@codeleap/mobile 2.4.7 → 3.1.1

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 (450) hide show
  1. package/mobile-packages.code-workspace +27 -0
  2. package/package.json +25 -33
  3. package/src/components/ActionIcon/index.tsx +16 -6
  4. package/src/components/ActionIcon/styles.ts +3 -90
  5. package/src/components/ActivityIndicator/index.tsx +28 -9
  6. package/src/components/ActivityIndicator/styles.ts +2 -59
  7. package/src/components/Autocomplete/index.tsx +235 -0
  8. package/src/components/Autocomplete/styles.ts +18 -0
  9. package/src/components/Autocomplete/types.ts +75 -0
  10. package/src/components/Avatar/index.tsx +126 -0
  11. package/src/components/Avatar/styles.ts +22 -0
  12. package/src/components/AvatarGroup/index.tsx +76 -0
  13. package/src/components/AvatarGroup/styles.ts +11 -0
  14. package/src/components/Backdrop/index.tsx +14 -13
  15. package/src/components/Backdrop/styles.ts +3 -24
  16. package/src/components/Badge/index.tsx +134 -0
  17. package/src/components/Badge/styles.ts +14 -0
  18. package/src/components/Button/index.tsx +39 -49
  19. package/src/components/Button/styles.ts +6 -107
  20. package/src/components/Calendar/index.tsx +3 -3
  21. package/src/components/Calendar/style.ts +2 -31
  22. package/src/components/Checkbox/index.tsx +137 -74
  23. package/src/components/Checkbox/styles.ts +13 -73
  24. package/src/components/ContentView/index.tsx +2 -2
  25. package/src/components/ContentView/styles.ts +1 -17
  26. package/src/components/DatePickerModal/index.tsx +240 -0
  27. package/src/components/DatePickerModal/styles.ts +15 -0
  28. package/src/components/DatePickerModal/types.ts +55 -0
  29. package/src/components/Drawer/index.tsx +2 -2
  30. package/src/components/Drawer/styles.ts +4 -39
  31. package/src/components/EmptyPlaceholder/index.tsx +3 -3
  32. package/src/components/EmptyPlaceholder/styles.ts +2 -47
  33. package/src/components/FileInput/styles.ts +1 -8
  34. package/src/components/Grid/index.tsx +76 -72
  35. package/src/components/Grid/styles.ts +4 -7
  36. package/src/components/Icon/index.tsx +46 -8
  37. package/src/components/Icon/styles.ts +3 -51
  38. package/src/components/Image/index.tsx +18 -22
  39. package/src/components/Image/styles.ts +1 -14
  40. package/src/components/ImageView/Spotlight.tsx +4 -2
  41. package/src/components/ImageView/component.tsx +0 -3
  42. package/src/components/InputBase/index.tsx +101 -0
  43. package/src/components/InputBase/styles.ts +135 -0
  44. package/src/components/InputBase/types.ts +28 -0
  45. package/src/components/InputBase/utils.ts +42 -0
  46. package/src/components/InputLabel/index.tsx +3 -3
  47. package/src/components/InputLabel/styles.ts +2 -14
  48. package/src/components/List/PaginationIndicator.tsx +4 -21
  49. package/src/components/List/index.tsx +84 -46
  50. package/src/components/List/styles.ts +8 -20
  51. package/src/components/LoadingOverlay/index.tsx +45 -45
  52. package/src/components/LoadingOverlay/styles.ts +5 -27
  53. package/src/components/Modal/index.tsx +56 -32
  54. package/src/components/Modal/styles.ts +3 -114
  55. package/src/components/NumberIncrement/index.tsx +318 -0
  56. package/src/components/NumberIncrement/styles.ts +14 -0
  57. package/src/components/NumberIncrement/types.ts +44 -0
  58. package/src/components/NumberIncrement/utils.ts +27 -0
  59. package/src/components/Pager/index.tsx +120 -67
  60. package/src/components/Pager/styles.ts +2 -69
  61. package/src/components/RadioInput/index.tsx +145 -68
  62. package/src/components/RadioInput/styles.ts +8 -61
  63. package/src/components/RefreshControl/index.tsx +28 -0
  64. package/src/components/RefreshControl/styles.ts +7 -0
  65. package/src/components/Scroll/index.tsx +22 -37
  66. package/src/components/Scroll/styles.ts +2 -16
  67. package/src/components/Sections/index.tsx +116 -54
  68. package/src/components/Sections/styles.ts +7 -0
  69. package/src/components/SegmentedControl/Option.tsx +51 -0
  70. package/src/components/SegmentedControl/index.tsx +51 -67
  71. package/src/components/SegmentedControl/styles.ts +7 -63
  72. package/src/components/Select/index.tsx +268 -95
  73. package/src/components/Select/styles.ts +11 -131
  74. package/src/components/Select/types.ts +47 -11
  75. package/src/components/Slider/index.tsx +151 -94
  76. package/src/components/Slider/styles.ts +7 -72
  77. package/src/components/Slider/types.ts +18 -20
  78. package/src/components/Switch/index.tsx +115 -63
  79. package/src/components/Switch/styles.ts +13 -30
  80. package/src/components/Text/index.tsx +14 -31
  81. package/src/components/Text/styles.ts +2 -41
  82. package/src/components/TextInput/index.tsx +237 -259
  83. package/src/components/TextInput/styles.ts +6 -120
  84. package/src/components/Touchable/index.tsx +74 -27
  85. package/src/components/Touchable/styles.ts +1 -12
  86. package/src/components/View/index.tsx +11 -26
  87. package/src/components/View/styles.ts +1 -17
  88. package/src/components/components.ts +9 -5
  89. package/src/components/defaultStyles.ts +74 -61
  90. package/src/index.ts +0 -1
  91. package/src/modules/PressableRipple/index.ts +5 -0
  92. package/src/modules/PressableRipple/ripple.js +258 -0
  93. package/src/modules/PressableRipple/styles.js +22 -0
  94. package/src/modules/PressableRipple/type.ts +17 -0
  95. package/src/modules/textInputMask.tsx +13 -0
  96. package/src/types/index.ts +5 -0
  97. package/src/types/utility.ts +2 -2
  98. package/src/utils/KeyboardAware/index.ts +0 -13
  99. package/src/utils/KeyboardAware/keyboardHooks.ts +69 -79
  100. package/src/utils/hooks.ts +63 -36
  101. package/src/utils/index.ts +1 -0
  102. package/src/utils/locale.ts +7 -0
  103. package/src/utils/theme.ts +1 -21
  104. package/dist/components/ActionIcon/index.d.ts +0 -13
  105. package/dist/components/ActionIcon/index.js +0 -51
  106. package/dist/components/ActionIcon/index.js.map +0 -1
  107. package/dist/components/ActionIcon/styles.d.ts +0 -65
  108. package/dist/components/ActionIcon/styles.js +0 -61
  109. package/dist/components/ActionIcon/styles.js.map +0 -1
  110. package/dist/components/ActivityIndicator/index.d.ts +0 -15
  111. package/dist/components/ActivityIndicator/index.js +0 -55
  112. package/dist/components/ActivityIndicator/index.js.map +0 -1
  113. package/dist/components/ActivityIndicator/styles.d.ts +0 -59
  114. package/dist/components/ActivityIndicator/styles.js +0 -52
  115. package/dist/components/ActivityIndicator/styles.js.map +0 -1
  116. package/dist/components/Animated.d.ts +0 -15
  117. package/dist/components/Animated.js +0 -55
  118. package/dist/components/Animated.js.map +0 -1
  119. package/dist/components/AutoComplete/index.d.ts +0 -34
  120. package/dist/components/AutoComplete/index.js +0 -126
  121. package/dist/components/AutoComplete/index.js.map +0 -1
  122. package/dist/components/AutoComplete/styles.d.ts +0 -57
  123. package/dist/components/AutoComplete/styles.js +0 -89
  124. package/dist/components/AutoComplete/styles.js.map +0 -1
  125. package/dist/components/Backdrop/index.d.ts +0 -14
  126. package/dist/components/Backdrop/index.js +0 -59
  127. package/dist/components/Backdrop/index.js.map +0 -1
  128. package/dist/components/Backdrop/styles.d.ts +0 -53
  129. package/dist/components/Backdrop/styles.js +0 -28
  130. package/dist/components/Backdrop/styles.js.map +0 -1
  131. package/dist/components/Button/index.d.ts +0 -246
  132. package/dist/components/Button/index.js +0 -115
  133. package/dist/components/Button/index.js.map +0 -1
  134. package/dist/components/Button/styles.d.ts +0 -65
  135. package/dist/components/Button/styles.js +0 -61
  136. package/dist/components/Button/styles.js.map +0 -1
  137. package/dist/components/Calendar/index.d.ts +0 -15
  138. package/dist/components/Calendar/index.js +0 -76
  139. package/dist/components/Calendar/index.js.map +0 -1
  140. package/dist/components/Calendar/style.d.ts +0 -4
  141. package/dist/components/Calendar/style.js +0 -36
  142. package/dist/components/Calendar/style.js.map +0 -1
  143. package/dist/components/Calendar/types.d.ts +0 -95
  144. package/dist/components/Calendar/types.js +0 -3
  145. package/dist/components/Calendar/types.js.map +0 -1
  146. package/dist/components/Checkbox/index.d.ts +0 -15
  147. package/dist/components/Checkbox/index.js +0 -81
  148. package/dist/components/Checkbox/index.js.map +0 -1
  149. package/dist/components/Checkbox/styles.d.ts +0 -56
  150. package/dist/components/Checkbox/styles.js +0 -53
  151. package/dist/components/Checkbox/styles.js.map +0 -1
  152. package/dist/components/ContentView/index.d.ts +0 -12
  153. package/dist/components/ContentView/index.js +0 -62
  154. package/dist/components/ContentView/index.js.map +0 -1
  155. package/dist/components/ContentView/styles.d.ts +0 -53
  156. package/dist/components/ContentView/styles.js +0 -26
  157. package/dist/components/ContentView/styles.js.map +0 -1
  158. package/dist/components/Drawer/index.d.ts +0 -7
  159. package/dist/components/Drawer/index.js +0 -66
  160. package/dist/components/Drawer/index.js.map +0 -1
  161. package/dist/components/Drawer/styles.d.ts +0 -56
  162. package/dist/components/Drawer/styles.js +0 -39
  163. package/dist/components/Drawer/styles.js.map +0 -1
  164. package/dist/components/EmptyPlaceholder/index.d.ts +0 -25
  165. package/dist/components/EmptyPlaceholder/index.js +0 -88
  166. package/dist/components/EmptyPlaceholder/index.js.map +0 -1
  167. package/dist/components/EmptyPlaceholder/styles.d.ts +0 -55
  168. package/dist/components/EmptyPlaceholder/styles.js +0 -30
  169. package/dist/components/EmptyPlaceholder/styles.js.map +0 -1
  170. package/dist/components/FileInput/index.d.ts +0 -24
  171. package/dist/components/FileInput/index.js +0 -179
  172. package/dist/components/FileInput/index.js.map +0 -1
  173. package/dist/components/FileInput/styles.d.ts +0 -53
  174. package/dist/components/FileInput/styles.js +0 -19
  175. package/dist/components/FileInput/styles.js.map +0 -1
  176. package/dist/components/Grid/index.d.ts +0 -32
  177. package/dist/components/Grid/index.js +0 -80
  178. package/dist/components/Grid/index.js.map +0 -1
  179. package/dist/components/Grid/styles.d.ts +0 -54
  180. package/dist/components/Grid/styles.js +0 -19
  181. package/dist/components/Grid/styles.js.map +0 -1
  182. package/dist/components/Icon/index.d.ts +0 -14
  183. package/dist/components/Icon/index.js +0 -75
  184. package/dist/components/Icon/index.js.map +0 -1
  185. package/dist/components/Icon/styles.d.ts +0 -61
  186. package/dist/components/Icon/styles.js +0 -49
  187. package/dist/components/Icon/styles.js.map +0 -1
  188. package/dist/components/Image/index.d.ts +0 -25
  189. package/dist/components/Image/index.js +0 -130
  190. package/dist/components/Image/index.js.map +0 -1
  191. package/dist/components/Image/styles.d.ts +0 -55
  192. package/dist/components/Image/styles.js +0 -25
  193. package/dist/components/Image/styles.js.map +0 -1
  194. package/dist/components/ImageView/Spotlight.d.ts +0 -25
  195. package/dist/components/ImageView/Spotlight.js +0 -150
  196. package/dist/components/ImageView/Spotlight.js.map +0 -1
  197. package/dist/components/ImageView/component.d.ts +0 -5
  198. package/dist/components/ImageView/component.js +0 -50
  199. package/dist/components/ImageView/component.js.map +0 -1
  200. package/dist/components/ImageView/index.d.ts +0 -2
  201. package/dist/components/ImageView/index.js +0 -15
  202. package/dist/components/ImageView/index.js.map +0 -1
  203. package/dist/components/InputLabel/index.d.ts +0 -12
  204. package/dist/components/InputLabel/index.js +0 -58
  205. package/dist/components/InputLabel/index.js.map +0 -1
  206. package/dist/components/InputLabel/styles.d.ts +0 -4
  207. package/dist/components/InputLabel/styles.js +0 -26
  208. package/dist/components/InputLabel/styles.js.map +0 -1
  209. package/dist/components/List/PaginationIndicator.d.ts +0 -67
  210. package/dist/components/List/PaginationIndicator.js +0 -51
  211. package/dist/components/List/PaginationIndicator.js.map +0 -1
  212. package/dist/components/List/index.d.ts +0 -31
  213. package/dist/components/List/index.js +0 -77
  214. package/dist/components/List/index.js.map +0 -1
  215. package/dist/components/List/styles.d.ts +0 -54
  216. package/dist/components/List/styles.js +0 -28
  217. package/dist/components/List/styles.js.map +0 -1
  218. package/dist/components/LoadingOverlay/index.d.ts +0 -11
  219. package/dist/components/LoadingOverlay/index.js +0 -60
  220. package/dist/components/LoadingOverlay/index.js.map +0 -1
  221. package/dist/components/LoadingOverlay/styles.d.ts +0 -7
  222. package/dist/components/LoadingOverlay/styles.js +0 -34
  223. package/dist/components/LoadingOverlay/styles.js.map +0 -1
  224. package/dist/components/Modal/index.d.ts +0 -43
  225. package/dist/components/Modal/index.js +0 -147
  226. package/dist/components/Modal/index.js.map +0 -1
  227. package/dist/components/Modal/styles.d.ts +0 -58
  228. package/dist/components/Modal/styles.js +0 -74
  229. package/dist/components/Modal/styles.js.map +0 -1
  230. package/dist/components/MultiSelect/index.d.ts +0 -6
  231. package/dist/components/MultiSelect/index.js +0 -119
  232. package/dist/components/MultiSelect/index.js.map +0 -1
  233. package/dist/components/MultiSelect/styles.d.ts +0 -7
  234. package/dist/components/MultiSelect/styles.js +0 -84
  235. package/dist/components/MultiSelect/styles.js.map +0 -1
  236. package/dist/components/MultiSelect/types.d.ts +0 -43
  237. package/dist/components/MultiSelect/types.js +0 -3
  238. package/dist/components/MultiSelect/types.js.map +0 -1
  239. package/dist/components/Navigation/Navigation.d.ts +0 -3
  240. package/dist/components/Navigation/Navigation.js +0 -80
  241. package/dist/components/Navigation/Navigation.js.map +0 -1
  242. package/dist/components/Navigation/constants.d.ts +0 -5
  243. package/dist/components/Navigation/constants.js +0 -11
  244. package/dist/components/Navigation/constants.js.map +0 -1
  245. package/dist/components/Navigation/index.d.ts +0 -3
  246. package/dist/components/Navigation/index.js +0 -16
  247. package/dist/components/Navigation/index.js.map +0 -1
  248. package/dist/components/Navigation/types.d.ts +0 -26
  249. package/dist/components/Navigation/types.js +0 -8
  250. package/dist/components/Navigation/types.js.map +0 -1
  251. package/dist/components/Navigation/utils.d.ts +0 -3
  252. package/dist/components/Navigation/utils.js +0 -69
  253. package/dist/components/Navigation/utils.js.map +0 -1
  254. package/dist/components/Pager/index.d.ts +0 -26
  255. package/dist/components/Pager/index.js +0 -84
  256. package/dist/components/Pager/index.js.map +0 -1
  257. package/dist/components/Pager/styles.d.ts +0 -87
  258. package/dist/components/Pager/styles.js +0 -72
  259. package/dist/components/Pager/styles.js.map +0 -1
  260. package/dist/components/RadioInput/index.d.ts +0 -27
  261. package/dist/components/RadioInput/index.js +0 -72
  262. package/dist/components/RadioInput/index.js.map +0 -1
  263. package/dist/components/RadioInput/styles.d.ts +0 -58
  264. package/dist/components/RadioInput/styles.js +0 -50
  265. package/dist/components/RadioInput/styles.js.map +0 -1
  266. package/dist/components/Scroll/index.d.ts +0 -124
  267. package/dist/components/Scroll/index.js +0 -97
  268. package/dist/components/Scroll/index.js.map +0 -1
  269. package/dist/components/Scroll/styles.d.ts +0 -53
  270. package/dist/components/Scroll/styles.js +0 -26
  271. package/dist/components/Scroll/styles.js.map +0 -1
  272. package/dist/components/Sections/index.d.ts +0 -115
  273. package/dist/components/Sections/index.js +0 -76
  274. package/dist/components/Sections/index.js.map +0 -1
  275. package/dist/components/SegmentedControl/index.d.ts +0 -52
  276. package/dist/components/SegmentedControl/index.js +0 -131
  277. package/dist/components/SegmentedControl/index.js.map +0 -1
  278. package/dist/components/SegmentedControl/styles.d.ts +0 -60
  279. package/dist/components/SegmentedControl/styles.js +0 -43
  280. package/dist/components/SegmentedControl/styles.js.map +0 -1
  281. package/dist/components/Select/index.d.ts +0 -16
  282. package/dist/components/Select/index.js +0 -122
  283. package/dist/components/Select/index.js.map +0 -1
  284. package/dist/components/Select/styles.d.ts +0 -60
  285. package/dist/components/Select/styles.js +0 -83
  286. package/dist/components/Select/styles.js.map +0 -1
  287. package/dist/components/Select/types.d.ts +0 -43
  288. package/dist/components/Select/types.js +0 -3
  289. package/dist/components/Select/types.js.map +0 -1
  290. package/dist/components/Slider/Mark.d.ts +0 -3
  291. package/dist/components/Slider/Mark.js +0 -32
  292. package/dist/components/Slider/Mark.js.map +0 -1
  293. package/dist/components/Slider/Thumb.d.ts +0 -7
  294. package/dist/components/Slider/Thumb.js +0 -30
  295. package/dist/components/Slider/Thumb.js.map +0 -1
  296. package/dist/components/Slider/index.d.ts +0 -4
  297. package/dist/components/Slider/index.js +0 -99
  298. package/dist/components/Slider/index.js.map +0 -1
  299. package/dist/components/Slider/styles.d.ts +0 -54
  300. package/dist/components/Slider/styles.js +0 -61
  301. package/dist/components/Slider/styles.js.map +0 -1
  302. package/dist/components/Slider/types.d.ts +0 -26
  303. package/dist/components/Slider/types.js +0 -3
  304. package/dist/components/Slider/types.js.map +0 -1
  305. package/dist/components/Switch/index.d.ts +0 -14
  306. package/dist/components/Switch/index.js +0 -81
  307. package/dist/components/Switch/index.js.map +0 -1
  308. package/dist/components/Switch/styles.d.ts +0 -55
  309. package/dist/components/Switch/styles.js +0 -34
  310. package/dist/components/Switch/styles.js.map +0 -1
  311. package/dist/components/Text/index.d.ts +0 -25
  312. package/dist/components/Text/index.js +0 -121
  313. package/dist/components/Text/index.js.map +0 -1
  314. package/dist/components/Text/styles.d.ts +0 -70
  315. package/dist/components/Text/styles.js +0 -34
  316. package/dist/components/Text/styles.js.map +0 -1
  317. package/dist/components/TextInput/index.d.ts +0 -181
  318. package/dist/components/TextInput/index.js +0 -213
  319. package/dist/components/TextInput/index.js.map +0 -1
  320. package/dist/components/TextInput/styles.d.ts +0 -63
  321. package/dist/components/TextInput/styles.js +0 -65
  322. package/dist/components/TextInput/styles.js.map +0 -1
  323. package/dist/components/Touchable/index.d.ts +0 -22
  324. package/dist/components/Touchable/index.js +0 -165
  325. package/dist/components/Touchable/index.js.map +0 -1
  326. package/dist/components/Touchable/styles.d.ts +0 -58
  327. package/dist/components/Touchable/styles.js +0 -24
  328. package/dist/components/Touchable/styles.js.map +0 -1
  329. package/dist/components/View/index.d.ts +0 -25
  330. package/dist/components/View/index.js +0 -107
  331. package/dist/components/View/index.js.map +0 -1
  332. package/dist/components/View/styles.d.ts +0 -54
  333. package/dist/components/View/styles.js +0 -29
  334. package/dist/components/View/styles.js.map +0 -1
  335. package/dist/components/components.d.ts +0 -37
  336. package/dist/components/components.js +0 -50
  337. package/dist/components/components.js.map +0 -1
  338. package/dist/components/defaultStyles.d.ts +0 -1468
  339. package/dist/components/defaultStyles.js +0 -67
  340. package/dist/components/defaultStyles.js.map +0 -1
  341. package/dist/index.d.ts +0 -7
  342. package/dist/index.js +0 -39
  343. package/dist/index.js.map +0 -1
  344. package/dist/modules/documentPicker.d.ts +0 -3
  345. package/dist/modules/documentPicker.js +0 -12
  346. package/dist/modules/documentPicker.js.map +0 -1
  347. package/dist/modules/fastImage.d.ts +0 -1
  348. package/dist/modules/fastImage.js +0 -10
  349. package/dist/modules/fastImage.js.map +0 -1
  350. package/dist/modules/reactNavigation.d.ts +0 -5
  351. package/dist/modules/reactNavigation.js +0 -26
  352. package/dist/modules/reactNavigation.js.map +0 -1
  353. package/dist/modules/rnDeviceInfo.d.ts +0 -2
  354. package/dist/modules/rnDeviceInfo.js +0 -10
  355. package/dist/modules/rnDeviceInfo.js.map +0 -1
  356. package/dist/modules/textInputMask.d.ts +0 -10
  357. package/dist/modules/textInputMask.js +0 -19
  358. package/dist/modules/textInputMask.js.map +0 -1
  359. package/dist/modules/types/fileTypes.d.ts +0 -138
  360. package/dist/modules/types/fileTypes.js +0 -3
  361. package/dist/modules/types/fileTypes.js.map +0 -1
  362. package/dist/modules/types/textInputMask.d.ts +0 -7
  363. package/dist/modules/types/textInputMask.js +0 -3
  364. package/dist/modules/types/textInputMask.js.map +0 -1
  365. package/dist/types/index.d.ts +0 -1
  366. package/dist/types/index.js +0 -14
  367. package/dist/types/index.js.map +0 -1
  368. package/dist/types/utility.d.ts +0 -14
  369. package/dist/types/utility.js +0 -3
  370. package/dist/types/utility.js.map +0 -1
  371. package/dist/utils/KeyboardAware/context.d.ts +0 -13
  372. package/dist/utils/KeyboardAware/context.js +0 -63
  373. package/dist/utils/KeyboardAware/context.js.map +0 -1
  374. package/dist/utils/KeyboardAware/index.d.ts +0 -8
  375. package/dist/utils/KeyboardAware/index.js +0 -29
  376. package/dist/utils/KeyboardAware/index.js.map +0 -1
  377. package/dist/utils/KeyboardAware/keyboardHooks.d.ts +0 -26
  378. package/dist/utils/KeyboardAware/keyboardHooks.js +0 -87
  379. package/dist/utils/KeyboardAware/keyboardHooks.js.map +0 -1
  380. package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.d.ts +0 -3
  381. package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.js +0 -9
  382. package/dist/utils/KeyboardAware/lib/KeyboardAwareFlatList.js.map +0 -1
  383. package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.d.ts +0 -67
  384. package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js +0 -439
  385. package/dist/utils/KeyboardAware/lib/KeyboardAwareHOC.js.map +0 -1
  386. package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.d.ts +0 -7
  387. package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.js +0 -4
  388. package/dist/utils/KeyboardAware/lib/KeyboardAwareInterface.js.map +0 -1
  389. package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.d.ts +0 -3
  390. package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.js +0 -10
  391. package/dist/utils/KeyboardAware/lib/KeyboardAwareScrollView.js.map +0 -1
  392. package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.d.ts +0 -3
  393. package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.js +0 -10
  394. package/dist/utils/KeyboardAware/lib/KeyboardAwareSectionList.js.map +0 -1
  395. package/dist/utils/KeyboardAware/types.d.ts +0 -1
  396. package/dist/utils/KeyboardAware/types.js +0 -7
  397. package/dist/utils/KeyboardAware/types.js.map +0 -1
  398. package/dist/utils/ModalManager/components.d.ts +0 -20
  399. package/dist/utils/ModalManager/components.js +0 -114
  400. package/dist/utils/ModalManager/components.js.map +0 -1
  401. package/dist/utils/ModalManager/context.d.ts +0 -48
  402. package/dist/utils/ModalManager/context.js +0 -201
  403. package/dist/utils/ModalManager/context.js.map +0 -1
  404. package/dist/utils/ModalManager/index.d.ts +0 -11
  405. package/dist/utils/ModalManager/index.js +0 -13
  406. package/dist/utils/ModalManager/index.js.map +0 -1
  407. package/dist/utils/OSAlert.d.ts +0 -32
  408. package/dist/utils/OSAlert.js +0 -143
  409. package/dist/utils/OSAlert.js.map +0 -1
  410. package/dist/utils/PermissionManager/context.d.ts +0 -53
  411. package/dist/utils/PermissionManager/context.js +0 -320
  412. package/dist/utils/PermissionManager/context.js.map +0 -1
  413. package/dist/utils/PermissionManager/index.d.ts +0 -4
  414. package/dist/utils/PermissionManager/index.js +0 -9
  415. package/dist/utils/PermissionManager/index.js.map +0 -1
  416. package/dist/utils/PermissionManager/types.d.ts +0 -13
  417. package/dist/utils/PermissionManager/types.js +0 -3
  418. package/dist/utils/PermissionManager/types.js.map +0 -1
  419. package/dist/utils/hooks.d.ts +0 -61
  420. package/dist/utils/hooks.js +0 -233
  421. package/dist/utils/hooks.js.map +0 -1
  422. package/dist/utils/index.d.ts +0 -10
  423. package/dist/utils/index.js +0 -36
  424. package/dist/utils/index.js.map +0 -1
  425. package/dist/utils/input.d.ts +0 -35
  426. package/dist/utils/input.js +0 -49
  427. package/dist/utils/input.js.map +0 -1
  428. package/dist/utils/misc.d.ts +0 -6
  429. package/dist/utils/misc.js +0 -87
  430. package/dist/utils/misc.js.map +0 -1
  431. package/dist/utils/notifications.d.ts +0 -34
  432. package/dist/utils/notifications.js +0 -268
  433. package/dist/utils/notifications.js.map +0 -1
  434. package/dist/utils/theme.d.ts +0 -42
  435. package/dist/utils/theme.js +0 -50
  436. package/dist/utils/theme.js.map +0 -1
  437. package/src/components/Animated.tsx +0 -34
  438. package/src/components/AutoComplete/index.tsx +0 -167
  439. package/src/components/AutoComplete/styles.ts +0 -150
  440. package/src/components/MultiSelect/index.tsx +0 -148
  441. package/src/components/MultiSelect/styles.ts +0 -131
  442. package/src/components/MultiSelect/types.ts +0 -51
  443. package/src/components/Slider/Mark.tsx +0 -46
  444. package/src/components/Slider/Thumb.tsx +0 -29
  445. package/src/modules/textInputMask.ts +0 -11
  446. package/src/utils/KeyboardAware/lib/KeyboardAwareFlatList.ts +0 -4
  447. package/src/utils/KeyboardAware/lib/KeyboardAwareHOC.tsx +0 -592
  448. package/src/utils/KeyboardAware/lib/KeyboardAwareInterface.ts +0 -13
  449. package/src/utils/KeyboardAware/lib/KeyboardAwareScrollView.ts +0 -6
  450. package/src/utils/KeyboardAware/lib/KeyboardAwareSectionList.ts +0 -6
@@ -0,0 +1,135 @@
1
+ import { TypeGuards, createDefaultVariantFactory, getRenderedComponent, includePresets, useDefaultComponentStyle, useMemo, useNestedStylesByKey } from "@codeleap/common"
2
+ import { ActionIconComposition, ActionIconParts } from "../ActionIcon"
3
+ import { InputBaseProps } from "./types"
4
+ import { StyleSheet } from "react-native"
5
+
6
+ type InputIcons = 'icon' | 'leftIcon' | 'rightIcon'
7
+
8
+ type IconParts = ActionIconParts
9
+
10
+ export type InputIconComposition = `${InputIcons}${Capitalize<IconParts>}`
11
+
12
+ export type InputBaseStates = 'error' | 'focus' | 'disabled'
13
+
14
+ export type InputBaseParts =
15
+ 'wrapper' |
16
+ 'innerWrapper' |
17
+ 'label' |
18
+ 'errorMessage' |
19
+ 'description' |
20
+ 'labelRow'|
21
+ InputIconComposition
22
+
23
+ export type IconLessInputBaseParts = Exclude<InputBaseParts, InputIconComposition>
24
+
25
+ export type InputBaseComposition = `${InputBaseParts}:${InputBaseStates}` | InputBaseParts
26
+
27
+ const createTextInputBaseComposition = createDefaultVariantFactory<InputBaseComposition>()
28
+
29
+ export const InputBasePresets = includePresets((styles) => createTextInputBaseComposition(() => ({ wrapper: styles })))
30
+
31
+
32
+ const getIconStyles = (obj, state) => {
33
+ return {
34
+ icon: [
35
+ obj.icon,
36
+ state.focused && obj['icon:focus'],
37
+ state.hasError && obj['icon:error'],
38
+ state.disabled && obj['icon:disabled']
39
+ ],
40
+ touchableWrapper: [
41
+ obj.touchableWrapper,
42
+ state.focused && obj['touchableWrapper:focus'],
43
+ state.hasError && obj['touchableWrapper:error'],
44
+ state.disabled && obj['touchableWrapper:disabled']
45
+ ],
46
+ }
47
+
48
+ }
49
+
50
+ export const useInputBaseStyles = (props: InputBaseProps) => {
51
+ const {
52
+ focused,
53
+ disabled,
54
+ error,
55
+ styles
56
+ } = props
57
+
58
+ const hasError = !TypeGuards.isNil(error)
59
+
60
+ const variantStyles = useDefaultComponentStyle<'u:InputBase', typeof InputBasePresets>('u:InputBase', {
61
+ styles,
62
+ transform: StyleSheet.flatten,
63
+ rootElement: 'wrapper'
64
+ })
65
+
66
+ const _leftIconStyles = useNestedStylesByKey<ActionIconComposition>('leftIcon', variantStyles)
67
+ const _rightIconStyles = useNestedStylesByKey<ActionIconComposition>('rightIcon', variantStyles)
68
+ const _generalIconStyles = useNestedStylesByKey<ActionIconComposition>('icon', variantStyles)
69
+
70
+ const generalIconStyles = getIconStyles(_generalIconStyles, { hasError, disabled })
71
+
72
+ const leftIconStyles = [
73
+ generalIconStyles,
74
+ getIconStyles(_leftIconStyles, { hasError, disabled, focused })
75
+ ]
76
+
77
+ const rightIconStyles = [
78
+ generalIconStyles,
79
+ getIconStyles(_rightIconStyles, { hasError, disabled, focused })
80
+ ]
81
+
82
+ const labelStyle = [
83
+ variantStyles.label,
84
+ focused && variantStyles['label:focus'],
85
+ hasError && variantStyles['label:error'],
86
+ disabled && variantStyles['label:disabled'],
87
+
88
+ ]
89
+
90
+ const errorStyle = [
91
+ variantStyles.errorMessage,
92
+ focused && variantStyles['errorMessage:focus'],
93
+ hasError && variantStyles['errorMessage:error'],
94
+ disabled && variantStyles['errorMessage:disabled'],
95
+ ]
96
+
97
+ const descriptionStyle = [
98
+ variantStyles.description,
99
+ focused && variantStyles['description:focus'],
100
+ hasError && variantStyles['description:error'],
101
+ disabled && variantStyles['description:disabled'],
102
+ ]
103
+
104
+ const wrapperStyle = [
105
+ variantStyles.wrapper,
106
+ focused && variantStyles['wrapper:focus'],
107
+ error && variantStyles['wrapper:error'],
108
+ disabled && variantStyles['wrapper:disabled'],
109
+ ]
110
+
111
+ const innerWrapperStyle = [
112
+ variantStyles.innerWrapper,
113
+ focused && variantStyles['innerWrapper:focus'],
114
+ hasError && variantStyles['innerWrapper:error'],
115
+ disabled && variantStyles['innerWrapper:disabled'],
116
+ ]
117
+
118
+ const labelRowStyle = [
119
+ variantStyles.labelRow,
120
+ focused && variantStyles['labelRow:focus'],
121
+ hasError && variantStyles['labelRow:error'],
122
+ disabled && variantStyles['labelRow:disabled'],
123
+ ]
124
+
125
+ return {
126
+ wrapperStyle,
127
+ innerWrapperStyle,
128
+ leftIconStyles,
129
+ rightIconStyles,
130
+ labelStyle,
131
+ errorStyle,
132
+ descriptionStyle,
133
+ labelRowStyle
134
+ }
135
+ }
@@ -0,0 +1,28 @@
1
+ import { PropsOf } from '@codeleap/common'
2
+ import { StylesOf } from '../../types'
3
+ import { InputBaseComposition } from './styles'
4
+ import { ActionIcon } from '../ActionIcon'
5
+
6
+ type ActionIconProps = PropsOf<typeof ActionIcon>
7
+
8
+ type OrderedParts = 'label' | 'description' | 'innerWrapper' | 'error'
9
+ type IconProp = Partial<ActionIconProps> | JSX.Element
10
+ export type InputBaseProps = React.PropsWithChildren<{
11
+ label?: React.ReactNode
12
+ error?: React.ReactNode
13
+ leftIcon?: IconProp
14
+ rightIcon?: IconProp
15
+ wrapper?: React.FC<any>
16
+ wrapperProps?: any
17
+ innerWrapper?: React.FC<any>
18
+ innerWrapperProps?: any
19
+ styles?: StylesOf<InputBaseComposition>
20
+ description?: React.ReactNode
21
+ debugName: string
22
+ focused?: boolean
23
+ disabled?: boolean
24
+ order?: OrderedParts[]
25
+ style?: any
26
+ labelAsRow?: boolean
27
+ hideErrorMessage?: boolean
28
+ }>
@@ -0,0 +1,42 @@
1
+ import { InputBaseProps } from './types'
2
+
3
+ type OmitDiff<T1, T2> = {
4
+ [K in Exclude<keyof T1, keyof T2>]: T1[K]
5
+ } & {
6
+ [K in keyof T2]: T2[K]
7
+ }
8
+
9
+ type InputBaseKey = keyof InputBaseProps
10
+
11
+ export function selectInputBaseProps<T extends InputBaseProps>(props: T): {
12
+ inputBaseProps: InputBaseProps
13
+ others: OmitDiff<T, T>
14
+ } {
15
+ const varList:InputBaseKey[] = [
16
+ 'label',
17
+ 'style',
18
+ 'error',
19
+ 'innerWrapper',
20
+ 'leftIcon',
21
+ 'rightIcon',
22
+ // 'styles',
23
+ 'description',
24
+ 'wrapper',
25
+ 'children',
26
+ 'innerWrapperProps',
27
+ 'wrapperProps',
28
+ 'disabled',
29
+ 'hideErrorMessage',
30
+ ]
31
+
32
+ const copy = { ...props }
33
+
34
+ const result = varList.reduce((acc, key) => {
35
+ // @ts-ignore
36
+ acc[key] = copy[key]
37
+
38
+ return acc
39
+ }, {} as InputBaseProps)
40
+
41
+ return { inputBaseProps: result, others: copy as OmitDiff<T, T> }
42
+ }
@@ -2,7 +2,7 @@ import React from 'react'
2
2
  import { ComponentVariants, FormTypes, useDefaultComponentStyle } from '@codeleap/common'
3
3
  import { StylesOf } from '../../types'
4
4
  import { View, ViewProps } from '../View'
5
- import { InputLabelComposition, InputLabelStyles } from './styles'
5
+ import { InputLabelComposition, InputLabelPresets } from './styles'
6
6
  import { Text } from '../Text'
7
7
  import { StyleSheet } from 'react-native'
8
8
 
@@ -10,13 +10,13 @@ export type InputLabelProps = ViewProps & {
10
10
  styles?: StylesOf<InputLabelComposition>
11
11
  label?: FormTypes.Label
12
12
  required?: boolean
13
- } & ComponentVariants<typeof InputLabelStyles>
13
+ } & ComponentVariants<typeof InputLabelPresets>
14
14
 
15
15
  export * from './styles'
16
16
 
17
17
  export const InputLabel:React.FC<InputLabelProps> = (props) => {
18
18
  const { label, required = false, variants = [], styles = {}, style, ...viewProps } = props
19
- const variantStyles = useDefaultComponentStyle<'u:InputLabel', typeof InputLabelStyles>('u:InputLabel', {
19
+ const variantStyles = useDefaultComponentStyle<'u:InputLabel', typeof InputLabelPresets>('u:InputLabel', {
20
20
  variants, styles, transform: StyleSheet.flatten,
21
21
  })
22
22
 
@@ -1,19 +1,7 @@
1
- import { assignTextStyle, createDefaultVariantFactory } from '@codeleap/common'
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
2
 
3
3
  export type InputLabelComposition = 'text' | 'wrapper' | 'asterisk'
4
4
 
5
5
  const createInputLabelStyle = createDefaultVariantFactory<InputLabelComposition>()
6
6
 
7
- export const InputLabelStyles = {
8
- default: createInputLabelStyle((theme) => ({
9
- asterisk: {
10
- color: theme.colors.negative,
11
- },
12
- wrapper: {
13
- ...theme.presets.row,
14
- },
15
- text: {
16
- ...assignTextStyle('h5')(theme).text,
17
- },
18
- })),
19
- }
7
+ export const InputLabelPresets = includePresets(style => createInputLabelStyle(() => ({ wrapper: style, text: style })))
@@ -1,6 +1,5 @@
1
1
  import React from 'react'
2
2
  import {
3
- assignTextStyle,
4
3
  ComponentVariants,
5
4
  createDefaultVariantFactory,
6
5
  getNestedStylesByKey,
@@ -16,24 +15,8 @@ import { Text } from '../Text'
16
15
  export type PaginationIndicatorComposition = 'text' | `loader${Capitalize<ActivityIndicatorComposition>}`
17
16
 
18
17
  const createPaginationIndicatorStyle = createDefaultVariantFactory<PaginationIndicatorComposition>()
19
- const presets = includePresets((style) => createPaginationIndicatorStyle(() => ({ loaderWrapper: style, text: style })))
20
- export const PaginationIndicatorStyles = {
21
- ...presets,
22
- default: createPaginationIndicatorStyle((theme) => {
23
- return {
24
- loaderWrapper: {
25
- ...theme.presets.center,
26
- ...theme.spacing.marginVertical(3),
27
- },
28
- text: {
29
- ...assignTextStyle('h4')(theme).text,
30
- ...theme.presets.textCenter,
31
- ...theme.spacing.marginVertical(3),
32
- ...theme.presets.fullWidth,
33
- },
34
- }
35
- }),
36
- }
18
+
19
+ export const PaginationIndicatorPresets = includePresets((style) => createPaginationIndicatorStyle(() => ({ loaderWrapper: style, text: style })))
37
20
 
38
21
  export type PaginationIndicatorProps = {
39
22
  isFetching?: boolean
@@ -42,14 +25,14 @@ export type PaginationIndicatorProps = {
42
25
  activityIndicator?: JSX.Element
43
26
  styles?: StylesOf<PaginationIndicatorComposition>
44
27
  style?: ViewStyle
45
- } & ComponentVariants<typeof PaginationIndicatorStyles>
28
+ } & ComponentVariants<typeof PaginationIndicatorPresets>
46
29
 
47
30
  export const PaginationIndicator = (props: PaginationIndicatorProps) => {
48
31
  const { hasMore, isFetching, noMoreItemsText, style, activityIndicator, styles = {}, variants = [] } = props
49
32
 
50
33
  const variantStyles = useDefaultComponentStyle<
51
34
  'u:PaginationIndicator',
52
- typeof PaginationIndicatorStyles
35
+ typeof PaginationIndicatorPresets
53
36
  >('u:PaginationIndicator', {
54
37
  variants,
55
38
  styles,
@@ -1,31 +1,40 @@
1
1
  import * as React from 'react'
2
2
  import { forwardRef } from 'react'
3
3
  import {
4
-
5
4
  useDefaultComponentStyle,
6
-
7
5
  ComponentVariants,
8
6
  useCallback,
7
+ TypeGuards,
9
8
  } from '@codeleap/common'
10
9
 
11
- import { RefreshControl, FlatList, FlatListProps as RNFlatListProps, ListRenderItemInfo, StyleSheet, RefreshControlProps } from 'react-native'
10
+ import { FlatListProps as RNFlatListProps, ListRenderItemInfo, StyleSheet } from 'react-native'
12
11
  import { View, ViewProps } from '../View'
13
12
  import { EmptyPlaceholder, EmptyPlaceholderProps } from '../EmptyPlaceholder'
14
- import { ListComposition, ListStyles } from './styles'
13
+ import { RefreshControl, RefreshControlProps } from '../RefreshControl'
14
+ import { ListComposition, ListPresets } from './styles'
15
15
  import { StylesOf } from '../../types'
16
- import { GetKeyboardAwarePropsOptions, useKeyboardAwareView } from '../../utils'
16
+
17
+ import { KeyboardAwareFlatList } from 'react-native-keyboard-aware-scroll-view'
17
18
 
18
19
  export type DataboundFlatListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout'
19
20
 
21
+ export type AugmentedRenderItemInfo<T> = ListRenderItemInfo<T> & {
22
+ isFirst: boolean
23
+ isLast: boolean
24
+ isOnly: boolean
25
+ }
26
+
20
27
  export type ReplaceFlatlistProps<P, T> = Omit<P, DataboundFlatListPropsTypes> & {
21
28
  data: T[]
22
29
  keyExtractor?: (item: T, index: number) => string
23
- renderItem: (data: ListRenderItemInfo<T>) => React.ReactElement
30
+ renderItem: (data: AugmentedRenderItemInfo<T>) => React.ReactElement
24
31
  onRefresh?: () => void
25
32
  getItemLayout?: ((
26
33
  data:T,
27
34
  index: number,
28
- ) => { length: number; offset: number; index: number })
35
+ ) => { length: number; offset: number; index: number })
36
+ fakeEmpty?: boolean
37
+ loading?: boolean
29
38
  }
30
39
 
31
40
  export * from './styles'
@@ -34,16 +43,23 @@ export * from './PaginationIndicator'
34
43
  export type FlatListProps<
35
44
  T = any[],
36
45
  Data = T extends Array<infer D> ? D : never
37
- > =RNFlatListProps<Data> &
46
+ > = ReplaceFlatlistProps<RNFlatListProps<Data>, Data> &
38
47
  Omit<ViewProps, 'variants'> & {
39
48
  separators?: boolean
40
49
  placeholder?: EmptyPlaceholderProps
41
- keyboardAware?: GetKeyboardAwarePropsOptions
42
50
  styles?: StylesOf<ListComposition>
43
51
  refreshControlProps?: Partial<RefreshControlProps>
44
- } & ComponentVariants<typeof ListStyles>
52
+ fakeEmpty?: boolean
53
+ loading?: boolean
54
+ } & ComponentVariants<typeof ListPresets>
55
+
56
+ const RenderSeparator = (props: { separatorStyles: ViewProps['style'] }) => {
57
+ return (
58
+ <View style={props.separatorStyles}></View>
59
+ )
60
+ }
45
61
 
46
- const ListCP = forwardRef<FlatList, FlatListProps>(
62
+ const ListCP = forwardRef<KeyboardAwareFlatList, FlatListProps>(
47
63
  (flatListProps, ref) => {
48
64
  const {
49
65
  variants = [],
@@ -55,54 +71,76 @@ const ListCP = forwardRef<FlatList, FlatListProps>(
55
71
  placeholder,
56
72
  keyboardAware,
57
73
  refreshControlProps = {},
74
+ loading = false,
75
+ fakeEmpty = loading,
58
76
  ...props
59
77
  } = flatListProps
60
78
 
61
- const variantStyles = useDefaultComponentStyle<'u:List', typeof ListStyles>('u:List', {
79
+ const variantStyles = useDefaultComponentStyle<'u:List', typeof ListPresets>('u:List', {
62
80
  variants,
63
81
  styles,
64
82
  transform: StyleSheet.flatten,
65
83
 
66
84
  })
67
85
 
68
- const renderSeparator = useCallback(() => {
69
- return (
70
- <View style={variantStyles.separator}></View>
71
- )
72
- }, [])
73
-
74
- const isEmpty = !props.data || !props.data.length
75
- const separator = !isEmpty && props?.separators && renderSeparator
86
+ // const isEmpty = !props.data || !props.data.length
87
+ const separator = props?.separators && <RenderSeparator separatorStyles={variantStyles.separator}/>
76
88
 
77
- const Component:any = component || FlatList
78
89
  const refreshStyles = StyleSheet.flatten([variantStyles.refreshControl, styles.refreshControl])
79
90
 
80
- const _listProps = {
81
- style: [variantStyles.wrapper, style],
82
- contentContainerStyle: variantStyles.content,
83
- ref: ref as unknown as FlatList,
84
- ItemSeparatorComponent: separator,
85
- refreshControl: !!onRefresh && (
86
- <RefreshControl
87
- refreshing={refreshing}
88
- onRefresh={onRefresh}
89
- tintColor={refreshStyles?.color}
90
- colors={[refreshStyles?.color]}
91
- {...refreshControlProps}
92
- />
93
- ),
94
- ListEmptyComponent: <EmptyPlaceholder {...placeholder}/>,
95
- ...props,
91
+ const renderItem = useCallback((data: ListRenderItemInfo<any>) => {
92
+ if (!props?.renderItem) return null
93
+ const listLength = props?.data?.length || 0
94
+
95
+ const isFirst = data.index === 0
96
+ const isLast = data.index === listLength - 1
97
+
98
+ const isOnly = isFirst && isLast
99
+
100
+ return props?.renderItem({
101
+ ...data,
102
+ isFirst,
103
+ isLast,
104
+ isOnly,
105
+ })
106
+ }, [props?.renderItem, props?.data?.length])
107
+
108
+ const isEmpty = !props.data || !props.data.length
109
+
110
+ const _placeholder = {
111
+ ...placeholder,
112
+ loading: TypeGuards.isBoolean(placeholder?.loading) ? placeholder.loading : loading,
96
113
  }
97
- const keyboard = useKeyboardAwareView()
98
- const listProps = keyboard.getKeyboardAwareProps(_listProps, {
99
- adapt: 'paddingBottom',
100
- baseStyleProp: 'contentContainerStyle',
101
- ...keyboardAware,
102
- })
114
+
103
115
  return (
104
- <Component
105
- {...listProps}
116
+ <KeyboardAwareFlatList
117
+ style={[
118
+ variantStyles.wrapper,
119
+ style,
120
+ isEmpty && variantStyles['wrapper:empty'],
121
+ ]}
122
+ contentContainerStyle={[
123
+ variantStyles.content,
124
+ isEmpty && variantStyles['content:empty'],
125
+ ]}
126
+ // @ts-expect-error React's refs suck
127
+ ItemSeparatorComponent={separator}
128
+ ListHeaderComponentStyle={variantStyles.header}
129
+
130
+ refreshControl={!!onRefresh && (
131
+ <RefreshControl
132
+ refreshing={refreshing}
133
+ onRefresh={onRefresh}
134
+ {...refreshControlProps}
135
+ />
136
+ )}
137
+
138
+ ListEmptyComponent={<EmptyPlaceholder {..._placeholder}/>}
139
+ {...props}
140
+ data={fakeEmpty ? [] : props.data}
141
+ ref={ ref as React.LegacyRef<KeyboardAwareFlatList> }
142
+ renderItem={renderItem}
143
+
106
144
  />
107
145
  )
108
146
  },
@@ -110,5 +148,5 @@ const ListCP = forwardRef<FlatList, FlatListProps>(
110
148
 
111
149
  export type ListComponentType = <T extends any[] = any[]>(props: FlatListProps<T>) => React.ReactElement
112
150
 
113
- export const List = ListCP as ListComponentType
151
+ export const List = ListCP as unknown as ListComponentType
114
152
 
@@ -1,25 +1,13 @@
1
1
  import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
- import { ScrollComposition, ScrollStyles } from '../Scroll/styles'
2
+ import { ScrollComposition } from '../Scroll/styles'
3
3
 
4
- export type ListComposition = ScrollComposition | 'separator'
5
4
 
6
- const createListStyle = createDefaultVariantFactory<ListComposition>()
5
+ type ListStates = 'empty' | 'loading'
6
+
7
+ type ListParts = ScrollComposition | 'separator' | 'header' | 'refreshControl'
7
8
 
8
- const presets = includePresets(style => createListStyle(() => ({ content: style })))
9
+ export type ListComposition = `${ListParts}:${ListStates}` | ListParts
10
+
11
+ const createListStyle = createDefaultVariantFactory<ListComposition>()
9
12
 
10
- export const ListStyles = {
11
- ...presets,
12
- default: createListStyle((theme) => {
13
- const defaultStyles = ScrollStyles.default(theme)
14
- return {
15
- ...defaultStyles,
16
- separator: {
17
- width: '100%',
18
- height: theme.spacing.value(1),
19
- },
20
- content: {
21
- flexGrow: 1,
22
- },
23
- }
24
- }),
25
- }
13
+ export const ListPresets = includePresets(style => createListStyle(() => ({ content: style })))
@@ -1,55 +1,55 @@
1
1
  import React, { useRef } from 'react'
2
- import { ComponentVariants, getNestedStylesByKey, onUpdate, useDefaultComponentStyle, useMemo } from "@codeleap/common"
3
- import { useDynamicAnimation } from "moti"
4
- import { StyleSheet } from "react-native"
5
- import { StylesOf } from "../../types"
6
- import { ActivityIndicator } from "../ActivityIndicator"
7
- import { View } from "../View"
8
- import { LoadingOverlayComposition, LoadingOverlayStyles } from "./styles"
9
- import {useStaticAnimationStyles} from '../../utils'
2
+ import { ComponentVariants, getNestedStylesByKey, onUpdate, useDefaultComponentStyle, useMemo } from '@codeleap/common'
3
+ import { StyleSheet } from 'react-native'
4
+ import { StylesOf } from '../../types'
5
+ import { ActivityIndicator } from '../ActivityIndicator'
6
+ import { View } from '../View'
7
+ import { LoadingOverlayComposition, LoadingOverlayPresets } from './styles'
8
+ import { useAnimatedVariantStyles } from '../../utils'
10
9
 
11
10
  export * from './styles'
12
11
 
13
12
  export type LoadingOverlayProps = React.PropsWithChildren<{
14
- variants?: ComponentVariants<typeof LoadingOverlayStyles>['variants']
13
+ variants?: ComponentVariants<typeof LoadingOverlayPresets>['variants']
15
14
  styles?: StylesOf<LoadingOverlayComposition>
16
15
  visible?: boolean
17
16
  } >
18
17
 
19
-
20
18
  export const LoadingOverlay = (props: LoadingOverlayProps) => {
21
- const {
22
- children,
23
- styles,
24
- variants,
25
- visible
26
- } = props
27
-
28
- const variantStyles = useDefaultComponentStyle<'u:LoadingOverlay', typeof LoadingOverlayStyles>('u:LoadingOverlay', {
29
- variants,
30
- rootElement: 'wrapper',
31
- styles,
32
- transform: StyleSheet.flatten,
33
- })
34
-
35
-
36
- const loaderStyles = useMemo(() => getNestedStylesByKey('loader', variantStyles), [variantStyles])
37
-
38
- const wrapperAnimationStates = useStaticAnimationStyles(variantStyles, ['wrapper:hidden','wrapper:visible'])
39
- const wrapperAnimation = useDynamicAnimation(() => {
40
- return visible ? wrapperAnimationStates["wrapper:visible"] : wrapperAnimationStates["wrapper:hidden"]
41
- })
42
-
43
- onUpdate(() => {
44
- wrapperAnimation.animateTo(visible ? wrapperAnimationStates["wrapper:visible"] : wrapperAnimationStates["wrapper:hidden"])
45
- }, [visible])
46
-
47
- const transition = useRef(null)
48
- if(!transition.current){
49
- transition.current = JSON.parse(JSON.stringify(variantStyles["wrapper:transition"]))
50
- }
51
- return <View style={variantStyles.wrapper} animated state={wrapperAnimation} transition={transition.current}>
52
- <ActivityIndicator styles={loaderStyles}/>
53
- {children}
54
- </View>
55
- }
19
+ const {
20
+ children,
21
+ styles,
22
+ variants,
23
+ visible,
24
+ } = props
25
+
26
+ const variantStyles = useDefaultComponentStyle<'u:LoadingOverlay', typeof LoadingOverlayPresets>('u:LoadingOverlay', {
27
+ variants,
28
+ rootElement: 'wrapper',
29
+ styles,
30
+ transform: StyleSheet.flatten,
31
+ })
32
+
33
+ const loaderStyles = useMemo(() => getNestedStylesByKey('loader', variantStyles), [variantStyles])
34
+
35
+ const wrapperAnimation = useAnimatedVariantStyles({
36
+ variantStyles,
37
+ animatedProperties: ['wrapper:visible', 'wrapper:hidden'],
38
+ updater: (s) => {
39
+ 'worklet'
40
+ return visible ? s['wrapper:visible'] : s['wrapper:hidden']
41
+ },
42
+ transition: variantStyles.transition,
43
+ dependencies: [visible],
44
+ })
45
+
46
+
47
+ const transition = useRef(null)
48
+ if (!transition.current) {
49
+ transition.current = JSON.parse(JSON.stringify(variantStyles['wrapper:transition']))
50
+ }
51
+ return <View style={[variantStyles.wrapper, wrapperAnimation]} animated transition={transition.current}>
52
+ <ActivityIndicator styles={loaderStyles}/>
53
+ {children}
54
+ </View>
55
+ }
@@ -1,32 +1,10 @@
1
- import { createDefaultVariantFactory, shadeColor } from "@codeleap/common"
2
- import { ActivityIndicatorComposition } from "../ActivityIndicator"
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
+ import { ActivityIndicatorComposition } from '../ActivityIndicator'
3
3
 
4
- type WrapperStates = 'hidden'| 'visible'
4
+ type WrapperStates = 'hidden'| 'visible'
5
5
 
6
- export type LoadingOverlayComposition = 'wrapper' | `wrapper:${WrapperStates}` | 'wrapper:transition' | `loader${Capitalize<ActivityIndicatorComposition>}`
6
+ export type LoadingOverlayComposition = 'wrapper' | `wrapper:${WrapperStates}` | 'wrapper:transition' | `loader${Capitalize<ActivityIndicatorComposition>}` | 'transition'
7
7
 
8
8
  const createLoadingOverlayStyle = createDefaultVariantFactory<LoadingOverlayComposition>()
9
9
 
10
- export const LoadingOverlayStyles = {
11
- default: createLoadingOverlayStyle(theme => ({
12
- wrapper: {
13
- ...theme.presets.center,
14
- ...theme.presets.whole,
15
- ...theme.presets.absolute,
16
- backgroundColor: theme.colors.background
17
- },
18
- 'wrapper:visible': {
19
- opacity: 1
20
- },
21
- 'wrapper:hidden': {
22
- opacity: 0
23
- },
24
- 'wrapper:transition': {
25
- opacity: {
26
- duration: 900,
27
- type: 'timing',
28
- },
29
-
30
- }
31
- }))
32
- }
10
+ export const LoadingOverlayPresets = includePresets((styles) => createLoadingOverlayStyle(() => ({ wrapper: styles })))