@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,28 @@
1
+ import { ComponentVariants, StylesOf, useDefaultComponentStyle } from '@codeleap/common'
2
+ import { RefreshControl as RNRefreshControl, RefreshControlProps as RNRefreshControlProps } from 'react-native'
3
+ import { RefreshControlComposition, RefreshControlPresets } from './styles'
4
+
5
+ export type RefreshControlProps = {
6
+ styles?: StylesOf<RefreshControlComposition>
7
+ } & RNRefreshControlProps & ComponentVariants<typeof RefreshControlPresets>
8
+
9
+ export const RefreshControl: React.FC<RefreshControlProps> = (props) => {
10
+ const { variants = [], styles } = props
11
+
12
+ const variantStyles = useDefaultComponentStyle<'u:RefreshControl', typeof RefreshControlPresets>('u:RefreshControl', {
13
+ variants,
14
+ styles,
15
+ })
16
+ return (
17
+ <RNRefreshControl
18
+ colors={[variantStyles.loadingAnimation?.color]}
19
+ tintColor={variantStyles.loadingAnimation?.color}
20
+ progressBackgroundColor={variantStyles.progressBackgroundColor?.color}
21
+ titleColor={variantStyles.titleColor?.color}
22
+ {...props}
23
+ />
24
+
25
+ )
26
+ }
27
+
28
+ export * from './styles'
@@ -0,0 +1,7 @@
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
+
3
+ export type RefreshControlComposition = 'loadingAnimation' |'progressBackgroundColor' | 'titleColor'
4
+
5
+ const createRefreshControlStyle = createDefaultVariantFactory<RefreshControlComposition>()
6
+
7
+ export const RefreshControlPresets = includePresets(style => createRefreshControlStyle(() => ({ loadingAnimation: style })))
@@ -6,15 +6,14 @@ import {
6
6
  useDefaultComponentStyle,
7
7
  usePrevious,
8
8
  } from '@codeleap/common'
9
-
10
- import { RefreshControl, RefreshControlProps, ScrollView, StyleSheet } from 'react-native'
9
+ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view'
10
+ import { ScrollView, StyleSheet } from 'react-native'
11
11
  import { ViewProps } from '../View'
12
+ import { RefreshControl, RefreshControlProps } from '../RefreshControl'
12
13
  import { KeyboardAwareScrollViewTypes } from '../../modules'
13
14
  import { StylesOf } from '../../types'
14
- import { ScrollComposition, ScrollStyles } from './styles'
15
- import { GetKeyboardAwarePropsOptions, useKeyboardAwareView } from '../../utils'
16
- import { ScrollView as MotiScrollView } from 'moti'
17
- // import { KeyboardAwareScrollView } from '../../utils'
15
+ import { ScrollComposition, ScrollPresets } from './styles'
16
+ import { GetKeyboardAwarePropsOptions } from '../../utils'
18
17
 
19
18
  type KeyboardAwareScrollViewProps = KeyboardAwareScrollViewTypes.KeyboardAwareScrollViewProps
20
19
 
@@ -75,46 +74,32 @@ export const Scroll = forwardRef<ScrollView, ScrollProps>(
75
74
  }
76
75
  }, [refreshingDisplay, changeData])
77
76
 
78
- const variantStyles = useDefaultComponentStyle<'u:Scroll', typeof ScrollStyles>('u:Scroll', {
77
+ const variantStyles = useDefaultComponentStyle<'u:Scroll', typeof ScrollPresets>('u:Scroll', {
79
78
  variants,
80
79
  styles,
81
80
  transform: StyleSheet.flatten,
82
81
  rootElement: 'content',
83
82
  })
84
83
 
85
- const refreshStyles = StyleSheet.flatten([variantStyles.refreshControl, styles.refreshControl])
86
- const _scrollProps = {
87
- style: [variantStyles.wrapper, style],
88
- contentContainerStyle: [variantStyles.content, contentContainerStyle],
89
- ref: ref as unknown as ScrollView,
90
- refreshControl: hasRefresh && (
91
- <RefreshControl
92
- refreshing={refreshingDisplay}
93
- onRefresh={onRefresh}
94
- tintColor={refreshStyles?.color}
95
- colors={[refreshStyles?.color]}
96
- {...refreshControlProps}
97
- />
98
- ),
99
- ...props,
100
- }
101
- const keyboard = useKeyboardAwareView({
102
- debugName,
103
- })
104
-
105
- const rootProps = keyboard.getKeyboardAwareProps(_scrollProps, {
106
- adapt: 'marginBottom',
107
- baseStyleProp: 'style',
108
- animated,
109
- ...keyboardAware,
110
-
111
- })
112
- const Component = (animated ? MotiScrollView : ScrollView ) as unknown as typeof ScrollView
84
+ const Component = (animated ? KeyboardAwareScrollView : KeyboardAwareScrollView) as unknown as typeof ScrollView
113
85
 
114
86
  return (
115
87
  <Component
116
- {...rootProps}
117
-
88
+ style={[variantStyles.wrapper, style]}
89
+ contentContainerStyle={[variantStyles.content, contentContainerStyle]}
90
+ showsVerticalScrollIndicator={false}
91
+ // @ts-expect-error - Refs suck
92
+ ref={ref}
93
+ refreshControl= {
94
+ hasRefresh && (
95
+ <RefreshControl
96
+ refreshing={refreshingDisplay}
97
+ onRefresh={onRefresh}
98
+ {...refreshControlProps}
99
+ />
100
+ )
101
+ }
102
+ {...props}
118
103
  >
119
104
  {children}
120
105
  </Component>
@@ -1,21 +1,7 @@
1
1
  import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
2
 
3
- export type ScrollComposition = 'wrapper' |'content' | 'refreshControl'
3
+ export type ScrollComposition = 'wrapper' |'content'
4
4
 
5
5
  const createScrollStyle = createDefaultVariantFactory<ScrollComposition>()
6
6
 
7
- const presets = includePresets(style => createScrollStyle(() => ({ content: style })))
8
-
9
- export const ScrollStyles = {
10
- ...presets,
11
- default: createScrollStyle((theme) => {
12
- return {
13
- wrapper: {
14
- ...theme.presets.fullHeight,
15
- },
16
- refreshControl: {
17
- color: theme.colors.primary,
18
- },
19
- }
20
- }),
21
- }
7
+ export const ScrollPresets = includePresets(style => createScrollStyle(() => ({ content: style })))
@@ -1,90 +1,152 @@
1
1
  import * as React from 'react'
2
- import { forwardRef, useState } from 'react'
2
+ import { forwardRef } from 'react'
3
3
  import {
4
- deepEqual,
5
- onUpdate,
6
4
  useDefaultComponentStyle,
7
- usePrevious,
8
- useCodeleapContext,
5
+ ComponentVariants,
6
+ useCallback,
9
7
  } from '@codeleap/common'
10
8
 
11
- import { RefreshControl, SectionList } from 'react-native'
9
+ import {
10
+ RefreshControl,
11
+ StyleSheet,
12
+ RefreshControlProps,
13
+ SectionListRenderItemInfo,
14
+ SectionListProps as RNSectionListProps,
15
+ } from 'react-native'
12
16
  import { View, ViewProps } from '../View'
13
- import { KeyboardAwareScrollViewTypes } from '../../modules'
14
- import { KeyboardAwareSectionList } from '../../utils'
15
-
16
- export type SectionListProps = KeyboardAwareScrollViewTypes.KeyboardAwareSectionListProps<any> &
17
- ViewProps & {
18
- onRefresh?: () => void
19
- refreshTimeout?: number
20
- changeData?: any
17
+ import { EmptyPlaceholderProps } from '../EmptyPlaceholder'
18
+ import { StylesOf } from '../../types'
19
+ import { KeyboardAwareSectionList } from 'react-native-keyboard-aware-scroll-view'
20
+ import { SectionsComposition, SectionsPresets } from './styles'
21
+ export * from './styles'
22
+
23
+ export type DataboundSectionListPropsTypes = 'data' | 'renderItem' | 'keyExtractor' | 'getItemLayout'
24
+
25
+
26
+ export type AugmentedSectionRenderItemInfo<T> = SectionListRenderItemInfo<T> & {
27
+ isFirst: boolean
28
+ isLast: boolean
29
+ isOnly: boolean
30
+ }
31
+
32
+ export type ReplaceSectionListProps<P, T> = Omit<P, DataboundSectionListPropsTypes> & {
33
+ sections: T[]
34
+ keyExtractor?: (item: T, index: number) => string
35
+ renderItem: (data: AugmentedSectionRenderItemInfo<T>) => React.ReactElement
36
+ onRefresh?: () => void
37
+ getItemLayout?: ((
38
+ data:T,
39
+ index: number,
40
+ ) => { length: number; offset: number; index: number })
41
+ fakeEmpty?: boolean
42
+ }
43
+
44
+ export * from './styles'
45
+
46
+
47
+ export type SectionListProps<
48
+ T = any[],
49
+ Data = T extends Array<infer D> ? D : never
50
+ > = ReplaceSectionListProps<RNSectionListProps<Data>, Data> &
51
+ Omit<ViewProps, 'variants'> & {
21
52
  separators?: boolean
22
- }
53
+ placeholder?: EmptyPlaceholderProps
54
+ styles?: StylesOf<SectionsComposition>
55
+ refreshControlProps?: Partial<RefreshControlProps>
56
+ fakeEmpty?: boolean
57
+ } & ComponentVariants<typeof SectionsPresets>
23
58
 
24
- export const Sections = forwardRef<SectionList, SectionListProps>(
25
- (flatListProps, ref) => {
59
+
60
+ export const Sections = forwardRef<KeyboardAwareSectionList, SectionListProps>(
61
+ (sectionsProps, ref) => {
26
62
  const {
27
63
  variants = [],
28
64
  style,
29
- refreshTimeout = 3000,
30
- changeData,
65
+ styles = {},
66
+ onRefresh,
67
+ component,
68
+ refreshing,
69
+ placeholder,
70
+ keyboardAware,
71
+ refreshControlProps = {},
72
+ fakeEmpty,
73
+ refreshControl,
31
74
  ...props
32
- } = flatListProps
33
- const hasRefresh = !!props.onRefresh
34
- const [refreshing, setRefreshing] = useState(false)
75
+ } = sectionsProps
35
76
 
36
- const timer = React.useRef(null)
37
- const previousData = usePrevious(changeData)
77
+ const variantStyles = useDefaultComponentStyle<'u:Sections', typeof SectionsPresets>('u:Sections', {
78
+ variants,
79
+ styles,
80
+ transform: StyleSheet.flatten,
38
81
 
39
- const onRefresh = () => {
40
- if (timer.current) {
41
- clearTimeout(timer.current)
42
- }
82
+ })
83
+
84
+ const renderSeparator = () => {
85
+ return (
86
+ <View style={variantStyles.separator}></View>
87
+ )
88
+ }
43
89
 
44
- setRefreshing(true)
90
+ const getItemPosition = (section, itemIdx) => {
91
+ const listLength = section?.length || 0
45
92
 
46
- props.onRefresh()
93
+ const isFirst = itemIdx === 0
94
+ const isLast = itemIdx === listLength - 1
95
+ const isOnly = isFirst && isLast
47
96
 
48
- timer.current = setTimeout(() => {
49
- setRefreshing(false)
50
- }, refreshTimeout)
97
+ return { isFirst, isLast, isOnly }
51
98
  }
52
- onUpdate(() => {
53
- if (refreshing && !deepEqual(previousData, changeData)) {
54
- setRefreshing(false)
55
- if (timer.current) {
56
- clearTimeout(timer.current)
57
- }
58
- }
59
- }, [refreshing, changeData])
60
- const { Theme } = useCodeleapContext()
61
99
 
62
- const variantStyles = useDefaultComponentStyle('View', {
63
- variants,
64
- })
100
+ const getSectionPosition = (data) => {
101
+ const listLength = props.sections?.length || 0
65
102
 
66
- const renderSeparator = () => {
67
- return (
68
- <View variants={['separator']}></View>
69
- )
103
+ const isFirst = data.section.key === props.sections[0].key
104
+ const isLast = data.section.key === props.sections[listLength - 1].key
105
+ const isOnly = isFirst && isLast
106
+
107
+ return { isFirst, isLast, isOnly }
70
108
  }
71
109
 
110
+ const renderSectionHeader = useCallback((data) => {
111
+ if (!props?.renderSectionHeader) return null
112
+
113
+ return props?.renderSectionHeader({ ...data, ...getSectionPosition(data) })
114
+ }, [props?.renderSectionHeader, props?.sections?.length])
115
+
116
+ const renderSectionFooter = useCallback((data) => {
117
+ if (!props?.renderSectionFooter) return null
118
+
119
+ return props?.renderSectionFooter({ ...data, ...getSectionPosition(data) })
120
+ }, [props?.renderSectionFooter, props?.sections?.length])
121
+
122
+ const renderItem = useCallback((data) => {
123
+ if (!props?.renderItem) return null
124
+
125
+ return props?.renderItem({ ...data, ...getItemPosition(data.section?.data, data?.index) })
126
+
127
+ }, [props?.renderItem, props?.sections?.length])
128
+
72
129
  const separatorProp = props.separators
73
- const isEmpty = !props.data || !props.data.length
130
+ const isEmpty = !props.sections || !props.sections.length
74
131
  const separator = !isEmpty && separatorProp == true && renderSeparator
75
132
 
76
133
  return (
77
134
  <KeyboardAwareSectionList
78
- style={[Theme.presets.full, style]}
79
- contentContainerStyle={[variantStyles.wrapper]}
80
- ref={ref as unknown as SectionList}
135
+ style={[variantStyles.wrapper,style]}
136
+ contentContainerStyle={[variantStyles.content]}
137
+ showsVerticalScrollIndicator={false}
138
+ // @ts-ignore
139
+ ref={ref}
81
140
  ItemSeparatorComponent={separator}
82
141
  {...props}
83
142
  refreshControl={
84
- hasRefresh && (
143
+ !!onRefresh && (
85
144
  <RefreshControl refreshing={refreshing} onRefresh={onRefresh} />
86
145
  )
87
146
  }
147
+ renderItem={renderItem}
148
+ renderSectionHeader={renderSectionHeader}
149
+ renderSectionFooter={renderSectionFooter}
88
150
  />
89
151
  )
90
152
  },
@@ -0,0 +1,7 @@
1
+ import { createDefaultVariantFactory, includePresets } from '@codeleap/common'
2
+
3
+ export type SectionsComposition = 'wrapper' |'content' | 'separator'
4
+
5
+ const createSectionsStyle = createDefaultVariantFactory<SectionsComposition>()
6
+
7
+ export const SectionsPresets = includePresets(style => createSectionsStyle(() => ({ content: style })))
@@ -0,0 +1,51 @@
1
+ import React from 'react'
2
+ import { IconPlaceholder, PropsOf } from '@codeleap/common'
3
+ import { StylesOf } from '../../types'
4
+ import { Text } from '../Text'
5
+ import { Touchable } from '../Touchable'
6
+ import { Gap, View } from '../View'
7
+ import { SegmentedControlComposition } from './styles'
8
+ import { Icon } from '../Icon'
9
+
10
+ export type SegmentedControlOptionProps = PropsOf<typeof Touchable> & {
11
+ selected?: boolean
12
+ label: string
13
+ value: string
14
+ variantStyles?: StylesOf<SegmentedControlComposition>
15
+ textProps?: Omit<PropsOf<typeof Text>, 'key'>
16
+ icon?: IconPlaceholder
17
+ badge?: React.ReactNode
18
+ }
19
+
20
+ export const SegmentedControlOption = (props: SegmentedControlOptionProps) => {
21
+ const { selected, onPress, debugName, style, variantStyles, label, value, icon, textProps, badge = null, ...touchableProps } = props
22
+
23
+ return <Touchable
24
+ debugName={`Segmented Control ${debugName}, option ${label}`}
25
+ noFeedback={selected}
26
+ key={touchableProps.key}
27
+ styles={{
28
+ feedback: variantStyles.buttonFeedback,
29
+ }}
30
+ style={[variantStyles.button, selected && variantStyles['button:selected'], style]}
31
+ onPress={onPress}
32
+ >
33
+ {
34
+ !!icon && (
35
+ <Icon name={icon} style={[variantStyles.icon]} />
36
+
37
+ )
38
+ }
39
+ <Text
40
+ text={label}
41
+ style={[
42
+ variantStyles.text,
43
+ selected && variantStyles['text:selected'],
44
+ touchableProps?.disabled && variantStyles['text:disabled'],
45
+ ]}
46
+ {...textProps}
47
+ />
48
+ { badge }
49
+
50
+ </Touchable>
51
+ }
@@ -1,15 +1,19 @@
1
1
  import React, { ReactElement, useImperativeHandle, useMemo, useRef } from 'react'
2
2
  import { Scroll, ScrollProps } from '../Scroll'
3
3
 
4
- import { Easing, EasingFunction, StyleSheet } from 'react-native'
5
- import { FormTypes, getNestedStylesByKey, PropsOf, useCodeleapContext, useDefaultComponentStyle } from '@codeleap/common'
6
- import { SegmentedControlComposition, SegmentedControlStyles } from './styles'
4
+ import { Easing, StyleSheet } from 'react-native'
5
+ import { FormTypes, getNestedStylesByKey, PropsOf, TypeGuards, useCodeleapContext, useDefaultComponentStyle } from '@codeleap/common'
6
+ import { SegmentedControlComposition, SegmentedControlPresets } from './styles'
7
7
  import { Touchable } from '../Touchable'
8
8
  import { StylesOf } from '../../types/utility'
9
- import { Text, TextProps } from '../Text'
9
+ import { Text } from '../Text'
10
10
  import { KeyboardAwareScrollViewTypes } from '../../modules'
11
11
  import { View } from '../View'
12
12
  import { InputLabel } from '../InputLabel'
13
+ import { useAnimatedVariantStyles, TransitionConfig } from '../../utils'
14
+ import { SegmentedControlOption } from './Option'
15
+ import { IconPlaceholder } from '@codeleap/common'
16
+ import { Badge, BadgeProps } from '../Badge'
13
17
 
14
18
  export * from './styles'
15
19
  export type SegmentedControlRef =KeyboardAwareScrollViewTypes.KeyboardAwareScrollView & {
@@ -17,15 +21,14 @@ export type SegmentedControlRef =KeyboardAwareScrollViewTypes.KeyboardAwareScrol
17
21
  scrollToCurrent: () => void
18
22
  }
19
23
 
24
+ type SegmentedContropOptions<T = string> = {label: string; value: T; icon?: IconPlaceholder; badge?: BadgeProps['badge']}
25
+
20
26
  export type SegmentedControlProps<T = string> = ScrollProps & {
21
- options : {label: string; value: T }[]
27
+ options : SegmentedContropOptions[]
22
28
  onValueChange: (value: T) => any
23
29
  value: T
24
30
  debugName: string
25
- animation?: {
26
- duration?: number
27
- easing?: EasingFunction
28
- }
31
+ animation?: TransitionConfig
29
32
  textProps?: Partial<PropsOf<typeof Text>>
30
33
  touchableProps?: Partial<PropsOf<typeof Touchable>>
31
34
  styles?: StylesOf<SegmentedControlComposition>
@@ -34,10 +37,11 @@ export type SegmentedControlProps<T = string> = ScrollProps & {
34
37
  RenderButton?: (props: SegmentedControlProps & {
35
38
  touchableProps: PropsOf<typeof Touchable>
36
39
  textProps: PropsOf<typeof Text>
37
- option: {label: string; value: any}
40
+ option: SegmentedContropOptions
38
41
  }) => ReactElement
39
42
  RenderAnimatedView?: (props: Partial<SegmentedControlProps>) => ReactElement
40
- getItemWidth?: (item:{label: string; value: T }, idx: number, arr: {label: string; value: T }[]) => number
43
+ getItemWidth?: (item: SegmentedContropOptions, idx: number, arr: SegmentedContropOptions[]) => number
44
+ badgeProps?: Partial<BadgeProps>
41
45
  }
42
46
 
43
47
  const defaultAnimation = {
@@ -63,13 +67,14 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
63
67
  getItemWidth = (i) => (Theme.values.width - Theme.spacing.value(4)) / options.length,
64
68
  RenderAnimatedView,
65
69
  RenderButton,
70
+ badgeProps = {},
66
71
  } = props
67
72
 
68
- let _animation = {
73
+ const _animation = {
69
74
  ...defaultAnimation, ...animation,
70
75
  }
71
76
 
72
- let variantStyles = useDefaultComponentStyle<'u:SegmentedControl', typeof SegmentedControlStyles>('u:SegmentedControl', {
77
+ let variantStyles = useDefaultComponentStyle<'u:SegmentedControl', typeof SegmentedControlPresets>('u:SegmentedControl', {
73
78
  styles,
74
79
  transform: StyleSheet.flatten,
75
80
  variants,
@@ -94,8 +99,6 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
94
99
 
95
100
  const currentOptionIdx = options.findIndex(o => o.value === value) || 0
96
101
 
97
- const translateX = widthStyle.width * currentOptionIdx
98
-
99
102
  const onPress = (txt:string, idx: number) => {
100
103
  return () => {
101
104
  onValueChange(txt)
@@ -123,11 +126,26 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
123
126
  hasScrolledInitially.current = true
124
127
  }
125
128
 
126
- const AnimatedView = RenderAnimatedView || View
129
+ const BubbleView = RenderAnimatedView || View
127
130
  variantStyles = JSON.parse(JSON.stringify(variantStyles))
128
- _animation = JSON.parse(JSON.stringify(_animation))
129
131
 
130
132
  const labelStyles = getNestedStylesByKey('label', variantStyles)
133
+
134
+ const bubbleAnimation = useAnimatedVariantStyles({
135
+ variantStyles,
136
+ animatedProperties: [],
137
+ updater: () => {
138
+ 'worklet'
139
+ return {
140
+ translateX: currentOptionIdx * widthStyle.width,
141
+ }
142
+ },
143
+ transition: _animation,
144
+ dependencies: [currentOptionIdx, widthStyle.width],
145
+ })
146
+
147
+ const badgeStyles = getNestedStylesByKey('badge', variantStyles)
148
+
131
149
  return (<View style={variantStyles.wrapper}>
132
150
  <InputLabel label={label} styles={labelStyles} required={false}/>
133
151
  <Scroll
@@ -142,61 +160,27 @@ const _SegmentedControl = React.forwardRef<SegmentedControlRef, SegmentedControl
142
160
  ref={scrollRef}
143
161
  >
144
162
  <View style={variantStyles.innerWrapper}>
145
- <AnimatedView
163
+ <BubbleView
146
164
  options={options}
147
165
  styles={variantStyles}
148
-
149
166
  animated
150
- style={[variantStyles.selectedBubble, widthStyle]}
151
- animate={{
152
- translateX,
153
- }}
154
- transition={{
155
- translateX: _animation,
156
- }}
167
+ style={[variantStyles.selectedBubble, props?.touchableProps?.disabled && variantStyles['selectedBubble:disabled'], widthStyle, bubbleAnimation]}
157
168
 
158
169
  />
159
- {options.map((o, idx) => {
160
- const selected = value === o.value
161
-
162
- const touchableProps = {
163
- key: idx,
164
- debugName: `Segmented Control ${debugName}, option ${o.label}`,
165
- onPress: onPress(o.value, idx),
166
- style: [widthStyle, variantStyles.button, selected && variantStyles['button:selected']],
167
- ...props.touchableProps,
168
-
169
- }
170
-
171
- const textProps:TextProps = {
172
- text: o.label as string,
173
- colorChangeConfig: _animation,
174
- style: StyleSheet.flatten([variantStyles.text, selected && variantStyles['text:selected']]),
175
- animated: true,
176
- ...props.textProps,
177
- }
178
-
179
- if (RenderButton) {
180
- return (
181
- <RenderButton {...props} touchableProps={touchableProps} key={touchableProps.key} textProps={textProps} option={o}/>
182
- )
183
- }
184
- return <Touchable
185
- {...touchableProps}
186
- noFeedback={selected}
187
- key={touchableProps.key}
188
- styles={{
189
- feedback: variantStyles.buttonFeedback,
190
- }}
191
- >
192
- <Text
193
-
194
- {...textProps}
195
- />
196
-
197
- </Touchable>
198
-
199
- })}
170
+ {options.map((o, idx) => (
171
+ <SegmentedControlOption
172
+ debugName={debugName}
173
+ label={o.label}
174
+ value={o.value}
175
+ icon={o.icon}
176
+ onPress={onPress(o.value, idx)}
177
+ key={idx}
178
+ style={widthStyle}
179
+ selected={value === o.value}
180
+ variantStyles={variantStyles}
181
+ badge={!TypeGuards.isNil(o.badge) ? <Badge badge={o.badge} styles={badgeStyles} {...badgeProps} /> : null}
182
+ />
183
+ ))}
200
184
  </View>
201
185
  </Scroll>
202
186
  </View>