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,48 @@
1
+ import type { ReactNode } from 'react';
2
+ import type {
3
+ ImageSourcePropType,
4
+ ModalProps,
5
+ StyleProp,
6
+ TextStyle,
7
+ ViewStyle,
8
+ } from 'react-native';
9
+
10
+ import type { ButtonVariant } from '../customButton/types';
11
+
12
+ export type ModalPresentation = 'center' | 'bottom' | 'fullscreen';
13
+
14
+ export type ModalAction = {
15
+ label: string;
16
+ onPress: () => void;
17
+ variant?: ButtonVariant;
18
+ disabled?: boolean;
19
+ isLoading?: boolean;
20
+ };
21
+
22
+ export type CustomModalProps = Pick<
23
+ ModalProps,
24
+ 'supportedOrientations' | 'statusBarTranslucent' | 'testID'
25
+ > & {
26
+ visible: boolean;
27
+ onClose: () => void;
28
+ title?: string;
29
+ description?: string;
30
+ children?: ReactNode;
31
+ presentation?: ModalPresentation;
32
+ showCloseButton?: boolean;
33
+ closeOnBackdropPress?: boolean;
34
+ animationType?: ModalProps['animationType'];
35
+ scrollable?: boolean;
36
+ containerStyle?: StyleProp<ViewStyle>;
37
+ backdropStyle?: StyleProp<ViewStyle>;
38
+ contentStyle?: StyleProp<ViewStyle>;
39
+ headerStyle?: StyleProp<ViewStyle>;
40
+ titleStyle?: StyleProp<TextStyle>;
41
+ descriptionStyle?: StyleProp<TextStyle>;
42
+ bodyStyle?: StyleProp<ViewStyle>;
43
+ footerStyle?: StyleProp<ViewStyle>;
44
+ footer?: ReactNode;
45
+ primaryAction?: ModalAction;
46
+ secondaryAction?: ModalAction;
47
+ closeImage?: ImageSourcePropType;
48
+ };
@@ -0,0 +1,25 @@
1
+ import { useCallback, useState } from 'react';
2
+
3
+ export const useCustomModal = (initialVisible = false) => {
4
+ const [visible, setVisible] = useState(initialVisible);
5
+
6
+ const open = useCallback(() => {
7
+ setVisible(true);
8
+ }, []);
9
+
10
+ const close = useCallback(() => {
11
+ setVisible(false);
12
+ }, []);
13
+
14
+ const toggle = useCallback(() => {
15
+ setVisible((current) => !current);
16
+ }, []);
17
+
18
+ return {
19
+ visible,
20
+ setVisible,
21
+ open,
22
+ close,
23
+ toggle,
24
+ };
25
+ };
@@ -0,0 +1,81 @@
1
+ import { useState } from 'react';
2
+ import {
3
+ Pressable,
4
+ Text,
5
+ type StyleProp,
6
+ type TextStyle,
7
+ type ViewStyle,
8
+ } from 'react-native';
9
+
10
+ import { styles } from './styles';
11
+ import type { NumberPadKeyConfig } from './types';
12
+
13
+ type NumberPadKeyProps = {
14
+ config: NumberPadKeyConfig;
15
+ onPress: () => void;
16
+ keyStyle?: StyleProp<ViewStyle>;
17
+ keyTextStyle?: StyleProp<TextStyle>;
18
+ theme: {
19
+ key: ViewStyle;
20
+ keyPressed: ViewStyle;
21
+ keyText: TextStyle;
22
+ keyTextMuted: TextStyle;
23
+ keyDisabled: ViewStyle;
24
+ };
25
+ sizeStyle: {
26
+ key: ViewStyle;
27
+ keyText: TextStyle;
28
+ };
29
+ disabled?: boolean;
30
+ };
31
+
32
+ const NumberPadKey = ({
33
+ config,
34
+ onPress,
35
+ keyStyle,
36
+ keyTextStyle,
37
+ theme,
38
+ sizeStyle,
39
+ disabled = false,
40
+ }: NumberPadKeyProps) => {
41
+ const [pressed, setPressed] = useState(false);
42
+ const isDisabled = disabled || config.disabled;
43
+ const isMuted = config.type === 'backspace' || config.type === 'decimal';
44
+
45
+ return (
46
+ <Pressable
47
+ accessibilityRole="keyboardkey"
48
+ accessibilityLabel={
49
+ config.accessibilityLabel ??
50
+ (typeof config.label === 'string' ? config.label : config.id)
51
+ }
52
+ accessibilityState={{ disabled: isDisabled }}
53
+ disabled={isDisabled}
54
+ onPress={onPress}
55
+ onPressIn={() => setPressed(true)}
56
+ onPressOut={() => setPressed(false)}
57
+ style={[
58
+ styles.key,
59
+ sizeStyle.key,
60
+ theme.key,
61
+ { flex: config.flex ?? 1 },
62
+ pressed && !isDisabled && theme.keyPressed,
63
+ isDisabled && theme.keyDisabled,
64
+ keyStyle,
65
+ ]}
66
+ >
67
+ <Text
68
+ style={[
69
+ styles.keyText,
70
+ sizeStyle.keyText,
71
+ isMuted ? theme.keyTextMuted : theme.keyText,
72
+ keyTextStyle,
73
+ ]}
74
+ >
75
+ {config.label}
76
+ </Text>
77
+ </Pressable>
78
+ );
79
+ };
80
+
81
+ export default NumberPadKey;
@@ -0,0 +1,204 @@
1
+ import { useCallback, useMemo } from 'react';
2
+ import { View } from 'react-native';
3
+
4
+ import NumberPadKey from './NumberPadKey';
5
+ import { sizeStyles, styles, variantTheme } from './styles';
6
+ import type { CustomNumberPadProps, NumberPadKeyConfig } from './types';
7
+ import { applyNumberPadKey, NUMBER_PAD_ROWS } from './utils';
8
+
9
+ const CustomNumberPad = ({
10
+ onKeyPress,
11
+ onBackspace,
12
+ value,
13
+ onChange,
14
+ maxLength,
15
+ allowDecimal = false,
16
+ decimalPlaces,
17
+ variant = 'default',
18
+ size = 'md',
19
+ disabled = false,
20
+ containerStyle,
21
+ rowStyle,
22
+ keyStyle,
23
+ keyTextStyle,
24
+ backspaceLabel = '⌫',
25
+ bottomLeftKey,
26
+ renderKey,
27
+ }: CustomNumberPadProps) => {
28
+ const theme = variantTheme[variant];
29
+ const sizing = sizeStyles[size];
30
+
31
+ const inputRules = useMemo(
32
+ () => ({ maxLength, allowDecimal, decimalPlaces }),
33
+ [allowDecimal, decimalPlaces, maxLength]
34
+ );
35
+
36
+ const handleKey = useCallback(
37
+ (key: string, customPress?: () => void) => {
38
+ if (disabled) {
39
+ return;
40
+ }
41
+
42
+ if (customPress) {
43
+ customPress();
44
+ return;
45
+ }
46
+
47
+ if (key === 'backspace') {
48
+ onBackspace?.();
49
+
50
+ if (onChange) {
51
+ onChange(
52
+ applyNumberPadKey(value ?? '', 'backspace', inputRules) ?? ''
53
+ );
54
+ }
55
+
56
+ onKeyPress?.('backspace');
57
+ return;
58
+ }
59
+
60
+ onKeyPress?.(key);
61
+
62
+ if (onChange) {
63
+ const next = applyNumberPadKey(value ?? '', key, inputRules);
64
+ if (next != null) {
65
+ onChange(next);
66
+ }
67
+ }
68
+ },
69
+ [disabled, inputRules, onBackspace, onChange, onKeyPress, value]
70
+ );
71
+
72
+ const digitRows: NumberPadKeyConfig[][] = useMemo(
73
+ () =>
74
+ NUMBER_PAD_ROWS.map((row) =>
75
+ row.map((digit) => ({
76
+ id: digit,
77
+ label: digit,
78
+ value: digit,
79
+ type: 'digit' as const,
80
+ accessibilityLabel: `Number ${digit}`,
81
+ }))
82
+ ),
83
+ []
84
+ );
85
+
86
+ const bottomRow = useMemo<NumberPadKeyConfig[]>(() => {
87
+ const keys: NumberPadKeyConfig[] = [];
88
+
89
+ if (bottomLeftKey) {
90
+ keys.push({
91
+ id: 'custom-bottom-left',
92
+ label: bottomLeftKey.label,
93
+ type: 'custom',
94
+ onPress: bottomLeftKey.onPress,
95
+ disabled: bottomLeftKey.disabled,
96
+ accessibilityLabel: bottomLeftKey.accessibilityLabel,
97
+ });
98
+ } else if (allowDecimal) {
99
+ keys.push({
100
+ id: 'decimal',
101
+ label: '.',
102
+ value: '.',
103
+ type: 'decimal',
104
+ accessibilityLabel: 'Decimal point',
105
+ });
106
+ } else {
107
+ keys.push({
108
+ id: 'spacer',
109
+ label: '',
110
+ type: 'custom',
111
+ flex: 1,
112
+ });
113
+ }
114
+
115
+ keys.push({
116
+ id: '0',
117
+ label: '0',
118
+ value: '0',
119
+ type: 'digit',
120
+ accessibilityLabel: 'Number 0',
121
+ });
122
+
123
+ keys.push({
124
+ id: 'backspace',
125
+ label: backspaceLabel,
126
+ value: 'backspace',
127
+ type: 'backspace',
128
+ accessibilityLabel: 'Backspace',
129
+ });
130
+
131
+ return keys;
132
+ }, [allowDecimal, backspaceLabel, bottomLeftKey]);
133
+
134
+ const rows = [...digitRows, bottomRow];
135
+
136
+ const renderPadKey = (config: NumberPadKeyConfig) => {
137
+ if (config.id === 'spacer') {
138
+ return <View key={config.id} style={styles.spacer} />;
139
+ }
140
+
141
+ const onPress = () => {
142
+ if (config.type === 'custom') {
143
+ handleKey('', config.onPress);
144
+ return;
145
+ }
146
+
147
+ handleKey(config.value ?? '');
148
+ };
149
+
150
+ if (renderKey) {
151
+ return (
152
+ <View key={config.id} style={{ flex: config.flex ?? 1 }}>
153
+ {renderKey(config, onPress)}
154
+ </View>
155
+ );
156
+ }
157
+
158
+ return (
159
+ <NumberPadKey
160
+ key={config.id}
161
+ config={config}
162
+ disabled={disabled}
163
+ keyStyle={keyStyle}
164
+ keyTextStyle={keyTextStyle}
165
+ onPress={onPress}
166
+ sizeStyle={sizing}
167
+ theme={theme}
168
+ />
169
+ );
170
+ };
171
+
172
+ return (
173
+ <View
174
+ style={[
175
+ styles.container,
176
+ theme.container,
177
+ { gap: sizing.gap },
178
+ containerStyle,
179
+ ]}
180
+ >
181
+ {rows.map((row, rowIndex) => (
182
+ <View
183
+ key={`row-${rowIndex}`}
184
+ style={[styles.row, { gap: sizing.gap }, rowStyle]}
185
+ >
186
+ {row.map(renderPadKey)}
187
+ </View>
188
+ ))}
189
+ </View>
190
+ );
191
+ };
192
+
193
+ export default CustomNumberPad;
194
+ export { applyNumberPadKey, NUMBER_PAD_ROWS } from './utils';
195
+ export { useNumberPadInput } from './useNumberPadInput';
196
+ export type {
197
+ CustomNumberPadProps,
198
+ NumberPadBottomLeftKey,
199
+ NumberPadKeyConfig,
200
+ NumberPadKeyType,
201
+ NumberPadSize,
202
+ NumberPadVariant,
203
+ UseNumberPadInputOptions,
204
+ } from './types';
@@ -0,0 +1,146 @@
1
+ import { StyleSheet, type TextStyle, type ViewStyle } from 'react-native';
2
+
3
+ import type { NumberPadSize, NumberPadVariant } from './types';
4
+
5
+ export const sizeStyles: Record<
6
+ NumberPadSize,
7
+ { key: ViewStyle; keyText: TextStyle; gap: number }
8
+ > = {
9
+ sm: {
10
+ key: {
11
+ minHeight: 44,
12
+ borderRadius: 8,
13
+ },
14
+ keyText: {
15
+ fontSize: 20,
16
+ },
17
+ gap: 8,
18
+ },
19
+ md: {
20
+ key: {
21
+ minHeight: 52,
22
+ borderRadius: 10,
23
+ },
24
+ keyText: {
25
+ fontSize: 24,
26
+ },
27
+ gap: 10,
28
+ },
29
+ lg: {
30
+ key: {
31
+ minHeight: 60,
32
+ borderRadius: 12,
33
+ },
34
+ keyText: {
35
+ fontSize: 28,
36
+ },
37
+ gap: 12,
38
+ },
39
+ };
40
+
41
+ export const variantTheme: Record<
42
+ NumberPadVariant,
43
+ {
44
+ container: ViewStyle;
45
+ key: ViewStyle;
46
+ keyPressed: ViewStyle;
47
+ keyText: TextStyle;
48
+ keyTextMuted: TextStyle;
49
+ keyDisabled: ViewStyle;
50
+ }
51
+ > = {
52
+ default: {
53
+ container: {
54
+ backgroundColor: '#F8F9FA',
55
+ },
56
+ key: {
57
+ backgroundColor: '#FFFFFF',
58
+ borderWidth: 1,
59
+ borderColor: '#E9ECEF',
60
+ },
61
+ keyPressed: {
62
+ backgroundColor: '#E9ECEF',
63
+ },
64
+ keyText: {
65
+ color: '#212529',
66
+ fontWeight: '600',
67
+ },
68
+ keyTextMuted: {
69
+ color: '#6C757D',
70
+ fontWeight: '600',
71
+ },
72
+ keyDisabled: {
73
+ opacity: 0.45,
74
+ },
75
+ },
76
+ primary: {
77
+ container: {
78
+ backgroundColor: '#E7F1FF',
79
+ },
80
+ key: {
81
+ backgroundColor: '#FFFFFF',
82
+ borderWidth: 1,
83
+ borderColor: '#B6D4FE',
84
+ },
85
+ keyPressed: {
86
+ backgroundColor: '#CFE2FF',
87
+ },
88
+ keyText: {
89
+ color: '#0D6EFD',
90
+ fontWeight: '700',
91
+ },
92
+ keyTextMuted: {
93
+ color: '#6EA8FE',
94
+ fontWeight: '700',
95
+ },
96
+ keyDisabled: {
97
+ opacity: 0.45,
98
+ },
99
+ },
100
+ dark: {
101
+ container: {
102
+ backgroundColor: '#212529',
103
+ },
104
+ key: {
105
+ backgroundColor: '#343A40',
106
+ borderWidth: 1,
107
+ borderColor: '#495057',
108
+ },
109
+ keyPressed: {
110
+ backgroundColor: '#495057',
111
+ },
112
+ keyText: {
113
+ color: '#F8F9FA',
114
+ fontWeight: '600',
115
+ },
116
+ keyTextMuted: {
117
+ color: '#ADB5BD',
118
+ fontWeight: '600',
119
+ },
120
+ keyDisabled: {
121
+ opacity: 0.45,
122
+ },
123
+ },
124
+ };
125
+
126
+ export const styles = StyleSheet.create({
127
+ container: {
128
+ padding: 12,
129
+ borderRadius: 16,
130
+ },
131
+ row: {
132
+ flexDirection: 'row',
133
+ alignItems: 'stretch',
134
+ },
135
+ key: {
136
+ flex: 1,
137
+ alignItems: 'center',
138
+ justifyContent: 'center',
139
+ },
140
+ keyText: {
141
+ textAlign: 'center',
142
+ },
143
+ spacer: {
144
+ flex: 1,
145
+ },
146
+ });
@@ -0,0 +1,53 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StyleProp, TextStyle, ViewStyle } from 'react-native';
3
+
4
+ export type NumberPadVariant = 'default' | 'primary' | 'dark';
5
+
6
+ export type NumberPadSize = 'sm' | 'md' | 'lg';
7
+
8
+ export type NumberPadKeyType = 'digit' | 'decimal' | 'backspace' | 'custom';
9
+
10
+ export type NumberPadKeyConfig = {
11
+ id: string;
12
+ label: ReactNode;
13
+ value?: string;
14
+ type: NumberPadKeyType;
15
+ flex?: number;
16
+ onPress?: () => void;
17
+ disabled?: boolean;
18
+ accessibilityLabel?: string;
19
+ };
20
+
21
+ export type NumberPadBottomLeftKey = {
22
+ label: ReactNode;
23
+ onPress: () => void;
24
+ accessibilityLabel?: string;
25
+ disabled?: boolean;
26
+ };
27
+
28
+ export type CustomNumberPadProps = {
29
+ onKeyPress?: (key: string) => void;
30
+ onBackspace?: () => void;
31
+ value?: string;
32
+ onChange?: (value: string) => void;
33
+ maxLength?: number;
34
+ allowDecimal?: boolean;
35
+ decimalPlaces?: number;
36
+ variant?: NumberPadVariant;
37
+ size?: NumberPadSize;
38
+ disabled?: boolean;
39
+ containerStyle?: StyleProp<ViewStyle>;
40
+ rowStyle?: StyleProp<ViewStyle>;
41
+ keyStyle?: StyleProp<ViewStyle>;
42
+ keyTextStyle?: StyleProp<TextStyle>;
43
+ backspaceLabel?: ReactNode;
44
+ bottomLeftKey?: NumberPadBottomLeftKey;
45
+ renderKey?: (key: NumberPadKeyConfig, onPress: () => void) => ReactNode;
46
+ };
47
+
48
+ export type UseNumberPadInputOptions = {
49
+ initialValue?: string;
50
+ maxLength?: number;
51
+ allowDecimal?: boolean;
52
+ decimalPlaces?: number;
53
+ };
@@ -0,0 +1,56 @@
1
+ import { useCallback, useMemo, useState } from 'react';
2
+
3
+ import { applyNumberPadKey } from './utils';
4
+ import type { UseNumberPadInputOptions } from './types';
5
+
6
+ export const useNumberPadInput = ({
7
+ initialValue = '',
8
+ maxLength,
9
+ allowDecimal = false,
10
+ decimalPlaces,
11
+ }: UseNumberPadInputOptions = {}) => {
12
+ const [value, setValue] = useState(initialValue);
13
+
14
+ const handleChange = useCallback((nextValue: string) => {
15
+ setValue(nextValue);
16
+ }, []);
17
+
18
+ const handleKeyPress = useCallback(
19
+ (key: string) => {
20
+ setValue((current) => {
21
+ const next = applyNumberPadKey(current, key, {
22
+ maxLength,
23
+ allowDecimal,
24
+ decimalPlaces,
25
+ });
26
+
27
+ return next ?? current;
28
+ });
29
+ },
30
+ [allowDecimal, decimalPlaces, maxLength]
31
+ );
32
+
33
+ const clear = useCallback(() => {
34
+ setValue('');
35
+ }, []);
36
+
37
+ const numberPadProps = useMemo(
38
+ () => ({
39
+ value,
40
+ onChange: handleChange,
41
+ maxLength,
42
+ allowDecimal,
43
+ decimalPlaces,
44
+ }),
45
+ [allowDecimal, decimalPlaces, handleChange, maxLength, value]
46
+ );
47
+
48
+ return {
49
+ value,
50
+ setValue,
51
+ clear,
52
+ handleChange,
53
+ handleKeyPress,
54
+ numberPadProps,
55
+ };
56
+ };
@@ -0,0 +1,54 @@
1
+ import type { UseNumberPadInputOptions } from './types';
2
+
3
+ export const NUMBER_PAD_ROWS = [
4
+ ['1', '2', '3'],
5
+ ['4', '5', '6'],
6
+ ['7', '8', '9'],
7
+ ] as const;
8
+
9
+ export const applyNumberPadKey = (
10
+ value: string,
11
+ key: string,
12
+ options: Pick<
13
+ UseNumberPadInputOptions,
14
+ 'maxLength' | 'allowDecimal' | 'decimalPlaces'
15
+ > = {}
16
+ ): string | null => {
17
+ const { maxLength, allowDecimal = false, decimalPlaces } = options;
18
+
19
+ if (key === 'backspace') {
20
+ return value.slice(0, -1);
21
+ }
22
+
23
+ if (key === '.') {
24
+ if (!allowDecimal || value.includes('.')) {
25
+ return null;
26
+ }
27
+
28
+ const next = value ? `${value}.` : '0.';
29
+ return maxLength && next.length > maxLength ? null : next;
30
+ }
31
+
32
+ if (!/^\d$/.test(key)) {
33
+ return null;
34
+ }
35
+
36
+ const next = `${value}${key}`;
37
+
38
+ if (maxLength && next.length > maxLength) {
39
+ return null;
40
+ }
41
+
42
+ if (allowDecimal && decimalPlaces != null && value.includes('.')) {
43
+ const [, decimalPart = ''] = value.split('.');
44
+ if (decimalPart.length >= decimalPlaces) {
45
+ return null;
46
+ }
47
+ }
48
+
49
+ if (value === '0' && key !== '.') {
50
+ return key;
51
+ }
52
+
53
+ return next;
54
+ };