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

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 +8 -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 +28 -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 +1 -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 +2 -0
  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 +2 -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 +2 -0
  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 +2 -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 +4 -0
  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
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useIndexStore;
7
+
8
+ var _react = require("react");
9
+
10
+ var _store = require("../store");
11
+
12
+ function useIndexStore(value) {
13
+ const {
14
+ animatedValue,
15
+ initialValue
16
+ } = value;
17
+ const store = (0, _react.useRef)(new _store.SimpleStore(initialValue)).current;
18
+ (0, _react.useEffect)(() => {
19
+ const id = animatedValue.addListener(newIndex => {
20
+ store.dispatch(newIndex.value);
21
+ });
22
+ return () => {
23
+ animatedValue.removeListener(id);
24
+ };
25
+ }, [animatedValue]);
26
+ (0, _react.useEffect)(() => {
27
+ return () => {
28
+ store.removeAllListeners();
29
+ };
30
+ }, [store]);
31
+ return store;
32
+ }
33
+
34
+ ;
35
+ //# sourceMappingURL=useIndexStore.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useIndexStore","value","animatedValue","initialValue","store","useRef","SimpleStore","current","useEffect","id","addListener","newIndex","dispatch","removeListener","removeAllListeners"],"sources":["useIndexStore.ts"],"sourcesContent":["import { useEffect, useRef } from 'react';\nimport type { MonoStore } from '../store';\nimport { SimpleStore } from '../store';\nimport type { SyncAnimatedValue } from '../types';\n\nexport default function useIndexStore(value: SyncAnimatedValue): MonoStore<number> {\n const {\n animatedValue,\n initialValue,\n } = value;\n\n const store = useRef(new SimpleStore(initialValue)).current;\n\n useEffect(() => {\n const id = animatedValue.addListener((newIndex) => {\n store.dispatch(newIndex.value);\n });\n\n return () => {\n animatedValue.removeListener(id);\n };\n }, [animatedValue]);\n\n useEffect(() => {\n return () => {\n store.removeAllListeners();\n };\n }, [store]);\n\n return store;\n};\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAGe,SAASA,aAAT,CAAuBC,KAAvB,EAAoE;EAC/E,MAAM;IACFC,aADE;IAEFC;EAFE,IAGFF,KAHJ;EAKA,MAAMG,KAAK,GAAG,IAAAC,aAAA,EAAO,IAAIC,kBAAJ,CAAgBH,YAAhB,CAAP,EAAsCI,OAApD;EAEA,IAAAC,gBAAA,EAAU,MAAM;IACZ,MAAMC,EAAE,GAAGP,aAAa,CAACQ,WAAd,CAA2BC,QAAD,IAAc;MAC/CP,KAAK,CAACQ,QAAN,CAAeD,QAAQ,CAACV,KAAxB;IACH,CAFU,CAAX;IAIA,OAAO,MAAM;MACTC,aAAa,CAACW,cAAd,CAA6BJ,EAA7B;IACH,CAFD;EAGH,CARD,EAQG,CAACP,aAAD,CARH;EAUA,IAAAM,gBAAA,EAAU,MAAM;IACZ,OAAO,MAAM;MACTJ,KAAK,CAACU,kBAAN;IACH,CAFD;EAGH,CAJD,EAIG,CAACV,KAAD,CAJH;EAMA,OAAOA,KAAP;AACH;;AAAA"}
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useScrollViewReaction;
7
+
8
+ var _react = require("react");
9
+
10
+ var _InternalContext = _interopRequireDefault(require("./InternalContext"));
11
+
12
+ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
+
14
+ function useScrollViewReaction(initialIndex, coordinates) {
15
+ const scrollViewRef = (0, _react.useRef)(null);
16
+ const lastScrolledXRef = (0, _react.useRef)(NaN);
17
+ const {
18
+ indexStore
19
+ } = (0, _react.useContext)(_InternalContext.default);
20
+
21
+ const scrollToX = x => {
22
+ if (Number.isFinite(x)) {
23
+ var _scrollViewRef$curren;
24
+
25
+ (_scrollViewRef$curren = scrollViewRef.current) === null || _scrollViewRef$curren === void 0 ? void 0 : _scrollViewRef$curren.scrollTo({
26
+ x,
27
+ y: 0,
28
+ animated: true
29
+ });
30
+ lastScrolledXRef.current = x;
31
+ }
32
+ };
33
+
34
+ const onLayout = (0, _react.useCallback)(() => {
35
+ scrollToX(lastScrolledXRef.current);
36
+ }, []);
37
+ const computeNextScrollX = (0, _react.useCallback)(index => {
38
+ const prevIndex = index - 1;
39
+ const prevCoordinate = coordinates[prevIndex];
40
+
41
+ if (prevCoordinate) {
42
+ const prevTabWidth = prevCoordinate.x2 - prevCoordinate.x1;
43
+ return Math.floor(prevCoordinate.x1 + prevTabWidth / 2);
44
+ }
45
+
46
+ return 0;
47
+ }, [coordinates]);
48
+ (0, _react.useEffect)(() => {
49
+ if (Number.isNaN(lastScrolledXRef.current)) {
50
+ const x = computeNextScrollX(initialIndex);
51
+
52
+ if (x > 0) {
53
+ scrollToX(x);
54
+ }
55
+ }
56
+ }, [initialIndex, computeNextScrollX]);
57
+ (0, _react.useEffect)(() => {
58
+ return indexStore.subscribe(currentIndex => {
59
+ scrollToX(computeNextScrollX(currentIndex));
60
+ });
61
+ }, [indexStore, computeNextScrollX]);
62
+ return {
63
+ scrollViewRef,
64
+ onLayout
65
+ };
66
+ }
67
+
68
+ ;
69
+ //# sourceMappingURL=useScrollViewReaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useScrollViewReaction","initialIndex","coordinates","scrollViewRef","useRef","lastScrolledXRef","NaN","indexStore","useContext","InternalContext","scrollToX","x","Number","isFinite","current","scrollTo","y","animated","onLayout","useCallback","computeNextScrollX","index","prevIndex","prevCoordinate","prevTabWidth","x2","x1","Math","floor","useEffect","isNaN","subscribe","currentIndex"],"sources":["useScrollViewReaction.ts"],"sourcesContent":["import type { MutableRefObject } from 'react';\nimport { useCallback, useContext, useEffect, useRef } from 'react';\nimport type { ScrollView, ViewProps } from 'react-native';\nimport type TabCoordinate from './TabCoordinate';\nimport InternalContext from './InternalContext';\n\nexport interface UseScrollViewReaction {\n scrollViewRef: MutableRefObject<ScrollView | null>;\n onLayout: ViewProps['onLayout'];\n}\n\nexport default function useScrollViewReaction(\n initialIndex: number,\n coordinates: TabCoordinate[],\n): UseScrollViewReaction {\n const scrollViewRef = useRef<ScrollView | null>(null);\n\n const lastScrolledXRef = useRef<number>(NaN);\n\n const { indexStore } = useContext(InternalContext);\n\n const scrollToX = (x: number) => {\n if (Number.isFinite(x)) {\n scrollViewRef.current?.scrollTo({ x, y: 0, animated: true });\n\n lastScrolledXRef.current = x;\n }\n };\n\n const onLayout = useCallback(() => {\n scrollToX(lastScrolledXRef.current);\n }, []);\n\n const computeNextScrollX = useCallback((index: number): number => {\n const prevIndex = index - 1;\n const prevCoordinate = coordinates[prevIndex];\n\n if (prevCoordinate) {\n const prevTabWidth = prevCoordinate.x2 - prevCoordinate.x1;\n return Math.floor(prevCoordinate.x1 + prevTabWidth / 2);\n }\n\n return 0;\n }, [coordinates]);\n\n useEffect(() => {\n if (Number.isNaN(lastScrolledXRef.current)) {\n const x = computeNextScrollX(initialIndex);\n if (x > 0) {\n scrollToX(x);\n }\n }\n }, [initialIndex, computeNextScrollX]);\n\n useEffect(() => {\n return indexStore.subscribe(currentIndex => {\n scrollToX(computeNextScrollX(currentIndex));\n });\n }, [indexStore, computeNextScrollX]);\n\n return { scrollViewRef, onLayout };\n};\n"],"mappings":";;;;;;;AACA;;AAGA;;;;AAOe,SAASA,qBAAT,CACXC,YADW,EAEXC,WAFW,EAGU;EACrB,MAAMC,aAAa,GAAG,IAAAC,aAAA,EAA0B,IAA1B,CAAtB;EAEA,MAAMC,gBAAgB,GAAG,IAAAD,aAAA,EAAeE,GAAf,CAAzB;EAEA,MAAM;IAAEC;EAAF,IAAiB,IAAAC,iBAAA,EAAWC,wBAAX,CAAvB;;EAEA,MAAMC,SAAS,GAAIC,CAAD,IAAe;IAC7B,IAAIC,MAAM,CAACC,QAAP,CAAgBF,CAAhB,CAAJ,EAAwB;MAAA;;MACpB,yBAAAR,aAAa,CAACW,OAAd,gFAAuBC,QAAvB,CAAgC;QAAEJ,CAAF;QAAKK,CAAC,EAAE,CAAR;QAAWC,QAAQ,EAAE;MAArB,CAAhC;MAEAZ,gBAAgB,CAACS,OAAjB,GAA2BH,CAA3B;IACH;EACJ,CAND;;EAQA,MAAMO,QAAQ,GAAG,IAAAC,kBAAA,EAAY,MAAM;IAC/BT,SAAS,CAACL,gBAAgB,CAACS,OAAlB,CAAT;EACH,CAFgB,EAEd,EAFc,CAAjB;EAIA,MAAMM,kBAAkB,GAAG,IAAAD,kBAAA,EAAaE,KAAD,IAA2B;IAC9D,MAAMC,SAAS,GAAGD,KAAK,GAAG,CAA1B;IACA,MAAME,cAAc,GAAGrB,WAAW,CAACoB,SAAD,CAAlC;;IAEA,IAAIC,cAAJ,EAAoB;MAChB,MAAMC,YAAY,GAAGD,cAAc,CAACE,EAAf,GAAoBF,cAAc,CAACG,EAAxD;MACA,OAAOC,IAAI,CAACC,KAAL,CAAWL,cAAc,CAACG,EAAf,GAAoBF,YAAY,GAAG,CAA9C,CAAP;IACH;;IAED,OAAO,CAAP;EACH,CAV0B,EAUxB,CAACtB,WAAD,CAVwB,CAA3B;EAYA,IAAA2B,gBAAA,EAAU,MAAM;IACZ,IAAIjB,MAAM,CAACkB,KAAP,CAAazB,gBAAgB,CAACS,OAA9B,CAAJ,EAA4C;MACxC,MAAMH,CAAC,GAAGS,kBAAkB,CAACnB,YAAD,CAA5B;;MACA,IAAIU,CAAC,GAAG,CAAR,EAAW;QACPD,SAAS,CAACC,CAAD,CAAT;MACH;IACJ;EACJ,CAPD,EAOG,CAACV,YAAD,EAAemB,kBAAf,CAPH;EASA,IAAAS,gBAAA,EAAU,MAAM;IACZ,OAAOtB,UAAU,CAACwB,SAAX,CAAqBC,YAAY,IAAI;MACxCtB,SAAS,CAACU,kBAAkB,CAACY,YAAD,CAAnB,CAAT;IACH,CAFM,CAAP;EAGH,CAJD,EAIG,CAACzB,UAAD,EAAaa,kBAAb,CAJH;EAMA,OAAO;IAAEjB,aAAF;IAAiBe;EAAjB,CAAP;AACH;;AAAA"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = useTabCoordinates;
7
+
8
+ var _react = require("react");
9
+
10
+ var _utils = require("./utils");
11
+
12
+ function useTabCoordinates(tabElements) {
13
+ const [coordinates, setCoordinates] = (0, _react.useState)([]);
14
+ const cacheRef = (0, _react.useRef)([]);
15
+
16
+ const updateCoordinate = (index, x, width) => {
17
+ cacheRef.current[index] = {
18
+ x1: x,
19
+ x2: x + width
20
+ };
21
+
22
+ if ((0, _utils.isEveryTabCoordinatesDefined)(cacheRef.current, tabElements)) {
23
+ setCoordinates([...cacheRef.current]);
24
+ cacheRef.current = [];
25
+ }
26
+ };
27
+
28
+ return [coordinates, updateCoordinate];
29
+ }
30
+ //# sourceMappingURL=useTabCoordinates.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useTabCoordinates","tabElements","coordinates","setCoordinates","useState","cacheRef","useRef","updateCoordinate","index","x","width","current","x1","x2","isEveryTabCoordinatesDefined"],"sources":["useTabCoordinates.ts"],"sourcesContent":["import React, { useRef, useState } from 'react';\nimport TabCoordinate from './TabCoordinate';\nimport { isEveryTabCoordinatesDefined } from './utils';\n\nexport interface UpdateCoordinate {\n (index: number, x: number, width: number): void;\n}\n\nexport default function useTabCoordinates(tabElements: React.ReactNode): [TabCoordinate[], UpdateCoordinate] {\n const [coordinates, setCoordinates] = useState<TabCoordinate[]>([]);\n\n const cacheRef = useRef<TabCoordinate[]>([]);\n\n const updateCoordinate: UpdateCoordinate = (index, x, width) => {\n cacheRef.current[index] = { x1: x, x2: x + width };\n\n if (isEveryTabCoordinatesDefined(cacheRef.current, tabElements)) {\n setCoordinates([...cacheRef.current]);\n\n cacheRef.current = [];\n }\n };\n\n return [coordinates, updateCoordinate];\n}\n"],"mappings":";;;;;;;AAAA;;AAEA;;AAMe,SAASA,iBAAT,CAA2BC,WAA3B,EAA8F;EACzG,MAAM,CAACC,WAAD,EAAcC,cAAd,IAAgC,IAAAC,eAAA,EAA0B,EAA1B,CAAtC;EAEA,MAAMC,QAAQ,GAAG,IAAAC,aAAA,EAAwB,EAAxB,CAAjB;;EAEA,MAAMC,gBAAkC,GAAG,CAACC,KAAD,EAAQC,CAAR,EAAWC,KAAX,KAAqB;IAC5DL,QAAQ,CAACM,OAAT,CAAiBH,KAAjB,IAA0B;MAAEI,EAAE,EAAEH,CAAN;MAASI,EAAE,EAAEJ,CAAC,GAAGC;IAAjB,CAA1B;;IAEA,IAAI,IAAAI,mCAAA,EAA6BT,QAAQ,CAACM,OAAtC,EAA+CV,WAA/C,CAAJ,EAAiE;MAC7DE,cAAc,CAAC,CAAC,GAAGE,QAAQ,CAACM,OAAb,CAAD,CAAd;MAEAN,QAAQ,CAACM,OAAT,GAAmB,EAAnB;IACH;EACJ,CARD;;EAUA,OAAO,CAACT,WAAD,EAAcK,gBAAd,CAAP;AACH"}
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.default = void 0;
7
+
8
+ var _react = require("react");
9
+
10
+ var _utils = require("./utils");
11
+
12
+ const useTabInnerContentsWidth = tabElements => {
13
+ const [innerContentsWidthList, setInnerContentsWidth] = (0, _react.useState)([]);
14
+ const cacheRef = (0, _react.useRef)([]);
15
+
16
+ const updateInnerContentsWidth = (index, width) => {
17
+ cacheRef.current[index] = width;
18
+
19
+ if ((0, _utils.isEveryTabCoordinatesDefined)(cacheRef.current, tabElements)) {
20
+ setInnerContentsWidth([...cacheRef.current]);
21
+ cacheRef.current = [];
22
+ }
23
+ };
24
+
25
+ return [innerContentsWidthList, updateInnerContentsWidth];
26
+ };
27
+
28
+ var _default = useTabInnerContentsWidth;
29
+ exports.default = _default;
30
+ //# sourceMappingURL=useTabInnerContentsWidth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["useTabInnerContentsWidth","tabElements","innerContentsWidthList","setInnerContentsWidth","useState","cacheRef","useRef","updateInnerContentsWidth","index","width","current","isEveryTabCoordinatesDefined"],"sources":["useTabInnerContentsWidth.ts"],"sourcesContent":["import React, { useRef, useState } from 'react';\nimport { isEveryTabCoordinatesDefined } from './utils';\n\nexport interface UpdateInnerContentsWidth {\n (index: number, width: number): void;\n}\n\nconst useTabInnerContentsWidth = (tabElements: React.ReactNode): [number[], UpdateInnerContentsWidth] => {\n const [innerContentsWidthList, setInnerContentsWidth] = useState<number[]>([]);\n\n const cacheRef = useRef<number[]>([]);\n\n const updateInnerContentsWidth: UpdateInnerContentsWidth = (index, width) => {\n cacheRef.current[index] = width;\n\n if (isEveryTabCoordinatesDefined(cacheRef.current, tabElements)) {\n setInnerContentsWidth([...cacheRef.current]);\n\n cacheRef.current = [];\n }\n };\n\n return [innerContentsWidthList, updateInnerContentsWidth];\n};\n\nexport default useTabInnerContentsWidth;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAMA,MAAMA,wBAAwB,GAAIC,WAAD,IAAwE;EACrG,MAAM,CAACC,sBAAD,EAAyBC,qBAAzB,IAAkD,IAAAC,eAAA,EAAmB,EAAnB,CAAxD;EAEA,MAAMC,QAAQ,GAAG,IAAAC,aAAA,EAAiB,EAAjB,CAAjB;;EAEA,MAAMC,wBAAkD,GAAG,CAACC,KAAD,EAAQC,KAAR,KAAkB;IACzEJ,QAAQ,CAACK,OAAT,CAAiBF,KAAjB,IAA0BC,KAA1B;;IAEA,IAAI,IAAAE,mCAAA,EAA6BN,QAAQ,CAACK,OAAtC,EAA+CT,WAA/C,CAAJ,EAAiE;MAC7DE,qBAAqB,CAAC,CAAC,GAAGE,QAAQ,CAACK,OAAb,CAAD,CAArB;MAEAL,QAAQ,CAACK,OAAT,GAAmB,EAAnB;IACH;EACJ,CARD;;EAUA,OAAO,CAACR,sBAAD,EAAyBK,wBAAzB,CAAP;AACH,CAhBD;;eAkBeP,wB"}
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.isEveryTabCoordinatesDefined = isEveryTabCoordinatesDefined;
7
+
8
+ var _react = require("react");
9
+
10
+ var _utils = require("@fountain-ui/utils");
11
+
12
+ function isEveryTabCoordinatesDefined(coordinates, tabElements) {
13
+ const numberOfTabs = _react.Children.count(tabElements);
14
+
15
+ const numberOfCoordinates = coordinates.length;
16
+ const everyCoordinatesDefined = (0, _utils.isEveryDefined)(coordinates);
17
+ return numberOfTabs === numberOfCoordinates && everyCoordinatesDefined;
18
+ }
19
+ //# sourceMappingURL=utils.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["isEveryTabCoordinatesDefined","coordinates","tabElements","numberOfTabs","Children","count","numberOfCoordinates","length","everyCoordinatesDefined","isEveryDefined"],"sources":["utils.ts"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { Children } from 'react';\nimport { isEveryDefined } from '@fountain-ui/utils';\nimport type TabCoordinate from './TabCoordinate';\n\n\nexport function isEveryTabCoordinatesDefined(coordinates: (TabCoordinate | number)[], tabElements: ReactNode): boolean {\n const numberOfTabs = Children.count(tabElements);\n const numberOfCoordinates = coordinates.length;\n\n const everyCoordinatesDefined = isEveryDefined(coordinates);\n\n return numberOfTabs === numberOfCoordinates && everyCoordinatesDefined;\n}\n"],"mappings":";;;;;;;AACA;;AACA;;AAIO,SAASA,4BAAT,CAAsCC,WAAtC,EAA+EC,WAA/E,EAAgH;EACnH,MAAMC,YAAY,GAAGC,eAAA,CAASC,KAAT,CAAeH,WAAf,CAArB;;EACA,MAAMI,mBAAmB,GAAGL,WAAW,CAACM,MAAxC;EAEA,MAAMC,uBAAuB,GAAG,IAAAC,qBAAA,EAAeR,WAAf,CAAhC;EAEA,OAAOE,YAAY,KAAKG,mBAAjB,IAAwCE,uBAA/C;AACH"}
@@ -83,6 +83,9 @@ const InputLabel = props => {
83
83
  })
84
84
  }]
85
85
  };
86
+ const labelTextFontStyle = (0, _styles.createFontStyle)(theme, {
87
+ selector: typo => typo.caption2
88
+ });
86
89
  const labelStyle = {
87
90
  fontSize,
88
91
  transform: [{
@@ -121,7 +124,7 @@ const InputLabel = props => {
121
124
  }]
122
125
  }), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.Text, {
123
126
  key: 'labelBackground-text',
124
- style: [styles.placeholder, styles.backgroundText, backgroundStyle, labelStyle, {
127
+ style: [labelTextFontStyle, styles.placeholder, styles.backgroundText, backgroundStyle, labelStyle, {
125
128
  top: topPosition + 1,
126
129
  opacity,
127
130
  transform: [...labelStyle.transform, {
@@ -134,7 +137,7 @@ const InputLabel = props => {
134
137
  numberOfLines: 1
135
138
  }, label)], /*#__PURE__*/_react.default.createElement(_reactNative.Animated.Text, {
136
139
  onLayout: onLayoutAnimatedText,
137
- style: [styles.placeholder, labelStyle, paddingOffset, {
140
+ style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
138
141
  textAlign: 'left',
139
142
  top: topPosition,
140
143
  color: error && errorColor ? errorColor : activeColor,
@@ -145,7 +148,7 @@ const InputLabel = props => {
145
148
  }],
146
149
  numberOfLines: 1
147
150
  }, label), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.Text, {
148
- style: [styles.placeholder, labelStyle, paddingOffset, {
151
+ style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
149
152
  textAlign: 'left',
150
153
  top: topPosition,
151
154
  color: error && errorColor ? errorColor : placeholderColor,
@@ -1 +1 @@
1
- {"version":3,"names":["useStyles","background","position","top","left","bottom","right","width","height","backgroundText","paddingHorizontal","color","placeholder","inputPaddingHorizontal","InputLabel","props","activeColor","animatedError","animatedLabel","error","errorColor","focused","fontSize","hasActiveOutline","label","labelLayout","labelScale","labelTranslateX","labelTranslateY","onLayoutAnimatedText","paddingOffset","placeholderColor","placeholderOpacity","topPosition","value","theme","useTheme","styles","paperStyles","usePaperStyles","backgroundStyle","backgroundColor","palette","default","hasFocus","opacity","interpolate","inputRange","outputRange","labelTranslationX","transform","translateX","labelStyle","translateY","scale","StyleSheet","absoluteFill","measured","scaleY","textAlign"],"sources":["InputLabel.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, StyleSheet } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { useTheme } from '../styles';\nimport usePaperStyles from '../Paper/usePaperStyles';\nimport { inputPaddingHorizontal } from './utils';\n\ninterface LabelProps {\n activeColor: string;\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n error?: boolean;\n errorColor?: string;\n focused?: boolean;\n fontSize?: number;\n hasActiveOutline?: boolean;\n label?: string;\n labelLayout: { measured: boolean; width: number; height: number };\n labelScale: number;\n labelTranslateX: number;\n labelTranslateY: number;\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n paddingOffset?: { paddingLeft: number; paddingRight: number };\n placeholder?: string;\n placeholderColor?: string;\n placeholderOpacity: number | Animated.AnimatedInterpolation;\n topPosition: number;\n value?: string;\n}\n\ntype InputLabelStyles = NamedStylesStringUnion<'background' | 'backgroundText' | 'placeholder'>;\n\nconst useStyles: UseStyles<InputLabelStyles> = function (): InputLabelStyles {\n return {\n background: {\n position: 'absolute',\n top: 6,\n left: 10,\n bottom: 0,\n right: 0,\n width: 8,\n height: 4,\n },\n backgroundText: {\n position: 'absolute',\n left: 18,\n paddingHorizontal: 0,\n color: 'transparent',\n },\n placeholder: {\n position: 'absolute',\n left: 0,\n paddingHorizontal: inputPaddingHorizontal,\n },\n };\n};\n\nconst InputLabel = (props: LabelProps) => {\n const {\n activeColor,\n animatedError,\n animatedLabel,\n error = false,\n errorColor,\n focused,\n fontSize,\n hasActiveOutline,\n label,\n labelLayout,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n paddingOffset,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const paperStyles = usePaperStyles();\n\n const backgroundStyle = {\n backgroundColor: paperStyles?.backgroundColor ?? theme.palette.background.default,\n };\n\n const hasFocus = hasActiveOutline || value;\n const opacity = animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasFocus ? 1 : 0, 0],\n });\n\n const labelTranslationX = {\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateX, 0 || 0],\n }),\n },\n ],\n };\n\n const labelStyle = {\n fontSize,\n transform: [\n {\n translateX: animatedError.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [0, value && error ? 4 : 0, 0],\n }),\n },\n {\n translateY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateY, 0],\n }),\n },\n {\n scale: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelScale, 1],\n }),\n },\n ],\n };\n\n return (label ? (\n <Animated.View\n pointerEvents={'none'}\n style={[\n StyleSheet.absoluteFill,\n {\n opacity: value || focused ? (labelLayout.measured ? 1 : 0) : 1,\n },\n labelTranslationX,\n ]}\n >\n {[\n <Animated.View\n key={'labelBackground-view'}\n pointerEvents={'none'}\n style={[\n styles.background,\n backgroundStyle,\n {\n opacity,\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [-labelTranslateX, 0],\n }),\n },\n ],\n },\n ]}\n />,\n <Animated.Text\n key={'labelBackground-text'}\n style={[\n styles.placeholder,\n styles.backgroundText,\n backgroundStyle,\n labelStyle,\n {\n top: topPosition + 1,\n opacity,\n transform: [\n ...labelStyle.transform,\n {\n scaleY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [0.2, 1],\n }),\n },\n ],\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>,\n ]}\n <Animated.Text\n onLayout={onLayoutAnimatedText}\n style={[\n styles.placeholder,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : activeColor,\n opacity: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 1 : 0, 0],\n }),\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n <Animated.Text\n style={[\n styles.placeholder,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : placeholderColor,\n opacity: placeholderOpacity,\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n </Animated.View>\n ) : null);\n};\n\nexport default InputLabel;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;AA2BA,MAAMA,SAAsC,GAAG,YAA8B;EACzE,OAAO;IACHC,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3B,aAAa,CAAC4B,WAAd,CAA0B;QAC/BC,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADmB;QAE/BC,WAAW,EAAE,CAACzB,gBAAgB,GAAG,CAAH,GAAO,CAAxB,EAA2B,CAA3B;MAFkB,CAA1B;IAJb,CAJG,CAFX;IAgBI,aAAa,EAAE;EAhBnB,GAkBKC,KAlBL,CAxDJ,eA4EI,6BAAC,qBAAD,CAAU,IAAV;IACI,KAAK,EAAE,CACHa,MAAM,CAACzB,WADJ,EAEHwC,UAFG,EAGHtB,aAHG,EAIH;MACI6B,SAAS,EAAE,MADf;MAEIxD,GAAG,EAAE8B,WAFT;MAGItB,KAAK,EAAEQ,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCW,gBAH9C;MAIIc,OAAO,EAAEb;IAJb,CAJG,CADX;IAYI,aAAa,EAAE;EAZnB,GAcKR,KAdL,CA5EJ,CADS,GA8FT,IA9FJ;AA+FH,CAzKD;;eA2KeV,U"}
1
+ {"version":3,"names":["useStyles","background","position","top","left","bottom","right","width","height","backgroundText","paddingHorizontal","color","placeholder","inputPaddingHorizontal","InputLabel","props","activeColor","animatedError","animatedLabel","error","errorColor","focused","fontSize","hasActiveOutline","label","labelLayout","labelScale","labelTranslateX","labelTranslateY","onLayoutAnimatedText","paddingOffset","placeholderColor","placeholderOpacity","topPosition","value","theme","useTheme","styles","paperStyles","usePaperStyles","backgroundStyle","backgroundColor","palette","default","hasFocus","opacity","interpolate","inputRange","outputRange","labelTranslationX","transform","translateX","labelTextFontStyle","createFontStyle","selector","typo","caption2","labelStyle","translateY","scale","StyleSheet","absoluteFill","measured","scaleY","textAlign"],"sources":["InputLabel.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, StyleSheet } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, useTheme } from '../styles';\nimport usePaperStyles from '../Paper/usePaperStyles';\nimport { inputPaddingHorizontal } from './utils';\n\ninterface LabelProps {\n activeColor: string;\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n error?: boolean;\n errorColor?: string;\n focused?: boolean;\n fontSize?: number;\n hasActiveOutline?: boolean;\n label?: string;\n labelLayout: { measured: boolean; width: number; height: number };\n labelScale: number;\n labelTranslateX: number;\n labelTranslateY: number;\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n paddingOffset?: { paddingLeft: number; paddingRight: number };\n placeholder?: string;\n placeholderColor?: string;\n placeholderOpacity: number | Animated.AnimatedInterpolation;\n topPosition: number;\n value?: string;\n}\n\ntype InputLabelStyles = NamedStylesStringUnion<'background' | 'backgroundText' | 'placeholder'>;\n\nconst useStyles: UseStyles<InputLabelStyles> = function (): InputLabelStyles {\n return {\n background: {\n position: 'absolute',\n top: 6,\n left: 10,\n bottom: 0,\n right: 0,\n width: 8,\n height: 4,\n },\n backgroundText: {\n position: 'absolute',\n left: 18,\n paddingHorizontal: 0,\n color: 'transparent',\n },\n placeholder: {\n position: 'absolute',\n left: 0,\n paddingHorizontal: inputPaddingHorizontal,\n },\n };\n};\n\nconst InputLabel = (props: LabelProps) => {\n const {\n activeColor,\n animatedError,\n animatedLabel,\n error = false,\n errorColor,\n focused,\n fontSize,\n hasActiveOutline,\n label,\n labelLayout,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n paddingOffset,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const paperStyles = usePaperStyles();\n\n const backgroundStyle = {\n backgroundColor: paperStyles?.backgroundColor ?? theme.palette.background.default,\n };\n\n const hasFocus = hasActiveOutline || value;\n const opacity = animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasFocus ? 1 : 0, 0],\n });\n\n const labelTranslationX = {\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateX, 0 || 0],\n }),\n },\n ],\n };\n\n const labelTextFontStyle = createFontStyle(theme, { selector: (typo) => typo.caption2 });\n\n const labelStyle = {\n fontSize,\n transform: [\n {\n translateX: animatedError.interpolate({\n inputRange: [0, 0.5, 1],\n outputRange: [0, value && error ? 4 : 0, 0],\n }),\n },\n {\n translateY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelTranslateY, 0],\n }),\n },\n {\n scale: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [labelScale, 1],\n }),\n },\n ],\n };\n\n return (label ? (\n <Animated.View\n pointerEvents={'none'}\n style={[\n StyleSheet.absoluteFill,\n {\n opacity: value || focused ? (labelLayout.measured ? 1 : 0) : 1,\n },\n labelTranslationX,\n ]}\n >\n {[\n <Animated.View\n key={'labelBackground-view'}\n pointerEvents={'none'}\n style={[\n styles.background,\n backgroundStyle,\n {\n opacity,\n transform: [\n {\n translateX: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [-labelTranslateX, 0],\n }),\n },\n ],\n },\n ]}\n />,\n <Animated.Text\n key={'labelBackground-text'}\n style={[\n labelTextFontStyle,\n styles.placeholder,\n styles.backgroundText,\n backgroundStyle,\n labelStyle,\n {\n top: topPosition + 1,\n opacity,\n transform: [\n ...labelStyle.transform,\n {\n scaleY: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [0.2, 1],\n }),\n },\n ],\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>,\n ]}\n <Animated.Text\n onLayout={onLayoutAnimatedText}\n style={[\n styles.placeholder,\n labelTextFontStyle,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : activeColor,\n opacity: animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 1 : 0, 0],\n }),\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n <Animated.Text\n style={[\n styles.placeholder,\n labelTextFontStyle,\n labelStyle,\n paddingOffset,\n {\n textAlign: 'left',\n top: topPosition,\n color: error && errorColor ? errorColor : placeholderColor,\n opacity: placeholderOpacity,\n },\n ]}\n numberOfLines={1}\n >\n {label}\n </Animated.Text>\n </Animated.View>\n ) : null);\n};\n\nexport default InputLabel;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AACA;;;;AA2BA,MAAMA,SAAsC,GAAG,YAA8B;EACzE,OAAO;IACHC,UAAU,EAAE;MACRC,QAAQ,EAAE,UADF;MAERC,GAAG,EAAE,CAFG;MAGRC,IAAI,EAAE,EAHE;MAIRC,MAAM,EAAE,CAJA;MAKRC,KAAK,EAAE,CALC;MAMRC,KAAK,EAAE,CANC;MAORC,MAAM,EAAE;IAPA,CADT;IAUHC,cAAc,EAAE;MACZP,QAAQ,EAAE,UADE;MAEZE,IAAI,EAAE,EAFM;MAGZM,iBAAiB,EAAE,CAHP;MAIZC,KAAK,EAAE;IAJK,CAVb;IAgBHC,WAAW,EAAE;MACTV,QAAQ,EAAE,UADD;MAETE,IAAI,EAAE,CAFG;MAGTM,iBAAiB,EAAEG;IAHV;EAhBV,CAAP;AAsBH,CAvBD;;AAyBA,MAAMC,UAAU,GAAIC,KAAD,IAAuB;EACtC,MAAM;IACFC,WADE;IAEFC,aAFE;IAGFC,aAHE;IAIFC,KAAK,GAAG,KAJN;IAKFC,UALE;IAMFC,OANE;IAOFC,QAPE;IAQFC,gBARE;IASFC,KATE;IAUFC,WAVE;IAWFC,UAXE;IAYFC,eAZE;IAaFC,eAbE;IAcFC,oBAdE;IAeFC,aAfE;IAgBFC,gBAhBE;IAiBFC,kBAjBE;IAkBFC,WAlBE;IAmBFC;EAnBE,IAoBFnB,KApBJ;EAsBA,MAAMoB,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,MAAMC,MAAM,GAAGrC,SAAS,EAAxB;EAEA,MAAMsC,WAAW,GAAG,IAAAC,uBAAA,GAApB;EAEA,MAAMC,eAAe,GAAG;IACpBC,eAAe,EAAE,CAAAH,WAAW,SAAX,I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,GAAD,EAAM,CAAN;QAFiB,CAA1B;MADZ,CAFO;IAHf,CANG,CAFX;IAsBI,aAAa,EAAE;EAtBnB,GAwBKxB,KAxBL,CApBH,CAVL,eAyDI,6BAAC,qBAAD,CAAU,IAAV;IACI,QAAQ,EAAEK,oBADd;IAEI,KAAK,EAAE,CACHQ,MAAM,CAACzB,WADJ,EAEHwC,kBAFG,EAGHK,UAHG,EAIH3B,aAJG,EAKH;MACIkC,SAAS,EAAE,MADf;MAEI7D,GAAG,EAAE8B,WAFT;MAGItB,KAAK,EAAEQ,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCJ,WAH9C;MAII6B,OAAO,EAAE3B,aAAa,CAAC4B,WAAd,CAA0B;QAC/BC,UAAU,EAAE,CAAC,CAAD,EAAI,CAAJ,CADmB;QAE/BC,WAAW,EAAE,CAACzB,gBAAgB,GAAG,CAAH,GAAO,CAAxB,EAA2B,CAA3B;MAFkB,CAA1B;IAJb,CALG,CAFX;IAiBI,aAAa,EAAE;EAjBnB,GAmBKC,KAnBL,CAzDJ,eA8EI,6BAAC,qBAAD,CAAU,IAAV;IACI,KAAK,EAAE,CACHa,MAAM,CAACzB,WADJ,EAEHwC,kBAFG,EAGHK,UAHG,EAIH3B,aAJG,EAKH;MACIkC,SAAS,EAAE,MADf;MAEI7D,GAAG,EAAE8B,WAFT;MAGItB,KAAK,EAAEQ,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCW,gBAH9C;MAIIc,OAAO,EAAEb;IAJb,CALG,CADX;IAaI,aAAa,EAAE;EAbnB,GAeKR,KAfL,CA9EJ,CADS,GAiGT,IAjGJ;AAkGH,CA9KD;;eAgLeV,U"}
@@ -78,7 +78,7 @@ const OutlinedTextField = /*#__PURE__*/_react.default.forwardRef(function Outlin
78
78
  const inputTextColor = disabled ? theme.palette.tertiary.main : theme.palette.primary.main;
79
79
  const activeColor = error ? theme.palette.warning.main : disabled ? theme.palette.tertiary.main : theme.palette.accent.main;
80
80
  const placeholderColor = disabled ? theme.palette.tertiary.main : theme.palette.text.hint;
81
- const outlineColor = disabled ? theme.palette.border : theme.palette.border;
81
+ const outlineColor = theme.palette.border.default;
82
82
  const errorColor = disabled ? theme.palette.tertiary.main : theme.palette.warning.main;
83
83
  const typography = theme.typography.body2;
84
84
  const fontSize = typography.fontSize.unitless;
@@ -112,12 +112,16 @@ const OutlinedTextField = /*#__PURE__*/_react.default.forwardRef(function Outlin
112
112
  placeholderOpacity,
113
113
  topPosition
114
114
  };
115
+ const inputTextFontStyle = (0, _styles.createFontStyle)(theme, {
116
+ selector: typo => typo.caption2,
117
+ color: inputTextColor
118
+ });
115
119
  const outlineStyle = (0, _styles.css)([styles.outline, {
116
120
  borderWidth: hasActiveOutline ? 2 : 1,
117
121
  borderColor: error ? errorColor : hasActiveOutline ? activeColor : outlineColor,
118
122
  top: label ? 6 : 0
119
123
  }]);
120
- const textInputStyle = (0, _styles.css)([styles.input, {
124
+ const textInputStyle = (0, _styles.css)([inputTextFontStyle, styles.input, {
121
125
  fontSize,
122
126
  color: inputTextColor,
123
127
  height: inputHeight
@@ -1 +1 @@
1
- {"version":3,"names":["useStyles","theme","useTheme","outline","position","left","right","bottom","borderRadius","shape","roundness","input","flexGrow","paddingHorizontal","inputPaddingHorizontal","textAlignVertical","textAlign","zIndex","textField","iconContainer","width","height","justifyContent","alignItems","OutlinedTextField","React","forwardRef","props","ref","animatedError","animatedLabel","disabled","error","focused","forceFocus","icon","keyboardType","label","labelLayout","onBlur","onChangeText","onFocus","onIconPress","onLayoutAnimatedText","onSubmitEditing","placeholder","secureTextEntry","style","value","styles","hasActiveOutline","inputTextColor","palette","tertiary","main","primary","activeColor","warning","accent","placeholderColor","text","hint","outlineColor","border","errorColor","typography","body2","fontSize","unitless","labelScale","labelFontSize","labelWidth","labelHeight","labelHalfWidth","labelHalfHeight","labelTranslateX","minInputHeight","defaultHeight","labelPaddingTop","inputHeight","topPosition","Math","floor","iconTopPosition","iconSize","labelYOffset","labelTranslateY","placeholderOpacity","interpolate","inputRange","outputRange","measured","labelProps","outlineStyle","css","borderWidth","borderColor","top","textInputStyle","color","marginRight","paddingRight","Platform","OS","outlineWidth","containerStyle","paddingTop","minHeight","iconContainerStyle","onIconButtonPress"],"sources":["OutlinedTextField.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, Platform, TextInput, View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { css, useTheme } from '../styles';\nimport IconButton from '../IconButton';\nimport TextFieldProps from './TextFieldProps';\nimport InputLabel from './InputLabel';\nimport {\n defaultHeight,\n iconSize,\n inputPaddingHorizontal,\n labelFontSize,\n labelPaddingTop,\n labelYOffset,\n} from './utils';\n\ninterface OutlinedTextFieldProps extends TextFieldProps {\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n focused: boolean;\n forceFocus: () => void;\n labelLayout: { measured: boolean; width: number; height: number };\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n}\n\ntype OutlinedTextFieldStyles = NamedStylesStringUnion<'outline' | 'input' | 'iconContainer'>;\n\nconst useStyles: UseStyles<OutlinedTextFieldStyles> = function (): OutlinedTextFieldStyles {\n const theme = useTheme();\n\n return {\n outline: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: theme.shape.roundness,\n },\n input: {\n flexGrow: 1,\n paddingHorizontal: inputPaddingHorizontal,\n textAlignVertical: 'center',\n textAlign: 'left',\n zIndex: theme.zIndex.textField,\n },\n iconContainer: {\n position: 'absolute',\n width: 24,\n height: 24,\n justifyContent: 'center',\n alignItems: 'center',\n right: 12,\n },\n };\n};\n\nconst OutlinedTextField = React.forwardRef<TextInput, OutlinedTextFieldProps>(function OutlinedTextField(props, ref) {\n const {\n animatedError,\n animatedLabel,\n disabled,\n error,\n focused,\n forceFocus,\n icon,\n keyboardType,\n label,\n labelLayout,\n onBlur,\n onChangeText,\n onFocus,\n onIconPress,\n onLayoutAnimatedText,\n onSubmitEditing,\n placeholder,\n secureTextEntry,\n style,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const hasActiveOutline = focused || error;\n const inputTextColor = disabled ? theme.palette.tertiary.main : theme.palette.primary.main;\n const activeColor = error\n ? theme.palette.warning.main\n : disabled\n ? theme.palette.tertiary.main\n : theme.palette.accent.main;\n const placeholderColor = disabled ? theme.palette.tertiary.main : theme.palette.text.hint;\n const outlineColor = disabled ? theme.palette.border : theme.palette.border;\n const errorColor = disabled ? theme.palette.tertiary.main : theme.palette.warning.main;\n\n const typography = theme.typography.body2;\n const fontSize = typography.fontSize.unitless;\n\n const labelScale = labelFontSize / fontSize;\n const labelWidth = labelLayout.width;\n const labelHeight = labelLayout.height;\n const labelHalfWidth = labelWidth / 2;\n const labelHalfHeight = labelHeight / 2;\n\n const labelTranslateX = -1 * (labelHalfWidth - (labelScale * labelWidth) / 2 - (fontSize - labelFontSize) * labelScale);\n const minInputHeight = defaultHeight - labelPaddingTop;\n const inputHeight = labelHeight < minInputHeight ? minInputHeight : labelHeight;\n const topPosition = Math.floor(((inputHeight > 0 ? inputHeight : 0) - labelHeight) / 2 + labelPaddingTop);\n const iconTopPosition = (defaultHeight - (label ? 0 : labelPaddingTop) - iconSize - (label ? labelYOffset : 0)) / 2;\n const labelTranslateY = -labelHalfHeight - (topPosition + labelYOffset);\n\n const placeholderOpacity = hasActiveOutline\n ? animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 0 : 1, 1],\n })\n : labelLayout.measured ? 1 : 0;\n\n const labelProps = {\n activeColor,\n error,\n errorColor,\n fontSize,\n hasActiveOutline,\n label,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n };\n\n const outlineStyle = css([\n styles.outline,\n {\n borderWidth: hasActiveOutline ? 2 : 1,\n borderColor: error ? errorColor : (hasActiveOutline ? activeColor : outlineColor),\n top: label ? 6 : 0,\n },\n ]);\n\n const textInputStyle = css([\n styles.input,\n {\n fontSize,\n color: inputTextColor,\n height: inputHeight,\n },\n icon && {\n marginRight: iconSize + 20,\n paddingRight: 0,\n },\n Platform.OS === 'web' && {\n //@ts-ignore\n outlineWidth: 0,\n },\n ]);\n\n const containerStyle = css([\n {\n paddingTop: label ? labelPaddingTop : 0,\n minHeight: label ? defaultHeight : defaultHeight + labelYOffset,\n },\n ]);\n\n const iconContainerStyle = css([\n styles.iconContainer,\n { top: iconTopPosition },\n ]);\n\n const onIconButtonPress = () => {\n forceFocus();\n onIconPress?.();\n };\n\n return (\n <View style={style}>\n <View\n pointerEvents={'none'}\n style={outlineStyle}\n />\n <View style={containerStyle}>\n {label ? (\n <InputLabel\n animatedLabel={animatedLabel}\n animatedError={animatedError}\n focused={focused}\n labelLayout={labelLayout}\n placeholder={placeholder}\n value={value}\n {...labelProps}\n />\n ) : null}\n <TextInput\n autoCapitalize={'none'}\n autoCorrect={false}\n disableFullscreenUI={true}\n ref={ref}\n onChangeText={onChangeText}\n placeholder={placeholder}\n placeholderTextColor={placeholderColor}\n editable={!disabled}\n selectionColor={activeColor}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmitEditing={onSubmitEditing}\n keyboardType={keyboardType}\n secureTextEntry={secureTextEntry}\n underlineColorAndroid={'transparent'}\n style={textInputStyle}\n value={value}\n />\n </View>\n {icon ? (\n <View style={iconContainerStyle}>\n <IconButton\n children={icon}\n onPress={onIconButtonPress}\n />\n </View>\n ) : null}\n </View>\n );\n});\n\nexport default OutlinedTextField;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;AAoBA,MAAMA,SAA6C,GAAG,YAAqC;EACvF,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,OAAO,EAAE;MACLC,QAAQ,EAAE,UADL;MAELC,IAAI,EAAE,CAFD;MAGLC,KAAK,EAAE,CAHF;MAILC,MAAM,EAAE,CAJ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ALlB;IAMI,WAAW,EAAEK,WANjB;IAOI,oBAAoB,EAAEc,gBAP1B;IAQI,QAAQ,EAAE,CAAC5B,QARf;IASI,cAAc,EAAEyB,WATpB;IAUI,OAAO,EAAEf,OAVb;IAWI,MAAM,EAAEF,MAXZ;IAYI,eAAe,EAAEK,eAZrB;IAaI,YAAY,EAAER,YAblB;IAcI,eAAe,EAAEU,eAdrB;IAeI,qBAAqB,EAAE,aAf3B;IAgBI,KAAK,EAAEoD,cAhBX;IAiBI,KAAK,EAAElD;EAjBX,EAZJ,CALJ,EAqCKb,IAAI,gBACD,6BAAC,iBAAD;IAAM,KAAK,EAAEyE;EAAb,gBACI,6BAAC,mBAAD;IACI,QAAQ,EAAEzE,IADd;IAEI,OAAO,EAAE0E;EAFb,EADJ,CADC,GAOD,IA5CR,CADJ;AAgDH,CAzKyB,CAA1B;;eA2KerF,iB"}
1
+ {"version":3,"names":["useStyles","theme","useTheme","outline","position","left","right","bottom","borderRadius","shape","roundness","input","flexGrow","paddingHorizontal","inputPaddingHorizontal","textAlignVertical","textAlign","zIndex","textField","iconContainer","width","height","justifyContent","alignItems","OutlinedTextField","React","forwardRef","props","ref","animatedError","animatedLabel","disabled","error","focused","forceFocus","icon","keyboardType","label","labelLayout","onBlur","onChangeText","onFocus","onIconPress","onLayoutAnimatedText","onSubmitEditing","placeholder","secureTextEntry","style","value","styles","hasActiveOutline","inputTextColor","palette","tertiary","main","primary","activeColor","warning","accent","placeholderColor","text","hint","outlineColor","border","default","errorColor","typography","body2","fontSize","unitless","labelScale","labelFontSize","labelWidth","labelHeight","labelHalfWidth","labelHalfHeight","labelTranslateX","minInputHeight","defaultHeight","labelPaddingTop","inputHeight","topPosition","Math","floor","iconTopPosition","iconSize","labelYOffset","labelTranslateY","placeholderOpacity","interpolate","inputRange","outputRange","measured","labelProps","inputTextFontStyle","createFontStyle","selector","typo","caption2","color","outlineStyle","css","borderWidth","borderColor","top","textInputStyle","marginRight","paddingRight","Platform","OS","outlineWidth","containerStyle","paddingTop","minHeight","iconContainerStyle","onIconButtonPress"],"sources":["OutlinedTextField.tsx"],"sourcesContent":["import React from 'react';\nimport { Animated, LayoutChangeEvent, Platform, TextInput, View } from 'react-native';\nimport { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';\nimport { createFontStyle, css, useTheme } from '../styles';\nimport IconButton from '../IconButton';\nimport TextFieldProps from './TextFieldProps';\nimport InputLabel from './InputLabel';\nimport {\n defaultHeight,\n iconSize,\n inputPaddingHorizontal,\n labelFontSize,\n labelPaddingTop,\n labelYOffset,\n} from './utils';\n\ninterface OutlinedTextFieldProps extends TextFieldProps {\n animatedError: Animated.Value;\n animatedLabel: Animated.Value;\n focused: boolean;\n forceFocus: () => void;\n labelLayout: { measured: boolean; width: number; height: number };\n onLayoutAnimatedText: (event: LayoutChangeEvent) => void;\n}\n\ntype OutlinedTextFieldStyles = NamedStylesStringUnion<'outline' | 'input' | 'iconContainer'>;\n\nconst useStyles: UseStyles<OutlinedTextFieldStyles> = function (): OutlinedTextFieldStyles {\n const theme = useTheme();\n\n return {\n outline: {\n position: 'absolute',\n left: 0,\n right: 0,\n bottom: 0,\n borderRadius: theme.shape.roundness,\n },\n input: {\n flexGrow: 1,\n paddingHorizontal: inputPaddingHorizontal,\n textAlignVertical: 'center',\n textAlign: 'left',\n zIndex: theme.zIndex.textField,\n },\n iconContainer: {\n position: 'absolute',\n width: 24,\n height: 24,\n justifyContent: 'center',\n alignItems: 'center',\n right: 12,\n },\n };\n};\n\nconst OutlinedTextField = React.forwardRef<TextInput, OutlinedTextFieldProps>(function OutlinedTextField(props, ref) {\n const {\n animatedError,\n animatedLabel,\n disabled,\n error,\n focused,\n forceFocus,\n icon,\n keyboardType,\n label,\n labelLayout,\n onBlur,\n onChangeText,\n onFocus,\n onIconPress,\n onLayoutAnimatedText,\n onSubmitEditing,\n placeholder,\n secureTextEntry,\n style,\n value,\n } = props;\n\n const theme = useTheme();\n\n const styles = useStyles();\n\n const hasActiveOutline = focused || error;\n const inputTextColor = disabled ? theme.palette.tertiary.main : theme.palette.primary.main;\n const activeColor = error\n ? theme.palette.warning.main\n : disabled\n ? theme.palette.tertiary.main\n : theme.palette.accent.main;\n const placeholderColor = disabled ? theme.palette.tertiary.main : theme.palette.text.hint;\n const outlineColor = theme.palette.border.default;\n const errorColor = disabled ? theme.palette.tertiary.main : theme.palette.warning.main;\n\n const typography = theme.typography.body2;\n const fontSize = typography.fontSize.unitless;\n\n const labelScale = labelFontSize / fontSize;\n const labelWidth = labelLayout.width;\n const labelHeight = labelLayout.height;\n const labelHalfWidth = labelWidth / 2;\n const labelHalfHeight = labelHeight / 2;\n\n const labelTranslateX = -1 * (labelHalfWidth - (labelScale * labelWidth) / 2 - (fontSize - labelFontSize) * labelScale);\n const minInputHeight = defaultHeight - labelPaddingTop;\n const inputHeight = labelHeight < minInputHeight ? minInputHeight : labelHeight;\n const topPosition = Math.floor(((inputHeight > 0 ? inputHeight : 0) - labelHeight) / 2 + labelPaddingTop);\n const iconTopPosition = (defaultHeight - (label ? 0 : labelPaddingTop) - iconSize - (label ? labelYOffset : 0)) / 2;\n const labelTranslateY = -labelHalfHeight - (topPosition + labelYOffset);\n\n const placeholderOpacity = hasActiveOutline\n ? animatedLabel.interpolate({\n inputRange: [0, 1],\n outputRange: [hasActiveOutline ? 0 : 1, 1],\n })\n : labelLayout.measured ? 1 : 0;\n\n const labelProps = {\n activeColor,\n error,\n errorColor,\n fontSize,\n hasActiveOutline,\n label,\n labelScale,\n labelTranslateX,\n labelTranslateY,\n onLayoutAnimatedText,\n placeholderColor,\n placeholderOpacity,\n topPosition,\n };\n\n const inputTextFontStyle = createFontStyle(theme, {\n selector: (typo) => typo.caption2,\n color: inputTextColor,\n });\n\n const outlineStyle = css([\n styles.outline,\n {\n borderWidth: hasActiveOutline ? 2 : 1,\n borderColor: error ? errorColor : (hasActiveOutline ? activeColor : outlineColor),\n top: label ? 6 : 0,\n },\n ]);\n\n const textInputStyle = css([\n inputTextFontStyle,\n styles.input,\n {\n fontSize,\n color: inputTextColor,\n height: inputHeight,\n },\n icon && {\n marginRight: iconSize + 20,\n paddingRight: 0,\n },\n Platform.OS === 'web' && {\n //@ts-ignore\n outlineWidth: 0,\n },\n ]);\n\n const containerStyle = css([\n {\n paddingTop: label ? labelPaddingTop : 0,\n minHeight: label ? defaultHeight : defaultHeight + labelYOffset,\n },\n ]);\n\n const iconContainerStyle = css([\n styles.iconContainer,\n { top: iconTopPosition },\n ]);\n\n const onIconButtonPress = () => {\n forceFocus();\n onIconPress?.();\n };\n\n return (\n <View style={style}>\n <View\n pointerEvents={'none'}\n style={outlineStyle}\n />\n <View style={containerStyle}>\n {label ? (\n <InputLabel\n animatedLabel={animatedLabel}\n animatedError={animatedError}\n focused={focused}\n labelLayout={labelLayout}\n placeholder={placeholder}\n value={value}\n {...labelProps}\n />\n ) : null}\n <TextInput\n autoCapitalize={'none'}\n autoCorrect={false}\n disableFullscreenUI={true}\n ref={ref}\n onChangeText={onChangeText}\n placeholder={placeholder}\n placeholderTextColor={placeholderColor}\n editable={!disabled}\n selectionColor={activeColor}\n onFocus={onFocus}\n onBlur={onBlur}\n onSubmitEditing={onSubmitEditing}\n keyboardType={keyboardType}\n secureTextEntry={secureTextEntry}\n underlineColorAndroid={'transparent'}\n style={textInputStyle}\n value={value}\n />\n </View>\n {icon ? (\n <View style={iconContainerStyle}>\n <IconButton\n children={icon}\n onPress={onIconButtonPress}\n />\n </View>\n ) : null}\n </View>\n );\n});\n\nexport default OutlinedTextField;\n"],"mappings":";;;;;;;AAAA;;AACA;;AAEA;;AACA;;AAEA;;AACA;;;;;;AAoBA,MAAMA,SAA6C,GAAG,YAAqC;EACvF,MAAMC,KAAK,GAAG,IAAAC,gBAAA,GAAd;EAEA,OAAO;IACHC,OAAO,EAAE;MACLC,QAAQ,EAAE,UADL;MAELC,IAAI,EAAE,CAFD;MAGLC,KAAK,EAAE,CAHF;MAILC,MAAM,EAAE,CAJH;MAKLC,YAAY,EAAEP,KAAK,CA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AE,MADpB;IAEI,WAAW,EAAE,KAFjB;IAGI,mBAAmB,EAAE,IAHzB;IAII,GAAG,EAAEjE,GAJT;IAKI,YAAY,EAAEY,YALlB;IAMI,WAAW,EAAEK,WANjB;IAOI,oBAAoB,EAAEc,gBAP1B;IAQI,QAAQ,EAAE,CAAC5B,QARf;IASI,cAAc,EAAEyB,WATpB;IAUI,OAAO,EAAEf,OAVb;IAWI,MAAM,EAAEF,MAXZ;IAYI,eAAe,EAAEK,eAZrB;IAaI,YAAY,EAAER,YAblB;IAcI,eAAe,EAAEU,eAdrB;IAeI,qBAAqB,EAAE,aAf3B;IAgBI,KAAK,EAAE2D,cAhBX;IAiBI,KAAK,EAAEzD;EAjBX,EAZJ,CALJ,EAqCKb,IAAI,gBACD,6BAAC,iBAAD;IAAM,KAAK,EAAE+E;EAAb,gBACI,6BAAC,mBAAD;IACI,QAAQ,EAAE/E,IADd;IAEI,OAAO,EAAEgF;EAFb,EADJ,CADC,GAOD,IA5CR,CADJ;AAgDH,CA/KyB,CAA1B;;eAiLe3F,iB"}
@@ -9,12 +9,14 @@ var _react = _interopRequireWildcard(require("react"));
9
9
 
10
10
  var _reactNative = require("react-native");
11
11
 
12
+ var _styles = require("../styles");
13
+
14
+ var _hooks = require("../hooks");
15
+
12
16
  var _OutlinedTextField = _interopRequireDefault(require("./OutlinedTextField"));
13
17
 
14
18
  var _utils = require("./utils");
15
19
 
16
- var _styles = require("../styles");
17
-
18
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
21
 
20
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); }
@@ -59,12 +61,17 @@ const TextField = /*#__PURE__*/_react.default.forwardRef(function TextField(prop
59
61
  var _innerRef$current3;
60
62
 
61
63
  (_innerRef$current3 = innerRef.current) === null || _innerRef$current3 === void 0 ? void 0 : _innerRef$current3.blur();
64
+ },
65
+ setStyle: style => {
66
+ var _innerRef$current4;
67
+
68
+ (_innerRef$current4 = innerRef.current) === null || _innerRef$current4 === void 0 ? void 0 : _innerRef$current4.setNativeProps({
69
+ style
70
+ });
62
71
  }
63
72
  }));
64
-
65
- const [animatedLabel] = _react.default.useState(() => new _reactNative.Animated.Value(value ? 0 : 1));
66
-
67
- const [animatedError] = _react.default.useState(() => new _reactNative.Animated.Value(error ? 1 : 0));
73
+ const animatedLabel = (0, _hooks.useAnimatedValue)(value ? 0 : 1);
74
+ const animatedError = (0, _hooks.useAnimatedValue)(error ? 1 : 0);
68
75
 
69
76
  const [focused, setFocused] = _react.default.useState(false);
70
77
 
@@ -153,9 +160,9 @@ const TextField = /*#__PURE__*/_react.default.forwardRef(function TextField(prop
153
160
  };
154
161
 
155
162
  const forceFocus = () => {
156
- var _innerRef$current4;
163
+ var _innerRef$current5;
157
164
 
158
- (_innerRef$current4 = innerRef.current) === null || _innerRef$current4 === void 0 ? void 0 : _innerRef$current4.focus();
165
+ (_innerRef$current5 = innerRef.current) === null || _innerRef$current5 === void 0 ? void 0 : _innerRef$current5.focus();
159
166
  };
160
167
 
161
168
  return /*#__PURE__*/_react.default.createElement(_OutlinedTextField.default, {
@@ -1 +1 @@
1
- {"version":3,"names":["TextField","React","forwardRef","props","ref","disabled","error","keyboardType","icon","label","onBlur","onChangeText","onFocus","onIconPress","onSubmitEditing","placeholder","placeholderProp","secureTextEntry","value","style","styleProp","innerRef","useRef","useImperativeHandle","focus","current","isFocused","clear","blur","animatedLabel","useState","Animated","Value","animatedError","focused","setFocused","setPlaceholder","labelLayout","setLabelLayout","measured","width","height","minimizeLabel","timing","toValue","duration","blurAnimationDuration","useNativeDriver","start","restoreLabel","focusAnimationDuration","showError","hideError","showPlaceholder","hidePlaceholder","useEffect","handleFocus","event","handleBlur","css","opacity","handleLayoutAnimatedText","nativeEvent","layout","forceFocus"],"sources":["TextField.tsx"],"sourcesContent":["import React, { useImperativeHandle, useRef } from 'react';\nimport { Animated, LayoutChangeEvent, NativeSyntheticEvent, TargetedEvent, TextInput } from 'react-native';\nimport OutlinedTextField from './OutlinedTextField';\nimport TextFieldProps from './TextFieldProps';\nimport { blurAnimationDuration, focusAnimationDuration } from './utils';\nimport { css } from '../styles';\n\nconst TextField = React.forwardRef<TextInput, TextFieldProps>(function TextField(props, ref) {\n const {\n disabled = false,\n error = false,\n keyboardType = 'default',\n icon,\n label,\n onBlur,\n onChangeText,\n onFocus,\n onIconPress,\n onSubmitEditing,\n placeholder: placeholderProp,\n secureTextEntry = false,\n value,\n style: styleProp,\n } = props;\n\n const innerRef = useRef<TextInput | null>(null);\n //@ts-ignore\n useImperativeHandle(ref, () => ({\n focus: () => {\n innerRef.current?.focus();\n },\n isFocused: () => {\n const current = innerRef.current;\n return current ? current.isFocused() : false;\n },\n clear: () => {\n innerRef.current?.clear();\n },\n blur: () => {\n innerRef.current?.blur();\n },\n }));\n\n const [animatedLabel] = React.useState(() => new Animated.Value(value ? 0 : 1));\n const [animatedError] = React.useState(() => new Animated.Value(error ? 1 : 0));\n const [focused, setFocused] = React.useState(false);\n const [placeholder, setPlaceholder] = React.useState('');\n const [labelLayout, setLabelLayout] = React.useState({\n measured: false,\n width: 0,\n height: 0,\n });\n\n const minimizeLabel = () => {\n Animated.timing(animatedLabel, {\n toValue: 0,\n duration: blurAnimationDuration,\n useNativeDriver: false,\n }).start();\n };\n\n const restoreLabel = () => {\n Animated.timing(animatedLabel, {\n toValue: 1,\n duration: focusAnimationDuration,\n useNativeDriver: false,\n }).start();\n };\n\n const showError = () => {\n Animated.timing(animatedError, {\n toValue: 1,\n duration: focusAnimationDuration,\n useNativeDriver: false,\n }).start();\n };\n\n const hideError = () => {\n Animated.timing(animatedError, {\n toValue: 0,\n duration: blurAnimationDuration,\n useNativeDriver: false,\n }).start();\n };\n\n const showPlaceholder = () => {\n placeholderProp && setPlaceholder(placeholderProp);\n };\n\n const hidePlaceholder = () => setPlaceholder('');\n\n React.useEffect(() => {\n value || focused ? minimizeLabel() : restoreLabel();\n }, [focused, value, labelLayout]);\n\n React.useEffect(() => {\n animatedError ? showError() : hideError();\n }, [animatedError]);\n\n React.useEffect(() => {\n focused || !label ? showPlaceholder() : hidePlaceholder();\n }, [focused, label]);\n\n const handleFocus = (event: NativeSyntheticEvent<TargetedEvent>) => {\n if (disabled) {\n return;\n }\n\n setFocused(true);\n onFocus?.(event);\n };\n\n const handleBlur = (event: NativeSyntheticEvent<TargetedEvent>) => {\n setFocused(false);\n onBlur?.(event);\n };\n\n const style = css([\n { opacity: disabled ? 0.3 : 1 },\n styleProp,\n ]);\n\n const handleLayoutAnimatedText = (event: LayoutChangeEvent) => {\n setLabelLayout({\n width: event.nativeEvent.layout.width,\n height: event.nativeEvent.layout.height,\n measured: true,\n });\n };\n\n const forceFocus = () => {\n innerRef.current?.focus();\n };\n\n return (\n <OutlinedTextField\n animatedError={animatedError}\n animatedLabel={animatedLabel}\n disabled={disabled}\n error={error}\n focused={focused}\n forceFocus={forceFocus}\n icon={icon}\n keyboardType={keyboardType}\n label={label}\n labelLayout={labelLayout}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChangeText={onChangeText}\n onIconPress={onIconPress}\n onLayoutAnimatedText={handleLayoutAnimatedText}\n onSubmitEditing={onSubmitEditing}\n placeholder={placeholder}\n ref={innerRef}\n secureTextEntry={secureTextEntry}\n style={style}\n value={value}\n />\n );\n});\n\nexport default TextField;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AAEA;;AACA;;;;;;;;AAEA,MAAMA,SAAS,gBAAGC,cAAA,CAAMC,UAAN,CAA4C,SAASF,SAAT,CAAmBG,KAAnB,EAA0BC,GAA1B,EAA+B;EACzF,MAAM;IACFC,QAAQ,GAAG,KADT;IAEFC,KAAK,GAAG,KAFN;IAGFC,YAAY,GAAG,SAHb;IAIFC,IAJE;IAKFC,KALE;IAMFC,MANE;IAO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AAa,EAAES,aADnB;IAEI,aAAa,EAAEJ,aAFnB;IAGI,QAAQ,EAAExB,QAHd;IAII,KAAK,EAAEC,KAJX;IAKI,OAAO,EAAE4B,OALb;IAMI,UAAU,EAAE8B,UANhB;IAOI,IAAI,EAAExD,IAPV;IAQI,YAAY,EAAED,YARlB;IASI,KAAK,EAAEE,KATX;IAUI,WAAW,EAAE4B,WAVjB;IAWI,OAAO,EAAEmB,WAXb;IAYI,MAAM,EAAEE,UAZZ;IAaI,YAAY,EAAE/C,YAblB;IAcI,WAAW,EAAEE,WAdjB;IAeI,oBAAoB,EAAEgD,wBAf1B;IAgBI,eAAe,EAAE/C,eAhBrB;IAiBI,WAAW,EAAEC,WAjBjB;IAkBI,GAAG,EAAEM,QAlBT;IAmBI,eAAe,EAAEJ,eAnBrB;IAoBI,KAAK,EAAEE,KApBX;IAqBI,KAAK,EAAED;EArBX,EADJ;AAyBH,CAxJiB,CAAlB;;eA0JelB,S"}
1
+ {"version":3,"names":["TextField","React","forwardRef","props","ref","disabled","error","keyboardType","icon","label","onBlur","onChangeText","onFocus","onIconPress","onSubmitEditing","placeholder","placeholderProp","secureTextEntry","value","style","styleProp","innerRef","useRef","useImperativeHandle","focus","current","isFocused","clear","blur","setStyle","setNativeProps","animatedLabel","useAnimatedValue","animatedError","focused","setFocused","useState","setPlaceholder","labelLayout","setLabelLayout","measured","width","height","minimizeLabel","Animated","timing","toValue","duration","blurAnimationDuration","useNativeDriver","start","restoreLabel","focusAnimationDuration","showError","hideError","showPlaceholder","hidePlaceholder","useEffect","handleFocus","event","handleBlur","css","opacity","handleLayoutAnimatedText","nativeEvent","layout","forceFocus"],"sources":["TextField.tsx"],"sourcesContent":["import React, { useImperativeHandle, useRef } from 'react';\nimport { Animated, LayoutChangeEvent, NativeSyntheticEvent, TargetedEvent, TextInput } from 'react-native';\nimport { css } from '../styles';\nimport { useAnimatedValue } from '../hooks';\nimport OutlinedTextField from './OutlinedTextField';\nimport TextFieldProps, { setStyleProp } from './TextFieldProps';\nimport { blurAnimationDuration, focusAnimationDuration } from './utils';\n\nconst TextField = React.forwardRef<TextInput, TextFieldProps>(function TextField(props, ref) {\n const {\n disabled = false,\n error = false,\n keyboardType = 'default',\n icon,\n label,\n onBlur,\n onChangeText,\n onFocus,\n onIconPress,\n onSubmitEditing,\n placeholder: placeholderProp,\n secureTextEntry = false,\n value,\n style: styleProp,\n } = props;\n\n const innerRef = useRef<TextInput | null>(null);\n //@ts-ignore\n useImperativeHandle(ref, () => ({\n focus: () => {\n innerRef.current?.focus();\n },\n isFocused: () => {\n const current = innerRef.current;\n return current ? current.isFocused() : false;\n },\n clear: () => {\n innerRef.current?.clear();\n },\n blur: () => {\n innerRef.current?.blur();\n },\n setStyle: (style: setStyleProp) => {\n innerRef.current?.setNativeProps({\n style,\n });\n },\n }));\n\n const animatedLabel = useAnimatedValue(value ? 0 : 1);\n const animatedError = useAnimatedValue(error ? 1 : 0);\n const [focused, setFocused] = React.useState(false);\n const [placeholder, setPlaceholder] = React.useState('');\n const [labelLayout, setLabelLayout] = React.useState({\n measured: false,\n width: 0,\n height: 0,\n });\n\n const minimizeLabel = () => {\n Animated.timing(animatedLabel, {\n toValue: 0,\n duration: blurAnimationDuration,\n useNativeDriver: false,\n }).start();\n };\n\n const restoreLabel = () => {\n Animated.timing(animatedLabel, {\n toValue: 1,\n duration: focusAnimationDuration,\n useNativeDriver: false,\n }).start();\n };\n\n const showError = () => {\n Animated.timing(animatedError, {\n toValue: 1,\n duration: focusAnimationDuration,\n useNativeDriver: false,\n }).start();\n };\n\n const hideError = () => {\n Animated.timing(animatedError, {\n toValue: 0,\n duration: blurAnimationDuration,\n useNativeDriver: false,\n }).start();\n };\n\n const showPlaceholder = () => {\n placeholderProp && setPlaceholder(placeholderProp);\n };\n\n const hidePlaceholder = () => setPlaceholder('');\n\n React.useEffect(() => {\n value || focused ? minimizeLabel() : restoreLabel();\n }, [focused, value, labelLayout]);\n\n React.useEffect(() => {\n animatedError ? showError() : hideError();\n }, [animatedError]);\n\n React.useEffect(() => {\n focused || !label ? showPlaceholder() : hidePlaceholder();\n }, [focused, label]);\n\n const handleFocus = (event: NativeSyntheticEvent<TargetedEvent>) => {\n if (disabled) {\n return;\n }\n\n setFocused(true);\n onFocus?.(event);\n };\n\n const handleBlur = (event: NativeSyntheticEvent<TargetedEvent>) => {\n setFocused(false);\n onBlur?.(event);\n };\n\n const style = css([\n { opacity: disabled ? 0.3 : 1 },\n styleProp,\n ]);\n\n const handleLayoutAnimatedText = (event: LayoutChangeEvent) => {\n setLabelLayout({\n width: event.nativeEvent.layout.width,\n height: event.nativeEvent.layout.height,\n measured: true,\n });\n };\n\n const forceFocus = () => {\n innerRef.current?.focus();\n };\n\n return (\n <OutlinedTextField\n animatedError={animatedError}\n animatedLabel={animatedLabel}\n disabled={disabled}\n error={error}\n focused={focused}\n forceFocus={forceFocus}\n icon={icon}\n keyboardType={keyboardType}\n label={label}\n labelLayout={labelLayout}\n onFocus={handleFocus}\n onBlur={handleBlur}\n onChangeText={onChangeText}\n onIconPress={onIconPress}\n onLayoutAnimatedText={handleLayoutAnimatedText}\n onSubmitEditing={onSubmitEditing}\n placeholder={placeholder}\n ref={innerRef}\n secureTextEntry={secureTextEntry}\n style={style}\n value={value}\n />\n );\n});\n\nexport default TextField;\n"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;AACA;;AAEA;;;;;;;;AAEA,MAAMA,SAAS,gBAAGC,cAAA,CAAMC,UAAN,CAA4C,SAASF,SAAT,CAAmBG,KAAnB,EAA0BC,GAA1B,EAA+B;EACzF,MAAM;IACFC,QAAQ,GAAG,KADT;IAEFC,KAAK,GAAG,KAFN;IAGFC,YAAY,GAAG,SAHb;IAIFC,IAJE;IAKFC,KALE;IAMFC,MANE;IAOFC,YAPE;IAQFC,OARE;IASFC,WATE;IAUFC,eAVE;IAWFC,WAAW,EAAEC,eAXX;IAYFC,eAAe,GAAG,KAZhB;IAaFC,KAbE;IAcFC,KAAK,EAAEC;EAdL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ALb;IAMI,UAAU,EAAEgC,UANhB;IAOI,IAAI,EAAE1D,IAPV;IAQI,YAAY,EAAED,YARlB;IASI,KAAK,EAAEE,KATX;IAUI,WAAW,EAAE6B,WAVjB;IAWI,OAAO,EAAEoB,WAXb;IAYI,MAAM,EAAEE,UAZZ;IAaI,YAAY,EAAEjD,YAblB;IAcI,WAAW,EAAEE,WAdjB;IAeI,oBAAoB,EAAEkD,wBAf1B;IAgBI,eAAe,EAAEjD,eAhBrB;IAiBI,WAAW,EAAEC,WAjBjB;IAkBI,GAAG,EAAEM,QAlBT;IAmBI,eAAe,EAAEJ,eAnBrB;IAoBI,KAAK,EAAEE,KApBX;IAqBI,KAAK,EAAED;EArBX,EADJ;AAyBH,CA7JiB,CAAlB;;eA+JelB,S"}
@@ -1 +1 @@
1
- {"version":3,"names":[],"sources":["TextFieldProps.ts"],"sourcesContent":["import React from 'react';\nimport { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport { ComponentProps } from '../types';\n\ntype TextFieldKeyboardType = 'default' | 'numeric' | 'email-address';\n\nexport default interface TextFieldProps extends ComponentProps<{\n /**\n * If true, user won't be able to interact with the component.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Whether to style the TextField with error style.\n * @default false\n */\n error?: boolean,\n\n /**\n * It is an icon placed to the right of the TextField.\n */\n icon?: React.ReactElement;\n\n /**\n * User can specify the keyboard type.\n * @default 'default'\n */\n keyboardType?: TextFieldKeyboardType;\n\n /**\n * The text to use for the floating label.\n */\n label?: string;\n\n /**\n * Callback that is called when the textField is blurred.\n */\n onBlur?: (event: NativeSyntheticEvent<TargetedEvent>) => void,\n\n /**\n * Callback that is called when the textField's text changes.\n */\n onChangeText?: (value: string) => void,\n\n /**\n * Callback that is called when the textField is focused.\n */\n onFocus?: (event: NativeSyntheticEvent<TargetedEvent>) => void,\n\n /**\n * Callback that is called when icon pressed.\n */\n onIconPress?: () => void;\n\n /**\n * Callback that is called when enter or submit key pressed.\n */\n onSubmitEditing?: () => void\n\n /**\n * Placeholder for textField.\n */\n placeholder?: string;\n\n /**\n * If true, the text input obscures the text entered so that sensitive text like passwords stay secure.\n * @default false\n */\n secureTextEntry?: boolean;\n\n /**\n * Value of the textField.\n */\n value?: string;\n}> {}"],"mappings":""}
1
+ {"version":3,"names":[],"sources":["TextFieldProps.ts"],"sourcesContent":["import React from 'react';\nimport { NativeSyntheticEvent, TargetedEvent } from 'react-native';\nimport { ComponentProps } from '../types';\n\ntype TextFieldKeyboardType = 'default' | 'numeric' | 'email-address';\n\nexport interface setStyleProp {\n fontFamily: string;\n}\n\nexport default interface TextFieldProps extends ComponentProps<{\n /**\n * If true, user won't be able to interact with the component.\n * @default false\n */\n disabled?: boolean;\n\n /**\n * Whether to style the TextField with error style.\n * @default false\n */\n error?: boolean,\n\n /**\n * It is an icon placed to the right of the TextField.\n */\n icon?: React.ReactElement;\n\n /**\n * User can specify the keyboard type.\n * @default 'default'\n */\n keyboardType?: TextFieldKeyboardType;\n\n /**\n * The text to use for the floating label.\n */\n label?: string;\n\n /**\n * Callback that is called when the textField is blurred.\n */\n onBlur?: (event: NativeSyntheticEvent<TargetedEvent>) => void,\n\n /**\n * Callback that is called when the textField's text changes.\n */\n onChangeText?: (value: string) => void,\n\n /**\n * Callback that is called when the textField is focused.\n */\n onFocus?: (event: NativeSyntheticEvent<TargetedEvent>) => void,\n\n /**\n * Callback that is called when icon pressed.\n */\n onIconPress?: () => void;\n\n /**\n * Callback that is called when enter or submit key pressed.\n */\n onSubmitEditing?: () => void\n\n /**\n * Placeholder for textField.\n */\n placeholder?: string;\n\n /**\n * If true, the text input obscures the text entered so that sensitive text like passwords stay secure.\n * @default false\n */\n secureTextEntry?: boolean;\n\n /**\n * Value of the textField.\n */\n value?: string;\n}> {}"],"mappings":""}