rn-custom-ui 1.0.0

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 (332) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +477 -0
  3. package/lib/module/assets/images/close.png +0 -0
  4. package/lib/module/components/CustomCheckbox/index.js +99 -0
  5. package/lib/module/components/CustomCheckbox/index.js.map +1 -0
  6. package/lib/module/components/CustomCheckbox/styles.js +213 -0
  7. package/lib/module/components/CustomCheckbox/styles.js.map +1 -0
  8. package/lib/module/components/CustomCheckbox/types.js +4 -0
  9. package/lib/module/components/CustomCheckbox/types.js.map +1 -0
  10. package/lib/module/components/closeButton/index.js +45 -0
  11. package/lib/module/components/closeButton/index.js.map +1 -0
  12. package/lib/module/components/closeButton/types.js +4 -0
  13. package/lib/module/components/closeButton/types.js.map +1 -0
  14. package/lib/module/components/customButton/index.js +176 -0
  15. package/lib/module/components/customButton/index.js.map +1 -0
  16. package/lib/module/components/customButton/styles.js +282 -0
  17. package/lib/module/components/customButton/styles.js.map +1 -0
  18. package/lib/module/components/customButton/types.js +4 -0
  19. package/lib/module/components/customButton/types.js.map +1 -0
  20. package/lib/module/components/customDropDown/DropDownBottomSheet.js +57 -0
  21. package/lib/module/components/customDropDown/DropDownBottomSheet.js.map +1 -0
  22. package/lib/module/components/customDropDown/DropDownList.js +51 -0
  23. package/lib/module/components/customDropDown/DropDownList.js.map +1 -0
  24. package/lib/module/components/customDropDown/DropDownListItem.js +38 -0
  25. package/lib/module/components/customDropDown/DropDownListItem.js.map +1 -0
  26. package/lib/module/components/customDropDown/DropDownListModal.js +63 -0
  27. package/lib/module/components/customDropDown/DropDownListModal.js.map +1 -0
  28. package/lib/module/components/customDropDown/index.js +143 -0
  29. package/lib/module/components/customDropDown/index.js.map +1 -0
  30. package/lib/module/components/customDropDown/styles.js +189 -0
  31. package/lib/module/components/customDropDown/styles.js.map +1 -0
  32. package/lib/module/components/customDropDown/types.js +4 -0
  33. package/lib/module/components/customDropDown/types.js.map +1 -0
  34. package/lib/module/components/customDropDown/utils.js +17 -0
  35. package/lib/module/components/customDropDown/utils.js.map +1 -0
  36. package/lib/module/components/customList/ListEmpty.js +33 -0
  37. package/lib/module/components/customList/ListEmpty.js.map +1 -0
  38. package/lib/module/components/customList/ListFooterLoader.js +14 -0
  39. package/lib/module/components/customList/ListFooterLoader.js.map +1 -0
  40. package/lib/module/components/customList/defaultKeyExtractor.js +9 -0
  41. package/lib/module/components/customList/defaultKeyExtractor.js.map +1 -0
  42. package/lib/module/components/customList/getFlashList.js +19 -0
  43. package/lib/module/components/customList/getFlashList.js.map +1 -0
  44. package/lib/module/components/customList/index.js +117 -0
  45. package/lib/module/components/customList/index.js.map +1 -0
  46. package/lib/module/components/customList/styles.js +45 -0
  47. package/lib/module/components/customList/styles.js.map +1 -0
  48. package/lib/module/components/customList/types.js +4 -0
  49. package/lib/module/components/customList/types.js.map +1 -0
  50. package/lib/module/components/customModal/ModalFooter.js +44 -0
  51. package/lib/module/components/customModal/ModalFooter.js.map +1 -0
  52. package/lib/module/components/customModal/index.js +132 -0
  53. package/lib/module/components/customModal/index.js.map +1 -0
  54. package/lib/module/components/customModal/styles.js +123 -0
  55. package/lib/module/components/customModal/styles.js.map +1 -0
  56. package/lib/module/components/customModal/types.js +4 -0
  57. package/lib/module/components/customModal/types.js.map +1 -0
  58. package/lib/module/components/customModal/useCustomModal.js +23 -0
  59. package/lib/module/components/customModal/useCustomModal.js.map +1 -0
  60. package/lib/module/components/customNumberPad/NumberPadKey.js +39 -0
  61. package/lib/module/components/customNumberPad/NumberPadKey.js.map +1 -0
  62. package/lib/module/components/customNumberPad/index.js +156 -0
  63. package/lib/module/components/customNumberPad/index.js.map +1 -0
  64. package/lib/module/components/customNumberPad/styles.js +131 -0
  65. package/lib/module/components/customNumberPad/styles.js.map +1 -0
  66. package/lib/module/components/customNumberPad/types.js +4 -0
  67. package/lib/module/components/customNumberPad/types.js.map +1 -0
  68. package/lib/module/components/customNumberPad/useNumberPadInput.js +44 -0
  69. package/lib/module/components/customNumberPad/useNumberPadInput.js.map +1 -0
  70. package/lib/module/components/customNumberPad/utils.js +38 -0
  71. package/lib/module/components/customNumberPad/utils.js.map +1 -0
  72. package/lib/module/components/customSlideTabs/AnimatedTabIndicator.js +66 -0
  73. package/lib/module/components/customSlideTabs/AnimatedTabIndicator.js.map +1 -0
  74. package/lib/module/components/customSlideTabs/TabBarItem.js +61 -0
  75. package/lib/module/components/customSlideTabs/TabBarItem.js.map +1 -0
  76. package/lib/module/components/customSlideTabs/TabScene.js +88 -0
  77. package/lib/module/components/customSlideTabs/TabScene.js.map +1 -0
  78. package/lib/module/components/customSlideTabs/index.js +277 -0
  79. package/lib/module/components/customSlideTabs/index.js.map +1 -0
  80. package/lib/module/components/customSlideTabs/styles.js +132 -0
  81. package/lib/module/components/customSlideTabs/styles.js.map +1 -0
  82. package/lib/module/components/customSlideTabs/tabBarScroll.js +65 -0
  83. package/lib/module/components/customSlideTabs/tabBarScroll.js.map +1 -0
  84. package/lib/module/components/customSlideTabs/types.js +4 -0
  85. package/lib/module/components/customSlideTabs/types.js.map +1 -0
  86. package/lib/module/components/loading/index.js +34 -0
  87. package/lib/module/components/loading/index.js.map +1 -0
  88. package/lib/module/customFunctions/array.js +61 -0
  89. package/lib/module/customFunctions/array.js.map +1 -0
  90. package/lib/module/customFunctions/async.js +62 -0
  91. package/lib/module/customFunctions/async.js.map +1 -0
  92. package/lib/module/customFunctions/date.js +109 -0
  93. package/lib/module/customFunctions/date.js.map +1 -0
  94. package/lib/module/customFunctions/general.js +29 -0
  95. package/lib/module/customFunctions/general.js.map +1 -0
  96. package/lib/module/customFunctions/id.js +20 -0
  97. package/lib/module/customFunctions/id.js.map +1 -0
  98. package/lib/module/customFunctions/index.js +29 -0
  99. package/lib/module/customFunctions/index.js.map +1 -0
  100. package/lib/module/customFunctions/number.js +94 -0
  101. package/lib/module/customFunctions/number.js.map +1 -0
  102. package/lib/module/customFunctions/object.js +39 -0
  103. package/lib/module/customFunctions/object.js.map +1 -0
  104. package/lib/module/customFunctions/string.js +63 -0
  105. package/lib/module/customFunctions/string.js.map +1 -0
  106. package/lib/module/customFunctions/types.js +2 -0
  107. package/lib/module/customFunctions/types.js.map +1 -0
  108. package/lib/module/customFunctions/validation.js +34 -0
  109. package/lib/module/customFunctions/validation.js.map +1 -0
  110. package/lib/module/customHooks/errors.js +61 -0
  111. package/lib/module/customHooks/errors.js.map +1 -0
  112. package/lib/module/customHooks/fetchJson.js +36 -0
  113. package/lib/module/customHooks/fetchJson.js.map +1 -0
  114. package/lib/module/customHooks/index.js +10 -0
  115. package/lib/module/customHooks/index.js.map +1 -0
  116. package/lib/module/customHooks/internal.js +49 -0
  117. package/lib/module/customHooks/internal.js.map +1 -0
  118. package/lib/module/customHooks/types.js +2 -0
  119. package/lib/module/customHooks/types.js.map +1 -0
  120. package/lib/module/customHooks/useApi.js +91 -0
  121. package/lib/module/customHooks/useApi.js.map +1 -0
  122. package/lib/module/customHooks/useLazyApi.js +80 -0
  123. package/lib/module/customHooks/useLazyApi.js.map +1 -0
  124. package/lib/module/customHooks/useMutation.js +69 -0
  125. package/lib/module/customHooks/useMutation.js.map +1 -0
  126. package/lib/module/customHooks/usePaginatedApi.js +127 -0
  127. package/lib/module/customHooks/usePaginatedApi.js.map +1 -0
  128. package/lib/module/customHooks/usePollingApi.js +37 -0
  129. package/lib/module/customHooks/usePollingApi.js.map +1 -0
  130. package/lib/module/index.js +13 -0
  131. package/lib/module/index.js.map +1 -0
  132. package/lib/module/multiply.js +6 -0
  133. package/lib/module/multiply.js.map +1 -0
  134. package/lib/module/package.json +1 -0
  135. package/lib/typescript/package.json +1 -0
  136. package/lib/typescript/src/components/CustomCheckbox/index.d.ts +5 -0
  137. package/lib/typescript/src/components/CustomCheckbox/index.d.ts.map +1 -0
  138. package/lib/typescript/src/components/CustomCheckbox/styles.d.ts +67 -0
  139. package/lib/typescript/src/components/CustomCheckbox/styles.d.ts.map +1 -0
  140. package/lib/typescript/src/components/CustomCheckbox/types.d.ts +28 -0
  141. package/lib/typescript/src/components/CustomCheckbox/types.d.ts.map +1 -0
  142. package/lib/typescript/src/components/closeButton/index.d.ts +4 -0
  143. package/lib/typescript/src/components/closeButton/index.d.ts.map +1 -0
  144. package/lib/typescript/src/components/closeButton/types.d.ts +8 -0
  145. package/lib/typescript/src/components/closeButton/types.d.ts.map +1 -0
  146. package/lib/typescript/src/components/customButton/index.d.ts +5 -0
  147. package/lib/typescript/src/components/customButton/index.d.ts.map +1 -0
  148. package/lib/typescript/src/components/customButton/styles.d.ts +231 -0
  149. package/lib/typescript/src/components/customButton/styles.d.ts.map +1 -0
  150. package/lib/typescript/src/components/customButton/types.d.ts +46 -0
  151. package/lib/typescript/src/components/customButton/types.d.ts.map +1 -0
  152. package/lib/typescript/src/components/customDropDown/DropDownBottomSheet.d.ts +18 -0
  153. package/lib/typescript/src/components/customDropDown/DropDownBottomSheet.d.ts.map +1 -0
  154. package/lib/typescript/src/components/customDropDown/DropDownList.d.ts +17 -0
  155. package/lib/typescript/src/components/customDropDown/DropDownList.d.ts.map +1 -0
  156. package/lib/typescript/src/components/customDropDown/DropDownListItem.d.ts +15 -0
  157. package/lib/typescript/src/components/customDropDown/DropDownListItem.d.ts.map +1 -0
  158. package/lib/typescript/src/components/customDropDown/DropDownListModal.d.ts +19 -0
  159. package/lib/typescript/src/components/customDropDown/DropDownListModal.d.ts.map +1 -0
  160. package/lib/typescript/src/components/customDropDown/index.d.ts +5 -0
  161. package/lib/typescript/src/components/customDropDown/index.d.ts.map +1 -0
  162. package/lib/typescript/src/components/customDropDown/styles.d.ts +190 -0
  163. package/lib/typescript/src/components/customDropDown/styles.d.ts.map +1 -0
  164. package/lib/typescript/src/components/customDropDown/types.d.ts +37 -0
  165. package/lib/typescript/src/components/customDropDown/types.d.ts.map +1 -0
  166. package/lib/typescript/src/components/customDropDown/utils.d.ts +4 -0
  167. package/lib/typescript/src/components/customDropDown/utils.d.ts.map +1 -0
  168. package/lib/typescript/src/components/customList/ListEmpty.d.ts +10 -0
  169. package/lib/typescript/src/components/customList/ListEmpty.d.ts.map +1 -0
  170. package/lib/typescript/src/components/customList/ListFooterLoader.d.ts +3 -0
  171. package/lib/typescript/src/components/customList/ListFooterLoader.d.ts.map +1 -0
  172. package/lib/typescript/src/components/customList/defaultKeyExtractor.d.ts +2 -0
  173. package/lib/typescript/src/components/customList/defaultKeyExtractor.d.ts.map +1 -0
  174. package/lib/typescript/src/components/customList/getFlashList.d.ts +6 -0
  175. package/lib/typescript/src/components/customList/getFlashList.d.ts.map +1 -0
  176. package/lib/typescript/src/components/customList/index.d.ts +11 -0
  177. package/lib/typescript/src/components/customList/index.d.ts.map +1 -0
  178. package/lib/typescript/src/components/customList/styles.d.ts +42 -0
  179. package/lib/typescript/src/components/customList/styles.d.ts.map +1 -0
  180. package/lib/typescript/src/components/customList/types.d.ts +33 -0
  181. package/lib/typescript/src/components/customList/types.d.ts.map +1 -0
  182. package/lib/typescript/src/components/customModal/ModalFooter.d.ts +12 -0
  183. package/lib/typescript/src/components/customModal/ModalFooter.d.ts.map +1 -0
  184. package/lib/typescript/src/components/customModal/index.d.ts +6 -0
  185. package/lib/typescript/src/components/customModal/index.d.ts.map +1 -0
  186. package/lib/typescript/src/components/customModal/styles.d.ts +83 -0
  187. package/lib/typescript/src/components/customModal/styles.d.ts.map +1 -0
  188. package/lib/typescript/src/components/customModal/types.d.ts +36 -0
  189. package/lib/typescript/src/components/customModal/types.d.ts.map +1 -0
  190. package/lib/typescript/src/components/customModal/useCustomModal.d.ts +8 -0
  191. package/lib/typescript/src/components/customModal/useCustomModal.d.ts.map +1 -0
  192. package/lib/typescript/src/components/customNumberPad/NumberPadKey.d.ts +23 -0
  193. package/lib/typescript/src/components/customNumberPad/NumberPadKey.d.ts.map +1 -0
  194. package/lib/typescript/src/components/customNumberPad/index.d.ts +7 -0
  195. package/lib/typescript/src/components/customNumberPad/index.d.ts.map +1 -0
  196. package/lib/typescript/src/components/customNumberPad/styles.d.ts +37 -0
  197. package/lib/typescript/src/components/customNumberPad/styles.d.ts.map +1 -0
  198. package/lib/typescript/src/components/customNumberPad/types.d.ts +47 -0
  199. package/lib/typescript/src/components/customNumberPad/types.d.ts.map +1 -0
  200. package/lib/typescript/src/components/customNumberPad/useNumberPadInput.d.ts +16 -0
  201. package/lib/typescript/src/components/customNumberPad/useNumberPadInput.d.ts.map +1 -0
  202. package/lib/typescript/src/components/customNumberPad/utils.d.ts +4 -0
  203. package/lib/typescript/src/components/customNumberPad/utils.d.ts.map +1 -0
  204. package/lib/typescript/src/components/customSlideTabs/AnimatedTabIndicator.d.ts +16 -0
  205. package/lib/typescript/src/components/customSlideTabs/AnimatedTabIndicator.d.ts.map +1 -0
  206. package/lib/typescript/src/components/customSlideTabs/TabBarItem.d.ts +23 -0
  207. package/lib/typescript/src/components/customSlideTabs/TabBarItem.d.ts.map +1 -0
  208. package/lib/typescript/src/components/customSlideTabs/TabScene.d.ts +21 -0
  209. package/lib/typescript/src/components/customSlideTabs/TabScene.d.ts.map +1 -0
  210. package/lib/typescript/src/components/customSlideTabs/index.d.ts +5 -0
  211. package/lib/typescript/src/components/customSlideTabs/index.d.ts.map +1 -0
  212. package/lib/typescript/src/components/customSlideTabs/styles.d.ts +130 -0
  213. package/lib/typescript/src/components/customSlideTabs/styles.d.ts.map +1 -0
  214. package/lib/typescript/src/components/customSlideTabs/tabBarScroll.d.ts +15 -0
  215. package/lib/typescript/src/components/customSlideTabs/tabBarScroll.d.ts.map +1 -0
  216. package/lib/typescript/src/components/customSlideTabs/types.d.ts +68 -0
  217. package/lib/typescript/src/components/customSlideTabs/types.d.ts.map +1 -0
  218. package/lib/typescript/src/components/loading/index.d.ts +7 -0
  219. package/lib/typescript/src/components/loading/index.d.ts.map +1 -0
  220. package/lib/typescript/src/customFunctions/array.d.ts +7 -0
  221. package/lib/typescript/src/customFunctions/array.d.ts.map +1 -0
  222. package/lib/typescript/src/customFunctions/async.d.ts +9 -0
  223. package/lib/typescript/src/customFunctions/async.d.ts.map +1 -0
  224. package/lib/typescript/src/customFunctions/date.d.ts +18 -0
  225. package/lib/typescript/src/customFunctions/date.d.ts.map +1 -0
  226. package/lib/typescript/src/customFunctions/general.d.ts +7 -0
  227. package/lib/typescript/src/customFunctions/general.d.ts.map +1 -0
  228. package/lib/typescript/src/customFunctions/id.d.ts +4 -0
  229. package/lib/typescript/src/customFunctions/id.d.ts.map +1 -0
  230. package/lib/typescript/src/customFunctions/index.d.ts +26 -0
  231. package/lib/typescript/src/customFunctions/index.d.ts.map +1 -0
  232. package/lib/typescript/src/customFunctions/number.d.ts +15 -0
  233. package/lib/typescript/src/customFunctions/number.d.ts.map +1 -0
  234. package/lib/typescript/src/customFunctions/object.d.ts +6 -0
  235. package/lib/typescript/src/customFunctions/object.d.ts.map +1 -0
  236. package/lib/typescript/src/customFunctions/string.d.ts +20 -0
  237. package/lib/typescript/src/customFunctions/string.d.ts.map +1 -0
  238. package/lib/typescript/src/customFunctions/types.d.ts +22 -0
  239. package/lib/typescript/src/customFunctions/types.d.ts.map +1 -0
  240. package/lib/typescript/src/customFunctions/validation.d.ts +11 -0
  241. package/lib/typescript/src/customFunctions/validation.d.ts.map +1 -0
  242. package/lib/typescript/src/customHooks/errors.d.ts +16 -0
  243. package/lib/typescript/src/customHooks/errors.d.ts.map +1 -0
  244. package/lib/typescript/src/customHooks/fetchJson.d.ts +5 -0
  245. package/lib/typescript/src/customHooks/fetchJson.d.ts.map +1 -0
  246. package/lib/typescript/src/customHooks/index.d.ts +9 -0
  247. package/lib/typescript/src/customHooks/index.d.ts.map +1 -0
  248. package/lib/typescript/src/customHooks/internal.d.ts +12 -0
  249. package/lib/typescript/src/customHooks/internal.d.ts.map +1 -0
  250. package/lib/typescript/src/customHooks/types.d.ts +49 -0
  251. package/lib/typescript/src/customHooks/types.d.ts.map +1 -0
  252. package/lib/typescript/src/customHooks/useApi.d.ts +13 -0
  253. package/lib/typescript/src/customHooks/useApi.d.ts.map +1 -0
  254. package/lib/typescript/src/customHooks/useLazyApi.d.ts +14 -0
  255. package/lib/typescript/src/customHooks/useLazyApi.d.ts.map +1 -0
  256. package/lib/typescript/src/customHooks/useMutation.d.ts +15 -0
  257. package/lib/typescript/src/customHooks/useMutation.d.ts.map +1 -0
  258. package/lib/typescript/src/customHooks/usePaginatedApi.d.ts +19 -0
  259. package/lib/typescript/src/customHooks/usePaginatedApi.d.ts.map +1 -0
  260. package/lib/typescript/src/customHooks/usePollingApi.d.ts +13 -0
  261. package/lib/typescript/src/customHooks/usePollingApi.d.ts.map +1 -0
  262. package/lib/typescript/src/index.d.ts +11 -0
  263. package/lib/typescript/src/index.d.ts.map +1 -0
  264. package/lib/typescript/src/multiply.d.ts +2 -0
  265. package/lib/typescript/src/multiply.d.ts.map +1 -0
  266. package/package.json +181 -0
  267. package/src/assets/images/close.png +0 -0
  268. package/src/components/CustomCheckbox/index.tsx +143 -0
  269. package/src/components/CustomCheckbox/styles.ts +146 -0
  270. package/src/components/CustomCheckbox/types.ts +33 -0
  271. package/src/components/closeButton/index.tsx +40 -0
  272. package/src/components/closeButton/types.ts +13 -0
  273. package/src/components/customButton/index.tsx +288 -0
  274. package/src/components/customButton/styles.ts +247 -0
  275. package/src/components/customButton/types.ts +71 -0
  276. package/src/components/customDropDown/DropDownBottomSheet.tsx +70 -0
  277. package/src/components/customDropDown/DropDownList.tsx +88 -0
  278. package/src/components/customDropDown/DropDownListItem.tsx +74 -0
  279. package/src/components/customDropDown/DropDownListModal.tsx +86 -0
  280. package/src/components/customDropDown/index.tsx +213 -0
  281. package/src/components/customDropDown/styles.ts +184 -0
  282. package/src/components/customDropDown/types.ts +48 -0
  283. package/src/components/customDropDown/utils.ts +24 -0
  284. package/src/components/customList/ListEmpty.tsx +36 -0
  285. package/src/components/customList/ListFooterLoader.tsx +11 -0
  286. package/src/components/customList/defaultKeyExtractor.ts +7 -0
  287. package/src/components/customList/getFlashList.ts +26 -0
  288. package/src/components/customList/index.tsx +142 -0
  289. package/src/components/customList/styles.ts +43 -0
  290. package/src/components/customList/types.ts +60 -0
  291. package/src/components/customModal/ModalFooter.tsx +57 -0
  292. package/src/components/customModal/index.tsx +166 -0
  293. package/src/components/customModal/styles.ts +131 -0
  294. package/src/components/customModal/types.ts +48 -0
  295. package/src/components/customModal/useCustomModal.ts +25 -0
  296. package/src/components/customNumberPad/NumberPadKey.tsx +81 -0
  297. package/src/components/customNumberPad/index.tsx +204 -0
  298. package/src/components/customNumberPad/styles.ts +146 -0
  299. package/src/components/customNumberPad/types.ts +53 -0
  300. package/src/components/customNumberPad/useNumberPadInput.ts +56 -0
  301. package/src/components/customNumberPad/utils.ts +54 -0
  302. package/src/components/customSlideTabs/AnimatedTabIndicator.tsx +103 -0
  303. package/src/components/customSlideTabs/TabBarItem.tsx +118 -0
  304. package/src/components/customSlideTabs/TabScene.tsx +136 -0
  305. package/src/components/customSlideTabs/index.tsx +385 -0
  306. package/src/components/customSlideTabs/styles.ts +136 -0
  307. package/src/components/customSlideTabs/tabBarScroll.ts +92 -0
  308. package/src/components/customSlideTabs/types.ts +87 -0
  309. package/src/components/loading/index.tsx +34 -0
  310. package/src/customFunctions/array.ts +83 -0
  311. package/src/customFunctions/async.ts +85 -0
  312. package/src/customFunctions/date.ts +158 -0
  313. package/src/customFunctions/general.ts +35 -0
  314. package/src/customFunctions/id.ts +25 -0
  315. package/src/customFunctions/index.ts +91 -0
  316. package/src/customFunctions/number.ts +139 -0
  317. package/src/customFunctions/object.ts +59 -0
  318. package/src/customFunctions/string.ts +119 -0
  319. package/src/customFunctions/types.ts +25 -0
  320. package/src/customFunctions/validation.ts +49 -0
  321. package/src/customHooks/errors.ts +87 -0
  322. package/src/customHooks/fetchJson.ts +49 -0
  323. package/src/customHooks/index.ts +20 -0
  324. package/src/customHooks/internal.ts +67 -0
  325. package/src/customHooks/types.ts +71 -0
  326. package/src/customHooks/useApi.ts +107 -0
  327. package/src/customHooks/useLazyApi.ts +92 -0
  328. package/src/customHooks/useMutation.ts +97 -0
  329. package/src/customHooks/usePaginatedApi.ts +168 -0
  330. package/src/customHooks/usePollingApi.ts +48 -0
  331. package/src/index.tsx +63 -0
  332. package/src/multiply.tsx +3 -0
@@ -0,0 +1,34 @@
1
+ import { ActivityIndicator, StyleSheet, View } from 'react-native';
2
+
3
+ interface Props {
4
+ small?: boolean;
5
+ color?: string;
6
+ }
7
+
8
+ const Loader = ({ small = false, color = 'white' }: Props) => {
9
+ return (
10
+ <View style={styles.container}>
11
+ {small ? (
12
+ <ActivityIndicator color={color} size={'small'} />
13
+ ) : (
14
+ <ActivityIndicator color={color} size={'large'} />
15
+ )}
16
+ </View>
17
+ );
18
+ };
19
+
20
+ export default Loader;
21
+
22
+ const styles = StyleSheet.create({
23
+ container: {
24
+ position: 'absolute',
25
+ top: 0,
26
+ bottom: 0,
27
+ right: 0,
28
+ left: 0,
29
+ backgroundColor: '#00000061',
30
+ justifyContent: 'center',
31
+ alignItems: 'center',
32
+ zIndex: 1,
33
+ },
34
+ });
@@ -0,0 +1,83 @@
1
+ export const groupBy = <T, K extends string | number>(
2
+ items: T[],
3
+ getKey: (item: T) => K
4
+ ): Record<K, T[]> => {
5
+ return items.reduce(
6
+ (acc, item) => {
7
+ const key = getKey(item);
8
+ if (!acc[key]) {
9
+ acc[key] = [];
10
+ }
11
+ acc[key].push(item);
12
+ return acc;
13
+ },
14
+ {} as Record<K, T[]>
15
+ );
16
+ };
17
+
18
+ export const chunk = <T>(items: T[], size: number): T[][] => {
19
+ if (size <= 0) {
20
+ return [];
21
+ }
22
+
23
+ const chunks: T[][] = [];
24
+ for (let index = 0; index < items.length; index += size) {
25
+ chunks.push(items.slice(index, index + size));
26
+ }
27
+
28
+ return chunks;
29
+ };
30
+
31
+ export const sortBy = <T>(
32
+ items: T[],
33
+ selector: (item: T) => string | number,
34
+ direction: 'asc' | 'desc' = 'asc'
35
+ ): T[] => {
36
+ const multiplier = direction === 'asc' ? 1 : -1;
37
+
38
+ return [...items].sort((left, right) => {
39
+ const leftValue = selector(left);
40
+ const rightValue = selector(right);
41
+
42
+ if (leftValue < rightValue) {
43
+ return -1 * multiplier;
44
+ }
45
+
46
+ if (leftValue > rightValue) {
47
+ return 1 * multiplier;
48
+ }
49
+
50
+ return 0;
51
+ });
52
+ };
53
+
54
+ export const uniqueBy = <T, K>(items: T[], selector: (item: T) => K): T[] => {
55
+ const seen = new Set<K>();
56
+ const result: T[] = [];
57
+
58
+ for (const item of items) {
59
+ const key = selector(item);
60
+ if (!seen.has(key)) {
61
+ seen.add(key);
62
+ result.push(item);
63
+ }
64
+ }
65
+
66
+ return result;
67
+ };
68
+
69
+ export const flatten = <T>(items: Array<T | T[]>): T[] => items.flat() as T[];
70
+
71
+ export const shuffle = <T>(items: T[]): T[] => {
72
+ const copy = [...items];
73
+
74
+ for (let index = copy.length - 1; index > 0; index -= 1) {
75
+ const randomIndex = Math.floor(Math.random() * (index + 1));
76
+ const current = copy[index] as T;
77
+ const swap = copy[randomIndex] as T;
78
+ copy[index] = swap;
79
+ copy[randomIndex] = current;
80
+ }
81
+
82
+ return copy;
83
+ };
@@ -0,0 +1,85 @@
1
+ export const sleep = (ms: number): Promise<void> =>
2
+ new Promise((resolve) => {
3
+ setTimeout(resolve, ms);
4
+ });
5
+
6
+ export const debounce = <T extends (...args: never[]) => void>(
7
+ fn: T,
8
+ delayMs: number
9
+ ) => {
10
+ let timeoutId: ReturnType<typeof setTimeout> | undefined;
11
+
12
+ const debounced = (...args: Parameters<T>) => {
13
+ if (timeoutId) {
14
+ clearTimeout(timeoutId);
15
+ }
16
+
17
+ timeoutId = setTimeout(() => {
18
+ fn(...args);
19
+ }, delayMs);
20
+ };
21
+
22
+ debounced.cancel = () => {
23
+ if (timeoutId) {
24
+ clearTimeout(timeoutId);
25
+ timeoutId = undefined;
26
+ }
27
+ };
28
+
29
+ return debounced;
30
+ };
31
+
32
+ export const throttle = <T extends (...args: never[]) => void>(
33
+ fn: T,
34
+ intervalMs: number
35
+ ) => {
36
+ let lastCall = 0;
37
+ let timeoutId: ReturnType<typeof setTimeout> | undefined;
38
+
39
+ return (...args: Parameters<T>) => {
40
+ const now = Date.now();
41
+ const remaining = intervalMs - (now - lastCall);
42
+
43
+ if (remaining <= 0) {
44
+ if (timeoutId) {
45
+ clearTimeout(timeoutId);
46
+ timeoutId = undefined;
47
+ }
48
+
49
+ lastCall = now;
50
+ fn(...args);
51
+ return;
52
+ }
53
+
54
+ if (!timeoutId) {
55
+ timeoutId = setTimeout(() => {
56
+ lastCall = Date.now();
57
+ timeoutId = undefined;
58
+ fn(...args);
59
+ }, remaining);
60
+ }
61
+ };
62
+ };
63
+
64
+ export const tryParseJson = <T = unknown>(
65
+ value: string,
66
+ fallback: T | null = null
67
+ ): T | null => {
68
+ try {
69
+ return JSON.parse(value) as T;
70
+ } catch {
71
+ return fallback;
72
+ }
73
+ };
74
+
75
+ export const safeStringify = (
76
+ value: unknown,
77
+ space = 2,
78
+ fallback = ''
79
+ ): string => {
80
+ try {
81
+ return JSON.stringify(value, null, space);
82
+ } catch {
83
+ return fallback;
84
+ }
85
+ };
@@ -0,0 +1,158 @@
1
+ import type { LocalizedDateTimeOptions } from './types';
2
+
3
+ export const formatDateYYYYMMDD = (date: Date = new Date()): string => {
4
+ const year = date.getFullYear();
5
+ const month = String(date.getMonth() + 1).padStart(2, '0');
6
+ const day = String(date.getDate()).padStart(2, '0');
7
+
8
+ return `${year}-${month}-${day}`;
9
+ };
10
+
11
+ export const getIsoTimeWithoutMilliseconds = (
12
+ date: Date = new Date()
13
+ ): string => `${date.toISOString().split('.')[0]}Z`;
14
+
15
+ export const isOlderThanHours = (
16
+ timestamp: string | number,
17
+ hours = 24
18
+ ): boolean => {
19
+ const diffMs = Math.abs(Date.now() - Number(timestamp));
20
+ const diffHours = diffMs / (1000 * 60 * 60);
21
+
22
+ return diffHours >= hours;
23
+ };
24
+
25
+ export const formatTimestampTo12Hour = (
26
+ timestampMs: string | number
27
+ ): string => {
28
+ const date = new Date(Number(timestampMs));
29
+ let hours = date.getHours();
30
+ const minutes = String(date.getMinutes()).padStart(2, '0');
31
+ const seconds = String(date.getSeconds()).padStart(2, '0');
32
+ const meridiem = hours >= 12 ? 'pm' : 'am';
33
+
34
+ hours %= 12;
35
+ if (hours === 0) {
36
+ hours = 12;
37
+ }
38
+
39
+ return `${hours}:${minutes}:${seconds} ${meridiem}`;
40
+ };
41
+
42
+ export const formatDateTimeLocalized = (
43
+ date: Date = new Date(),
44
+ options: LocalizedDateTimeOptions = {}
45
+ ) => {
46
+ const englishLocale = options.englishLocale ?? 'en-GB';
47
+ const frenchLocale = options.frenchLocale ?? 'fr-FR';
48
+
49
+ const englishDate = new Intl.DateTimeFormat(englishLocale, {
50
+ day: 'numeric',
51
+ month: 'short',
52
+ year: 'numeric',
53
+ hour: 'numeric',
54
+ minute: '2-digit',
55
+ hour12: true,
56
+ }).format(date);
57
+
58
+ const frenchDate = new Intl.DateTimeFormat(frenchLocale, {
59
+ day: 'numeric',
60
+ month: 'long',
61
+ year: 'numeric',
62
+ hour: 'numeric',
63
+ minute: '2-digit',
64
+ hour12: false,
65
+ }).format(date);
66
+
67
+ return { englishDate, frenchDate };
68
+ };
69
+
70
+ export const parseCompactDateTime = (dateString: string): string => {
71
+ const year = dateString.slice(0, 4);
72
+ const month = dateString.slice(4, 6);
73
+ const day = dateString.slice(6, 8);
74
+ const hour = dateString.slice(8, 10);
75
+ const minute = dateString.slice(10, 12);
76
+ const second = dateString.slice(12, 14);
77
+
78
+ return `${year}-${month}-${day}T${hour}:${minute}:${second}`;
79
+ };
80
+
81
+ export const generateCompactTimestampId = (hoursOffset = 0): string => {
82
+ const date = new Date();
83
+
84
+ if (hoursOffset !== 0) {
85
+ date.setHours(date.getHours() + hoursOffset);
86
+ }
87
+
88
+ return date.toISOString().replace(/[-:]/g, '').replace('T', '').slice(0, 15);
89
+ };
90
+
91
+ export const addDays = (date: Date, days: number): Date => {
92
+ const next = new Date(date);
93
+ next.setDate(next.getDate() + days);
94
+ return next;
95
+ };
96
+
97
+ export const differenceInDays = (from: Date, to: Date): number => {
98
+ const msPerDay = 1000 * 60 * 60 * 24;
99
+ const start = new Date(from.getFullYear(), from.getMonth(), from.getDate());
100
+ const end = new Date(to.getFullYear(), to.getMonth(), to.getDate());
101
+
102
+ return Math.round((end.getTime() - start.getTime()) / msPerDay);
103
+ };
104
+
105
+ export const differenceInMinutes = (
106
+ from: Date | number,
107
+ to: Date | number
108
+ ): number => {
109
+ const start = new Date(from).getTime();
110
+ const end = new Date(to).getTime();
111
+
112
+ return Math.round((end - start) / (1000 * 60));
113
+ };
114
+
115
+ export const isSameDay = (
116
+ left: Date | number,
117
+ right: Date | number
118
+ ): boolean => {
119
+ const a = new Date(left);
120
+ const b = new Date(right);
121
+
122
+ return (
123
+ a.getFullYear() === b.getFullYear() &&
124
+ a.getMonth() === b.getMonth() &&
125
+ a.getDate() === b.getDate()
126
+ );
127
+ };
128
+
129
+ export const isToday = (date: Date | number): boolean =>
130
+ isSameDay(date, new Date());
131
+
132
+ export const formatRelativeTime = (
133
+ date: Date | number,
134
+ now: Date | number = Date.now()
135
+ ): string => {
136
+ const diffMinutes = differenceInMinutes(date, now);
137
+ const absMinutes = Math.abs(diffMinutes);
138
+ const isPast = diffMinutes > 0;
139
+
140
+ if (absMinutes < 1) {
141
+ return 'just now';
142
+ }
143
+
144
+ if (absMinutes < 60) {
145
+ const label = `${absMinutes} min`;
146
+ return isPast ? `${label} ago` : `in ${label}`;
147
+ }
148
+
149
+ const absHours = Math.round(absMinutes / 60);
150
+ if (absHours < 24) {
151
+ const label = `${absHours} hour${absHours === 1 ? '' : 's'}`;
152
+ return isPast ? `${label} ago` : `in ${label}`;
153
+ }
154
+
155
+ const absDays = Math.round(absHours / 24);
156
+ const label = `${absDays} day${absDays === 1 ? '' : 's'}`;
157
+ return isPast ? `${label} ago` : `in ${label}`;
158
+ };
@@ -0,0 +1,35 @@
1
+ import type { LoggerPayload } from './types';
2
+
3
+ export const logger = ({ msg = '', data }: LoggerPayload) => {
4
+ console.log(`------------------------${msg}------------------------`);
5
+ console.log(data);
6
+ console.log('------------------------------------------------------');
7
+ };
8
+
9
+ export const isNullish = (value: unknown): value is null | undefined =>
10
+ value === null || value === undefined;
11
+
12
+ export const isEmpty = (value: unknown): boolean => {
13
+ if (isNullish(value)) {
14
+ return true;
15
+ }
16
+
17
+ if (typeof value === 'string') {
18
+ return value.trim().length === 0;
19
+ }
20
+
21
+ if (Array.isArray(value)) {
22
+ return value.length === 0;
23
+ }
24
+
25
+ if (typeof value === 'object') {
26
+ return Object.keys(value).length === 0;
27
+ }
28
+
29
+ return false;
30
+ };
31
+
32
+ export const isDefined = <T>(value: T | null | undefined): value is T =>
33
+ value !== null && value !== undefined;
34
+
35
+ export const noop = () => {};
@@ -0,0 +1,25 @@
1
+ const ALPHANUMERIC_CHARS = 'abcdefghijklmnopqrstuvwxyz0123456789';
2
+
3
+ export const generateRandomAlphanumeric = (length = 10): string => {
4
+ let id = '';
5
+
6
+ for (let i = 0; i < length; i += 1) {
7
+ id += ALPHANUMERIC_CHARS.charAt(
8
+ Math.floor(Math.random() * ALPHANUMERIC_CHARS.length)
9
+ );
10
+ }
11
+
12
+ return id;
13
+ };
14
+
15
+ export const generateSessionId = (randomLength = 29): string => {
16
+ const prefix = Date.now();
17
+ return `${prefix}_${generateRandomAlphanumeric(randomLength)}`;
18
+ };
19
+
20
+ export const generateUuid = (): string =>
21
+ 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, (char) => {
22
+ const random = Math.floor(Math.random() * 16);
23
+ const value = char === 'x' ? random : (random & 0x3) | 0x8;
24
+ return value.toString(16);
25
+ });
@@ -0,0 +1,91 @@
1
+ export { chunk, flatten, groupBy, shuffle, sortBy, uniqueBy } from './array';
2
+ export {
3
+ debounce,
4
+ safeStringify,
5
+ sleep,
6
+ throttle,
7
+ tryParseJson,
8
+ } from './async';
9
+ export {
10
+ addDays,
11
+ differenceInDays,
12
+ differenceInMinutes,
13
+ formatDateYYYYMMDD,
14
+ formatDateTimeLocalized,
15
+ formatRelativeTime,
16
+ formatTimestampTo12Hour,
17
+ generateCompactTimestampId,
18
+ getIsoTimeWithoutMilliseconds,
19
+ isOlderThanHours,
20
+ isSameDay,
21
+ isToday,
22
+ parseCompactDateTime,
23
+ } from './date';
24
+ export { isDefined, isEmpty, isNullish, logger, noop } from './general';
25
+ export {
26
+ generateRandomAlphanumeric,
27
+ generateSessionId,
28
+ generateUuid,
29
+ } from './id';
30
+ export {
31
+ average,
32
+ clamp,
33
+ formatBytes,
34
+ formatCurrency,
35
+ formatDiscountAmount,
36
+ formatNumberWithCommas,
37
+ formatPercentage,
38
+ generateRandomNumberString,
39
+ parseNumberSafe,
40
+ percentage,
41
+ randomInt,
42
+ roundToDecimals,
43
+ sum,
44
+ } from './number';
45
+ export { deepClone, getNestedValue, isPlainObject, omit, pick } from './object';
46
+ export {
47
+ camelToTitle,
48
+ capitalizeFirst,
49
+ capitalizeWords,
50
+ findItemByProperty,
51
+ getLocalizedSplitText,
52
+ initialsFromName,
53
+ maskString,
54
+ normalizeWhitespace,
55
+ removeDuplicateStrings,
56
+ removeDuplicates,
57
+ slugify,
58
+ truncate,
59
+ } from './string';
60
+ export type {
61
+ CurrencyLocale,
62
+ FormatCurrencyOptions,
63
+ FormatNumberOptions,
64
+ LocalizedDateTimeOptions,
65
+ LoggerPayload,
66
+ } from './types';
67
+ export {
68
+ encodePlusInEmail,
69
+ isNumeric,
70
+ isStrongPassword,
71
+ isValidEmail,
72
+ isValidPhone,
73
+ isValidUrl,
74
+ } from './validation';
75
+
76
+ // Backward-friendly aliases mapped from the original app helpers
77
+ export { isOlderThanHours as isUpdateAppSession } from './date';
78
+ export { capitalizeFirst as getFirstCap } from './string';
79
+ export { formatCurrency as getFrAmount } from './number';
80
+ export { formatDateYYYYMMDD as getFormattedDate } from './date';
81
+ export { getIsoTimeWithoutMilliseconds as getCurrentTime } from './date';
82
+ export { generateCompactTimestampId as getUniqueId } from './date';
83
+ export { formatTimestampTo12Hour as getLastScannedTime } from './date';
84
+ export { formatDateTimeLocalized as getPrintDate } from './date';
85
+ export { parseCompactDateTime as formatToEST } from './date';
86
+ export { generateRandomAlphanumeric as paymentServiceId } from './id';
87
+ export { generateSessionId as generateAppSessionId } from './id';
88
+ export { generateSessionId as generateUserSessionId } from './id';
89
+ export { generateUuid as generateCartSessionId } from './id';
90
+ export { findItemByProperty as getCurrentScreen } from './string';
91
+ export { getLocalizedSplitText as getTextByLanguage } from './string';
@@ -0,0 +1,139 @@
1
+ import type { FormatCurrencyOptions, FormatNumberOptions } from './types';
2
+
3
+ const toSafeNumber = (value: number | string | null | undefined): number => {
4
+ const parsed = Number(value);
5
+ return Number.isNaN(parsed) ? 0 : parsed;
6
+ };
7
+
8
+ export const parseNumberSafe = toSafeNumber;
9
+
10
+ export const formatNumberWithCommas = (
11
+ value: number | string | null | undefined,
12
+ options: FormatNumberOptions = {}
13
+ ): string => {
14
+ const {
15
+ locale = 'en-US',
16
+ minimumFractionDigits = 0,
17
+ maximumFractionDigits = 2,
18
+ } = options;
19
+
20
+ return toSafeNumber(value).toLocaleString(locale, {
21
+ minimumFractionDigits,
22
+ maximumFractionDigits,
23
+ });
24
+ };
25
+
26
+ export const formatCurrency = (
27
+ amount: number | string | null | undefined,
28
+ options: FormatCurrencyOptions = {}
29
+ ): string => {
30
+ const {
31
+ locale = 'en-US',
32
+ currency = 'USD',
33
+ isDiscount = false,
34
+ minimumFractionDigits = 2,
35
+ maximumFractionDigits = 2,
36
+ } = options;
37
+
38
+ const safeAmount = toSafeNumber(amount);
39
+
40
+ if (locale.startsWith('fr')) {
41
+ const formatted = `${safeAmount
42
+ .toFixed(maximumFractionDigits)
43
+ .replace('.', ',')} $`;
44
+ return isDiscount ? `-${formatted}` : formatted;
45
+ }
46
+
47
+ const formatted = new Intl.NumberFormat(locale, {
48
+ style: 'currency',
49
+ currency,
50
+ minimumFractionDigits,
51
+ maximumFractionDigits,
52
+ }).format(safeAmount);
53
+
54
+ return isDiscount ? `-${formatted}` : formatted;
55
+ };
56
+
57
+ export const formatDiscountAmount = (
58
+ discount: number | string | undefined,
59
+ options: FormatCurrencyOptions = {}
60
+ ): string | number => {
61
+ if (discount === undefined || discount === null || discount === '') {
62
+ return 0;
63
+ }
64
+
65
+ const raw = discount.toString().replace('-', '');
66
+ return formatCurrency(raw, { ...options, isDiscount: true });
67
+ };
68
+
69
+ export const generateRandomNumberString = (length: number): string => {
70
+ let result = '';
71
+ const digits = '0123456789';
72
+
73
+ for (let i = 0; i < length; i += 1) {
74
+ result += digits.charAt(Math.floor(Math.random() * digits.length));
75
+ }
76
+
77
+ return result;
78
+ };
79
+
80
+ export const roundToDecimals = (
81
+ value: number | string,
82
+ decimals = 2
83
+ ): number => {
84
+ const factor = 10 ** decimals;
85
+ return Math.round(toSafeNumber(value) * factor) / factor;
86
+ };
87
+
88
+ export const clamp = (value: number, min: number, max: number): number =>
89
+ Math.min(Math.max(value, min), max);
90
+
91
+ export const formatPercentage = (
92
+ value: number | string,
93
+ decimals = 0,
94
+ locale = 'en-US'
95
+ ): string =>
96
+ `${toSafeNumber(value).toLocaleString(locale, {
97
+ minimumFractionDigits: decimals,
98
+ maximumFractionDigits: decimals,
99
+ })}%`;
100
+
101
+ export const percentage = (part: number, total: number): number => {
102
+ if (!total) {
103
+ return 0;
104
+ }
105
+
106
+ return roundToDecimals((part / total) * 100, 2);
107
+ };
108
+
109
+ export const formatBytes = (bytes: number, decimals = 2): string => {
110
+ if (bytes === 0) {
111
+ return '0 B';
112
+ }
113
+
114
+ const units = ['B', 'KB', 'MB', 'GB', 'TB'];
115
+ const index = Math.min(
116
+ Math.floor(Math.log(bytes) / Math.log(1024)),
117
+ units.length - 1
118
+ );
119
+ const value = bytes / 1024 ** index;
120
+
121
+ return `${roundToDecimals(value, decimals)} ${units[index]}`;
122
+ };
123
+
124
+ export const randomInt = (min: number, max: number): number => {
125
+ const lower = Math.ceil(min);
126
+ const upper = Math.floor(max);
127
+ return Math.floor(Math.random() * (upper - lower + 1)) + lower;
128
+ };
129
+
130
+ export const sum = (values: Array<number | string>): number =>
131
+ values.reduce<number>((total, value) => total + toSafeNumber(value), 0);
132
+
133
+ export const average = (values: Array<number | string>): number => {
134
+ if (!values.length) {
135
+ return 0;
136
+ }
137
+
138
+ return roundToDecimals(sum(values) / values.length, 2);
139
+ };
@@ -0,0 +1,59 @@
1
+ export const pick = <T extends object, K extends keyof T>(
2
+ object: T,
3
+ keys: K[]
4
+ ): Pick<T, K> => {
5
+ const result = {} as Pick<T, K>;
6
+
7
+ for (const key of keys) {
8
+ if (key in object) {
9
+ result[key] = object[key];
10
+ }
11
+ }
12
+
13
+ return result;
14
+ };
15
+
16
+ export const omit = <T extends object, K extends keyof T>(
17
+ object: T,
18
+ keys: K[]
19
+ ): Omit<T, K> => {
20
+ const result = { ...object };
21
+
22
+ for (const key of keys) {
23
+ delete result[key];
24
+ }
25
+
26
+ return result;
27
+ };
28
+
29
+ export const deepClone = <T>(value: T): T => {
30
+ if (value === null || typeof value !== 'object') {
31
+ return value;
32
+ }
33
+
34
+ return JSON.parse(JSON.stringify(value)) as T;
35
+ };
36
+
37
+ export const isPlainObject = (
38
+ value: unknown
39
+ ): value is Record<string, unknown> =>
40
+ typeof value === 'object' && value !== null && !Array.isArray(value);
41
+
42
+ export const getNestedValue = <T = unknown>(
43
+ object: Record<string, unknown>,
44
+ path: string,
45
+ fallback?: T
46
+ ): T | undefined => {
47
+ const keys = path.split('.');
48
+ let current: unknown = object;
49
+
50
+ for (const key of keys) {
51
+ if (!isPlainObject(current) || !(key in current)) {
52
+ return fallback;
53
+ }
54
+
55
+ current = current[key];
56
+ }
57
+
58
+ return current as T;
59
+ };