@codeleap/mobile 2.4.7 → 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 +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 +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 +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,75 @@
1
+ import {
2
+ ComponentVariants,
3
+ FormTypes,
4
+ IconPlaceholder,
5
+ PropsOf,
6
+ } from '@codeleap/common'
7
+ import { AutocompletePresets } from '.'
8
+ import { StylesOf } from '../../types/utility'
9
+ import { GetKeyboardAwarePropsOptions } from '../../utils'
10
+ import { Icon } from '../Icon'
11
+ import { FlatListProps } from '../List'
12
+ import { Text } from '../Text'
13
+ import { SearchInputProps, TextInputProps } from '../TextInput'
14
+ import { Touchable } from '../Touchable'
15
+ import { AutocompleteComposition } from './styles'
16
+
17
+ export type AutocompleteRenderFNProps<T> = {
18
+ styles: StylesOf<AutocompleteComposition>
19
+ onPress: () => void
20
+ isSelected?: boolean
21
+ item: FormTypes.Options<T>[number]
22
+ touchableProps?: Partial<PropsOf<typeof Touchable>>
23
+ textProps?: Partial<PropsOf<typeof Text>>
24
+ iconProps?: Partial<PropsOf<typeof Icon>>
25
+ }
26
+
27
+ export type AutocompleteRenderFN<T> = (props: AutocompleteRenderFNProps<T>) => JSX.Element
28
+
29
+ export type AutocompleteValue<T, Multi extends boolean = false> = Multi extends true ? T[] : T
30
+
31
+ export type ValueBoundAutocompleteProps<T, Multi extends boolean = false> = {
32
+ options?: FormTypes.Options<T>
33
+ defaultOptions?: FormTypes.Options<T>
34
+ loadOptions?: (search: string) => Promise<FormTypes.Options<T>>
35
+ value: AutocompleteValue<T, Multi>
36
+ renderItem?: AutocompleteRenderFN<AutocompleteValue<T, Multi>>
37
+ onValueChange: (value: AutocompleteValue<T, Multi>) => void
38
+ filterItems?: (search: string, items: FormTypes.Options<T>) => FormTypes.Options<T>
39
+ onLoadOptionsError?: (error: any) => void
40
+ multiple?: Multi
41
+ getLabel?: (forOption: Multi extends true ? FormTypes.Options<T> : FormTypes.Options<T>[number]) => FormTypes.Label
42
+ onItemPressed?: (item: FormTypes.Options<T>[number]) => any
43
+ }
44
+
45
+ export type ReplaceAutocompleteProps<Props, T, Multi extends boolean = false> = Omit<
46
+ Props,
47
+ keyof ValueBoundAutocompleteProps<T, Multi>
48
+ > & ValueBoundAutocompleteProps<T, Multi>
49
+
50
+ export type AutocompleteProps<T = any, Multi extends boolean = false> = {
51
+ placeholder?: string
52
+ label?: FormTypes.Label
53
+ styles?: StylesOf<AutocompleteComposition>
54
+ style?: TextInputProps['style']
55
+ closeOnSelect?: boolean
56
+ listProps?: Partial<FlatListProps>
57
+ keyboardAware?: GetKeyboardAwarePropsOptions
58
+ multiple?: Multi
59
+ itemProps?: Partial<
60
+ Pick<AutocompleteRenderFNProps<any>, 'iconProps'|'textProps'|'touchableProps'
61
+ >>
62
+ searchable?: boolean
63
+ limit?: number
64
+ selectedIcon?: IconPlaceholder
65
+ loadOptionsOnMount?: boolean
66
+ loadOptionsOnOpen?: boolean
67
+ selectable?: boolean
68
+ searchInputProps?: Partial<SearchInputProps>
69
+ debugName: string
70
+ searchComponent?: React.ComponentType<SearchInputProps>
71
+ }
72
+ & Omit<FlatListProps<T>, 'renderItem'|'styles'|'style'>
73
+ & ComponentVariants<typeof AutocompletePresets>
74
+ & ValueBoundAutocompleteProps<T, Multi>
75
+
@@ -0,0 +1,126 @@
1
+ import {
2
+ ComponentVariants,
3
+ IconPlaceholder,
4
+ TypeGuards,
5
+ matchInitialToColor,
6
+ useDefaultComponentStyle,
7
+ useMemo,
8
+ getNestedStylesByKey,
9
+ } from '@codeleap/common'
10
+ import React from 'react'
11
+ import { StyleSheet } from 'react-native'
12
+ import { StylesOf } from '../../types'
13
+ import { AvatarComposition, AvatarPresets } from './styles'
14
+ import { Image, ImageProps } from '../Image'
15
+ import { Touchable } from '../Touchable'
16
+ import { Text } from '../Text'
17
+ import { View, ViewProps } from '../View'
18
+ import { Icon } from '../Icon'
19
+ import { Badge, BadgeComponentProps } from '../Badge'
20
+
21
+ export type AvatarProps = ComponentVariants<typeof AvatarPresets> & {
22
+ styles?: StylesOf<AvatarComposition>
23
+ image?: ImageProps['source']
24
+ name?: string | string[]
25
+ debugName: string
26
+ firstNameOnly?: boolean
27
+ text?: string
28
+ description?: string
29
+ icon?: IconPlaceholder
30
+ badgeIcon?: IconPlaceholder
31
+ style?: ViewProps['style']
32
+ onPress?: () => void
33
+ noFeedback?: boolean
34
+ } & BadgeComponentProps
35
+
36
+ export const Avatar: React.FC<AvatarProps> = (props) => {
37
+ const {
38
+ debugName,
39
+ name = '',
40
+ firstNameOnly = true,
41
+ image,
42
+ variants = [],
43
+ styles,
44
+ style,
45
+ icon,
46
+ badgeIcon,
47
+ text,
48
+ description,
49
+ onPress,
50
+ noFeedback,
51
+ badge = false,
52
+ badgeProps = {},
53
+ ...viewProps
54
+ } = props
55
+
56
+ const variantStyles = useDefaultComponentStyle('u:Avatar', {
57
+ variants,
58
+ styles,
59
+ transform: StyleSheet.flatten,
60
+ })
61
+
62
+ const hasImage = !!image
63
+
64
+ const { initials, randomColor } = useMemo(() => {
65
+ const [first = '', last = ''] = TypeGuards.isString(name)
66
+ ? name.split(' ')
67
+ : name
68
+ const initials = [first[0]]
69
+ if (!firstNameOnly) {
70
+ initials.push(last[0])
71
+ }
72
+ return {
73
+ initials: initials.join(' '),
74
+ randomColor: matchInitialToColor(first[0]),
75
+ }
76
+ }, [name, firstNameOnly])
77
+
78
+ const renderContent = () => {
79
+ if (hasImage) return <Image source={image} style={variantStyles.image} />
80
+ if (icon) return <Icon name={icon} style={variantStyles.icon} />
81
+ return <Text text={text || initials} style={variantStyles.initials} />
82
+ }
83
+
84
+ const hasBackgroundColor = !!variantStyles?.touchable?.backgroundColor
85
+
86
+ const badgeStyles = getNestedStylesByKey('badge', variantStyles)
87
+
88
+ return (
89
+ <View style={[variantStyles.wrapper, style]} {...viewProps}>
90
+ <Touchable
91
+ debugName={'Avatar ' + debugName}
92
+ onPress={() => onPress?.()}
93
+ style={[
94
+ variantStyles.touchable,
95
+ !hasBackgroundColor && {
96
+ backgroundColor: randomColor,
97
+ },
98
+ ]}
99
+ noFeedback={noFeedback || !onPress}
100
+ >
101
+ {renderContent()}
102
+
103
+ {!!description && (
104
+ <View style={variantStyles.descriptionOverlay}>
105
+ <Text text={description} style={variantStyles.description} />
106
+ </View>
107
+ )}
108
+
109
+ <Badge badge={badge} style={badgeStyles} {...badgeProps} />
110
+ </Touchable>
111
+
112
+ {badgeIcon && (
113
+ <Touchable
114
+ debugName={`${debugName} badge`}
115
+ style={variantStyles.badgeIconWrapper}
116
+ onPress={() => onPress?.()}
117
+ noFeedback
118
+ >
119
+ <Icon name={badgeIcon} style={variantStyles.badgeIcon} />
120
+ </Touchable>
121
+ )}
122
+ </View>
123
+ )
124
+ }
125
+
126
+ export * from './styles'
@@ -0,0 +1,22 @@
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
+ import { BadgeComposition } from '../Badge'
3
+
4
+ export type AvatarParts =
5
+ | 'wrapper'
6
+ | 'touchable'
7
+ | 'initials'
8
+ | 'image'
9
+ | 'icon'
10
+ | 'iconWrapper'
11
+ | 'description'
12
+ | 'descriptionOverlay'
13
+ | 'badgeIconWrapper'
14
+ | 'badgeIcon'
15
+ | `badge${Capitalize<BadgeComposition>}`
16
+
17
+ export type AvatarComposition = AvatarParts
18
+
19
+ const createAvatarStyle = createDefaultVariantFactory<AvatarComposition>()
20
+
21
+ export const AvatarPresets = includePresets((styles) => createAvatarStyle(() => ({ wrapper: styles })),
22
+ )
@@ -0,0 +1,76 @@
1
+ import {
2
+ ComponentVariants,
3
+ useDefaultComponentStyle,
4
+ useNestedStylesByKey,
5
+ } from '@codeleap/common'
6
+ import React from 'react'
7
+ import { StyleSheet } from 'react-native'
8
+ import { StylesOf } from '../../types'
9
+ import { AvatarGroupComposition, AvatarGroupPresets } from './styles'
10
+ import { View, ViewProps } from '../View'
11
+ import { Avatar, AvatarProps } from '../Avatar'
12
+
13
+ export type AvatarGroupProps = ComponentVariants<typeof AvatarGroupPresets> & {
14
+ styles?: StylesOf<AvatarGroupComposition>
15
+ style?: ViewProps['style']
16
+ avatars: AvatarProps[]
17
+ displacement?: number
18
+ avatarVariants?: AvatarProps['variants']
19
+ }
20
+
21
+ const defaultProps:Partial<AvatarGroupProps> = {
22
+ displacement: 20.5,
23
+ }
24
+
25
+
26
+
27
+ export const AvatarGroup: React.FC<AvatarGroupProps> = (props) => {
28
+ const {
29
+ variants = [],
30
+ avatars = [],
31
+ avatarVariants,
32
+ styles,
33
+ style,
34
+ displacement,
35
+ ...viewProps
36
+ } = {
37
+ ...defaultProps,
38
+ ...props
39
+ }
40
+
41
+ const variantStyles = useDefaultComponentStyle('u:AvatarGroup', {
42
+ variants,
43
+ styles,
44
+ transform: StyleSheet.flatten,
45
+ })
46
+
47
+ const avatarStyles = useNestedStylesByKey('avatar', variantStyles)
48
+
49
+ return (
50
+ <View
51
+ style={[variantStyles.wrapper, style]}
52
+ variants={['row']}
53
+ {...viewProps}
54
+ >
55
+ {avatars.map((avatar, index) => (
56
+ <Avatar
57
+ firstNameOnly
58
+ key={avatar.debugName || index}
59
+ {...avatar}
60
+ variants={avatar.variants || avatarVariants}
61
+ style={getAvatarStyle(index,displacement)}
62
+ styles={avatarStyles}
63
+ />
64
+ ))}
65
+ </View>
66
+ )
67
+ }
68
+
69
+ AvatarGroup.defaultProps = defaultProps
70
+
71
+ const getAvatarStyle = (index: number,displacementPixels: number) => {
72
+ const displacement = index * 20.5
73
+ return { right: `${displacement}%` }
74
+ }
75
+
76
+ export * from './styles'
@@ -0,0 +1,11 @@
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
+ import { AvatarComposition } from '../components'
3
+
4
+ export type AvatarGroupParts = 'wrapper'
5
+
6
+ export type AvatarGroupComposition = AvatarGroupParts | `avatar${Capitalize<AvatarComposition>}`
7
+
8
+ const createAvatarStyle = createDefaultVariantFactory<AvatarGroupComposition>()
9
+
10
+ export const AvatarGroupPresets = includePresets((styles) => createAvatarStyle(() => ({ wrapper: styles })),
11
+ )
@@ -1,13 +1,12 @@
1
1
  import React from 'react'
2
2
  import { ComponentVariants, onUpdate, PropsOf, useDefaultComponentStyle } from '@codeleap/common'
3
- import { useDynamicAnimation } from 'moti'
4
3
  import { Touchable } from '../Touchable'
5
4
  import { View } from '../View'
6
5
 
7
6
  import { StylesOf } from '../../types/utility'
8
7
  import { StyleSheet } from 'react-native'
9
- import { useStaticAnimationStyles } from '../../utils'
10
- import { BackdropComposition, BackdropStyles } from './styles'
8
+ import { useAnimatedVariantStyles } from '../../utils'
9
+ import { BackdropComposition, BackdropPresets } from './styles'
11
10
 
12
11
  export * from './styles'
13
12
  export type BackdropProps = React.PropsWithChildren<
@@ -15,31 +14,33 @@ export type BackdropProps = React.PropsWithChildren<
15
14
  PropsOf<typeof Touchable> & {
16
15
  visible: boolean
17
16
  wrapperProps?: PropsOf<typeof View>
18
- variants?: ComponentVariants<typeof BackdropStyles>['variants']
17
+ variants?: ComponentVariants<typeof BackdropPresets>['variants']
19
18
  styles?: StylesOf<BackdropComposition>
20
19
  }>
21
20
 
22
21
  export const Backdrop = (backdropProps:BackdropProps) => {
23
22
  const { variants = [], styles = {}, visible, children, wrapperProps = {}, ...props } = backdropProps
24
23
 
25
- const variantStyles = useDefaultComponentStyle<'u:Backdrop', typeof BackdropStyles>('u:Backdrop', {
24
+ const variantStyles = useDefaultComponentStyle<'u:Backdrop', typeof BackdropPresets>('u:Backdrop', {
26
25
  variants,
27
26
  rootElement: 'wrapper',
28
27
  styles,
29
28
  transform: StyleSheet.flatten,
30
29
  })
31
30
 
32
- const animationStates = useStaticAnimationStyles(variantStyles, ['wrapper:hidden', 'wrapper:visible'])
33
-
34
- const animation = useDynamicAnimation(() => {
35
- return visible ? animationStates['wrapper:visible'] : animationStates['wrapper:hidden']
31
+ const animation = useAnimatedVariantStyles({
32
+ variantStyles,
33
+ animatedProperties: ['wrapper:hidden', 'wrapper:visible'],
34
+ updater: (s) => {
35
+ 'worklet'
36
+ return visible ? s['wrapper:visible'] : s['wrapper:hidden']
37
+ },
38
+ dependencies: [visible],
39
+ transition: variantStyles.transition,
36
40
  })
37
41
 
38
- onUpdate(() => {
39
- animation.animateTo(visible ? animationStates['wrapper:visible'] : animationStates['wrapper:hidden'])
40
- }, [visible, animationStates])
41
42
 
42
- return <View pointerEvents={visible ? 'auto' : 'none' } animated style={variantStyles.wrapper} state={animation} {...wrapperProps}>
43
+ return <View pointerEvents={visible ? 'auto' : 'none' } animated style={[variantStyles.wrapper, animation]} {...wrapperProps}>
43
44
  {
44
45
  !!props?.onPress ?
45
46
  <Touchable style={variantStyles.touchable} {...props} noFeedback android_ripple={null}/>
@@ -4,30 +4,9 @@ export type BackdropComposition =
4
4
  'wrapper'|
5
5
  'touchable' |
6
6
  'wrapper:visible' |
7
- 'wrapper:hidden'
7
+ 'wrapper:hidden' |
8
+ 'transition'
8
9
 
9
10
  const createBackdropVariant = createDefaultVariantFactory<BackdropComposition>()
10
11
 
11
- const presets = includePresets((style) => createBackdropVariant(() => ({ wrapper: style })))
12
-
13
- export const BackdropStyles = {
14
- ...presets,
15
- default: createBackdropVariant((theme) => ({
16
- wrapper: {
17
- backgroundColor: theme.colors.black,
18
- ...theme.presets.whole,
19
- ...theme.presets.absolute,
20
- },
21
- 'wrapper:visible': {
22
- opacity: 0.5,
23
- },
24
- 'wrapper:hidden': {
25
-
26
- opacity: 0,
27
- },
28
- touchable: {
29
- ...theme.presets.whole,
30
- ...theme.presets.absolute,
31
- },
32
- })),
33
- }
12
+ export const BackdropPresets = includePresets((style) => createBackdropVariant(() => ({ wrapper: style })))
@@ -0,0 +1,134 @@
1
+ import React from 'react'
2
+ import { ComponentVariants, PropsOf, StylesOf, TypeGuards, useDefaultComponentStyle } from '@codeleap/common'
3
+ import { Text } from '../Text'
4
+ import { View, ViewProps } from '../View'
5
+ import { BadgeComposition, BadgePresets } from './styles'
6
+ import { StyleSheet } from 'react-native'
7
+
8
+ export * from './styles'
9
+
10
+ export type BadgeProps = ComponentVariants<typeof BadgePresets>
11
+ & ViewProps
12
+ & {
13
+ styles?: StylesOf<BadgeComposition>
14
+ maxCount?: number
15
+ minCount?: number
16
+ debugName?: string
17
+ innerWrapperProps?: Partial<PropsOf<typeof View>>
18
+ textProps?: Partial<PropsOf<typeof Text>>
19
+ getBadgeContent?: (props: BadgeContent) => string
20
+ renderBadgeContent?: (props: BadgeContent & { content: string }) => JSX.Element
21
+ disabled?: boolean
22
+ badge?: number | boolean
23
+ }
24
+
25
+ type BadgeContent = BadgeProps & { count: number }
26
+
27
+ export type BadgeComponentProps = {
28
+ badge?: BadgeProps['badge']
29
+ badgeProps?: Partial<BadgeProps>
30
+ }
31
+
32
+ const defaultGetBadgeContent = ({ count, maxCount }: BadgeContent) => {
33
+ if (Number(count) > maxCount) {
34
+ return `${maxCount}+`
35
+ } else {
36
+ return String(count)
37
+ }
38
+ }
39
+
40
+ const defaultProps: Partial<BadgeProps> = {
41
+ maxCount: 9,
42
+ minCount: 1,
43
+ getBadgeContent: defaultGetBadgeContent,
44
+ renderBadgeContent: null,
45
+ disabled: false,
46
+ badge: true,
47
+ }
48
+
49
+ export const Badge = (props: BadgeProps) => {
50
+ const allProps = {
51
+ ...Badge.defaultProps,
52
+ ...props,
53
+ }
54
+
55
+ const {
56
+ debugName,
57
+ innerWrapperProps = {},
58
+ textProps = {},
59
+ maxCount,
60
+ minCount,
61
+ getBadgeContent,
62
+ renderBadgeContent,
63
+ styles = {},
64
+ variants,
65
+ disabled,
66
+ style = {},
67
+ badge,
68
+ ...rest
69
+ } = allProps
70
+
71
+ const visible = (TypeGuards.isBoolean(badge) && badge === true) || TypeGuards.isNumber(badge)
72
+
73
+ if (!visible) return null
74
+
75
+ const variantStyles = useDefaultComponentStyle<'u:Badge', typeof BadgePresets>('u:Badge', {
76
+ variants,
77
+ styles,
78
+ rootElement: 'wrapper',
79
+ transform: StyleSheet.flatten,
80
+ })
81
+
82
+ const wrapperStyles: ViewProps['style'] = [
83
+ variantStyles?.wrapper,
84
+ (disabled && variantStyles?.['wrapper:disabled']),
85
+ style,
86
+ ]
87
+
88
+ const innerWrapperStyles: ViewProps['style'] = [
89
+ variantStyles?.innerWrapper,
90
+ (disabled && variantStyles?.['innerWrapper:disabled']),
91
+ innerWrapperProps?.style,
92
+ ]
93
+
94
+ const countStyles = [
95
+ variantStyles?.count,
96
+ (disabled && variantStyles?.['count:disabled']),
97
+ textProps?.style,
98
+ ]
99
+
100
+ const count = TypeGuards.isNumber(badge) ? badge : null
101
+
102
+ const content = getBadgeContent({ ...props, maxCount, minCount, count })
103
+
104
+ const showContent = TypeGuards.isNumber(count) && count >= minCount
105
+
106
+ let BadgeContent = renderBadgeContent
107
+
108
+ if (TypeGuards.isNil(renderBadgeContent)) {
109
+ BadgeContent = () => <Text text={content} {...textProps} style={countStyles} />
110
+ }
111
+
112
+ return (
113
+ <View
114
+ {...rest}
115
+ style={wrapperStyles}
116
+ >
117
+ <View {...innerWrapperProps} style={innerWrapperStyles}>
118
+ {showContent
119
+ ? <BadgeContent
120
+ {...props}
121
+ maxCount={maxCount}
122
+ minCount={minCount}
123
+ count={count}
124
+ getBadgeContent={getBadgeContent}
125
+ content={content}
126
+ />
127
+ : null
128
+ }
129
+ </View>
130
+ </View>
131
+ )
132
+ }
133
+
134
+ Badge.defaultProps = defaultProps
@@ -0,0 +1,14 @@
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
+
3
+ type BadgeParts = 'wrapper' | 'innerWrapper' | 'count'
4
+
5
+ type BadgeStates = 'disabled'
6
+
7
+ export type BadgeComposition =
8
+ `${BadgeParts}:${BadgeStates}`
9
+ | BadgeParts
10
+
11
+ const createBadgeStyle =
12
+ createDefaultVariantFactory<BadgeComposition>()
13
+
14
+ export const BadgePresets = includePresets((styles) => createBadgeStyle(() => ({ wrapper: styles })))