@fountain-ui/core 3.0.0-alpha.1 → 3.0.0-alpha.10

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 (327) hide show
  1. package/build/commonjs/Accordion/Accordion.js +4 -1
  2. package/build/commonjs/Accordion/Accordion.js.map +1 -1
  3. package/build/commonjs/Accordion/index.js +8 -0
  4. package/build/commonjs/Accordion/index.js.map +1 -1
  5. package/build/commonjs/Accordion/useVariantStyleMap.js +11 -10
  6. package/build/commonjs/Accordion/useVariantStyleMap.js.map +1 -1
  7. package/build/commonjs/AppBar/index.js +8 -0
  8. package/build/commonjs/AppBar/index.js.map +1 -1
  9. package/build/commonjs/Badge/index.js +26 -0
  10. package/build/commonjs/Badge/index.js.map +1 -1
  11. package/build/commonjs/Badge/useVariantStyleMap.js +2 -2
  12. package/build/commonjs/Badge/useVariantStyleMap.js.map +1 -1
  13. package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js +1 -0
  14. package/build/commonjs/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
  15. package/build/commonjs/Button/Button.js +15 -3
  16. package/build/commonjs/Button/Button.js.map +1 -1
  17. package/build/commonjs/Button/ButtonProps.js +7 -7
  18. package/build/commonjs/Button/ButtonProps.js.map +1 -1
  19. package/build/commonjs/Button/index.js +20 -0
  20. package/build/commonjs/Button/index.js.map +1 -1
  21. package/build/commonjs/Button/useVariantStyleMap.js +5 -7
  22. package/build/commonjs/Button/useVariantStyleMap.js.map +1 -1
  23. package/build/commonjs/Checkbox/Checkbox.js +5 -2
  24. package/build/commonjs/Checkbox/Checkbox.js.map +1 -1
  25. package/build/commonjs/Checkbox/index.js +8 -0
  26. package/build/commonjs/Checkbox/index.js.map +1 -1
  27. package/build/commonjs/Checkbox/useVariantStyleMap.js +6 -2
  28. package/build/commonjs/Checkbox/useVariantStyleMap.js.map +1 -1
  29. package/build/commonjs/Chip/index.js +14 -0
  30. package/build/commonjs/Chip/index.js.map +1 -1
  31. package/build/commonjs/Chip/useChipStyle.js +2 -18
  32. package/build/commonjs/Chip/useChipStyle.js.map +1 -1
  33. package/build/commonjs/Dialog/index.js +8 -0
  34. package/build/commonjs/Dialog/index.js.map +1 -1
  35. package/build/commonjs/DialogContent/DialogContent.js +1 -2
  36. package/build/commonjs/DialogContent/DialogContent.js.map +1 -1
  37. package/build/commonjs/Divider/Divider.js +1 -1
  38. package/build/commonjs/Divider/Divider.js.map +1 -1
  39. package/build/commonjs/Divider/DividerProps.js +3 -3
  40. package/build/commonjs/Divider/DividerProps.js.map +1 -1
  41. package/build/commonjs/Divider/index.js +14 -0
  42. package/build/commonjs/Divider/index.js.map +1 -1
  43. package/build/commonjs/Empty/Empty.js +1 -2
  44. package/build/commonjs/Empty/Empty.js.map +1 -1
  45. package/build/commonjs/Flexbox/Flexbox.js +2 -0
  46. package/build/commonjs/Flexbox/Flexbox.js.map +1 -1
  47. package/build/commonjs/Flexbox/FlexboxProps.js.map +1 -1
  48. package/build/commonjs/IconButton/index.js +8 -0
  49. package/build/commonjs/IconButton/index.js.map +1 -1
  50. package/build/commonjs/ListItem/ListItem.js +47 -25
  51. package/build/commonjs/ListItem/ListItem.js.map +1 -1
  52. package/build/commonjs/ListItem/ListItemProps.js.map +1 -1
  53. package/build/commonjs/ListItemIcon/ListItemIcon.js +1 -2
  54. package/build/commonjs/ListItemIcon/ListItemIcon.js.map +1 -1
  55. package/build/commonjs/ListItemSecondaryAction/ListItemSecondaryAction.js +2 -0
  56. package/build/commonjs/ListItemSecondaryAction/ListItemSecondaryAction.js.map +1 -1
  57. package/build/commonjs/ListItemText/ListItemText.js +20 -21
  58. package/build/commonjs/ListItemText/ListItemText.js.map +1 -1
  59. package/build/commonjs/ListItemText/ListItemTextProps.js.map +1 -1
  60. package/build/commonjs/ListSubheader/ListSubheader.js +1 -1
  61. package/build/commonjs/ListSubheader/ListSubheader.js.map +1 -1
  62. package/build/commonjs/Pagination/NumberPagination.js +1 -1
  63. package/build/commonjs/Pagination/NumberPagination.js.map +1 -1
  64. package/build/commonjs/Pagination/index.js +8 -0
  65. package/build/commonjs/Pagination/index.js.map +1 -1
  66. package/build/commonjs/Radio/Radio.js +6 -2
  67. package/build/commonjs/Radio/Radio.js.map +1 -1
  68. package/build/commonjs/Section/Section.js +32 -0
  69. package/build/commonjs/Section/Section.js.map +1 -0
  70. package/build/commonjs/Section/SectionProps.js +2 -0
  71. package/build/commonjs/Section/SectionProps.js.map +1 -0
  72. package/build/commonjs/Section/index.js +16 -0
  73. package/build/commonjs/Section/index.js.map +1 -0
  74. package/build/commonjs/ShadowView/ShadowView.native.js +4 -0
  75. package/build/commonjs/ShadowView/ShadowView.native.js.map +1 -1
  76. package/build/commonjs/Snackbar/index.js +8 -0
  77. package/build/commonjs/Snackbar/index.js.map +1 -1
  78. package/build/commonjs/SnackbarContent/SnackbarContent.js +27 -12
  79. package/build/commonjs/SnackbarContent/SnackbarContent.js.map +1 -1
  80. package/build/commonjs/SvgIcon/index.js +14 -0
  81. package/build/commonjs/SvgIcon/index.js.map +1 -1
  82. package/build/commonjs/Tab/useVariantStyleMap.js +3 -3
  83. package/build/commonjs/Tab/useVariantStyleMap.js.map +1 -1
  84. package/build/commonjs/Tabs/Tabs.js +6 -1
  85. package/build/commonjs/Tabs/Tabs.js.map +1 -1
  86. package/build/commonjs/Tabs/index.js +14 -0
  87. package/build/commonjs/Tabs/index.js.map +1 -1
  88. package/build/commonjs/Tabs/useTabsStyle.js +39 -0
  89. package/build/commonjs/Tabs/useTabsStyle.js.map +1 -0
  90. package/build/commonjs/TextField/TextField.js +1 -1
  91. package/build/commonjs/TextField/TextField.js.map +1 -1
  92. package/build/commonjs/TextField/index.js +8 -0
  93. package/build/commonjs/TextField/index.js.map +1 -1
  94. package/build/commonjs/TextField/useVariantStyleMap.js +2 -2
  95. package/build/commonjs/TextField/useVariantStyleMap.js.map +1 -1
  96. package/build/commonjs/Toolbar/index.js +8 -0
  97. package/build/commonjs/Toolbar/index.js.map +1 -1
  98. package/build/commonjs/Tooltip/Beaks/index.js +32 -0
  99. package/build/commonjs/Tooltip/Beaks/index.js.map +1 -1
  100. package/build/commonjs/Tooltip/Tooltip.js +11 -24
  101. package/build/commonjs/Tooltip/Tooltip.js.map +1 -1
  102. package/build/commonjs/Tooltip/index.js +39 -0
  103. package/build/commonjs/Tooltip/index.js.map +1 -1
  104. package/build/commonjs/Typography/Typography.js +9 -2
  105. package/build/commonjs/Typography/Typography.js.map +1 -1
  106. package/build/commonjs/Typography/TypographyProps.js.map +1 -1
  107. package/build/commonjs/Typography/index.js +8 -0
  108. package/build/commonjs/Typography/index.js.map +1 -1
  109. package/build/commonjs/hooks/useBreakpointUp.js +4 -1
  110. package/build/commonjs/hooks/useBreakpointUp.js.map +1 -1
  111. package/build/commonjs/hooks/useContentContainerStyle.js +21 -28
  112. package/build/commonjs/hooks/useContentContainerStyle.js.map +1 -1
  113. package/build/commonjs/index.js +21 -0
  114. package/build/commonjs/index.js.map +1 -1
  115. package/build/module/Accordion/Accordion.js +4 -1
  116. package/build/module/Accordion/Accordion.js.map +1 -1
  117. package/build/module/Accordion/index.js +1 -0
  118. package/build/module/Accordion/index.js.map +1 -1
  119. package/build/module/Accordion/useVariantStyleMap.js +11 -10
  120. package/build/module/Accordion/useVariantStyleMap.js.map +1 -1
  121. package/build/module/AppBar/index.js +1 -0
  122. package/build/module/AppBar/index.js.map +1 -1
  123. package/build/module/Badge/index.js +1 -0
  124. package/build/module/Badge/index.js.map +1 -1
  125. package/build/module/Badge/useVariantStyleMap.js +2 -2
  126. package/build/module/Badge/useVariantStyleMap.js.map +1 -1
  127. package/build/module/BottomSheetTitle/BottomSheetTitle.js +1 -0
  128. package/build/module/BottomSheetTitle/BottomSheetTitle.js.map +1 -1
  129. package/build/module/Button/Button.js +16 -4
  130. package/build/module/Button/Button.js.map +1 -1
  131. package/build/module/Button/ButtonProps.js +3 -3
  132. package/build/module/Button/ButtonProps.js.map +1 -1
  133. package/build/module/Button/index.js +1 -0
  134. package/build/module/Button/index.js.map +1 -1
  135. package/build/module/Button/useVariantStyleMap.js +5 -7
  136. package/build/module/Button/useVariantStyleMap.js.map +1 -1
  137. package/build/module/Checkbox/Checkbox.js +5 -2
  138. package/build/module/Checkbox/Checkbox.js.map +1 -1
  139. package/build/module/Checkbox/index.js +1 -0
  140. package/build/module/Checkbox/index.js.map +1 -1
  141. package/build/module/Checkbox/useVariantStyleMap.js +6 -2
  142. package/build/module/Checkbox/useVariantStyleMap.js.map +1 -1
  143. package/build/module/Chip/index.js +1 -0
  144. package/build/module/Chip/index.js.map +1 -1
  145. package/build/module/Chip/useChipStyle.js +2 -17
  146. package/build/module/Chip/useChipStyle.js.map +1 -1
  147. package/build/module/Dialog/index.js +1 -0
  148. package/build/module/Dialog/index.js.map +1 -1
  149. package/build/module/DialogContent/DialogContent.js +1 -2
  150. package/build/module/DialogContent/DialogContent.js.map +1 -1
  151. package/build/module/Divider/Divider.js +1 -1
  152. package/build/module/Divider/Divider.js.map +1 -1
  153. package/build/module/Divider/DividerProps.js +1 -1
  154. package/build/module/Divider/DividerProps.js.map +1 -1
  155. package/build/module/Divider/index.js +1 -0
  156. package/build/module/Divider/index.js.map +1 -1
  157. package/build/module/Empty/Empty.js +1 -2
  158. package/build/module/Empty/Empty.js.map +1 -1
  159. package/build/module/Flexbox/Flexbox.js +2 -0
  160. package/build/module/Flexbox/Flexbox.js.map +1 -1
  161. package/build/module/Flexbox/FlexboxProps.js.map +1 -1
  162. package/build/module/IconButton/index.js +1 -0
  163. package/build/module/IconButton/index.js.map +1 -1
  164. package/build/module/ListItem/ListItem.js +45 -27
  165. package/build/module/ListItem/ListItem.js.map +1 -1
  166. package/build/module/ListItem/ListItemProps.js.map +1 -1
  167. package/build/module/ListItemIcon/ListItemIcon.js +1 -2
  168. package/build/module/ListItemIcon/ListItemIcon.js.map +1 -1
  169. package/build/module/ListItemSecondaryAction/ListItemSecondaryAction.js +2 -0
  170. package/build/module/ListItemSecondaryAction/ListItemSecondaryAction.js.map +1 -1
  171. package/build/module/ListItemText/ListItemText.js +17 -19
  172. package/build/module/ListItemText/ListItemText.js.map +1 -1
  173. package/build/module/ListItemText/ListItemTextProps.js.map +1 -1
  174. package/build/module/ListSubheader/ListSubheader.js +1 -1
  175. package/build/module/ListSubheader/ListSubheader.js.map +1 -1
  176. package/build/module/Pagination/NumberPagination.js +1 -1
  177. package/build/module/Pagination/NumberPagination.js.map +1 -1
  178. package/build/module/Pagination/index.js +1 -0
  179. package/build/module/Pagination/index.js.map +1 -1
  180. package/build/module/Radio/Radio.js +5 -2
  181. package/build/module/Radio/Radio.js.map +1 -1
  182. package/build/module/Section/Section.js +19 -0
  183. package/build/module/Section/Section.js.map +1 -0
  184. package/build/module/Section/SectionProps.js +2 -0
  185. package/build/module/Section/SectionProps.js.map +1 -0
  186. package/build/module/Section/index.js +2 -0
  187. package/build/module/Section/index.js.map +1 -0
  188. package/build/module/ShadowView/ShadowView.native.js +4 -0
  189. package/build/module/ShadowView/ShadowView.native.js.map +1 -1
  190. package/build/module/Snackbar/index.js +1 -0
  191. package/build/module/Snackbar/index.js.map +1 -1
  192. package/build/module/SnackbarContent/SnackbarContent.js +27 -12
  193. package/build/module/SnackbarContent/SnackbarContent.js.map +1 -1
  194. package/build/module/SvgIcon/index.js +1 -0
  195. package/build/module/SvgIcon/index.js.map +1 -1
  196. package/build/module/Tab/useVariantStyleMap.js +3 -3
  197. package/build/module/Tab/useVariantStyleMap.js.map +1 -1
  198. package/build/module/Tabs/Tabs.js +5 -1
  199. package/build/module/Tabs/Tabs.js.map +1 -1
  200. package/build/module/Tabs/index.js +1 -0
  201. package/build/module/Tabs/index.js.map +1 -1
  202. package/build/module/Tabs/useTabsStyle.js +30 -0
  203. package/build/module/Tabs/useTabsStyle.js.map +1 -0
  204. package/build/module/TextField/TextField.js +1 -1
  205. package/build/module/TextField/TextField.js.map +1 -1
  206. package/build/module/TextField/index.js +1 -0
  207. package/build/module/TextField/index.js.map +1 -1
  208. package/build/module/TextField/useVariantStyleMap.js +2 -2
  209. package/build/module/TextField/useVariantStyleMap.js.map +1 -1
  210. package/build/module/Toolbar/index.js +1 -0
  211. package/build/module/Toolbar/index.js.map +1 -1
  212. package/build/module/Tooltip/Beaks/index.js +4 -0
  213. package/build/module/Tooltip/Beaks/index.js.map +1 -1
  214. package/build/module/Tooltip/Tooltip.js +4 -16
  215. package/build/module/Tooltip/Tooltip.js.map +1 -1
  216. package/build/module/Tooltip/index.js +2 -0
  217. package/build/module/Tooltip/index.js.map +1 -1
  218. package/build/module/Typography/Typography.js +9 -2
  219. package/build/module/Typography/Typography.js.map +1 -1
  220. package/build/module/Typography/TypographyProps.js.map +1 -1
  221. package/build/module/Typography/index.js +1 -0
  222. package/build/module/Typography/index.js.map +1 -1
  223. package/build/module/hooks/useBreakpointUp.js +4 -1
  224. package/build/module/hooks/useBreakpointUp.js.map +1 -1
  225. package/build/module/hooks/useContentContainerStyle.js +23 -26
  226. package/build/module/hooks/useContentContainerStyle.js.map +1 -1
  227. package/build/module/index.js +2 -0
  228. package/build/module/index.js.map +1 -1
  229. package/build/typescript/Accordion/index.d.ts +1 -0
  230. package/build/typescript/Accordion/useVariantStyleMap.d.ts +1 -0
  231. package/build/typescript/AppBar/index.d.ts +1 -0
  232. package/build/typescript/Badge/index.d.ts +2 -1
  233. package/build/typescript/Button/ButtonProps.d.ts +11 -6
  234. package/build/typescript/Button/index.d.ts +1 -0
  235. package/build/typescript/Checkbox/index.d.ts +1 -0
  236. package/build/typescript/Checkbox/useVariantStyleMap.d.ts +1 -0
  237. package/build/typescript/Chip/index.d.ts +1 -0
  238. package/build/typescript/Dialog/index.d.ts +1 -0
  239. package/build/typescript/Divider/DividerProps.d.ts +3 -3
  240. package/build/typescript/Divider/index.d.ts +1 -0
  241. package/build/typescript/Flexbox/FlexboxProps.d.ts +4 -0
  242. package/build/typescript/IconButton/index.d.ts +1 -0
  243. package/build/typescript/ListItem/ListItem.d.ts +1 -1
  244. package/build/typescript/ListItem/ListItemProps.d.ts +4 -0
  245. package/build/typescript/ListItemText/ListItemTextProps.d.ts +2 -9
  246. package/build/typescript/Pagination/index.d.ts +1 -0
  247. package/build/typescript/Section/Section.d.ts +3 -0
  248. package/build/typescript/Section/SectionProps.d.ts +6 -0
  249. package/build/typescript/Section/index.d.ts +2 -0
  250. package/build/typescript/Snackbar/index.d.ts +1 -0
  251. package/build/typescript/SvgIcon/index.d.ts +1 -0
  252. package/build/typescript/Tabs/index.d.ts +1 -0
  253. package/build/typescript/Tabs/useTabsStyle.d.ts +7 -0
  254. package/build/typescript/TextField/index.d.ts +1 -0
  255. package/build/typescript/Toolbar/index.d.ts +1 -0
  256. package/build/typescript/Tooltip/Beaks/index.d.ts +4 -0
  257. package/build/typescript/Tooltip/index.d.ts +3 -1
  258. package/build/typescript/Typography/TypographyProps.d.ts +4 -0
  259. package/build/typescript/Typography/index.d.ts +1 -0
  260. package/build/typescript/hooks/useContentContainerStyle.d.ts +4 -8
  261. package/build/typescript/index.d.ts +2 -0
  262. package/package.json +3 -3
  263. package/src/Accordion/Accordion.tsx +4 -1
  264. package/src/Accordion/index.ts +1 -0
  265. package/src/Accordion/useVariantStyleMap.ts +12 -10
  266. package/src/AppBar/index.ts +1 -0
  267. package/src/Badge/index.ts +12 -1
  268. package/src/Badge/useVariantStyleMap.ts +2 -2
  269. package/src/BottomSheetTitle/BottomSheetTitle.tsx +1 -0
  270. package/src/Button/Button.tsx +19 -4
  271. package/src/Button/ButtonProps.ts +12 -6
  272. package/src/Button/index.ts +1 -0
  273. package/src/Button/useVariantStyleMap.ts +3 -7
  274. package/src/Checkbox/Checkbox.tsx +12 -9
  275. package/src/Checkbox/index.ts +1 -0
  276. package/src/Checkbox/useVariantStyleMap.ts +6 -1
  277. package/src/Chip/index.ts +1 -0
  278. package/src/Chip/useChipStyle.ts +2 -17
  279. package/src/Dialog/index.ts +1 -0
  280. package/src/DialogContent/DialogContent.tsx +1 -2
  281. package/src/Divider/Divider.tsx +1 -1
  282. package/src/Divider/DividerProps.ts +3 -3
  283. package/src/Divider/index.ts +1 -0
  284. package/src/Empty/Empty.tsx +1 -2
  285. package/src/Flexbox/Flexbox.tsx +2 -0
  286. package/src/Flexbox/FlexboxProps.ts +5 -0
  287. package/src/IconButton/index.ts +1 -0
  288. package/src/ListItem/ListItem.tsx +69 -28
  289. package/src/ListItem/ListItemProps.ts +5 -0
  290. package/src/ListItemIcon/ListItemIcon.tsx +1 -2
  291. package/src/ListItemSecondaryAction/ListItemSecondaryAction.tsx +2 -0
  292. package/src/ListItemText/ListItemText.tsx +20 -28
  293. package/src/ListItemText/ListItemTextProps.ts +2 -10
  294. package/src/ListSubheader/ListSubheader.tsx +1 -1
  295. package/src/Pagination/NumberPagination.tsx +1 -1
  296. package/src/Pagination/index.ts +1 -0
  297. package/src/Radio/Radio.tsx +8 -2
  298. package/src/Section/Section.tsx +26 -0
  299. package/src/Section/SectionProps.ts +6 -0
  300. package/src/Section/index.ts +2 -0
  301. package/src/ShadowView/ShadowView.native.tsx +4 -0
  302. package/src/Snackbar/index.ts +1 -0
  303. package/src/SnackbarContent/SnackbarContent.tsx +37 -18
  304. package/src/SvgIcon/index.ts +1 -0
  305. package/src/Tab/useVariantStyleMap.ts +3 -3
  306. package/src/Tabs/Tabs.tsx +4 -0
  307. package/src/Tabs/index.ts +1 -0
  308. package/src/Tabs/useTabsStyle.ts +35 -0
  309. package/src/TextField/TextField.tsx +1 -1
  310. package/src/TextField/index.tsx +1 -0
  311. package/src/TextField/useVariantStyleMap.ts +2 -2
  312. package/src/Toolbar/index.ts +1 -0
  313. package/src/Tooltip/Beaks/index.ts +4 -0
  314. package/src/Tooltip/Tooltip.tsx +5 -16
  315. package/src/Tooltip/index.ts +3 -1
  316. package/src/Typography/Typography.tsx +3 -1
  317. package/src/Typography/TypographyProps.ts +5 -0
  318. package/src/Typography/index.ts +1 -0
  319. package/src/hooks/useBreakpointUp.ts +3 -1
  320. package/src/hooks/useContentContainerStyle.ts +26 -34
  321. package/src/index.ts +3 -0
  322. package/build/commonjs/TextField/InputLabel.js +0 -163
  323. package/build/commonjs/TextField/InputLabel.js.map +0 -1
  324. package/build/module/TextField/InputLabel.js +0 -149
  325. package/build/module/TextField/InputLabel.js.map +0 -1
  326. package/build/typescript/TextField/InputLabel.d.ts +0 -33
  327. package/src/TextField/InputLabel.tsx +0 -234
@@ -1,163 +0,0 @@
1
- "use strict";
2
-
3
- Object.defineProperty(exports, "__esModule", {
4
- value: true
5
- });
6
- exports.default = void 0;
7
-
8
- var _react = _interopRequireDefault(require("react"));
9
-
10
- var _reactNative = require("react-native");
11
-
12
- var _styles = require("../styles");
13
-
14
- var _usePaperStyles = _interopRequireDefault(require("../Paper/usePaperStyles"));
15
-
16
- var _utils = require("./utils");
17
-
18
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
19
-
20
- const useStyles = function () {
21
- return {
22
- background: {
23
- position: 'absolute',
24
- top: 6,
25
- left: 10,
26
- bottom: 0,
27
- right: 0,
28
- width: 8,
29
- height: 4
30
- },
31
- backgroundText: {
32
- position: 'absolute',
33
- left: 18,
34
- paddingHorizontal: 0,
35
- color: 'transparent'
36
- },
37
- placeholder: {
38
- position: 'absolute',
39
- left: 0,
40
- paddingHorizontal: _utils.inputPaddingHorizontal
41
- }
42
- };
43
- };
44
-
45
- const InputLabel = props => {
46
- const {
47
- activeColor,
48
- animatedError,
49
- animatedLabel,
50
- error = false,
51
- errorColor,
52
- focused,
53
- fontSize,
54
- hasActiveOutline,
55
- label,
56
- labelLayout,
57
- labelScale,
58
- labelTranslateX,
59
- labelTranslateY,
60
- onLayoutAnimatedText,
61
- paddingOffset,
62
- placeholderColor,
63
- placeholderOpacity,
64
- topPosition,
65
- value
66
- } = props;
67
- const theme = (0, _styles.useTheme)();
68
- const styles = useStyles();
69
- const paperStyles = (0, _usePaperStyles.default)();
70
- const backgroundStyle = {
71
- backgroundColor: (paperStyles === null || paperStyles === void 0 ? void 0 : paperStyles.backgroundColor) ?? theme.palette.background.default
72
- };
73
- const hasFocus = hasActiveOutline || value;
74
- const opacity = animatedLabel.interpolate({
75
- inputRange: [0, 1],
76
- outputRange: [hasFocus ? 1 : 0, 0]
77
- });
78
- const labelTranslationX = {
79
- transform: [{
80
- translateX: animatedLabel.interpolate({
81
- inputRange: [0, 1],
82
- outputRange: [labelTranslateX, 0 || 0]
83
- })
84
- }]
85
- };
86
- const labelTextFontStyle = (0, _styles.createFontStyle)(theme, {
87
- selector: typo => typo.caption2
88
- });
89
- const labelStyle = {
90
- fontSize,
91
- transform: [{
92
- translateX: animatedError.interpolate({
93
- inputRange: [0, 0.5, 1],
94
- outputRange: [0, value && error ? 4 : 0, 0]
95
- })
96
- }, {
97
- translateY: animatedLabel.interpolate({
98
- inputRange: [0, 1],
99
- outputRange: [labelTranslateY, 0]
100
- })
101
- }, {
102
- scale: animatedLabel.interpolate({
103
- inputRange: [0, 1],
104
- outputRange: [labelScale, 1]
105
- })
106
- }]
107
- };
108
- return label ? /*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
109
- pointerEvents: 'none',
110
- style: [_reactNative.StyleSheet.absoluteFill, {
111
- opacity: value || focused ? labelLayout.measured ? 1 : 0 : 1
112
- }, labelTranslationX]
113
- }, [/*#__PURE__*/_react.default.createElement(_reactNative.Animated.View, {
114
- key: 'labelBackground-view',
115
- pointerEvents: 'none',
116
- style: [styles.background, backgroundStyle, {
117
- opacity,
118
- transform: [{
119
- translateX: animatedLabel.interpolate({
120
- inputRange: [0, 1],
121
- outputRange: [-labelTranslateX, 0]
122
- })
123
- }]
124
- }]
125
- }), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.Text, {
126
- key: 'labelBackground-text',
127
- style: [labelTextFontStyle, styles.placeholder, styles.backgroundText, backgroundStyle, labelStyle, {
128
- top: topPosition + 1,
129
- opacity,
130
- transform: [...labelStyle.transform, {
131
- scaleY: animatedLabel.interpolate({
132
- inputRange: [0, 1],
133
- outputRange: [0.2, 1]
134
- })
135
- }]
136
- }],
137
- numberOfLines: 1
138
- }, label)], /*#__PURE__*/_react.default.createElement(_reactNative.Animated.Text, {
139
- onLayout: onLayoutAnimatedText,
140
- style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
141
- textAlign: 'left',
142
- top: topPosition,
143
- color: error && errorColor ? errorColor : activeColor,
144
- opacity: animatedLabel.interpolate({
145
- inputRange: [0, 1],
146
- outputRange: [hasActiveOutline ? 1 : 0, 0]
147
- })
148
- }],
149
- numberOfLines: 1
150
- }, label), /*#__PURE__*/_react.default.createElement(_reactNative.Animated.Text, {
151
- style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
152
- textAlign: 'left',
153
- top: topPosition,
154
- color: error && errorColor ? errorColor : placeholderColor,
155
- opacity: placeholderOpacity
156
- }],
157
- numberOfLines: 1
158
- }, label)) : null;
159
- };
160
-
161
- var _default = InputLabel;
162
- exports.default = _default;
163
- //# sourceMappingURL=InputLabel.js.map
@@ -1 +0,0 @@
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,IAAAA,WAAW,WAAX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N;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"}
@@ -1,149 +0,0 @@
1
- import React from 'react';
2
- import { Animated, StyleSheet } from 'react-native';
3
- import { createFontStyle, useTheme } from '../styles';
4
- import usePaperStyles from '../Paper/usePaperStyles';
5
- import { inputPaddingHorizontal } from './utils';
6
-
7
- const useStyles = function () {
8
- return {
9
- background: {
10
- position: 'absolute',
11
- top: 6,
12
- left: 10,
13
- bottom: 0,
14
- right: 0,
15
- width: 8,
16
- height: 4
17
- },
18
- backgroundText: {
19
- position: 'absolute',
20
- left: 18,
21
- paddingHorizontal: 0,
22
- color: 'transparent'
23
- },
24
- placeholder: {
25
- position: 'absolute',
26
- left: 0,
27
- paddingHorizontal: inputPaddingHorizontal
28
- }
29
- };
30
- };
31
-
32
- const InputLabel = props => {
33
- const {
34
- activeColor,
35
- animatedError,
36
- animatedLabel,
37
- error = false,
38
- errorColor,
39
- focused,
40
- fontSize,
41
- hasActiveOutline,
42
- label,
43
- labelLayout,
44
- labelScale,
45
- labelTranslateX,
46
- labelTranslateY,
47
- onLayoutAnimatedText,
48
- paddingOffset,
49
- placeholderColor,
50
- placeholderOpacity,
51
- topPosition,
52
- value
53
- } = props;
54
- const theme = useTheme();
55
- const styles = useStyles();
56
- const paperStyles = usePaperStyles();
57
- const backgroundStyle = {
58
- backgroundColor: (paperStyles === null || paperStyles === void 0 ? void 0 : paperStyles.backgroundColor) ?? theme.palette.background.default
59
- };
60
- const hasFocus = hasActiveOutline || value;
61
- const opacity = animatedLabel.interpolate({
62
- inputRange: [0, 1],
63
- outputRange: [hasFocus ? 1 : 0, 0]
64
- });
65
- const labelTranslationX = {
66
- transform: [{
67
- translateX: animatedLabel.interpolate({
68
- inputRange: [0, 1],
69
- outputRange: [labelTranslateX, 0 || 0]
70
- })
71
- }]
72
- };
73
- const labelTextFontStyle = createFontStyle(theme, {
74
- selector: typo => typo.caption2
75
- });
76
- const labelStyle = {
77
- fontSize,
78
- transform: [{
79
- translateX: animatedError.interpolate({
80
- inputRange: [0, 0.5, 1],
81
- outputRange: [0, value && error ? 4 : 0, 0]
82
- })
83
- }, {
84
- translateY: animatedLabel.interpolate({
85
- inputRange: [0, 1],
86
- outputRange: [labelTranslateY, 0]
87
- })
88
- }, {
89
- scale: animatedLabel.interpolate({
90
- inputRange: [0, 1],
91
- outputRange: [labelScale, 1]
92
- })
93
- }]
94
- };
95
- return label ? /*#__PURE__*/React.createElement(Animated.View, {
96
- pointerEvents: 'none',
97
- style: [StyleSheet.absoluteFill, {
98
- opacity: value || focused ? labelLayout.measured ? 1 : 0 : 1
99
- }, labelTranslationX]
100
- }, [/*#__PURE__*/React.createElement(Animated.View, {
101
- key: 'labelBackground-view',
102
- pointerEvents: 'none',
103
- style: [styles.background, backgroundStyle, {
104
- opacity,
105
- transform: [{
106
- translateX: animatedLabel.interpolate({
107
- inputRange: [0, 1],
108
- outputRange: [-labelTranslateX, 0]
109
- })
110
- }]
111
- }]
112
- }), /*#__PURE__*/React.createElement(Animated.Text, {
113
- key: 'labelBackground-text',
114
- style: [labelTextFontStyle, styles.placeholder, styles.backgroundText, backgroundStyle, labelStyle, {
115
- top: topPosition + 1,
116
- opacity,
117
- transform: [...labelStyle.transform, {
118
- scaleY: animatedLabel.interpolate({
119
- inputRange: [0, 1],
120
- outputRange: [0.2, 1]
121
- })
122
- }]
123
- }],
124
- numberOfLines: 1
125
- }, label)], /*#__PURE__*/React.createElement(Animated.Text, {
126
- onLayout: onLayoutAnimatedText,
127
- style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
128
- textAlign: 'left',
129
- top: topPosition,
130
- color: error && errorColor ? errorColor : activeColor,
131
- opacity: animatedLabel.interpolate({
132
- inputRange: [0, 1],
133
- outputRange: [hasActiveOutline ? 1 : 0, 0]
134
- })
135
- }],
136
- numberOfLines: 1
137
- }, label), /*#__PURE__*/React.createElement(Animated.Text, {
138
- style: [styles.placeholder, labelTextFontStyle, labelStyle, paddingOffset, {
139
- textAlign: 'left',
140
- top: topPosition,
141
- color: error && errorColor ? errorColor : placeholderColor,
142
- opacity: placeholderOpacity
143
- }],
144
- numberOfLines: 1
145
- }, label)) : null;
146
- };
147
-
148
- export default InputLabel;
149
- //# sourceMappingURL=InputLabel.js.map
@@ -1 +0,0 @@
1
- {"version":3,"names":["React","Animated","StyleSheet","createFontStyle","useTheme","usePaperStyles","inputPaddingHorizontal","useStyles","background","position","top","left","bottom","right","width","height","backgroundText","paddingHorizontal","color","placeholder","InputLabel","props","activeColor","animatedError","animatedLabel","error","errorColor","focused","fontSize","hasActiveOutline","label","labelLayout","labelScale","labelTranslateX","labelTranslateY","onLayoutAnimatedText","paddingOffset","placeholderColor","placeholderOpacity","topPosition","value","theme","styles","paperStyles","backgroundStyle","backgroundColor","palette","default","hasFocus","opacity","interpolate","inputRange","outputRange","labelTranslationX","transform","translateX","labelTextFontStyle","selector","typo","caption2","labelStyle","translateY","scale","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,OAAOA,KAAP,MAAkB,OAAlB;AACA,SAASC,QAAT,EAAsCC,UAAtC,QAAwD,cAAxD;AAEA,SAASC,eAAT,EAA0BC,QAA1B,QAA0C,WAA1C;AACA,OAAOC,cAAP,MAA2B,yBAA3B;AACA,SAASC,sBAAT,QAAuC,SAAvC;;AA2BA,MAAMC,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;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xB,EAA2B,CAA3B;MAFkB,CAA1B;IAJb,CALG,CAFX;IAiBI,aAAa,EAAE;EAjBnB,GAmBKC,KAnBL,CAzDJ,eA8EI,oBAAC,QAAD,CAAU,IAAV;IACI,KAAK,EAAE,CACHY,MAAM,CAACvB,WADJ,EAEHqC,kBAFG,EAGHI,UAHG,EAIHxB,aAJG,EAKH;MACI8B,SAAS,EAAE,MADf;MAEIxD,GAAG,EAAE6B,WAFT;MAGIrB,KAAK,EAAEO,KAAK,IAAIC,UAAT,GAAsBA,UAAtB,GAAmCW,gBAH9C;MAIIY,OAAO,EAAEX;IAJb,CALG,CADX;IAaI,aAAa,EAAE;EAbnB,GAeKR,KAfL,CA9EJ,CADS,GAiGT,IAjGJ;AAkGH,CA9KD;;AAgLA,eAAeV,UAAf"}
@@ -1,33 +0,0 @@
1
- /// <reference types="react" />
2
- import { Animated, LayoutChangeEvent } from 'react-native';
3
- interface LabelProps {
4
- activeColor: string;
5
- animatedError: Animated.Value;
6
- animatedLabel: Animated.Value;
7
- error?: boolean;
8
- errorColor?: string;
9
- focused?: boolean;
10
- fontSize?: number;
11
- hasActiveOutline?: boolean;
12
- label?: string;
13
- labelLayout: {
14
- measured: boolean;
15
- width: number;
16
- height: number;
17
- };
18
- labelScale: number;
19
- labelTranslateX: number;
20
- labelTranslateY: number;
21
- onLayoutAnimatedText: (event: LayoutChangeEvent) => void;
22
- paddingOffset?: {
23
- paddingLeft: number;
24
- paddingRight: number;
25
- };
26
- placeholder?: string;
27
- placeholderColor?: string;
28
- placeholderOpacity: number | Animated.AnimatedInterpolation;
29
- topPosition: number;
30
- value?: string;
31
- }
32
- declare const InputLabel: (props: LabelProps) => JSX.Element | null;
33
- export default InputLabel;
@@ -1,234 +0,0 @@
1
- import React from 'react';
2
- import { Animated, LayoutChangeEvent, StyleSheet } from 'react-native';
3
- import { NamedStylesStringUnion, UseStyles } from '@fountain-ui/styles';
4
- import { createFontStyle, useTheme } from '../styles';
5
- import usePaperStyles from '../Paper/usePaperStyles';
6
- import { inputPaddingHorizontal } from './utils';
7
-
8
- interface LabelProps {
9
- activeColor: string;
10
- animatedError: Animated.Value;
11
- animatedLabel: Animated.Value;
12
- error?: boolean;
13
- errorColor?: string;
14
- focused?: boolean;
15
- fontSize?: number;
16
- hasActiveOutline?: boolean;
17
- label?: string;
18
- labelLayout: { measured: boolean; width: number; height: number };
19
- labelScale: number;
20
- labelTranslateX: number;
21
- labelTranslateY: number;
22
- onLayoutAnimatedText: (event: LayoutChangeEvent) => void;
23
- paddingOffset?: { paddingLeft: number; paddingRight: number };
24
- placeholder?: string;
25
- placeholderColor?: string;
26
- placeholderOpacity: number | Animated.AnimatedInterpolation;
27
- topPosition: number;
28
- value?: string;
29
- }
30
-
31
- type InputLabelStyles = NamedStylesStringUnion<'background' | 'backgroundText' | 'placeholder'>;
32
-
33
- const useStyles: UseStyles<InputLabelStyles> = function (): InputLabelStyles {
34
- return {
35
- background: {
36
- position: 'absolute',
37
- top: 6,
38
- left: 10,
39
- bottom: 0,
40
- right: 0,
41
- width: 8,
42
- height: 4,
43
- },
44
- backgroundText: {
45
- position: 'absolute',
46
- left: 18,
47
- paddingHorizontal: 0,
48
- color: 'transparent',
49
- },
50
- placeholder: {
51
- position: 'absolute',
52
- left: 0,
53
- paddingHorizontal: inputPaddingHorizontal,
54
- },
55
- };
56
- };
57
-
58
- const InputLabel = (props: LabelProps) => {
59
- const {
60
- activeColor,
61
- animatedError,
62
- animatedLabel,
63
- error = false,
64
- errorColor,
65
- focused,
66
- fontSize,
67
- hasActiveOutline,
68
- label,
69
- labelLayout,
70
- labelScale,
71
- labelTranslateX,
72
- labelTranslateY,
73
- onLayoutAnimatedText,
74
- paddingOffset,
75
- placeholderColor,
76
- placeholderOpacity,
77
- topPosition,
78
- value,
79
- } = props;
80
-
81
- const theme = useTheme();
82
-
83
- const styles = useStyles();
84
-
85
- const paperStyles = usePaperStyles();
86
-
87
- const backgroundStyle = {
88
- backgroundColor: paperStyles?.backgroundColor ?? theme.palette.background.default,
89
- };
90
-
91
- const hasFocus = hasActiveOutline || value;
92
- const opacity = animatedLabel.interpolate({
93
- inputRange: [0, 1],
94
- outputRange: [hasFocus ? 1 : 0, 0],
95
- });
96
-
97
- const labelTranslationX = {
98
- transform: [
99
- {
100
- translateX: animatedLabel.interpolate({
101
- inputRange: [0, 1],
102
- outputRange: [labelTranslateX, 0 || 0],
103
- }),
104
- },
105
- ],
106
- };
107
-
108
- const labelTextFontStyle = createFontStyle(theme, { selector: (typo) => typo.caption2 });
109
-
110
- const labelStyle = {
111
- fontSize,
112
- transform: [
113
- {
114
- translateX: animatedError.interpolate({
115
- inputRange: [0, 0.5, 1],
116
- outputRange: [0, value && error ? 4 : 0, 0],
117
- }),
118
- },
119
- {
120
- translateY: animatedLabel.interpolate({
121
- inputRange: [0, 1],
122
- outputRange: [labelTranslateY, 0],
123
- }),
124
- },
125
- {
126
- scale: animatedLabel.interpolate({
127
- inputRange: [0, 1],
128
- outputRange: [labelScale, 1],
129
- }),
130
- },
131
- ],
132
- };
133
-
134
- return (label ? (
135
- <Animated.View
136
- pointerEvents={'none'}
137
- style={[
138
- StyleSheet.absoluteFill,
139
- {
140
- opacity: value || focused ? (labelLayout.measured ? 1 : 0) : 1,
141
- },
142
- labelTranslationX,
143
- ]}
144
- >
145
- {[
146
- <Animated.View
147
- key={'labelBackground-view'}
148
- pointerEvents={'none'}
149
- style={[
150
- styles.background,
151
- backgroundStyle,
152
- {
153
- opacity,
154
- transform: [
155
- {
156
- translateX: animatedLabel.interpolate({
157
- inputRange: [0, 1],
158
- outputRange: [-labelTranslateX, 0],
159
- }),
160
- },
161
- ],
162
- },
163
- ]}
164
- />,
165
- <Animated.Text
166
- key={'labelBackground-text'}
167
- style={[
168
- labelTextFontStyle,
169
- styles.placeholder,
170
- styles.backgroundText,
171
- backgroundStyle,
172
- labelStyle,
173
- {
174
- top: topPosition + 1,
175
- opacity,
176
- transform: [
177
- ...labelStyle.transform,
178
- {
179
- scaleY: animatedLabel.interpolate({
180
- inputRange: [0, 1],
181
- outputRange: [0.2, 1],
182
- }),
183
- },
184
- ],
185
- },
186
- ]}
187
- numberOfLines={1}
188
- >
189
- {label}
190
- </Animated.Text>,
191
- ]}
192
- <Animated.Text
193
- onLayout={onLayoutAnimatedText}
194
- style={[
195
- styles.placeholder,
196
- labelTextFontStyle,
197
- labelStyle,
198
- paddingOffset,
199
- {
200
- textAlign: 'left',
201
- top: topPosition,
202
- color: error && errorColor ? errorColor : activeColor,
203
- opacity: animatedLabel.interpolate({
204
- inputRange: [0, 1],
205
- outputRange: [hasActiveOutline ? 1 : 0, 0],
206
- }),
207
- },
208
- ]}
209
- numberOfLines={1}
210
- >
211
- {label}
212
- </Animated.Text>
213
- <Animated.Text
214
- style={[
215
- styles.placeholder,
216
- labelTextFontStyle,
217
- labelStyle,
218
- paddingOffset,
219
- {
220
- textAlign: 'left',
221
- top: topPosition,
222
- color: error && errorColor ? errorColor : placeholderColor,
223
- opacity: placeholderOpacity,
224
- },
225
- ]}
226
- numberOfLines={1}
227
- >
228
- {label}
229
- </Animated.Text>
230
- </Animated.View>
231
- ) : null);
232
- };
233
-
234
- export default InputLabel;