@fountain-ui/core 3.0.0-alpha.5 → 3.0.0-alpha.50

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 (607) hide show
  1. package/build/commonjs/Accordion/Accordion.js +20 -13
  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 +13 -6
  5. package/build/commonjs/Accordion/useVariantStyleMap.js.map +1 -1
  6. package/build/commonjs/AppBar/AppBar.js +1 -1
  7. package/build/commonjs/AppBar/AppBar.js.map +1 -1
  8. package/build/commonjs/AspectRatio/AspectRatioNative.js +1 -1
  9. package/build/commonjs/AspectRatio/AspectRatioNative.js.map +1 -1
  10. package/build/commonjs/AspectRatio/AspectRatioWeb.js +1 -1
  11. package/build/commonjs/AspectRatio/AspectRatioWeb.js.map +1 -1
  12. package/build/commonjs/Badge/Badge.js +4 -3
  13. package/build/commonjs/Badge/Badge.js.map +1 -1
  14. package/build/commonjs/Badge/BadgeProps.js.map +1 -1
  15. package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js +7 -3
  16. package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
  17. package/build/commonjs/BottomSheetTitle/BottomSheetTitleProps.js.map +1 -1
  18. package/build/commonjs/Button/Button.js +26 -12
  19. package/build/commonjs/Button/Button.js.map +1 -1
  20. package/build/commonjs/Button/ButtonProps.js.map +1 -1
  21. package/build/commonjs/Button/useVariantStyleMap.js +18 -0
  22. package/build/commonjs/Button/useVariantStyleMap.js.map +1 -1
  23. package/build/commonjs/ButtonBase/ButtonBase.js +1 -1
  24. package/build/commonjs/ButtonBase/ButtonBase.js.map +1 -1
  25. package/build/commonjs/ButtonBase/index.js +2 -2
  26. package/build/commonjs/ButtonBase/index.js.map +1 -1
  27. package/build/commonjs/Checkbox/Checkbox.js +4 -1
  28. package/build/commonjs/Checkbox/Checkbox.js.map +1 -1
  29. package/build/commonjs/Checkbox/useVariantStyleMap.js +6 -2
  30. package/build/commonjs/Checkbox/useVariantStyleMap.js.map +1 -1
  31. package/build/commonjs/Chip/Chip.js +27 -14
  32. package/build/commonjs/Chip/Chip.js.map +1 -1
  33. package/build/commonjs/Chip/ChipProps.js +5 -1
  34. package/build/commonjs/Chip/ChipProps.js.map +1 -1
  35. package/build/commonjs/Chip/index.js +12 -0
  36. package/build/commonjs/Chip/index.js.map +1 -1
  37. package/build/commonjs/Chip/useChipStyle.js +59 -32
  38. package/build/commonjs/Chip/useChipStyle.js.map +1 -1
  39. package/build/commonjs/Dialog/Dialog.js +11 -12
  40. package/build/commonjs/Dialog/Dialog.js.map +1 -1
  41. package/build/commonjs/Dialog/DialogProps.js +1 -1
  42. package/build/commonjs/Dialog/DialogProps.js.map +1 -1
  43. package/build/commonjs/Dialog/useDialogSectionStyle.js +6 -4
  44. package/build/commonjs/Dialog/useDialogSectionStyle.js.map +1 -1
  45. package/build/commonjs/Dialog/useDialogStyle.js +19 -8
  46. package/build/commonjs/Dialog/useDialogStyle.js.map +1 -1
  47. package/build/commonjs/DialogActions/DialogActions.js +0 -1
  48. package/build/commonjs/DialogActions/DialogActions.js.map +1 -1
  49. package/build/commonjs/DialogTitle/DialogLargeTitle.js +80 -0
  50. package/build/commonjs/DialogTitle/DialogLargeTitle.js.map +1 -0
  51. package/build/commonjs/DialogTitle/DialogTitle.js +8 -4
  52. package/build/commonjs/DialogTitle/DialogTitle.js.map +1 -1
  53. package/build/commonjs/Divider/Divider.js +17 -9
  54. package/build/commonjs/Divider/Divider.js.map +1 -1
  55. package/build/commonjs/Divider/DividerProps.js +1 -1
  56. package/build/commonjs/Divider/DividerProps.js.map +1 -1
  57. package/build/commonjs/Empty/Empty.js +1 -1
  58. package/build/commonjs/Empty/Empty.js.map +1 -1
  59. package/build/commonjs/Flexbox/Flexbox.js +2 -0
  60. package/build/commonjs/Flexbox/Flexbox.js.map +1 -1
  61. package/build/commonjs/Flexbox/FlexboxProps.js.map +1 -1
  62. package/build/commonjs/IconButton/IconButton.js +3 -0
  63. package/build/commonjs/IconButton/IconButton.js.map +1 -1
  64. package/build/commonjs/IconButton/IconButtonProps.js +1 -1
  65. package/build/commonjs/IconButton/IconButtonProps.js.map +1 -1
  66. package/build/commonjs/Image/Image.js +13 -4
  67. package/build/commonjs/Image/Image.js.map +1 -1
  68. package/build/commonjs/Image/ImageProps.js.map +1 -1
  69. package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButton.js +46 -0
  70. package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButton.js.map +1 -0
  71. package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButtonProps.js +2 -0
  72. package/build/commonjs/Image/OverlayCloseButton/OverlayCloseButtonProps.js.map +1 -0
  73. package/build/commonjs/Image/OverlayCloseButton/index.js +16 -0
  74. package/build/commonjs/Image/OverlayCloseButton/index.js.map +1 -0
  75. package/build/commonjs/Image/preload.js +10 -0
  76. package/build/commonjs/Image/preload.js.map +1 -0
  77. package/build/commonjs/Image/preload.native.js +22 -0
  78. package/build/commonjs/Image/preload.native.js.map +1 -0
  79. package/build/commonjs/ImageCore/ImageCoreNative.js +13 -10
  80. package/build/commonjs/ImageCore/ImageCoreNative.js.map +1 -1
  81. package/build/commonjs/ImageCore/ImageCoreProps.js.map +1 -1
  82. package/build/commonjs/ListItem/ListItem.js +5 -15
  83. package/build/commonjs/ListItem/ListItem.js.map +1 -1
  84. package/build/commonjs/ListItemText/ListItemText.js +2 -2
  85. package/build/commonjs/ListItemText/ListItemText.js.map +1 -1
  86. package/build/commonjs/ListSubheader/ListSubheader.js +1 -1
  87. package/build/commonjs/ListSubheader/ListSubheader.js.map +1 -1
  88. package/build/commonjs/Modal/Modal.js +29 -20
  89. package/build/commonjs/Modal/Modal.js.map +1 -1
  90. package/build/commonjs/Modal/ModalProps.js.map +1 -1
  91. package/build/commonjs/Pagination/NumberPagination.js +4 -2
  92. package/build/commonjs/Pagination/NumberPagination.js.map +1 -1
  93. package/build/commonjs/Pagination/Pagination.js +2 -0
  94. package/build/commonjs/Pagination/Pagination.js.map +1 -1
  95. package/build/commonjs/Pagination/PaginationProps.js +3 -1
  96. package/build/commonjs/Pagination/PaginationProps.js.map +1 -1
  97. package/build/commonjs/Pagination/index.js +6 -0
  98. package/build/commonjs/Pagination/index.js.map +1 -1
  99. package/build/commonjs/PaginationItem/PaginationItem.js +32 -22
  100. package/build/commonjs/PaginationItem/PaginationItem.js.map +1 -1
  101. package/build/commonjs/PaginationItem/PaginationItemProps.js.map +1 -1
  102. package/build/commonjs/Radio/Radio.js +31 -8
  103. package/build/commonjs/Radio/Radio.js.map +1 -1
  104. package/build/commonjs/Radio/RadioProps.js.map +1 -1
  105. package/build/commonjs/RadioGroup/RadioGroup.js +2 -27
  106. package/build/commonjs/RadioGroup/RadioGroup.js.map +1 -1
  107. package/build/commonjs/ShadowView/ShadowView.native.js +1 -1
  108. package/build/commonjs/ShadowView/ShadowView.native.js.map +1 -1
  109. package/build/commonjs/Slider/Slider.js +22 -18
  110. package/build/commonjs/Slider/Slider.js.map +1 -1
  111. package/build/commonjs/SnackbarContent/SnackbarContent.js +24 -7
  112. package/build/commonjs/SnackbarContent/SnackbarContent.js.map +1 -1
  113. package/build/commonjs/Tab/Tab.js +21 -19
  114. package/build/commonjs/Tab/Tab.js.map +1 -1
  115. package/build/commonjs/Tab/TabProps.js +4 -2
  116. package/build/commonjs/Tab/TabProps.js.map +1 -1
  117. package/build/commonjs/Tab/index.js +14 -0
  118. package/build/commonjs/Tab/index.js.map +1 -1
  119. package/build/commonjs/Tab/useVariantStyleMap.js +57 -16
  120. package/build/commonjs/Tab/useVariantStyleMap.js.map +1 -1
  121. package/build/commonjs/TabBase/TabBase.js +1 -8
  122. package/build/commonjs/TabBase/TabBase.js.map +1 -1
  123. package/build/commonjs/TabBase/TabBaseProps.js.map +1 -1
  124. package/build/commonjs/Tabs/Tabs.js +32 -11
  125. package/build/commonjs/Tabs/Tabs.js.map +1 -1
  126. package/build/commonjs/Tabs/TabsProps.js.map +1 -1
  127. package/build/commonjs/Tabs/index.js.map +1 -1
  128. package/build/commonjs/Tabs/useTabsStyle.js +81 -0
  129. package/build/commonjs/Tabs/useTabsStyle.js.map +1 -0
  130. package/build/commonjs/TextField/TextField.js +99 -17
  131. package/build/commonjs/TextField/TextField.js.map +1 -1
  132. package/build/commonjs/TextField/TextFieldProps.js +3 -1
  133. package/build/commonjs/TextField/TextFieldProps.js.map +1 -1
  134. package/build/commonjs/TextField/useVariantStyleMap.js +50 -30
  135. package/build/commonjs/TextField/useVariantStyleMap.js.map +1 -1
  136. package/build/commonjs/Toolbar/BackButton/BackButton.js +47 -0
  137. package/build/commonjs/Toolbar/BackButton/BackButton.js.map +1 -0
  138. package/build/commonjs/Toolbar/BackButton/BackButtonProps.js +2 -0
  139. package/build/commonjs/Toolbar/BackButton/BackButtonProps.js.map +1 -0
  140. package/build/commonjs/Toolbar/BackButton/index.js +16 -0
  141. package/build/commonjs/Toolbar/BackButton/index.js.map +1 -0
  142. package/build/commonjs/Toolbar/Toolbar.js +22 -12
  143. package/build/commonjs/Toolbar/Toolbar.js.map +1 -1
  144. package/build/commonjs/Toolbar/ToolbarProps.js.map +1 -1
  145. package/build/commonjs/Tooltip/Beaks/index.js +32 -0
  146. package/build/commonjs/Tooltip/Beaks/index.js.map +1 -1
  147. package/build/commonjs/Tooltip/Tooltip.js +23 -23
  148. package/build/commonjs/Tooltip/Tooltip.js.map +1 -1
  149. package/build/commonjs/Tooltip/TooltipProps.js.map +1 -1
  150. package/build/commonjs/Tooltip/index.js +19 -0
  151. package/build/commonjs/Tooltip/index.js.map +1 -1
  152. package/build/commonjs/Typography/Typography.js +9 -2
  153. package/build/commonjs/Typography/Typography.js.map +1 -1
  154. package/build/commonjs/Typography/TypographyProps.js.map +1 -1
  155. package/build/commonjs/hooks/useCollapsibleAppBar.js +21 -13
  156. package/build/commonjs/hooks/useCollapsibleAppBar.js.map +1 -1
  157. package/build/commonjs/hooks/useContentContainerStyle.js +35 -17
  158. package/build/commonjs/hooks/useContentContainerStyle.js.map +1 -1
  159. package/build/commonjs/hooks/useFadeInAppBar.js +4 -4
  160. package/build/commonjs/hooks/useFadeInAppBar.js.map +1 -1
  161. package/build/commonjs/internal/icons/AppBarChevronLeft.js +23 -0
  162. package/build/commonjs/internal/icons/AppBarChevronLeft.js.map +1 -0
  163. package/build/commonjs/internal/icons/ChevronLeft.js +4 -2
  164. package/build/commonjs/internal/icons/ChevronLeft.js.map +1 -1
  165. package/build/commonjs/internal/icons/ChevronRight.js +4 -2
  166. package/build/commonjs/internal/icons/ChevronRight.js.map +1 -1
  167. package/build/commonjs/internal/icons/ChipClose.js +23 -0
  168. package/build/commonjs/internal/icons/ChipClose.js.map +1 -0
  169. package/build/commonjs/internal/icons/Clear.js +3 -3
  170. package/build/commonjs/internal/icons/Clear.js.map +1 -1
  171. package/build/commonjs/internal/icons/Close.js +4 -2
  172. package/build/commonjs/internal/icons/Close.js.map +1 -1
  173. package/build/commonjs/internal/icons/CloseCircleFillPierced.js +23 -0
  174. package/build/commonjs/internal/icons/CloseCircleFillPierced.js.map +1 -0
  175. package/build/commonjs/internal/icons/Search.js +2 -2
  176. package/build/commonjs/internal/icons/Search.js.map +1 -1
  177. package/build/commonjs/internal/icons/index.js +24 -0
  178. package/build/commonjs/internal/icons/index.js.map +1 -1
  179. package/build/module/Accordion/Accordion.js +20 -13
  180. package/build/module/Accordion/Accordion.js.map +1 -1
  181. package/build/module/Accordion/AccordionProps.js.map +1 -1
  182. package/build/module/Accordion/useVariantStyleMap.js +13 -6
  183. package/build/module/Accordion/useVariantStyleMap.js.map +1 -1
  184. package/build/module/AppBar/AppBar.js +1 -1
  185. package/build/module/AppBar/AppBar.js.map +1 -1
  186. package/build/module/AspectRatio/AspectRatioNative.js +1 -1
  187. package/build/module/AspectRatio/AspectRatioNative.js.map +1 -1
  188. package/build/module/AspectRatio/AspectRatioWeb.js +1 -1
  189. package/build/module/AspectRatio/AspectRatioWeb.js.map +1 -1
  190. package/build/module/Badge/Badge.js +4 -3
  191. package/build/module/Badge/Badge.js.map +1 -1
  192. package/build/module/Badge/BadgeProps.js.map +1 -1
  193. package/build/module/BottomSheetTitle/BottomSheetTitle.js +7 -3
  194. package/build/module/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
  195. package/build/module/BottomSheetTitle/BottomSheetTitleProps.js.map +1 -1
  196. package/build/module/Button/Button.js +27 -13
  197. package/build/module/Button/Button.js.map +1 -1
  198. package/build/module/Button/ButtonProps.js.map +1 -1
  199. package/build/module/Button/useVariantStyleMap.js +18 -0
  200. package/build/module/Button/useVariantStyleMap.js.map +1 -1
  201. package/build/module/ButtonBase/ButtonBase.js +1 -1
  202. package/build/module/ButtonBase/ButtonBase.js.map +1 -1
  203. package/build/module/ButtonBase/index.js +1 -1
  204. package/build/module/ButtonBase/index.js.map +1 -1
  205. package/build/module/Checkbox/Checkbox.js +4 -1
  206. package/build/module/Checkbox/Checkbox.js.map +1 -1
  207. package/build/module/Checkbox/useVariantStyleMap.js +6 -2
  208. package/build/module/Checkbox/useVariantStyleMap.js.map +1 -1
  209. package/build/module/Chip/Chip.js +23 -13
  210. package/build/module/Chip/Chip.js.map +1 -1
  211. package/build/module/Chip/ChipProps.js +2 -0
  212. package/build/module/Chip/ChipProps.js.map +1 -1
  213. package/build/module/Chip/index.js +1 -1
  214. package/build/module/Chip/index.js.map +1 -1
  215. package/build/module/Chip/useChipStyle.js +59 -32
  216. package/build/module/Chip/useChipStyle.js.map +1 -1
  217. package/build/module/Dialog/Dialog.js +11 -11
  218. package/build/module/Dialog/Dialog.js.map +1 -1
  219. package/build/module/Dialog/DialogProps.js +1 -1
  220. package/build/module/Dialog/DialogProps.js.map +1 -1
  221. package/build/module/Dialog/useDialogSectionStyle.js +6 -4
  222. package/build/module/Dialog/useDialogSectionStyle.js.map +1 -1
  223. package/build/module/Dialog/useDialogStyle.js +18 -8
  224. package/build/module/Dialog/useDialogStyle.js.map +1 -1
  225. package/build/module/DialogActions/DialogActions.js +0 -1
  226. package/build/module/DialogActions/DialogActions.js.map +1 -1
  227. package/build/module/DialogTitle/DialogLargeTitle.js +65 -0
  228. package/build/module/DialogTitle/DialogLargeTitle.js.map +1 -0
  229. package/build/module/DialogTitle/DialogTitle.js +6 -3
  230. package/build/module/DialogTitle/DialogTitle.js.map +1 -1
  231. package/build/module/Divider/Divider.js +7 -0
  232. package/build/module/Divider/Divider.js.map +1 -1
  233. package/build/module/Divider/DividerProps.js +1 -1
  234. package/build/module/Divider/DividerProps.js.map +1 -1
  235. package/build/module/Empty/Empty.js +1 -1
  236. package/build/module/Empty/Empty.js.map +1 -1
  237. package/build/module/Flexbox/Flexbox.js +2 -0
  238. package/build/module/Flexbox/Flexbox.js.map +1 -1
  239. package/build/module/Flexbox/FlexboxProps.js.map +1 -1
  240. package/build/module/IconButton/IconButton.js +3 -0
  241. package/build/module/IconButton/IconButton.js.map +1 -1
  242. package/build/module/IconButton/IconButtonProps.js +1 -1
  243. package/build/module/IconButton/IconButtonProps.js.map +1 -1
  244. package/build/module/Image/Image.js +11 -4
  245. package/build/module/Image/Image.js.map +1 -1
  246. package/build/module/Image/ImageProps.js.map +1 -1
  247. package/build/module/Image/OverlayCloseButton/OverlayCloseButton.js +31 -0
  248. package/build/module/Image/OverlayCloseButton/OverlayCloseButton.js.map +1 -0
  249. package/build/module/Image/OverlayCloseButton/OverlayCloseButtonProps.js +2 -0
  250. package/build/module/Image/OverlayCloseButton/OverlayCloseButtonProps.js.map +1 -0
  251. package/build/module/Image/OverlayCloseButton/index.js +2 -0
  252. package/build/module/Image/OverlayCloseButton/index.js.map +1 -0
  253. package/build/module/Image/preload.js +3 -0
  254. package/build/module/Image/preload.js.map +1 -0
  255. package/build/module/Image/preload.native.js +12 -0
  256. package/build/module/Image/preload.native.js.map +1 -0
  257. package/build/module/ImageCore/ImageCoreNative.js +14 -10
  258. package/build/module/ImageCore/ImageCoreNative.js.map +1 -1
  259. package/build/module/ImageCore/ImageCoreProps.js.map +1 -1
  260. package/build/module/ListItem/ListItem.js +5 -15
  261. package/build/module/ListItem/ListItem.js.map +1 -1
  262. package/build/module/ListItemText/ListItemText.js +2 -2
  263. package/build/module/ListItemText/ListItemText.js.map +1 -1
  264. package/build/module/ListSubheader/ListSubheader.js +1 -1
  265. package/build/module/ListSubheader/ListSubheader.js.map +1 -1
  266. package/build/module/Modal/Modal.js +30 -21
  267. package/build/module/Modal/Modal.js.map +1 -1
  268. package/build/module/Modal/ModalProps.js.map +1 -1
  269. package/build/module/Pagination/NumberPagination.js +4 -2
  270. package/build/module/Pagination/NumberPagination.js.map +1 -1
  271. package/build/module/Pagination/Pagination.js +2 -0
  272. package/build/module/Pagination/Pagination.js.map +1 -1
  273. package/build/module/Pagination/PaginationProps.js +1 -0
  274. package/build/module/Pagination/PaginationProps.js.map +1 -1
  275. package/build/module/Pagination/index.js +1 -1
  276. package/build/module/Pagination/index.js.map +1 -1
  277. package/build/module/PaginationItem/PaginationItem.js +28 -21
  278. package/build/module/PaginationItem/PaginationItem.js.map +1 -1
  279. package/build/module/PaginationItem/PaginationItemProps.js.map +1 -1
  280. package/build/module/Radio/Radio.js +28 -8
  281. package/build/module/Radio/Radio.js.map +1 -1
  282. package/build/module/Radio/RadioProps.js.map +1 -1
  283. package/build/module/RadioGroup/RadioGroup.js +2 -20
  284. package/build/module/RadioGroup/RadioGroup.js.map +1 -1
  285. package/build/module/ShadowView/ShadowView.native.js +2 -2
  286. package/build/module/ShadowView/ShadowView.native.js.map +1 -1
  287. package/build/module/Slider/Slider.js +22 -18
  288. package/build/module/Slider/Slider.js.map +1 -1
  289. package/build/module/SnackbarContent/SnackbarContent.js +24 -7
  290. package/build/module/SnackbarContent/SnackbarContent.js.map +1 -1
  291. package/build/module/Tab/Tab.js +22 -19
  292. package/build/module/Tab/Tab.js.map +1 -1
  293. package/build/module/Tab/TabProps.js +2 -1
  294. package/build/module/Tab/TabProps.js.map +1 -1
  295. package/build/module/Tab/index.js +1 -0
  296. package/build/module/Tab/index.js.map +1 -1
  297. package/build/module/Tab/useVariantStyleMap.js +57 -16
  298. package/build/module/Tab/useVariantStyleMap.js.map +1 -1
  299. package/build/module/TabBase/TabBase.js +1 -8
  300. package/build/module/TabBase/TabBase.js.map +1 -1
  301. package/build/module/TabBase/TabBaseProps.js.map +1 -1
  302. package/build/module/Tabs/Tabs.js +31 -12
  303. package/build/module/Tabs/Tabs.js.map +1 -1
  304. package/build/module/Tabs/TabsProps.js.map +1 -1
  305. package/build/module/Tabs/index.js.map +1 -1
  306. package/build/module/Tabs/useTabsStyle.js +71 -0
  307. package/build/module/Tabs/useTabsStyle.js.map +1 -0
  308. package/build/module/TextField/TextField.js +99 -18
  309. package/build/module/TextField/TextField.js.map +1 -1
  310. package/build/module/TextField/TextFieldProps.js +1 -0
  311. package/build/module/TextField/TextFieldProps.js.map +1 -1
  312. package/build/module/TextField/useVariantStyleMap.js +49 -30
  313. package/build/module/TextField/useVariantStyleMap.js.map +1 -1
  314. package/build/module/Toolbar/BackButton/BackButton.js +32 -0
  315. package/build/module/Toolbar/BackButton/BackButton.js.map +1 -0
  316. package/build/module/Toolbar/BackButton/BackButtonProps.js +2 -0
  317. package/build/module/Toolbar/BackButton/BackButtonProps.js.map +1 -0
  318. package/build/module/Toolbar/BackButton/index.js +2 -0
  319. package/build/module/Toolbar/BackButton/index.js.map +1 -0
  320. package/build/module/Toolbar/Toolbar.js +20 -12
  321. package/build/module/Toolbar/Toolbar.js.map +1 -1
  322. package/build/module/Toolbar/ToolbarProps.js.map +1 -1
  323. package/build/module/Tooltip/Beaks/index.js +4 -0
  324. package/build/module/Tooltip/Beaks/index.js.map +1 -1
  325. package/build/module/Tooltip/Tooltip.js +17 -16
  326. package/build/module/Tooltip/Tooltip.js.map +1 -1
  327. package/build/module/Tooltip/TooltipProps.js.map +1 -1
  328. package/build/module/Tooltip/index.js +1 -0
  329. package/build/module/Tooltip/index.js.map +1 -1
  330. package/build/module/Typography/Typography.js +9 -2
  331. package/build/module/Typography/Typography.js.map +1 -1
  332. package/build/module/Typography/TypographyProps.js.map +1 -1
  333. package/build/module/hooks/useCollapsibleAppBar.js +22 -13
  334. package/build/module/hooks/useCollapsibleAppBar.js.map +1 -1
  335. package/build/module/hooks/useContentContainerStyle.js +32 -13
  336. package/build/module/hooks/useContentContainerStyle.js.map +1 -1
  337. package/build/module/hooks/useFadeInAppBar.js +4 -4
  338. package/build/module/hooks/useFadeInAppBar.js.map +1 -1
  339. package/build/module/internal/icons/AppBarChevronLeft.js +9 -0
  340. package/build/module/internal/icons/AppBarChevronLeft.js.map +1 -0
  341. package/build/module/internal/icons/ChevronLeft.js +4 -2
  342. package/build/module/internal/icons/ChevronLeft.js.map +1 -1
  343. package/build/module/internal/icons/ChevronRight.js +4 -2
  344. package/build/module/internal/icons/ChevronRight.js.map +1 -1
  345. package/build/module/internal/icons/ChipClose.js +9 -0
  346. package/build/module/internal/icons/ChipClose.js.map +1 -0
  347. package/build/module/internal/icons/Clear.js +3 -3
  348. package/build/module/internal/icons/Clear.js.map +1 -1
  349. package/build/module/internal/icons/Close.js +4 -2
  350. package/build/module/internal/icons/Close.js.map +1 -1
  351. package/build/module/internal/icons/CloseCircleFillPierced.js +9 -0
  352. package/build/module/internal/icons/CloseCircleFillPierced.js.map +1 -0
  353. package/build/module/internal/icons/Search.js +2 -2
  354. package/build/module/internal/icons/Search.js.map +1 -1
  355. package/build/module/internal/icons/index.js +3 -0
  356. package/build/module/internal/icons/index.js.map +1 -1
  357. package/build/typescript/Accordion/Accordion.d.ts +0 -1
  358. package/build/typescript/Accordion/AccordionProps.d.ts +4 -1
  359. package/build/typescript/Accordion/useVariantStyleMap.d.ts +1 -0
  360. package/build/typescript/AspectRatio/AspectRatioNative.d.ts +0 -1
  361. package/build/typescript/AspectRatio/AspectRatioWeb.d.ts +0 -1
  362. package/build/typescript/Avatar/Avatar.d.ts +0 -1
  363. package/build/typescript/Badge/Badge.d.ts +0 -1
  364. package/build/typescript/Badge/BadgeProps.d.ts +10 -5
  365. package/build/typescript/BottomSheetActions/BottomSheetActions.d.ts +0 -1
  366. package/build/typescript/BottomSheetContent/BottomSheetContent.d.ts +0 -1
  367. package/build/typescript/BottomSheetTitle/BottomSheetTitle.d.ts +0 -1
  368. package/build/typescript/BottomSheetTitle/BottomSheetTitleProps.d.ts +3 -3
  369. package/build/typescript/Button/Button.d.ts +0 -1
  370. package/build/typescript/Button/ButtonProps.d.ts +5 -0
  371. package/build/typescript/ButtonBase/ButtonBase.d.ts +0 -1
  372. package/build/typescript/ButtonBase/index.d.ts +1 -1
  373. package/build/typescript/ButtonSet/ButtonSet.d.ts +0 -1
  374. package/build/typescript/Card/Card.d.ts +0 -1
  375. package/build/typescript/CardActions/CardActions.d.ts +0 -1
  376. package/build/typescript/CardContent/CardContent.d.ts +0 -1
  377. package/build/typescript/CardMedia/CardMedia.d.ts +0 -1
  378. package/build/typescript/Checkbox/Checkbox.d.ts +0 -1
  379. package/build/typescript/Checkbox/useVariantStyleMap.d.ts +1 -0
  380. package/build/typescript/Chip/Chip.d.ts +0 -1
  381. package/build/typescript/Chip/ChipProps.d.ts +18 -4
  382. package/build/typescript/Chip/index.d.ts +2 -2
  383. package/build/typescript/Chip/useChipStyle.d.ts +6 -3
  384. package/build/typescript/CircularProgress/CircularProgress.d.ts +0 -1
  385. package/build/typescript/Column/Column.d.ts +0 -1
  386. package/build/typescript/Dialog/Dialog.d.ts +0 -1
  387. package/build/typescript/Dialog/DialogProps.d.ts +1 -6
  388. package/build/typescript/Dialog/useDialogSectionStyle.d.ts +1 -2
  389. package/build/typescript/Dialog/useDialogStyle.d.ts +1 -1
  390. package/build/typescript/DialogActions/DialogActions.d.ts +0 -1
  391. package/build/typescript/DialogContent/DialogContent.d.ts +0 -1
  392. package/build/typescript/DialogMedia/DialogMedia.d.ts +0 -1
  393. package/build/typescript/DialogTitle/DialogLargeTitle.d.ts +8 -0
  394. package/build/typescript/DialogTitle/DialogTitle.d.ts +6 -2
  395. package/build/typescript/Divider/Divider.d.ts +0 -1
  396. package/build/typescript/Divider/DividerProps.d.ts +1 -1
  397. package/build/typescript/Empty/Empty.d.ts +0 -1
  398. package/build/typescript/Fab/Fab.d.ts +0 -1
  399. package/build/typescript/Flexbox/Flexbox.d.ts +0 -1
  400. package/build/typescript/Flexbox/FlexboxProps.d.ts +4 -0
  401. package/build/typescript/IconButton/IconButton.d.ts +0 -1
  402. package/build/typescript/IconButton/IconButtonProps.d.ts +1 -1
  403. package/build/typescript/Image/Image.d.ts +6 -2
  404. package/build/typescript/Image/ImageProps.d.ts +6 -0
  405. package/build/typescript/Image/OverlayCloseButton/OverlayCloseButton.d.ts +2 -0
  406. package/build/typescript/Image/OverlayCloseButton/OverlayCloseButtonProps.d.ts +3 -0
  407. package/build/typescript/Image/OverlayCloseButton/index.d.ts +2 -0
  408. package/build/typescript/Image/preload.d.ts +2 -0
  409. package/build/typescript/Image/preload.native.d.ts +2 -0
  410. package/build/typescript/ImageCore/ImageCoreNative.d.ts +0 -1
  411. package/build/typescript/ImageCore/ImageCoreProps.d.ts +1 -0
  412. package/build/typescript/ImageCore/ImageCoreWeb.d.ts +0 -1
  413. package/build/typescript/Link/Link.d.ts +0 -1
  414. package/build/typescript/List/List.d.ts +0 -1
  415. package/build/typescript/ListItem/ListItem.d.ts +0 -1
  416. package/build/typescript/ListItemIcon/ListItemIcon.d.ts +0 -1
  417. package/build/typescript/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +0 -1
  418. package/build/typescript/ListItemText/ListItemText.d.ts +0 -1
  419. package/build/typescript/ListSubheader/ListSubheader.d.ts +0 -1
  420. package/build/typescript/Menu/Menu.d.ts +0 -1
  421. package/build/typescript/MenuItem/MenuItem.d.ts +0 -1
  422. package/build/typescript/Modal/AnimatedContainer/index.d.ts +0 -1
  423. package/build/typescript/Modal/Modal.d.ts +0 -1
  424. package/build/typescript/Modal/ModalProps.d.ts +8 -0
  425. package/build/typescript/Pagination/NumberPagination.d.ts +0 -1
  426. package/build/typescript/Pagination/Pagination.d.ts +0 -1
  427. package/build/typescript/Pagination/PaginationProps.d.ts +12 -0
  428. package/build/typescript/Pagination/index.d.ts +2 -2
  429. package/build/typescript/PaginationItem/PaginationItemProps.d.ts +6 -0
  430. package/build/typescript/Portal/Portal.d.ts +0 -1
  431. package/build/typescript/Radio/Radio.d.ts +0 -1
  432. package/build/typescript/Radio/RadioProps.d.ts +4 -0
  433. package/build/typescript/RadioGroup/RadioGroup.d.ts +0 -1
  434. package/build/typescript/Row/Row.d.ts +0 -1
  435. package/build/typescript/Section/Section.d.ts +0 -1
  436. package/build/typescript/ShadowView/ShadowView.d.ts +0 -1
  437. package/build/typescript/ShadowView/ShadowView.native.d.ts +0 -1
  438. package/build/typescript/Slide/Slide.d.ts +0 -1
  439. package/build/typescript/Slider/Slider.d.ts +1 -1
  440. package/build/typescript/Snackbar/Snackbar.d.ts +0 -1
  441. package/build/typescript/SnackbarContent/SnackbarContent.d.ts +0 -1
  442. package/build/typescript/SnackbarContent/StatusIcon.d.ts +0 -1
  443. package/build/typescript/Spacer/Spacer.d.ts +0 -1
  444. package/build/typescript/SvgIcon/SvgIcon.d.ts +0 -1
  445. package/build/typescript/Switch/Switch.d.ts +0 -1
  446. package/build/typescript/Tab/Tab.d.ts +0 -1
  447. package/build/typescript/Tab/TabProps.d.ts +21 -2
  448. package/build/typescript/Tab/index.d.ts +2 -1
  449. package/build/typescript/Tab/useVariantStyleMap.d.ts +4 -2
  450. package/build/typescript/TabBase/TabBase.d.ts +0 -1
  451. package/build/typescript/TabBase/TabBaseProps.d.ts +0 -5
  452. package/build/typescript/Tabs/ScrollableTabsView.d.ts +0 -1
  453. package/build/typescript/Tabs/TabIndicator.d.ts +0 -1
  454. package/build/typescript/Tabs/Tabs.d.ts +1 -1
  455. package/build/typescript/Tabs/TabsProps.d.ts +6 -1
  456. package/build/typescript/Tabs/index.d.ts +1 -1
  457. package/build/typescript/Tabs/useTabsStyle.d.ts +8 -0
  458. package/build/typescript/TextField/TextFieldProps.d.ts +13 -0
  459. package/build/typescript/TextField/useVariantStyleMap.d.ts +4 -2
  460. package/build/typescript/Toggle/Toggle.d.ts +0 -1
  461. package/build/typescript/Toolbar/BackButton/BackButton.d.ts +2 -0
  462. package/build/typescript/Toolbar/BackButton/BackButtonProps.d.ts +4 -0
  463. package/build/typescript/Toolbar/BackButton/index.d.ts +2 -0
  464. package/build/typescript/Toolbar/Toolbar.d.ts +6 -2
  465. package/build/typescript/Toolbar/ToolbarProps.d.ts +0 -5
  466. package/build/typescript/Tooltip/Beaks/Beak.d.ts +0 -1
  467. package/build/typescript/Tooltip/Beaks/HorizontalLargeBeak.d.ts +0 -1
  468. package/build/typescript/Tooltip/Beaks/HorizontalSmallBeak.d.ts +0 -1
  469. package/build/typescript/Tooltip/Beaks/VerticalLargeBeak.d.ts +0 -1
  470. package/build/typescript/Tooltip/Beaks/VerticalSmallBeak.d.ts +0 -1
  471. package/build/typescript/Tooltip/Beaks/index.d.ts +4 -0
  472. package/build/typescript/Tooltip/Tooltip.d.ts +0 -1
  473. package/build/typescript/Tooltip/TooltipProps.d.ts +2 -2
  474. package/build/typescript/Tooltip/index.d.ts +1 -0
  475. package/build/typescript/Typography/TypographyProps.d.ts +4 -0
  476. package/build/typescript/animated/AnimatedAppBar.d.ts +1 -2
  477. package/build/typescript/animated/AnimatedFlatList.d.ts +1 -2
  478. package/build/typescript/animated/AnimatedTypography.d.ts +1 -2
  479. package/build/typescript/hooks/useCollapsibleAppBar.d.ts +2 -1
  480. package/build/typescript/hooks/useContentContainerStyle.d.ts +2 -1
  481. package/build/typescript/internal/icons/AppBarChevronLeft.d.ts +358 -0
  482. package/build/typescript/internal/icons/Check.d.ts +300 -73
  483. package/build/typescript/internal/icons/CheckCircle.d.ts +300 -73
  484. package/build/typescript/internal/icons/Checkbox.d.ts +300 -73
  485. package/build/typescript/internal/icons/CheckboxChecked.d.ts +300 -73
  486. package/build/typescript/internal/icons/CheckboxOn.d.ts +300 -73
  487. package/build/typescript/internal/icons/ChevronDown.d.ts +300 -73
  488. package/build/typescript/internal/icons/ChevronLeft.d.ts +300 -73
  489. package/build/typescript/internal/icons/ChevronRight.d.ts +300 -73
  490. package/build/typescript/internal/icons/ChipClose.d.ts +358 -0
  491. package/build/typescript/internal/icons/CircularProgress.d.ts +0 -1
  492. package/build/typescript/internal/icons/Clear.d.ts +300 -73
  493. package/build/typescript/internal/icons/Close.d.ts +300 -73
  494. package/build/typescript/internal/icons/CloseCircleFillPierced.d.ts +358 -0
  495. package/build/typescript/internal/icons/EyeOff.d.ts +300 -73
  496. package/build/typescript/internal/icons/EyeOn.d.ts +300 -73
  497. package/build/typescript/internal/icons/InfoCircle.d.ts +300 -73
  498. package/build/typescript/internal/icons/LoadingSpinner/index.d.ts +0 -1
  499. package/build/typescript/internal/icons/LoadingSpinner/index.native.d.ts +0 -1
  500. package/build/typescript/internal/icons/Radio.d.ts +300 -73
  501. package/build/typescript/internal/icons/RadioChecked.d.ts +300 -73
  502. package/build/typescript/internal/icons/Search.d.ts +300 -73
  503. package/build/typescript/internal/icons/index.d.ts +3 -0
  504. package/package.json +10 -10
  505. package/src/Accordion/Accordion.tsx +23 -14
  506. package/src/Accordion/AccordionProps.ts +4 -2
  507. package/src/Accordion/useVariantStyleMap.ts +12 -4
  508. package/src/AppBar/AppBar.tsx +2 -2
  509. package/src/AspectRatio/AspectRatioNative.tsx +2 -2
  510. package/src/AspectRatio/AspectRatioWeb.tsx +3 -3
  511. package/src/Badge/Badge.tsx +4 -3
  512. package/src/Badge/BadgeProps.ts +12 -6
  513. package/src/BottomSheetTitle/BottomSheetTitle.tsx +6 -2
  514. package/src/BottomSheetTitle/BottomSheetTitleProps.ts +3 -3
  515. package/src/Button/Button.tsx +28 -12
  516. package/src/Button/ButtonProps.ts +6 -0
  517. package/src/Button/useVariantStyleMap.ts +18 -0
  518. package/src/ButtonBase/ButtonBase.tsx +1 -1
  519. package/src/ButtonBase/index.ts +1 -1
  520. package/src/Checkbox/Checkbox.tsx +11 -8
  521. package/src/Checkbox/useVariantStyleMap.ts +6 -1
  522. package/src/Chip/Chip.tsx +27 -13
  523. package/src/Chip/ChipProps.ts +22 -4
  524. package/src/Chip/index.ts +2 -2
  525. package/src/Chip/useChipStyle.ts +75 -29
  526. package/src/Dialog/Dialog.tsx +13 -11
  527. package/src/Dialog/DialogProps.ts +1 -7
  528. package/src/Dialog/useDialogSectionStyle.ts +6 -4
  529. package/src/Dialog/useDialogStyle.ts +19 -7
  530. package/src/DialogActions/DialogActions.tsx +0 -1
  531. package/src/DialogTitle/DialogLargeTitle.tsx +95 -0
  532. package/src/DialogTitle/DialogTitle.tsx +6 -1
  533. package/src/Divider/Divider.tsx +5 -0
  534. package/src/Divider/DividerProps.ts +1 -1
  535. package/src/Empty/Empty.tsx +1 -1
  536. package/src/Flexbox/Flexbox.tsx +2 -0
  537. package/src/Flexbox/FlexboxProps.ts +5 -0
  538. package/src/IconButton/IconButton.tsx +2 -0
  539. package/src/IconButton/IconButtonProps.ts +1 -0
  540. package/src/Image/Image.tsx +13 -4
  541. package/src/Image/ImageProps.ts +7 -0
  542. package/src/Image/OverlayCloseButton/OverlayCloseButton.tsx +41 -0
  543. package/src/Image/OverlayCloseButton/OverlayCloseButtonProps.ts +3 -0
  544. package/src/Image/OverlayCloseButton/index.ts +2 -0
  545. package/src/Image/preload.native.ts +6 -0
  546. package/src/Image/preload.ts +5 -0
  547. package/src/ImageCore/ImageCoreNative.tsx +13 -10
  548. package/src/ImageCore/ImageCoreProps.ts +1 -0
  549. package/src/ListItem/ListItem.tsx +5 -15
  550. package/src/ListItemText/ListItemText.tsx +2 -2
  551. package/src/ListSubheader/ListSubheader.tsx +1 -1
  552. package/src/Modal/Modal.tsx +12 -4
  553. package/src/Modal/ModalProps.ts +9 -0
  554. package/src/Pagination/NumberPagination.tsx +7 -2
  555. package/src/Pagination/Pagination.tsx +3 -2
  556. package/src/Pagination/PaginationProps.ts +15 -0
  557. package/src/Pagination/index.ts +2 -2
  558. package/src/PaginationItem/PaginationItem.tsx +31 -24
  559. package/src/PaginationItem/PaginationItemProps.ts +7 -0
  560. package/src/Radio/Radio.tsx +46 -17
  561. package/src/Radio/RadioProps.ts +6 -0
  562. package/src/RadioGroup/RadioGroup.tsx +2 -28
  563. package/src/ShadowView/ShadowView.native.tsx +2 -2
  564. package/src/Slider/Slider.tsx +1 -0
  565. package/src/SnackbarContent/SnackbarContent.tsx +35 -14
  566. package/src/Tab/Tab.tsx +32 -22
  567. package/src/Tab/TabProps.ts +25 -2
  568. package/src/Tab/index.ts +2 -1
  569. package/src/Tab/useVariantStyleMap.ts +70 -17
  570. package/src/TabBase/TabBase.tsx +1 -9
  571. package/src/TabBase/TabBaseProps.ts +0 -6
  572. package/src/Tabs/Tabs.tsx +40 -13
  573. package/src/Tabs/TabsProps.ts +7 -1
  574. package/src/Tabs/index.ts +1 -1
  575. package/src/Tabs/useTabsStyle.ts +79 -0
  576. package/src/TextField/TextField.tsx +142 -47
  577. package/src/TextField/TextFieldProps.ts +16 -0
  578. package/src/TextField/useVariantStyleMap.ts +57 -30
  579. package/src/Toolbar/BackButton/BackButton.tsx +42 -0
  580. package/src/Toolbar/BackButton/BackButtonProps.ts +4 -0
  581. package/src/Toolbar/BackButton/index.ts +2 -0
  582. package/src/Toolbar/Toolbar.tsx +26 -17
  583. package/src/Toolbar/ToolbarProps.ts +0 -6
  584. package/src/Tooltip/Beaks/index.ts +4 -0
  585. package/src/Tooltip/Tooltip.tsx +16 -13
  586. package/src/Tooltip/TooltipProps.ts +2 -2
  587. package/src/Tooltip/index.ts +1 -0
  588. package/src/Typography/Typography.tsx +3 -1
  589. package/src/Typography/TypographyProps.ts +5 -0
  590. package/src/hooks/useCollapsibleAppBar.ts +27 -24
  591. package/src/hooks/useContentContainerStyle.ts +29 -12
  592. package/src/hooks/useFadeInAppBar.ts +4 -4
  593. package/src/internal/icons/AppBarChevronLeft.tsx +15 -0
  594. package/src/internal/icons/ChevronLeft.tsx +4 -1
  595. package/src/internal/icons/ChevronRight.tsx +4 -1
  596. package/src/internal/icons/ChipClose.tsx +13 -0
  597. package/src/internal/icons/Clear.tsx +3 -3
  598. package/src/internal/icons/Close.tsx +4 -1
  599. package/src/internal/icons/CloseCircleFillPierced.tsx +13 -0
  600. package/src/internal/icons/Search.tsx +2 -2
  601. package/src/internal/icons/index.ts +3 -0
  602. package/build/commonjs/ButtonBase/LegacyButtonBase.js +0 -126
  603. package/build/commonjs/ButtonBase/LegacyButtonBase.js.map +0 -1
  604. package/build/module/ButtonBase/LegacyButtonBase.js +0 -106
  605. package/build/module/ButtonBase/LegacyButtonBase.js.map +0 -1
  606. package/build/typescript/ButtonBase/LegacyButtonBase.d.ts +0 -5
  607. package/src/ButtonBase/LegacyButtonBase.tsx +0 -135
@@ -1,18 +1,21 @@
1
1
  function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
2
 
3
3
  import React from 'react';
4
+ import { View } from 'react-native';
4
5
  import Row from '../Row';
5
- import { css, useTheme } from '../styles';
6
+ import { useBreakpointUp } from '../hooks';
7
+ import { css } from '../styles';
8
+ import BackButton from './BackButton';
6
9
 
7
10
  const useStyles = function () {
8
- const theme = useTheme();
11
+ const shouldApplyHorizontalPadding = useBreakpointUp('sm', true, false);
9
12
  return {
13
+ container: {
14
+ paddingHorizontal: shouldApplyHorizontalPadding ? 8 : 0
15
+ },
10
16
  root: {
11
17
  alignItems: 'center',
12
18
  flexWrap: 'nowrap'
13
- },
14
- gutters: {
15
- paddingHorizontal: theme.spacing(4)
16
19
  }
17
20
  };
18
21
  };
@@ -28,17 +31,22 @@ const sizeMap = {
28
31
  height: 56
29
32
  }
30
33
  };
31
- export default function Toolbar(props) {
34
+
35
+ const Toolbar = props => {
32
36
  const {
33
- disableGutters = false,
34
37
  size = 'medium',
35
38
  style,
36
39
  ...otherProps
37
40
  } = props;
38
41
  const styles = useStyles();
39
- return /*#__PURE__*/React.createElement(Row, _extends({
40
- style: css([styles.root, !disableGutters ? styles.gutters : undefined, sizeMap[size], style])
41
- }, otherProps));
42
- }
43
- ;
42
+ const rootStyle = css([styles.root, sizeMap[size], style]);
43
+ return /*#__PURE__*/React.createElement(View, {
44
+ style: styles.container
45
+ }, /*#__PURE__*/React.createElement(Row, _extends({
46
+ style: rootStyle
47
+ }, otherProps)));
48
+ };
49
+
50
+ Toolbar.BackButton = BackButton;
51
+ export default Toolbar;
44
52
  //# sourceMappingURL=Toolbar.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["React","Row","css","useTheme","useStyles","theme","root","alignItems","flexWrap","gutters","paddingHorizontal","spacing","sizeMap","small","height","medium","large","Toolbar","props","disableGutters","size","style","otherProps","styles","undefined"],"sources":["Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport type { FountainUiStyle, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport Row from '../Row';\nimport { css, useTheme } from '../styles';\nimport type ToolbarProps from './ToolbarProps';\nimport type { ToolbarSize } from './ToolbarProps';\n\ntype ToolbarStyles = NamedStylesStringUnion<'root' | 'gutters'>;\n\nconst useStyles: UseStyles<ToolbarStyles> = function (): ToolbarStyles {\n const theme = useTheme();\n\n return {\n root: {\n alignItems: 'center',\n flexWrap: 'nowrap',\n },\n gutters: {\n paddingHorizontal: theme.spacing(4),\n },\n };\n};\n\nconst sizeMap: Record<ToolbarSize, FountainUiStyle> = {\n small: { height: 48 },\n medium: { height: 50 },\n large: { height: 56 },\n};\n\nexport default function Toolbar(props: ToolbarProps) {\n const {\n disableGutters = false,\n size = 'medium',\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n return (\n <Row\n style={css([\n styles.root,\n !disableGutters ? styles.gutters : undefined,\n sizeMap[size],\n style,\n ])}\n {...otherProps}\n />\n );\n};\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AAEA,OAAOC,GAAP,MAAgB,QAAhB;AACA,SAASC,GAAT,EAAcC,QAAd,QAA8B,WAA9B;;AAMA,MAAMC,SAAmC,GAAG,YAA2B;EACnE,MAAMC,KAAK,GAAGF,QAAQ,EAAtB;EAEA,OAAO;IACHG,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,QAAQ,EAAE;IAFR,CADH;IAKHC,OAAO,EAAE;MACLC,iBAAiB,EAAEL,KAAK,CAACM,OAAN,CAAc,CAAd;IADd;EALN,CAAP;AASH,CAZD;;AAcA,MAAMC,OAA6C,GAAG;EAClDC,KAAK,EAAE;IAAEC,MAAM,EAAE;EAAV,CAD2C;EAElDC,MAAM,EAAE;IAAED,MAAM,EAAE;EAAV,CAF0C;EAGlDE,KAAK,EAAE;IAAEF,MAAM,EAAE;EAAV;AAH2C,CAAtD;AAMA,eAAe,SAASG,OAAT,CAAiBC,KAAjB,EAAsC;EACjD,MAAM;IACFC,cAAc,GAAG,KADf;IAEFC,IAAI,GAAG,QAFL;IAGFC,KAHE;IAIF,GAAGC;EAJD,IAKFJ,KALJ;EAOA,MAAMK,MAAM,GAAGnB,SAAS,EAAxB;EAEA,oBACI,oBAAC,GAAD;IACI,KAAK,EAAEF,GAAG,CAAC,CACPqB,MAAM,CAACjB,IADA,EAEP,CAACa,cAAD,GAAkBI,MAAM,CAACd,OAAzB,GAAmCe,SAF5B,EAGPZ,OAAO,CAACQ,IAAD,CAHA,EAIPC,KAJO,CAAD;EADd,GAOQC,UAPR,EADJ;AAWH;AAAA"}
1
+ {"version":3,"names":["React","View","Row","useBreakpointUp","css","BackButton","useStyles","shouldApplyHorizontalPadding","container","paddingHorizontal","root","alignItems","flexWrap","sizeMap","small","height","medium","large","Toolbar","props","size","style","otherProps","styles","rootStyle"],"sources":["Toolbar.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport type { FountainUiStyle, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport Row from '../Row';\nimport { useBreakpointUp } from '../hooks';\nimport { css } from '../styles';\nimport BackButton from './BackButton';\nimport type ToolbarProps from './ToolbarProps';\nimport type { ToolbarSize } from './ToolbarProps';\n\ntype ToolbarStyles = NamedStylesStringUnion<'container' | 'root'>;\n\nconst useStyles: UseStyles<ToolbarStyles> = function (): ToolbarStyles {\n const shouldApplyHorizontalPadding = useBreakpointUp('sm', true, false);\n\n return {\n container: {\n paddingHorizontal: shouldApplyHorizontalPadding ? 8 : 0,\n },\n root: {\n alignItems: 'center',\n flexWrap: 'nowrap',\n },\n };\n};\n\nconst sizeMap: Record<ToolbarSize, FountainUiStyle> = {\n small: { height: 48 },\n medium: { height: 50 },\n large: { height: 56 },\n};\n\nconst Toolbar = (props: ToolbarProps) => {\n const {\n size = 'medium',\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const rootStyle = css([\n styles.root,\n sizeMap[size],\n style,\n ]);\n\n return (\n <View style={styles.container}>\n <Row\n style={rootStyle}\n {...otherProps}\n />\n </View>\n );\n};\n\nToolbar.BackButton = BackButton;\n\nexport default Toolbar;\n"],"mappings":";;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,IAAT,QAAqB,cAArB;AAEA,OAAOC,GAAP,MAAgB,QAAhB;AACA,SAASC,eAAT,QAAgC,UAAhC;AACA,SAASC,GAAT,QAAoB,WAApB;AACA,OAAOC,UAAP,MAAuB,cAAvB;;AAMA,MAAMC,SAAmC,GAAG,YAA2B;EACnE,MAAMC,4BAA4B,GAAGJ,eAAe,CAAC,IAAD,EAAO,IAAP,EAAa,KAAb,CAApD;EAEA,OAAO;IACHK,SAAS,EAAE;MACPC,iBAAiB,EAAEF,4BAA4B,GAAG,CAAH,GAAO;IAD/C,CADR;IAIHG,IAAI,EAAE;MACFC,UAAU,EAAE,QADV;MAEFC,QAAQ,EAAE;IAFR;EAJH,CAAP;AASH,CAZD;;AAcA,MAAMC,OAA6C,GAAG;EAClDC,KAAK,EAAE;IAAEC,MAAM,EAAE;EAAV,CAD2C;EAElDC,MAAM,EAAE;IAAED,MAAM,EAAE;EAAV,CAF0C;EAGlDE,KAAK,EAAE;IAAEF,MAAM,EAAE;EAAV;AAH2C,CAAtD;;AAMA,MAAMG,OAAO,GAAIC,KAAD,IAAyB;EACrC,MAAM;IACFC,IAAI,GAAG,QADL;IAEFC,KAFE;IAGF,GAAGC;EAHD,IAIFH,KAJJ;EAMA,MAAMI,MAAM,GAAGjB,SAAS,EAAxB;EAEA,MAAMkB,SAAS,GAAGpB,GAAG,CAAC,CAClBmB,MAAM,CAACb,IADW,EAElBG,OAAO,CAACO,IAAD,CAFW,EAGlBC,KAHkB,CAAD,CAArB;EAMA,oBACI,oBAAC,IAAD;IAAM,KAAK,EAAEE,MAAM,CAACf;EAApB,gBACI,oBAAC,GAAD;IACI,KAAK,EAAEgB;EADX,GAEQF,UAFR,EADJ,CADJ;AAQH,CAvBD;;AAyBAJ,OAAO,CAACb,UAAR,GAAqBA,UAArB;AAEA,eAAea,OAAf"}
@@ -1 +1 @@
1
- {"version":3,"names":["toolbarSizes"],"sources":["ToolbarProps.ts"],"sourcesContent":["import React from 'react';\nimport type { RowProps } from '../Row';\nimport type { OverridableComponentProps } from '../types';\n\nexport const toolbarSizes = ['small', 'medium', 'large'] as const;\nexport type ToolbarSize = typeof toolbarSizes[number];\n\nexport default interface ToolbarProps extends OverridableComponentProps<RowProps, {\n /**\n * The content of the component.\n */\n children: React.ReactNode,\n\n /**\n * If `true`, disables gutter padding.\n * @default false\n */\n disableGutters?: boolean,\n\n /**\n * Determines the height of the toolbar.\n * @default 'medium'\n */\n size?: ToolbarSize;\n}> {}\n"],"mappings":"AAIA,OAAO,MAAMA,YAAY,GAAG,CAAC,OAAD,EAAU,QAAV,EAAoB,OAApB,CAArB"}
1
+ {"version":3,"names":["toolbarSizes"],"sources":["ToolbarProps.ts"],"sourcesContent":["import React from 'react';\nimport type { RowProps } from '../Row';\nimport type { OverridableComponentProps } from '../types';\n\nexport const toolbarSizes = ['small', 'medium', 'large'] as const;\nexport type ToolbarSize = typeof toolbarSizes[number];\n\nexport default interface ToolbarProps extends OverridableComponentProps<RowProps, {\n /**\n * The content of the component.\n */\n children: React.ReactNode,\n\n /**\n * Determines the height of the toolbar.\n * @default 'medium'\n */\n size?: ToolbarSize;\n}> {}\n"],"mappings":"AAIA,OAAO,MAAMA,YAAY,GAAG,CAAC,OAAD,EAAU,QAAV,EAAoB,OAApB,CAArB"}
@@ -1,2 +1,6 @@
1
1
  export { default } from './Beak';
2
+ export { default as HorizontalLargeBeak } from './HorizontalLargeBeak';
3
+ export { default as HorizontalSmallBeak } from './HorizontalSmallBeak';
4
+ export { default as VerticalLargeBeak } from './VerticalLargeBeak';
5
+ export { default as VerticalSmallBeak } from './VerticalSmallBeak';
2
6
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default"],"sources":["index.ts"],"sourcesContent":["export { default } from './Beak';\nexport type { default as BeakProps } from './BeakProps';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,QAAxB"}
1
+ {"version":3,"names":["default","HorizontalLargeBeak","HorizontalSmallBeak","VerticalLargeBeak","VerticalSmallBeak"],"sources":["index.ts"],"sourcesContent":["export { default } from './Beak';\nexport type { default as BeakProps } from './BeakProps';\nexport { default as HorizontalLargeBeak } from './HorizontalLargeBeak';\nexport { default as HorizontalSmallBeak } from './HorizontalSmallBeak';\nexport { default as VerticalLargeBeak } from './VerticalLargeBeak';\nexport { default as VerticalSmallBeak } from './VerticalSmallBeak';\n"],"mappings":"AAAA,SAASA,OAAT,QAAwB,QAAxB;AAEA,SAASA,OAAO,IAAIC,mBAApB,QAA+C,uBAA/C;AACA,SAASD,OAAO,IAAIE,mBAApB,QAA+C,uBAA/C;AACA,SAASF,OAAO,IAAIG,iBAApB,QAA6C,qBAA7C;AACA,SAASH,OAAO,IAAII,iBAApB,QAA6C,qBAA7C"}
@@ -1,7 +1,8 @@
1
+ function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
+
1
3
  import React, { useEffect, useState } from 'react';
2
- import { Platform, Text, View } from 'react-native';
4
+ import { Platform, StyleSheet, Text, View } from 'react-native';
3
5
  import Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';
4
- import { typographyOf } from '@fountain-ui/styles';
5
6
  import ButtonBase from '../ButtonBase';
6
7
  import { createFontStyle, css, useTheme } from '../styles';
7
8
  import Beak from './Beaks';
@@ -50,14 +51,14 @@ const useStyles = function () {
50
51
  },
51
52
  small: {
52
53
  borderRadius: theme.shape.radius.sm,
54
+ paddingBottom: theme.spacing(1.75),
53
55
  paddingHorizontal: theme.spacing(2),
54
- paddingVertical: theme.spacing(1.5)
56
+ paddingTop: theme.spacing(1.5)
55
57
  },
56
58
  large: {
57
59
  borderRadius: 5,
58
- paddingBottom: theme.spacing(2.5),
59
60
  paddingHorizontal: theme.spacing(4),
60
- paddingTop: theme.spacing(2)
61
+ paddingVertical: theme.spacing(2)
61
62
  }
62
63
  };
63
64
  };
@@ -77,7 +78,8 @@ export default function Tooltip(props) {
77
78
  title,
78
79
  tooltipStyle,
79
80
  verticalOffset = 4,
80
- visible = false
81
+ visible = false,
82
+ ...otherProps
81
83
  } = props;
82
84
  const {
83
85
  offset: beakOffset,
@@ -91,7 +93,7 @@ export default function Tooltip(props) {
91
93
  transform: [{
92
94
  scale: scale.value
93
95
  }]
94
- }), []);
96
+ }), [scale]);
95
97
  const flexDirection = getFlexDirection(placement);
96
98
  const isVerticalPlacement = placement === 'top' || placement === 'bottom';
97
99
  const totalOffset = -((isVerticalPlacement ? layout.height : layout.width) + verticalOffset);
@@ -121,23 +123,22 @@ export default function Tooltip(props) {
121
123
  scale.value = withTiming(nextScaleValue, ANIMATION_CONFIG);
122
124
  }, [visible]);
123
125
  const fontStyle = createFontStyle(theme, {
124
- selector: typo => size === 'large' ? typographyOf({
125
- fontSize: 13,
126
- lineHeight: 19.5,
127
- fontFamily: 'PretendardStd-Regular',
128
- letterSpacing: 0
129
- }) : typo.caption2.regular,
126
+ selector: typo => size === 'large' ? typo.body3.regular : typo.caption2.regular,
130
127
  color: theme.palette.text.strongInverse
131
128
  });
132
129
  const textStyle = css([fontStyle, {
133
130
  flexShrink: 1
134
131
  }]);
132
+ const beakOverlapStyle = {
133
+ [placement === 'top' ? 'marginTop' : placement === 'bottom' ? 'marginBottom' : placement === 'left' ? 'marginLeft' : 'marginRight']: -StyleSheet.hairlineWidth
134
+ };
135
135
  const beakStyle = css({
136
136
  transform: [isVerticalPlacement ? {
137
137
  translateX: beakOffset
138
138
  } : {
139
139
  translateY: beakOffset
140
- }]
140
+ }],
141
+ ...beakOverlapStyle
141
142
  });
142
143
  const buttonElem = /*#__PURE__*/React.createElement(ButtonBase, {
143
144
  pressEffect: 'none',
@@ -155,9 +156,9 @@ export default function Tooltip(props) {
155
156
  placement: placement,
156
157
  size: size
157
158
  }));
158
- return /*#__PURE__*/React.createElement(View, {
159
+ return /*#__PURE__*/React.createElement(View, _extends({
159
160
  style: style
160
- }, children, /*#__PURE__*/React.createElement(Animated.View, {
161
+ }, otherProps), children, /*#__PURE__*/React.createElement(Animated.View, {
161
162
  onLayout: event => {
162
163
  if (event.nativeEvent.layout.height === 0) {
163
164
  return;
@@ -1 +1 @@
1
- {"version":3,"names":["React","useEffect","useState","Platform","Text","View","Animated","useAnimatedStyle","useSharedValue","withTiming","typographyOf","ButtonBase","createFontStyle","css","useTheme","Beak","DEFAULT_BEAK_LAYOUT","offset","placement","INITIAL_LAYOUT","width","height","x","y","ANIMATION_CONFIG","duration","getFlexDirection","useStyles","theme","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","scale","animatedStyle","transform","value","flexDirection","isVerticalPlacement","totalOffset","tooltipLayoutStyle","alignItems","undefined","overflow","select","web","display","default","contentStyle","flexGrow","flexShrink","nextScaleValue","fontStyle","selector","typo","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: 'PretendardStd-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,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,QAAT,EAAmBC,IAAnB,EAAyBC,IAAzB,QAAgD,cAAhD;AAEA,OAAOC,QAAP,IAAmBC,gBAAnB,EAAqCC,cAArC,EAAqDC,UAArD,QAAuE,yBAAvE;AAEA,SAASC,YAAT,QAA6B,qBAA7B;AACA,OAAOC,UAAP,MAAuB,eAAvB;AACA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,QAA/B,QAA+C,WAA/C;AAGA,OAAOC,IAAP,MAAiB,SAAjB;AAEA,MAAMC,mBAAsC,GAAG;EAC3CC,MAAM,EAAE,CADmC;EAE3CC,SAAS,EAAE;AAFgC,CAA/C;AAKA,MAAMC,cAAc,GAAG;EAAEC,KA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CAFkB,CAAD,CAArB;EAKA,MAAMe,SAAS,GAAGxF,GAAG,CAAC;IAClB0D,SAAS,EAAE,CAACG,mBAAmB,GAAG;MAAE4B,UAAU,EAAEtC;IAAd,CAAH,GAAgC;MAAEuC,UAAU,EAAEvC;IAAd,CAApD;EADO,CAAD,CAArB;EAIA,MAAMwC,UAAU,gBACZ,oBAAC,UAAD;IACI,WAAW,EAAE,MADjB;IAEI,OAAO,EAAEjD,OAFb;IAGI,KAAK,EAAE6B;EAHX,gBAKI,oBAAC,IAAD,CACI;EADJ;IAEI,aAAa,EAAE3B,kBAFnB;IAGI,KAAK,EAAE2C;EAHX,GAKKxC,KALL,CALJ,CADJ;EAgBA,MAAM6C,QAAQ,gBACV,oBAAC,IAAD;IAAM,KAAK,EAAEJ;EAAb,gBACI,oBAAC,IAAD;IACI,IAAI,EAAEzE,KAAK,CAACO,OAAN,CAAcC,IAAd,CAAmBC,IAD7B;IAEI,SAAS,EAAEnB,SAFf;IAGI,IAAI,EAAEwC;EAHV,EADJ,CADJ;EAUA,oBACI,oBAAC,IAAD;IAAM,KAAK,EAAEC;EAAb,GACKP,QADL,eAGI,oBAAC,QAAD,CAAU,IAAV;IACI,QAAQ,EAAGsD,KAAD,IAAW;MACjB,IAAIA,KAAK,CAACC,WAAN,CAAkBxC,MAAlB,CAAyB9C,MAAzB,KAAoC,CAAxC,EAA2C;QACvC;MACH;;MAED+C,SAAS,CAACsC,KAAK,CAACC,WAAN,CAAkBxC,MAAnB,CAAT;IACH,CAPL;IAQI,KAAK,EAAE,CACHD,MAAM,CAACrC,IADJ,EAEHyC,aAFG,EAGHM,kBAHG,EAIHf,YAJG;EARX,GAeK2C,UAfL,EAiBKC,QAjBL,CAHJ,CADJ;AAyBH;AAAA"}
1
+ {"version":3,"names":["React","useEffect","useState","Platform","StyleSheet","Text","View","Animated","useAnimatedStyle","useSharedValue","withTiming","ButtonBase","createFontStyle","css","useTheme","Beak","DEFAULT_BEAK_LAYOUT","offset","placement","INITIAL_LAYOUT","width","height","x","y","ANIMATION_CONFIG","duration","getFlexDirection","useStyles","theme","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","otherProps","beakOffset","beakPlacement","styles","layout","setLayout","scale","animatedStyle","transform","value","flexDirection","isVerticalPlacement","totalOffset","tooltipLayoutStyle","alignItems","undefined","overflow","select","web","display","default","contentStyle","flexGrow","flexShrink","nextScaleValue","fontStyle","selector","typo","body3","regular","caption2","color","text","strongInverse","textStyle","beakOverlapStyle","hairlineWidth","beakStyle","translateX","translateY","buttonElem","beakElem","event","nativeEvent"],"sources":["Tooltip.tsx"],"sourcesContent":["import React, { useEffect, useState } from 'react';\nimport { Platform, StyleSheet, 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 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 ...otherProps\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 }), [scale]);\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 beakOverlapStyle = {\n [placement === 'top' ? 'marginTop' : placement === 'bottom' ? 'marginBottom' : placement === 'left' ? 'marginLeft' : 'marginRight']: -StyleSheet.hairlineWidth,\n };\n\n const beakStyle = css({\n transform: [isVerticalPlacement ? { translateX: beakOffset } : { translateY: beakOffset }],\n ...beakOverlapStyle,\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\n style={style}\n {...otherProps}\n >\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,OAAOA,KAAP,IAAgBC,SAAhB,EAA2BC,QAA3B,QAA2C,OAA3C;AACA,SAASC,QAAT,EAAmBC,UAAnB,EAA+BC,IAA/B,EAAqCC,IAArC,QAA4D,cAA5D;AAEA,OAAOC,QAAP,IAAmBC,gBAAnB,EAAqCC,cAArC,EAAqDC,UAArD,QAAuE,yBAAvE;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C,WAAN,CAAkBvC,MAAlB,CAAyB/C,MAAzB,KAAoC,CAAxC,EAA2C;QACvC;MACH;;MAEDgD,SAAS,CAACqC,KAAK,CAACC,WAAN,CAAkBvC,MAAnB,CAAT;IACH,CAPL;IAQI,KAAK,EAAE,CACHD,MAAM,CAACtC,IADJ,EAEH0C,aAFG,EAGHM,kBAHG,EAIHhB,YAJG;EARX,GAeK2C,UAfL,EAiBKC,QAjBL,CANJ,CADJ;AA4BH;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":["tooltipPlacements","tooltipSizes","tooltipBeakPlacements"],"sources":["TooltipProps.ts"],"sourcesContent":["import React from 'react';\nimport type { TextProps, ViewProps } from 'react-native';\nimport type { ComponentProps } from '../types';\nimport type { ButtonProps } from '../Button';\n\nexport const tooltipPlacements = ['top', 'bottom', 'left', 'right'] as const;\nexport type TooltipPlacement = typeof tooltipPlacements[number];\n\nexport const tooltipSizes = ['small', 'large'] as const;\nexport type TooltipSize = typeof tooltipSizes[number];\n\nexport const tooltipBeakPlacements = ['start', 'middle', 'end'] as const;\nexport type TooltipBeakPlacement = typeof tooltipBeakPlacements[number];\n\nexport type TooltipBeakLayout = {\n placement: TooltipBeakPlacement;\n offset: number;\n};\n\nexport type TooltipInitialLayout = {\n height: number;\n width: number;\n x: number;\n y: number;\n};\n\nexport default interface TooltipProps extends ComponentProps<{\n /**\n * Tooltip reference element.\n */\n children: React.ReactNode;\n\n /**\n * Left position relative to reference element.\n */\n left?: number;\n\n /**\n * Callback fired when the component requests to be closed.\n */\n onClose?: () => void;\n\n /**\n * Tooltip placement.\n * @default 'top'\n */\n placement?: TooltipPlacement;\n\n /**\n * Right position relative to reference element.\n */\n right?: number;\n\n /**\n * Tooltip title.\n */\n title: ButtonProps['children'];\n\n /**\n * Additional style for tooltip wrapper.\n */\n tooltipStyle?: ViewProps['style'];\n\n /**\n * The additional amount to vertically shift.\n * @default 4\n */\n verticalOffset?: number;\n\n /**\n * If `true`, the tooltip is shown.\n * @default false\n */\n visible?: boolean;\n\n /**\n * Tooltip beak layout.\n * If 'undefined', the beak will be centered on tooltip.\n */\n beakLayout?: TooltipBeakLayout;\n\n /**\n * number of tooltip's title lines\n * @default 1\n */\n numberOfTitleLines?: TextProps['numberOfLines'];\n\n /**\n * position of tooltip before onLayout call\n * @default { height: 0, width: 0 , x: 0, y: 0}\n */\n initialLayout?: TooltipInitialLayout;\n\n /**\n * Determines the size of the tooltip.\n * @default 'small'\n */\n size?: TooltipSize;\n}> {}\n"],"mappings":"AAKA,OAAO,MAAMA,iBAAiB,GAAG,CAAC,KAAD,EAAQ,QAAR,EAAkB,MAAlB,EAA0B,OAA1B,CAA1B;AAGP,OAAO,MAAMC,YAAY,GAAG,CAAC,OAAD,EAAU,OAAV,CAArB;AAGP,OAAO,MAAMC,qBAAqB,GAAG,CAAC,OAAD,EAAU,QAAV,EAAoB,KAApB,CAA9B"}
1
+ {"version":3,"names":["tooltipPlacements","tooltipSizes","tooltipBeakPlacements"],"sources":["TooltipProps.ts"],"sourcesContent":["import React from 'react';\nimport type { TextProps, ViewProps } from 'react-native';\nimport type { ButtonProps } from '../Button';\nimport type { OverridableComponentProps } from '../types';\n\nexport const tooltipPlacements = ['top', 'bottom', 'left', 'right'] as const;\nexport type TooltipPlacement = typeof tooltipPlacements[number];\n\nexport const tooltipSizes = ['small', 'large'] as const;\nexport type TooltipSize = typeof tooltipSizes[number];\n\nexport const tooltipBeakPlacements = ['start', 'middle', 'end'] as const;\nexport type TooltipBeakPlacement = typeof tooltipBeakPlacements[number];\n\nexport type TooltipBeakLayout = {\n placement: TooltipBeakPlacement;\n offset: number;\n};\n\nexport type TooltipInitialLayout = {\n height: number;\n width: number;\n x: number;\n y: number;\n};\n\nexport default interface TooltipProps extends OverridableComponentProps<ViewProps, {\n /**\n * Tooltip reference element.\n */\n children: React.ReactNode;\n\n /**\n * Left position relative to reference element.\n */\n left?: number;\n\n /**\n * Callback fired when the component requests to be closed.\n */\n onClose?: () => void;\n\n /**\n * Tooltip placement.\n * @default 'top'\n */\n placement?: TooltipPlacement;\n\n /**\n * Right position relative to reference element.\n */\n right?: number;\n\n /**\n * Tooltip title.\n */\n title: ButtonProps['children'];\n\n /**\n * Additional style for tooltip wrapper.\n */\n tooltipStyle?: ViewProps['style'];\n\n /**\n * The additional amount to vertically shift.\n * @default 4\n */\n verticalOffset?: number;\n\n /**\n * If `true`, the tooltip is shown.\n * @default false\n */\n visible?: boolean;\n\n /**\n * Tooltip beak layout.\n * If 'undefined', the beak will be centered on tooltip.\n */\n beakLayout?: TooltipBeakLayout;\n\n /**\n * number of tooltip's title lines\n * @default 1\n */\n numberOfTitleLines?: TextProps['numberOfLines'];\n\n /**\n * position of tooltip before onLayout call\n * @default { height: 0, width: 0 , x: 0, y: 0}\n */\n initialLayout?: TooltipInitialLayout;\n\n /**\n * Determines the size of the tooltip.\n * @default 'small'\n */\n size?: TooltipSize;\n}> {}\n"],"mappings":"AAKA,OAAO,MAAMA,iBAAiB,GAAG,CAAC,KAAD,EAAQ,QAAR,EAAkB,MAAlB,EAA0B,OAA1B,CAA1B;AAGP,OAAO,MAAMC,YAAY,GAAG,CAAC,OAAD,EAAU,OAAV,CAArB;AAGP,OAAO,MAAMC,qBAAqB,GAAG,CAAC,OAAD,EAAU,QAAV,EAAoB,KAApB,CAA9B"}
@@ -1,3 +1,4 @@
1
1
  export { default } from './Tooltip';
2
2
  export { tooltipBeakPlacements, tooltipPlacements, tooltipSizes } from './TooltipProps';
3
+ export * from './Beaks';
3
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["default","tooltipBeakPlacements","tooltipPlacements","tooltipSizes"],"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,SAASA,OAAT,QAAwB,WAAxB;AAEA,SAASC,qBAAT,EAAgCC,iBAAhC,EAAmDC,YAAnD,QAAuE,gBAAvE"}
1
+ {"version":3,"names":["default","tooltipBeakPlacements","tooltipPlacements","tooltipSizes"],"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,SAASA,OAAT,QAAwB,WAAxB;AAEA,SAASC,qBAAT,EAAgCC,iBAAhC,EAAmDC,YAAnD,QAAuE,gBAAvE;AACA,cAAc,SAAd"}
@@ -42,6 +42,7 @@ const Typography = /*#__PURE__*/React.forwardRef(function Typography(props, ref)
42
42
  color: colorProp = 'inherit',
43
43
  ellipsizeMode = 'tail',
44
44
  href,
45
+ lineHeight,
45
46
  numberOfLines,
46
47
  onPress,
47
48
  selectable,
@@ -53,7 +54,11 @@ const Typography = /*#__PURE__*/React.forwardRef(function Typography(props, ref)
53
54
  } = props;
54
55
  const theme = useTheme();
55
56
  const fontStyle = createFontStyle(theme, {
56
- selector: typography => typography[variant][weight],
57
+ selector: typography => {
58
+ var _typography$variant;
59
+
60
+ return (_typography$variant = typography[variant]) === null || _typography$variant === void 0 ? void 0 : _typography$variant[weight];
61
+ },
57
62
  color: selectColor(theme, colorProp)
58
63
  }); // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.
59
64
 
@@ -62,7 +67,9 @@ const Typography = /*#__PURE__*/React.forwardRef(function Typography(props, ref)
62
67
  } : {};
63
68
  const textStyle = css([styles.root, {
64
69
  textAlign: align === 'inherit' ? 'auto' : align
65
- }, textWrapStyle, fontStyle, style]);
70
+ }, textWrapStyle, fontStyle, lineHeight ? {
71
+ lineHeight
72
+ } : undefined, style]);
66
73
  const accessibility = accessibilityMap[variant];
67
74
  const variantRole = href !== undefined ? 'link' : accessibility === null || accessibility === void 0 ? void 0 : accessibility.accessibilityRole;
68
75
  const variantLevel = accessibility === null || accessibility === void 0 ? void 0 : accessibility['area-level'];
@@ -1 +1 @@
1
- {"version":3,"names":["React","Platform","Text","createFontStyle","css","StyleSheet","useTheme","accessibilityMap","selectColor","theme","colorProp","OS","undefined","palette","text","styles","create","root","flexShrink","maxWidth","Typography","forwardRef","props","ref","accessibilityRole","align","ariaLevel","disableFontScaling","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","weight","onLayout","onTextLayout","fontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","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,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,cAA/B;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,UAA/B,EAA2CC,QAA3C,QAA2D,WAA3D;AAIA,MAAMC,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,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EAAZ,CAA9D,GAAuF,EAA7G;EAEA,MAAMC,SAAS,GAAGzC,GAAG,CAAC,CAClBW,MAAM,CAACE,IADW,EAElB;IAAE6B,SAAS,EAAErB,KAAK,KAAK,SAAV,GAAsB,MAAtB,GAA+BA;EAA5C,CAFkB,EAGlBkB,aAHkB,EAIlBH,SAJkB,EAKlBL,KALkB,CAAD,CAArB;EAQA,MAAMY,aAAa,GAAGxC,gBAAgB,CAAC6B,OAAD,CAAtC;EACA,MAAMY,WAAW,GAAGjB,IAAI,KAAKnB,SAAT,GAAqB,MAArB,GAA8BmC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAEvB,iBAAjE;EACA,MAAMyB,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAG,YAAH,CAAlC;EAEA,oBACI,oBAAC,IAAD;IACI,GAAG,EAAExB,GADT;IAEI,iBAAiB,EAAEC,iBAAiB,IAAIwB,WAF5C;IAGI,gBAAgB,EAAE,CAACrB,kBAHvB;IAII,cAAYD,SAAS,IAAIuB,YAJ7B;IAKI,QAAQ,EAAErB,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,EAAEW,SAZX;IAaI,QAAQ,EAAEP,QAbd;IAcI,YAAY,EAAEC;EAdlB,EADJ;AAkBH,CA5DkB,CAAnB;AA8DA,4BAAevC,KAAK,CAACkD,IAAN,CAAW9B,UAAX,CAAf"}
1
+ {"version":3,"names":["React","Platform","Text","createFontStyle","css","StyleSheet","useTheme","accessibilityMap","selectColor","theme","colorProp","OS","undefined","palette","text","styles","create","root","flexShrink","maxWidth","Typography","forwardRef","props","ref","accessibilityRole","align","ariaLevel","disableFontScaling","children","color","ellipsizeMode","href","lineHeight","numberOfLines","onPress","selectable","style","variant","weight","onLayout","onTextLayout","fontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","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,OAAOA,KAAP,MAAkB,OAAlB;AAEA,SAASC,QAAT,EAAmBC,IAAnB,QAA+B,cAA/B;AAEA,SAASC,eAAT,EAA0BC,GAA1B,EAA+BC,UAA/B,EAA2CC,QAA3C,QAA2D,WAA3D;AAIA,MAAMC,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,OAAOT,QAAQ,CAACU,EAAT,KAAgB,KAAhB,GAAwB,SAAxB,GAAoCC,SAA3C;;IACJ;MACI,OAAOH,KAAK,CAACI,OAAN,CAAcC,IAAd,CAAmBJ,SAAnB,CAAP;EAJR;AAMH;;AAED,MAAMK,MAAM,GAAGV,UAAU,CAACW,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACFC,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AIlBH,SAJkB,EAKlBT,UAAU,GAAG;IAAEA;EAAF,CAAH,GAAoBpB,SALZ,EAMlBwB,KANkB,CAAD,CAArB;EASA,MAAMY,aAAa,GAAGzC,gBAAgB,CAAC8B,OAAD,CAAtC;EACA,MAAMY,WAAW,GAAGlB,IAAI,KAAKnB,SAAT,GAAqB,MAArB,GAA8BoC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAExB,iBAAjE;EACA,MAAM0B,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAG,YAAH,CAAlC;EAEA,oBACI,oBAAC,IAAD;IACI,GAAG,EAAEzB,GADT;IAEI,iBAAiB,EAAEC,iBAAiB,IAAIyB,WAF5C;IAGI,gBAAgB,EAAE,CAACtB,kBAHvB;IAII,cAAYD,SAAS,IAAIwB,YAJ7B;IAKI,QAAQ,EAAEtB,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,EAAEW,SAZX;IAaI,QAAQ,EAAEP,QAbd;IAcI,YAAY,EAAEC;EAdlB,EADJ;AAkBH,CA9DkB,CAAnB;AAgEA,4BAAexC,KAAK,CAACmD,IAAN,CAAW/B,UAAX,CAAf"}
@@ -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":"AAOA,OAAO,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":"AAOA,OAAO,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,14 +1,13 @@
1
1
  import { useCallback, useRef, useState } from 'react';
2
- import { Keyboard, Platform, StyleSheet } from 'react-native';
2
+ import { Keyboard, Platform } from 'react-native';
3
3
  import { runOnJS, useAnimatedScrollHandler, useAnimatedStyle, useDerivedValue, useSharedValue, withTiming } from 'react-native-reanimated';
4
4
  import { useSafeAreaInsets } from 'react-native-safe-area-context';
5
- import { useTheme } from '@fountain-ui/styles';
6
5
  import { useHeight } from '../internal/hooks';
7
6
  import useAppbarStyles from './useAppbarStyles';
8
7
  const defaultOptions = {
9
8
  keyboardDismissMode: 'none',
10
- dividerExposureMode: 'overlapped',
11
- supportsReverseScroll: true
9
+ supportsReverseScroll: true,
10
+ minVisibleHeight: 0
12
11
  };
13
12
  const ANIMATION_CONFIG = {
14
13
  duration: 100
@@ -22,8 +21,8 @@ export default function useCollapsibleAppBar() {
22
21
  let userOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : defaultOptions;
23
22
  const {
24
23
  keyboardDismissMode,
25
- dividerExposureMode,
26
- supportsReverseScroll
24
+ supportsReverseScroll,
25
+ minVisibleHeight
27
26
  } = { ...defaultOptions,
28
27
  ...userOptions
29
28
  };
@@ -31,23 +30,23 @@ export default function useCollapsibleAppBar() {
31
30
  const safeAreaInsets = useSafeAreaInsets();
32
31
  const [appBarHeight, onAppBarLayout] = useHeight();
33
32
  const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();
34
- const maxTranslateY = useDerivedValue(() => -collapsibleToolbarHeight, [collapsibleToolbarHeight]);
33
+ const maxTranslateY = useDerivedValue(() => {
34
+ const safeMinVisibleHeight = Math.min(minVisibleHeight, collapsibleToolbarHeight);
35
+ return -(collapsibleToolbarHeight - safeMinVisibleHeight);
36
+ }, [collapsibleToolbarHeight, minVisibleHeight]);
35
37
  const translateY = useSharedValue(0);
36
38
  const lastTranslateY = useSharedValue(0);
37
39
  const lastOffsetY = useSharedValue(0);
38
40
  const overlapped = useSharedValue(false);
39
41
  const [isScrolled, setIsScrolled] = useState(false);
40
- const theme = useTheme();
41
42
  const animatedStyle = useAnimatedStyle(() => {
42
43
  const transform = [{
43
44
  translateY: translateY.value
44
45
  }];
45
46
  return {
46
- transform,
47
- borderColor: dividerExposureMode === 'always' || overlapped.value ? theme.palette.divider : TRANSPARENT,
48
- borderBottomWidth: StyleSheet.hairlineWidth
47
+ transform
49
48
  };
50
- }, [theme, dividerExposureMode]);
49
+ }, [translateY]);
51
50
  const indexRef = useRef(0);
52
51
  const offsetsRef = useRef([]);
53
52
  const onScrollViewChanged = useCallback(nextIndex => {
@@ -68,6 +67,15 @@ export default function useCollapsibleAppBar() {
68
67
  translateY.value = withTiming(0, ANIMATION_CONFIG);
69
68
  }
70
69
  }, [appBarHeight]);
70
+ const recoverAppBar = useCallback(() => {
71
+ const currentIndex = indexRef.current;
72
+ offsetsRef.current[currentIndex] = 0;
73
+ lastOffsetY.value = 0;
74
+ translateY.value = withTiming(0, ANIMATION_CONFIG);
75
+ lastTranslateY.value = 0;
76
+ overlapped.value = false;
77
+ setIsScrolled(false);
78
+ }, []);
71
79
  const scrollHandler = useAnimatedScrollHandler({
72
80
  onBeginDrag: () => {
73
81
  if (keyboardDismissMode === 'on-drag') {
@@ -125,7 +133,7 @@ export default function useCollapsibleAppBar() {
125
133
  overlapped.value = offsetY + nextTranslateY > 0;
126
134
  translateY.value = withTiming(nextTranslateY, ANIMATION_CONFIG);
127
135
  }
128
- }, [keyboardDismissMode, appBarHeight, isScrolled]);
136
+ });
129
137
  const hasCollapsible = collapsibleToolbarHeight > 0;
130
138
  const appBarStyle = [animatedStyle, {
131
139
  paddingTop: safeAreaInsets.top
@@ -136,6 +144,7 @@ export default function useCollapsibleAppBar() {
136
144
  onCollapsibleToolbarLayout,
137
145
  onScroll: scrollHandler,
138
146
  onScrollViewChanged,
147
+ recoverAppBar,
139
148
  scrollContentInsets: {
140
149
  top: hasCollapsible ? appBarHeight : 0
141
150
  },
@@ -1 +1 @@
1
- {"version":3,"names":["useCallback","useRef","useState","Keyboard","Platform","StyleSheet","runOnJS","useAnimatedScrollHandler","useAnimatedStyle","useDerivedValue","useSharedValue","withTiming","useSafeAreaInsets","useTheme","useHeight","useAppbarStyles","defaultOptions","keyboardDismissMode","dividerExposureMode","supportsReverseScroll","ANIMATION_CONFIG","duration","TRANSPARENT","SUPPORTS_DRAG_DETECTION","OS","dismissKeyboard","dismiss","useCollapsibleAppBar","userOptions","styles","safeAreaInsets","appBarHeight","onAppBarLayout","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","translateY","lastTranslateY","lastOffsetY","overlapped","isScrolled","setIsScrolled","theme","animatedStyle","transform","value","borderColor","palette","divider","borderBottomWidth","hairlineWidth","indexRef","offsetsRef","onScrollViewChanged","nextIndex","prevIndex","current","savedOffsetY","scrollHandler","onBeginDrag","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,SAASA,WAAT,EAAsBC,MAAtB,EAA8BC,QAA9B,QAA8C,OAA9C;AACA,SAEIC,QAFJ,EAGIC,QAHJ,EAMIC,UANJ,QASO,cATP;AAWA,SACIC,OADJ,EAEIC,wBAFJ,EAGIC,gBAHJ,EAIIC,eAJJ,EAKIC,cALJ,EAMIC,UANJ,QAOO,yBAPP;AAQA,SAASC,iBAAT,QAAkC,gCAAlC;AACA,SAASC,QAAT,QAAyB,qBAAzB;AACA,SAASC,SAAT,QAA0B,mBAA1B;AACA,OAAOC,eAAP,MAA4B,mBAA5B;AAiCA,MAAMC,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,GAAGnB,QAAQ,CAACoB,EAAT,KAAgB,KAAhD;;AACA,MAAMC,eAAe,GAAG,MAAMtB,QAAQ,CAACuB,OAAT,EAA9B;;AAEA,eAAe,SAASC,oBAAT,GAAwF;EAAA,IAA1DC,WAA0D,uEAAnCZ,cAAmC;EACnG,MAAM;IAAEC,mBAAF;IAAuBC,mBAAvB;IAA4CC;EAA5C,IAAyF,EAC3F,GAAGH,cADwF;IAE3F,GAAGY;EAFwF,CAA/F;EAKA,MA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AAmB,EAAE;MAAEH,GAAG,EAAEH,cAAc,GAAGrD,YAAH,GAAkB;IAAvC,CANlB;IAOHS;EAPG,CAAP;AASH;AAAA"}
1
+ {"version":3,"names":["useCallback","useRef","useState","Keyboard","Platform","runOnJS","useAnimatedScrollHandler","useAnimatedStyle","useDerivedValue","useSharedValue","withTiming","useSafeAreaInsets","useHeight","useAppbarStyles","defaultOptions","keyboardDismissMode","supportsReverseScroll","minVisibleHeight","ANIMATION_CONFIG","duration","TRANSPARENT","SUPPORTS_DRAG_DETECTION","OS","dismissKeyboard","dismiss","useCollapsibleAppBar","userOptions","styles","safeAreaInsets","appBarHeight","onAppBarLayout","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","safeMinVisibleHeight","Math","min","translateY","lastTranslateY","lastOffsetY","overlapped","isScrolled","setIsScrolled","animatedStyle","transform","value","indexRef","offsetsRef","onScrollViewChanged","nextIndex","prevIndex","current","savedOffsetY","recoverAppBar","currentIndex","scrollHandler","onBeginDrag","onMomentumBegin","onScroll","event","offsetY","contentOffset","y","maxTy","dy","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 minVisibleHeight?: number;\n}\n\nexport interface CollapsibleAppBar {\n appBarStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onCollapsibleToolbarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n onScrollViewChanged: (index: number) => void;\n recoverAppBar: () => void;\n scrollContentInsets: ContentInsets;\n isScrolled: boolean;\n}\n\nconst defaultOptions: Required<Options> = {\n keyboardDismissMode: 'none',\n supportsReverseScroll: true,\n minVisibleHeight: 0,\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, minVisibleHeight }: 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(() => {\n const safeMinVisibleHeight = Math.min(minVisibleHeight, collapsibleToolbarHeight);\n return -(collapsibleToolbarHeight - safeMinVisibleHeight);\n }, [collapsibleToolbarHeight, minVisibleHeight]);\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 }, [translateY]);\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 recoverAppBar = useCallback(() => {\n const currentIndex = indexRef.current;\n\n offsetsRef.current[currentIndex] = 0;\n\n lastOffsetY.value = 0;\n\n translateY.value = withTiming(0, ANIMATION_CONFIG);\n lastTranslateY.value = 0;\n\n overlapped.value = false;\n\n setIsScrolled(false);\n }, []);\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 recoverAppBar,\n scrollContentInsets: { top: hasCollapsible ? appBarHeight : 0 },\n isScrolled,\n };\n};\n"],"mappings":"AAAA,SAASA,WAAT,EAAsBC,MAAtB,EAA8BC,QAA9B,QAA8C,OAA9C;AACA,SAAgBC,QAAhB,EAA0BC,QAA1B,QAAkG,cAAlG;AAEA,SACIC,OADJ,EAEIC,wBAFJ,EAGIC,gBAHJ,EAIIC,eAJJ,EAKIC,cALJ,EAMIC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C,OAAO,GAAGD,KAAK,CAACE,aAAN,CAAoBC,CAApC;MAEAvB,WAAW,CAACM,KAAZ,GAAoBe,OAApB;MAEA,MAAMgB,EAAE,GAAGvC,UAAU,CAACQ,KAAtB;MACA,MAAMkB,KAAK,GAAG9B,aAAa,CAACY,KAA5B,CANsB,CAQtB;;MACA,IAAI+B,EAAE,IAAIb,KAAN,IAAea,EAAE,IAAI,CAAzB,EAA4B;QACxB;MACH;;MAED,MAAMC,SAAS,GAAGd,KAAK,GAAG,GAA1B;MAEA,MAAMe,cAAc,GAAIF,EAAE,GAAGC,SAAL,IAAkBjB,OAAO,GAAG/B,YAA7B,GAA6C,CAA7C,GAAiDkC,KAAxE;MAEAvB,UAAU,CAACK,KAAX,GAAmBe,OAAO,GAAGkB,cAAV,GAA2B,CAA9C;MAEAzC,UAAU,CAACQ,KAAX,GAAmBnC,UAAU,CAACoE,cAAD,EAAiB5D,gBAAjB,CAA7B;IACH;EA5E0C,CAAD,CAA9C;EA+EA,MAAM6D,cAAc,GAAGhD,wBAAwB,GAAG,CAAlD;EAEA,MAAMiD,WAAW,GAAG,CAChBrC,aADgB,EAEhB;IAAEsC,UAAU,EAAErD,cAAc,CAACsD;EAA7B,CAFgB,EAGhBH,cAAc,GAAGpD,MAAM,CAACwD,QAAV,GAAqBC,SAHnB,CAApB;EAMA,OAAO;IACHJ,WADG;IAEHlD,cAFG;IAGHE,0BAHG;IAIH0B,QAAQ,EAAEH,aAJP;IAKHP,mBALG;IAMHK,aANG;IAOHgC,mBAAmB,EAAE;MAAEH,GAAG,EAAEH,cAAc,GAAGlD,YAAH,GAAkB;IAAvC,CAPlB;IAQHY;EARG,CAAP;AAUH;AAAA"}
@@ -1,20 +1,37 @@
1
- import { useBreakpointByWidth } from '@fountain-ui/styles';
2
1
  import { css, useTheme } from '../styles';
3
2
 
4
- function getMaxWidth(theme, breakpoint) {
3
+ function getMaxWidth(theme, breakpoint, customMaxWidth) {
5
4
  switch (breakpoint) {
6
5
  case 'lg':
7
- return theme.breakpoints.values['lg'];
8
-
9
6
  case 'md':
10
- return theme.breakpoints.values['md'];
7
+ return customMaxWidth ?? theme.breakpoints.values[breakpoint];
11
8
 
12
9
  default:
13
- return 'none';
10
+ return undefined;
14
11
  }
15
12
  }
16
13
 
17
- function getPaddingHorizontal(theme, breakpoint) {
14
+ function getHomeScreenPaddingHorizontal(theme, breakpoint) {
15
+ switch (breakpoint) {
16
+ case 'xxs':
17
+ case 'xs':
18
+ return theme.spacing(3);
19
+
20
+ case 'sm':
21
+ return theme.spacing(6);
22
+
23
+ case 'md':
24
+ case 'lg':
25
+ default:
26
+ return theme.spacing(4);
27
+ }
28
+ }
29
+
30
+ function getPaddingHorizontal(theme, breakpoint, isHomeScreen) {
31
+ if (isHomeScreen) {
32
+ return getHomeScreenPaddingHorizontal(theme, breakpoint);
33
+ }
34
+
18
35
  switch (breakpoint) {
19
36
  case 'sm':
20
37
  return theme.spacing(6);
@@ -24,18 +41,20 @@ function getPaddingHorizontal(theme, breakpoint) {
24
41
  }
25
42
  }
26
43
 
27
- export default function useContentContainerStyle(config) {
44
+ export default function useContentContainerStyle() {
45
+ let config = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
28
46
  const {
29
- maxWidth,
30
- styleProvider
47
+ maxWidth: customMaxWidth,
48
+ styleProvider,
49
+ isHomeScreen = false
31
50
  } = config;
32
51
  const theme = useTheme();
33
- const currentBreakpoint = useBreakpointByWidth();
52
+ const currentBreakpoint = theme.breakpoints.current;
34
53
  const additionalStyle = styleProvider === null || styleProvider === void 0 ? void 0 : styleProvider(theme);
35
54
  return css([{
36
55
  alignSelf: 'center',
37
- maxWidth: maxWidth ?? getMaxWidth(theme, currentBreakpoint),
38
- paddingHorizontal: getPaddingHorizontal(theme, currentBreakpoint),
56
+ maxWidth: getMaxWidth(theme, currentBreakpoint, customMaxWidth),
57
+ paddingHorizontal: getPaddingHorizontal(theme, currentBreakpoint, isHomeScreen),
39
58
  width: '100%'
40
59
  }, additionalStyle]);
41
60
  }