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

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 (378) hide show
  1. package/build/commonjs/Button/Button.js +51 -63
  2. package/build/commonjs/Button/Button.js.map +1 -1
  3. package/build/commonjs/Button/ButtonProps.js +11 -0
  4. package/build/commonjs/Button/ButtonProps.js.map +1 -1
  5. package/build/commonjs/Button/LegacyButton.js +144 -0
  6. package/build/commonjs/Button/LegacyButton.js.map +1 -0
  7. package/build/commonjs/Button/LegacyButtonProps.js +2 -0
  8. package/build/commonjs/Button/LegacyButtonProps.js.map +1 -0
  9. package/build/commonjs/Button/index.js +2 -2
  10. package/build/commonjs/Button/index.js.map +1 -1
  11. package/build/commonjs/Button/useVariantStyleMap.js +95 -0
  12. package/build/commonjs/Button/useVariantStyleMap.js.map +1 -0
  13. package/build/commonjs/ButtonSet/ButtonSet.js +54 -0
  14. package/build/commonjs/ButtonSet/ButtonSet.js.map +1 -0
  15. package/build/commonjs/ButtonSet/ButtonSetProps.js +11 -0
  16. package/build/commonjs/ButtonSet/ButtonSetProps.js.map +1 -0
  17. package/build/commonjs/ButtonSet/index.js +30 -0
  18. package/build/commonjs/ButtonSet/index.js.map +1 -0
  19. package/build/commonjs/ButtonSet/useVariantStyleMap.js +85 -0
  20. package/build/commonjs/ButtonSet/useVariantStyleMap.js.map +1 -0
  21. package/build/commonjs/Checkbox/Checkbox.js +33 -23
  22. package/build/commonjs/Checkbox/Checkbox.js.map +1 -1
  23. package/build/commonjs/Checkbox/CheckboxProps.js +7 -0
  24. package/build/commonjs/Checkbox/CheckboxProps.js.map +1 -1
  25. package/build/commonjs/Checkbox/LegacyCheckbox.js +65 -0
  26. package/build/commonjs/Checkbox/LegacyCheckbox.js.map +1 -0
  27. package/build/commonjs/Checkbox/LegacyCheckboxProps.js +2 -0
  28. package/build/commonjs/Checkbox/LegacyCheckboxProps.js.map +1 -0
  29. package/build/commonjs/Checkbox/index.js +2 -2
  30. package/build/commonjs/Checkbox/index.js.map +1 -1
  31. package/build/commonjs/Checkbox/useVariantStyleMap.js +70 -0
  32. package/build/commonjs/Checkbox/useVariantStyleMap.js.map +1 -0
  33. package/build/commonjs/CheckboxGroup/CheckboxGroup.js +50 -0
  34. package/build/commonjs/CheckboxGroup/CheckboxGroup.js.map +1 -0
  35. package/build/commonjs/CheckboxGroup/CheckboxGroupProps.js +2 -0
  36. package/build/commonjs/CheckboxGroup/CheckboxGroupProps.js.map +1 -0
  37. package/build/commonjs/CheckboxGroup/index.js +16 -0
  38. package/build/commonjs/CheckboxGroup/index.js.map +1 -0
  39. package/build/commonjs/Divider/Divider.js +16 -4
  40. package/build/commonjs/Divider/Divider.js.map +1 -1
  41. package/build/commonjs/Divider/DividerProps.js +9 -0
  42. package/build/commonjs/Divider/DividerProps.js.map +1 -1
  43. package/build/commonjs/Divider/LegacyDivider.js +114 -0
  44. package/build/commonjs/Divider/LegacyDivider.js.map +1 -0
  45. package/build/commonjs/Divider/LegacyDividerProps.js +2 -0
  46. package/build/commonjs/Divider/LegacyDividerProps.js.map +1 -0
  47. package/build/commonjs/Divider/index.js +2 -2
  48. package/build/commonjs/Divider/index.js.map +1 -1
  49. package/build/commonjs/IconButton/IconButton.js +39 -42
  50. package/build/commonjs/IconButton/IconButton.js.map +1 -1
  51. package/build/commonjs/IconButton/IconButtonProps.js +7 -0
  52. package/build/commonjs/IconButton/IconButtonProps.js.map +1 -1
  53. package/build/commonjs/IconButton/LegacyIconButton.js +88 -0
  54. package/build/commonjs/IconButton/LegacyIconButton.js.map +1 -0
  55. package/build/commonjs/IconButton/LegacyIconButtonProps.js +2 -0
  56. package/build/commonjs/IconButton/LegacyIconButtonProps.js.map +1 -0
  57. package/build/commonjs/IconButton/index.js +2 -2
  58. package/build/commonjs/IconButton/index.js.map +1 -1
  59. package/build/commonjs/Modal/index.js +0 -10
  60. package/build/commonjs/Modal/index.js.map +1 -1
  61. package/build/commonjs/Radio/LegacyRadio.js +82 -0
  62. package/build/commonjs/Radio/LegacyRadio.js.map +1 -0
  63. package/build/commonjs/Radio/LegacyRadioProps.js +2 -0
  64. package/build/commonjs/Radio/LegacyRadioProps.js.map +1 -0
  65. package/build/commonjs/Radio/Radio.js +40 -19
  66. package/build/commonjs/Radio/Radio.js.map +1 -1
  67. package/build/commonjs/Radio/RadioProps.js.map +1 -1
  68. package/build/commonjs/Radio/index.js +2 -2
  69. package/build/commonjs/Radio/index.js.map +1 -1
  70. package/build/commonjs/RadioGroup/LegacyRadioGroup.js +31 -0
  71. package/build/commonjs/RadioGroup/LegacyRadioGroup.js.map +1 -0
  72. package/build/commonjs/RadioGroup/RadioGroup.js +28 -2
  73. package/build/commonjs/RadioGroup/RadioGroup.js.map +1 -1
  74. package/build/commonjs/RadioGroup/index.js +2 -2
  75. package/build/commonjs/RadioGroup/index.js.map +1 -1
  76. package/build/commonjs/ShadowView/ShadowView.js +35 -0
  77. package/build/commonjs/ShadowView/ShadowView.js.map +1 -0
  78. package/build/commonjs/ShadowView/ShadowView.native.js +35 -0
  79. package/build/commonjs/ShadowView/ShadowView.native.js.map +1 -0
  80. package/build/commonjs/ShadowView/ShadowViewProps.js +2 -0
  81. package/build/commonjs/ShadowView/ShadowViewProps.js.map +1 -0
  82. package/build/commonjs/ShadowView/index.js +16 -0
  83. package/build/commonjs/ShadowView/index.js.map +1 -0
  84. package/build/commonjs/SvgIcon/LegacySvgIcon.js +43 -0
  85. package/build/commonjs/SvgIcon/LegacySvgIcon.js.map +1 -0
  86. package/build/commonjs/SvgIcon/LegacySvgIconProps.js +2 -0
  87. package/build/commonjs/SvgIcon/LegacySvgIconProps.js.map +1 -0
  88. package/build/commonjs/SvgIcon/SvgIcon.js +16 -4
  89. package/build/commonjs/SvgIcon/SvgIcon.js.map +1 -1
  90. package/build/commonjs/SvgIcon/SvgIconProps.js +15 -0
  91. package/build/commonjs/SvgIcon/SvgIconProps.js.map +1 -1
  92. package/build/commonjs/SvgIcon/index.js +2 -2
  93. package/build/commonjs/SvgIcon/index.js.map +1 -1
  94. package/build/commonjs/Toggle/Toggle.js +110 -0
  95. package/build/commonjs/Toggle/Toggle.js.map +1 -0
  96. package/build/commonjs/Toggle/ToggleProps.js +2 -0
  97. package/build/commonjs/Toggle/ToggleProps.js.map +1 -0
  98. package/build/commonjs/Toggle/index.js +16 -0
  99. package/build/commonjs/Toggle/index.js.map +1 -0
  100. package/build/commonjs/Typography/LegacyTypography.js +142 -0
  101. package/build/commonjs/Typography/LegacyTypography.js.map +1 -0
  102. package/build/commonjs/Typography/LegacyTypographyProps.js +2 -0
  103. package/build/commonjs/Typography/LegacyTypographyProps.js.map +1 -0
  104. package/build/commonjs/Typography/Typography.js +15 -54
  105. package/build/commonjs/Typography/Typography.js.map +1 -1
  106. package/build/commonjs/Typography/TypographyProps.js +7 -0
  107. package/build/commonjs/Typography/TypographyProps.js.map +1 -1
  108. package/build/commonjs/Typography/index.js +2 -2
  109. package/build/commonjs/Typography/index.js.map +1 -1
  110. package/build/commonjs/hooks/useCollapsibleAppBar.js +11 -2
  111. package/build/commonjs/hooks/useCollapsibleAppBar.js.map +1 -1
  112. package/build/commonjs/index.js +80 -3
  113. package/build/commonjs/index.js.map +1 -1
  114. package/build/commonjs/internal/icons/Check.js +23 -0
  115. package/build/commonjs/internal/icons/Check.js.map +1 -0
  116. package/build/commonjs/internal/icons/CheckboxOn.js +23 -0
  117. package/build/commonjs/internal/icons/CheckboxOn.js.map +1 -0
  118. package/build/commonjs/internal/icons/index.js +16 -0
  119. package/build/commonjs/internal/icons/index.js.map +1 -1
  120. package/build/commonjs/styles/createFontStyle.js.map +1 -1
  121. package/build/commonjs/utils/cloneElementSafely.js.map +1 -1
  122. package/build/commonjs/utils/createSvgIcon.js +15 -3
  123. package/build/commonjs/utils/createSvgIcon.js.map +1 -1
  124. package/build/commonjs/utils/index.js.map +1 -1
  125. package/build/module/Button/Button.js +53 -63
  126. package/build/module/Button/Button.js.map +1 -1
  127. package/build/module/Button/ButtonProps.js +3 -1
  128. package/build/module/Button/ButtonProps.js.map +1 -1
  129. package/build/module/Button/LegacyButton.js +127 -0
  130. package/build/module/Button/LegacyButton.js.map +1 -0
  131. package/build/module/Button/LegacyButtonProps.js +2 -0
  132. package/build/module/Button/LegacyButtonProps.js.map +1 -0
  133. package/build/module/Button/index.js +1 -1
  134. package/build/module/Button/index.js.map +1 -1
  135. package/build/module/Button/useVariantStyleMap.js +85 -0
  136. package/build/module/Button/useVariantStyleMap.js.map +1 -0
  137. package/build/module/ButtonSet/ButtonSet.js +34 -0
  138. package/build/module/ButtonSet/ButtonSet.js.map +1 -0
  139. package/build/module/ButtonSet/ButtonSetProps.js +3 -0
  140. package/build/module/ButtonSet/ButtonSetProps.js.map +1 -0
  141. package/build/module/ButtonSet/index.js +3 -0
  142. package/build/module/ButtonSet/index.js.map +1 -0
  143. package/build/module/ButtonSet/useVariantStyleMap.js +76 -0
  144. package/build/module/ButtonSet/useVariantStyleMap.js.map +1 -0
  145. package/build/module/Checkbox/Checkbox.js +32 -26
  146. package/build/module/Checkbox/Checkbox.js.map +1 -1
  147. package/build/module/Checkbox/CheckboxProps.js +1 -1
  148. package/build/module/Checkbox/CheckboxProps.js.map +1 -1
  149. package/build/module/Checkbox/LegacyCheckbox.js +52 -0
  150. package/build/module/Checkbox/LegacyCheckbox.js.map +1 -0
  151. package/build/module/Checkbox/LegacyCheckboxProps.js +2 -0
  152. package/build/module/Checkbox/LegacyCheckboxProps.js.map +1 -0
  153. package/build/module/Checkbox/index.js +1 -1
  154. package/build/module/Checkbox/index.js.map +1 -1
  155. package/build/module/Checkbox/useVariantStyleMap.js +59 -0
  156. package/build/module/Checkbox/useVariantStyleMap.js.map +1 -0
  157. package/build/module/CheckboxGroup/CheckboxGroup.js +34 -0
  158. package/build/module/CheckboxGroup/CheckboxGroup.js.map +1 -0
  159. package/build/module/CheckboxGroup/CheckboxGroupProps.js +2 -0
  160. package/build/module/CheckboxGroup/CheckboxGroupProps.js.map +1 -0
  161. package/build/module/CheckboxGroup/index.js +2 -0
  162. package/build/module/CheckboxGroup/index.js.map +1 -0
  163. package/build/module/Divider/Divider.js +17 -4
  164. package/build/module/Divider/Divider.js.map +1 -1
  165. package/build/module/Divider/DividerProps.js +2 -1
  166. package/build/module/Divider/DividerProps.js.map +1 -1
  167. package/build/module/Divider/LegacyDivider.js +100 -0
  168. package/build/module/Divider/LegacyDivider.js.map +1 -0
  169. package/build/module/Divider/LegacyDividerProps.js +2 -0
  170. package/build/module/Divider/LegacyDividerProps.js.map +1 -0
  171. package/build/module/Divider/index.js +1 -1
  172. package/build/module/Divider/index.js.map +1 -1
  173. package/build/module/IconButton/IconButton.js +36 -40
  174. package/build/module/IconButton/IconButton.js.map +1 -1
  175. package/build/module/IconButton/IconButtonProps.js +1 -1
  176. package/build/module/IconButton/IconButtonProps.js.map +1 -1
  177. package/build/module/IconButton/LegacyIconButton.js +73 -0
  178. package/build/module/IconButton/LegacyIconButton.js.map +1 -0
  179. package/build/module/IconButton/LegacyIconButtonProps.js +2 -0
  180. package/build/module/IconButton/LegacyIconButtonProps.js.map +1 -0
  181. package/build/module/IconButton/index.js +1 -1
  182. package/build/module/IconButton/index.js.map +1 -1
  183. package/build/module/Modal/index.js +0 -1
  184. package/build/module/Modal/index.js.map +1 -1
  185. package/build/module/Radio/LegacyRadio.js +63 -0
  186. package/build/module/Radio/LegacyRadio.js.map +1 -0
  187. package/build/module/Radio/LegacyRadioProps.js +2 -0
  188. package/build/module/Radio/LegacyRadioProps.js.map +1 -0
  189. package/build/module/Radio/Radio.js +35 -18
  190. package/build/module/Radio/Radio.js.map +1 -1
  191. package/build/module/Radio/RadioProps.js.map +1 -1
  192. package/build/module/Radio/index.js +1 -1
  193. package/build/module/Radio/index.js.map +1 -1
  194. package/build/module/RadioGroup/LegacyRadioGroup.js +18 -0
  195. package/build/module/RadioGroup/LegacyRadioGroup.js.map +1 -0
  196. package/build/module/RadioGroup/RadioGroup.js +21 -2
  197. package/build/module/RadioGroup/RadioGroup.js.map +1 -1
  198. package/build/module/RadioGroup/index.js +1 -1
  199. package/build/module/RadioGroup/index.js.map +1 -1
  200. package/build/module/ShadowView/ShadowView.js +23 -0
  201. package/build/module/ShadowView/ShadowView.js.map +1 -0
  202. package/build/module/ShadowView/ShadowView.native.js +23 -0
  203. package/build/module/ShadowView/ShadowView.native.js.map +1 -0
  204. package/build/module/ShadowView/ShadowViewProps.js +2 -0
  205. package/build/module/ShadowView/ShadowViewProps.js.map +1 -0
  206. package/build/module/ShadowView/index.js +2 -0
  207. package/build/module/ShadowView/index.js.map +1 -0
  208. package/build/module/SvgIcon/LegacySvgIcon.js +30 -0
  209. package/build/module/SvgIcon/LegacySvgIcon.js.map +1 -0
  210. package/build/module/SvgIcon/LegacySvgIconProps.js +2 -0
  211. package/build/module/SvgIcon/LegacySvgIconProps.js.map +1 -0
  212. package/build/module/SvgIcon/SvgIcon.js +15 -4
  213. package/build/module/SvgIcon/SvgIcon.js.map +1 -1
  214. package/build/module/SvgIcon/SvgIconProps.js +7 -1
  215. package/build/module/SvgIcon/SvgIconProps.js.map +1 -1
  216. package/build/module/SvgIcon/index.js +1 -1
  217. package/build/module/SvgIcon/index.js.map +1 -1
  218. package/build/module/Toggle/Toggle.js +90 -0
  219. package/build/module/Toggle/Toggle.js.map +1 -0
  220. package/build/module/Toggle/ToggleProps.js +2 -0
  221. package/build/module/Toggle/ToggleProps.js.map +1 -0
  222. package/build/module/Toggle/index.js +2 -0
  223. package/build/module/Toggle/index.js.map +1 -0
  224. package/build/module/Typography/LegacyTypography.js +126 -0
  225. package/build/module/Typography/LegacyTypography.js.map +1 -0
  226. package/build/module/Typography/LegacyTypographyProps.js +2 -0
  227. package/build/module/Typography/LegacyTypographyProps.js.map +1 -0
  228. package/build/module/Typography/Typography.js +15 -54
  229. package/build/module/Typography/Typography.js.map +1 -1
  230. package/build/module/Typography/TypographyProps.js +1 -1
  231. package/build/module/Typography/TypographyProps.js.map +1 -1
  232. package/build/module/Typography/index.js +1 -1
  233. package/build/module/Typography/index.js.map +1 -1
  234. package/build/module/hooks/useCollapsibleAppBar.js +12 -3
  235. package/build/module/hooks/useCollapsibleAppBar.js.map +1 -1
  236. package/build/module/index.js +9 -1
  237. package/build/module/index.js.map +1 -1
  238. package/build/module/internal/icons/Check.js +9 -0
  239. package/build/module/internal/icons/Check.js.map +1 -0
  240. package/build/module/internal/icons/CheckboxOn.js +9 -0
  241. package/build/module/internal/icons/CheckboxOn.js.map +1 -0
  242. package/build/module/internal/icons/index.js +2 -0
  243. package/build/module/internal/icons/index.js.map +1 -1
  244. package/build/module/styles/createFontStyle.js.map +1 -1
  245. package/build/module/utils/cloneElementSafely.js.map +1 -1
  246. package/build/module/utils/createSvgIcon.js +14 -3
  247. package/build/module/utils/createSvgIcon.js.map +1 -1
  248. package/build/module/utils/index.js.map +1 -1
  249. package/build/typescript/Button/ButtonProps.d.ts +13 -11
  250. package/build/typescript/Button/LegacyButton.d.ts +3 -0
  251. package/build/typescript/Button/LegacyButtonProps.d.ts +51 -0
  252. package/build/typescript/Button/index.d.ts +2 -2
  253. package/build/typescript/Button/useVariantStyleMap.d.ts +9 -0
  254. package/build/typescript/ButtonSet/ButtonSet.d.ts +3 -0
  255. package/build/typescript/ButtonSet/ButtonSetProps.d.ts +20 -0
  256. package/build/typescript/ButtonSet/index.d.ts +3 -0
  257. package/build/typescript/ButtonSet/useVariantStyleMap.d.ts +10 -0
  258. package/build/typescript/Checkbox/CheckboxProps.d.ts +10 -14
  259. package/build/typescript/Checkbox/LegacyCheckbox.d.ts +3 -0
  260. package/build/typescript/Checkbox/LegacyCheckboxProps.d.ts +36 -0
  261. package/build/typescript/Checkbox/index.d.ts +2 -2
  262. package/build/typescript/Checkbox/useVariantStyleMap.d.ts +9 -0
  263. package/build/typescript/CheckboxGroup/CheckboxGroup.d.ts +3 -0
  264. package/build/typescript/CheckboxGroup/CheckboxGroupProps.d.ts +11 -0
  265. package/build/typescript/CheckboxGroup/index.d.ts +2 -0
  266. package/build/typescript/Divider/DividerProps.d.ts +12 -9
  267. package/build/typescript/Divider/LegacyDivider.d.ts +3 -0
  268. package/build/typescript/Divider/LegacyDividerProps.d.ts +41 -0
  269. package/build/typescript/Divider/index.d.ts +2 -2
  270. package/build/typescript/IconButton/IconButtonProps.d.ts +7 -10
  271. package/build/typescript/IconButton/LegacyIconButton.d.ts +3 -0
  272. package/build/typescript/IconButton/LegacyIconButtonProps.d.ts +26 -0
  273. package/build/typescript/IconButton/index.d.ts +2 -2
  274. package/build/typescript/Modal/index.d.ts +0 -2
  275. package/build/typescript/Radio/LegacyRadio.d.ts +3 -0
  276. package/build/typescript/Radio/LegacyRadioProps.d.ts +43 -0
  277. package/build/typescript/Radio/RadioProps.d.ts +9 -14
  278. package/build/typescript/Radio/index.d.ts +2 -2
  279. package/build/typescript/RadioGroup/LegacyRadioGroup.d.ts +3 -0
  280. package/build/typescript/RadioGroup/index.d.ts +1 -1
  281. package/build/typescript/ShadowView/ShadowView.d.ts +3 -0
  282. package/build/typescript/ShadowView/ShadowView.native.d.ts +3 -0
  283. package/build/typescript/ShadowView/ShadowViewProps.d.ts +11 -0
  284. package/build/typescript/ShadowView/index.d.ts +2 -0
  285. package/build/typescript/SvgIcon/LegacySvgIcon.d.ts +3 -0
  286. package/build/typescript/SvgIcon/LegacySvgIconProps.d.ts +35 -0
  287. package/build/typescript/SvgIcon/SvgIconProps.d.ts +17 -6
  288. package/build/typescript/SvgIcon/index.d.ts +2 -2
  289. package/build/typescript/Toggle/Toggle.d.ts +3 -0
  290. package/build/typescript/Toggle/ToggleProps.d.ts +19 -0
  291. package/build/typescript/Toggle/index.d.ts +2 -0
  292. package/build/typescript/Typography/LegacyTypography.d.ts +5 -0
  293. package/build/typescript/Typography/LegacyTypographyProps.d.ts +81 -0
  294. package/build/typescript/Typography/Typography.d.ts +1 -1
  295. package/build/typescript/Typography/TypographyProps.d.ts +12 -9
  296. package/build/typescript/Typography/index.d.ts +2 -2
  297. package/build/typescript/hooks/useCollapsibleAppBar.d.ts +1 -0
  298. package/build/typescript/index.d.ts +10 -2
  299. package/build/typescript/internal/icons/Check.d.ts +8 -0
  300. package/build/typescript/internal/icons/Checkbox.d.ts +2 -124
  301. package/build/typescript/internal/icons/CheckboxChecked.d.ts +2 -124
  302. package/build/typescript/internal/icons/CheckboxOn.d.ts +8 -0
  303. package/build/typescript/internal/icons/ChevronDown.d.ts +2 -124
  304. package/build/typescript/internal/icons/ChevronLeft.d.ts +2 -124
  305. package/build/typescript/internal/icons/ChevronRight.d.ts +2 -124
  306. package/build/typescript/internal/icons/Close.d.ts +2 -124
  307. package/build/typescript/internal/icons/Radio.d.ts +2 -124
  308. package/build/typescript/internal/icons/RadioChecked.d.ts +2 -124
  309. package/build/typescript/internal/icons/index.d.ts +2 -0
  310. package/build/typescript/styles/createFontStyle.d.ts +1 -1
  311. package/build/typescript/utils/cloneElementSafely.d.ts +1 -2
  312. package/build/typescript/utils/createSvgIcon.d.ts +8 -3
  313. package/build/typescript/utils/index.d.ts +1 -0
  314. package/package.json +2 -2
  315. package/src/Button/Button.tsx +53 -71
  316. package/src/Button/ButtonProps.ts +29 -12
  317. package/src/Button/LegacyButton.tsx +157 -0
  318. package/src/Button/LegacyButtonProps.ts +62 -0
  319. package/src/Button/index.ts +2 -2
  320. package/src/Button/useVariantStyleMap.ts +99 -0
  321. package/src/ButtonSet/ButtonSet.tsx +43 -0
  322. package/src/ButtonSet/ButtonSetProps.ts +27 -0
  323. package/src/ButtonSet/index.ts +3 -0
  324. package/src/ButtonSet/useVariantStyleMap.ts +84 -0
  325. package/src/Checkbox/Checkbox.tsx +48 -33
  326. package/src/Checkbox/CheckboxProps.ts +10 -15
  327. package/src/Checkbox/LegacyCheckbox.tsx +62 -0
  328. package/src/Checkbox/LegacyCheckboxProps.ts +42 -0
  329. package/src/Checkbox/index.ts +2 -2
  330. package/src/Checkbox/useVariantStyleMap.ts +71 -0
  331. package/src/CheckboxGroup/CheckboxGroup.tsx +47 -0
  332. package/src/CheckboxGroup/CheckboxGroupProps.ts +11 -0
  333. package/src/CheckboxGroup/index.ts +2 -0
  334. package/src/Divider/Divider.tsx +17 -8
  335. package/src/Divider/DividerProps.ts +14 -10
  336. package/src/Divider/LegacyDivider.tsx +114 -0
  337. package/src/Divider/LegacyDividerProps.ts +48 -0
  338. package/src/Divider/index.ts +2 -2
  339. package/src/IconButton/IconButton.tsx +36 -54
  340. package/src/IconButton/IconButtonProps.ts +12 -12
  341. package/src/IconButton/LegacyIconButton.tsx +96 -0
  342. package/src/IconButton/LegacyIconButtonProps.ts +31 -0
  343. package/src/IconButton/index.ts +2 -2
  344. package/src/Modal/index.ts +0 -2
  345. package/src/Radio/LegacyRadio.tsx +72 -0
  346. package/src/Radio/LegacyRadioProps.ts +50 -0
  347. package/src/Radio/Radio.tsx +47 -16
  348. package/src/Radio/RadioProps.ts +10 -16
  349. package/src/Radio/index.ts +2 -2
  350. package/src/RadioGroup/LegacyRadioGroup.tsx +20 -0
  351. package/src/RadioGroup/RadioGroup.tsx +31 -4
  352. package/src/RadioGroup/index.ts +2 -2
  353. package/src/ShadowView/ShadowView.native.tsx +37 -0
  354. package/src/ShadowView/ShadowView.tsx +33 -0
  355. package/src/ShadowView/ShadowViewProps.ts +11 -0
  356. package/src/ShadowView/index.ts +2 -0
  357. package/src/SvgIcon/LegacySvgIcon.tsx +36 -0
  358. package/src/SvgIcon/LegacySvgIconProps.ts +41 -0
  359. package/src/SvgIcon/SvgIcon.tsx +19 -5
  360. package/src/SvgIcon/SvgIconProps.ts +33 -6
  361. package/src/SvgIcon/index.ts +2 -2
  362. package/src/Toggle/Toggle.tsx +113 -0
  363. package/src/Toggle/ToggleProps.ts +21 -0
  364. package/src/Toggle/index.ts +2 -0
  365. package/src/Typography/LegacyTypography.tsx +107 -0
  366. package/src/Typography/LegacyTypographyProps.ts +122 -0
  367. package/src/Typography/Typography.tsx +24 -30
  368. package/src/Typography/TypographyProps.ts +29 -34
  369. package/src/Typography/index.ts +2 -2
  370. package/src/hooks/useCollapsibleAppBar.ts +12 -2
  371. package/src/index.ts +14 -2
  372. package/src/internal/icons/Check.tsx +13 -0
  373. package/src/internal/icons/CheckboxOn.tsx +13 -0
  374. package/src/internal/icons/index.ts +2 -0
  375. package/src/styles/createFontStyle.ts +1 -1
  376. package/src/utils/cloneElementSafely.ts +1 -1
  377. package/src/utils/createSvgIcon.tsx +29 -6
  378. package/src/utils/index.ts +1 -0
@@ -0,0 +1,110 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = Toggle;
7
+
8
+ var _react = _interopRequireWildcard(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _styles = require("@fountain-ui/styles");
13
+
14
+ var _ButtonBase = _interopRequireDefault(require("../ButtonBase"));
15
+
16
+ var _ShadowView = _interopRequireDefault(require("../ShadowView"));
17
+
18
+ var _styles2 = require("../styles");
19
+
20
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
+
22
+ 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); }
23
+
24
+ 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; }
25
+
26
+ 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); }
27
+
28
+ const useStyles = function () {
29
+ const theme = (0, _styles2.useTheme)();
30
+ return {
31
+ root: {
32
+ borderRadius: theme.shape.radius.full,
33
+ justifyContent: 'center'
34
+ },
35
+ toggle: {
36
+ backgroundColor: _styles.commonColors.static.strongInverse,
37
+ borderRadius: theme.shape.radius.full
38
+ }
39
+ };
40
+ };
41
+
42
+ const sizeMap = {
43
+ medium: {
44
+ containerHeight: 24,
45
+ containerWidth: 42,
46
+ paddingHorizontal: 3,
47
+ toggleSize: 18
48
+ }
49
+ };
50
+
51
+ function Toggle(props) {
52
+ const {
53
+ checked = false,
54
+ onChange,
55
+ style: styleProp,
56
+ ...otherProps
57
+ } = props;
58
+ const styles = useStyles();
59
+ const theme = (0, _styles2.useTheme)();
60
+ const animation = (0, _react.useRef)(new _reactNative.Animated.Value(checked ? 1 : 0)).current;
61
+ const {
62
+ containerHeight,
63
+ containerWidth,
64
+ paddingHorizontal,
65
+ toggleSize
66
+ } = sizeMap['medium'];
67
+ (0, _react.useEffect)(() => {
68
+ _reactNative.Animated.timing(animation, {
69
+ toValue: checked ? 1 : 0,
70
+ duration: 150,
71
+ useNativeDriver: false
72
+ }).start();
73
+ }, [checked]);
74
+ const translateX = animation.interpolate({
75
+ inputRange: [0, 1],
76
+ outputRange: [paddingHorizontal, containerWidth - toggleSize - paddingHorizontal]
77
+ });
78
+ const containerStyle = (0, _styles2.css)([styles.root, {
79
+ backgroundColor: checked ? theme.palette.fill.accent : theme.palette.fill.weak,
80
+ height: containerHeight,
81
+ width: containerWidth
82
+ }, styleProp]);
83
+ const toggleStyle = (0, _styles2.css)([styles.toggle, {
84
+ height: toggleSize,
85
+ width: toggleSize
86
+ }]);
87
+ const animatedStyle = {
88
+ transform: [{
89
+ translateX: translateX
90
+ }]
91
+ };
92
+
93
+ const handlePress = () => {
94
+ onChange === null || onChange === void 0 ? void 0 : onChange(!checked);
95
+ };
96
+
97
+ return /*#__PURE__*/_react.default.createElement(_ButtonBase.default, _extends({}, otherProps, {
98
+ pressEffect: 'none',
99
+ onPress: handlePress,
100
+ style: containerStyle
101
+ }), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
102
+ style: animatedStyle
103
+ }, /*#__PURE__*/_react.default.createElement(_ShadowView.default, {
104
+ style: toggleStyle,
105
+ variant: 400
106
+ })));
107
+ }
108
+
109
+ ;
110
+ //# sourceMappingURL=Toggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useStyles","theme","useTheme","root","borderRadius","shape","radius","full","justifyContent","toggle","backgroundColor","commonColors","static","strongInverse","sizeMap","medium","containerHeight","containerWidth","paddingHorizontal","toggleSize","Toggle","props","checked","onChange","style","styleProp","otherProps","styles","animation","useRef","Animated","Value","current","useEffect","timing","toValue","duration","useNativeDriver","start","translateX","interpolate","inputRange","outputRange","containerStyle","css","palette","fill","accent","weak","height","width","toggleStyle","animatedStyle","transform","handlePress"],"sources":["Toggle.tsx"],"sourcesContent":["import React, { useRef, useEffect } from 'react';\nimport { Animated } from 'react-native';\nimport { commonColors, NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport ButtonBase from '../ButtonBase';\nimport ShadowView from '../ShadowView';\nimport { css, useTheme } from '../styles';\nimport { ExtendedStyle } from '../types';\nimport type ToggleProps from './ToggleProps';\n\ntype ToggleStyles = NamedStylesStringUnion<'root' | 'toggle'>;\n\nconst useStyles: UseStyles<ToggleStyles> = function (): ToggleStyles {\n const theme = useTheme();\n\n return {\n root: {\n borderRadius: theme.shape.radius.full,\n justifyContent: 'center',\n },\n toggle: {\n backgroundColor: commonColors.static.strongInverse,\n borderRadius: theme.shape.radius.full,\n },\n };\n};\n\nconst sizeMap = {\n medium: {\n containerHeight: 24,\n containerWidth: 42,\n paddingHorizontal: 3,\n toggleSize: 18,\n },\n};\n\nexport default function Toggle(props: ToggleProps) {\n const {\n checked = false,\n onChange,\n style: styleProp,\n ...otherProps\n } = props;\n\n const styles = useStyles();\n\n const theme = useTheme();\n\n const animation = useRef(new Animated.Value(checked ? 1 : 0)).current;\n\n const {\n containerHeight,\n containerWidth,\n paddingHorizontal,\n toggleSize,\n } = sizeMap['medium'];\n\n useEffect(() => {\n Animated.timing(animation, {\n toValue: checked ? 1 : 0,\n duration: 150,\n useNativeDriver: false,\n }).start();\n }, [checked]);\n\n const translateX = animation.interpolate({\n inputRange: [0, 1],\n outputRange: [paddingHorizontal, containerWidth - toggleSize - paddingHorizontal],\n });\n\n const containerStyle = css([\n styles.root,\n {\n backgroundColor: checked\n ? theme.palette.fill.accent\n : theme.palette.fill.weak,\n height: containerHeight,\n width: containerWidth,\n },\n styleProp,\n ]);\n\n const toggleStyle = css([\n styles.toggle,\n {\n height: toggleSize,\n width: toggleSize,\n },\n ]);\n\n const animatedStyle = {\n transform: [{ translateX: translateX as unknown }],\n } as ExtendedStyle;\n\n const handlePress = () => {\n onChange?.(!checked);\n };\n\n return (\n <ButtonBase\n {...otherProps}\n pressEffect={'none'}\n onPress={handlePress}\n style={containerStyle}\n >\n <Animated.View style={animatedStyle}>\n <ShadowView\n style={toggleStyle}\n variant={400}\n />\n </Animated.View>\n </ButtonBase>\n );\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AACA;;;;;;;;;;AAMA,MAAMA,SAAkC,GAAG,YAA0B;EACjE,MAAMC,KAAK,GAAG,IAAAC,iBAAA,GAAd;EAEA,OAAO;IACHC,IAAI,EAAE;MACFC,YAAY,EAAEH,KAAK,CAACI,KAAN,CAAYC,MAAZ,CAAmBC,IAD/B;MAEFC,cAAc,EAAE;IAFd,CADH;IAKHC,MAAM,EAAE;MACJC,eAAe,EAAEC,oBAAA,CAAaC,MAAb,CAAoBC,aADjC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B,EAEvB;IACIO,eAAe,EAAEY,OAAO,GAClBrB,KAAK,CAAC4C,OAAN,CAAcC,IAAd,CAAmBC,MADD,GAElB9C,KAAK,CAAC4C,OAAN,CAAcC,IAAd,CAAmBE,IAH7B;IAIIC,MAAM,EAAEjC,eAJZ;IAKIkC,KAAK,EAAEjC;EALX,CAFuB,EASvBQ,SATuB,CAAJ,CAAvB;EAYA,MAAM0B,WAAW,GAAG,IAAAP,YAAA,EAAI,CACpBjB,MAAM,CAAClB,MADa,EAEpB;IACIwC,MAAM,EAAE9B,UADZ;IAEI+B,KAAK,EAAE/B;EAFX,CAFoB,CAAJ,CAApB;EAQA,MAAMiC,aAAa,GAAG;IAClBC,SAAS,EAAE,CAAC;MAAEd,UAAU,EAAEA;IAAd,CAAD;EADO,CAAtB;;EAIA,MAAMe,WAAW,GAAG,MAAM;IACtB/B,QAAQ,SAAR,IAAAA,QAAQ,WAAR,YAAAA,QAAQ,CAAG,CAACD,OAAJ,CAAR;EACH,CAFD;;EAIA,oBACI,6BAAC,mBAAD,eACQI,UADR;IAEI,WAAW,EAAE,MAFjB;IAGI,OAAO,EAAE4B,WAHb;IAII,KAAK,EAAEX;EAJX,iBAMI,6BAAC,qBAAD,CAAU,IAAV;IAAe,KAAK,EAAES;EAAtB,gBACI,6BAAC,mBAAD;IACI,KAAK,EAAED,WADX;IAEI,OAAO,EAAE;EAFb,EADJ,CANJ,CADJ;AAeH;;AAAA"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=ToggleProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["ToggleProps.ts"],"sourcesContent":["import type { ButtonBaseProps } from '../ButtonBase';\nimport type { OverridableComponentProps } from '../types';\n\nexport default interface ToggleProps extends OverridableComponentProps<Omit<ButtonBaseProps, 'children'>, {\n /**\n * If `true`, the component is checked.\n * @default false\n */\n checked?: boolean;\n\n /**\n * If `true`, the switch is disabled.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Callback fired when the switch is changed.\n */\n onChange?: (newChecked: boolean) => void;\n}> {}\n"],"mappings":""}
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ Object.defineProperty(exports, "default", {
7
+ enumerable: true,
8
+ get: function () {
9
+ return _Toggle.default;
10
+ }
11
+ });
12
+
13
+ var _Toggle = _interopRequireDefault(require("./Toggle"));
14
+
15
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './Toggle';\nexport type { default as ToggleProps } from './ToggleProps';\n"],"mappings":";;;;;;;;;;;;AAAA"}
@@ -0,0 +1,142 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = _interopRequireDefault(require("react"));
9
+
10
+ var _reactNative = require("react-native");
11
+
12
+ var _styles = require("../styles");
13
+
14
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
+
16
+ const accessibilityMap = {
17
+ h1: {
18
+ accessibilityRole: 'header',
19
+ 'area-level': 1
20
+ },
21
+ h2: {
22
+ accessibilityRole: 'header',
23
+ 'area-level': 2
24
+ },
25
+ h3: {
26
+ accessibilityRole: 'header',
27
+ 'area-level': 3
28
+ },
29
+ subtitle1: {
30
+ accessibilityRole: 'header',
31
+ 'area-level': 6
32
+ },
33
+ subtitle2: {
34
+ accessibilityRole: 'header',
35
+ 'area-level': 6
36
+ },
37
+ body1: {
38
+ accessibilityRole: 'text'
39
+ },
40
+ body2: {
41
+ accessibilityRole: 'text'
42
+ },
43
+ caption1: {
44
+ accessibilityRole: 'text'
45
+ },
46
+ caption2: {
47
+ accessibilityRole: 'text'
48
+ },
49
+ flag: {
50
+ accessibilityRole: 'text'
51
+ }
52
+ };
53
+
54
+ function selectColor(theme, colorProp) {
55
+ var _theme$palette$colorP;
56
+
57
+ const palette = theme.palette.text;
58
+
59
+ switch (colorProp) {
60
+ case 'inherit':
61
+ return _reactNative.Platform.OS === 'web' ? 'inherit' : undefined;
62
+
63
+ case 'textPrimary':
64
+ return palette.primary;
65
+
66
+ case 'textSecondary':
67
+ return palette.secondary;
68
+
69
+ case 'textAccent':
70
+ return palette.accent;
71
+
72
+ case 'textHint':
73
+ return palette.hint;
74
+ }
75
+
76
+ return (_theme$palette$colorP = theme.palette[colorProp]) === null || _theme$palette$colorP === void 0 ? void 0 : _theme$palette$colorP.main;
77
+ }
78
+
79
+ const styles = _styles.StyleSheet.create({
80
+ root: {
81
+ flexShrink: 1,
82
+ ...(_reactNative.Platform.OS === 'web' ? {
83
+ maxWidth: '100%'
84
+ } : {})
85
+ }
86
+ });
87
+
88
+ const Typography = /*#__PURE__*/_react.default.forwardRef(function Typography(props, ref) {
89
+ const {
90
+ accessibilityRole,
91
+ align = 'inherit',
92
+ ariaLevel,
93
+ disableFontScaling = false,
94
+ children,
95
+ color: colorProp = 'inherit',
96
+ ellipsizeMode = 'tail',
97
+ href,
98
+ numberOfLines,
99
+ onPress,
100
+ selectable,
101
+ style,
102
+ variant = 'body1',
103
+ onLayout,
104
+ onTextLayout
105
+ } = props;
106
+ const theme = (0, _styles.useTheme)();
107
+ const fontStyle = (0, _styles.createFontStyle)(theme, {
108
+ selector: typography => typography[variant],
109
+ color: selectColor(theme, colorProp)
110
+ }); // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.
111
+
112
+ const textWrapStyle = numberOfLines && numberOfLines > 0 && _reactNative.Platform.OS === 'web' ? {
113
+ wordWrap: 'normal'
114
+ } : {};
115
+ const textStyle = (0, _styles.css)([styles.root, {
116
+ textAlign: align === 'inherit' ? 'auto' : align
117
+ }, textWrapStyle, fontStyle, style]);
118
+ const accessibility = accessibilityMap[variant];
119
+ const variantRole = href !== undefined ? 'link' : accessibility === null || accessibility === void 0 ? void 0 : accessibility.accessibilityRole;
120
+ const variantLevel = accessibility === null || accessibility === void 0 ? void 0 : accessibility['area-level'];
121
+ return /*#__PURE__*/_react.default.createElement(_reactNative.Text, {
122
+ ref: ref,
123
+ accessibilityRole: accessibilityRole || variantRole,
124
+ allowFontScaling: !disableFontScaling,
125
+ "aria-level": ariaLevel || variantLevel,
126
+ children: children,
127
+ ellipsizeMode: ellipsizeMode // @ts-ignore
128
+ ,
129
+ href: href,
130
+ numberOfLines: numberOfLines,
131
+ onPress: onPress,
132
+ selectable: selectable,
133
+ style: textStyle,
134
+ onLayout: onLayout,
135
+ onTextLayout: onTextLayout
136
+ });
137
+ });
138
+
139
+ var _default = /*#__PURE__*/_react.default.memo(Typography);
140
+
141
+ exports.default = _default;
142
+ //# sourceMappingURL=LegacyTypography.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["accessibilityMap","h1","accessibilityRole","h2","h3","subtitle1","subtitle2","body1","body2","caption1","caption2","flag","selectColor","theme","colorProp","palette","text","Platform","OS","undefined","primary","secondary","accent","hint","main","styles","StyleSheet","create","root","flexShrink","maxWidth","Typography","React","forwardRef","props","ref","align","ariaLevel","disableFontScaling","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","onLayout","onTextLayout","useTheme","fontStyle","createFontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","css","textAlign","accessibility","variantRole","variantLevel","memo"],"sources":["LegacyTypography.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, Text, TextStyle } from 'react-native';\nimport type { Theme } from '@fountain-ui/styles';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport TypographyProps, { AccessibilityMap, TypographyColor } from './LegacyTypographyProps';\n\nconst accessibilityMap: AccessibilityMap = {\n h1: { accessibilityRole: 'header', 'area-level': 1 },\n h2: { accessibilityRole: 'header', 'area-level': 2 },\n h3: { accessibilityRole: 'header', 'area-level': 3 },\n subtitle1: { accessibilityRole: 'header', 'area-level': 6 },\n subtitle2: { accessibilityRole: 'header', 'area-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 const palette = theme.palette.text;\n\n switch (colorProp) {\n case 'inherit':\n return Platform.OS === 'web' ? 'inherit' : undefined;\n case 'textPrimary':\n return palette.primary;\n case 'textSecondary':\n return palette.secondary;\n case 'textAccent':\n return palette.accent;\n case 'textHint':\n return palette.hint;\n }\n\n return theme.palette[colorProp]?.main;\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',\n ariaLevel,\n disableFontScaling = false,\n children,\n color: colorProp = 'inherit',\n ellipsizeMode = 'tail',\n href,\n numberOfLines,\n onPress,\n selectable,\n style,\n variant = 'body1',\n onLayout,\n onTextLayout,\n } = props;\n\n const theme = useTheme();\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography[variant],\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;;AACA;;AAEA;;;;AAGA,MAAMA,gBAAkC,GAAG;EACvCC,EAAE,EAAE;IAAEC,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CADmC;EAEvCC,EAAE,EAAE;IAAED,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAFmC;EAGvCE,EAAE,EAAE;IAAEF,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAHmC;EAIvCG,SAAS,EAAE;IAAEH,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAJ4B;EAKvCI,SAAS,EAAE;IAAEJ,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAL4B;EAMvCK,KAAK,EAAE;IAAEL,iBAAiB,EAAE;EAArB,CANgC;EAOvCM,KAAK,EAAE;IAAEN,iBAAiB,EAAE;EAArB,CAPgC;EAQvCO,QAAQ,EAAE;IAAEP,iBAAiB,EAAE;EAArB,CAR6B;EASvCQ,QAAQ,EAAE;IAAER,iBAAiB,EAAE;EAArB,CAT6B;EAUvCS,IAAI,EAAE;IAAET,iBAAiB,EAAE;EAArB;AAViC,CAA3C;;AAaA,SAASU,WAAT,CAAqBC,KAArB,EAAmCC,SAAnC,EAAmF;EAAA;;EAC/E,MAAMC,OAAO,GAAGF,KAAK,CAACE,OAAN,CAAcC,IAA9B;;EAEA,QAAQF,SAAR;IACI,KAAK,SAAL;MACI,OAAOG,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB,SAAxB,GAAoCC,SAA3C;;IACJ,KAAK,aAAL;MACI,OAAOJ,OAAO,CAACK,OAAf;;IACJ,KAAK,eAAL;MACI,OAAOL,OAAO,CAACM,SAAf;;IACJ,KAAK,YAAL;MACI,OAAON,O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AS,GAAG,IAAAC,WAAA,EAAI,CAClBjC,MAAM,CAACG,IADW,EAElB;IAAE+B,SAAS,EAAEvB,KAAK,KAAK,SAAV,GAAsB,MAAtB,GAA+BA;EAA5C,CAFkB,EAGlBmB,aAHkB,EAIlBJ,SAJkB,EAKlBL,KALkB,CAAJ,CAAlB;EAQA,MAAMc,aAAa,GAAG5D,gBAAgB,CAAC+C,OAAD,CAAtC;EACA,MAAMc,WAAW,GAAGnB,IAAI,KAAKvB,SAAT,GAAqB,MAArB,GAA8ByC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAE1D,iBAAjE;EACA,MAAM4D,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAG,YAAH,CAAlC;EAEA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAEzB,GADT;IAEI,iBAAiB,EAAEjC,iBAAiB,IAAI2D,WAF5C;IAGI,gBAAgB,EAAE,CAACvB,kBAHvB;IAII,cAAYD,SAAS,IAAIyB,YAJ7B;IAKI,QAAQ,EAAEvB,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,EAAEY,SAZX;IAaI,QAAQ,EAAET,QAbd;IAcI,YAAY,EAAEC;EAdlB,EADJ;AAkBH,CA3DkB,CAAnB;;4BA6DejB,cAAA,CAAM+B,IAAN,CAAWhC,UAAX,C"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ //# sourceMappingURL=LegacyTypographyProps.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sources":["LegacyTypographyProps.ts"],"sourcesContent":["import React from 'react';\nimport type { AccessibilityProps, TextProps } from 'react-native';\nimport type { ComponentProps } from '../types';\n\nexport type TypographyAlign = 'inherit' | 'left' | 'center' | 'right' | 'justify';\n\nexport type TypographyColor =\n | 'inherit'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'warning'\n | 'error'\n | 'accent'\n | 'textPrimary'\n | 'textSecondary'\n | 'textAccent'\n | 'textHint';\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'subtitle1'\n | 'subtitle2'\n | 'body1'\n | 'body2'\n | 'caption1'\n | 'caption2'\n | 'flag'\n | 'button1'\n | 'button2';\n\nexport interface Accessibility {\n accessibilityRole: AccessibilityProps['accessibilityRole'];\n 'area-level'?: number;\n}\n\nexport interface AccessibilityMap extends Partial<{\n [key: string]: Accessibility;\n}> {}\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?: TypographyVariant;\n\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":""}
@@ -13,67 +13,27 @@ var _styles = require("../styles");
13
13
 
14
14
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
15
15
 
16
- const accessibilityMap = {
17
- h1: {
18
- accessibilityRole: 'header',
19
- 'area-level': 1
20
- },
21
- h2: {
22
- accessibilityRole: 'header',
23
- 'area-level': 2
24
- },
25
- h3: {
26
- accessibilityRole: 'header',
27
- 'area-level': 3
28
- },
29
- subtitle1: {
30
- accessibilityRole: 'header',
31
- 'area-level': 6
32
- },
33
- subtitle2: {
34
- accessibilityRole: 'header',
35
- 'area-level': 6
36
- },
37
- body1: {
38
- accessibilityRole: 'text'
39
- },
40
- body2: {
41
- accessibilityRole: 'text'
42
- },
43
- caption1: {
44
- accessibilityRole: 'text'
45
- },
46
- caption2: {
47
- accessibilityRole: 'text'
48
- },
49
- flag: {
50
- accessibilityRole: 'text'
51
- }
16
+ const accessibilityMap = {// TODO: set accessibilityRole.
17
+ // h1: { accessibilityRole: 'header', 'aria-level': 1 },
18
+ // h2: { accessibilityRole: 'header', 'aria-level': 2 },
19
+ // h3: { accessibilityRole: 'header', 'aria-level': 3 },
20
+ // subtitle1: { accessibilityRole: 'header', 'aria-level': 6 },
21
+ // subtitle2: { accessibilityRole: 'header', 'aria-level': 6 },
22
+ // body1: { accessibilityRole: 'text' },
23
+ // body2: { accessibilityRole: 'text' },
24
+ // caption1: { accessibilityRole: 'text' },
25
+ // caption2: { accessibilityRole: 'text' },
26
+ // flag: { accessibilityRole: 'text' },
52
27
  };
53
28
 
54
29
  function selectColor(theme, colorProp) {
55
- var _theme$palette$colorP;
56
-
57
- const palette = theme.palette.text;
58
-
59
30
  switch (colorProp) {
60
31
  case 'inherit':
61
32
  return _reactNative.Platform.OS === 'web' ? 'inherit' : undefined;
62
33
 
63
- case 'textPrimary':
64
- return palette.primary;
65
-
66
- case 'textSecondary':
67
- return palette.secondary;
68
-
69
- case 'textAccent':
70
- return palette.accent;
71
-
72
- case 'textHint':
73
- return palette.hint;
34
+ default:
35
+ return theme.palette.text[colorProp];
74
36
  }
75
-
76
- return (_theme$palette$colorP = theme.palette[colorProp]) === null || _theme$palette$colorP === void 0 ? void 0 : _theme$palette$colorP.main;
77
37
  }
78
38
 
79
39
  const styles = _styles.StyleSheet.create({
@@ -100,12 +60,13 @@ const Typography = /*#__PURE__*/_react.default.forwardRef(function Typography(pr
100
60
  selectable,
101
61
  style,
102
62
  variant = 'body1',
63
+ weight = 'medium',
103
64
  onLayout,
104
65
  onTextLayout
105
66
  } = props;
106
67
  const theme = (0, _styles.useTheme)();
107
68
  const fontStyle = (0, _styles.createFontStyle)(theme, {
108
- selector: typography => typography[variant],
69
+ selector: typography => typography[variant][weight],
109
70
  color: selectColor(theme, colorProp)
110
71
  }); // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.
111
72
 
@@ -1 +1 @@
1
- {"version":3,"names":["accessibilityMap","h1","accessibilityRole","h2","h3","subtitle1","subtitle2","body1","body2","caption1","caption2","flag","selectColor","theme","colorProp","palette","text","Platform","OS","undefined","primary","secondary","accent","hint","main","styles","StyleSheet","create","root","flexShrink","maxWidth","Typography","React","forwardRef","props","ref","align","ariaLevel","disableFontScaling","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","onLayout","onTextLayout","useTheme","fontStyle","createFontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","css","textAlign","accessibility","variantRole","variantLevel","memo"],"sources":["Typography.tsx"],"sourcesContent":["import React from 'react';\nimport { Platform, Text, TextStyle } from 'react-native';\nimport type { Theme } from '@fountain-ui/styles';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport TypographyProps, { AccessibilityMap, TypographyColor } from './TypographyProps';\n\nconst accessibilityMap: AccessibilityMap = {\n h1: { accessibilityRole: 'header', 'area-level': 1 },\n h2: { accessibilityRole: 'header', 'area-level': 2 },\n h3: { accessibilityRole: 'header', 'area-level': 3 },\n subtitle1: { accessibilityRole: 'header', 'area-level': 6 },\n subtitle2: { accessibilityRole: 'header', 'area-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 const palette = theme.palette.text;\n\n switch (colorProp) {\n case 'inherit':\n return Platform.OS === 'web' ? 'inherit' : undefined;\n case 'textPrimary':\n return palette.primary;\n case 'textSecondary':\n return palette.secondary;\n case 'textAccent':\n return palette.accent;\n case 'textHint':\n return palette.hint;\n }\n\n return theme.palette[colorProp]?.main;\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',\n ariaLevel,\n disableFontScaling = false,\n children,\n color: colorProp = 'inherit',\n ellipsizeMode = 'tail',\n href,\n numberOfLines,\n onPress,\n selectable,\n style,\n variant = 'body1',\n onLayout,\n onTextLayout,\n } = props;\n\n const theme = useTheme();\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography[variant],\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;;AACA;;AAEA;;;;AAGA,MAAMA,gBAAkC,GAAG;EACvCC,EAAE,EAAE;IAAEC,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CADmC;EAEvCC,EAAE,EAAE;IAAED,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAFmC;EAGvCE,EAAE,EAAE;IAAEF,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAHmC;EAIvCG,SAAS,EAAE;IAAEH,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAJ4B;EAKvCI,SAAS,EAAE;IAAEJ,iBAAiB,EAAE,QAArB;IAA+B,cAAc;EAA7C,CAL4B;EAMvCK,KAAK,EAAE;IAAEL,iBAAiB,EAAE;EAArB,CANgC;EAOvCM,KAAK,EAAE;IAAEN,iBAAiB,EAAE;EAArB,CAPgC;EAQvCO,QAAQ,EAAE;IAAEP,iBAAiB,EAAE;EAArB,CAR6B;EASvCQ,QAAQ,EAAE;IAAER,iBAAiB,EAAE;EAArB,CAT6B;EAUvCS,IAAI,EAAE;IAAET,iBAAiB,EAAE;EAArB;AAViC,CAA3C;;AAaA,SAASU,WAAT,CAAqBC,KAArB,EAAmCC,SAAnC,EAAmF;EAAA;;EAC/E,MAAMC,OAAO,GAAGF,KAAK,CAACE,OAAN,CAAcC,IAA9B;;EAEA,QAAQF,SAAR;IACI,KAAK,SAAL;MACI,OAAOG,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB,SAAxB,GAAoCC,SAA3C;;IACJ,KAAK,aAAL;MACI,OAAOJ,OAAO,CAACK,OAAf;;IACJ,KAAK,eAA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AEsC,QAAQ,EAAE;EAAZ,CAA9D,GAAuF,EAA7G;EAEA,MAAMC,SAAS,GAAG,IAAAC,WAAA,EAAI,CAClBjC,MAAM,CAACG,IADW,EAElB;IAAE+B,SAAS,EAAEvB,KAAK,KAAK,SAAV,GAAsB,MAAtB,GAA+BA;EAA5C,CAFkB,EAGlBmB,aAHkB,EAIlBJ,SAJkB,EAKlBL,KALkB,CAAJ,CAAlB;EAQA,MAAMc,aAAa,GAAG5D,gBAAgB,CAAC+C,OAAD,CAAtC;EACA,MAAMc,WAAW,GAAGnB,IAAI,KAAKvB,SAAT,GAAqB,MAArB,GAA8ByC,aAA9B,aAA8BA,aAA9B,uBAA8BA,aAAa,CAAE1D,iBAAjE;EACA,MAAM4D,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAG,YAAH,CAAlC;EAEA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAEzB,GADT;IAEI,iBAAiB,EAAEjC,iBAAiB,IAAI2D,WAF5C;IAGI,gBAAgB,EAAE,CAACvB,kBAHvB;IAII,cAAYD,SAAS,IAAIyB,YAJ7B;IAKI,QAAQ,EAAEvB,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,EAAEY,SAZX;IAaI,QAAQ,EAAET,QAbd;IAcI,YAAY,EAAEC;EAdlB,EADJ;AAkBH,CA3DkB,CAAnB;;4BA6DejB,cAAA,CAAM+B,IAAN,CAAWhC,UAAX,C"}
1
+ {"version":3,"names":["accessibilityMap","selectColor","theme","colorProp","Platform","OS","undefined","palette","text","styles","StyleSheet","create","root","flexShrink","maxWidth","Typography","React","forwardRef","props","ref","accessibilityRole","align","ariaLevel","disableFontScaling","children","color","ellipsizeMode","href","numberOfLines","onPress","selectable","style","variant","weight","onLayout","onTextLayout","useTheme","fontStyle","createFontStyle","selector","typography","textWrapStyle","wordWrap","textStyle","css","textAlign","accessibility","variantRole","variantLevel","memo"],"sources":["Typography.tsx"],"sourcesContent":["import React from 'react';\nimport type { TextProps, TextStyle } from 'react-native';\nimport { Platform, Text } from 'react-native';\nimport type { FontVariant, FontWeight, Theme } from '@fountain-ui/styles';\nimport { createFontStyle, css, StyleSheet, useTheme } from '../styles';\nimport type TypographyProps from './TypographyProps';\nimport type { AccessibilityMap, TypographyAlign, TypographyColor } from './TypographyProps';\n\nconst accessibilityMap: AccessibilityMap = {\n // TODO: set accessibilityRole.\n // h1: { accessibilityRole: 'header', 'aria-level': 1 },\n // h2: { accessibilityRole: 'header', 'aria-level': 2 },\n // h3: { accessibilityRole: 'header', 'aria-level': 3 },\n // subtitle1: { accessibilityRole: 'header', 'aria-level': 6 },\n // subtitle2: { accessibilityRole: 'header', 'aria-level': 6 },\n // body1: { accessibilityRole: 'text' },\n // body2: { accessibilityRole: 'text' },\n // caption1: { accessibilityRole: 'text' },\n // caption2: { accessibilityRole: 'text' },\n // flag: { accessibilityRole: 'text' },\n};\n\nfunction selectColor(theme: Theme, colorProp: TypographyColor): string | undefined {\n switch (colorProp) {\n case 'inherit':\n return Platform.OS === 'web' ? 'inherit' : undefined;\n default:\n return theme.palette.text[colorProp];\n }\n}\n\nconst styles = StyleSheet.create({\n root: {\n flexShrink: 1,\n ...(Platform.OS === 'web' ? { maxWidth: '100%' } : {}),\n },\n});\n\nconst Typography = React.forwardRef<Text, TypographyProps>(function Typography(props, ref) {\n const {\n accessibilityRole,\n align = 'inherit' as TypographyAlign,\n ariaLevel,\n disableFontScaling = false,\n children,\n color: colorProp = 'inherit' as TypographyColor,\n ellipsizeMode = 'tail' as TextProps['ellipsizeMode'],\n href,\n numberOfLines,\n onPress,\n selectable,\n style,\n variant = 'body1' as FontVariant,\n weight = 'medium' as FontWeight,\n onLayout,\n onTextLayout,\n } = props;\n\n const theme = useTheme();\n\n const fontStyle = createFontStyle(theme, {\n selector: (typography) => typography[variant][weight],\n color: selectColor(theme, colorProp),\n });\n\n // To prevent white-space: pre, word-wrap:break-word style conflicting issue at safari browser.\n const textWrapStyle = numberOfLines && numberOfLines > 0 && Platform.OS === 'web' ? { wordWrap: 'normal' } : {};\n\n const textStyle = css([\n styles.root,\n { textAlign: align === 'inherit' ? 'auto' : align },\n textWrapStyle as TextStyle,\n fontStyle,\n style,\n ]);\n\n const accessibility = accessibilityMap[variant];\n const variantRole = href !== undefined ? 'link' : accessibility?.accessibilityRole;\n const variantLevel = accessibility?.['area-level'];\n\n return (\n <Text\n ref={ref}\n accessibilityRole={accessibilityRole || variantRole}\n allowFontScaling={!disableFontScaling}\n aria-level={ariaLevel || variantLevel}\n children={children}\n ellipsizeMode={ellipsizeMode}\n // @ts-ignore\n href={href}\n numberOfLines={numberOfLines}\n onPress={onPress}\n selectable={selectable}\n style={textStyle}\n onLayout={onLayout}\n onTextLayout={onTextLayout}\n />\n );\n});\n\nexport default React.memo(Typography);\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAEA;;;;AAIA,MAAMA,gBAAkC,GAAG,CACvC;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;AAXuC,CAA3C;;AAcA,SAASC,WAAT,CAAqBC,KAArB,EAAmCC,SAAnC,EAAmF;EAC/E,QAAQA,SAAR;IACI,KAAK,SAAL;MACI,OAAOC,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB,SAAxB,GAAoCC,SAA3C;;IACJ;MACI,OAAOJ,KAAK,CAACK,OAAN,CAAcC,IAAd,CAAmBL,SAAnB,CAAP;EAJR;AAMH;;AAED,MAAMM,MAAM,GAAGC,kBAAA,CAAWC,MAAX,CAAkB;EAC7BC,IAAI,EAAE;IACFC,UAAU,EAAE,CADV;IAEF,IAAIT,qBAAA,CAASC,EAAT,KAAgB,KAAhB,GAAwB;MAAES,QAAQ,EAAE;IAAZ,CAAxB,GAA+C,EAAnD;EAFE;AADuB,CAAlB,CAAf;;AAOA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AA9B,uBAA8BA,aAAa,CAAE1B,iBAAjE;EACA,MAAM4B,YAAY,GAAGF,aAAH,aAAGA,aAAH,uBAAGA,aAAa,CAAG,YAAH,CAAlC;EAEA,oBACI,6BAAC,iBAAD;IACI,GAAG,EAAE3B,GADT;IAEI,iBAAiB,EAAEC,iBAAiB,IAAI2B,WAF5C;IAGI,gBAAgB,EAAE,CAACxB,kBAHvB;IAII,cAAYD,SAAS,IAAI0B,YAJ7B;IAKI,QAAQ,EAAExB,QALd;IAMI,aAAa,EAAEE,aANnB,CAOI;IAPJ;IAQI,IAAI,EAAEC,IARV;IASI,aAAa,EAAEC,aATnB;IAUI,OAAO,EAAEC,OAVb;IAWI,UAAU,EAAEC,UAXhB;IAYI,KAAK,EAAEa,SAZX;IAaI,QAAQ,EAAET,QAbd;IAcI,YAAY,EAAEC;EAdlB,EADJ;AAkBH,CA5DkB,CAAnB;;4BA8DenB,cAAA,CAAMiC,IAAN,CAAWlC,UAAX,C"}
@@ -1,2 +1,9 @@
1
1
  "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.typographyColors = void 0;
7
+ const typographyColors = ['inherit', 'accent', 'accentAlt', 'strong', 'strongInverse', 'base', 'baseInverse', 'baseOpacity', 'baseOpacityInverse', 'weak', 'weakOpacity', 'weakInverse', 'weakOpacityInverse'];
8
+ exports.typographyColors = typographyColors;
2
9
  //# sourceMappingURL=TypographyProps.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TypographyProps.ts"],"sourcesContent":["import React from 'react';\nimport type { AccessibilityProps, TextProps } from 'react-native';\nimport type { ComponentProps } from '../types';\n\nexport type TypographyAlign = 'inherit' | 'left' | 'center' | 'right' | 'justify';\n\nexport type TypographyColor =\n | 'inherit'\n | 'primary'\n | 'secondary'\n | 'tertiary'\n | 'warning'\n | 'error'\n | 'accent'\n | 'textPrimary'\n | 'textSecondary'\n | 'textAccent'\n | 'textHint';\n\nexport type TypographyVariant =\n | 'h1'\n | 'h2'\n | 'h3'\n | 'subtitle1'\n | 'subtitle2'\n | 'body1'\n | 'body2'\n | 'caption1'\n | 'caption2'\n | 'flag'\n | 'button1'\n | 'button2';\n\nexport interface Accessibility {\n accessibilityRole: AccessibilityProps['accessibilityRole'];\n 'area-level'?: number;\n}\n\nexport interface AccessibilityMap extends Partial<{\n [key: string]: Accessibility;\n}> {}\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?: TypographyVariant;\n\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":""}
1
+ {"version":3,"names":["typographyColors"],"sources":["TypographyProps.ts"],"sourcesContent":["import React from 'react';\nimport type { AccessibilityProps, TextProps, TextStyle } from 'react-native';\nimport type { FontVariant, FontWeight } from '@fountain-ui/styles';\nimport type { ComponentProps } from '../types';\n\nexport type TypographyAlign = 'inherit' | TextStyle['textAlign'];\n\nexport const typographyColors = [\n 'inherit',\n 'accent',\n 'accentAlt',\n 'strong',\n 'strongInverse',\n 'base',\n 'baseInverse',\n 'baseOpacity',\n 'baseOpacityInverse',\n 'weak',\n 'weakOpacity',\n 'weakInverse',\n 'weakOpacityInverse',\n] as const;\n\nexport type TypographyColor = typeof typographyColors[number];\n\nexport interface Accessibility {\n accessibilityRole: AccessibilityProps['accessibilityRole'];\n 'area-level'?: number;\n}\n\nexport type AccessibilityMap = Partial<Record<FontVariant, Accessibility>>;\n\nexport default interface TypographyProps extends ComponentProps<{\n /**\n * Applies HTML tag at web and communicates purpose of component at app\n */\n accessibilityRole?: AccessibilityProps['accessibilityRole'];\n\n /**\n * Set the text-align on the component.\n * The value 'justify' is not supported on Android and fallbacks to left.\n * @default 'inherit'\n */\n align?: TypographyAlign;\n\n /**\n * Applies HTML heading level\n */\n ariaLevel?: number;\n\n /**\n * Specifies whether fonts should scale to respect Text Size accessibility settings.\n * @default false\n */\n disableFontScaling?: boolean;\n\n /**\n * The content of the component.\n */\n children?: React.ReactNode;\n\n /**\n * The color of the component. It supports those theme colors that make sense for this component.\n * @default 'inherit'\n */\n color?: TypographyColor;\n\n /**\n * The text ellipsis mode.\n * @default 'tail'\n */\n ellipsizeMode?: TextProps['ellipsizeMode'];\n\n /**\n * Internal use only. The hyperlink of the text.\n */\n href?: string;\n\n /**\n * Used to truncate the text with an ellipsis after computing the text\n * layout, including line wrapping, such that the total number of lines\n * does not exceed this number.\n */\n numberOfLines?: TextProps['numberOfLines'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n onPress?: TextProps['onPress'];\n\n /**\n * Lets the user select text, to use the native copy and paste functionality.\n */\n selectable?: boolean;\n\n /**\n * Applies the theme typography styles.\n * @default 'body1'\n */\n variant?: FontVariant;\n\n /**\n * Determines the font weight.\n * @default 'medium'\n */\n weight?: FontWeight;\n\n /**\n * Callback that is called when the text layout has been calculated.\n */\n onTextLayout?: TextProps['onTextLayout'];\n\n /**\n * Callback that is called when the layout of the Text component changes.\n */\n onLayout?: TextProps['onLayout'];\n}> {}\n"],"mappings":";;;;;;AAOO,MAAMA,gBAAgB,GAAG,CAC5B,SAD4B,EAE5B,QAF4B,EAG5B,WAH4B,EAI5B,QAJ4B,EAK5B,eAL4B,EAM5B,MAN4B,EAO5B,aAP4B,EAQ5B,aAR4B,EAS5B,oBAT4B,EAU5B,MAV4B,EAW5B,aAX4B,EAY5B,aAZ4B,EAa5B,oBAb4B,CAAzB"}
@@ -6,11 +6,11 @@ Object.defineProperty(exports, "__esModule", {
6
6
  Object.defineProperty(exports, "default", {
7
7
  enumerable: true,
8
8
  get: function () {
9
- return _Typography.default;
9
+ return _LegacyTypography.default;
10
10
  }
11
11
  });
12
12
 
13
- var _Typography = _interopRequireDefault(require("./Typography"));
13
+ var _LegacyTypography = _interopRequireDefault(require("./LegacyTypography"));
14
14
 
15
15
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
16
16
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './Typography';\nexport type { default as TypographyProps } from './TypographyProps';"],"mappings":";;;;;;;;;;;;AAAA"}
1
+ {"version":3,"names":[],"sources":["index.ts"],"sourcesContent":["export { default } from './LegacyTypography';\nexport type { default as TypographyProps } from './LegacyTypographyProps';\n"],"mappings":";;;;;;;;;;;;AAAA"}
@@ -52,6 +52,7 @@ function useCollapsibleAppBar() {
52
52
  const lastTranslateY = (0, _reactNativeReanimated.useSharedValue)(0);
53
53
  const lastOffsetY = (0, _reactNativeReanimated.useSharedValue)(0);
54
54
  const overlapped = (0, _reactNativeReanimated.useSharedValue)(false);
55
+ const [isScrolled, setIsScrolled] = (0, _react.useState)(false);
55
56
  const theme = (0, _styles.useTheme)();
56
57
  const animatedStyle = (0, _reactNativeReanimated.useAnimatedStyle)(() => {
57
58
  const transform = [{
@@ -96,6 +97,13 @@ function useCollapsibleAppBar() {
96
97
  },
97
98
  onScroll: event => {
98
99
  const offsetY = event.contentOffset.y;
100
+
101
+ if (!isScrolled && offsetY > 0) {
102
+ (0, _reactNativeReanimated.runOnJS)(setIsScrolled)(true);
103
+ } else if (isScrolled && offsetY <= 0) {
104
+ (0, _reactNativeReanimated.runOnJS)(setIsScrolled)(false);
105
+ }
106
+
99
107
  const maxTy = maxTranslateY.value;
100
108
 
101
109
  if (SUPPORTS_DRAG_DETECTION) {
@@ -133,7 +141,7 @@ function useCollapsibleAppBar() {
133
141
  overlapped.value = offsetY + nextTranslateY > 0;
134
142
  translateY.value = (0, _reactNativeReanimated.withTiming)(nextTranslateY, ANIMATION_CONFIG);
135
143
  }
136
- }, [keyboardDismissMode, appBarHeight]);
144
+ }, [keyboardDismissMode, appBarHeight, isScrolled]);
137
145
  const hasCollapsible = collapsibleToolbarHeight > 0;
138
146
  const appBarStyle = [animatedStyle, {
139
147
  paddingTop: safeAreaInsets.top
@@ -146,7 +154,8 @@ function useCollapsibleAppBar() {
146
154
  onScrollViewChanged,
147
155
  scrollContentInsets: {
148
156
  top: hasCollapsible ? appBarHeight : 0
149
- }
157
+ },
158
+ isScrolled
150
159
  };
151
160
  }
152
161
 
@@ -1 +1 @@
1
- {"version":3,"names":["defaultOptions","keyboardDismissMode","dividerExposureMode","supportsReverseScroll","ANIMATION_CONFIG","duration","TRANSPARENT","SUPPORTS_DRAG_DETECTION","Platform","OS","dismissKeyboard","Keyboard","dismiss","useCollapsibleAppBar","userOptions","styles","useAppbarStyles","safeAreaInsets","useSafeAreaInsets","appBarHeight","onAppBarLayout","useHeight","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","useDerivedValue","translateY","useSharedValue","lastTranslateY","lastOffsetY","overlapped","theme","useTheme","animatedStyle","useAnimatedStyle","transform","value","borderColor","palette","divider","borderBottomWidth","StyleSheet","hairlineWidth","indexRef","useRef","offsetsRef","onScrollViewChanged","useCallback","nextIndex","prevIndex","current","savedOffsetY","withTiming","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","onMomentumBegin","onScroll","event","offsetY","contentOffset","y","maxTy","dy","Math","min","max","minOffsetY","maxOffsetY","contentSize","height","layoutMeasurement","safeOffsetY","safeLastOffsetY","newTranslateY","onEndDrag","onMomentumEnd","ty","threshold","nextTranslateY","hasCollapsible","appBarStyle","paddingTop","top","floating","undefined","scrollContentInsets"],"sources":["useCollapsibleAppBar.ts"],"sourcesContent":["import { useCallback, useRef } 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}\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 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 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 = supportsReverseScroll\n ? dy === 0\n ? lastTranslateY.value\n : dy > 0\n ? maxTy\n : 0\n : safeLastOffsetY === minOffsetY\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]);\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 };\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAWA;;AAQA;;AACA;;AACA;;AACA;;;;AAgCA,MAAMA,cAAiC,GAAG;EACtCC,mBAAmB,EAAE,MADiB;EAEtCC,mBAAmB,EAAE,YAFiB;EAGtCC,qBAAqB,EAAE;AAHe,CAA1C;AAMA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;AACA,MAAMC,WAAW,GAAG,WAApB;AAEA,MAAMC,uBAAuB,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAAhD;;AACA,MAAMC,eAAe,GAAG,MAAMC,qBAAA,CAASC,OAAT,EAA9B;;AAEe,SAASC,oBAAT,GAAwF;EAAA,IAA1DC,WAA0D,uEAAnCd,cAAmC;EACnG,MAAM;IAAEC,mBAAF;IAAuBC,mBAAvB;IAA4CC;EAA5C,IAAyF,EAC3F,GAAGH,cADwF;IAE3F,GAAGc;EAFwF,CAA/F;EAKA,MAAMC,MAAM,GAAG,IAAAC,wBAAA,GAAf;EAEA,MAAMC,cAAc,GAAG,IAAAC,6CAAA,GAAvB;EAEA,MAAM,CAACC,YAAD,EAAeC,cAAf,IAAiC,IAAAC,gBAAA,GAAvC;EACA,MAAM,CAACC,wBAAD,EAA2BC,0BAA3B,IAAyD,IAAAF,gBAAA,GAA/D;EAEA,MAAMG,aAAa,GAAG,IAAAC,sCAAA,EAAgB,MAAM,CAACH,wBAAvB,EAAiD,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B;QACxB;MACH;;MAED,MAAMC,SAAS,GAAGhB,KAAK,GAAG,GAA1B;MAEA,MAAMiB,cAAc,GAAIF,EAAE,GAAGC,SAAL,IAAkBnB,OAAO,GAAGzC,YAA7B,GAA6C,CAA7C,GAAiD4C,KAAxE;MAEAjC,UAAU,CAACM,KAAX,GAAmBwB,OAAO,GAAGoB,cAAV,GAA2B,CAA9C;MAEAtD,UAAU,CAACU,KAAX,GAAmB,IAAAgB,iCAAA,EAAW4B,cAAX,EAA2B5E,gBAA3B,CAAnB;IACH;EAtE0C,CAAzB,EAuEnB,CAACH,mBAAD,EAAsBkB,YAAtB,CAvEmB,CAAtB;EAyEA,MAAM8D,cAAc,GAAG3D,wBAAwB,GAAG,CAAlD;EAEA,MAAM4D,WAAW,GAAG,CAChBjD,aADgB,EAEhB;IAAEkD,UAAU,EAAElE,cAAc,CAACmE;EAA7B,CAFgB,EAGhBH,cAAc,GAAGlE,MAAM,CAACsE,QAAV,GAAqBC,SAHnB,CAApB;EAMA,OAAO;IACHJ,WADG;IAEH9D,cAFG;IAGHG,0BAHG;IAIHmC,QAAQ,EAAEL,aAJP;IAKHP,mBALG;IAMHyC,mBAAmB,EAAE;MAAEH,GAAG,EAAEH,cAAc,GAAG9D,YAAH,GAAkB;IAAvC;EANlB,CAAP;AAQH;;AAAA"}
1
+ {"version":3,"names":["defaultOptions","keyboardDismissMode","dividerExposureMode","supportsReverseScroll","ANIMATION_CONFIG","duration","TRANSPARENT","SUPPORTS_DRAG_DETECTION","Platform","OS","dismissKeyboard","Keyboard","dismiss","useCollapsibleAppBar","userOptions","styles","useAppbarStyles","safeAreaInsets","useSafeAreaInsets","appBarHeight","onAppBarLayout","useHeight","collapsibleToolbarHeight","onCollapsibleToolbarLayout","maxTranslateY","useDerivedValue","translateY","useSharedValue","lastTranslateY","lastOffsetY","overlapped","isScrolled","setIsScrolled","useState","theme","useTheme","animatedStyle","useAnimatedStyle","transform","value","borderColor","palette","divider","borderBottomWidth","StyleSheet","hairlineWidth","indexRef","useRef","offsetsRef","onScrollViewChanged","useCallback","nextIndex","prevIndex","current","savedOffsetY","withTiming","scrollHandler","useAnimatedScrollHandler","onBeginDrag","runOnJS","onMomentumBegin","onScroll","event","offsetY","contentOffset","y","maxTy","dy","Math","min","max","minOffsetY","maxOffsetY","contentSize","height","layoutMeasurement","safeOffsetY","safeLastOffsetY","newTranslateY","onEndDrag","onMomentumEnd","ty","threshold","nextTranslateY","hasCollapsible","appBarStyle","paddingTop","top","floating","undefined","scrollContentInsets"],"sources":["useCollapsibleAppBar.ts"],"sourcesContent":["import { useCallback, useRef, useState } from 'react';\nimport {\n Falsy,\n Keyboard,\n Platform,\n RegisteredStyle,\n ScrollViewProps,\n StyleSheet,\n ViewProps,\n ViewStyle,\n} from 'react-native';\nimport type { WithTimingConfig } from 'react-native-reanimated';\nimport {\n runOnJS,\n useAnimatedScrollHandler,\n useAnimatedStyle,\n useDerivedValue,\n useSharedValue,\n withTiming,\n} from 'react-native-reanimated';\nimport { useSafeAreaInsets } from 'react-native-safe-area-context';\nimport { useTheme } from '@fountain-ui/styles';\nimport { useHeight } from '../internal/hooks';\nimport useAppbarStyles from './useAppbarStyles';\n\ntype WebOnlyStyle = { boxShadow: any };\n\ntype ViewStyleProp = Array<ViewStyle | RegisteredStyle<ViewStyle> | WebOnlyStyle | Falsy>;\n\ntype OnScroll = ScrollViewProps['onScroll'];\n\ntype OnLayoutCallback = ViewProps['onLayout'];\n\nexport interface ContentInsets {\n top?: number;\n bottom?: number;\n left?: number;\n right?: number;\n}\n\nexport interface Options {\n keyboardDismissMode?: 'none' | 'on-drag';\n dividerExposureMode?: 'always' | 'overlapped';\n supportsReverseScroll?: boolean;\n}\n\nexport interface CollapsibleAppBar {\n appBarStyle: ViewStyleProp;\n onAppBarLayout: OnLayoutCallback;\n onCollapsibleToolbarLayout: OnLayoutCallback;\n onScroll: OnScroll;\n onScrollViewChanged: (index: number) => void;\n scrollContentInsets: ContentInsets;\n isScrolled: boolean;\n}\n\nconst defaultOptions: Required<Options> = {\n keyboardDismissMode: 'none',\n dividerExposureMode: 'overlapped',\n supportsReverseScroll: true,\n};\n\nconst ANIMATION_CONFIG: Readonly<WithTimingConfig> = { duration: 100 };\nconst TRANSPARENT = '#FFFFFF00';\n\nconst SUPPORTS_DRAG_DETECTION = Platform.OS !== 'web';\nconst dismissKeyboard = () => Keyboard.dismiss();\n\nexport default function useCollapsibleAppBar(userOptions: Options = defaultOptions): CollapsibleAppBar {\n const { keyboardDismissMode, dividerExposureMode, supportsReverseScroll }: Required<Options> = {\n ...defaultOptions,\n ...userOptions,\n };\n\n const styles = useAppbarStyles();\n\n const safeAreaInsets = useSafeAreaInsets();\n\n const [appBarHeight, onAppBarLayout] = useHeight();\n const [collapsibleToolbarHeight, onCollapsibleToolbarLayout] = useHeight();\n\n const maxTranslateY = useDerivedValue(() => -collapsibleToolbarHeight, [collapsibleToolbarHeight]);\n\n const translateY = useSharedValue<number>(0);\n const lastTranslateY = useSharedValue<number>(0);\n const lastOffsetY = useSharedValue<number>(0);\n const overlapped = useSharedValue<boolean>(false);\n\n const [isScrolled, setIsScrolled] = useState<boolean>(false);\n\n const theme = useTheme();\n\n const animatedStyle = useAnimatedStyle(() => {\n const transform = [{ translateY: translateY.value }];\n\n return {\n transform,\n borderColor: dividerExposureMode === 'always' || overlapped.value ? theme.palette.divider : TRANSPARENT,\n borderBottomWidth: StyleSheet.hairlineWidth,\n };\n }, [\n theme,\n dividerExposureMode,\n ]);\n\n const indexRef = useRef<number>(0);\n const offsetsRef = useRef<Array<number>>([]);\n\n const onScrollViewChanged = useCallback((nextIndex: number) => {\n const prevIndex = indexRef.current;\n if (prevIndex === nextIndex) {\n return;\n }\n\n offsetsRef.current[prevIndex] = lastOffsetY.value;\n\n const savedOffsetY = offsetsRef.current[nextIndex] ?? 0;\n lastOffsetY.value = savedOffsetY;\n\n indexRef.current = nextIndex;\n\n // Determine whether to overlap every time index is changed.\n overlapped.value = savedOffsetY > 0;\n\n // If next ScrollView's offset is too short, expand app bar.\n if (translateY.value < 0 && savedOffsetY < appBarHeight) {\n translateY.value = withTiming(0, ANIMATION_CONFIG);\n }\n }, [appBarHeight]);\n\n const scrollHandler = useAnimatedScrollHandler({\n onBeginDrag: () => {\n if (keyboardDismissMode === 'on-drag') {\n runOnJS(dismissKeyboard)();\n }\n lastTranslateY.value = translateY.value;\n },\n onMomentumBegin: () => {\n lastTranslateY.value = translateY.value;\n },\n onScroll: (event) => {\n const offsetY = event.contentOffset.y;\n\n if (!isScrolled && offsetY > 0) {\n runOnJS(setIsScrolled)(true);\n } else if (isScrolled && offsetY <= 0) {\n runOnJS(setIsScrolled)(false);\n }\n\n const maxTy = maxTranslateY.value;\n\n if (SUPPORTS_DRAG_DETECTION) {\n const dy = offsetY - lastOffsetY.value;\n\n translateY.value = offsetY <= 0 ? 0 : Math.min(Math.max(lastTranslateY.value - dy, maxTy), 0);\n\n overlapped.value = offsetY + translateY.value > 0;\n } else {\n const minOffsetY = -maxTy;\n const maxOffsetY = event.contentSize.height - event.layoutMeasurement.height;\n\n const safeOffsetY = Math.min(Math.max(offsetY, minOffsetY), maxOffsetY);\n const safeLastOffsetY = Math.min(Math.max(lastOffsetY.value, minOffsetY), maxOffsetY);\n const dy = safeOffsetY - safeLastOffsetY;\n\n const newTranslateY = supportsReverseScroll\n ? dy === 0\n ? lastTranslateY.value\n : dy > 0\n ? maxTy\n : 0\n : safeLastOffsetY === minOffsetY\n ? 0\n : maxTy;\n\n translateY.value = withTiming(newTranslateY, ANIMATION_CONFIG);\n lastTranslateY.value = newTranslateY;\n\n overlapped.value = offsetY > 0;\n\n lastOffsetY.value = offsetY;\n }\n },\n onEndDrag: (event) => {\n lastOffsetY.value = event.contentOffset.y;\n },\n onMomentumEnd: (event) => {\n const offsetY = event.contentOffset.y;\n\n lastOffsetY.value = offsetY;\n\n const ty = translateY.value;\n const maxTy = maxTranslateY.value;\n\n // If toolbar is already positioned on edge, do nothing.\n if (ty <= maxTy || ty >= 0) {\n return;\n }\n\n const threshold = maxTy * 0.5;\n\n const nextTranslateY = (ty > threshold || offsetY < appBarHeight) ? 0 : maxTy;\n\n overlapped.value = offsetY + nextTranslateY > 0;\n\n translateY.value = withTiming(nextTranslateY, ANIMATION_CONFIG);\n },\n }, [keyboardDismissMode, appBarHeight, isScrolled]);\n\n const hasCollapsible = collapsibleToolbarHeight > 0;\n\n const appBarStyle = [\n animatedStyle,\n { paddingTop: safeAreaInsets.top },\n hasCollapsible ? styles.floating : undefined,\n ];\n\n return {\n appBarStyle,\n onAppBarLayout,\n onCollapsibleToolbarLayout,\n onScroll: scrollHandler,\n onScrollViewChanged,\n scrollContentInsets: { top: hasCollapsible ? appBarHeight : 0 },\n isScrolled,\n };\n};\n"],"mappings":";;;;;;;AAAA;;AACA;;AAWA;;AAQA;;AACA;;AACA;;AACA;;;;AAiCA,MAAMA,cAAiC,GAAG;EACtCC,mBAAmB,EAAE,MADiB;EAEtCC,mBAAmB,EAAE,YAFiB;EAGtCC,qBAAqB,EAAE;AAHe,CAA1C;AAMA,MAAMC,gBAA4C,GAAG;EAAEC,QAAQ,EAAE;AAAZ,CAArD;AACA,MAAMC,WAAW,GAAG,WAApB;AAEA,MAAMC,uBAAuB,GAAGC,qBAAA,CAASC,EAAT,KAAgB,KAAhD;;AACA,MAAMC,eAAe,GAAG,MAAMC,qBAAA,CAASC,OAAT,EAA9B;;AAEe,SAASC,oBAAT,GAAwF;EAAA,IAA1DC,WAA0D,uEAAnCd,cAAmC;EACnG,MAAM;IAAEC,mBAAF;IAAuBC,mBAAvB;IAA4CC;EAA5C,IAAyF,EAC3F,GAAGH,cADwF;IAE3F,GAAGc;EAFwF,CAA/F;EAKA,MAAMC,MAAM,GAAG,IAAAC,wBAAA,GAAf;EAEA,MAAMC,cAAc,GAAG,IAAAC,6CAAA,GAAvB;EAEA,MAAM,CAACC,YAAD,EAAeC,cAAf,IAAiC,IAAAC,gBAAA,GAAvC;EACA,MAAM,CAACC,wBAAD,EAA2BC,0BAA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