@codeleap/mobile 2.4.6 → 3.0.2

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 +57 -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 +264 -93
  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 +12 -25
  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 +141 -8
  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 -142
  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 -23
  330. package/dist/components/View/index.js +0 -102
  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 -42
  420. package/dist/utils/hooks.js +0 -174
  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,27 @@
1
+ {
2
+ "folders": [
3
+ {
4
+ "path": "."
5
+ }
6
+ ],
7
+ "settings": {
8
+ "eslint.alwaysShowStatus": true,
9
+ "todohighlight.keywords": [
10
+ "TODO",
11
+ "NOTES",
12
+ "NOTE",
13
+ "FIXME",
14
+ "HACK",
15
+ "DISCUSS",
16
+ "WTF",
17
+ "REFACTOR"
18
+ ],
19
+ "todohighlight.defaultStyle": {
20
+ "color": "red",
21
+ "border": "2px solid #aaa",
22
+ "backgroundColor": "#faea00",
23
+ "fontWeight": "bold",
24
+ "borderRadius": "3px"
25
+ }
26
+ }
27
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@codeleap/mobile",
3
- "version": "2.4.6",
3
+ "version": "3.0.2",
4
4
  "main": "src/index.ts",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {
@@ -9,12 +9,7 @@
9
9
  "directory": "packages/mobile"
10
10
  },
11
11
  "devDependencies": {
12
- "@codeleap/config": "*",
13
- "@types/react-native": "0.66.15",
14
- "@types/react-window": "1.8.5",
15
- "moti": "0.18.0",
16
- "@codeleap/common": "*",
17
- "typescript": "4.5.4"
12
+ "@codeleap/config": "*"
18
13
  },
19
14
  "scripts": {
20
15
  "build": "tsc --build",
@@ -22,34 +17,31 @@
22
17
  },
23
18
  "peerDependencies": {
24
19
  "@codeleap/common": "*",
20
+ "@react-native-community/async-storage": "1.12.1",
25
21
  "@react-native-firebase/messaging": "14.4.0",
26
- "@react-navigation/bottom-tabs": "^6.0.9",
27
- "@react-navigation/drawer": "^6.1.8",
28
- "@react-navigation/native": "^6.0.6",
29
- "@react-navigation/native-stack": "^6.2.5",
30
- "@react-navigation/stack": "^6.1.1",
31
- "moti": "^0.18.0",
32
- "react": "17.0.2",
33
- "react-native": "0.66.4",
34
- "react-native-animatable": "^1.3.3",
35
- "react-native-calendars": "*",
36
- "react-native-fast-image": "^8.5.11",
37
- "react-native-gesture-handler": "^2.2.0",
38
- "react-native-image-crop-picker": "*",
39
- "react-native-image-viewing": "^0.2.2",
40
- "react-native-keyboard-aware-scroll-view": "^0.9.5",
41
- "react-native-text-input-mask": "3.1.4",
42
- "@react-native-community/async-storage": "*",
43
- "react-native-device-info": "10.3.0"
22
+ "@react-navigation/bottom-tabs": "6.5.3",
23
+ "@react-navigation/drawer": "6.5.7",
24
+ "@react-navigation/native": "6.1.2",
25
+ "@react-navigation/native-stack": "6.9.8",
26
+ "@react-navigation/stack": "6.3.11",
27
+ "react": "18.1.0",
28
+ "react-native": "0.70.6",
29
+ "react-native-calendars": "1.1293.0",
30
+ "react-native-date-picker": "^4.2.13",
31
+ "react-native-device-info": "10.3.0",
32
+ "react-native-fast-image": "8.6.3",
33
+ "react-native-gesture-handler": "2.9.0",
34
+ "react-native-image-crop-picker": "0.37.2",
35
+ "react-native-image-viewing": "0.2.2",
36
+ "react-native-keyboard-aware-scroll-view": "0.9.5",
37
+ "typescript": "4.5.4"
44
38
  },
45
39
  "dependencies": {
46
- "@gorhom/portal": "^1.0.13",
47
- "@miblanchard/react-native-slider": "^2.1.0",
48
- "date-fns": "^2.28.0",
49
- "react-native-animatable": "^1.3.3",
50
- "react-native-masked-text": "^1.13.0",
51
- "react-native-pose": "^0.9.1",
52
- "react-native-super-grid": "^4.4.2",
53
- "react-native-uuid": "^2.0.1"
40
+ "@gorhom/portal": "1.0.14",
41
+ "@miblanchard/react-native-slider": "2.3.1",
42
+ "date-fns": "^2.29.3",
43
+ "react-native-masked-text": "1.13.0",
44
+ "react-native-super-grid": "4.4.2",
45
+ "react-native-uuid": "2.0.1"
54
46
  }
55
47
  }
@@ -2,31 +2,41 @@ import { ComponentVariants, getNestedStylesByKey, useDefaultComponentStyle } fro
2
2
  import React from 'react'
3
3
  import { StyleSheet } from 'react-native'
4
4
  import { StylesOf } from '../../types'
5
+ import { Badge, BadgeComponentProps } from '../Badge'
5
6
  import { Icon, IconProps } from '../Icon'
6
7
  import { Touchable, TouchableProps } from '../Touchable'
7
- import { ActionIconComposition, ActionIconStyles } from './styles'
8
+ import { ActionIconComposition, ActionIconPresets } from './styles'
8
9
 
9
10
  export type ActionIconProps= {
10
11
  iconProps?: Partial<IconProps>
11
12
  icon?: IconProps['name']
12
- styles?: StylesOf<ActionIconComposition>
13
- } & Omit<TouchableProps, 'styles' | 'variants'> & ComponentVariants<typeof ActionIconStyles>
13
+ name?: IconProps['name']
14
+ styles?: StylesOf<ActionIconComposition> | StylesOf<ActionIconComposition>[]
15
+ } & Omit<TouchableProps, 'styles' | 'variants'> & ComponentVariants<typeof ActionIconPresets> & BadgeComponentProps
14
16
 
15
17
  export const ActionIcon:React.FC<ActionIconProps> = (props) => {
16
- const { icon, iconProps, variants, styles, children, ...touchableProps } = props
17
- const variantStyles = useDefaultComponentStyle<'u:ActionIcon', typeof ActionIconStyles>('u:ActionIcon', {
18
+ const { name, icon, iconProps, variants, styles, children, badge = false, badgeProps = {}, ...touchableProps } = props
19
+ const variantStyles = useDefaultComponentStyle<'u:ActionIcon', typeof ActionIconPresets>('u:ActionIcon', {
18
20
  variants, styles, transform: StyleSheet.flatten,
19
21
  })
20
22
  const touchableStyles = getNestedStylesByKey('touchable', variantStyles)
21
23
 
24
+ const badgeStyles = getNestedStylesByKey('badge', variantStyles)
25
+
22
26
  return <Touchable styles={touchableStyles} {...touchableProps}>
23
- <Icon name={icon} style={
27
+ <Icon name={icon ?? name} style={
24
28
  [
25
29
  variantStyles.icon,
26
30
  touchableProps?.disabled && variantStyles['icon:disabled'],
27
31
  ]} {...iconProps}/>
28
32
  {children}
33
+
34
+ <Badge badge={badge} style={badgeStyles} {...badgeProps} />
29
35
  </Touchable>
30
36
  }
31
37
 
38
+ ActionIcon.defaultProps = {
39
+ hitSlop: 10,
40
+ }
41
+
32
42
  export * from './styles'
@@ -1,97 +1,10 @@
1
1
  import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
+ import { BadgeComposition } from '../Badge'
2
3
  import { TouchableComposition } from '../Touchable'
3
4
 
4
- export type ActionIconParts = 'icon' | `touchable${Capitalize<TouchableComposition>}`
5
+ export type ActionIconParts = 'icon' | `touchable${Capitalize<TouchableComposition>}` | `badge${Capitalize<BadgeComposition>}`
5
6
  export type ActionIconStates = ':disabled' | ''
6
7
  export type ActionIconComposition = `${ActionIconParts}${ActionIconStates}`
7
8
  const createActionIconStyle = createDefaultVariantFactory<ActionIconComposition>()
8
9
 
9
- const presets = includePresets((style) => createActionIconStyle(() => ({ touchableWrapper: style })))
10
-
11
- export const ActionIconStyles = {
12
- ...presets,
13
- default: createActionIconStyle((theme) => {
14
-
15
- return {
16
- icon: {
17
- color: theme.colors.icon,
18
- ...theme.sized(5 * 0.6),
19
-
20
- },
21
- touchableWrapper: {
22
- ...theme.sized(5),
23
- borderRadius: theme.borderRadius.round,
24
- ...theme.presets.center,
25
- },
26
- 'icon:disabled': {
27
- color: theme.colors.disabled,
28
- },
29
-
30
- }
31
- }),
32
- originalColor: createActionIconStyle(theme => ({
33
- icon: {
34
- color: 'auto',
35
- },
36
- })),
37
- small: createActionIconStyle((theme) => ({
38
- touchableWrapper: {
39
- ...theme.sized(3.5),
40
-
41
- },
42
- icon: {
43
- ...theme.sized(3.5 * 0.6),
44
-
45
- },
46
- })),
47
- large: createActionIconStyle((theme) => ({
48
- touchableWrapper: {
49
- ...theme.sized(6.5),
50
-
51
- },
52
- icon: {
53
- ...theme.sized(6.5 * 0.6),
54
-
55
- },
56
- })),
57
- primary: createActionIconStyle((theme) => ({
58
- icon: {
59
- color: theme.colors.primary,
60
-
61
- },
62
-
63
- })),
64
- negative: createActionIconStyle((theme) => ({
65
- icon: {
66
- color: theme.colors.negative,
67
-
68
- },
69
-
70
- })),
71
- positive: createActionIconStyle((theme) => ({
72
- icon: {
73
- color: theme.colors.positive,
74
-
75
- },
76
-
77
- })),
78
- black: createActionIconStyle((theme) => ({
79
- icon: {
80
- color: theme.colors.black,
81
-
82
- },
83
-
84
- })),
85
- white: createActionIconStyle((theme) => ({
86
- icon: {
87
- color: theme.colors.white,
88
-
89
- },
90
-
91
- })),
92
- neutral: createActionIconStyle((theme) => ({
93
- icon: {
94
- color: theme.colors.neutral,
95
- },
96
- })),
97
- }
10
+ export const ActionIconPresets = includePresets((style) => createActionIconStyle(() => ({ touchableWrapper: style })))
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react'
2
- import { ComponentPropsWithoutRef, forwardRef } from 'react'
3
- import { ActivityIndicator as Indicator, StyleSheet } from 'react-native'
2
+ import { forwardRef } from 'react'
3
+ import { ActivityIndicator as Indicator, ActivityIndicatorProps as IndicatorProps, StyleSheet } from 'react-native'
4
4
  import {
5
5
 
6
6
  useDefaultComponentStyle,
@@ -10,20 +10,31 @@ import {
10
10
  import { StylesOf } from '../../types'
11
11
  import {
12
12
  ActivityIndicatorComposition,
13
- ActivityIndicatorStyles,
13
+ ActivityIndicatorPresets,
14
14
  } from './styles'
15
15
 
16
16
  export * from './styles'
17
- export type ActivityIndicatorProps = ComponentPropsWithoutRef<
18
- typeof Indicator
19
- > & {
20
- variants?: ComponentVariants<typeof ActivityIndicatorStyles>['variants']
17
+ export type ActivityIndicatorProps =
18
+ IndicatorProps
19
+ & {
20
+ variants?: ComponentVariants<typeof ActivityIndicatorPresets>['variants']
21
21
  styles?: StylesOf<ActivityIndicatorComposition>
22
+ component?: React.ComponentType<Omit<ActivityIndicatorProps & {ref?: React.Ref<Indicator>}, 'component'>>
22
23
  }
23
24
 
24
25
  export const ActivityIndicator = forwardRef<Indicator, ActivityIndicatorProps>(
25
26
  (activityIndicatorProps, ref) => {
26
- const { variants = [], style, styles: propStyles, ...props } = activityIndicatorProps
27
+ const {
28
+ variants = [],
29
+ style,
30
+ styles: propStyles,
31
+ component,
32
+ ...props
33
+ } = {
34
+ ...ActivityIndicator.defaultProps,
35
+ ...activityIndicatorProps,
36
+
37
+ }
27
38
 
28
39
  const variantStyles = useDefaultComponentStyle('ActivityIndicator', {
29
40
  variants,
@@ -37,14 +48,22 @@ export const ActivityIndicator = forwardRef<Indicator, ActivityIndicatorProps>(
37
48
  const color = styles?.color || Theme.colors.gray
38
49
  const size = styles?.height || styles?.width || 'large'
39
50
 
51
+ const Component = component
52
+
53
+
40
54
  return (
41
- <Indicator
55
+ <Component
42
56
  size={size}
43
57
  ref={ref}
44
58
  color={color}
45
59
  style={styles}
60
+ styles={styles}
46
61
  {...props}
47
62
  />
48
63
  )
49
64
  },
50
65
  )
66
+
67
+ ActivityIndicator.defaultProps = {
68
+ component: Indicator,
69
+ }
@@ -6,63 +6,6 @@ export type ActivityIndicatorComposition =
6
6
  | 'frontCircle'
7
7
  | 'circle'
8
8
 
9
- const createActivityIndicatorStyle =
10
- createDefaultVariantFactory<ActivityIndicatorComposition>()
9
+ const createActivityIndicatorStyle = createDefaultVariantFactory<ActivityIndicatorComposition>()
11
10
 
12
- const presets = includePresets((styles) => createActivityIndicatorStyle(() => ({ wrapper: styles })),
13
- )
14
-
15
- export const getActivityIndicatorBaseStyles = (size:number) => {
16
- const sizes = {
17
- height: size,
18
- width: size,
19
- borderWidth: size * 0.25,
20
- }
21
-
22
- return {
23
- wrapper: {
24
- position: 'relative',
25
- ...sizes,
26
- } as any,
27
- circle: {
28
- borderRadius: 100,
29
- position: 'absolute',
30
- borderStyle: 'solid',
31
- top: 0,
32
- bottom: 0,
33
- left: 0,
34
- right: 0,
35
- } as any,
36
- backCircle: {
37
-
38
- // borderColor: theme.colors.primary,
39
- minWidth: '100%',
40
- opacity: 0.5,
41
- } as any,
42
- frontCircle: {
43
- position: 'absolute',
44
- borderColor: 'transparent',
45
- // borderTopColor: theme.colors.primary,
46
- } as any,
47
- }
48
- }
49
-
50
- export const ActivityIndicatorStyles = {
51
- ...presets,
52
- default: createActivityIndicatorStyle((theme) => {
53
- const baseStyles = getActivityIndicatorBaseStyles(35)
54
-
55
- return {
56
- ...baseStyles,
57
- backCircle: {
58
- ...baseStyles.backCircle,
59
- borderColor: theme.colors.primary,
60
- },
61
- frontCircle: {
62
- ...baseStyles.frontCircle,
63
- borderTopColor: theme.colors.primary,
64
- },
65
- }
66
-
67
- }),
68
- }
11
+ export const ActivityIndicatorPresets = includePresets((styles) => createActivityIndicatorStyle(() => ({ wrapper: styles })))
@@ -0,0 +1,235 @@
1
+ import {
2
+ useDefaultComponentStyle,
3
+ TypeGuards,
4
+ useNestedStylesByKey,
5
+ FormTypes,
6
+ onMount,
7
+ useSearch,
8
+ } from '@codeleap/common'
9
+ import React, { useCallback } from 'react'
10
+ import { StyleSheet } from 'react-native'
11
+ import { List } from '../List'
12
+ import { SearchInput } from '../TextInput'
13
+ import { AutocompletePresets } from './styles'
14
+ import { AutocompleteProps } from './types'
15
+ import { Button } from '../Button'
16
+ import { View } from '../View'
17
+ export * from './styles'
18
+
19
+ const defaultFilterFunction = (search: string, options: FormTypes.Options<any>) => {
20
+ return options.filter((option) => {
21
+ if (TypeGuards.isString(option.label)) {
22
+ return option.label.toLowerCase().includes(search.toLowerCase())
23
+ }
24
+
25
+ return option.label === search
26
+ })
27
+ }
28
+
29
+ const defaultProps:Partial<AutocompleteProps<any, boolean>> = {
30
+ getLabel(option) {
31
+
32
+ if (TypeGuards.isArray(option)) {
33
+
34
+ if (option.length === 0) return null
35
+
36
+ return option.map(o => o.label).join(', ')
37
+
38
+ } else {
39
+ if (!option) return null
40
+ return option?.label
41
+ }
42
+ },
43
+ searchInputProps: {},
44
+ selectedIcon: 'check' as any,
45
+ searchComponent: SearchInput,
46
+ }
47
+
48
+ export const Autocomplete = <T extends string|number = string, Multi extends boolean = false>(autocomplete:AutocompleteProps<T, Multi>) => {
49
+ const allProps = {
50
+ ...defaultProps,
51
+ ...autocomplete,
52
+ }
53
+
54
+ const {
55
+ value,
56
+ onValueChange,
57
+ styles = {},
58
+ options = [],
59
+ variants,
60
+ renderItem,
61
+
62
+ debugName,
63
+ placeholder = 'Select',
64
+ itemProps = {},
65
+ searchable = true,
66
+ loadOptions,
67
+ multiple = false,
68
+ limit = null,
69
+ defaultOptions = options,
70
+ onLoadOptionsError,
71
+ selectedIcon,
72
+ loadOptionsOnMount = defaultOptions.length === 0,
73
+ selectable = false,
74
+ searchComponent,
75
+ filterItems = defaultFilterFunction,
76
+ searchInputProps: searchProps = {},
77
+ onItemPressed = () => {},
78
+ ...listProps
79
+ } = allProps
80
+
81
+ const isValueArray = TypeGuards.isArray(value) && multiple
82
+
83
+ const {
84
+ loading,
85
+ setLoading,
86
+ labelOptions,
87
+ setLabelOptions,
88
+ filteredOptions,
89
+ load,
90
+ onChangeSearch,
91
+ } = useSearch({
92
+ value,
93
+ multiple,
94
+ options,
95
+ filterItems,
96
+ debugName,
97
+ defaultOptions,
98
+ loadOptions,
99
+ onLoadOptionsError,
100
+ })
101
+
102
+ onMount(() => {
103
+ if (loadOptionsOnMount && !!loadOptions) {
104
+ load()
105
+ }
106
+ })
107
+
108
+ const variantStyles = useDefaultComponentStyle<'u:Autocomplete', typeof AutocompletePresets>('u:Autocomplete', {
109
+ transform: StyleSheet.flatten,
110
+ rootElement: 'inputWrapper',
111
+ styles,
112
+ variants,
113
+ })
114
+
115
+ const itemStyles = useNestedStylesByKey('item', variantStyles)
116
+
117
+ const listStyles = useNestedStylesByKey('list', variantStyles)
118
+
119
+ const currentOptions = searchable ? filteredOptions : defaultOptions
120
+
121
+ const select = (selectedValue) => {
122
+
123
+ let newValue = null
124
+
125
+ let newOption = null
126
+ let removedIndex = null
127
+
128
+ if (multiple && isValueArray) {
129
+ if (value.includes(selectedValue)) {
130
+ removedIndex = value.findIndex(v => v === selectedValue)
131
+
132
+ newValue = value.filter((v, i) => i !== removedIndex)
133
+
134
+ } else {
135
+
136
+ if (TypeGuards.isNumber(limit) && value.length >= limit) {
137
+ return
138
+ }
139
+
140
+ newOption = currentOptions.find(o => o.value === selectedValue)
141
+
142
+ newValue = [...value, selectedValue]
143
+ }
144
+
145
+ } else {
146
+ newValue = selectedValue
147
+ newOption = currentOptions.find(o => o.value === selectedValue)
148
+ }
149
+
150
+ onValueChange(newValue)
151
+
152
+ if (isValueArray) {
153
+ if (removedIndex !== null) {
154
+ const newOptions = [...labelOptions]
155
+ newOptions.splice(removedIndex, 1)
156
+ setLabelOptions(newOptions)
157
+ } else {
158
+ setLabelOptions([...labelOptions, newOption])
159
+ }
160
+ } else {
161
+ setLabelOptions([newOption])
162
+ }
163
+
164
+ }
165
+
166
+ const Item = renderItem || Button
167
+
168
+ const renderListItem = useCallback(({ item }) => {
169
+
170
+ let selected = false
171
+
172
+ if (multiple && isValueArray) {
173
+ selected = value?.includes(item.value)
174
+ } else {
175
+ selected = value === item.value
176
+ }
177
+
178
+ return <Item
179
+ debugName={`${debugName} item ${item.value}`}
180
+ selected={selectable ? selected : false}
181
+ text={item.label}
182
+ item={item}
183
+ onPress={() => {
184
+ onItemPressed(item)
185
+ if (selectable) {
186
+ select(item.value)
187
+ }
188
+ }}
189
+ // @ts-ignore
190
+ rightIcon={selectedIcon}
191
+ // @ts-ignore
192
+ icon={selectedIcon}
193
+ styles={itemStyles}
194
+ {...itemProps}
195
+ />
196
+ }, [value, select, multiple, selectable, isValueArray])
197
+
198
+ const Search = searchComponent
199
+
200
+ return <View style={variantStyles.wrapper}>
201
+ <Search
202
+ placeholder={placeholder}
203
+ debugName={debugName}
204
+ onTypingChange={(isTyping) => {
205
+ if (searchable && !!loadOptions) {
206
+ setLoading(isTyping)
207
+ }
208
+ }}
209
+ debounce={!!loadOptions ? 800 : null}
210
+ onSearchChange={onChangeSearch}
211
+ hideErrorMessage
212
+ {...searchProps}
213
+ />
214
+
215
+ <List<any>
216
+ data={searchable ? filteredOptions : options}
217
+ scrollEnabled={false}
218
+ showsHorizontalScrollIndicator={false}
219
+ styles={listStyles}
220
+ // @ts-ignore
221
+ keyExtractor={(i) => i.value}
222
+ renderItem={renderListItem}
223
+ fakeEmpty={loading}
224
+ placeholder={{
225
+ loading,
226
+ }}
227
+ {...listProps}
228
+ />
229
+ </View>
230
+ }
231
+
232
+ export * from './styles'
233
+ export * from './types'
234
+
235
+ Autocomplete.defaultProps = defaultProps
@@ -0,0 +1,18 @@
1
+ import { ButtonComposition, createDefaultVariantFactory, includePresets, TextInputComposition } from '@codeleap/common'
2
+ import { ListComposition } from '../List'
3
+
4
+ type ItemStates = '' | ':selected'
5
+
6
+ type ItemParts = ButtonComposition
7
+
8
+ type ItemComposition = `${ItemParts}${ItemStates}` | ItemParts
9
+
10
+ export type AutocompleteComposition =
11
+ 'wrapper' |
12
+ `list${Capitalize<ListComposition>}` |
13
+ `item${Capitalize<ItemComposition>}` |
14
+ `searchInput${Capitalize<TextInputComposition>}`
15
+
16
+ const createSelectStyle = createDefaultVariantFactory<AutocompleteComposition>()
17
+
18
+ export const AutocompletePresets = includePresets((style) => createSelectStyle(() => ({ wrapper: style })))