@fountain-ui/core 2.0.0-beta.9 → 2.0.0-beta.91

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 (573) hide show
  1. package/CHANGELOG.md +32 -0
  2. package/build/commonjs/Accordion/Accordion.js +110 -27
  3. package/build/commonjs/Accordion/Accordion.js.map +1 -1
  4. package/build/commonjs/Accordion/AccordionProps.js.map +1 -1
  5. package/build/commonjs/Badge/Badge.js +5 -14
  6. package/build/commonjs/Badge/Badge.js.map +1 -1
  7. package/build/commonjs/Badge/BadgeProps.js.map +1 -1
  8. package/build/commonjs/Button/Button.js +6 -3
  9. package/build/commonjs/Button/Button.js.map +1 -1
  10. package/build/commonjs/ButtonBase/ButtonBase.js +65 -51
  11. package/build/commonjs/ButtonBase/ButtonBase.js.map +1 -1
  12. package/build/commonjs/ButtonBase/ButtonBaseProps.js.map +1 -1
  13. package/build/commonjs/Checkbox/CheckboxProps.js.map +1 -1
  14. package/build/commonjs/Chip/Chip.js +11 -9
  15. package/build/commonjs/Chip/Chip.js.map +1 -1
  16. package/build/commonjs/Chip/ChipProps.js.map +1 -1
  17. package/build/commonjs/CircularProgress/CircularProgress.js +27 -28
  18. package/build/commonjs/CircularProgress/CircularProgress.js.map +1 -1
  19. package/build/commonjs/Dialog/Dialog.js +118 -10
  20. package/build/commonjs/Dialog/Dialog.js.map +1 -1
  21. package/build/commonjs/Dialog/DialogProps.js.map +1 -1
  22. package/build/commonjs/Divider/Divider.js +26 -18
  23. package/build/commonjs/Divider/Divider.js.map +1 -1
  24. package/build/commonjs/Divider/DividerProps.js.map +1 -1
  25. package/build/commonjs/Image/Image.js +58 -14
  26. package/build/commonjs/Image/Image.js.map +1 -1
  27. package/build/commonjs/Image/ImageProps.js.map +1 -1
  28. package/build/commonjs/Image/index.js.map +1 -1
  29. package/build/commonjs/ImageCore/ImageCoreNative.js +36 -26
  30. package/build/commonjs/ImageCore/ImageCoreNative.js.map +1 -1
  31. package/build/commonjs/ImageCore/ImageCoreProps.js.map +1 -1
  32. package/build/commonjs/ImageCore/ImageCoreWeb.js +19 -1
  33. package/build/commonjs/ImageCore/ImageCoreWeb.js.map +1 -1
  34. package/build/commonjs/ImageCore/ImageFileExtensionContext.js +14 -0
  35. package/build/commonjs/ImageCore/ImageFileExtensionContext.js.map +1 -0
  36. package/build/commonjs/ImageCore/ImageFileExtensionProvider.js +42 -0
  37. package/build/commonjs/ImageCore/ImageFileExtensionProvider.js.map +1 -0
  38. package/build/commonjs/ImageCore/index.js +17 -5
  39. package/build/commonjs/ImageCore/index.js.map +1 -1
  40. package/build/commonjs/ImageCore/index.native.js +27 -0
  41. package/build/commonjs/ImageCore/index.native.js.map +1 -1
  42. package/build/commonjs/Modal/AnimatedContainer/index.js +167 -0
  43. package/build/commonjs/Modal/AnimatedContainer/index.js.map +1 -0
  44. package/build/commonjs/Modal/Modal.js +43 -9
  45. package/build/commonjs/Modal/Modal.js.map +1 -1
  46. package/build/commonjs/Modal/ModalProps.js +12 -0
  47. package/build/commonjs/Modal/ModalProps.js.map +1 -1
  48. package/build/commonjs/Modal/index.js +18 -0
  49. package/build/commonjs/Modal/index.js.map +1 -1
  50. package/build/commonjs/Paper/Paper.js +1 -1
  51. package/build/commonjs/Paper/Paper.js.map +1 -1
  52. package/build/commonjs/Radio/Radio.js +11 -4
  53. package/build/commonjs/Radio/Radio.js.map +1 -1
  54. package/build/commonjs/Radio/RadioProps.js.map +1 -1
  55. package/build/commonjs/Slide/Slide.js +41 -27
  56. package/build/commonjs/Slide/Slide.js.map +1 -1
  57. package/build/commonjs/Slide/SlideProps.js.map +1 -1
  58. package/build/commonjs/Snackbar/Snackbar.js +34 -7
  59. package/build/commonjs/Snackbar/Snackbar.js.map +1 -1
  60. package/build/commonjs/Snackbar/SnackbarProps.js.map +1 -1
  61. package/build/commonjs/SnackbarContent/SnackbarContent.js +32 -14
  62. package/build/commonjs/SnackbarContent/SnackbarContent.js.map +1 -1
  63. package/build/commonjs/SnackbarContent/SnackbarContentProps.js.map +1 -1
  64. package/build/commonjs/SvgIcon/SvgIcon.js +1 -1
  65. package/build/commonjs/SvgIcon/SvgIcon.js.map +1 -1
  66. package/build/commonjs/Tab/Tab.js +66 -20
  67. package/build/commonjs/Tab/Tab.js.map +1 -1
  68. package/build/commonjs/Tab/TabIndicator.js +11 -7
  69. package/build/commonjs/Tab/TabIndicator.js.map +1 -1
  70. package/build/commonjs/Tab/TabProps.js.map +1 -1
  71. package/build/commonjs/Tab/index.js.map +1 -1
  72. package/build/commonjs/Tabs/IndexAwareTab.js +35 -0
  73. package/build/commonjs/Tabs/IndexAwareTab.js.map +1 -0
  74. package/build/commonjs/Tabs/InternalContext.js +17 -0
  75. package/build/commonjs/Tabs/InternalContext.js.map +1 -0
  76. package/build/commonjs/Tabs/ScrollableTabsView.js +35 -0
  77. package/build/commonjs/Tabs/ScrollableTabsView.js.map +1 -0
  78. package/build/commonjs/Tabs/TabIndicator.js +73 -28
  79. package/build/commonjs/Tabs/TabIndicator.js.map +1 -1
  80. package/build/commonjs/Tabs/TabIndicatorProps.js.map +1 -1
  81. package/build/commonjs/Tabs/Tabs.js +119 -83
  82. package/build/commonjs/Tabs/Tabs.js.map +1 -1
  83. package/build/commonjs/Tabs/TabsProps.js.map +1 -1
  84. package/build/commonjs/Tabs/index.js.map +1 -1
  85. package/build/commonjs/Tabs/types.js +2 -0
  86. package/build/commonjs/Tabs/types.js.map +1 -0
  87. package/build/commonjs/Tabs/useIndexStore.js +35 -0
  88. package/build/commonjs/Tabs/useIndexStore.js.map +1 -0
  89. package/build/commonjs/Tabs/useScrollViewReaction.js +69 -0
  90. package/build/commonjs/Tabs/useScrollViewReaction.js.map +1 -0
  91. package/build/commonjs/Tabs/useTabCoordinates.js +30 -0
  92. package/build/commonjs/Tabs/useTabCoordinates.js.map +1 -0
  93. package/build/commonjs/Tabs/useTabInnerContentsWidth.js +30 -0
  94. package/build/commonjs/Tabs/useTabInnerContentsWidth.js.map +1 -0
  95. package/build/commonjs/Tabs/utils.js +19 -0
  96. package/build/commonjs/Tabs/utils.js.map +1 -0
  97. package/build/commonjs/TextField/InputLabel.js +6 -3
  98. package/build/commonjs/TextField/InputLabel.js.map +1 -1
  99. package/build/commonjs/TextField/OutlinedTextField.js +6 -2
  100. package/build/commonjs/TextField/OutlinedTextField.js.map +1 -1
  101. package/build/commonjs/TextField/TextField.js +15 -8
  102. package/build/commonjs/TextField/TextField.js.map +1 -1
  103. package/build/commonjs/TextField/TextFieldProps.js.map +1 -1
  104. package/build/commonjs/Tooltip/Tooltip.js +50 -31
  105. package/build/commonjs/Tooltip/Tooltip.js.map +1 -1
  106. package/build/commonjs/Tooltip/TooltipProps.js.map +1 -1
  107. package/build/commonjs/Typography/Typography.js +14 -5
  108. package/build/commonjs/Typography/Typography.js.map +1 -1
  109. package/build/commonjs/Typography/TypographyProps.js.map +1 -1
  110. package/build/commonjs/animated/AnimatedPressable.js +2 -3
  111. package/build/commonjs/animated/AnimatedPressable.js.map +1 -1
  112. package/build/commonjs/hooks/index.js +32 -0
  113. package/build/commonjs/hooks/index.js.map +1 -1
  114. package/build/commonjs/hooks/useAnimatedValue.js +31 -0
  115. package/build/commonjs/hooks/useAnimatedValue.js.map +1 -0
  116. package/build/commonjs/hooks/useCollapsibleAppBar.js +41 -54
  117. package/build/commonjs/hooks/useCollapsibleAppBar.js.map +1 -1
  118. package/build/commonjs/hooks/useDebounce.js +33 -0
  119. package/build/commonjs/hooks/useDebounce.js.map +1 -0
  120. package/build/commonjs/hooks/useFadeInAppBar.js +21 -23
  121. package/build/commonjs/hooks/useFadeInAppBar.js.map +1 -1
  122. package/build/commonjs/hooks/useImperativeState.js +26 -0
  123. package/build/commonjs/hooks/useImperativeState.js.map +1 -0
  124. package/build/commonjs/hooks/useSyncAnimatedValue.js +40 -0
  125. package/build/commonjs/hooks/useSyncAnimatedValue.js.map +1 -0
  126. package/build/commonjs/hooks/useThrottle.js +3 -7
  127. package/build/commonjs/hooks/useThrottle.js.map +1 -1
  128. package/build/commonjs/hooks/useValidWindowDimensions/index.ios.js +14 -7
  129. package/build/commonjs/hooks/useValidWindowDimensions/index.ios.js.map +1 -1
  130. package/build/commonjs/index.js +35 -0
  131. package/build/commonjs/index.js.map +1 -1
  132. package/build/commonjs/internal/hooks/index.js +0 -8
  133. package/build/commonjs/internal/hooks/index.js.map +1 -1
  134. package/build/commonjs/internal/hooks/useHeight.js +3 -9
  135. package/build/commonjs/internal/hooks/useHeight.js.map +1 -1
  136. package/build/commonjs/internal/icons/Checkbox.js +1 -1
  137. package/build/commonjs/internal/icons/Checkbox.js.map +1 -1
  138. package/build/commonjs/internal/icons/CheckboxChecked.js +1 -1
  139. package/build/commonjs/internal/icons/CheckboxChecked.js.map +1 -1
  140. package/build/commonjs/internal/icons/ChevronDown.js +1 -1
  141. package/build/commonjs/internal/icons/ChevronDown.js.map +1 -1
  142. package/build/commonjs/internal/icons/ChevronLeft.js +1 -1
  143. package/build/commonjs/internal/icons/ChevronLeft.js.map +1 -1
  144. package/build/commonjs/internal/icons/ChevronRight.js +1 -1
  145. package/build/commonjs/internal/icons/ChevronRight.js.map +1 -1
  146. package/build/commonjs/internal/icons/Close.js +1 -1
  147. package/build/commonjs/internal/icons/Close.js.map +1 -1
  148. package/build/commonjs/internal/icons/Radio.js +1 -1
  149. package/build/commonjs/internal/icons/Radio.js.map +1 -1
  150. package/build/commonjs/internal/icons/RadioChecked.js +1 -1
  151. package/build/commonjs/internal/icons/RadioChecked.js.map +1 -1
  152. package/build/commonjs/store/MockStore.js +27 -0
  153. package/build/commonjs/store/MockStore.js.map +1 -0
  154. package/build/commonjs/store/SimpleStore.js +59 -0
  155. package/build/commonjs/store/SimpleStore.js.map +1 -0
  156. package/build/commonjs/store/index.js +24 -0
  157. package/build/commonjs/store/index.js.map +1 -0
  158. package/build/commonjs/store/types.js +2 -0
  159. package/build/commonjs/store/types.js.map +1 -0
  160. package/build/commonjs/types/index.js.map +1 -1
  161. package/build/commonjs/utils/index.js +8 -0
  162. package/build/commonjs/utils/index.js.map +1 -1
  163. package/build/commonjs/utils/isNotAndroid12.js +20 -0
  164. package/build/commonjs/utils/isNotAndroid12.js.map +1 -0
  165. package/build/module/Accordion/Accordion.js +111 -29
  166. package/build/module/Accordion/Accordion.js.map +1 -1
  167. package/build/module/Accordion/AccordionProps.js.map +1 -1
  168. package/build/module/Badge/Badge.js +5 -14
  169. package/build/module/Badge/Badge.js.map +1 -1
  170. package/build/module/Badge/BadgeProps.js.map +1 -1
  171. package/build/module/Button/Button.js +6 -3
  172. package/build/module/Button/Button.js.map +1 -1
  173. package/build/module/ButtonBase/ButtonBase.js +64 -49
  174. package/build/module/ButtonBase/ButtonBase.js.map +1 -1
  175. package/build/module/ButtonBase/ButtonBaseProps.js.map +1 -1
  176. package/build/module/Checkbox/CheckboxProps.js.map +1 -1
  177. package/build/module/Chip/Chip.js +11 -9
  178. package/build/module/Chip/Chip.js.map +1 -1
  179. package/build/module/Chip/ChipProps.js.map +1 -1
  180. package/build/module/CircularProgress/CircularProgress.js +25 -23
  181. package/build/module/CircularProgress/CircularProgress.js.map +1 -1
  182. package/build/module/Dialog/Dialog.js +109 -8
  183. package/build/module/Dialog/Dialog.js.map +1 -1
  184. package/build/module/Dialog/DialogProps.js.map +1 -1
  185. package/build/module/Divider/Divider.js +26 -18
  186. package/build/module/Divider/Divider.js.map +1 -1
  187. package/build/module/Divider/DividerProps.js.map +1 -1
  188. package/build/module/Image/Image.js +54 -12
  189. package/build/module/Image/Image.js.map +1 -1
  190. package/build/module/Image/ImageProps.js.map +1 -1
  191. package/build/module/Image/index.js.map +1 -1
  192. package/build/module/ImageCore/ImageCoreNative.js +31 -25
  193. package/build/module/ImageCore/ImageCoreNative.js.map +1 -1
  194. package/build/module/ImageCore/ImageCoreProps.js.map +1 -1
  195. package/build/module/ImageCore/ImageCoreWeb.js +19 -1
  196. package/build/module/ImageCore/ImageCoreWeb.js.map +1 -1
  197. package/build/module/ImageCore/ImageFileExtensionContext.js +5 -0
  198. package/build/module/ImageCore/ImageFileExtensionContext.js.map +1 -0
  199. package/build/module/ImageCore/ImageFileExtensionProvider.js +24 -0
  200. package/build/module/ImageCore/ImageFileExtensionProvider.js.map +1 -0
  201. package/build/module/ImageCore/index.js +2 -1
  202. package/build/module/ImageCore/index.js.map +1 -1
  203. package/build/module/ImageCore/index.native.js +2 -0
  204. package/build/module/ImageCore/index.native.js.map +1 -1
  205. package/build/module/Modal/AnimatedContainer/index.js +144 -0
  206. package/build/module/Modal/AnimatedContainer/index.js.map +1 -0
  207. package/build/module/Modal/Modal.js +43 -9
  208. package/build/module/Modal/Modal.js.map +1 -1
  209. package/build/module/Modal/ModalProps.js +5 -0
  210. package/build/module/Modal/ModalProps.js.map +1 -1
  211. package/build/module/Modal/index.js +2 -0
  212. package/build/module/Modal/index.js.map +1 -1
  213. package/build/module/Paper/Paper.js +1 -1
  214. package/build/module/Paper/Paper.js.map +1 -1
  215. package/build/module/Radio/Radio.js +9 -5
  216. package/build/module/Radio/Radio.js.map +1 -1
  217. package/build/module/Radio/RadioProps.js.map +1 -1
  218. package/build/module/Slide/Slide.js +39 -23
  219. package/build/module/Slide/Slide.js.map +1 -1
  220. package/build/module/Slide/SlideProps.js.map +1 -1
  221. package/build/module/Snackbar/Snackbar.js +25 -5
  222. package/build/module/Snackbar/Snackbar.js.map +1 -1
  223. package/build/module/Snackbar/SnackbarProps.js.map +1 -1
  224. package/build/module/SnackbarContent/SnackbarContent.js +21 -6
  225. package/build/module/SnackbarContent/SnackbarContent.js.map +1 -1
  226. package/build/module/SnackbarContent/SnackbarContentProps.js.map +1 -1
  227. package/build/module/SvgIcon/SvgIcon.js +1 -1
  228. package/build/module/SvgIcon/SvgIcon.js.map +1 -1
  229. package/build/module/Tab/Tab.js +63 -21
  230. package/build/module/Tab/Tab.js.map +1 -1
  231. package/build/module/Tab/TabIndicator.js +11 -7
  232. package/build/module/Tab/TabIndicator.js.map +1 -1
  233. package/build/module/Tab/TabProps.js.map +1 -1
  234. package/build/module/Tab/index.js.map +1 -1
  235. package/build/module/Tabs/IndexAwareTab.js +23 -0
  236. package/build/module/Tabs/IndexAwareTab.js.map +1 -0
  237. package/build/module/Tabs/InternalContext.js +7 -0
  238. package/build/module/Tabs/InternalContext.js.map +1 -0
  239. package/build/module/Tabs/ScrollableTabsView.js +22 -0
  240. package/build/module/Tabs/ScrollableTabsView.js.map +1 -0
  241. package/build/module/Tabs/TabIndicator.js +66 -25
  242. package/build/module/Tabs/TabIndicator.js.map +1 -1
  243. package/build/module/Tabs/TabIndicatorProps.js.map +1 -1
  244. package/build/module/Tabs/Tabs.js +109 -72
  245. package/build/module/Tabs/Tabs.js.map +1 -1
  246. package/build/module/Tabs/TabsProps.js.map +1 -1
  247. package/build/module/Tabs/index.js.map +1 -1
  248. package/build/module/Tabs/types.js +2 -0
  249. package/build/module/Tabs/types.js.map +1 -0
  250. package/build/module/Tabs/useIndexStore.js +25 -0
  251. package/build/module/Tabs/useIndexStore.js.map +1 -0
  252. package/build/module/Tabs/useScrollViewReaction.js +57 -0
  253. package/build/module/Tabs/useScrollViewReaction.js.map +1 -0
  254. package/build/module/Tabs/useTabCoordinates.js +21 -0
  255. package/build/module/Tabs/useTabCoordinates.js.map +1 -0
  256. package/build/module/Tabs/useTabInnerContentsWidth.js +21 -0
  257. package/build/module/Tabs/useTabInnerContentsWidth.js.map +1 -0
  258. package/build/module/Tabs/utils.js +9 -0
  259. package/build/module/Tabs/utils.js.map +1 -0
  260. package/build/module/TextField/InputLabel.js +7 -4
  261. package/build/module/TextField/InputLabel.js.map +1 -1
  262. package/build/module/TextField/OutlinedTextField.js +7 -3
  263. package/build/module/TextField/OutlinedTextField.js.map +1 -1
  264. package/build/module/TextField/TextField.js +13 -5
  265. package/build/module/TextField/TextField.js.map +1 -1
  266. package/build/module/TextField/TextFieldProps.js.map +1 -1
  267. package/build/module/Tooltip/Tooltip.js +48 -25
  268. package/build/module/Tooltip/Tooltip.js.map +1 -1
  269. package/build/module/Tooltip/TooltipProps.js.map +1 -1
  270. package/build/module/Typography/Typography.js +14 -5
  271. package/build/module/Typography/Typography.js.map +1 -1
  272. package/build/module/Typography/TypographyProps.js.map +1 -1
  273. package/build/module/animated/AnimatedPressable.js +2 -3
  274. package/build/module/animated/AnimatedPressable.js.map +1 -1
  275. package/build/module/hooks/index.js +4 -0
  276. package/build/module/hooks/index.js.map +1 -1
  277. package/build/module/hooks/useAnimatedValue.js +22 -0
  278. package/build/module/hooks/useAnimatedValue.js.map +1 -0
  279. package/build/module/hooks/useCollapsibleAppBar.js +42 -52
  280. package/build/module/hooks/useCollapsibleAppBar.js.map +1 -1
  281. package/build/module/hooks/useDebounce.js +25 -0
  282. package/build/module/hooks/useDebounce.js.map +1 -0
  283. package/build/module/hooks/useFadeInAppBar.js +23 -20
  284. package/build/module/hooks/useFadeInAppBar.js.map +1 -1
  285. package/build/module/hooks/useImperativeState.js +17 -0
  286. package/build/module/hooks/useImperativeState.js.map +1 -0
  287. package/build/module/hooks/useSyncAnimatedValue.js +28 -0
  288. package/build/module/hooks/useSyncAnimatedValue.js.map +1 -0
  289. package/build/module/hooks/useThrottle.js +3 -3
  290. package/build/module/hooks/useThrottle.js.map +1 -1
  291. package/build/module/hooks/useValidWindowDimensions/index.ios.js +15 -9
  292. package/build/module/hooks/useValidWindowDimensions/index.ios.js.map +1 -1
  293. package/build/module/index.js +3 -1
  294. package/build/module/index.js.map +1 -1
  295. package/build/module/internal/hooks/index.js +0 -1
  296. package/build/module/internal/hooks/index.js.map +1 -1
  297. package/build/module/internal/hooks/useHeight.js +3 -4
  298. package/build/module/internal/hooks/useHeight.js.map +1 -1
  299. package/build/module/internal/icons/Checkbox.js +1 -1
  300. package/build/module/internal/icons/Checkbox.js.map +1 -1
  301. package/build/module/internal/icons/CheckboxChecked.js +1 -1
  302. package/build/module/internal/icons/CheckboxChecked.js.map +1 -1
  303. package/build/module/internal/icons/ChevronDown.js +1 -1
  304. package/build/module/internal/icons/ChevronDown.js.map +1 -1
  305. package/build/module/internal/icons/ChevronLeft.js +1 -1
  306. package/build/module/internal/icons/ChevronLeft.js.map +1 -1
  307. package/build/module/internal/icons/ChevronRight.js +1 -1
  308. package/build/module/internal/icons/ChevronRight.js.map +1 -1
  309. package/build/module/internal/icons/Close.js +1 -1
  310. package/build/module/internal/icons/Close.js.map +1 -1
  311. package/build/module/internal/icons/Radio.js +1 -1
  312. package/build/module/internal/icons/Radio.js.map +1 -1
  313. package/build/module/internal/icons/RadioChecked.js +1 -1
  314. package/build/module/internal/icons/RadioChecked.js.map +1 -1
  315. package/build/module/store/MockStore.js +18 -0
  316. package/build/module/store/MockStore.js.map +1 -0
  317. package/build/module/store/SimpleStore.js +50 -0
  318. package/build/module/store/SimpleStore.js.map +1 -0
  319. package/build/module/store/index.js +3 -0
  320. package/build/module/store/index.js.map +1 -0
  321. package/build/module/store/types.js +2 -0
  322. package/build/module/store/types.js.map +1 -0
  323. package/build/module/types/index.js.map +1 -1
  324. package/build/module/utils/index.js +1 -0
  325. package/build/module/utils/index.js.map +1 -1
  326. package/build/module/utils/isNotAndroid12.js +6 -0
  327. package/build/module/utils/isNotAndroid12.js.map +1 -0
  328. package/build/typescript/Accordion/Accordion.d.ts +1 -0
  329. package/build/typescript/Accordion/AccordionProps.d.ts +14 -11
  330. package/build/typescript/AspectRatio/AspectRatioNative.d.ts +1 -0
  331. package/build/typescript/AspectRatio/AspectRatioWeb.d.ts +1 -0
  332. package/build/typescript/Avatar/Avatar.d.ts +1 -0
  333. package/build/typescript/Badge/Badge.d.ts +1 -0
  334. package/build/typescript/Badge/BadgeProps.d.ts +5 -0
  335. package/build/typescript/Button/Button.d.ts +1 -0
  336. package/build/typescript/ButtonBase/ButtonBase.d.ts +1 -0
  337. package/build/typescript/ButtonBase/ButtonBaseProps.d.ts +8 -0
  338. package/build/typescript/Card/Card.d.ts +1 -0
  339. package/build/typescript/CardActions/CardActions.d.ts +1 -0
  340. package/build/typescript/CardContent/CardContent.d.ts +1 -0
  341. package/build/typescript/CardMedia/CardMedia.d.ts +1 -0
  342. package/build/typescript/Checkbox/Checkbox.d.ts +1 -0
  343. package/build/typescript/Checkbox/CheckboxProps.d.ts +1 -1
  344. package/build/typescript/Chip/Chip.d.ts +1 -0
  345. package/build/typescript/Chip/ChipProps.d.ts +4 -0
  346. package/build/typescript/CircularProgress/CircularProgress.d.ts +3 -2
  347. package/build/typescript/Column/Column.d.ts +1 -0
  348. package/build/typescript/Dialog/Dialog.d.ts +1 -0
  349. package/build/typescript/Dialog/DialogProps.d.ts +10 -0
  350. package/build/typescript/DialogActions/DialogActions.d.ts +1 -0
  351. package/build/typescript/DialogContent/DialogContent.d.ts +1 -0
  352. package/build/typescript/DialogMedia/DialogMedia.d.ts +1 -0
  353. package/build/typescript/DialogTitle/DialogTitle.d.ts +1 -0
  354. package/build/typescript/Divider/Divider.d.ts +1 -0
  355. package/build/typescript/Divider/DividerProps.d.ts +22 -1
  356. package/build/typescript/Fab/Fab.d.ts +1 -0
  357. package/build/typescript/Flexbox/Flexbox.d.ts +1 -0
  358. package/build/typescript/IconButton/IconButton.d.ts +1 -0
  359. package/build/typescript/Image/Image.d.ts +1 -0
  360. package/build/typescript/Image/ImageProps.d.ts +30 -2
  361. package/build/typescript/Image/index.d.ts +1 -1
  362. package/build/typescript/ImageCore/ImageCoreNative.d.ts +1 -0
  363. package/build/typescript/ImageCore/ImageCoreProps.d.ts +5 -1
  364. package/build/typescript/ImageCore/ImageCoreWeb.d.ts +1 -0
  365. package/build/typescript/ImageCore/ImageFileExtensionContext.d.ts +3 -0
  366. package/build/typescript/ImageCore/ImageFileExtensionProvider.d.ts +13 -0
  367. package/build/typescript/ImageCore/index.d.ts +3 -1
  368. package/build/typescript/ImageCore/index.native.d.ts +2 -0
  369. package/build/typescript/Link/Link.d.ts +1 -0
  370. package/build/typescript/List/List.d.ts +1 -0
  371. package/build/typescript/ListItem/ListItem.d.ts +1 -0
  372. package/build/typescript/ListItemIcon/ListItemIcon.d.ts +1 -0
  373. package/build/typescript/ListItemSecondaryAction/ListItemSecondaryAction.d.ts +1 -0
  374. package/build/typescript/ListItemText/ListItemText.d.ts +1 -0
  375. package/build/typescript/ListSubheader/ListSubheader.d.ts +1 -0
  376. package/build/typescript/Menu/Menu.d.ts +1 -0
  377. package/build/typescript/MenuItem/MenuItem.d.ts +1 -0
  378. package/build/typescript/Modal/AnimatedContainer/index.d.ts +5 -0
  379. package/build/typescript/Modal/Modal.d.ts +1 -0
  380. package/build/typescript/Modal/ModalProps.d.ts +47 -0
  381. package/build/typescript/Modal/index.d.ts +4 -1
  382. package/build/typescript/Pagination/Pagination.d.ts +1 -0
  383. package/build/typescript/Portal/Portal.d.ts +1 -0
  384. package/build/typescript/Radio/Radio.d.ts +1 -0
  385. package/build/typescript/Radio/RadioProps.d.ts +13 -0
  386. package/build/typescript/RadioGroup/RadioGroup.d.ts +1 -0
  387. package/build/typescript/Row/Row.d.ts +1 -0
  388. package/build/typescript/Slide/Slide.d.ts +1 -0
  389. package/build/typescript/Slide/SlideProps.d.ts +2 -3
  390. package/build/typescript/Slider/Slider.d.ts +1 -1
  391. package/build/typescript/Snackbar/Snackbar.d.ts +1 -0
  392. package/build/typescript/Snackbar/SnackbarProps.d.ts +10 -3
  393. package/build/typescript/SnackbarContent/SnackbarContent.d.ts +1 -0
  394. package/build/typescript/SnackbarContent/SnackbarContentProps.d.ts +9 -0
  395. package/build/typescript/Spacer/Spacer.d.ts +1 -0
  396. package/build/typescript/SvgIcon/SvgIcon.d.ts +1 -0
  397. package/build/typescript/Switch/Switch.d.ts +1 -0
  398. package/build/typescript/Tab/Tab.d.ts +1 -0
  399. package/build/typescript/Tab/TabIndicator.d.ts +5 -1
  400. package/build/typescript/Tab/TabProps.d.ts +21 -2
  401. package/build/typescript/Tab/index.d.ts +1 -1
  402. package/build/typescript/TabBase/TabBase.d.ts +1 -0
  403. package/build/typescript/Tabs/IndexAwareTab.d.ts +8 -0
  404. package/build/typescript/Tabs/InternalContext.d.ts +7 -0
  405. package/build/typescript/Tabs/ScrollableTabsView.d.ts +8 -0
  406. package/build/typescript/Tabs/TabIndicator.d.ts +1 -0
  407. package/build/typescript/Tabs/TabIndicatorProps.d.ts +10 -5
  408. package/build/typescript/Tabs/Tabs.d.ts +4 -1
  409. package/build/typescript/Tabs/TabsProps.d.ts +37 -13
  410. package/build/typescript/Tabs/index.d.ts +1 -0
  411. package/build/typescript/Tabs/types.d.ts +9 -0
  412. package/build/typescript/Tabs/useIndexStore.d.ts +3 -0
  413. package/build/typescript/Tabs/useScrollViewReaction.d.ts +8 -0
  414. package/build/typescript/Tabs/useTabCoordinates.d.ts +6 -0
  415. package/build/typescript/Tabs/useTabInnerContentsWidth.d.ts +6 -0
  416. package/build/typescript/Tabs/utils.d.ts +3 -0
  417. package/build/typescript/TextField/InputLabel.d.ts +1 -0
  418. package/build/typescript/TextField/TextFieldProps.d.ts +3 -0
  419. package/build/typescript/Toolbar/Toolbar.d.ts +1 -0
  420. package/build/typescript/Tooltip/Tooltip.d.ts +1 -0
  421. package/build/typescript/Tooltip/TooltipProps.d.ts +26 -1
  422. package/build/typescript/Typography/TypographyProps.d.ts +22 -1
  423. package/build/typescript/animated/AnimatedPressable.d.ts +2 -2
  424. package/build/typescript/hooks/index.d.ts +5 -0
  425. package/build/typescript/hooks/useAnimatedValue.d.ts +2 -0
  426. package/build/typescript/hooks/useCollapsibleAppBar.d.ts +2 -0
  427. package/build/typescript/hooks/useDebounce.d.ts +1 -0
  428. package/build/typescript/hooks/useFadeInAppBar.d.ts +1 -0
  429. package/build/typescript/hooks/useImperativeState.d.ts +6 -0
  430. package/build/typescript/hooks/useSyncAnimatedValue.d.ts +6 -0
  431. package/build/typescript/hooks/useValidWindowDimensions/index.ios.d.ts +2 -1
  432. package/build/typescript/index.d.ts +4 -2
  433. package/build/typescript/internal/hooks/index.d.ts +0 -1
  434. package/build/typescript/internal/icons/Checkbox.d.ts +9 -7
  435. package/build/typescript/internal/icons/CheckboxChecked.d.ts +9 -7
  436. package/build/typescript/internal/icons/ChevronDown.d.ts +9 -7
  437. package/build/typescript/internal/icons/ChevronLeft.d.ts +9 -7
  438. package/build/typescript/internal/icons/ChevronRight.d.ts +9 -7
  439. package/build/typescript/internal/icons/CircularProgress.d.ts +1 -0
  440. package/build/typescript/internal/icons/Close.d.ts +9 -7
  441. package/build/typescript/internal/icons/Radio.d.ts +9 -7
  442. package/build/typescript/internal/icons/RadioChecked.d.ts +9 -7
  443. package/build/typescript/store/MockStore.d.ts +7 -0
  444. package/build/typescript/store/SimpleStore.d.ts +10 -0
  445. package/build/typescript/store/index.d.ts +3 -0
  446. package/build/typescript/store/types.d.ts +10 -0
  447. package/build/typescript/types/index.d.ts +6 -0
  448. package/build/typescript/utils/index.d.ts +1 -0
  449. package/build/typescript/utils/isNotAndroid12.d.ts +2 -0
  450. package/package.json +9 -9
  451. package/src/Accordion/Accordion.tsx +147 -51
  452. package/src/Accordion/AccordionProps.ts +15 -11
  453. package/src/Badge/Badge.tsx +6 -16
  454. package/src/Badge/BadgeProps.ts +6 -0
  455. package/src/Button/Button.tsx +8 -2
  456. package/src/ButtonBase/ButtonBase.tsx +79 -44
  457. package/src/ButtonBase/ButtonBaseProps.ts +10 -0
  458. package/src/Checkbox/CheckboxProps.ts +1 -1
  459. package/src/Chip/Chip.tsx +13 -9
  460. package/src/Chip/ChipProps.ts +5 -0
  461. package/src/CircularProgress/CircularProgress.tsx +41 -33
  462. package/src/Dialog/Dialog.tsx +136 -14
  463. package/src/Dialog/DialogProps.ts +12 -0
  464. package/src/Divider/Divider.tsx +23 -14
  465. package/src/Divider/DividerProps.ts +27 -1
  466. package/src/Image/Image.tsx +78 -16
  467. package/src/Image/ImageProps.ts +36 -2
  468. package/src/Image/index.ts +1 -1
  469. package/src/ImageCore/ImageCoreNative.tsx +29 -19
  470. package/src/ImageCore/ImageCoreProps.ts +6 -1
  471. package/src/ImageCore/ImageCoreWeb.tsx +22 -2
  472. package/src/ImageCore/ImageFileExtensionContext.ts +7 -0
  473. package/src/ImageCore/ImageFileExtensionProvider.tsx +33 -0
  474. package/src/ImageCore/index.native.ts +3 -1
  475. package/src/ImageCore/index.ts +4 -1
  476. package/src/Modal/AnimatedContainer/index.tsx +172 -0
  477. package/src/Modal/Modal.tsx +44 -12
  478. package/src/Modal/ModalProps.ts +59 -1
  479. package/src/Modal/index.ts +4 -1
  480. package/src/Paper/Paper.tsx +1 -1
  481. package/src/Radio/Radio.tsx +10 -7
  482. package/src/Radio/RadioProps.ts +16 -0
  483. package/src/Slide/Slide.tsx +33 -27
  484. package/src/Slide/SlideProps.ts +2 -3
  485. package/src/Snackbar/Snackbar.tsx +33 -7
  486. package/src/Snackbar/SnackbarProps.ts +19 -9
  487. package/src/SnackbarContent/SnackbarContent.tsx +42 -10
  488. package/src/SnackbarContent/SnackbarContentProps.ts +14 -3
  489. package/src/SvgIcon/SvgIcon.tsx +1 -1
  490. package/src/Tab/Tab.tsx +85 -28
  491. package/src/Tab/TabIndicator.tsx +17 -15
  492. package/src/Tab/TabProps.ts +24 -2
  493. package/src/Tab/index.ts +1 -1
  494. package/src/Tabs/IndexAwareTab.tsx +29 -0
  495. package/src/Tabs/InternalContext.ts +13 -0
  496. package/src/Tabs/ScrollableTabsView.tsx +28 -0
  497. package/src/Tabs/TabIndicator.tsx +74 -37
  498. package/src/Tabs/TabIndicatorProps.ts +12 -5
  499. package/src/Tabs/Tabs.tsx +139 -93
  500. package/src/Tabs/TabsProps.ts +43 -23
  501. package/src/Tabs/index.ts +2 -1
  502. package/src/Tabs/types.ts +18 -0
  503. package/src/Tabs/useIndexStore.ts +31 -0
  504. package/src/Tabs/useScrollViewReaction.ts +62 -0
  505. package/src/Tabs/useTabCoordinates.ts +25 -0
  506. package/src/Tabs/useTabInnerContentsWidth.ts +26 -0
  507. package/src/Tabs/utils.ts +14 -0
  508. package/src/TextField/InputLabel.tsx +6 -1
  509. package/src/TextField/OutlinedTextField.tsx +8 -2
  510. package/src/TextField/TextField.tsx +10 -4
  511. package/src/TextField/TextFieldProps.ts +4 -0
  512. package/src/Tooltip/Tooltip.tsx +57 -26
  513. package/src/Tooltip/TooltipProps.ts +26 -1
  514. package/src/Typography/Typography.tsx +12 -3
  515. package/src/Typography/TypographyProps.ts +30 -1
  516. package/src/animated/AnimatedPressable.tsx +1 -2
  517. package/src/hooks/index.ts +6 -0
  518. package/src/hooks/useAnimatedValue.ts +21 -0
  519. package/src/hooks/useCollapsibleAppBar.ts +64 -47
  520. package/src/hooks/useDebounce.ts +23 -0
  521. package/src/hooks/useFadeInAppBar.ts +23 -17
  522. package/src/hooks/useImperativeState.ts +24 -0
  523. package/src/hooks/useSyncAnimatedValue.ts +38 -0
  524. package/src/hooks/useThrottle.ts +3 -3
  525. package/src/hooks/useValidWindowDimensions/index.ios.ts +16 -10
  526. package/src/index.ts +6 -2
  527. package/src/internal/hooks/index.ts +0 -1
  528. package/src/internal/hooks/useHeight.ts +4 -5
  529. package/src/internal/icons/Checkbox.tsx +1 -1
  530. package/src/internal/icons/CheckboxChecked.tsx +1 -1
  531. package/src/internal/icons/ChevronDown.tsx +1 -1
  532. package/src/internal/icons/ChevronLeft.tsx +1 -1
  533. package/src/internal/icons/ChevronRight.tsx +1 -1
  534. package/src/internal/icons/Close.tsx +1 -1
  535. package/src/internal/icons/Radio.tsx +1 -1
  536. package/src/internal/icons/RadioChecked.tsx +1 -1
  537. package/src/store/MockStore.ts +21 -0
  538. package/src/store/SimpleStore.ts +50 -0
  539. package/src/store/index.ts +3 -0
  540. package/src/store/types.ts +12 -0
  541. package/src/types/index.ts +7 -0
  542. package/src/utils/index.ts +1 -0
  543. package/src/utils/isNotAndroid12.ts +7 -0
  544. package/build/commonjs/ButtonBase/ButtonBase.ios.js +0 -101
  545. package/build/commonjs/ButtonBase/ButtonBase.ios.js.map +0 -1
  546. package/build/commonjs/ButtonBase/useDisabledReaction/index.js +0 -21
  547. package/build/commonjs/ButtonBase/useDisabledReaction/index.js.map +0 -1
  548. package/build/commonjs/ButtonBase/useDisabledReaction/index.native.js +0 -9
  549. package/build/commonjs/ButtonBase/useDisabledReaction/index.native.js.map +0 -1
  550. package/build/commonjs/ImageCore/ImageCoreNative.ios.js +0 -60
  551. package/build/commonjs/ImageCore/ImageCoreNative.ios.js.map +0 -1
  552. package/build/commonjs/internal/hooks/useWidth.js +0 -29
  553. package/build/commonjs/internal/hooks/useWidth.js.map +0 -1
  554. package/build/module/ButtonBase/ButtonBase.ios.js +0 -82
  555. package/build/module/ButtonBase/ButtonBase.ios.js.map +0 -1
  556. package/build/module/ButtonBase/useDisabledReaction/index.js +0 -12
  557. package/build/module/ButtonBase/useDisabledReaction/index.js.map +0 -1
  558. package/build/module/ButtonBase/useDisabledReaction/index.native.js +0 -2
  559. package/build/module/ButtonBase/useDisabledReaction/index.native.js.map +0 -1
  560. package/build/module/ImageCore/ImageCoreNative.ios.js +0 -45
  561. package/build/module/ImageCore/ImageCoreNative.ios.js.map +0 -1
  562. package/build/module/internal/hooks/useWidth.js +0 -15
  563. package/build/module/internal/hooks/useWidth.js.map +0 -1
  564. package/build/typescript/ButtonBase/ButtonBase.ios.d.ts +0 -2
  565. package/build/typescript/ButtonBase/useDisabledReaction/index.d.ts +0 -2
  566. package/build/typescript/ButtonBase/useDisabledReaction/index.native.d.ts +0 -2
  567. package/build/typescript/ImageCore/ImageCoreNative.ios.d.ts +0 -2
  568. package/build/typescript/internal/hooks/useWidth.d.ts +0 -2
  569. package/src/ButtonBase/ButtonBase.ios.tsx +0 -95
  570. package/src/ButtonBase/useDisabledReaction/index.native.ts +0 -4
  571. package/src/ButtonBase/useDisabledReaction/index.ts +0 -16
  572. package/src/ImageCore/ImageCoreNative.ios.tsx +0 -46
  573. package/src/internal/hooks/useWidth.ts +0 -17
package/CHANGELOG.md CHANGED
@@ -3,6 +3,38 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [2.0.0-beta.28](https://github.com/tappytoon/tappytoon/compare/@fountain-ui/core@1.11.0...@fountain-ui/core@2.0.0-beta.28) (2022-11-15)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * 3.23.0 issues ([#4681](https://github.com/tappytoon/tappytoon/issues/4681)) ([9337d88](https://github.com/tappytoon/tappytoon/commit/9337d88280066ba353297520c1abd6910159f8f9))
12
+ * Fix qa issues 2 ([#4629](https://github.com/tappytoon/tappytoon/issues/4629)) ([d1a2c4e](https://github.com/tappytoon/tappytoon/commit/d1a2c4e28353b950ac4abc7d4440f4f053fbe10a))
13
+ * front dev qa part 1 ([#4333](https://github.com/tappytoon/tappytoon/issues/4333)) ([98fb40c](https://github.com/tappytoon/tappytoon/commit/98fb40c8b9df489d2f6a5fa70e4d8eae6058fe42))
14
+ * fui carousel smooth scroll on fast swipe ([#4580](https://github.com/tappytoon/tappytoon/issues/4580)) ([ecddc30](https://github.com/tappytoon/tappytoon/commit/ecddc30bea41c43073f304f7acc0fcc6b4451810))
15
+ * fui several problems ([#4567](https://github.com/tappytoon/tappytoon/issues/4567)) ([6f8f30d](https://github.com/tappytoon/tappytoon/commit/6f8f30d43f906c93a356c3d640d85af1280a48ac))
16
+ * prevent infinite loop ([#4578](https://github.com/tappytoon/tappytoon/issues/4578)) ([826c164](https://github.com/tappytoon/tappytoon/commit/826c164ec0eca4a6abde0a9efa8ac418ee66e343))
17
+ * Qa web issues ([#4799](https://github.com/tappytoon/tappytoon/issues/4799)) ([0243146](https://github.com/tappytoon/tappytoon/commit/02431466df5043744ce0125023a491112e7af264))
18
+ * several problems ([#4611](https://github.com/tappytoon/tappytoon/issues/4611)) ([293c855](https://github.com/tappytoon/tappytoon/commit/293c85526da34409a1c5c988434c0841e35bedcd))
19
+ * several problems ([#4645](https://github.com/tappytoon/tappytoon/issues/4645)) ([e018bb2](https://github.com/tappytoon/tappytoon/commit/e018bb20b3ce334827d12c11a16435b101974f61))
20
+ * Web qa 6 ([#4819](https://github.com/tappytoon/tappytoon/issues/4819)) ([b553310](https://github.com/tappytoon/tappytoon/commit/b5533106a3bf8ada5bae97b999b6e4f333393433))
21
+
22
+
23
+ ### Features
24
+
25
+ * Add Accept header fountain-ui ImageCore ([#5012](https://github.com/tappytoon/tappytoon/issues/5012)) ([6801b51](https://github.com/tappytoon/tappytoon/commit/6801b513b7be30ef4330ac382ec58b7ad9f5ba5b))
26
+ * Add Chip component numberOfLines ([#4607](https://github.com/tappytoon/tappytoon/issues/4607)) ([3414b91](https://github.com/tappytoon/tappytoon/commit/3414b91f580a5242fd6a035d1faed06a1c827645))
27
+ * dark theme ([#4309](https://github.com/tappytoon/tappytoon/issues/4309)) ([bec43d0](https://github.com/tappytoon/tappytoon/commit/bec43d09e599e3ae0991d124602795260ff152d6))
28
+ * dark theme part 2 ([#4318](https://github.com/tappytoon/tappytoon/issues/4318)) ([00f5377](https://github.com/tappytoon/tappytoon/commit/00f53774f5220d63f446d3287eb397e54a790c87))
29
+ * dark theme part 3 ([#4328](https://github.com/tappytoon/tappytoon/issues/4328)) ([f91d9e1](https://github.com/tappytoon/tappytoon/commit/f91d9e1e10070cc92e95258b1344d42ca3f4fbd8))
30
+ * Fix dark theme qa part 2 ([#4394](https://github.com/tappytoon/tappytoon/issues/4394)) ([a5c7b75](https://github.com/tappytoon/tappytoon/commit/a5c7b7514ba7e7b58268d48d99945b397f981003))
31
+ * Fix several problems ([#4562](https://github.com/tappytoon/tappytoon/issues/4562)) ([bf6542d](https://github.com/tappytoon/tappytoon/commit/bf6542d9c72d0bc319dc1f1a6545c393fcda4cbb))
32
+ * Fui next ([#4520](https://github.com/tappytoon/tappytoon/issues/4520)) ([8c8c9ed](https://github.com/tappytoon/tappytoon/commit/8c8c9ed35e8d21113ccbe9b690fea6c48656bde9))
33
+
34
+
35
+
36
+
37
+
6
38
  ## [1.19.1](https://github.com/tappytoon/tappytoon/compare/@fountain-ui/core@1.11.0...@fountain-ui/core@1.19.1) (2022-05-19)
7
39
 
8
40
  **Note:** Version bump only for package @fountain-ui/core
@@ -7,82 +7,165 @@ exports.default = Accordion;
7
7
 
8
8
  var _react = _interopRequireWildcard(require("react"));
9
9
 
10
+ var _reactNative = require("react-native");
11
+
10
12
  var _reactNativeReanimated = _interopRequireWildcard(require("react-native-reanimated"));
11
13
 
14
+ var _styles = require("../styles");
15
+
12
16
  var _icons = require("../internal/icons");
13
17
 
14
18
  var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
15
19
 
16
20
  var _Column = _interopRequireDefault(require("../Column"));
17
21
 
18
- var _Divider = _interopRequireDefault(require("../Divider"));
22
+ var _Row = _interopRequireDefault(require("../Row"));
19
23
 
20
24
  var _Spacer = _interopRequireDefault(require("../Spacer"));
21
25
 
22
26
  var _Typography = _interopRequireDefault(require("../Typography"));
23
27
 
24
- var _styles = require("../styles");
25
-
26
28
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
27
29
 
28
30
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
29
31
 
30
32
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
31
33
 
32
- const ANIMATION_OPTION = {
33
- duration: 250
34
+ const ROTATE_HIDE_DEGREE = 0;
35
+ const ROTATE_SHOW_DEGREE = 180;
36
+ const ANIMATION_CONFIG = {
37
+ duration: 200
34
38
  };
39
+ const INITIAL_EXPANDED_DELAY_MILLIS = 100;
40
+ const CONTENT_OPACITY_DELAY_MILLIS = 200;
35
41
 
36
42
  const useStyles = function () {
37
43
  const theme = (0, _styles.useTheme)();
38
44
  return {
39
45
  root: {
40
- flexDirection: 'row',
41
- paddingVertical: theme.spacing(3)
46
+ marginBottom: theme.spacing(3)
47
+ },
48
+ title: {
49
+ borderRadius: theme.spacing(4),
50
+ backgroundColor: theme.palette.paper.grey,
51
+ paddingHorizontal: theme.spacing(4),
52
+ paddingVertical: theme.spacing(3.5),
53
+ alignItems: 'center',
54
+ height: 64
55
+ },
56
+ titleColumn: {
57
+ flexShrink: 1
58
+ },
59
+ subtitle: {
60
+ fontSize: 11,
61
+ lineHeight: 12,
62
+ fontFamily: 'Inter-Regular'
63
+ },
64
+ contentView: {
65
+ position: 'absolute',
66
+ width: '100%',
67
+ borderRadius: theme.spacing(4),
68
+ backgroundColor: theme.palette.paper.grey,
69
+ paddingHorizontal: theme.spacing(4),
70
+ paddingVertical: theme.spacing(6),
71
+ marginTop: theme.spacing(1)
42
72
  }
43
73
  };
44
74
  };
45
75
 
46
76
  function Accordion(props) {
47
77
  const {
78
+ title,
79
+ subTitle,
48
80
  content,
49
- LeftIcon,
50
81
  RightIcon,
51
- title,
52
- titleVariant = 'subtitle2'
82
+ LeftComponent,
83
+ isInitialExpanded = false
53
84
  } = props;
54
85
  const styles = useStyles();
86
+ const theme = (0, _styles.useTheme)();
87
+ const CONTENT_MARGIN_HEIGHT = theme.spacing(2);
55
88
  const [isExpanded, setIsExpanded] = (0, _react.useState)(false);
56
- const rotate = (0, _reactNativeReanimated.useSharedValue)(0);
89
+ const shouldInitialExpandedRef = (0, _react.useRef)(isInitialExpanded);
90
+ const rotate = (0, _reactNativeReanimated.useSharedValue)(ROTATE_HIDE_DEGREE);
91
+ const animatedOpacity = (0, _reactNativeReanimated.useSharedValue)(0);
92
+ const animatedHeight = (0, _reactNativeReanimated.useSharedValue)(0);
93
+ const [contentHeight, setContentHeight] = (0, _react.useState)(0);
57
94
  const animatedChevronDownStyles = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
58
95
  transform: [{
59
96
  rotate: `${rotate.value}deg`
60
97
  }]
61
- }));
98
+ }), []);
99
+ const animatedContentBackgroundStyles = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
100
+ height: animatedHeight.value,
101
+ overflow: 'hidden'
102
+ }), []);
103
+ const animatedContentStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
104
+ opacity: animatedOpacity.value
105
+ }), []);
62
106
 
63
107
  const onPress = () => {
64
108
  setIsExpanded(prev => !prev);
65
- rotate.value = (0, _reactNativeReanimated.withTiming)(!isExpanded ? 180 : 0, ANIMATION_OPTION);
66
109
  };
67
110
 
68
- return /*#__PURE__*/_react.default.createElement(_Column.default, null, /*#__PURE__*/_react.default.createElement(_ButtonBase.default, {
69
- onPress: onPress,
111
+ const onLayout = event => {
112
+ const height = event.nativeEvent.layout.height + CONTENT_MARGIN_HEIGHT;
113
+ setContentHeight(height);
114
+
115
+ if (shouldInitialExpandedRef.current) {
116
+ shouldInitialExpandedRef.current = false;
117
+ setTimeout(() => setIsExpanded(true), INITIAL_EXPANDED_DELAY_MILLIS);
118
+ }
119
+ };
120
+
121
+ (0, _react.useEffect)(() => {
122
+ rotate.value = (0, _reactNativeReanimated.withTiming)(isExpanded ? ROTATE_SHOW_DEGREE : ROTATE_HIDE_DEGREE, ANIMATION_CONFIG);
123
+ animatedHeight.value = (0, _reactNativeReanimated.withTiming)(isExpanded ? contentHeight : 0, ANIMATION_CONFIG);
124
+ animatedOpacity.value = isExpanded ? (0, _reactNativeReanimated.withDelay)(CONTENT_OPACITY_DELAY_MILLIS, (0, _reactNativeReanimated.withTiming)(1, ANIMATION_CONFIG)) : (0, _reactNativeReanimated.withTiming)(0, ANIMATION_CONFIG);
125
+ }, [isExpanded, contentHeight]);
126
+ return /*#__PURE__*/_react.default.createElement(_Column.default, {
70
127
  style: styles.root
71
- }, LeftIcon ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, LeftIcon, /*#__PURE__*/_react.default.createElement(_Spacer.default, {
72
- size: 2
73
- })) : null, /*#__PURE__*/_react.default.createElement(_Typography.default, {
128
+ }, /*#__PURE__*/_react.default.createElement(_ButtonBase.default, {
129
+ onPress: onPress
130
+ }, /*#__PURE__*/_react.default.createElement(_Row.default, {
131
+ style: styles.title
132
+ }, LeftComponent ? LeftComponent : null, /*#__PURE__*/_react.default.createElement(_Column.default, {
133
+ style: styles.titleColumn
134
+ }, /*#__PURE__*/_react.default.createElement(_Typography.default, {
135
+ variant: 'subtitle2',
74
136
  children: title,
75
- variant: titleVariant
76
- }), /*#__PURE__*/_react.default.createElement(_Spacer.default, {
137
+ color: 'textPrimary',
138
+ numberOfLines: 1,
139
+ disableFontScaling: true
140
+ }), subTitle ? /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_Spacer.default, {
141
+ size: 0.5
142
+ }), /*#__PURE__*/_react.default.createElement(_Typography.default, {
143
+ style: styles.subtitle,
144
+ color: 'tertiary',
145
+ children: subTitle,
146
+ numberOfLines: 1,
147
+ disableFontScaling: true
148
+ })) : null), /*#__PURE__*/_react.default.createElement(_Spacer.default, {
77
149
  flex: 1
78
150
  }), /*#__PURE__*/_react.default.createElement(_Spacer.default, {
79
- size: 2
80
- }), /*#__PURE__*/_react.default.createElement(_Column.default, null, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
151
+ size: 3
152
+ }), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
81
153
  style: animatedChevronDownStyles
82
- }, RightIcon ? RightIcon : /*#__PURE__*/_react.default.createElement(_icons.ChevronDown, null)))), isExpanded ? /*#__PURE__*/_react.default.isValidElement(content) ? content : /*#__PURE__*/_react.default.createElement(_Typography.default, {
83
- children: content,
84
- color: 'textSecondary',
85
- variant: 'body2'
86
- }) : null, /*#__PURE__*/_react.default.createElement(_Divider.default, null));
154
+ }, RightIcon ? RightIcon : /*#__PURE__*/_react.default.createElement(_icons.ChevronDown, {
155
+ width: 20,
156
+ height: 20,
157
+ color: 'tertiary'
158
+ })))), /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
159
+ style: animatedContentBackgroundStyles
160
+ }, /*#__PURE__*/_react.default.createElement(_reactNative.View, {
161
+ onLayout: onLayout,
162
+ style: styles.contentView
163
+ }, /*#__PURE__*/_react.default.createElement(_reactNativeReanimated.default.View, {
164
+ style: animatedContentStyle
165
+ }, typeof content === 'string' ? /*#__PURE__*/_react.default.createElement(_Typography.default, {
166
+ variant: 'subtitle2',
167
+ color: 'tertiary',
168
+ children: content
169
+ }) : content))));
87
170
  }
88
171
  //# sourceMappingURL=Accordion.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["ANIMATION_OPTION","duration","useStyles","theme","useTheme","root","flexDirection","paddingVertical","spacing","Accordion","props","content","LeftIcon","RightIcon","title","titleVariant","styles","isExpanded","setIsExpanded","useState","rotate","useSharedValue","animatedChevronDownStyles","useAnimatedStyle","transform","value","onPress","prev","withTiming","React","isValidElement"],"sources":["Accordion.tsx"],"sourcesContent":["import React, { useState } from 'react';\nimport Animated, { useAnimatedStyle, useSharedValue, withTiming } from 'react-native-reanimated';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { ChevronDown as ChevronDownIcon } from '../internal/icons';\nimport ButtonBase from '../ButtonBase';\nimport Column from '../Column';\nimport Divider from '../Divider';\nimport Spacer from '../Spacer';\nimport Typography from '../Typography';\nimport { useTheme } from '../styles';\n\nimport AccordionProps from './AccordionProps';\n\ntype AccordionStyles = NamedStylesStringUnion<'root'>;\n\nconst ANIMATION_OPTION = { duration: 250 };\n\nconst useStyles: UseStyles<AccordionStyles> = function (): AccordionStyles {\n const theme = useTheme();\n\n return {\n root: {\n flexDirection: 'row',\n paddingVertical: theme.spacing(3),\n },\n };\n};\n\nexport default function Accordion(props: AccordionProps) {\n const {\n content,\n LeftIcon,\n RightIcon,\n title,\n titleVariant = 'subtitle2',\n } = props;\n\n const styles = useStyles();\n\n const [isExpanded, setIsExpanded] = useState(false);\n const rotate = useSharedValue(0);\n\n const animatedChevronDownStyles = useAnimatedStyle(() => ({\n transform: [{ rotate: `${rotate.value}deg` }],\n }));\n\n const onPress = () => {\n setIsExpanded(prev => !prev);\n rotate.value = withTiming(!isExpanded ? 180 : 0, ANIMATION_OPTION);\n };\n\n return (\n <Column>\n <ButtonBase\n onPress={onPress}\n style={styles.root}\n >\n {LeftIcon ? (\n <React.Fragment>\n {LeftIcon}\n <Spacer size={2}/>\n </React.Fragment>\n ) : null}\n\n <Typography\n children={title}\n variant={titleVariant}\n />\n\n <Spacer flex={1}/>\n\n <Spacer size={2}/>\n\n <Column>\n <Animated.View style={animatedChevronDownStyles}>\n {RightIcon ? RightIcon : <ChevronDownIcon/>}\n </Animated.View>\n </Column>\n </ButtonBase>\n\n {isExpanded ? (\n React.isValidElement(content) ? (content) : (\n <Typography\n children={content}\n color={'textSecondary'}\n variant={'body2'}\n />\n )\n ) : null}\n\n <Divider/>\n </Column>\n );\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAMA,MAAMA,gBAAgB,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAAzB;;AAEA,MAAMC,SAAqC,GAAG,YAA6B;EACvE,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,aAAa,EAAE,KADb;MAEFC,eAAe,EAAEJ,KAAK,CAACK,OAAN,CAAc,CAAd;IAFf;EADH,CAAP;AAMH,CATD;;AAWe,SAASC,SAAT,CAAmBC,KAAnB,EAA0C;EACrD,MAAM;IACFC,OADE;IAEFC,QAFE;IAGFC,SAHE;IAIFC,KAJE;IAKFC,YAAY,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BAAD;IACI,QAAQ,EAAEA,OADd;IAEI,KAAK,EAAE,eAFX;IAGI,OAAO,EAAE;EAHb,EAFG,GAQP,IApCR,eAsCI,6BAAC,gBAAD,OAtCJ,CADJ;AA0CH"}
1
+ {"version":3,"names":["ROTATE_HIDE_DEGREE","ROTATE_SHOW_DEGREE","ANIMATION_CONFIG","duration","INITIAL_EXPANDED_DELAY_MILLIS","CONTENT_OPACITY_DELAY_MILLIS","useStyles","theme","useTheme","root","marginBottom","spacing","title","borderRadius","backgroundColor","palette","paper","grey","paddingHorizontal","paddingVertical","alignItems","height","titleColumn","flexShrink","subtitle","fontSize","lineHeight","fontFamily","contentView","position","width","marginTop","Accordion","props","subTitle","content","RightIcon","LeftComponent","isInitialExpanded","styles","CONTENT_MARGIN_HEIGHT","isExpanded","setIsExpanded","useState","shouldInitialExpandedRef","useRef","rotate","useSharedValue","animatedOpacity","animatedHeight","contentHeight","setContentHeight","animatedChevronDownStyles","useAnimatedStyle","transform","value","animatedContentBackgroundStyles","overflow","animatedContentStyle","opacity","onPress","prev","onLayout","event","nativeEvent","layout","current","setTimeout","useEffect","withTiming","withDelay"],"sources":["Accordion.tsx"],"sourcesContent":["import React, { useEffect, useRef, useState } from 'react';\nimport { LayoutChangeEvent, View } from 'react-native';\nimport Animated, {\n useAnimatedStyle,\n useSharedValue,\n withDelay,\n withTiming,\n WithTimingConfig,\n} from 'react-native-reanimated';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport { ChevronDown } from '../internal/icons';\nimport ButtonBase from '../ButtonBase';\nimport Column from '../Column';\nimport Row from '../Row';\nimport Spacer from '../Spacer';\nimport Typography from '../Typography';\n\nimport AccordionProps from './AccordionProps';\n\ntype AccordionStyles = NamedStylesStringUnion<\n 'root'\n | 'title'\n | 'titleColumn'\n | 'subtitle'\n | 'contentView'\n>;\n\nconst ROTATE_HIDE_DEGREE = 0;\nconst ROTATE_SHOW_DEGREE = 180;\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 200 };\nconst INITIAL_EXPANDED_DELAY_MILLIS = 100;\nconst CONTENT_OPACITY_DELAY_MILLIS = 200;\n\nconst useStyles: UseStyles<AccordionStyles> = function (): AccordionStyles {\n const theme = useTheme();\n\n return {\n root: { marginBottom: theme.spacing(3) },\n title: {\n borderRadius: theme.spacing(4),\n backgroundColor: theme.palette.paper.grey,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(3.5),\n alignItems: 'center',\n height: 64,\n },\n titleColumn: { flexShrink: 1 },\n subtitle: {\n fontSize: 11,\n lineHeight: 12,\n fontFamily: 'Inter-Regular',\n },\n contentView: {\n position: 'absolute',\n width: '100%',\n borderRadius: theme.spacing(4),\n backgroundColor: theme.palette.paper.grey,\n paddingHorizontal: theme.spacing(4),\n paddingVertical: theme.spacing(6),\n marginTop: theme.spacing(1),\n },\n };\n};\n\nexport default function Accordion(props: AccordionProps) {\n const {\n title,\n subTitle,\n content,\n RightIcon,\n LeftComponent,\n isInitialExpanded = false,\n } = props;\n\n const styles = useStyles();\n const theme = useTheme();\n const CONTENT_MARGIN_HEIGHT = theme.spacing(2);\n\n const [isExpanded, setIsExpanded] = useState(false);\n const shouldInitialExpandedRef = useRef<boolean>(isInitialExpanded);\n\n const rotate = useSharedValue(ROTATE_HIDE_DEGREE);\n const animatedOpacity = useSharedValue(0);\n\n const animatedHeight = useSharedValue(0);\n const [contentHeight, setContentHeight] = useState(0);\n\n const animatedChevronDownStyles = useAnimatedStyle(() => ({\n transform: [{ rotate: `${rotate.value}deg` }],\n }), []);\n\n const animatedContentBackgroundStyles = useAnimatedStyle(() => ({\n height: animatedHeight.value,\n overflow: 'hidden',\n }), []);\n\n const animatedContentStyle = useAnimatedStyle(() => ({\n opacity: animatedOpacity.value,\n }), []);\n\n const onPress = () => {\n setIsExpanded(prev => !prev);\n };\n\n const onLayout = (event: LayoutChangeEvent) => {\n const height = event.nativeEvent.layout.height + CONTENT_MARGIN_HEIGHT;\n setContentHeight(height);\n\n if (shouldInitialExpandedRef.current) {\n shouldInitialExpandedRef.current = false;\n setTimeout(() => setIsExpanded(true), INITIAL_EXPANDED_DELAY_MILLIS);\n }\n };\n\n useEffect(() => {\n rotate.value = withTiming(isExpanded ? ROTATE_SHOW_DEGREE : ROTATE_HIDE_DEGREE, ANIMATION_CONFIG);\n\n animatedHeight.value = withTiming(isExpanded ? contentHeight : 0, ANIMATION_CONFIG);\n\n animatedOpacity.value = isExpanded\n ? withDelay(CONTENT_OPACITY_DELAY_MILLIS, withTiming(1, ANIMATION_CONFIG))\n : withTiming(0, ANIMATION_CONFIG);\n }, [isExpanded, contentHeight]);\n\n return (\n <Column style={styles.root}>\n <ButtonBase onPress={onPress}>\n <Row style={styles.title}>\n {LeftComponent ? LeftComponent : null}\n\n <Column style={styles.titleColumn}>\n <Typography\n variant={'subtitle2'}\n children={title}\n color={'textPrimary'}\n numberOfLines={1}\n disableFontScaling={true}\n />\n\n {subTitle ? (\n <React.Fragment>\n <Spacer size={0.5}/>\n\n <Typography\n style={styles.subtitle}\n color={'tertiary'}\n children={subTitle}\n numberOfLines={1}\n disableFontScaling={true}\n />\n </React.Fragment>\n ) : null}\n </Column>\n\n <Spacer flex={1}/>\n\n <Spacer size={3}/>\n\n <Animated.View style={animatedChevronDownStyles}>\n {RightIcon ? RightIcon : (\n <ChevronDown\n width={20}\n height={20}\n color={'tertiary'}\n />\n )}\n </Animated.View>\n </Row>\n </ButtonBase>\n\n <Animated.View style={animatedContentBackgroundStyles}>\n <View\n onLayout={onLayout}\n style={styles.contentView}\n >\n <Animated.View style={animatedContentStyle}>\n {typeof content === 'string' ? (\n <Typography\n variant={'subtitle2'}\n color={'tertiary'}\n children={content}\n />\n ) : (content)}\n </Animated.View>\n </View>\n </Animated.View>\n </Column>\n );\n}\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAQA;;AACA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;AAYA,MAAMA,kBAA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,EAAEV,KAFd;IAGI,KAAK,EAAE,aAHX;IAII,aAAa,EAAE,CAJnB;IAKI,kBAAkB,EAAE;EALxB,EADJ,EASKsB,QAAQ,gBACL,6BAAC,cAAD,CAAO,QAAP,qBACI,6BAAC,eAAD;IAAQ,IAAI,EAAE;EAAd,EADJ,eAGI,6BAAC,mBAAD;IACI,KAAK,EAAEK,MAAM,CAACf,QADlB;IAEI,KAAK,EAAE,UAFX;IAGI,QAAQ,EAAEU,QAHd;IAII,aAAa,EAAE,CAJnB;IAKI,kBAAkB,EAAE;EALxB,EAHJ,CADK,GAYL,IArBR,CAHJ,eA2BI,6BAAC,eAAD;IAAQ,IAAI,EAAE;EAAd,EA3BJ,eA6BI,6BAAC,eAAD;IAAQ,IAAI,EAAE;EAAd,EA7BJ,eA+BI,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAEkB;EAAtB,GACKhB,SAAS,GAAGA,SAAH,gBACN,6BAAC,kBAAD;IACI,KAAK,EAAE,EADX;IAEI,MAAM,EAAE,EAFZ;IAGI,KAAK,EAAE;EAHX,EAFR,CA/BJ,CADJ,CADJ,eA6CI,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAEoB;EAAtB,gBACI,6BAAC,iBAAD;IACI,QAAQ,EAAEM,QADd;IAEI,KAAK,EAAEvB,MAAM,CAACX;EAFlB,gBAII,6BAAC,8BAAD,CAAU,IAAV;IAAe,KAAK,EAAE8B;EAAtB,GACK,OAAOvB,OAAP,KAAmB,QAAnB,gBACG,6BAAC,mBAAD;IACI,OAAO,EAAE,WADb;IAEI,KAAK,EAAE,UAFX;IAGI,QAAQ,EAAEA;EAHd,EADH,GAMIA,OAPT,CAJJ,CADJ,CA7CJ,CADJ;AAgEH"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["AccordionProps.ts"],"sourcesContent":["import React from 'react';\nimport type { TypographyProps } from '../Typography';\n\nexport default interface AccordionProps {\n /**\n * The content of the component.\n */\n content: string | React.ReactNode;\n\n /**\n * The icon to the left of the component.\n */\n LeftIcon?: React.ReactElement;\n\n /**\n * The icon to the right of the component.\n */\n RightIcon?: React.ReactElement;\n\n /**\n * The title of the component.\n */\n title: string;\n\n /**\n * The variant of the component title.\n * @default 'subtitle2'\n */\n titleVariant?: TypographyProps['variant'];\n}"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["AccordionProps.ts"],"sourcesContent":["import React from 'react';\n\nexport default interface AccordionProps {\n /**\n * The title of the component.\n */\n title: string | React.ReactNode;\n\n /**\n * The subtitle of the component.\n */\n subTitle?: string | React.ReactNode;\n\n /**\n * The component to the left of the title.\n */\n LeftComponent?: React.ReactNode;\n\n /**\n * The icon to the right of the title.\n */\n RightIcon?: React.ReactElement;\n\n /**\n * The content of the component.\n */\n content: string | React.ReactNode;\n\n /**\n * The initial state of expanding\n * @default false\n */\n isInitialExpanded?: boolean;\n}"],"mappings":""}
@@ -23,7 +23,6 @@ const defaultPosition = {
23
23
  const useStyles = function () {
24
24
  const theme = (0, _styles.useTheme)();
25
25
  const dotSize = 4;
26
- const offset = 0;
27
26
  return {
28
27
  root: {},
29
28
  badge: {
@@ -32,18 +31,6 @@ const useStyles = function () {
32
31
  height: dotSize,
33
32
  position: 'absolute',
34
33
  width: dotSize
35
- },
36
- top: {
37
- top: offset
38
- },
39
- bottom: {
40
- bottom: offset
41
- },
42
- left: {
43
- left: offset
44
- },
45
- right: {
46
- right: offset
47
34
  }
48
35
  };
49
36
  };
@@ -54,11 +41,15 @@ function Badge(props) {
54
41
  invisible = false,
55
42
  position = defaultPosition,
56
43
  style,
44
+ offset = 0,
57
45
  ...otherProps
58
46
  } = props;
59
47
  const styles = useStyles();
60
48
  const rootStyle = (0, _styles.css)([styles.root, style]);
61
- const badgeStyle = (0, _styles.css)([styles.badge, styles[position.vertical], styles[position.horizontal]]);
49
+ const badgeStyle = (0, _styles.css)([styles.badge, {
50
+ [position.vertical]: offset,
51
+ [position.horizontal]: offset
52
+ }]);
62
53
  return /*#__PURE__*/_react.default.createElement(_reactNative.View, _extends({
63
54
  style: rootStyle
64
55
  }, otherProps), children, !invisible ? /*#__PURE__*/_react.default.createElement(_reactNative.View, {
@@ -1 +1 @@
1
- {"version":3,"names":["defaultPosition","vertical","horizontal","useStyles","theme","useTheme","dotSize","offset","root","badge","backgroundColor","palette","secondary","main","borderRadius","height","position","width","top","bottom","left","right","Badge","props","children","invisible","style","otherProps","styles","rootStyle","css","badgeStyle"],"sources":["Badge.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport BadgeProps, { BadgePosition } from './BadgeProps';\n\nconst defaultPosition: BadgePosition = {\n vertical: 'top',\n horizontal: 'right',\n};\n\ntype BadgeStyles = NamedStylesStringUnion<'root' | 'badge' | 'top' | 'bottom' | 'left' | 'right'>;\n\nconst useStyles: UseStyles<BadgeStyles> = function (): BadgeStyles {\n const theme = useTheme();\n\n const dotSize = 4;\n const offset = 0;\n\n return {\n root: {},\n badge: {\n backgroundColor: theme.palette.secondary.main,\n borderRadius: dotSize * 0.5,\n height: dotSize,\n position: 'absolute',\n width: dotSize,\n },\n top: {\n top: offset,\n },\n bottom: {\n bottom: offset,\n },\n left: {\n left: offset,\n },\n right: {\n right: offset,\n },\n };\n};\n\nexport default function Badge(props: BadgeProps) {\n const {\n children,\n invisible = false,\n position = defaultPosition,\n style,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const rootStyle = css([\n styles.root,\n style,\n ]);\n\n const badgeStyle = css([\n styles.badge,\n styles[position.vertical],\n styles[position.horizontal],\n ]);\n\n return (\n <View\n style={rootStyle}\n {...otherProps}\n >\n {children}\n\n {!invisible ? <View style={badgeStyle}/> : null}\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAGA,MAAMA,eAA8B,GAAG;EACnCC,QAAQ,EAAE,KADyB;EAEnCC,UAAU,EAAE;AAFu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,KAAK,EAAEM;EAAb,EAAb,GAA0C,IAN/C,CADJ;AAUH;;AAAA"}
1
+ {"version":3,"names":["defaultPosition","vertical","horizontal","useStyles","theme","useTheme","dotSize","root","badge","backgroundColor","palette","secondary","main","borderRadius","height","position","width","Badge","props","children","invisible","style","offset","otherProps","styles","rootStyle","css","badgeStyle"],"sources":["Badge.tsx"],"sourcesContent":["import React from 'react';\nimport { View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport BadgeProps, { BadgePosition } from './BadgeProps';\n\nconst defaultPosition: BadgePosition = {\n vertical: 'top',\n horizontal: 'right',\n};\n\ntype BadgeStyles = NamedStylesStringUnion<'root' | 'badge'>;\n\nconst useStyles: UseStyles<BadgeStyles> = function (): BadgeStyles {\n const theme = useTheme();\n\n const dotSize = 4;\n\n return {\n root: {},\n badge: {\n backgroundColor: theme.palette.secondary.main,\n borderRadius: dotSize * 0.5,\n height: dotSize,\n position: 'absolute',\n width: dotSize,\n },\n };\n};\n\nexport default function Badge(props: BadgeProps) {\n const {\n children,\n invisible = false,\n position = defaultPosition,\n style,\n offset = 0,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const rootStyle = css([\n styles.root,\n style,\n ]);\n\n const badgeStyle = css([\n styles.badge,\n {\n [position.vertical]: offset,\n [position.horizontal]: offset,\n },\n ]);\n\n return (\n <View\n style={rootStyle}\n {...otherProps}\n >\n {children}\n\n {!invisible ? <View style={badgeStyle}/> : null}\n </View>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;;;;;AAGA,MAAMA,eAA8B,GAAG;EACnCC,QAAQ,EAAE,KADyB;EAEnCC,UAAU,EAAE;AAFuB,CAAvC;;AAOA,MAAMC,SAAiC,GAAG,YAAyB;EAC/D,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC,OAAO,GAAG,CAAhB;EAEA,OAAO;IACHC,IAAI,EAAE,EADH;IAEHC,KAAK,EAAE;MACHC,eAAe,EAAEL,KAAK,CAACM,OAAN,CAAcC,SAAd,CAAwBC,IADtC;MAEHC,YAAY,EAAEP,OAAO,GAAG,GAFrB;MAGHQ,MAAM,EAAER,OAHL;MAIHS,QAAQ,EAAE,UAJP;MAKHC,KAAK,EAAEV;IALJ;EAFJ,CAAP;AAUH,CAfD;;AAiBe,SAASW,KAAT,CAAeC,KAAf,EAAkC;EAC7C,MAAM;IACFC,QADE;IAEFC,SAAS,GAAG,KAFV;IAGFL,QAAQ,GAAGf,eAHT;IAIFqB,KAJE;IAKFC,MAAM,GAAG,CALP;IAMF,GAAGC;EAND,IAOFL,KAPJ;EASA,MAAMM,MAAM,GAAGrB,SAAS,EAAxB;EAEA,MAAMsB,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBF,MAAM,CAACjB,IADW,EAElBc,KAFkB,CAAJ,CAAlB;EAKA,MAAMM,UAAU,GAAG,IAAAD,WAAA,EAAI,CACnBF,MAAM,CAAChB,KADY,EAEnB;IACI,CAACO,QAAQ,CAACd,QAAV,GAAqBqB,MADzB;IAEI,CAACP,QAAQ,CAACb,UAAV,GAAuBoB;EAF3B,CAFmB,CAAJ,CAAnB;EAQA,oBACI,6BAAC,iBAAD;IACI,KAAK,EAAEG;EADX,GAEQF,UAFR,GAIKJ,QAJL,EAMK,CAACC,SAAD,gBAAa,6BAAC,iBAAD;IAAM,KAAK,EAAEO;EAAb,EAAb,GAA0C,IAN/C,CADJ;AAUH;;AAAA"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport type BadgeHorizontalPosition = 'right' | 'left';\n\nexport type BadgeVerticalPosition = 'top' | 'bottom';\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n}> {}\n"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["BadgeProps.ts"],"sourcesContent":["import React from 'react';\nimport type { ViewProps } from 'react-native';\nimport type { OverridableComponentProps } from '../types';\n\nexport type BadgeHorizontalPosition = 'right' | 'left';\n\nexport type BadgeVerticalPosition = 'top' | 'bottom';\n\nexport interface BadgePosition {\n vertical: BadgeVerticalPosition;\n horizontal: BadgeHorizontalPosition;\n}\n\nexport default interface BadgeProps extends OverridableComponentProps<ViewProps, {\n /**\n * The badge will be added relative to this node.\n */\n children?: React.ReactNode;\n\n /**\n * If `true`, the badge is invisible.\n * @default false\n */\n invisible?: boolean;\n\n /**\n * The position of the badge.\n * @default {\n * vertical: 'top',\n * horizontal: 'right',\n * }\n */\n position?: BadgePosition;\n\n /**\n * The offset of the badge.\n * @default 0\n */\n offset?: number;\n}> {}\n"],"mappings":""}
@@ -53,6 +53,7 @@ function Button(props) {
53
53
  fullWidth = false,
54
54
  href,
55
55
  onPress,
56
+ pressEffect,
56
57
  size = 'medium',
57
58
  startIcon: startIconProp,
58
59
  style: styleProp,
@@ -83,10 +84,10 @@ function Button(props) {
83
84
  };
84
85
  const startIcon = (0, _utils.cloneElementSafely)(startIconProp, iconProps);
85
86
  const endIcon = (0, _utils.cloneElementSafely)(endIconProp, iconProps);
86
- const paddingSize = size === 'small' ? theme.spacing(2) : theme.spacing(4);
87
+ const paddingSize = size === 'small' ? theme.spacing(3) : theme.spacing(4);
87
88
  const paddingLeft = startIcon ? paddingSize - theme.spacing(1) : paddingSize;
88
89
  const paddingRight = endIcon ? paddingSize - theme.spacing(1) : paddingSize;
89
- const borderRadius = theme.shape.roundness;
90
+ const borderRadius = theme.shape.roundnessLarge;
90
91
  const buttonBaseStyle = (0, _styles.css)([styles.root, variantStyleMap[variant], size === 'medium' ? styles.medium : styles.small, fullWidth ? styles.fullWidth : undefined, {
91
92
  borderRadius,
92
93
  color: fontColor
@@ -109,6 +110,7 @@ function Button(props) {
109
110
  const textStyle = (0, _styles.css)([fontStyle, textMarginStyle, {
110
111
  textAlign: 'center'
111
112
  }]);
113
+ const modifiedPressEffect = variant !== 'text' && !pressEffect ? 'scale' : pressEffect;
112
114
 
113
115
  const handlePress = async () => {
114
116
  if (disabled) {
@@ -130,7 +132,8 @@ function Button(props) {
130
132
  return /*#__PURE__*/_react.default.createElement(_ButtonBase.default, _extends({
131
133
  disabled: disabled,
132
134
  onPress: handlePress,
133
- style: buttonBaseStyle
135
+ style: buttonBaseStyle,
136
+ pressEffect: modifiedPressEffect
134
137
  }, otherProps), startIcon, /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
135
138
  children: children,
136
139
  style: textStyle
@@ -1 +1 @@
1
- {"version":3,"names":["iconSizes","small","medium","styles","StyleSheet","create","root","flexDirection","justifyContent","alignItems","fullWidth","width","minWidth","height","Button","props","children","clipHorizontalSpacing","color","disabled","endIcon","endIconProp","href","onPress","size","startIcon","startIconProp","style","styleProp","variant","otherProps","theme","useTheme","mainColor","palette","main","fontColor","contrastTextColor","variantStyleMap","contained","backgroundColor","outlined","borderColor","borderStyle","borderWidth","text","iconProps","fill","cloneElementSafely","paddingSize","spacing","paddingLeft","paddingRight","borderRadius","shape","roundness","buttonBaseStyle","css","undefined","fontStyle","createFontStyle","selector","typo","button2","button1","textMarginSize","textMarginStyle","marginLeft","marginRight","textStyle","textAlign","handlePress","Linking","canOpenURL","openURL"],"sources":["Button.tsx"],"sourcesContent":["import React from 'react';\nimport { Linking, Text } from 'react-native';\nimport ButtonBase from '../ButtonBase';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport type ButtonProps from './ButtonProps';\nimport type { ButtonSize } from './ButtonProps';\n\ntype IconSizes = { [n in ButtonSize]: number };\n\nconst iconSizes: IconSizes = {\n small: 20,\n medium: 24,\n};\n\nconst styles = StyleSheet.create({\n root: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n },\n fullWidth: {\n width: '100%',\n },\n medium: {\n minWidth: 104,\n height: 48,\n },\n small: {\n minWidth: 56,\n height: 32,\n },\n});\n\nexport default function Button(props: ButtonProps) {\n const {\n children,\n clipHorizontalSpacing = false,\n color = 'primary',\n disabled = false,\n endIcon: endIconProp,\n fullWidth = false,\n href,\n onPress,\n size = 'medium',\n startIcon: startIconProp,\n style: styleProp,\n variant = 'contained',\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const mainColor = theme.palette[color].main;\n\n const fontColor = variant === 'contained'\n ? theme.palette[color].contrastTextColor\n : theme.palette[color].main;\n\n const variantStyleMap = {\n contained: {\n backgroundColor: mainColor,\n },\n outlined: {\n backgroundColor: 'transparent',\n borderColor: mainColor,\n borderStyle: 'solid',\n borderWidth: 1,\n },\n text: {\n backgroundColor: 'transparent',\n },\n };\n\n const iconProps = {\n width: iconSizes[size],\n height: iconSizes[size],\n fill: fontColor,\n };\n\n const startIcon = cloneElementSafely(startIconProp, iconProps);\n const endIcon = cloneElementSafely(endIconProp, iconProps);\n\n const paddingSize = size === 'small' ? theme.spacing(2) : theme.spacing(4);\n const paddingLeft = startIcon ? paddingSize - theme.spacing(1) : paddingSize;\n const paddingRight = endIcon ? paddingSize - theme.spacing(1) : paddingSize;\n\n const borderRadius = theme.shape.roundness;\n const buttonBaseStyle = css([\n styles.root,\n variantStyleMap[variant],\n size === 'medium' ? styles.medium : styles.small,\n fullWidth ? styles.fullWidth : undefined,\n { borderRadius, color: fontColor },\n (variant === 'text' && clipHorizontalSpacing)\n ? { minWidth: 0 }\n : { paddingLeft, paddingRight },\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => size === 'small' ? typo.button2 : typo.button1,\n color: fontColor,\n });\n\n const textMarginSize = size === 'small' ? theme.spacing(1) : theme.spacing(2);\n const textMarginStyle = startIcon\n ? { marginLeft: textMarginSize }\n : endIcon\n ? { marginRight: textMarginSize }\n : undefined;\n\n const textStyle = css([\n fontStyle,\n textMarginStyle,\n { textAlign: 'center' },\n ]);\n\n const handlePress = async () => {\n if (disabled) {\n return;\n }\n if (onPress) {\n onPress();\n return;\n }\n if (href) {\n if (await Linking.canOpenURL(href)) {\n await Linking.openURL(href);\n }\n }\n };\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={buttonBaseStyle}\n {...otherProps}\n >\n {startIcon}\n\n <Text\n children={children}\n style={textStyle}\n />\n\n {endIcon}\n </ButtonBase>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAMA,MAAMA,SAAoB,GAAG;EACzBC,KAAK,EAAE,EADkB;EAEzBC,MAAM,EAAE;AAFiB,CAA7B;;AAKA,MAAMC,MAAM,GAAGC,kBAAA,CAAWC,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACFC,aAAa,EAAE,KADb;IAEFC,cAAc,EAAE,QAFd;IAGFC,UAAU,EAAE;EAHV,CADuB;EAM7BC,SAAS,EAAE;IACPC,KAAK,EAAE;EADA,CANkB;EAS7BT,MAAM,EAAE;IACJU,QAAQ,EAAE,GADN;IAEJC,MAAM,EAAE;EAFJ,CATqB;EAa7BZ,KAAK,EAAE;IACHW,QAAQ,EAAE,EADP;IAEHC,MAAM,EAAE;EAFL;AAbsB,CAAlB,CAAf;;AAmBe,SAASC,MAAT,CAAgBC,KAAhB,EAAoC;EAC/C,MAAM;IACFC,QADE;IAEFC,qBAAqB,GAAG,KAFtB;IAGFC,KAAK,GAAG,SAHN;IAIFC,QAAQ,GAAG,KAJT;IAKFC,OAAO,EAAEC,WALP;IAMFX,SAAS,GAAG,KANV;IAOFY,IAPE;IAQFC,OARE;IASFC,IAAI,GAAG,QATL;IAUFC,SAAS,EAAEC,aAVT;IAWFC,KAA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AIpD,QAAJ,EAAc;MACV;IACH;;IACD,IAAII,OAAJ,EAAa;MACTA,OAAO;MACP;IACH;;IACD,IAAID,IAAJ,EAAU;MACN,IAAI,MAAMkD,oBAAA,CAAQC,UAAR,CAAmBnD,IAAnB,CAAV,EAAoC;QAChC,MAAMkD,oBAAA,CAAQE,OAAR,CAAgBpD,IAAhB,CAAN;MACH;IACJ;EACJ,CAbD;;EAeA,oBACI,6BAAC,mBAAD;IACI,QAAQ,EAAEH,QADd;IAEI,OAAO,EAAEoD,WAFb;IAGI,KAAK,EAAEf;EAHX,GAIQ1B,UAJR,GAMKL,SANL,eAQI,6BAAC,iBAAD;IACI,QAAQ,EAAET,QADd;IAEI,KAAK,EAAEqD;EAFX,EARJ,EAaKjD,OAbL,CADJ;AAiBH;;AAAA"}
1
+ {"version":3,"names":["iconSizes","small","medium","styles","StyleSheet","create","root","flexDirection","justifyContent","alignItems","fullWidth","width","minWidth","height","Button","props","children","clipHorizontalSpacing","color","disabled","endIcon","endIconProp","href","onPress","pressEffect","size","startIcon","startIconProp","style","styleProp","variant","otherProps","theme","useTheme","mainColor","palette","main","fontColor","contrastTextColor","variantStyleMap","contained","backgroundColor","outlined","borderColor","borderStyle","borderWidth","text","iconProps","fill","cloneElementSafely","paddingSize","spacing","paddingLeft","paddingRight","borderRadius","shape","roundnessLarge","buttonBaseStyle","css","undefined","fontStyle","createFontStyle","selector","typo","button2","button1","textMarginSize","textMarginStyle","marginLeft","marginRight","textStyle","textAlign","modifiedPressEffect","handlePress","Linking","canOpenURL","openURL"],"sources":["Button.tsx"],"sourcesContent":["import React from 'react';\nimport { Linking, Text } from 'react-native';\nimport ButtonBase from '../ButtonBase';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport { cloneElementSafely } from '../utils';\nimport type ButtonProps from './ButtonProps';\nimport type { ButtonSize } from './ButtonProps';\n\ntype IconSizes = { [n in ButtonSize]: number };\n\nconst iconSizes: IconSizes = {\n small: 20,\n medium: 24,\n};\n\nconst styles = StyleSheet.create({\n root: {\n flexDirection: 'row',\n justifyContent: 'center',\n alignItems: 'center',\n },\n fullWidth: {\n width: '100%',\n },\n medium: {\n minWidth: 104,\n height: 48,\n },\n small: {\n minWidth: 56,\n height: 32,\n },\n});\n\nexport default function Button(props: ButtonProps) {\n const {\n children,\n clipHorizontalSpacing = false,\n color = 'primary',\n disabled = false,\n endIcon: endIconProp,\n fullWidth = false,\n href,\n onPress,\n pressEffect,\n size = 'medium',\n startIcon: startIconProp,\n style: styleProp,\n variant = 'contained',\n ...otherProps\n } = props;\n\n const theme = useTheme();\n\n const mainColor = theme.palette[color].main;\n\n const fontColor = variant === 'contained'\n ? theme.palette[color].contrastTextColor\n : theme.palette[color].main;\n\n const variantStyleMap = {\n contained: {\n backgroundColor: mainColor,\n },\n outlined: {\n backgroundColor: 'transparent',\n borderColor: mainColor,\n borderStyle: 'solid',\n borderWidth: 1,\n },\n text: {\n backgroundColor: 'transparent',\n },\n };\n\n const iconProps = {\n width: iconSizes[size],\n height: iconSizes[size],\n fill: fontColor,\n };\n\n const startIcon = cloneElementSafely(startIconProp, iconProps);\n const endIcon = cloneElementSafely(endIconProp, iconProps);\n\n const paddingSize = size === 'small' ? theme.spacing(3) : theme.spacing(4);\n const paddingLeft = startIcon ? paddingSize - theme.spacing(1) : paddingSize;\n const paddingRight = endIcon ? paddingSize - theme.spacing(1) : paddingSize;\n\n const borderRadius = theme.shape.roundnessLarge;\n const buttonBaseStyle = css([\n styles.root,\n variantStyleMap[variant],\n size === 'medium' ? styles.medium : styles.small,\n fullWidth ? styles.fullWidth : undefined,\n { borderRadius, color: fontColor },\n (variant === 'text' && clipHorizontalSpacing)\n ? { minWidth: 0 }\n : { paddingLeft, paddingRight },\n styleProp,\n ]);\n\n const fontStyle = createFontStyle(theme, {\n selector: (typo) => size === 'small' ? typo.button2 : typo.button1,\n color: fontColor,\n });\n\n const textMarginSize = size === 'small' ? theme.spacing(1) : theme.spacing(2);\n const textMarginStyle = startIcon\n ? { marginLeft: textMarginSize }\n : endIcon\n ? { marginRight: textMarginSize }\n : undefined;\n\n const textStyle = css([\n fontStyle,\n textMarginStyle,\n { textAlign: 'center' },\n ]);\n\n const modifiedPressEffect = variant !== 'text' && !pressEffect\n ? 'scale'\n : pressEffect;\n\n const handlePress = async () => {\n if (disabled) {\n return;\n }\n if (onPress) {\n onPress();\n return;\n }\n if (href) {\n if (await Linking.canOpenURL(href)) {\n await Linking.openURL(href);\n }\n }\n };\n\n return (\n <ButtonBase\n disabled={disabled}\n onPress={handlePress}\n style={buttonBaseStyle}\n pressEffect={modifiedPressEffect}\n {...otherProps}\n >\n {startIcon}\n\n <Text\n children={children}\n style={textStyle}\n />\n\n {endIcon}\n </ButtonBase>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;;;;;AAMA,MAAMA,SAAoB,GAAG;EACzBC,KAAK,EAAE,EADkB;EAEzBC,MAAM,EAAE;AAFiB,CAA7B;;AAKA,MAAMC,MAAM,GAAGC,kBAAA,CAAWC,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACFC,aAAa,EAAE,KADb;IAEFC,cAAc,EAAE,QAFd;IAGFC,UAAU,EAAE;EAHV,CADuB;EAM7BC,SAAS,EAAE;IACPC,KAAK,EAAE;EADA,CANkB;EAS7BT,MAAM,EAAE;IACJU,QAAQ,EAAE,GADN;IAEJC,MAAM,EAAE;EAFJ,CATqB;EAa7BZ,KAAK,EAAE;IACHW,QAAQ,EAAE,EADP;IAEHC,MAAM,EAAE;EAFL;AAbsB,CAAlB,CAAf;;AAmBe,SAASC,MAAT,CAAgBC,KAAhB,EAAoC;EAC/C,MAAM;IACFC,QADE;IAEFC,qBAAqB,GAAG,KAFtB;IAGFC,KAAK,GAAG,SAHN;IAIFC,QAAQ,GAAG,KAJT;IAKFC,OAAO,EAAEC,WALP;IAMFX,SAAS,GAAG,KANV;IAOFY,IAPE;IAQFC,OARE;IASFC,WATE;IAUFC,IAAI,GAAG,QAVL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;EAMA,MAAMC,mBAAmB,GAAG1C,OAAO,KAAK,MAAZ,IAAsB,CAACN,WAAvB,GACtB,OADsB,GAEtBA,WAFN;;EAIA,MAAMiD,WAAW,GAAG,YAAY;IAC5B,IAAItD,QAAJ,EAAc;MACV;IACH;;IACD,IAAII,OAAJ,EAAa;MACTA,OAAO;MACP;IACH;;IACD,IAAID,IAAJ,EAAU;MACN,IAAI,MAAMoD,oBAAA,CAAQC,UAAR,CAAmBrD,IAAnB,CAAV,EAAoC;QAChC,MAAMoD,oBAAA,CAAQE,OAAR,CAAgBtD,IAAhB,CAAN;MACH;IACJ;EACJ,CAbD;;EAeA,oBACI,6BAAC,mBAAD;IACI,QAAQ,EAAEH,QADd;IAEI,OAAO,EAAEsD,WAFb;IAGI,KAAK,EAAEhB,eAHX;IAII,WAAW,EAAEe;EAJjB,GAKQzC,UALR,GAOKL,SAPL,eASI,6BAAC,iBAAD;IACI,QAAQ,EAAEV,QADd;IAEI,KAAK,EAAEsD;EAFX,EATJ,EAcKlD,OAdL,CADJ;AAkBH;;AAAA"}
@@ -6,19 +6,19 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.ORIGINAL_OPACITY = exports.DISABLED_OPACITY = void 0;
7
7
  exports.default = ButtonBase;
8
8
 
9
- var _react = _interopRequireDefault(require("react"));
9
+ var _react = _interopRequireWildcard(require("react"));
10
10
 
11
- var _reactNativeReanimated = require("react-native-reanimated");
11
+ var _reactNative = require("react-native");
12
12
 
13
13
  var _hooks = require("../hooks");
14
14
 
15
- var _animated = require("../animated");
15
+ var _utils = require("../utils");
16
16
 
17
- var _styles = require("../styles");
17
+ var _animated = require("../animated");
18
18
 
19
- var _useDisabledReaction = _interopRequireDefault(require("./useDisabledReaction"));
19
+ function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
20
20
 
21
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
22
22
 
23
23
  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); }
24
24
 
@@ -28,19 +28,21 @@ const DISABLED_OPACITY = .3;
28
28
  exports.DISABLED_OPACITY = DISABLED_OPACITY;
29
29
  const ACTIVE_OPACITY = .65;
30
30
  const ORIGINAL_SCALE = 1;
31
- const MINIFIED_SCALE = .96;
32
- const animationTimingConfig = {
33
- duration: 150
31
+ const MINIFIED_SCALE = .96; // at "node_modules/react-native/Libraries/Pressability.js"
32
+ // const DEFAULT_MIN_PRESS_DURATION = 130;
33
+
34
+ const SCALE_EFFECT_PRESS_IN_DELAY = 130;
35
+ const OPACITY_EFFECT_PRESS_IN_DELAY = 0;
36
+
37
+ const startTimingAnimationWithDefaults = (value, toValue) => {
38
+ _reactNative.Animated.timing(value, {
39
+ toValue,
40
+ duration: 150,
41
+ useNativeDriver: _utils.isNotAndroid12
42
+ }).start();
34
43
  };
35
44
 
36
- const styles = _styles.StyleSheet.create({
37
- disabled: {
38
- opacity: DISABLED_OPACITY,
39
- transform: [{
40
- scale: ORIGINAL_SCALE
41
- }]
42
- }
43
- });
45
+ const getOpacityByDisabled = disabled => disabled ? DISABLED_OPACITY : ORIGINAL_OPACITY;
44
46
 
45
47
  function ButtonBase(props) {
46
48
  const {
@@ -48,8 +50,10 @@ function ButtonBase(props) {
48
50
  disabled = false,
49
51
  disableThrottle = false,
50
52
  onPress,
53
+ onPressOut,
51
54
  pressEffect = 'opacity',
52
- style,
55
+ pressDelay: pressDelayOrNil,
56
+ style: styleProp,
53
57
  throttleMillis = 650,
54
58
  ...otherProps
55
59
  } = props;
@@ -57,51 +61,61 @@ function ButtonBase(props) {
57
61
  periodMillis: disableThrottle ? 0 : throttleMillis,
58
62
  callback: onPress
59
63
  });
60
- const opacity = (0, _reactNativeReanimated.useSharedValue)(ORIGINAL_OPACITY);
61
- const scale = (0, _reactNativeReanimated.useSharedValue)(ORIGINAL_SCALE);
62
- const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => ({
63
- opacity: opacity.value,
64
- transform: [{
65
- scale: scale.value
66
- }]
67
- }));
68
- (0, _useDisabledReaction.default)(disabled, opacity);
69
-
70
- const startAnimation = function (pressIn) {
71
- let isHovered = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
72
-
73
- if (pressEffect === 'none') {
74
- return;
64
+ const opacity = (0, _hooks.useAnimatedValue)(getOpacityByDisabled(disabled));
65
+ const scale = (0, _hooks.useAnimatedValue)(ORIGINAL_SCALE);
66
+ (0, _react.useEffect)(() => {
67
+ opacity.setValue(getOpacityByDisabled(disabled));
68
+ }, [disabled, pressEffect]);
69
+ const startScaleAnimation = (0, _react.useCallback)((pressIn, isHover) => {
70
+ if (!isHover) {
71
+ startTimingAnimationWithDefaults(scale, pressIn ? MINIFIED_SCALE : ORIGINAL_SCALE);
75
72
  }
76
-
77
- if (pressEffect === 'opacity') {
78
- if (pressIn) {
79
- opacity.value = ACTIVE_OPACITY;
80
- } else {
81
- opacity.value = (0, _reactNativeReanimated.withTiming)(ORIGINAL_OPACITY, animationTimingConfig);
82
- }
83
- } else if (!isHovered) {
84
- if (pressIn) {
85
- scale.value = (0, _reactNativeReanimated.withDelay)(100, (0, _reactNativeReanimated.withTiming)(MINIFIED_SCALE, animationTimingConfig));
86
- } else {
87
- scale.value = (0, _reactNativeReanimated.withTiming)(ORIGINAL_SCALE, animationTimingConfig);
88
- }
73
+ }, []);
74
+ const startOpacityAnimation = (0, _react.useCallback)(pressIn => {
75
+ if (pressIn) {
76
+ opacity.setValue(ACTIVE_OPACITY);
77
+ } else {
78
+ startTimingAnimationWithDefaults(opacity, ORIGINAL_OPACITY);
79
+ }
80
+ }, []);
81
+ const startPressAnimation = (0, _react.useCallback)(function (pressIn) {
82
+ let isHover = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;
83
+
84
+ if (pressEffect === 'scale') {
85
+ startScaleAnimation(pressIn, isHover);
86
+ } else if (pressEffect === 'opacity') {
87
+ startOpacityAnimation(pressIn, isHover);
89
88
  }
89
+ }, [pressEffect]);
90
+ const handlePressIn = (0, _react.useCallback)(() => {
91
+ startPressAnimation(true, false);
92
+ }, [startPressAnimation]);
93
+ const handlePressOut = (0, _react.useCallback)(() => {
94
+ onPressOut && onPressOut();
95
+ startPressAnimation(false, false);
96
+ }, [startPressAnimation, onPressOut]);
97
+ const animatedStyle = {
98
+ opacity,
99
+ transform: [{
100
+ scale
101
+ }]
90
102
  };
91
-
103
+ const defaultPressDelay = pressEffect === 'scale' ? SCALE_EFFECT_PRESS_IN_DELAY : OPACITY_EFFECT_PRESS_IN_DELAY;
104
+ const pressDelay = pressDelayOrNil ?? defaultPressDelay;
92
105
  return /*#__PURE__*/_react.default.createElement(_animated.AnimatedPressable, _extends({
93
106
  disabled: disabled,
94
107
  onPress: handlePress,
95
- onPressIn: () => startAnimation(true),
96
- onPressOut: () => startAnimation(false),
97
- style: [animatedStyle, disabled ? styles.disabled : undefined, style]
108
+ onPressIn: handlePressIn,
109
+ onPressOut: handlePressOut,
110
+ style: [animatedStyle, styleProp],
111
+ unstable_pressDelay: pressDelay
98
112
  }, otherProps), typeof children !== 'function' ? _ref => {
99
113
  let {
100
114
  hovered
101
115
  } = _ref;
102
116
 
103
117
  if (hovered !== undefined && !disabled) {
104
- startAnimation(hovered, true);
118
+ startPressAnimation(hovered, true);
105
119
  }
106
120
 
107
121
  return children;