@fountain-ui/core 3.0.0-alpha.3 → 3.0.0-alpha.31

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 (481) hide show
  1. package/build/commonjs/Accordion/Accordion.js +15 -8
  2. package/build/commonjs/Accordion/Accordion.js.map +1 -1
  3. package/build/commonjs/Accordion/AccordionProps.js.map +1 -1
  4. package/build/commonjs/Accordion/useVariantStyleMap.js +15 -8
  5. package/build/commonjs/Accordion/useVariantStyleMap.js.map +1 -1
  6. package/build/commonjs/AppBar/AppBar.js +7 -2
  7. package/build/commonjs/AppBar/AppBar.js.map +1 -1
  8. package/build/commonjs/Badge/Badge.js +4 -3
  9. package/build/commonjs/Badge/Badge.js.map +1 -1
  10. package/build/commonjs/Badge/BadgeProps.js.map +1 -1
  11. package/build/commonjs/Badge/useVariantStyleMap.js +2 -2
  12. package/build/commonjs/Badge/useVariantStyleMap.js.map +1 -1
  13. package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js +5 -2
  14. package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
  15. package/build/commonjs/BottomSheetTitle/BottomSheetTitleProps.js.map +1 -1
  16. package/build/commonjs/Button/Button.js +26 -12
  17. package/build/commonjs/Button/Button.js.map +1 -1
  18. package/build/commonjs/Button/ButtonProps.js.map +1 -1
  19. package/build/commonjs/Button/useVariantStyleMap.js +9 -0
  20. package/build/commonjs/Button/useVariantStyleMap.js.map +1 -1
  21. package/build/commonjs/ButtonBase/ButtonBase.js +1 -1
  22. package/build/commonjs/ButtonBase/ButtonBase.js.map +1 -1
  23. package/build/commonjs/ButtonBase/index.js +2 -2
  24. package/build/commonjs/ButtonBase/index.js.map +1 -1
  25. package/build/commonjs/Checkbox/Checkbox.js +4 -1
  26. package/build/commonjs/Checkbox/Checkbox.js.map +1 -1
  27. package/build/commonjs/Checkbox/useVariantStyleMap.js +6 -2
  28. package/build/commonjs/Checkbox/useVariantStyleMap.js.map +1 -1
  29. package/build/commonjs/Chip/Chip.js +25 -14
  30. package/build/commonjs/Chip/Chip.js.map +1 -1
  31. package/build/commonjs/Chip/ChipProps.js +3 -1
  32. package/build/commonjs/Chip/ChipProps.js.map +1 -1
  33. package/build/commonjs/Chip/index.js +6 -0
  34. package/build/commonjs/Chip/index.js.map +1 -1
  35. package/build/commonjs/Chip/useChipStyle.js +51 -31
  36. package/build/commonjs/Chip/useChipStyle.js.map +1 -1
  37. package/build/commonjs/Dialog/Dialog.js +10 -12
  38. package/build/commonjs/Dialog/Dialog.js.map +1 -1
  39. package/build/commonjs/Dialog/DialogProps.js +1 -1
  40. package/build/commonjs/Dialog/DialogProps.js.map +1 -1
  41. package/build/commonjs/Dialog/useDialogSectionStyle.js +6 -4
  42. package/build/commonjs/Dialog/useDialogSectionStyle.js.map +1 -1
  43. package/build/commonjs/Dialog/useDialogStyle.js +19 -8
  44. package/build/commonjs/Dialog/useDialogStyle.js.map +1 -1
  45. package/build/commonjs/DialogActions/DialogActions.js +0 -1
  46. package/build/commonjs/DialogActions/DialogActions.js.map +1 -1
  47. package/build/commonjs/DialogTitle/DialogLargeTitle.js +80 -0
  48. package/build/commonjs/DialogTitle/DialogLargeTitle.js.map +1 -0
  49. package/build/commonjs/DialogTitle/DialogTitle.js +8 -4
  50. package/build/commonjs/DialogTitle/DialogTitle.js.map +1 -1
  51. package/build/commonjs/Divider/Divider.js +17 -9
  52. package/build/commonjs/Divider/Divider.js.map +1 -1
  53. package/build/commonjs/Divider/DividerProps.js +1 -1
  54. package/build/commonjs/Divider/DividerProps.js.map +1 -1
  55. package/build/commonjs/Empty/Empty.js +1 -1
  56. package/build/commonjs/Empty/Empty.js.map +1 -1
  57. package/build/commonjs/Flexbox/Flexbox.js +2 -0
  58. package/build/commonjs/Flexbox/Flexbox.js.map +1 -1
  59. package/build/commonjs/Flexbox/FlexboxProps.js.map +1 -1
  60. package/build/commonjs/IconButton/IconButton.js +3 -0
  61. package/build/commonjs/IconButton/IconButton.js.map +1 -1
  62. package/build/commonjs/IconButton/IconButtonProps.js +1 -1
  63. package/build/commonjs/IconButton/IconButtonProps.js.map +1 -1
  64. package/build/commonjs/Image/Image.js +2 -2
  65. package/build/commonjs/Image/Image.js.map +1 -1
  66. package/build/commonjs/ImageCore/ImageCoreNative.js +1 -1
  67. package/build/commonjs/ImageCore/ImageCoreNative.js.map +1 -1
  68. package/build/commonjs/ListItem/ListItem.js +38 -26
  69. package/build/commonjs/ListItem/ListItem.js.map +1 -1
  70. package/build/commonjs/ListItem/ListItemProps.js.map +1 -1
  71. package/build/commonjs/ListItemIcon/ListItemIcon.js +1 -2
  72. package/build/commonjs/ListItemIcon/ListItemIcon.js.map +1 -1
  73. package/build/commonjs/ListItemSecondaryAction/ListItemSecondaryAction.js +2 -0
  74. package/build/commonjs/ListItemSecondaryAction/ListItemSecondaryAction.js.map +1 -1
  75. package/build/commonjs/ListItemText/ListItemText.js +20 -21
  76. package/build/commonjs/ListItemText/ListItemText.js.map +1 -1
  77. package/build/commonjs/ListItemText/ListItemTextProps.js.map +1 -1
  78. package/build/commonjs/ListSubheader/ListSubheader.js +1 -1
  79. package/build/commonjs/ListSubheader/ListSubheader.js.map +1 -1
  80. package/build/commonjs/Pagination/NumberPagination.js +4 -2
  81. package/build/commonjs/Pagination/NumberPagination.js.map +1 -1
  82. package/build/commonjs/Pagination/Pagination.js +2 -0
  83. package/build/commonjs/Pagination/Pagination.js.map +1 -1
  84. package/build/commonjs/Pagination/PaginationProps.js +3 -1
  85. package/build/commonjs/Pagination/PaginationProps.js.map +1 -1
  86. package/build/commonjs/Pagination/index.js +6 -0
  87. package/build/commonjs/Pagination/index.js.map +1 -1
  88. package/build/commonjs/PaginationItem/PaginationItem.js +32 -22
  89. package/build/commonjs/PaginationItem/PaginationItem.js.map +1 -1
  90. package/build/commonjs/PaginationItem/PaginationItemProps.js.map +1 -1
  91. package/build/commonjs/Radio/Radio.js +11 -4
  92. package/build/commonjs/Radio/Radio.js.map +1 -1
  93. package/build/commonjs/RadioGroup/RadioGroup.js +2 -27
  94. package/build/commonjs/RadioGroup/RadioGroup.js.map +1 -1
  95. package/build/commonjs/Section/Section.js +32 -0
  96. package/build/commonjs/Section/Section.js.map +1 -0
  97. package/build/commonjs/Section/SectionProps.js +2 -0
  98. package/build/commonjs/Section/SectionProps.js.map +1 -0
  99. package/build/commonjs/Section/index.js +16 -0
  100. package/build/commonjs/Section/index.js.map +1 -0
  101. package/build/commonjs/ShadowView/ShadowView.native.js +4 -0
  102. package/build/commonjs/ShadowView/ShadowView.native.js.map +1 -1
  103. package/build/commonjs/SnackbarContent/SnackbarContent.js +26 -9
  104. package/build/commonjs/SnackbarContent/SnackbarContent.js.map +1 -1
  105. package/build/commonjs/Tab/Tab.js +21 -19
  106. package/build/commonjs/Tab/Tab.js.map +1 -1
  107. package/build/commonjs/Tab/TabProps.js +4 -2
  108. package/build/commonjs/Tab/TabProps.js.map +1 -1
  109. package/build/commonjs/Tab/index.js +14 -0
  110. package/build/commonjs/Tab/index.js.map +1 -1
  111. package/build/commonjs/Tab/useVariantStyleMap.js +59 -18
  112. package/build/commonjs/Tab/useVariantStyleMap.js.map +1 -1
  113. package/build/commonjs/TabBase/TabBase.js +1 -8
  114. package/build/commonjs/TabBase/TabBase.js.map +1 -1
  115. package/build/commonjs/TabBase/TabBaseProps.js.map +1 -1
  116. package/build/commonjs/Tabs/Tabs.js +23 -7
  117. package/build/commonjs/Tabs/Tabs.js.map +1 -1
  118. package/build/commonjs/Tabs/TabsProps.js.map +1 -1
  119. package/build/commonjs/Tabs/index.js.map +1 -1
  120. package/build/commonjs/Tabs/useTabsStyle.js +80 -0
  121. package/build/commonjs/Tabs/useTabsStyle.js.map +1 -0
  122. package/build/commonjs/TextField/TextField.js +48 -12
  123. package/build/commonjs/TextField/TextField.js.map +1 -1
  124. package/build/commonjs/TextField/useVariantStyleMap.js +29 -29
  125. package/build/commonjs/TextField/useVariantStyleMap.js.map +1 -1
  126. package/build/commonjs/Toolbar/BackButton/BackButton.js +47 -0
  127. package/build/commonjs/Toolbar/BackButton/BackButton.js.map +1 -0
  128. package/build/commonjs/Toolbar/BackButton/BackButtonProps.js +2 -0
  129. package/build/commonjs/Toolbar/BackButton/BackButtonProps.js.map +1 -0
  130. package/build/commonjs/Toolbar/BackButton/index.js +16 -0
  131. package/build/commonjs/Toolbar/BackButton/index.js.map +1 -0
  132. package/build/commonjs/Toolbar/Toolbar.js +8 -4
  133. package/build/commonjs/Toolbar/Toolbar.js.map +1 -1
  134. package/build/commonjs/Tooltip/Beaks/index.js +32 -0
  135. package/build/commonjs/Tooltip/Beaks/index.js.map +1 -1
  136. package/build/commonjs/Tooltip/Tooltip.js +11 -18
  137. package/build/commonjs/Tooltip/Tooltip.js.map +1 -1
  138. package/build/commonjs/Tooltip/index.js +19 -0
  139. package/build/commonjs/Tooltip/index.js.map +1 -1
  140. package/build/commonjs/Typography/Typography.js +9 -2
  141. package/build/commonjs/Typography/Typography.js.map +1 -1
  142. package/build/commonjs/Typography/TypographyProps.js.map +1 -1
  143. package/build/commonjs/hooks/useBreakpointUp.js +4 -1
  144. package/build/commonjs/hooks/useBreakpointUp.js.map +1 -1
  145. package/build/commonjs/hooks/useCollapsibleAppBar.js +3 -10
  146. package/build/commonjs/hooks/useCollapsibleAppBar.js.map +1 -1
  147. package/build/commonjs/hooks/useContentContainerStyle.js +39 -25
  148. package/build/commonjs/hooks/useContentContainerStyle.js.map +1 -1
  149. package/build/commonjs/hooks/useFadeInAppBar.js +2 -2
  150. package/build/commonjs/hooks/useFadeInAppBar.js.map +1 -1
  151. package/build/commonjs/index.js +21 -0
  152. package/build/commonjs/index.js.map +1 -1
  153. package/build/commonjs/internal/icons/AppBarChevronLeft.js +23 -0
  154. package/build/commonjs/internal/icons/AppBarChevronLeft.js.map +1 -0
  155. package/build/commonjs/internal/icons/ChevronLeft.js +4 -2
  156. package/build/commonjs/internal/icons/ChevronLeft.js.map +1 -1
  157. package/build/commonjs/internal/icons/ChevronRight.js +4 -2
  158. package/build/commonjs/internal/icons/ChevronRight.js.map +1 -1
  159. package/build/commonjs/internal/icons/ChipClose.js +23 -0
  160. package/build/commonjs/internal/icons/ChipClose.js.map +1 -0
  161. package/build/commonjs/internal/icons/Clear.js +3 -3
  162. package/build/commonjs/internal/icons/Clear.js.map +1 -1
  163. package/build/commonjs/internal/icons/Close.js +4 -2
  164. package/build/commonjs/internal/icons/Close.js.map +1 -1
  165. package/build/commonjs/internal/icons/Search.js +2 -2
  166. package/build/commonjs/internal/icons/Search.js.map +1 -1
  167. package/build/commonjs/internal/icons/index.js +16 -0
  168. package/build/commonjs/internal/icons/index.js.map +1 -1
  169. package/build/module/Accordion/Accordion.js +15 -8
  170. package/build/module/Accordion/Accordion.js.map +1 -1
  171. package/build/module/Accordion/AccordionProps.js.map +1 -1
  172. package/build/module/Accordion/useVariantStyleMap.js +15 -8
  173. package/build/module/Accordion/useVariantStyleMap.js.map +1 -1
  174. package/build/module/AppBar/AppBar.js +6 -2
  175. package/build/module/AppBar/AppBar.js.map +1 -1
  176. package/build/module/Badge/Badge.js +4 -3
  177. package/build/module/Badge/Badge.js.map +1 -1
  178. package/build/module/Badge/BadgeProps.js.map +1 -1
  179. package/build/module/Badge/useVariantStyleMap.js +2 -2
  180. package/build/module/Badge/useVariantStyleMap.js.map +1 -1
  181. package/build/module/BottomSheetTitle/BottomSheetTitle.js +5 -2
  182. package/build/module/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
  183. package/build/module/BottomSheetTitle/BottomSheetTitleProps.js.map +1 -1
  184. package/build/module/Button/Button.js +27 -13
  185. package/build/module/Button/Button.js.map +1 -1
  186. package/build/module/Button/ButtonProps.js.map +1 -1
  187. package/build/module/Button/useVariantStyleMap.js +9 -0
  188. package/build/module/Button/useVariantStyleMap.js.map +1 -1
  189. package/build/module/ButtonBase/ButtonBase.js +1 -1
  190. package/build/module/ButtonBase/ButtonBase.js.map +1 -1
  191. package/build/module/ButtonBase/index.js +1 -1
  192. package/build/module/ButtonBase/index.js.map +1 -1
  193. package/build/module/Checkbox/Checkbox.js +4 -1
  194. package/build/module/Checkbox/Checkbox.js.map +1 -1
  195. package/build/module/Checkbox/useVariantStyleMap.js +6 -2
  196. package/build/module/Checkbox/useVariantStyleMap.js.map +1 -1
  197. package/build/module/Chip/Chip.js +21 -13
  198. package/build/module/Chip/Chip.js.map +1 -1
  199. package/build/module/Chip/ChipProps.js +1 -0
  200. package/build/module/Chip/ChipProps.js.map +1 -1
  201. package/build/module/Chip/index.js +1 -1
  202. package/build/module/Chip/index.js.map +1 -1
  203. package/build/module/Chip/useChipStyle.js +51 -31
  204. package/build/module/Chip/useChipStyle.js.map +1 -1
  205. package/build/module/Dialog/Dialog.js +10 -11
  206. package/build/module/Dialog/Dialog.js.map +1 -1
  207. package/build/module/Dialog/DialogProps.js +1 -1
  208. package/build/module/Dialog/DialogProps.js.map +1 -1
  209. package/build/module/Dialog/useDialogSectionStyle.js +6 -4
  210. package/build/module/Dialog/useDialogSectionStyle.js.map +1 -1
  211. package/build/module/Dialog/useDialogStyle.js +18 -8
  212. package/build/module/Dialog/useDialogStyle.js.map +1 -1
  213. package/build/module/DialogActions/DialogActions.js +0 -1
  214. package/build/module/DialogActions/DialogActions.js.map +1 -1
  215. package/build/module/DialogTitle/DialogLargeTitle.js +65 -0
  216. package/build/module/DialogTitle/DialogLargeTitle.js.map +1 -0
  217. package/build/module/DialogTitle/DialogTitle.js +6 -3
  218. package/build/module/DialogTitle/DialogTitle.js.map +1 -1
  219. package/build/module/Divider/Divider.js +7 -0
  220. package/build/module/Divider/Divider.js.map +1 -1
  221. package/build/module/Divider/DividerProps.js +1 -1
  222. package/build/module/Divider/DividerProps.js.map +1 -1
  223. package/build/module/Empty/Empty.js +1 -1
  224. package/build/module/Empty/Empty.js.map +1 -1
  225. package/build/module/Flexbox/Flexbox.js +2 -0
  226. package/build/module/Flexbox/Flexbox.js.map +1 -1
  227. package/build/module/Flexbox/FlexboxProps.js.map +1 -1
  228. package/build/module/IconButton/IconButton.js +3 -0
  229. package/build/module/IconButton/IconButton.js.map +1 -1
  230. package/build/module/IconButton/IconButtonProps.js +1 -1
  231. package/build/module/IconButton/IconButtonProps.js.map +1 -1
  232. package/build/module/Image/Image.js +2 -2
  233. package/build/module/Image/Image.js.map +1 -1
  234. package/build/module/ImageCore/ImageCoreNative.js +1 -1
  235. package/build/module/ImageCore/ImageCoreNative.js.map +1 -1
  236. package/build/module/ListItem/ListItem.js +36 -28
  237. package/build/module/ListItem/ListItem.js.map +1 -1
  238. package/build/module/ListItem/ListItemProps.js.map +1 -1
  239. package/build/module/ListItemIcon/ListItemIcon.js +1 -2
  240. package/build/module/ListItemIcon/ListItemIcon.js.map +1 -1
  241. package/build/module/ListItemSecondaryAction/ListItemSecondaryAction.js +2 -0
  242. package/build/module/ListItemSecondaryAction/ListItemSecondaryAction.js.map +1 -1
  243. package/build/module/ListItemText/ListItemText.js +17 -19
  244. package/build/module/ListItemText/ListItemText.js.map +1 -1
  245. package/build/module/ListItemText/ListItemTextProps.js.map +1 -1
  246. package/build/module/ListSubheader/ListSubheader.js +1 -1
  247. package/build/module/ListSubheader/ListSubheader.js.map +1 -1
  248. package/build/module/Pagination/NumberPagination.js +4 -2
  249. package/build/module/Pagination/NumberPagination.js.map +1 -1
  250. package/build/module/Pagination/Pagination.js +2 -0
  251. package/build/module/Pagination/Pagination.js.map +1 -1
  252. package/build/module/Pagination/PaginationProps.js +1 -0
  253. package/build/module/Pagination/PaginationProps.js.map +1 -1
  254. package/build/module/Pagination/index.js +1 -1
  255. package/build/module/Pagination/index.js.map +1 -1
  256. package/build/module/PaginationItem/PaginationItem.js +28 -21
  257. package/build/module/PaginationItem/PaginationItem.js.map +1 -1
  258. package/build/module/PaginationItem/PaginationItemProps.js.map +1 -1
  259. package/build/module/Radio/Radio.js +10 -4
  260. package/build/module/Radio/Radio.js.map +1 -1
  261. package/build/module/RadioGroup/RadioGroup.js +2 -20
  262. package/build/module/RadioGroup/RadioGroup.js.map +1 -1
  263. package/build/module/Section/Section.js +19 -0
  264. package/build/module/Section/Section.js.map +1 -0
  265. package/build/module/Section/SectionProps.js +2 -0
  266. package/build/module/Section/SectionProps.js.map +1 -0
  267. package/build/module/Section/index.js +2 -0
  268. package/build/module/Section/index.js.map +1 -0
  269. package/build/module/ShadowView/ShadowView.native.js +4 -0
  270. package/build/module/ShadowView/ShadowView.native.js.map +1 -1
  271. package/build/module/SnackbarContent/SnackbarContent.js +26 -9
  272. package/build/module/SnackbarContent/SnackbarContent.js.map +1 -1
  273. package/build/module/Tab/Tab.js +22 -19
  274. package/build/module/Tab/Tab.js.map +1 -1
  275. package/build/module/Tab/TabProps.js +2 -1
  276. package/build/module/Tab/TabProps.js.map +1 -1
  277. package/build/module/Tab/index.js +1 -0
  278. package/build/module/Tab/index.js.map +1 -1
  279. package/build/module/Tab/useVariantStyleMap.js +59 -18
  280. package/build/module/Tab/useVariantStyleMap.js.map +1 -1
  281. package/build/module/TabBase/TabBase.js +1 -8
  282. package/build/module/TabBase/TabBase.js.map +1 -1
  283. package/build/module/TabBase/TabBaseProps.js.map +1 -1
  284. package/build/module/Tabs/Tabs.js +21 -7
  285. package/build/module/Tabs/Tabs.js.map +1 -1
  286. package/build/module/Tabs/TabsProps.js.map +1 -1
  287. package/build/module/Tabs/index.js.map +1 -1
  288. package/build/module/Tabs/useTabsStyle.js +70 -0
  289. package/build/module/Tabs/useTabsStyle.js.map +1 -0
  290. package/build/module/TextField/TextField.js +48 -12
  291. package/build/module/TextField/TextField.js.map +1 -1
  292. package/build/module/TextField/useVariantStyleMap.js +29 -29
  293. package/build/module/TextField/useVariantStyleMap.js.map +1 -1
  294. package/build/module/Toolbar/BackButton/BackButton.js +32 -0
  295. package/build/module/Toolbar/BackButton/BackButton.js.map +1 -0
  296. package/build/module/Toolbar/BackButton/BackButtonProps.js +2 -0
  297. package/build/module/Toolbar/BackButton/BackButtonProps.js.map +1 -0
  298. package/build/module/Toolbar/BackButton/index.js +2 -0
  299. package/build/module/Toolbar/BackButton/index.js.map +1 -0
  300. package/build/module/Toolbar/Toolbar.js +7 -3
  301. package/build/module/Toolbar/Toolbar.js.map +1 -1
  302. package/build/module/Tooltip/Beaks/index.js +4 -0
  303. package/build/module/Tooltip/Beaks/index.js.map +1 -1
  304. package/build/module/Tooltip/Tooltip.js +4 -10
  305. package/build/module/Tooltip/Tooltip.js.map +1 -1
  306. package/build/module/Tooltip/index.js +1 -0
  307. package/build/module/Tooltip/index.js.map +1 -1
  308. package/build/module/Typography/Typography.js +9 -2
  309. package/build/module/Typography/Typography.js.map +1 -1
  310. package/build/module/Typography/TypographyProps.js.map +1 -1
  311. package/build/module/hooks/useBreakpointUp.js +4 -1
  312. package/build/module/hooks/useBreakpointUp.js.map +1 -1
  313. package/build/module/hooks/useCollapsibleAppBar.js +4 -10
  314. package/build/module/hooks/useCollapsibleAppBar.js.map +1 -1
  315. package/build/module/hooks/useContentContainerStyle.js +43 -25
  316. package/build/module/hooks/useContentContainerStyle.js.map +1 -1
  317. package/build/module/hooks/useFadeInAppBar.js +2 -2
  318. package/build/module/hooks/useFadeInAppBar.js.map +1 -1
  319. package/build/module/index.js +2 -0
  320. package/build/module/index.js.map +1 -1
  321. package/build/module/internal/icons/AppBarChevronLeft.js +9 -0
  322. package/build/module/internal/icons/AppBarChevronLeft.js.map +1 -0
  323. package/build/module/internal/icons/ChevronLeft.js +4 -2
  324. package/build/module/internal/icons/ChevronLeft.js.map +1 -1
  325. package/build/module/internal/icons/ChevronRight.js +4 -2
  326. package/build/module/internal/icons/ChevronRight.js.map +1 -1
  327. package/build/module/internal/icons/ChipClose.js +9 -0
  328. package/build/module/internal/icons/ChipClose.js.map +1 -0
  329. package/build/module/internal/icons/Clear.js +3 -3
  330. package/build/module/internal/icons/Clear.js.map +1 -1
  331. package/build/module/internal/icons/Close.js +4 -2
  332. package/build/module/internal/icons/Close.js.map +1 -1
  333. package/build/module/internal/icons/Search.js +2 -2
  334. package/build/module/internal/icons/Search.js.map +1 -1
  335. package/build/module/internal/icons/index.js +2 -0
  336. package/build/module/internal/icons/index.js.map +1 -1
  337. package/build/typescript/Accordion/AccordionProps.d.ts +4 -1
  338. package/build/typescript/Accordion/useVariantStyleMap.d.ts +1 -0
  339. package/build/typescript/Badge/BadgeProps.d.ts +10 -5
  340. package/build/typescript/BottomSheetTitle/BottomSheetTitleProps.d.ts +1 -0
  341. package/build/typescript/Button/ButtonProps.d.ts +5 -0
  342. package/build/typescript/ButtonBase/index.d.ts +1 -1
  343. package/build/typescript/Checkbox/useVariantStyleMap.d.ts +1 -0
  344. package/build/typescript/Chip/ChipProps.d.ts +11 -4
  345. package/build/typescript/Chip/index.d.ts +1 -1
  346. package/build/typescript/Chip/useChipStyle.d.ts +6 -3
  347. package/build/typescript/Dialog/DialogProps.d.ts +1 -6
  348. package/build/typescript/Dialog/useDialogStyle.d.ts +1 -1
  349. package/build/typescript/DialogTitle/DialogLargeTitle.d.ts +9 -0
  350. package/build/typescript/DialogTitle/DialogTitle.d.ts +6 -1
  351. package/build/typescript/Divider/DividerProps.d.ts +1 -1
  352. package/build/typescript/Flexbox/FlexboxProps.d.ts +4 -0
  353. package/build/typescript/IconButton/IconButtonProps.d.ts +1 -1
  354. package/build/typescript/ListItem/ListItem.d.ts +1 -1
  355. package/build/typescript/ListItem/ListItemProps.d.ts +4 -0
  356. package/build/typescript/ListItemText/ListItemTextProps.d.ts +2 -9
  357. package/build/typescript/Pagination/PaginationProps.d.ts +12 -0
  358. package/build/typescript/Pagination/index.d.ts +2 -2
  359. package/build/typescript/PaginationItem/PaginationItemProps.d.ts +6 -0
  360. package/build/typescript/Section/Section.d.ts +3 -0
  361. package/build/typescript/Section/SectionProps.d.ts +6 -0
  362. package/build/typescript/Section/index.d.ts +2 -0
  363. package/build/typescript/Tab/TabProps.d.ts +21 -2
  364. package/build/typescript/Tab/index.d.ts +2 -1
  365. package/build/typescript/Tab/useVariantStyleMap.d.ts +4 -2
  366. package/build/typescript/TabBase/TabBaseProps.d.ts +0 -5
  367. package/build/typescript/Tabs/Tabs.d.ts +1 -1
  368. package/build/typescript/Tabs/TabsProps.d.ts +6 -1
  369. package/build/typescript/Tabs/index.d.ts +1 -1
  370. package/build/typescript/Tabs/useTabsStyle.d.ts +8 -0
  371. package/build/typescript/TextField/useVariantStyleMap.d.ts +2 -0
  372. package/build/typescript/Toolbar/BackButton/BackButton.d.ts +3 -0
  373. package/build/typescript/Toolbar/BackButton/BackButtonProps.d.ts +4 -0
  374. package/build/typescript/Toolbar/BackButton/index.d.ts +2 -0
  375. package/build/typescript/Toolbar/Toolbar.d.ts +6 -1
  376. package/build/typescript/Tooltip/Beaks/index.d.ts +4 -0
  377. package/build/typescript/Tooltip/index.d.ts +1 -0
  378. package/build/typescript/Typography/TypographyProps.d.ts +4 -0
  379. package/build/typescript/hooks/useCollapsibleAppBar.d.ts +0 -1
  380. package/build/typescript/hooks/useContentContainerStyle.d.ts +5 -8
  381. package/build/typescript/index.d.ts +2 -0
  382. package/build/typescript/internal/icons/AppBarChevronLeft.d.ts +131 -0
  383. package/build/typescript/internal/icons/ChipClose.d.ts +131 -0
  384. package/build/typescript/internal/icons/index.d.ts +2 -0
  385. package/package.json +5 -5
  386. package/src/Accordion/Accordion.tsx +18 -9
  387. package/src/Accordion/AccordionProps.ts +4 -2
  388. package/src/Accordion/useVariantStyleMap.ts +14 -6
  389. package/src/AppBar/AppBar.tsx +5 -1
  390. package/src/Badge/Badge.tsx +4 -3
  391. package/src/Badge/BadgeProps.ts +12 -6
  392. package/src/Badge/useVariantStyleMap.ts +2 -2
  393. package/src/BottomSheetTitle/BottomSheetTitle.tsx +4 -1
  394. package/src/BottomSheetTitle/BottomSheetTitleProps.ts +1 -0
  395. package/src/Button/Button.tsx +28 -12
  396. package/src/Button/ButtonProps.ts +6 -0
  397. package/src/Button/useVariantStyleMap.ts +9 -0
  398. package/src/ButtonBase/ButtonBase.tsx +1 -1
  399. package/src/ButtonBase/index.ts +1 -1
  400. package/src/Checkbox/Checkbox.tsx +11 -8
  401. package/src/Checkbox/useVariantStyleMap.ts +6 -1
  402. package/src/Chip/Chip.tsx +24 -13
  403. package/src/Chip/ChipProps.ts +13 -4
  404. package/src/Chip/index.ts +1 -1
  405. package/src/Chip/useChipStyle.ts +59 -29
  406. package/src/Dialog/Dialog.tsx +12 -11
  407. package/src/Dialog/DialogProps.ts +1 -7
  408. package/src/Dialog/useDialogSectionStyle.ts +6 -4
  409. package/src/Dialog/useDialogStyle.ts +19 -7
  410. package/src/DialogActions/DialogActions.tsx +0 -1
  411. package/src/DialogTitle/DialogLargeTitle.tsx +95 -0
  412. package/src/DialogTitle/DialogTitle.tsx +6 -1
  413. package/src/Divider/Divider.tsx +5 -0
  414. package/src/Divider/DividerProps.ts +1 -1
  415. package/src/Empty/Empty.tsx +1 -1
  416. package/src/Flexbox/Flexbox.tsx +2 -0
  417. package/src/Flexbox/FlexboxProps.ts +5 -0
  418. package/src/IconButton/IconButton.tsx +2 -0
  419. package/src/IconButton/IconButtonProps.ts +1 -0
  420. package/src/Image/Image.tsx +3 -3
  421. package/src/ImageCore/ImageCoreNative.tsx +1 -1
  422. package/src/ListItem/ListItem.tsx +61 -30
  423. package/src/ListItem/ListItemProps.ts +5 -0
  424. package/src/ListItemIcon/ListItemIcon.tsx +1 -2
  425. package/src/ListItemSecondaryAction/ListItemSecondaryAction.tsx +2 -0
  426. package/src/ListItemText/ListItemText.tsx +20 -28
  427. package/src/ListItemText/ListItemTextProps.ts +2 -10
  428. package/src/ListSubheader/ListSubheader.tsx +1 -1
  429. package/src/Pagination/NumberPagination.tsx +7 -2
  430. package/src/Pagination/Pagination.tsx +3 -2
  431. package/src/Pagination/PaginationProps.ts +15 -0
  432. package/src/Pagination/index.ts +2 -2
  433. package/src/PaginationItem/PaginationItem.tsx +31 -24
  434. package/src/PaginationItem/PaginationItemProps.ts +7 -0
  435. package/src/Radio/Radio.tsx +12 -3
  436. package/src/RadioGroup/RadioGroup.tsx +2 -28
  437. package/src/Section/Section.tsx +26 -0
  438. package/src/Section/SectionProps.ts +6 -0
  439. package/src/Section/index.ts +2 -0
  440. package/src/ShadowView/ShadowView.native.tsx +4 -0
  441. package/src/SnackbarContent/SnackbarContent.tsx +36 -15
  442. package/src/Tab/Tab.tsx +32 -22
  443. package/src/Tab/TabProps.ts +25 -2
  444. package/src/Tab/index.ts +2 -1
  445. package/src/Tab/useVariantStyleMap.ts +72 -19
  446. package/src/TabBase/TabBase.tsx +1 -9
  447. package/src/TabBase/TabBaseProps.ts +0 -6
  448. package/src/Tabs/Tabs.tsx +26 -8
  449. package/src/Tabs/TabsProps.ts +7 -1
  450. package/src/Tabs/index.ts +1 -1
  451. package/src/Tabs/useTabsStyle.ts +77 -0
  452. package/src/TextField/TextField.tsx +69 -26
  453. package/src/TextField/useVariantStyleMap.ts +29 -27
  454. package/src/Toolbar/BackButton/BackButton.tsx +44 -0
  455. package/src/Toolbar/BackButton/BackButtonProps.ts +4 -0
  456. package/src/Toolbar/BackButton/index.ts +2 -0
  457. package/src/Toolbar/Toolbar.tsx +6 -1
  458. package/src/Tooltip/Beaks/index.ts +4 -0
  459. package/src/Tooltip/Tooltip.tsx +4 -9
  460. package/src/Tooltip/index.ts +1 -0
  461. package/src/Typography/Typography.tsx +3 -1
  462. package/src/Typography/TypographyProps.ts +5 -0
  463. package/src/hooks/useBreakpointUp.ts +3 -1
  464. package/src/hooks/useCollapsibleAppBar.ts +4 -23
  465. package/src/hooks/useContentContainerStyle.ts +43 -31
  466. package/src/hooks/useFadeInAppBar.ts +2 -2
  467. package/src/index.ts +3 -0
  468. package/src/internal/icons/AppBarChevronLeft.tsx +15 -0
  469. package/src/internal/icons/ChevronLeft.tsx +4 -1
  470. package/src/internal/icons/ChevronRight.tsx +4 -1
  471. package/src/internal/icons/ChipClose.tsx +13 -0
  472. package/src/internal/icons/Clear.tsx +3 -3
  473. package/src/internal/icons/Close.tsx +4 -1
  474. package/src/internal/icons/Search.tsx +2 -2
  475. package/src/internal/icons/index.ts +2 -0
  476. package/build/commonjs/ButtonBase/LegacyButtonBase.js +0 -126
  477. package/build/commonjs/ButtonBase/LegacyButtonBase.js.map +0 -1
  478. package/build/module/ButtonBase/LegacyButtonBase.js +0 -106
  479. package/build/module/ButtonBase/LegacyButtonBase.js.map +0 -1
  480. package/build/typescript/ButtonBase/LegacyButtonBase.d.ts +0 -5
  481. package/src/ButtonBase/LegacyButtonBase.tsx +0 -135
@@ -11,11 +11,9 @@ var _reactNative = require("react-native");
11
11
 
12
12
  var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
13
13
 
14
- var _styles = require("@fountain-ui/styles");
15
-
16
14
  var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
17
15
 
18
- var _styles2 = require("../styles");
16
+ var _styles = require("../styles");
19
17
 
20
18
  var _Beaks = _interopRequireDefault(require("./Beaks"));
21
19
 
@@ -57,7 +55,7 @@ const getFlexDirection = placement => {
57
55
  };
58
56
 
59
57
  const useStyles = function () {
60
- const theme = (0, _styles2.useTheme)();
58
+ const theme = (0, _styles.useTheme)();
61
59
  return {
62
60
  root: {
63
61
  position: 'absolute',
@@ -70,14 +68,14 @@ const useStyles = function () {
70
68
  },
71
69
  small: {
72
70
  borderRadius: theme.shape.radius.sm,
71
+ paddingBottom: theme.spacing(1.75),
73
72
  paddingHorizontal: theme.spacing(2),
74
- paddingVertical: theme.spacing(1.5)
73
+ paddingTop: theme.spacing(1.5)
75
74
  },
76
75
  large: {
77
76
  borderRadius: 5,
78
- paddingBottom: theme.spacing(2.5),
79
77
  paddingHorizontal: theme.spacing(4),
80
- paddingTop: theme.spacing(2)
78
+ paddingVertical: theme.spacing(2)
81
79
  }
82
80
  };
83
81
  };
@@ -103,7 +101,7 @@ function Tooltip(props) {
103
101
  offset: beakOffset,
104
102
  placement: beakPlacement
105
103
  } = beakLayout;
106
- const theme = (0, _styles2.useTheme)();
104
+ const theme = (0, _styles.useTheme)();
107
105
  const styles = useStyles();
108
106
  const [layout, setLayout] = (0, _react.useState)(initialLayout);
109
107
  const scale = (0, _reactNativeReanimated.useSharedValue)(0);
@@ -130,7 +128,7 @@ function Tooltip(props) {
130
128
  }),
131
129
  [placement]: totalOffset
132
130
  };
133
- const contentStyle = (0, _styles2.css)([styles.content, styles[size], isVerticalPlacement ? {
131
+ const contentStyle = (0, _styles.css)([styles.content, styles[size], isVerticalPlacement ? {
134
132
  width: '100%'
135
133
  } : {
136
134
  flexGrow: 1,
@@ -140,19 +138,14 @@ function Tooltip(props) {
140
138
  const nextScaleValue = visible ? 1 : 0;
141
139
  scale.value = (0, _reactNativeReanimated.withTiming)(nextScaleValue, ANIMATION_CONFIG);
142
140
  }, [visible]);
143
- const fontStyle = (0, _styles2.createFontStyle)(theme, {
144
- selector: typo => size === 'large' ? (0, _styles.typographyOf)({
145
- fontSize: 13,
146
- lineHeight: 19.5,
147
- fontFamily: 'Pretendard-Regular',
148
- letterSpacing: 0
149
- }) : typo.caption2.regular,
141
+ const fontStyle = (0, _styles.createFontStyle)(theme, {
142
+ selector: typo => size === 'large' ? typo.body3.regular : typo.caption2.regular,
150
143
  color: theme.palette.text.strongInverse
151
144
  });
152
- const textStyle = (0, _styles2.css)([fontStyle, {
145
+ const textStyle = (0, _styles.css)([fontStyle, {
153
146
  flexShrink: 1
154
147
  }]);
155
- const beakStyle = (0, _styles2.css)({
148
+ const beakStyle = (0, _styles.css)({
156
149
  transform: [isVerticalPlacement ? {
157
150
  translateX: beakOffset
158
151
  } : {
@@ -1 +1 @@
1
- {"version":3,"names":["DEFAULT_BEAK_LAYOUT","offset","placement","INITIAL_LAYOUT","width","height","x","y","ANIMATION_CONFIG","duration","getFlexDirection","useStyles","theme","useTheme","root","position","zIndex","tooltip","content","backgroundColor","palette","fill","base","paddingHorizontal","spacing","paddingVertical","small","borderRadius","shape","radius","sm","large","paddingBottom","paddingTop","Tooltip","props","beakLayout","children","initialLayout","left","onClose","right","numberOfTitleLines","size","style","title","tooltipStyle","verticalOffset","visible","beakOffset","beakPlacement","styles","layout","setLayout","useState","scale","useSharedValue","animatedStyle","useAnimatedStyle","transform","value","flexDirection","isVerticalPlacement","totalOffset","tooltipLayoutStyle","alignItems","undefined","overflow","Platform","select","web","display","default","contentStyle","css","flexGrow","flexShrink","useEffect","nextScaleValue","withTiming","fontStyle","createFontStyle","selector","typo","typographyOf","fontSize","lineHeight","fontFamily","letterSpacing","caption2","regular","color","text","strongInverse","textStyle","beakStyle","translateX","translateY","buttonElem","beakElem","event","nativeEvent"],"sources":["Tooltip.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Platform, Text, View, ViewProps } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { typographyOf } from '@fountain-ui/styles';\nimport ButtonBase from '../ButtonBase';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport type TooltipProps from './TooltipProps';\nimport type { TooltipBeakLayout, TooltipPlacement, TooltipSize } from './TooltipProps';\nimport Beak from './Beaks';\n\nconst DEFAULT_BEAK_LAYOUT: TooltipBeakLayout = {\n offset: 0,\n placement: 'middle',\n};\n\nconst INITIAL_LAYOUT = { width: 0, height: 0, x: 0, y: 0 };\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 150 };\n\ntype FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';\n\nconst getFlexDirection = (placement: TooltipPlacement): FlexDirection => {\n switch (placement) {\n case 'right':\n return 'row-reverse';\n case 'bottom':\n return 'column-reverse';\n case 'left':\n return 'row';\n case 'top':\n default:\n return 'column';\n }\n};\n\ntype TooltipStyles = NamedStylesStringUnion<'root' | 'content' | 'small' | 'large'>;\n\nconst useStyles: UseStyles<TooltipStyles> = function (): TooltipStyles {\n const theme = useTheme();\n\n return {\n root: {\n position: 'absolute',\n zIndex: theme.zIndex.tooltip,\n },\n content: {\n backgroundColor: theme.palette.fill.base,\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1.5),\n },\n small: {\n borderRadius: theme.shape.radius.sm,\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1.5),\n },\n large: {\n borderRadius: 5,\n paddingBottom: theme.spacing(2.5),\n paddingHorizontal: theme.spacing(4),\n paddingTop: theme.spacing(2),\n },\n };\n};\n\nexport default function Tooltip(props: TooltipProps) {\n const {\n beakLayout = DEFAULT_BEAK_LAYOUT,\n children,\n initialLayout = INITIAL_LAYOUT,\n left,\n onClose,\n placement = 'top' as TooltipPlacement,\n right,\n numberOfTitleLines = 1,\n size = 'small' as TooltipSize,\n style,\n title,\n tooltipStyle,\n verticalOffset = 4,\n visible = false,\n } = props;\n\n const {\n offset: beakOffset,\n placement: beakPlacement,\n } = beakLayout;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const [layout, setLayout] = useState(initialLayout);\n\n const scale = useSharedValue(0);\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scale.value }],\n }), []);\n\n const flexDirection = getFlexDirection(placement);\n\n const isVerticalPlacement = placement === 'top' || placement === 'bottom';\n\n const totalOffset = -((isVerticalPlacement ? layout.height : layout.width) + verticalOffset);\n const tooltipLayoutStyle: ViewProps['style'] = {\n alignItems: beakPlacement === 'start'\n ? 'flex-start'\n : beakPlacement === 'end'\n ? 'flex-end'\n : 'center',\n flexDirection,\n left,\n right,\n height: visible ? undefined : 0,\n overflow: visible ? undefined : 'hidden',\n ...Platform.select({\n web: {\n display: visible ? 'flex' : 'none',\n },\n default: {},\n }),\n [placement]: totalOffset,\n };\n\n const contentStyle = css([\n styles.content,\n styles[size],\n isVerticalPlacement\n ? { width: '100%' }\n : { flexGrow: 1, flexShrink: 1 },\n ]);\n\n useEffect(() => {\n const nextScaleValue = visible ? 1 : 0;\n\n scale.value = withTiming(nextScaleValue, ANIMATION_CONFIG);\n }, [visible]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => size === 'large'\n ? typographyOf({\n fontSize: 13,\n lineHeight: 19.5,\n fontFamily: 'Pretendard-Regular',\n letterSpacing: 0,\n })\n : typo.caption2.regular,\n color: theme.palette.text.strongInverse,\n });\n\n const textStyle = css([\n fontStyle,\n { flexShrink: 1 },\n ]);\n\n const beakStyle = css({\n transform: [isVerticalPlacement ? { translateX: beakOffset } : { translateY: beakOffset }],\n });\n\n const buttonElem = (\n <ButtonBase\n pressEffect={'none'}\n onPress={onClose}\n style={contentStyle}\n >\n <Text\n // TODO: Should we provide text prop customization?\n numberOfLines={numberOfTitleLines}\n style={textStyle}\n >\n {title}\n </Text>\n </ButtonBase>\n );\n\n const beakElem = (\n <View style={beakStyle}>\n <Beak\n fill={theme.palette.fill.base}\n placement={placement}\n size={size}\n />\n </View>\n );\n\n return (\n <View style={style}>\n {children}\n\n <Animated.View\n onLayout={(event) => {\n if (event.nativeEvent.layout.height === 0) {\n return;\n }\n\n setLayout(event.nativeEvent.layout);\n }}\n style={[\n styles.root,\n animatedStyle,\n tooltipLayoutStyle,\n tooltipStyle,\n ]}\n >\n {buttonElem}\n\n {beakElem}\n </Animated.View>\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAEA;;AACA;;AACA;;AAGA;;;;;;;;AAEA,MAAMA,mBAAsC,GAAG;EAC3CC,MAAM,EAAE,CADmC;EAE3CC,SAAS,EAAE;AAFgC,CAA/C;AAKA,MAAMC,cAAc,GAAG;EAAEC,KAAK,EAAE,CAAT;EAAYC,MAAM,EAAE,CAApB;EAAuBC,CAAC,EAAE,CAA1B;EAA6BC,CAAC,EAAE;AAAhC,CAAvB;AAEA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;;AAIA,MAAMC,gBAAgB,GAAIR,SAAD,IAAgD;EACrE,QAAQA,SAAR;IACI,KAAK,OAAL;MACI,OAAO,aAAP;;IACJ,KAAK,QAAL;MACI,OAAO,gBAAP;;IACJ,KAAK,MAAL;MACI,OAAO,KAAP;;IAC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AFb;IAGI,KAAK,EAAEiC;EAHX,gBAKI,6BAAC,iBAAD,CACI;EADJ;IAEI,aAAa,EAAE/B,kBAFnB;IAGI,KAAK,EAAEoD;EAHX,GAKKjD,KALL,CALJ,CADJ;;EAgBA,MAAMsD,QAAQ,gBACV,6BAAC,iBAAD;IAAM,KAAK,EAAEJ;EAAb,gBACI,6BAAC,cAAD;IACI,IAAI,EAAEnF,KAAK,CAACQ,OAAN,CAAcC,IAAd,CAAmBC,IAD7B;IAEI,SAAS,EAAEpB,SAFf;IAGI,IAAI,EAAEyC;EAHV,EADJ,CADJ;;EAUA,oBACI,6BAAC,iBAAD;IAAM,KAAK,EAAEC;EAAb,GACKP,QADL,eAGI,6BAAC,8BAAD,CAAU,IAAV;IACI,QAAQ,EAAG+D,KAAD,IAAW;MACjB,IAAIA,KAAK,CAACC,WAAN,CAAkBjD,MAAlB,CAAyB/C,MAAzB,KAAoC,CAAxC,EAA2C;QACvC;MACH;;MAEDgD,SAAS,CAAC+C,KAAK,CAACC,WAAN,CAAkBjD,MAAnB,CAAT;IACH,CAPL;IAQI,KAAK,EAAE,CACHD,MAAM,CAACrC,IADJ,EAEH2C,aAFG,EAGHO,kBAHG,EAIHlB,YAJG;EARX,GAeKoD,UAfL,EAiBKC,QAjBL,CAHJ,CADJ;AAyBH;;AAAA"}
1
+ {"version":3,"names":["DEFAULT_BEAK_LAYOUT","offset","placement","INITIAL_LAYOUT","width","height","x","y","ANIMATION_CONFIG","duration","getFlexDirection","useStyles","theme","useTheme","root","position","zIndex","tooltip","content","backgroundColor","palette","fill","base","paddingHorizontal","spacing","paddingVertical","small","borderRadius","shape","radius","sm","paddingBottom","paddingTop","large","Tooltip","props","beakLayout","children","initialLayout","left","onClose","right","numberOfTitleLines","size","style","title","tooltipStyle","verticalOffset","visible","beakOffset","beakPlacement","styles","layout","setLayout","useState","scale","useSharedValue","animatedStyle","useAnimatedStyle","transform","value","flexDirection","isVerticalPlacement","totalOffset","tooltipLayoutStyle","alignItems","undefined","overflow","Platform","select","web","display","default","contentStyle","css","flexGrow","flexShrink","useEffect","nextScaleValue","withTiming","fontStyle","createFontStyle","selector","typo","body3","regular","caption2","color","text","strongInverse","textStyle","beakStyle","translateX","translateY","buttonElem","beakElem","event","nativeEvent"],"sources":["Tooltip.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Platform, Text, View, ViewProps } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport type { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { typographyOf } from '@fountain-ui/styles';\nimport ButtonBase from '../ButtonBase';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport type TooltipProps from './TooltipProps';\nimport type { TooltipBeakLayout, TooltipPlacement, TooltipSize } from './TooltipProps';\nimport Beak from './Beaks';\n\nconst DEFAULT_BEAK_LAYOUT: TooltipBeakLayout = {\n offset: 0,\n placement: 'middle',\n};\n\nconst INITIAL_LAYOUT = { width: 0, height: 0, x: 0, y: 0 };\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 150 };\n\ntype FlexDirection = 'row' | 'column' | 'row-reverse' | 'column-reverse';\n\nconst getFlexDirection = (placement: TooltipPlacement): FlexDirection => {\n switch (placement) {\n case 'right':\n return 'row-reverse';\n case 'bottom':\n return 'column-reverse';\n case 'left':\n return 'row';\n case 'top':\n default:\n return 'column';\n }\n};\n\ntype TooltipStyles = NamedStylesStringUnion<'root' | 'content' | 'small' | 'large'>;\n\nconst useStyles: UseStyles<TooltipStyles> = function (): TooltipStyles {\n const theme = useTheme();\n\n return {\n root: {\n position: 'absolute',\n zIndex: theme.zIndex.tooltip,\n },\n content: {\n backgroundColor: theme.palette.fill.base,\n paddingHorizontal: theme.spacing(2),\n paddingVertical: theme.spacing(1.5),\n },\n small: {\n borderRadius: theme.shape.radius.sm,\n paddingBottom: theme.spacing(1.75),\n paddingHorizontal: theme.spacing(2),\n paddingTop: theme.spacing(1.5),\n },\n large: {\n borderRadius: 5,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(2),\n },\n };\n};\n\nexport default function Tooltip(props: TooltipProps) {\n const {\n beakLayout = DEFAULT_BEAK_LAYOUT,\n children,\n initialLayout = INITIAL_LAYOUT,\n left,\n onClose,\n placement = 'top' as TooltipPlacement,\n right,\n numberOfTitleLines = 1,\n size = 'small' as TooltipSize,\n style,\n title,\n tooltipStyle,\n verticalOffset = 4,\n visible = false,\n } = props;\n\n const {\n offset: beakOffset,\n placement: beakPlacement,\n } = beakLayout;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const [layout, setLayout] = useState(initialLayout);\n\n const scale = useSharedValue(0);\n\n const animatedStyle = useAnimatedStyle(() => ({\n transform: [{ scale: scale.value }],\n }), []);\n\n const flexDirection = getFlexDirection(placement);\n\n const isVerticalPlacement = placement === 'top' || placement === 'bottom';\n\n const totalOffset = -((isVerticalPlacement ? layout.height : layout.width) + verticalOffset);\n const tooltipLayoutStyle: ViewProps['style'] = {\n alignItems: beakPlacement === 'start'\n ? 'flex-start'\n : beakPlacement === 'end'\n ? 'flex-end'\n : 'center',\n flexDirection,\n left,\n right,\n height: visible ? undefined : 0,\n overflow: visible ? undefined : 'hidden',\n ...Platform.select({\n web: {\n display: visible ? 'flex' : 'none',\n },\n default: {},\n }),\n [placement]: totalOffset,\n };\n\n const contentStyle = css([\n styles.content,\n styles[size],\n isVerticalPlacement\n ? { width: '100%' }\n : { flexGrow: 1, flexShrink: 1 },\n ]);\n\n useEffect(() => {\n const nextScaleValue = visible ? 1 : 0;\n\n scale.value = withTiming(nextScaleValue, ANIMATION_CONFIG);\n }, [visible]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => size === 'large'\n ? typo.body3.regular\n : typo.caption2.regular,\n color: theme.palette.text.strongInverse,\n });\n\n const textStyle = css([\n fontStyle,\n { flexShrink: 1 },\n ]);\n\n const beakStyle = css({\n transform: [isVerticalPlacement ? { translateX: beakOffset } : { translateY: beakOffset }],\n });\n\n const buttonElem = (\n <ButtonBase\n pressEffect={'none'}\n onPress={onClose}\n style={contentStyle}\n >\n <Text\n // TODO: Should we provide text prop customization?\n numberOfLines={numberOfTitleLines}\n style={textStyle}\n >\n {title}\n </Text>\n </ButtonBase>\n );\n\n const beakElem = (\n <View style={beakStyle}>\n <Beak\n fill={theme.palette.fill.base}\n placement={placement}\n size={size}\n />\n </View>\n );\n\n return (\n <View style={style}>\n {children}\n\n <Animated.View\n onLayout={(event) => {\n if (event.nativeEvent.layout.height === 0) {\n return;\n }\n\n setLayout(event.nativeEvent.layout);\n }}\n style={[\n styles.root,\n animatedStyle,\n tooltipLayoutStyle,\n tooltipStyle,\n ]}\n >\n {buttonElem}\n\n {beakElem}\n </Animated.View>\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAGA;;AACA;;AAGA;;;;;;;;AAEA,MAAMA,mBAAsC,GAAG;EAC3CC,MAAM,EAAE,CADmC;EAE3CC,SAAS,EAAE;AAFgC,CAA/C;AAKA,MAAMC,cAAc,GAAG;EAAEC,KAAK,EAAE,CAAT;EAAYC,MAAM,EAAE,CAApB;EAAuBC,CAAC,EAAE,CAA1B;EAA6BC,CAAC,EAAE;AAAhC,CAAvB;AAEA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;;AAIA,MAAMC,gBAAgB,GAAIR,SAAD,IAAgD;EACrE,QAAQA,SAAR;IACI,KAAK,OAAL;MACI,OAAO,aAAP;;IACJ,KAAK,QAAL;MACI,OAAO,gBAAP;;IACJ,KAAK,MAAL;MACI,OAAO,KAAP;;IACJ,KAAK,KAAL;IACA;MACI,OAAO,QAAP;EATR;AAWH,CAZD;;AAgBA,MAAMS,SAAmC,GAAG,YAA2B;EACnE,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,QAAQ,EA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AAcC,IAAd,CAAmBC,IAD7B;IAEI,SAAS,EAAEpB,SAFf;IAGI,IAAI,EAAEyC;EAHV,EADJ,CADJ;;EAUA,oBACI,6BAAC,iBAAD;IAAM,KAAK,EAAEC;EAAb,GACKP,QADL,eAGI,6BAAC,8BAAD,CAAU,IAAV;IACI,QAAQ,EAAG2D,KAAD,IAAW;MACjB,IAAIA,KAAK,CAACC,WAAN,CAAkB7C,MAAlB,CAAyB/C,MAAzB,KAAoC,CAAxC,EAA2C;QACvC;MACH;;MAEDgD,SAAS,CAAC2C,KAAK,CAACC,WAAN,CAAkB7C,MAAnB,CAAT;IACH,CAPL;IAQI,KAAK,EAAE,CACHD,MAAM,CAACrC,IADJ,EAEH2C,aAFG,EAGHO,kBAHG,EAIHlB,YAJG;EARX,GAeKgD,UAfL,EAiBKC,QAjBL,CAHJ,CADJ;AAyBH;;AAAA"}
@@ -3,6 +3,11 @@
3
3
  Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
+ var _exportNames = {
7
+ tooltipBeakPlacements: true,
8
+ tooltipPlacements: true,
9
+ tooltipSizes: true
10
+ };
6
11
  Object.defineProperty(exports, "default", {
7
12
  enumerable: true,
8
13
  get: function () {
@@ -32,5 +37,19 @@ var _Tooltip = _interopRequireDefault(require("./Tooltip"));
32
37
 
33
38
  var _TooltipProps = require("./TooltipProps");
34
39
 
40
+ var _Beaks = require("./Beaks");
41
+
42
+ Object.keys(_Beaks).forEach(function (key) {
43
+ if (key === "default" || key === "__esModule") return;
44
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
45
+ if (key in exports && exports[key] === _Beaks[key]) return;
46
+ Object.defineProperty(exports, key, {
47
+ enumerable: true,
48
+ get: function () {
49
+ return _Beaks[key];
50
+ }
51
+ });
52
+ });
53
+
35
54
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
36
55
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './Tooltip';\nexport type { default as TooltipProps, TooltipBeakLayout, TooltipBeakPlacement } from './TooltipProps';\nexport { tooltipBeakPlacements, tooltipPlacements, tooltipSizes } from './TooltipProps';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './Tooltip';\nexport type { default as TooltipProps, TooltipBeakLayout, TooltipBeakPlacement } from './TooltipProps';\nexport { tooltipBeakPlacements, tooltipPlacements, tooltipSizes } from './TooltipProps';\nexport * from './Beaks';\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AAEA;;AACA;;AAAA;EAAA;EAAA;EAAA;EAAA;IAAA;IAAA;MAAA;IAAA;EAAA;AAAA"}
@@ -55,6 +55,7 @@ const Typography = /*#__PURE__*/_react.default.forwardRef(function Typography(pr
55
55
  color: colorProp = 'inherit',
56
56
  ellipsizeMode = 'tail',
57
57
  href,
58
+ lineHeight,
58
59
  numberOfLines,
59
60
  onPress,
60
61
  selectable,
@@ -66,7 +67,11 @@ const Typography = /*#__PURE__*/_react.default.forwardRef(function Typography(pr
66
67
  } = props;
67
68
  const theme = (0, _styles.useTheme)();
68
69
  const fontStyle = (0, _styles.createFontStyle)(theme, {
69
- selector: typography => typography[variant][weight],
70
+ selector: typography => {
71
+ var _typography$variant;
72
+
73
+ return (_typography$variant = typography[variant]) === null || _typography$variant === void 0 ? void 0 : _typography$variant[weight];
74
+ },
70
75
  color: selectColor(theme, colorProp)
71
76
  }); // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.
72
77
 
@@ -75,7 +80,9 @@ const Typography = /*#__PURE__*/_react.default.forwardRef(function Typography(pr
75
80
  } : {};
76
81
  const textStyle = (0, _styles.css)([styles.root, {
77
82
  textAlign: align === 'inherit' ? 'auto' : align
78
- }, textWrapStyle, fontStyle, style]);
83
+ }, textWrapStyle, fontStyle, lineHeight ? {
84
+ lineHeight
85
+ } : undefined, style]);
79
86
  const accessibility = accessibilityMap[variant];
80
87
  const variantRole = href !== undefined ? 'link' : accessibility === null || accessibility === void 0 ? void 0 : accessibility.accessibilityRole;
81
88
  const variantLevel = accessibility === null || accessibility === void 0 ? void 0 : accessibility['area-level'];
@@ -1 +1 @@
1
- {"version":3,"names":["accessibilityMap","selectColor","theme","colorProp","Platform","OS","undefined","palette","text","styles","StyleSheet","create","root","flexShrink","maxWidth","Typography","React","forwardRef","props","ref","accessibilityRole","align","ariaLevel","disableFontScaling","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","weight","onLayout","onTextLayout","useTheme","fontStyle","createFontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","css","textAlign","accessibility","variantRole","variantLevel","memo"],"sources":["Typography.tsx"],"sourcesContent":["import React from 'react';\nimport type { TextProps, TextStyle } from 'react-native';\nimport { Platform, Text } from 'react-native';\nimport type { FontVariant, FontWeight, Theme } from '@fountain-ui/styles';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport type TypographyProps from './TypographyProps';\nimport type { AccessibilityMap, TypographyAlign, TypographyColor } from './TypographyProps';\n\nconst accessibilityMap: AccessibilityMap = {\n // TODO: set accessibilityRole.\n // h1: { accessibilityRole: 'header', 'aria-level': 1 },\n // h2: { accessibilityRole: 'header', 'aria-level': 2 },\n // h3: { accessibilityRole: 'header', 'aria-level': 3 },\n // subtitle1: { accessibilityRole: 'header', 'aria-level': 6 },\n // subtitle2: { accessibilityRole: 'header', 'aria-level': 6 },\n // body1: { accessibilityRole: 'text' },\n // body2: { accessibilityRole: 'text' },\n // caption1: { accessibilityRole: 'text' },\n // caption2: { accessibilityRole: 'text' },\n // flag: { accessibilityRole: 'text' },\n};\n\nfunction selectColor(theme: Theme, colorProp: TypographyColor): string | undefined {\n switch (colorProp) {\n case 'inherit':\n return Platform.OS === 'web' ? 'inherit' : undefined;\n default:\n return theme.palette.text[colorProp];\n }\n}\n\nconst styles = StyleSheet.create({\n root: {\n flexShrink: 1,\n ...(Platform.OS === 'web' ? { maxWidth: '100%' } : {}),\n },\n});\n\nconst Typography = React.forwardRef<Text, TypographyProps>(function Typography(props, ref) {\n const {\n accessibilityRole,\n align = 'inherit' as TypographyAlign,\n ariaLevel,\n disableFontScaling = false,\n children,\n color: colorProp = 'inherit' as TypographyColor,\n ellipsizeMode = 'tail' as TextProps['ellipsizeMode'],\n href,\n numberOfLines,\n onPress,\n selectable,\n style,\n variant = 'body1' as FontVariant,\n weight = 'medium' as FontWeight,\n onLayout,\n onTextLayout,\n } = props;\n\n const theme = useTheme();\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography[variant][weight],\n color: selectColor(theme, colorProp),\n });\n\n // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.\n const textWrapStyle = numberOfLines && numberOfLines > 0 && Platform.OS === 'web' ? { wordWrap: 'normal' } : {};\n\n const textStyle = css([\n styles.root,\n { textAlign: align === 'inherit' ? 'auto' : align },\n textWrapStyle as TextStyle,\n fontStyle,\n style,\n ]);\n\n const accessibility = accessibilityMap[variant];\n const variantRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;\n const variantLevel = accessibility?.['area-level'];\n\n return (\n <Text\n ref={ref}\n accessibilityRole={accessibilityRole || variantRole}\n allowFontScaling={!disableFontScaling}\n aria-level={ariaLevel || variantLevel}\n children={children}\n ellipsizeMode={ellipsizeMode}\n // @ts-ignore\n href={href}\n numberOfLines={numberOfLines}\n onPress={onPress}\n selectable={selectable}\n style={textStyle}\n onLayout={onLayout}\n onTextLayout={onTextLayout}\n />\n );\n});\n\nexport default React.memo(Typography);\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;;;AAIA,MAAMA,gBAAkC,GAAG,CACvC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAXuC,CAA3C;;AAcA,SAASC,WAAT,CAAqBC,KAArB,EAAmCC,SAAnC,EAAmF;EAC/E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KAAtD,GAA8D;IAAEqC,QAAQ,EAAE;EAAZ,CAA9D,GAAuF,EAA7G;EAEA,MAAMC,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBnC,MAAM,CAACG,IADW,EAElB;IAAEiC,SAAS,EAAExB,KAAK,KAAK,SAAV,GAAsB,MAAtB,GAA+BA;EAA5C,CAFkB,EAGlBoB,aAHkB,EAIlBJ,SAJkB,EAKlBN,KALkB,CAAJ,CAAlB;EAQA,MAAMe,aAAa,GAAG9C,gBAAgB,CAACgC,OAAD,CAAtC;EACA,MAAMe,WAAW,GAAGpB,IAAI,KAAKrB,SAAT,GAAqB,MAArB,GAA8BwC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAE1B,iBAAjE;EACA,MAAM4B,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAG,YAAH,CAAlC;EAEA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAE3B,GADT;IAEI,iBAAiB,EAAEC,iBAAiB,IAAI2B,WAF5C;IAGI,gBAAgB,EAAE,CAACxB,kBAHvB;IAII,cAAYD,SAAS,IAAI0B,YAJ7B;IAKI,QAAQ,EAAExB,QALd;IAMI,aAAa,EAAEE,aANnB,CAOI;IAPJ;IAQI,IAAI,EAAEC,IARV;IASI,aAAa,EAAEC,aATnB;IAUI,OAAO,EAAEC,OAVb;IAWI,UAAU,EAAEC,UAXhB;IAYI,KAAK,EAAEa,SAZX;IAaI,QAAQ,EAAET,QAbd;IAcI,YAAY,EAAEC;EAdlB,EADJ;AAkBH,CA5DkB,CAAnB;;4BA8DenB,cAAA,CAAMiC,IAAN,CAAWlC,UAAX,C"}
1
+ {"version":3,"names":["accessibilityMap","selectColor","theme","colorProp","Platform","OS","undefined","palette","text","styles","StyleSheet","create","root","flexShrink","maxWidth","Typography","React","forwardRef","props","ref","accessibilityRole","align","ariaLevel","disableFontScaling","children","color","ellipsizeMode","href","lineHeight","numberOfLines","onPress","selectable","style","variant","weight","onLayout","onTextLayout","useTheme","fontStyle","createFontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","css","textAlign","accessibility","variantRole","variantLevel","memo"],"sources":["Typography.tsx"],"sourcesContent":["import React from 'react';\nimport type { TextProps, TextStyle } from 'react-native';\nimport { Platform, Text } from 'react-native';\nimport type { FontVariant, FontWeight, Theme } from '@fountain-ui/styles';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport type TypographyProps from './TypographyProps';\nimport type { AccessibilityMap, TypographyAlign, TypographyColor } from './TypographyProps';\n\nconst accessibilityMap: AccessibilityMap = {\n // TODO: set accessibilityRole.\n // h1: { accessibilityRole: 'header', 'aria-level': 1 },\n // h2: { accessibilityRole: 'header', 'aria-level': 2 },\n // h3: { accessibilityRole: 'header', 'aria-level': 3 },\n // subtitle1: { accessibilityRole: 'header', 'aria-level': 6 },\n // subtitle2: { accessibilityRole: 'header', 'aria-level': 6 },\n // body1: { accessibilityRole: 'text' },\n // body2: { accessibilityRole: 'text' },\n // caption1: { accessibilityRole: 'text' },\n // caption2: { accessibilityRole: 'text' },\n // flag: { accessibilityRole: 'text' },\n};\n\nfunction selectColor(theme: Theme, colorProp: TypographyColor): string | undefined {\n switch (colorProp) {\n case 'inherit':\n return Platform.OS === 'web' ? 'inherit' : undefined;\n default:\n return theme.palette.text[colorProp];\n }\n}\n\nconst styles = StyleSheet.create({\n root: {\n flexShrink: 1,\n ...(Platform.OS === 'web' ? { maxWidth: '100%' } : {}),\n },\n});\n\nconst Typography = React.forwardRef<Text, TypographyProps>(function Typography(props, ref) {\n const {\n accessibilityRole,\n align = 'inherit' as TypographyAlign,\n ariaLevel,\n disableFontScaling = false,\n children,\n color: colorProp = 'inherit' as TypographyColor,\n ellipsizeMode = 'tail' as TextProps['ellipsizeMode'],\n href,\n lineHeight,\n numberOfLines,\n onPress,\n selectable,\n style,\n variant = 'body1' as FontVariant,\n weight = 'medium' as FontWeight,\n onLayout,\n onTextLayout,\n } = props;\n\n const theme = useTheme();\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography[variant]?.[weight],\n color: selectColor(theme, colorProp),\n });\n\n // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.\n const textWrapStyle = numberOfLines && numberOfLines > 0 && Platform.OS === 'web' ? { wordWrap: 'normal' } : {};\n\n const textStyle = css([\n styles.root,\n { textAlign: align === 'inherit' ? 'auto' : align },\n textWrapStyle as TextStyle,\n fontStyle,\n lineHeight ? { lineHeight } : undefined,\n style,\n ]);\n\n const accessibility = accessibilityMap[variant];\n const variantRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;\n const variantLevel = accessibility?.['area-level'];\n\n return (\n <Text\n ref={ref}\n accessibilityRole={accessibilityRole || variantRole}\n allowFontScaling={!disableFontScaling}\n aria-level={ariaLevel || variantLevel}\n children={children}\n ellipsizeMode={ellipsizeMode}\n // @ts-ignore\n href={href}\n numberOfLines={numberOfLines}\n onPress={onPress}\n selectable={selectable}\n style={textStyle}\n onLayout={onLayout}\n onTextLayout={onTextLayout}\n />\n );\n});\n\nexport default React.memo(Typography);\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;;;AAIA,MAAMA,gBAAkC,GAAG,CACvC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAXuC,CAA3C;;AAcA,SAASC,WAAT,CAAqBC,KAArB,EAAmCC,SAAnC,EAAmF;EAC/E,QAAQA,SAAR;IACI,KAAK,SAAL;MACI,OAAOC,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB,SAAxB,GAAoCC,SAA3C;;IACJ;MACI,OAAOJ,KAAK,CAACK,OAAN,CAAcC,IAAd,CAAmBL,SAAnB,CAAP;EAJR;AAMH;;AAED,MAAMM,MAAM,GAAGC,kBAAA,CAAWC,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACFC,UAAU,EAAE,CADV;IAEF,IAAIT,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB;MAAES,QAAQ,EAAE;IA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EAMlB0B,KANkB,CAAJ,CAAlB;EASA,MAAMe,aAAa,GAAG/C,gBAAgB,CAACiC,OAAD,CAAtC;EACA,MAAMe,WAAW,GAAGrB,IAAI,KAAKrB,SAAT,GAAqB,MAArB,GAA8ByC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAE3B,iBAAjE;EACA,MAAM6B,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAG,YAAH,CAAlC;EAEA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAE5B,GADT;IAEI,iBAAiB,EAAEC,iBAAiB,IAAI4B,WAF5C;IAGI,gBAAgB,EAAE,CAACzB,kBAHvB;IAII,cAAYD,SAAS,IAAI2B,YAJ7B;IAKI,QAAQ,EAAEzB,QALd;IAMI,aAAa,EAAEE,aANnB,CAOI;IAPJ;IAQI,IAAI,EAAEC,IARV;IASI,aAAa,EAAEE,aATnB;IAUI,OAAO,EAAEC,OAVb;IAWI,UAAU,EAAEC,UAXhB;IAYI,KAAK,EAAEa,SAZX;IAaI,QAAQ,EAAET,QAbd;IAcI,YAAY,EAAEC;EAdlB,EADJ;AAkBH,CA9DkB,CAAnB;;4BAgEepB,cAAA,CAAMkC,IAAN,CAAWnC,UAAX,C"}
@@ -1 +1 @@
1
- {"version":3,"names":["typographyColors"],"sources":["TypographyProps.ts"],"sourcesContent":["import React from 'react';\nimport type { AccessibilityProps, TextProps, TextStyle } from 'react-native';\nimport type { FontVariant, FontWeight } from '@fountain-ui/styles';\nimport type { ComponentProps } from '../types';\n\nexport type TypographyAlign = 'inherit' | TextStyle['textAlign'];\n\nexport const typographyColors = [\n 'inherit',\n 'accent',\n 'accentAlt',\n 'strong',\n 'strongInverse',\n 'base',\n 'baseInverse',\n 'baseOpacity',\n 'baseOpacityInverse',\n 'weak',\n 'weakOpacity',\n 'weakInverse',\n 'weakOpacityInverse',\n] as const;\n\nexport type TypographyColor = typeof typographyColors[number];\n\nexport interface Accessibility {\n accessibilityRole: AccessibilityProps['accessibilityRole'];\n 'area-level'?: number;\n}\n\nexport type AccessibilityMap = Partial<Record<FontVariant, Accessibility>>;\n\nexport default interface TypographyProps extends ComponentProps<{\n /**\n * Applies HTML tag at web and communicates purpose of component at app\n */\n accessibilityRole?: AccessibilityProps['accessibilityRole'];\n\n /**\n * Set the text-align on the component.\n * The value 'justify' is not supported on Android and fallbacks to left.\n * @default 'inherit'\n */\n align?: TypographyAlign;\n\n /**\n * Applies HTML heading level\n */\n ariaLevel?: number;\n\n /**\n * Specifies whether fonts should scale to respect Text Size accessibility settings.\n * @default false\n */\n disableFontScaling?: boolean;\n\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'inherit'\n */\n color?: TypographyColor;\n\n /**\n * The text ellipsis mode.\n * @default 'tail'\n */\n ellipsizeMode?: TextProps['ellipsizeMode'];\n\n /**\n * Internal use only. The hyperlink of the text.\n */\n href?: string;\n\n /**\n * Used to truncate the text with an ellipsis after computing the text\n * layout, including line wrapping, such that the total number of lines\n * does not exceed this number.\n */\n numberOfLines?: TextProps['numberOfLines'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n onPress?: TextProps['onPress'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n selectable?: boolean;\n\n /**\n * Applies the theme typography styles.\n * @default 'body1'\n */\n variant?: FontVariant;\n\n /**\n * Determines the font weight.\n * @default 'medium'\n */\n weight?: FontWeight;\n\n /**\n * Callback that is called when the text layout has been calculated.\n */\n onTextLayout?: TextProps['onTextLayout'];\n\n /**\n * Callback that is called when the layout of the Text component changes.\n */\n onLayout?: TextProps['onLayout'];\n}> {}\n"],"mappings":";;;;;;AAOO,MAAMA,gBAAgB,GAAG,CAC5B,SAD4B,EAE5B,QAF4B,EAG5B,WAH4B,EAI5B,QAJ4B,EAK5B,eAL4B,EAM5B,MAN4B,EAO5B,aAP4B,EAQ5B,aAR4B,EAS5B,oBAT4B,EAU5B,MAV4B,EAW5B,aAX4B,EAY5B,aAZ4B,EAa5B,oBAb4B,CAAzB"}
1
+ {"version":3,"names":["typographyColors"],"sources":["TypographyProps.ts"],"sourcesContent":["import React from 'react';\nimport type { AccessibilityProps, TextProps, TextStyle } from 'react-native';\nimport type { FontVariant, FontWeight } from '@fountain-ui/styles';\nimport type { ComponentProps } from '../types';\n\nexport type TypographyAlign = 'inherit' | TextStyle['textAlign'];\n\nexport const typographyColors = [\n 'inherit',\n 'accent',\n 'accentAlt',\n 'strong',\n 'strongInverse',\n 'base',\n 'baseInverse',\n 'baseOpacity',\n 'baseOpacityInverse',\n 'weak',\n 'weakOpacity',\n 'weakInverse',\n 'weakOpacityInverse',\n] as const;\n\nexport type TypographyColor = typeof typographyColors[number];\n\nexport interface Accessibility {\n accessibilityRole: AccessibilityProps['accessibilityRole'];\n 'area-level'?: number;\n}\n\nexport type AccessibilityMap = Partial<Record<FontVariant, Accessibility>>;\n\nexport default interface TypographyProps extends ComponentProps<{\n /**\n * Applies HTML tag at web and communicates purpose of component at app\n */\n accessibilityRole?: AccessibilityProps['accessibilityRole'];\n\n /**\n * Set the text-align on the component.\n * The value 'justify' is not supported on Android and fallbacks to left.\n * @default 'inherit'\n */\n align?: TypographyAlign;\n\n /**\n * Applies HTML heading level\n */\n ariaLevel?: number;\n\n /**\n * Specifies whether fonts should scale to respect Text Size accessibility settings.\n * @default false\n */\n disableFontScaling?: boolean;\n\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'inherit'\n */\n color?: TypographyColor;\n\n /**\n * The text ellipsis mode.\n * @default 'tail'\n */\n ellipsizeMode?: TextProps['ellipsizeMode'];\n\n /**\n * Internal use only. The hyperlink of the text.\n */\n href?: string;\n\n /**\n * Defines the vertical spacing between lines of text.\n */\n lineHeight?: TextStyle['lineHeight'];\n\n /**\n * Used to truncate the text with an ellipsis after computing the text\n * layout, including line wrapping, such that the total number of lines\n * does not exceed this number.\n */\n numberOfLines?: TextProps['numberOfLines'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n onPress?: TextProps['onPress'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n selectable?: boolean;\n\n /**\n * Applies the theme typography styles.\n * @default 'body1'\n */\n variant?: FontVariant;\n\n /**\n * Determines the font weight.\n * @default 'medium'\n */\n weight?: FontWeight;\n\n /**\n * Callback that is called when the text layout has been calculated.\n */\n onTextLayout?: TextProps['onTextLayout'];\n\n /**\n * Callback that is called when the layout of the Text component changes.\n */\n onLayout?: TextProps['onLayout'];\n}> {}\n"],"mappings":";;;;;;AAOO,MAAMA,gBAAgB,GAAG,CAC5B,SAD4B,EAE5B,QAF4B,EAG5B,WAH4B,EAI5B,QAJ4B,EAK5B,eAL4B,EAM5B,MAN4B,EAO5B,aAP4B,EAQ5B,aAR4B,EAS5B,oBAT4B,EAU5B,MAV4B,EAW5B,aAX4B,EAY5B,aAZ4B,EAa5B,oBAb4B,CAAzB"}
@@ -15,9 +15,12 @@ function useBreakpointUp(target, yes, no) {
15
15
 
16
16
  const isUp = (0, _react.useMemo)(() => {
17
17
  switch (target) {
18
- case 'xs':
18
+ case 'xxs':
19
19
  return true;
20
20
 
21
+ case 'xs':
22
+ return current === 'xs' || current === 'sm' || current === 'md' || current === 'lg';
23
+
21
24
  case 'sm':
22
25
  return current === 'sm' || current === 'md' || current === 'lg';
23
26
 
@@ -1 +1 @@
1
- {"version":3,"names":["useBreakpointUp","target","yes","no","theme","useTheme","current","breakpoints","isUp","useMemo"],"sources":["useBreakpointUp.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { Theme } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\n\ntype Breakpoint = keyof Theme['breakpoints']['values'];\n\nexport default function useBreakpointUp<R>(target: Breakpoint, yes: R, no: R): R {\n const theme = useTheme();\n\n const current = theme.breakpoints.current;\n\n // TODO: Needs to refactor\n const isUp = useMemo<boolean>(() => {\n switch (target) {\n case 'xs':\n return true;\n case 'sm':\n return current === 'sm' || current === 'md' || current === 'lg';\n case 'md':\n return current === 'md' || current === 'lg';\n case 'lg':\n return current === 'lg';\n }\n }, [target, current]);\n\n return isUp ? yes : no;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAIe,SAASA,eAAT,CAA4BC,MAA5B,EAAgDC,GAAhD,EAAwDC,EAAxD,EAAkE;EAC7E,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC,OAAO,GAAGF,KAAK,CAACG,WAAN,CAAkBD,OAAlC,CAH6E,CAK7E;;EACA,MAAME,IAAI,GAAG,IAAAC,cAAA,EAAiB,MAAM;IAChC,QAAQR,MAAR;MACI,KAAK,IAAL;QACI,OAAO,IAAP;;MACJ,KAAK,IAAL;QACI,OAAOK,OAAO,KAAK,IAAZ,IAAoBA,OAAO,KAAK,IAAhC,IAAwCA,OAAO,KAAK,IAA3D;;MACJ,KAAK,IAAL;QACI,OAAOA,OAAO,KAAK,IAAZ,IAAoBA,OAAO,KAAK,IAAvC;;MACJ,KAAK,IAAL;QACI,OAAOA,OAAO,KAAK,IAAnB;IARR;EAUH,CAXY,EAWV,CAACL,MAAD,EAASK,OAAT,CAXU,CAAb;EAaA,OAAOE,IAAI,GAAGN,GAAH,GAASC,EAApB;AACH;;AAAA"}
1
+ {"version":3,"names":["useBreakpointUp","target","yes","no","theme","useTheme","current","breakpoints","isUp","useMemo"],"sources":["useBreakpointUp.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport type { Theme } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\n\ntype Breakpoint = keyof Theme['breakpoints']['values'];\n\nexport default function useBreakpointUp<R>(target: Breakpoint, yes: R, no: R): R {\n const theme = useTheme();\n\n const current = theme.breakpoints.current;\n\n // TODO: Needs to refactor\n const isUp = useMemo<boolean>(() => {\n switch (target) {\n case 'xxs':\n return true;\n case 'xs':\n return current === 'xs' || current === 'sm' || current === 'md' || current === 'lg';\n case 'sm':\n return current === 'sm' || current === 'md' || current === 'lg';\n case 'md':\n return current === 'md' || current === 'lg';\n case 'lg':\n return current === 'lg';\n }\n }, [target, current]);\n\n return isUp ? yes : no;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAIe,SAASA,eAAT,CAA4BC,MAA5B,EAAgDC,GAAhD,EAAwDC,EAAxD,EAAkE;EAC7E,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC,OAAO,GAAGF,KAAK,CAACG,WAAN,CAAkBD,OAAlC,CAH6E,CAK7E;;EACA,MAAME,IAAI,GAAG,IAAAC,cAAA,EAAiB,MAAM;IAChC,QAAQR,MAAR;MACI,KAAK,KAAL;QACI,OAAO,IAAP;;MACJ,KAAK,IAAL;QACI,OAAOK,OAAO,KAAK,IAAZ,IAAoBA,OAAO,KAAK,IAAhC,IAAwCA,OAAO,KAAK,IAApD,IAA4DA,OAAO,KAAK,IAA/E;;MACJ,KAAK,IAAL;QACI,OAAOA,OAAO,KAAK,IAAZ,IAAoBA,OAAO,KAAK,IAAhC,IAAwCA,OAAO,KAAK,IAA3D;;MACJ,KAAK,IAAL;QACI,OAAOA,OAAO,KAAK,IAAZ,IAAoBA,OAAO,KAAK,IAAvC;;MACJ,KAAK,IAAL;QACI,OAAOA,OAAO,KAAK,IAAnB;IAVR;EAYH,CAbY,EAaV,CAACL,MAAD,EAASK,OAAT,CAbU,CAAb;EAeA,OAAOE,IAAI,GAAGN,GAAH,GAASC,EAApB;AACH;;AAAA"}
@@ -13,8 +13,6 @@ var _reactNativeReanimated = require("react-native-reanimated");
13
13
 
14
14
  var _reactNativeSafeAreaContext = require("react-native-safe-area-context");
15
15
 
16
- var _styles = require("@fountain-ui/styles");
17
-
18
16
  var _hooks = require("../internal/hooks");
19
17
 
20
18
  var _useAppbarStyles = _interopRequireDefault(require("./useAppbarStyles"));
@@ -23,7 +21,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
23
21
 
24
22
  const defaultOptions = {
25
23
  keyboardDismissMode: 'none',
26
- dividerExposureMode: 'overlapped',
27
24
  supportsReverseScroll: true
28
25
  };
29
26
  const ANIMATION_CONFIG = {
@@ -38,7 +35,6 @@ function useCollapsibleAppBar() {
38
35
  let userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultOptions;
39
36
  const {
40
37
  keyboardDismissMode,
41
- dividerExposureMode,
42
38
  supportsReverseScroll
43
39
  } = { ...defaultOptions,
44
40
  ...userOptions
@@ -53,17 +49,14 @@ function useCollapsibleAppBar() {
53
49
  const lastOffsetY = (0, _reactNativeReanimated.useSharedValue)(0);
54
50
  const overlapped = (0, _reactNativeReanimated.useSharedValue)(false);
55
51
  const [isScrolled, setIsScrolled] = (0, _react.useState)(false);
56
- const theme = (0, _styles.useTheme)();
57
52
  const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
58
53
  const transform = [{
59
54
  translateY: translateY.value
60
55
  }];
61
56
  return {
62
- transform,
63
- borderColor: dividerExposureMode === 'always' || overlapped.value ? theme.palette.divider : TRANSPARENT,
64
- borderBottomWidth: _reactNative.StyleSheet.hairlineWidth
57
+ transform
65
58
  };
66
- }, [theme, dividerExposureMode]);
59
+ }, []);
67
60
  const indexRef = (0, _react.useRef)(0);
68
61
  const offsetsRef = (0, _react.useRef)([]);
69
62
  const onScrollViewChanged = (0, _react.useCallback)(nextIndex => {
@@ -141,7 +134,7 @@ function useCollapsibleAppBar() {
141
134
  overlapped.value = offsetY + nextTranslateY > 0;
142
135
  translateY.value = (0, _reactNativeReanimated.withTiming)(nextTranslateY, ANIMATION_CONFIG);
143
136
  }
144
- }, [keyboardDismissMode, appBarHeight, isScrolled]);
137
+ });
145
138
  const hasCollapsible = collapsibleToolbarHeight > 0;
146
139
  const appBarStyle = [animatedStyle, {
147
140
  paddingTop: safeAreaInsets.top
@@ -1 +1 @@
1
- {"version":3,"names":["defaultOptions","keyboardDismissMode","dividerExposureMode","supportsReverseScroll","ANIMATION_CONFIG","duration","TRANSPARENT","SUPPORTS_DRAG_DETECTION","Platform","OS","dismissKeyboard","Keyboard","dismiss","useCollapsibleAppBar","userOptions","styles","useAppbarStyles","safeAreaInsets","useSafeAreaInsets","appBarHeight","onAppBarLayout","useHeight","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","useDerivedValue","translateY","useSharedValue","lastTranslateY","lastOffsetY","overlapped","isScrolled","setIsScrolled","useState","theme","useTheme","animatedStyle","useAnimatedStyle","transform","value","borderColor","palette","divider","borderBottomWidth","StyleSheet","hairlineWidth","indexRef","useRef","offsetsRef","onScrollViewChanged","useCallback","nextIndex","prevIndex","current","savedOffsetY","withTiming","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","onMomentumBegin","onScroll","event","offsetY","contentOffset","y","maxTy","dy","Math","min","max","minOffsetY","maxOffsetY","contentSize","height","layoutMeasurement","safeOffsetY","safeLastOffsetY","newTranslateY","onEndDrag","onMomentumEnd","ty","threshold","nextTranslateY","hasCollapsible","appBarStyle","paddingTop","top","floating","undefined","scrollContentInsets"],"sources":["useCollapsibleAppBar.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\nimport {\n Falsy,\n Keyboard,\n Platform,\n RegisteredStyle,\n ScrollViewProps,\n StyleSheet,\n ViewProps,\n ViewStyle,\n} from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport {\n runOnJS,\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useTheme } from '@fountain-ui/styles';\nimport { useHeight } from '../internal/hooks';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype WebOnlyStyle = { boxShadow: any };\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | WebOnlyStyle | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface ContentInsets {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\nexport interface Options {\n keyboardDismissMode?: 'none' | 'on-drag';\n dividerExposureMode?: 'always' | 'overlapped';\n supportsReverseScroll?: boolean;\n}\n\nexport interface CollapsibleAppBar {\n appBarStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onCollapsibleToolbarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n onScrollViewChanged: (index: number) => void;\n scrollContentInsets: ContentInsets;\n isScrolled: boolean;\n}\n\nconst defaultOptions: Required<Options> = {\n keyboardDismissMode: 'none',\n dividerExposureMode: 'overlapped',\n supportsReverseScroll: true,\n};\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 100 };\nconst TRANSPARENT = '#FFFFFF00';\n\nconst SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';\nconst dismissKeyboard = () => Keyboard.dismiss();\n\nexport default function useCollapsibleAppBar(userOptions: Options = defaultOptions): CollapsibleAppBar {\n const { keyboardDismissMode, dividerExposureMode, supportsReverseScroll }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();\n\n const maxTranslateY = useDerivedValue(() => -collapsibleToolbarHeight, [collapsibleToolbarHeight]);\n\n const translateY = useSharedValue<number>(0);\n const lastTranslateY = useSharedValue<number>(0);\n const lastOffsetY = useSharedValue<number>(0);\n const overlapped = useSharedValue<boolean>(false);\n\n const [isScrolled, setIsScrolled] = useState<boolean>(false);\n\n const theme = useTheme();\n\n const animatedStyle = useAnimatedStyle(() => {\n const transform = [{ translateY: translateY.value }];\n\n return {\n transform,\n borderColor: dividerExposureMode === 'always' || overlapped.value ? theme.palette.divider : TRANSPARENT,\n borderBottomWidth: StyleSheet.hairlineWidth,\n };\n }, [\n theme,\n dividerExposureMode,\n ]);\n\n const indexRef = useRef<number>(0);\n const offsetsRef = useRef<Array<number>>([]);\n\n const onScrollViewChanged = useCallback((nextIndex: number) => {\n const prevIndex = indexRef.current;\n if (prevIndex === nextIndex) {\n return;\n }\n\n offsetsRef.current[prevIndex] = lastOffsetY.value;\n\n const savedOffsetY = offsetsRef.current[nextIndex] ?? 0;\n lastOffsetY.value = savedOffsetY;\n\n indexRef.current = nextIndex;\n\n // Determine whether to overlap every time index is changed.\n overlapped.value = savedOffsetY > 0;\n\n // If next ScrollView's offset is too short, expand app bar.\n if (translateY.value < 0 && savedOffsetY < appBarHeight) {\n translateY.value = withTiming(0, ANIMATION_CONFIG);\n }\n }, [appBarHeight]);\n\n const scrollHandler = useAnimatedScrollHandler({\n onBeginDrag: () => {\n if (keyboardDismissMode === 'on-drag') {\n runOnJS(dismissKeyboard)();\n }\n lastTranslateY.value = translateY.value;\n },\n onMomentumBegin: () => {\n lastTranslateY.value = translateY.value;\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n\n if (!isScrolled && offsetY > 0) {\n runOnJS(setIsScrolled)(true);\n } else if (isScrolled && offsetY <= 0) {\n runOnJS(setIsScrolled)(false);\n }\n\n const maxTy = maxTranslateY.value;\n\n if (SUPPORTS_DRAG_DETECTION) {\n const dy = offsetY - lastOffsetY.value;\n\n translateY.value = offsetY <= 0 ? 0 : Math.min(Math.max(lastTranslateY.value - dy, maxTy), 0);\n\n overlapped.value = offsetY + translateY.value > 0;\n } else {\n const minOffsetY = -maxTy;\n const maxOffsetY = event.contentSize.height - event.layoutMeasurement.height;\n\n const safeOffsetY = Math.min(Math.max(offsetY, minOffsetY), maxOffsetY);\n const safeLastOffsetY = Math.min(Math.max(lastOffsetY.value, minOffsetY), maxOffsetY);\n const dy = safeOffsetY - safeLastOffsetY;\n\n const newTranslateY = safeOffsetY <= minOffsetY\n ? 0\n : supportsReverseScroll\n ? dy === 0\n ? lastTranslateY.value\n : dy > 0\n ? maxTy\n : 0\n : maxTy;\n\n translateY.value = withTiming(newTranslateY, ANIMATION_CONFIG);\n lastTranslateY.value = newTranslateY;\n\n overlapped.value = offsetY > 0;\n\n lastOffsetY.value = offsetY;\n }\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n const offsetY = event.contentOffset.y;\n\n lastOffsetY.value = offsetY;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n // If toolbar is already positioned on edge, do nothing.\n if (ty <= maxTy || ty >= 0) {\n return;\n }\n\n const threshold = maxTy * 0.5;\n\n const nextTranslateY = (ty > threshold || offsetY < appBarHeight) ? 0 : maxTy;\n\n overlapped.value = offsetY + nextTranslateY > 0;\n\n translateY.value = withTiming(nextTranslateY, ANIMATION_CONFIG);\n },\n }, [keyboardDismissMode, appBarHeight, isScrolled]);\n\n const hasCollapsible = collapsibleToolbarHeight > 0;\n\n const appBarStyle = [\n animatedStyle,\n { paddingTop: safeAreaInsets.top },\n hasCollapsible ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n onAppBarLayout,\n onCollapsibleToolbarLayout,\n onScroll: scrollHandler,\n onScrollViewChanged,\n scrollContentInsets: { top: hasCollapsible ? appBarHeight : 0 },\n isScrolled,\n };\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAWA;;AAQA;;AACA;;AACA;;AACA;;;;AAiCA,MAAMA,cAAiC,GAAG;EACtCC,mBAAmB,EAAE,MADiB;EAEtCC,mBAAmB,EAAE,YAFiB;EAGtCC,qBAAqB,EAAE;AAHe,CAA1C;AAMA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;AACA,MAAMC,WAAW,GAAG,WAApB;AAEA,MAAMC,uBAAuB,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAAhD;;AACA,MAAMC,eAAe,GAAG,MAAMC,qBAAA,CAASC,OAAT,EAA9B;;AAEe,SAASC,oBAAT,GAAwF;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;EAEA,MAAM+D,WAAW,GAAG,CAChBjD,aADgB,EAEhB;IAAEkD,UAAU,EAAErE,cAAc,CAACsE;EAA7B,CAFgB,EAGhBH,cAAc,GAAGrE,MAAM,CAACyE,QAAV,GAAqBC,SAHnB,CAApB;EAMA,OAAO;IACHJ,WADG;IAEHjE,cAFG;IAGHG,0BAHG;IAIHsC,QAAQ,EAAEL,aAJP;IAKHP,mBALG;IAMHyC,mBAAmB,EAAE;MAAEH,GAAG,EAAEH,cAAc,GAAGjE,YAAH,GAAkB;IAAvC,CANlB;IAOHY;EAPG,CAAP;AASH;;AAAA"}
1
+ {"version":3,"names":["defaultOptions","keyboardDismissMode","supportsReverseScroll","ANIMATION_CONFIG","duration","TRANSPARENT","SUPPORTS_DRAG_DETECTION","Platform","OS","dismissKeyboard","Keyboard","dismiss","useCollapsibleAppBar","userOptions","styles","useAppbarStyles","safeAreaInsets","useSafeAreaInsets","appBarHeight","onAppBarLayout","useHeight","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","useDerivedValue","translateY","useSharedValue","lastTranslateY","lastOffsetY","overlapped","isScrolled","setIsScrolled","useState","animatedStyle","useAnimatedStyle","transform","value","indexRef","useRef","offsetsRef","onScrollViewChanged","useCallback","nextIndex","prevIndex","current","savedOffsetY","withTiming","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","onMomentumBegin","onScroll","event","offsetY","contentOffset","y","maxTy","dy","Math","min","max","minOffsetY","maxOffsetY","contentSize","height","layoutMeasurement","safeOffsetY","safeLastOffsetY","newTranslateY","onEndDrag","onMomentumEnd","ty","threshold","nextTranslateY","hasCollapsible","appBarStyle","paddingTop","top","floating","undefined","scrollContentInsets"],"sources":["useCollapsibleAppBar.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\nimport { Falsy, Keyboard, Platform, RegisteredStyle, ScrollViewProps, ViewProps, ViewStyle } from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport {\n runOnJS,\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useHeight } from '../internal/hooks';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype WebOnlyStyle = { boxShadow: any };\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | WebOnlyStyle | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface ContentInsets {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\nexport interface Options {\n keyboardDismissMode?: 'none' | 'on-drag';\n supportsReverseScroll?: boolean;\n}\n\nexport interface CollapsibleAppBar {\n appBarStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onCollapsibleToolbarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n onScrollViewChanged: (index: number) => void;\n scrollContentInsets: ContentInsets;\n isScrolled: boolean;\n}\n\nconst defaultOptions: Required<Options> = {\n keyboardDismissMode: 'none',\n supportsReverseScroll: true,\n};\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 100 };\nconst TRANSPARENT = '#FFFFFF00';\n\nconst SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';\nconst dismissKeyboard = () => Keyboard.dismiss();\n\nexport default function useCollapsibleAppBar(userOptions: Options = defaultOptions): CollapsibleAppBar {\n const { keyboardDismissMode, supportsReverseScroll }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();\n\n const maxTranslateY = useDerivedValue(() => -collapsibleToolbarHeight, [collapsibleToolbarHeight]);\n\n const translateY = useSharedValue<number>(0);\n const lastTranslateY = useSharedValue<number>(0);\n const lastOffsetY = useSharedValue<number>(0);\n const overlapped = useSharedValue<boolean>(false);\n\n const [isScrolled, setIsScrolled] = useState<boolean>(false);\n\n const animatedStyle = useAnimatedStyle(() => {\n const transform = [{ translateY: translateY.value }];\n\n return {\n transform,\n };\n }, []);\n\n const indexRef = useRef<number>(0);\n const offsetsRef = useRef<Array<number>>([]);\n\n const onScrollViewChanged = useCallback((nextIndex: number) => {\n const prevIndex = indexRef.current;\n if (prevIndex === nextIndex) {\n return;\n }\n\n offsetsRef.current[prevIndex] = lastOffsetY.value;\n\n const savedOffsetY = offsetsRef.current[nextIndex] ?? 0;\n lastOffsetY.value = savedOffsetY;\n\n indexRef.current = nextIndex;\n\n // Determine whether to overlap every time index is changed.\n overlapped.value = savedOffsetY > 0;\n\n // If next ScrollView's offset is too short, expand app bar.\n if (translateY.value < 0 && savedOffsetY < appBarHeight) {\n translateY.value = withTiming(0, ANIMATION_CONFIG);\n }\n }, [appBarHeight]);\n\n const scrollHandler = useAnimatedScrollHandler({\n onBeginDrag: () => {\n if (keyboardDismissMode === 'on-drag') {\n runOnJS(dismissKeyboard)();\n }\n lastTranslateY.value = translateY.value;\n },\n onMomentumBegin: () => {\n lastTranslateY.value = translateY.value;\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n\n if (!isScrolled && offsetY > 0) {\n runOnJS(setIsScrolled)(true);\n } else if (isScrolled && offsetY <= 0) {\n runOnJS(setIsScrolled)(false);\n }\n\n const maxTy = maxTranslateY.value;\n\n if (SUPPORTS_DRAG_DETECTION) {\n const dy = offsetY - lastOffsetY.value;\n\n translateY.value = offsetY <= 0 ? 0 : Math.min(Math.max(lastTranslateY.value - dy, maxTy), 0);\n\n overlapped.value = offsetY + translateY.value > 0;\n } else {\n const minOffsetY = -maxTy;\n const maxOffsetY = event.contentSize.height - event.layoutMeasurement.height;\n\n const safeOffsetY = Math.min(Math.max(offsetY, minOffsetY), maxOffsetY);\n const safeLastOffsetY = Math.min(Math.max(lastOffsetY.value, minOffsetY), maxOffsetY);\n const dy = safeOffsetY - safeLastOffsetY;\n\n const newTranslateY = safeOffsetY <= minOffsetY\n ? 0\n : supportsReverseScroll\n ? dy === 0\n ? lastTranslateY.value\n : dy > 0\n ? maxTy\n : 0\n : maxTy;\n\n translateY.value = withTiming(newTranslateY, ANIMATION_CONFIG);\n lastTranslateY.value = newTranslateY;\n\n overlapped.value = offsetY > 0;\n\n lastOffsetY.value = offsetY;\n }\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n const offsetY = event.contentOffset.y;\n\n lastOffsetY.value = offsetY;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n // If toolbar is already positioned on edge, do nothing.\n if (ty <= maxTy || ty >= 0) {\n return;\n }\n\n const threshold = maxTy * 0.5;\n\n const nextTranslateY = (ty > threshold || offsetY < appBarHeight) ? 0 : maxTy;\n\n overlapped.value = offsetY + nextTranslateY > 0;\n\n translateY.value = withTiming(nextTranslateY, ANIMATION_CONFIG);\n },\n });\n\n const hasCollapsible = collapsibleToolbarHeight > 0;\n\n const appBarStyle = [\n animatedStyle,\n { paddingTop: safeAreaInsets.top },\n hasCollapsible ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n onAppBarLayout,\n onCollapsibleToolbarLayout,\n onScroll: scrollHandler,\n onScrollViewChanged,\n scrollContentInsets: { top: hasCollapsible ? appBarHeight : 0 },\n isScrolled,\n };\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AAQA;;AACA;;AACA;;;;AAgCA,MAAMA,cAAiC,GAAG;EACtCC,mBAAmB,EAAE,MADiB;EAEtCC,qBAAqB,EAAE;AAFe,CAA1C;AAKA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;AACA,MAAMC,WAAW,GAAG,WAApB;AAEA,MAAMC,uBAAuB,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAAhD;;AACA,MAAMC,eAAe,GAAG,M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yC,mBAAmB,EAAE;MAAEH,GAAG,EAAEH,cAAc,GAAGzD,YAAH,GAAkB;IAAvC,CANlB;IAOHY;EAPG,CAAP;AASH;;AAAA"}
@@ -7,49 +7,63 @@ exports.default = useContentContainerStyle;
7
7
 
8
8
  var _styles = require("../styles");
9
9
 
10
- var _useBreakpointUp = _interopRequireDefault(require("./useBreakpointUp"));
11
-
12
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
+ function getMaxWidth(theme, breakpoint, customMaxWidth) {
11
+ switch (breakpoint) {
12
+ case 'lg':
13
+ case 'md':
14
+ return customMaxWidth ?? theme.breakpoints.values[breakpoint];
13
15
 
14
- const defaultConfig = {
15
- breakpoint: 'lg',
16
- maxWidth: 'md',
17
- styleProvider: () => undefined
18
- }; // TODO: Needs to refactor
16
+ default:
17
+ return undefined;
18
+ }
19
+ }
19
20
 
20
- function getMaxWidth(theme, breakpoint) {
21
+ function getHomeScreenPaddingHorizontal(theme, breakpoint) {
21
22
  switch (breakpoint) {
23
+ case 'xxs':
22
24
  case 'xs':
23
- return theme.breakpoints.values['sm'];
25
+ return theme.spacing(3);
24
26
 
25
27
  case 'sm':
26
- return theme.breakpoints.values['md'];
28
+ return theme.spacing(6);
27
29
 
28
30
  case 'md':
29
- return theme.breakpoints.values['lg'];
30
-
31
31
  case 'lg':
32
- return 'none';
32
+ default:
33
+ return theme.spacing(4);
34
+ }
35
+ }
36
+
37
+ function getPaddingHorizontal(theme, breakpoint, isHomeScreen) {
38
+ if (isHomeScreen) {
39
+ return getHomeScreenPaddingHorizontal(theme, breakpoint);
40
+ }
41
+
42
+ switch (breakpoint) {
43
+ case 'sm':
44
+ return theme.spacing(6);
45
+
46
+ default:
47
+ return theme.spacing(4);
33
48
  }
34
49
  }
35
50
 
36
51
  function useContentContainerStyle() {
37
- let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultConfig;
52
+ let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
38
53
  const {
39
- breakpoint,
40
- maxWidth,
41
- styleProvider
42
- } = { ...defaultConfig,
43
- ...config
44
- };
54
+ maxWidth: customMaxWidth,
55
+ styleProvider,
56
+ isHomeScreen = false
57
+ } = config;
45
58
  const theme = (0, _styles.useTheme)();
59
+ const currentBreakpoint = theme.breakpoints.current;
46
60
  const additionalStyle = styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider(theme);
47
- const yesStyle = [{
61
+ return (0, _styles.css)([{
48
62
  alignSelf: 'center',
49
- maxWidth: getMaxWidth(theme, maxWidth),
63
+ maxWidth: getMaxWidth(theme, currentBreakpoint, customMaxWidth),
64
+ paddingHorizontal: getPaddingHorizontal(theme, currentBreakpoint, isHomeScreen),
50
65
  width: '100%'
51
- }, additionalStyle];
52
- return (0, _useBreakpointUp.default)(breakpoint, yesStyle, additionalStyle);
66
+ }, additionalStyle]);
53
67
  }
54
68
 
55
69
  ;
@@ -1 +1 @@
1
- {"version":3,"names":["defaultConfig","breakpoint","maxWidth","styleProvider","undefined","getMaxWidth","theme","breakpoints","values","useContentContainerStyle","config","useTheme","additionalStyle","yesStyle","alignSelf","width","useBreakpointUp"],"sources":["useContentContainerStyle.ts"],"sourcesContent":["import type { ScrollViewProps, ViewStyle } from 'react-native';\nimport type { Theme } from '../types';\nimport { useTheme } from '../styles';\nimport useBreakpointUp from './useBreakpointUp';\n\ntype Breakpoint = keyof Theme['breakpoints']['values'];\n\ntype ContentContainerStyle = ScrollViewProps['contentContainerStyle'];\n\nexport interface Config {\n breakpoint?: Breakpoint;\n maxWidth?: Breakpoint;\n styleProvider?: (theme: Theme) => ContentContainerStyle;\n}\n\nconst defaultConfig: Required<Config> = {\n breakpoint: 'lg',\n maxWidth: 'md',\n styleProvider: () => undefined,\n};\n\n// TODO: Needs to refactor\nfunction getMaxWidth(theme: Theme, breakpoint: Breakpoint): ViewStyle['maxWidth'] {\n switch (breakpoint) {\n case 'xs':\n return theme.breakpoints.values['sm'];\n case 'sm':\n return theme.breakpoints.values['md'];\n case 'md':\n return theme.breakpoints.values['lg'];\n case 'lg':\n return 'none';\n }\n}\n\nexport default function useContentContainerStyle(config: Config = defaultConfig): ContentContainerStyle {\n const {\n breakpoint,\n maxWidth,\n styleProvider,\n } = {\n ...defaultConfig,\n ...config,\n };\n\n const theme = useTheme();\n\n const additionalStyle = styleProvider?.(theme);\n\n const yesStyle: ContentContainerStyle = [\n {\n alignSelf: 'center',\n maxWidth: getMaxWidth(theme, maxWidth),\n width: '100%',\n },\n additionalStyle,\n ];\n\n return useBreakpointUp(breakpoint, yesStyle, additionalStyle);\n};\n"],"mappings":";;;;;;;AAEA;;AACA;;;;AAYA,MAAMA,aAA+B,GAAG;EACpCC,UAAU,EAAE,IADwB;EAEpCC,QAAQ,EAAE,IAF0B;EAGpCC,aAAa,EAAE,MAAMC;AAHe,CAAxC,C,CAMA;;AACA,SAASC,WAAT,CAAqBC,KAArB,EAAmCL,UAAnC,EAAkF;EAC9E,QAAQA,UAAR;IACI,KAAK,IAAL;MACI,OAAOK,KAAK,CAACC,WAAN,CAAkBC,MAAlB,CAAyB,IAAzB,CAAP;;IACJ,KAAK,IAAL;MACI,OAAOF,KAAK,CAACC,WAAN,CAAkBC,MAAlB,CAAyB,IAAzB,CAAP;;IACJ,KAAK,IAAL;MACI,OAAOF,KAAK,CAACC,WAAN,CAAkBC,MAAlB,CAAyB,IAAzB,CAAP;;IACJ,KAAK,IAAL;MACI,OAAO,MAAP;EARR;AAUH;;AAEc,SAASC,wBAAT,GAAyF;EAAA,IAAvDC,MAAuD,uEAAtCV,aAAsC;EACpG,MAAM;IACFC,UADE;IAEFC,QAFE;IAGFC;EAHE,IAIF,EACA,GAAGH,aADH;IAEA,GAAGU;EAFH,CAJJ;EASA,MAAMJ,KAAK,GAAG,IAAAK,gBAAA,GAAd;EAEA,MAAMC,eAAe,GAAGT,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAGG,KAAH,CAArC;EAEA,MAAMO,QAA+B,GAAG,CACpC;IACIC,SAAS,EAAE,QADf;IAEIZ,QAAQ,EAAEG,WAAW,CAACC,KAAD,EAAQJ,QAAR,CAFzB;IAGIa,KAAK,EAAE;EAHX,CADoC,EAMpCH,eANoC,CAAxC;EASA,OAAO,IAAAI,wBAAA,EAAgBf,UAAhB,EAA4BY,QAA5B,EAAsCD,eAAtC,CAAP;AACH;;AAAA"}
1
+ {"version":3,"names":["getMaxWidth","theme","breakpoint","customMaxWidth","breakpoints","values","undefined","getHomeScreenPaddingHorizontal","spacing","getPaddingHorizontal","isHomeScreen","useContentContainerStyle","config","maxWidth","styleProvider","useTheme","currentBreakpoint","current","additionalStyle","css","alignSelf","paddingHorizontal","width"],"sources":["useContentContainerStyle.ts"],"sourcesContent":["import type { FountainUiStyle } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport type { Theme } from '../types';\n\ntype Breakpoint = keyof Theme['breakpoints']['values'];\n\nexport interface Config {\n maxWidth?: number;\n styleProvider?: (theme: Theme) => FountainUiStyle;\n isHomeScreen?: boolean;\n}\n\nfunction getMaxWidth(theme: Theme, breakpoint: Breakpoint, customMaxWidth?: number): number | undefined {\n switch (breakpoint) {\n case 'lg':\n case 'md':\n return customMaxWidth ?? theme.breakpoints.values[breakpoint];\n default:\n return undefined;\n }\n}\n\nfunction getHomeScreenPaddingHorizontal(theme: Theme, breakpoint: Breakpoint): number {\n switch (breakpoint) {\n case 'xxs':\n case 'xs':\n return theme.spacing(3);\n case 'sm':\n return theme.spacing(6);\n case 'md':\n case 'lg':\n default:\n return theme.spacing(4);\n }\n}\n\nfunction getPaddingHorizontal(theme: Theme, breakpoint: Breakpoint, isHomeScreen?: boolean): number {\n if (isHomeScreen) {\n return getHomeScreenPaddingHorizontal(theme, breakpoint);\n }\n\n switch (breakpoint) {\n case 'sm':\n return theme.spacing(6);\n default:\n return theme.spacing(4);\n }\n}\n\nexport default function useContentContainerStyle(config: Config = {}): FountainUiStyle {\n const {\n maxWidth: customMaxWidth,\n styleProvider,\n isHomeScreen = false,\n } = config;\n\n const theme = useTheme();\n\n const currentBreakpoint = theme.breakpoints.current;\n\n const additionalStyle = styleProvider?.(theme);\n\n return css([\n {\n alignSelf: 'center',\n maxWidth: getMaxWidth(theme, currentBreakpoint, customMaxWidth),\n paddingHorizontal: getPaddingHorizontal(theme, currentBreakpoint, isHomeScreen),\n width: '100%',\n },\n additionalStyle,\n ]);\n};\n"],"mappings":";;;;;;;AACA;;AAWA,SAASA,WAAT,CAAqBC,KAArB,EAAmCC,UAAnC,EAA2DC,cAA3D,EAAwG;EACpG,QAAQD,UAAR;IACI,KAAK,IAAL;IACA,KAAK,IAAL;MACI,OAAOC,cAAc,IAAIF,KAAK,CAACG,WAAN,CAAkBC,MAAlB,CAAyBH,UAAzB,CAAzB;;IACJ;MACI,OAAOI,SAAP;EALR;AAOH;;AAED,SAASC,8BAAT,CAAwCN,KAAxC,EAAsDC,UAAtD,EAAsF;EAClF,QAAQA,UAAR;IACI,KAAK,KAAL;IACA,KAAK,IAAL;MACI,OAAOD,KAAK,CAACO,OAAN,CAAc,CAAd,CAAP;;IACJ,KAAK,IAAL;MACI,OAAOP,KAAK,CAACO,OAAN,CAAc,CAAd,CAAP;;IACJ,KAAK,IAAL;IACA,KAAK,IAAL;IACA;MACI,OAAOP,KAAK,CAACO,OAAN,CAAc,CAAd,CAAP;EATR;AAWH;;AAED,SAASC,oBAAT,CAA8BR,KAA9B,EAA4CC,UAA5C,EAAoEQ,YAApE,EAAoG;EAChG,IAAIA,YAAJ,EAAkB;IACd,OAAOH,8BAA8B,CAACN,KAAD,EAAQC,UAAR,CAArC;EACH;;EAED,QAAQA,UAAR;IACI,KAAK,IAAL;MACI,OAAOD,KAAK,CAACO,OAAN,CAAc,CAAd,CAAP;;IACJ;MACI,OAAOP,KAAK,CAACO,OAAN,CAAc,CAAd,CAAP;EAJR;AAMH;;AAEc,SAASG,wBAAT,GAAwE;EAAA,IAAtCC,MAAsC,uEAArB,EAAqB;EACnF,MAAM;IACFC,QAAQ,EAAEV,cADR;IAEFW,aAFE;IAGFJ,YAAY,GAAG;EAHb,IAIFE,MAJJ;EAMA,MAAMX,KAAK,GAAG,IAAAc,gBAAA,GAAd;EAEA,MAAMC,iBAAiB,GAAGf,KAAK,CAACG,WAAN,CAAkBa,OAA5C;EAEA,MAAMC,eAAe,GAAGJ,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAGb,KAAH,CAArC;EAEA,OAAO,IAAAkB,WAAA,EAAI,CACP;IACIC,SAAS,EAAE,QADf;IAEIP,QAAQ,EAAEb,WAAW,CAACC,KAAD,EAAQe,iBAAR,EAA2Bb,cAA3B,CAFzB;IAGIkB,iBAAiB,EAAEZ,oBAAoB,CAACR,KAAD,EAAQe,iBAAR,EAA2BN,YAA3B,CAH3C;IAIIY,KAAK,EAAE;EAJX,CADO,EAOPJ,eAPO,CAAJ,CAAP;AASH;;AAAA"}
@@ -55,7 +55,7 @@ function useFadeInAppBar() {
55
55
  const dy = (0, _reactNativeReanimated.useSharedValue)(0);
56
56
  const lastOffsetY = (0, _reactNativeReanimated.useSharedValue)(0);
57
57
  const normalized = (0, _reactNativeReanimated.useSharedValue)(0);
58
- const originalBackgroundColor = theme.palette.background.default;
58
+ const originalBackgroundColor = theme.palette.background.base;
59
59
  const rgbValues = (0, _react.useMemo)(() => (0, _utils.rgb)(originalBackgroundColor), [originalBackgroundColor]);
60
60
  const animatedAppBarStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
61
61
  const [r, g, b] = rgbValues;
@@ -89,7 +89,7 @@ function useFadeInAppBar() {
89
89
  onMomentumEnd: event => {
90
90
  lastOffsetY.value = event.contentOffset.y;
91
91
  }
92
- }, [keyboardDismissMode]);
92
+ });
93
93
  const appBarStyle = [animatedAppBarStyle, {
94
94
  paddingTop: safeAreaInsets.top
95
95
  }, floating ? styles.floating : undefined];
@@ -1 +1 @@
1
- {"version":3,"names":["defaultOptions","fadeInBeginY","endY","appBarHeight","fadeInEndY","floating","keyboardDismissMode","dismissKeyboard","Keyboard","dismiss","useFadeInAppBar","userOptions","theme","useTheme","styles","useAppbarStyles","safeAreaInsets","useSafeAreaInsets","onAppBarLayout","useHeight","fromOffsetY","toOffsetY","useMemo","beginY","scrollY","useSharedValue","dy","lastOffsetY","normalized","originalBackgroundColor","palette","background","default","rgbValues","rgb","animatedAppBarStyle","useAnimatedStyle","r","g","b","backgroundColor","value","borderColor","divider","borderBottomWidth","StyleSheet","hairlineWidth","animatedTitleStyle","opacity","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","onScroll","event","offsetY","contentOffset","y","distance","Math","max","localOffsetY","min","onEndDrag","onMomentumEnd","appBarStyle","paddingTop","top","undefined","titleStyle"],"sources":["useFadeInAppBar.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { Falsy, Keyboard, RegisteredStyle, ScrollViewProps, StyleSheet, ViewProps, ViewStyle } from 'react-native';\nimport type { SharedValue } from 'react-native-reanimated';\nimport { runOnJS, useAnimatedScrollHandler, useAnimatedStyle, useSharedValue } from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { rgb } from '@fountain-ui/utils';\nimport { useHeight } from '../internal/hooks';\nimport { useTheme } from '../styles';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface Options {\n fadeInBeginY?: number | ((endY: number, appBarHeight: number) => number);\n fadeInEndY?: number | ((appBarHeight: number) => number);\n floating?: boolean;\n keyboardDismissMode?: 'none' | 'on-drag';\n}\n\nexport interface FadeInAppBar {\n appBarStyle: ViewStyleProp;\n titleStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n scrollY: SharedValue<number>;\n dy: SharedValue<number>;\n normalized: SharedValue<number>;\n}\n\nconst defaultOptions: Required<Options> = {\n fadeInBeginY: (endY, appBarHeight) => endY - appBarHeight,\n fadeInEndY: (appBarHeight) => appBarHeight,\n floating: true,\n keyboardDismissMode: 'none',\n};\n\nconst dismissKeyboard = () => Keyboard.dismiss();\n\nexport default function useFadeInAppBar(userOptions: Options = defaultOptions): FadeInAppBar {\n const {\n fadeInBeginY,\n fadeInEndY,\n floating,\n keyboardDismissMode,\n }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const theme = useTheme();\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n\n const [fromOffsetY, toOffsetY] = useMemo(() => {\n const endY = typeof fadeInEndY === 'function'\n ? fadeInEndY(appBarHeight)\n : fadeInEndY;\n\n const beginY = typeof fadeInBeginY === 'function'\n ? fadeInBeginY(endY, appBarHeight)\n : fadeInBeginY;\n\n return [beginY, endY];\n }, [fadeInBeginY, fadeInBeginY, appBarHeight]);\n\n const scrollY = useSharedValue<number>(0);\n const dy = useSharedValue<number>(0);\n const lastOffsetY = useSharedValue<number>(0);\n const normalized = useSharedValue<number>(0);\n\n const originalBackgroundColor = theme.palette.background.default;\n const rgbValues = useMemo(() => rgb(originalBackgroundColor), [originalBackgroundColor]);\n\n const animatedAppBarStyle = useAnimatedStyle(() => {\n const [r, g, b] = rgbValues;\n const backgroundColor = `rgba(${r}, ${g}, ${b}, ${normalized.value})`;\n\n return {\n backgroundColor,\n borderColor: theme.palette.divider,\n borderBottomWidth: normalized.value >= 1 ? StyleSheet.hairlineWidth : 0,\n };\n }, [rgbValues]);\n\n const animatedTitleStyle = useAnimatedStyle(() => ({\n opacity: normalized.value,\n }), []);\n\n const scrollHandler = useAnimatedScrollHandler({\n onBeginDrag: () => {\n if (keyboardDismissMode === 'on-drag') {\n runOnJS(dismissKeyboard)();\n }\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n scrollY.value = offsetY;\n\n const distance = Math.max(toOffsetY - fromOffsetY, 1);\n const localOffsetY = offsetY - fromOffsetY;\n\n dy.value = offsetY - lastOffsetY.value;\n\n normalized.value = Math.min(Math.max(localOffsetY / distance, 0), 1);\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n }, [keyboardDismissMode]);\n\n const appBarStyle = [\n animatedAppBarStyle,\n { paddingTop: safeAreaInsets.top },\n floating ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n titleStyle: [animatedTitleStyle],\n onAppBarLayout,\n onScroll: scrollHandler,\n scrollY,\n dy,\n normalized,\n };\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAyBA,MAAMA,cAAiC,GAAG;EACtCC,YAAY,EAAE,CAACC,IAAD,EAAOC,YAAP,KAAwBD,IAAI,GAAGC,YADP;EAEtCC,UAAU,EAAGD,YAAD,IAAkBA,YAFQ;EAGtCE,QAAQ,EAAE,IAH4B;EAItCC,mBAAmB,EAAE;AAJiB,CAA1C;;AAOA,MAAMC,eAAe,GAAG,MAAMC,qBAAA,CAASC,OAAT,EAA9B;;AAEe,SAASC,eAAT,GAA8E;EAAA,IAArDC,WAAqD,uEAA9BX,cAA8B;EACzF,MAAM;IACFC,YADE;IAEFG,UAFE;IAGFC,QAHE;IAIFC;EAJE,IAKiB,EACnB,GAAGN,cADgB;IAEnB,GAAGW;EAFgB,CALvB;EAUA,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC,MAAM,GAAG,IAAAC,wBAAA,GAAf;EAEA,MAAMC,cAAc,GAAG,IAAAC,6CAAA,GAAvB;EAEA,MAAM,CAACd,YAAD,EAAee,cAAf,IAAiC,IAAAC,gBAAA,GAAvC;EAEA,MAAM,CAACC,WAAD,EAAcC,SAAd,IAA2B,IAAAC,cAAA,EAAQ,MAAM;IAC3C,MAAMpB,IAAI,GAAG,OAAOE,UAAP,KAAsB,UA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BAAD,CAFT;IAGH7B,cAHG;IAIHmC,QAAQ,EAAEJ,aAJP;IAKHzB,OALG;IAMHE,EANG;IAOHE;EAPG,CAAP;AASH;;AAAA"}
1
+ {"version":3,"names":["defaultOptions","fadeInBeginY","endY","appBarHeight","fadeInEndY","floating","keyboardDismissMode","dismissKeyboard","Keyboard","dismiss","useFadeInAppBar","userOptions","theme","useTheme","styles","useAppbarStyles","safeAreaInsets","useSafeAreaInsets","onAppBarLayout","useHeight","fromOffsetY","toOffsetY","useMemo","beginY","scrollY","useSharedValue","dy","lastOffsetY","normalized","originalBackgroundColor","palette","background","base","rgbValues","rgb","animatedAppBarStyle","useAnimatedStyle","r","g","b","backgroundColor","value","borderColor","divider","borderBottomWidth","StyleSheet","hairlineWidth","animatedTitleStyle","opacity","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","onScroll","event","offsetY","contentOffset","y","distance","Math","max","localOffsetY","min","onEndDrag","onMomentumEnd","appBarStyle","paddingTop","top","undefined","titleStyle"],"sources":["useFadeInAppBar.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { Falsy, Keyboard, RegisteredStyle, ScrollViewProps, StyleSheet, ViewProps, ViewStyle } from 'react-native';\nimport type { SharedValue } from 'react-native-reanimated';\nimport { runOnJS, useAnimatedScrollHandler, useAnimatedStyle, useSharedValue } from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { rgb } from '@fountain-ui/utils';\nimport { useHeight } from '../internal/hooks';\nimport { useTheme } from '../styles';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface Options {\n fadeInBeginY?: number | ((endY: number, appBarHeight: number) => number);\n fadeInEndY?: number | ((appBarHeight: number) => number);\n floating?: boolean;\n keyboardDismissMode?: 'none' | 'on-drag';\n}\n\nexport interface FadeInAppBar {\n appBarStyle: ViewStyleProp;\n titleStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n scrollY: SharedValue<number>;\n dy: SharedValue<number>;\n normalized: SharedValue<number>;\n}\n\nconst defaultOptions: Required<Options> = {\n fadeInBeginY: (endY, appBarHeight) => endY - appBarHeight,\n fadeInEndY: (appBarHeight) => appBarHeight,\n floating: true,\n keyboardDismissMode: 'none',\n};\n\nconst dismissKeyboard = () => Keyboard.dismiss();\n\nexport default function useFadeInAppBar(userOptions: Options = defaultOptions): FadeInAppBar {\n const {\n fadeInBeginY,\n fadeInEndY,\n floating,\n keyboardDismissMode,\n }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const theme = useTheme();\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n\n const [fromOffsetY, toOffsetY] = useMemo(() => {\n const endY = typeof fadeInEndY === 'function'\n ? fadeInEndY(appBarHeight)\n : fadeInEndY;\n\n const beginY = typeof fadeInBeginY === 'function'\n ? fadeInBeginY(endY, appBarHeight)\n : fadeInBeginY;\n\n return [beginY, endY];\n }, [fadeInBeginY, fadeInBeginY, appBarHeight]);\n\n const scrollY = useSharedValue<number>(0);\n const dy = useSharedValue<number>(0);\n const lastOffsetY = useSharedValue<number>(0);\n const normalized = useSharedValue<number>(0);\n\n const originalBackgroundColor = theme.palette.background.base;\n const rgbValues = useMemo(() => rgb(originalBackgroundColor), [originalBackgroundColor]);\n\n const animatedAppBarStyle = useAnimatedStyle(() => {\n const [r, g, b] = rgbValues;\n const backgroundColor = `rgba(${r}, ${g}, ${b}, ${normalized.value})`;\n\n return {\n backgroundColor,\n borderColor: theme.palette.divider,\n borderBottomWidth: normalized.value >= 1 ? StyleSheet.hairlineWidth : 0,\n };\n }, [rgbValues]);\n\n const animatedTitleStyle = useAnimatedStyle(() => ({\n opacity: normalized.value,\n }), []);\n\n const scrollHandler = useAnimatedScrollHandler({\n onBeginDrag: () => {\n if (keyboardDismissMode === 'on-drag') {\n runOnJS(dismissKeyboard)();\n }\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n scrollY.value = offsetY;\n\n const distance = Math.max(toOffsetY - fromOffsetY, 1);\n const localOffsetY = offsetY - fromOffsetY;\n\n dy.value = offsetY - lastOffsetY.value;\n\n normalized.value = Math.min(Math.max(localOffsetY / distance, 0), 1);\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n });\n\n const appBarStyle = [\n animatedAppBarStyle,\n { paddingTop: safeAreaInsets.top },\n floating ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n titleStyle: [animatedTitleStyle],\n onAppBarLayout,\n onScroll: scrollHandler,\n scrollY,\n dy,\n normalized,\n };\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;AAyBA,MAAMA,cAAiC,GAAG;EACtCC,YAAY,EAAE,CAACC,IAAD,EAAOC,YAAP,KAAwBD,IAAI,GAAGC,YADP;EAEtCC,UAAU,EAAGD,YAAD,IAAkBA,YAFQ;EAGtCE,QAAQ,EAAE,IAH4B;EAItCC,mBAAmB,EAAE;AAJiB,CAA1C;;AAOA,MAAMC,eAAe,GAAG,MAAMC,qBAAA,CAASC,OAAT,EAA9B;;AAEe,SAASC,eAAT,GAA8E;EAAA,IAArDC,WAAqD,uEAA9BX,cAA8B;EACzF,MAAM;IACFC,YADE;IAEFG,UAFE;IAGFC,QAHE;IAIFC;EAJE,IAKiB,EACnB,GAAGN,cADgB;IAEnB,GAAGW;EAFgB,CALvB;EAUA,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC,MAAM,GAAG,IAAAC,wBAAA,GAAf;EAEA,MAAMC,cAAc,GAAG,IAAAC,6CAAA,GAAvB;EAEA,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