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.
- package/LICENSE +20 -0
- package/README.md +477 -0
- package/lib/module/assets/images/close.png +0 -0
- package/lib/module/components/CustomCheckbox/index.js +99 -0
- package/lib/module/components/CustomCheckbox/index.js.map +1 -0
- package/lib/module/components/CustomCheckbox/styles.js +213 -0
- package/lib/module/components/CustomCheckbox/styles.js.map +1 -0
- package/lib/module/components/CustomCheckbox/types.js +4 -0
- package/lib/module/components/CustomCheckbox/types.js.map +1 -0
- package/lib/module/components/closeButton/index.js +45 -0
- package/lib/module/components/closeButton/index.js.map +1 -0
- package/lib/module/components/closeButton/types.js +4 -0
- package/lib/module/components/closeButton/types.js.map +1 -0
- package/lib/module/components/customButton/index.js +176 -0
- package/lib/module/components/customButton/index.js.map +1 -0
- package/lib/module/components/customButton/styles.js +282 -0
- package/lib/module/components/customButton/styles.js.map +1 -0
- package/lib/module/components/customButton/types.js +4 -0
- package/lib/module/components/customButton/types.js.map +1 -0
- package/lib/module/components/customDropDown/DropDownBottomSheet.js +57 -0
- package/lib/module/components/customDropDown/DropDownBottomSheet.js.map +1 -0
- package/lib/module/components/customDropDown/DropDownList.js +51 -0
- package/lib/module/components/customDropDown/DropDownList.js.map +1 -0
- package/lib/module/components/customDropDown/DropDownListItem.js +38 -0
- package/lib/module/components/customDropDown/DropDownListItem.js.map +1 -0
- package/lib/module/components/customDropDown/DropDownListModal.js +63 -0
- package/lib/module/components/customDropDown/DropDownListModal.js.map +1 -0
- package/lib/module/components/customDropDown/index.js +143 -0
- package/lib/module/components/customDropDown/index.js.map +1 -0
- package/lib/module/components/customDropDown/styles.js +189 -0
- package/lib/module/components/customDropDown/styles.js.map +1 -0
- package/lib/module/components/customDropDown/types.js +4 -0
- package/lib/module/components/customDropDown/types.js.map +1 -0
- package/lib/module/components/customDropDown/utils.js +17 -0
- package/lib/module/components/customDropDown/utils.js.map +1 -0
- package/lib/module/components/customList/ListEmpty.js +33 -0
- package/lib/module/components/customList/ListEmpty.js.map +1 -0
- package/lib/module/components/customList/ListFooterLoader.js +14 -0
- package/lib/module/components/customList/ListFooterLoader.js.map +1 -0
- package/lib/module/components/customList/defaultKeyExtractor.js +9 -0
- package/lib/module/components/customList/defaultKeyExtractor.js.map +1 -0
- package/lib/module/components/customList/getFlashList.js +19 -0
- package/lib/module/components/customList/getFlashList.js.map +1 -0
- package/lib/module/components/customList/index.js +117 -0
- package/lib/module/components/customList/index.js.map +1 -0
- package/lib/module/components/customList/styles.js +45 -0
- package/lib/module/components/customList/styles.js.map +1 -0
- package/lib/module/components/customList/types.js +4 -0
- package/lib/module/components/customList/types.js.map +1 -0
- package/lib/module/components/customModal/ModalFooter.js +44 -0
- package/lib/module/components/customModal/ModalFooter.js.map +1 -0
- package/lib/module/components/customModal/index.js +132 -0
- package/lib/module/components/customModal/index.js.map +1 -0
- package/lib/module/components/customModal/styles.js +123 -0
- package/lib/module/components/customModal/styles.js.map +1 -0
- package/lib/module/components/customModal/types.js +4 -0
- package/lib/module/components/customModal/types.js.map +1 -0
- package/lib/module/components/customModal/useCustomModal.js +23 -0
- package/lib/module/components/customModal/useCustomModal.js.map +1 -0
- package/lib/module/components/customNumberPad/NumberPadKey.js +39 -0
- package/lib/module/components/customNumberPad/NumberPadKey.js.map +1 -0
- package/lib/module/components/customNumberPad/index.js +156 -0
- package/lib/module/components/customNumberPad/index.js.map +1 -0
- package/lib/module/components/customNumberPad/styles.js +131 -0
- package/lib/module/components/customNumberPad/styles.js.map +1 -0
- package/lib/module/components/customNumberPad/types.js +4 -0
- package/lib/module/components/customNumberPad/types.js.map +1 -0
- package/lib/module/components/customNumberPad/useNumberPadInput.js +44 -0
- package/lib/module/components/customNumberPad/useNumberPadInput.js.map +1 -0
- package/lib/module/components/customNumberPad/utils.js +38 -0
- package/lib/module/components/customNumberPad/utils.js.map +1 -0
- package/lib/module/components/customSlideTabs/AnimatedTabIndicator.js +66 -0
- package/lib/module/components/customSlideTabs/AnimatedTabIndicator.js.map +1 -0
- package/lib/module/components/customSlideTabs/TabBarItem.js +61 -0
- package/lib/module/components/customSlideTabs/TabBarItem.js.map +1 -0
- package/lib/module/components/customSlideTabs/TabScene.js +88 -0
- package/lib/module/components/customSlideTabs/TabScene.js.map +1 -0
- package/lib/module/components/customSlideTabs/index.js +277 -0
- package/lib/module/components/customSlideTabs/index.js.map +1 -0
- package/lib/module/components/customSlideTabs/styles.js +132 -0
- package/lib/module/components/customSlideTabs/styles.js.map +1 -0
- package/lib/module/components/customSlideTabs/tabBarScroll.js +65 -0
- package/lib/module/components/customSlideTabs/tabBarScroll.js.map +1 -0
- package/lib/module/components/customSlideTabs/types.js +4 -0
- package/lib/module/components/customSlideTabs/types.js.map +1 -0
- package/lib/module/components/loading/index.js +34 -0
- package/lib/module/components/loading/index.js.map +1 -0
- package/lib/module/customFunctions/array.js +61 -0
- package/lib/module/customFunctions/array.js.map +1 -0
- package/lib/module/customFunctions/async.js +62 -0
- package/lib/module/customFunctions/async.js.map +1 -0
- package/lib/module/customFunctions/date.js +109 -0
- package/lib/module/customFunctions/date.js.map +1 -0
- package/lib/module/customFunctions/general.js +29 -0
- package/lib/module/customFunctions/general.js.map +1 -0
- package/lib/module/customFunctions/id.js +20 -0
- package/lib/module/customFunctions/id.js.map +1 -0
- package/lib/module/customFunctions/index.js +29 -0
- package/lib/module/customFunctions/index.js.map +1 -0
- package/lib/module/customFunctions/number.js +94 -0
- package/lib/module/customFunctions/number.js.map +1 -0
- package/lib/module/customFunctions/object.js +39 -0
- package/lib/module/customFunctions/object.js.map +1 -0
- package/lib/module/customFunctions/string.js +63 -0
- package/lib/module/customFunctions/string.js.map +1 -0
- package/lib/module/customFunctions/types.js +2 -0
- package/lib/module/customFunctions/types.js.map +1 -0
- package/lib/module/customFunctions/validation.js +34 -0
- package/lib/module/customFunctions/validation.js.map +1 -0
- package/lib/module/customHooks/errors.js +61 -0
- package/lib/module/customHooks/errors.js.map +1 -0
- package/lib/module/customHooks/fetchJson.js +36 -0
- package/lib/module/customHooks/fetchJson.js.map +1 -0
- package/lib/module/customHooks/index.js +10 -0
- package/lib/module/customHooks/index.js.map +1 -0
- package/lib/module/customHooks/internal.js +49 -0
- package/lib/module/customHooks/internal.js.map +1 -0
- package/lib/module/customHooks/types.js +2 -0
- package/lib/module/customHooks/types.js.map +1 -0
- package/lib/module/customHooks/useApi.js +91 -0
- package/lib/module/customHooks/useApi.js.map +1 -0
- package/lib/module/customHooks/useLazyApi.js +80 -0
- package/lib/module/customHooks/useLazyApi.js.map +1 -0
- package/lib/module/customHooks/useMutation.js +69 -0
- package/lib/module/customHooks/useMutation.js.map +1 -0
- package/lib/module/customHooks/usePaginatedApi.js +127 -0
- package/lib/module/customHooks/usePaginatedApi.js.map +1 -0
- package/lib/module/customHooks/usePollingApi.js +37 -0
- package/lib/module/customHooks/usePollingApi.js.map +1 -0
- package/lib/module/index.js +13 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/multiply.js +6 -0
- package/lib/module/multiply.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/components/CustomCheckbox/index.d.ts +5 -0
- package/lib/typescript/src/components/CustomCheckbox/index.d.ts.map +1 -0
- package/lib/typescript/src/components/CustomCheckbox/styles.d.ts +67 -0
- package/lib/typescript/src/components/CustomCheckbox/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/CustomCheckbox/types.d.ts +28 -0
- package/lib/typescript/src/components/CustomCheckbox/types.d.ts.map +1 -0
- package/lib/typescript/src/components/closeButton/index.d.ts +4 -0
- package/lib/typescript/src/components/closeButton/index.d.ts.map +1 -0
- package/lib/typescript/src/components/closeButton/types.d.ts +8 -0
- package/lib/typescript/src/components/closeButton/types.d.ts.map +1 -0
- package/lib/typescript/src/components/customButton/index.d.ts +5 -0
- package/lib/typescript/src/components/customButton/index.d.ts.map +1 -0
- package/lib/typescript/src/components/customButton/styles.d.ts +231 -0
- package/lib/typescript/src/components/customButton/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/customButton/types.d.ts +46 -0
- package/lib/typescript/src/components/customButton/types.d.ts.map +1 -0
- package/lib/typescript/src/components/customDropDown/DropDownBottomSheet.d.ts +18 -0
- package/lib/typescript/src/components/customDropDown/DropDownBottomSheet.d.ts.map +1 -0
- package/lib/typescript/src/components/customDropDown/DropDownList.d.ts +17 -0
- package/lib/typescript/src/components/customDropDown/DropDownList.d.ts.map +1 -0
- package/lib/typescript/src/components/customDropDown/DropDownListItem.d.ts +15 -0
- package/lib/typescript/src/components/customDropDown/DropDownListItem.d.ts.map +1 -0
- package/lib/typescript/src/components/customDropDown/DropDownListModal.d.ts +19 -0
- package/lib/typescript/src/components/customDropDown/DropDownListModal.d.ts.map +1 -0
- package/lib/typescript/src/components/customDropDown/index.d.ts +5 -0
- package/lib/typescript/src/components/customDropDown/index.d.ts.map +1 -0
- package/lib/typescript/src/components/customDropDown/styles.d.ts +190 -0
- package/lib/typescript/src/components/customDropDown/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/customDropDown/types.d.ts +37 -0
- package/lib/typescript/src/components/customDropDown/types.d.ts.map +1 -0
- package/lib/typescript/src/components/customDropDown/utils.d.ts +4 -0
- package/lib/typescript/src/components/customDropDown/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/customList/ListEmpty.d.ts +10 -0
- package/lib/typescript/src/components/customList/ListEmpty.d.ts.map +1 -0
- package/lib/typescript/src/components/customList/ListFooterLoader.d.ts +3 -0
- package/lib/typescript/src/components/customList/ListFooterLoader.d.ts.map +1 -0
- package/lib/typescript/src/components/customList/defaultKeyExtractor.d.ts +2 -0
- package/lib/typescript/src/components/customList/defaultKeyExtractor.d.ts.map +1 -0
- package/lib/typescript/src/components/customList/getFlashList.d.ts +6 -0
- package/lib/typescript/src/components/customList/getFlashList.d.ts.map +1 -0
- package/lib/typescript/src/components/customList/index.d.ts +11 -0
- package/lib/typescript/src/components/customList/index.d.ts.map +1 -0
- package/lib/typescript/src/components/customList/styles.d.ts +42 -0
- package/lib/typescript/src/components/customList/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/customList/types.d.ts +33 -0
- package/lib/typescript/src/components/customList/types.d.ts.map +1 -0
- package/lib/typescript/src/components/customModal/ModalFooter.d.ts +12 -0
- package/lib/typescript/src/components/customModal/ModalFooter.d.ts.map +1 -0
- package/lib/typescript/src/components/customModal/index.d.ts +6 -0
- package/lib/typescript/src/components/customModal/index.d.ts.map +1 -0
- package/lib/typescript/src/components/customModal/styles.d.ts +83 -0
- package/lib/typescript/src/components/customModal/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/customModal/types.d.ts +36 -0
- package/lib/typescript/src/components/customModal/types.d.ts.map +1 -0
- package/lib/typescript/src/components/customModal/useCustomModal.d.ts +8 -0
- package/lib/typescript/src/components/customModal/useCustomModal.d.ts.map +1 -0
- package/lib/typescript/src/components/customNumberPad/NumberPadKey.d.ts +23 -0
- package/lib/typescript/src/components/customNumberPad/NumberPadKey.d.ts.map +1 -0
- package/lib/typescript/src/components/customNumberPad/index.d.ts +7 -0
- package/lib/typescript/src/components/customNumberPad/index.d.ts.map +1 -0
- package/lib/typescript/src/components/customNumberPad/styles.d.ts +37 -0
- package/lib/typescript/src/components/customNumberPad/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/customNumberPad/types.d.ts +47 -0
- package/lib/typescript/src/components/customNumberPad/types.d.ts.map +1 -0
- package/lib/typescript/src/components/customNumberPad/useNumberPadInput.d.ts +16 -0
- package/lib/typescript/src/components/customNumberPad/useNumberPadInput.d.ts.map +1 -0
- package/lib/typescript/src/components/customNumberPad/utils.d.ts +4 -0
- package/lib/typescript/src/components/customNumberPad/utils.d.ts.map +1 -0
- package/lib/typescript/src/components/customSlideTabs/AnimatedTabIndicator.d.ts +16 -0
- package/lib/typescript/src/components/customSlideTabs/AnimatedTabIndicator.d.ts.map +1 -0
- package/lib/typescript/src/components/customSlideTabs/TabBarItem.d.ts +23 -0
- package/lib/typescript/src/components/customSlideTabs/TabBarItem.d.ts.map +1 -0
- package/lib/typescript/src/components/customSlideTabs/TabScene.d.ts +21 -0
- package/lib/typescript/src/components/customSlideTabs/TabScene.d.ts.map +1 -0
- package/lib/typescript/src/components/customSlideTabs/index.d.ts +5 -0
- package/lib/typescript/src/components/customSlideTabs/index.d.ts.map +1 -0
- package/lib/typescript/src/components/customSlideTabs/styles.d.ts +130 -0
- package/lib/typescript/src/components/customSlideTabs/styles.d.ts.map +1 -0
- package/lib/typescript/src/components/customSlideTabs/tabBarScroll.d.ts +15 -0
- package/lib/typescript/src/components/customSlideTabs/tabBarScroll.d.ts.map +1 -0
- package/lib/typescript/src/components/customSlideTabs/types.d.ts +68 -0
- package/lib/typescript/src/components/customSlideTabs/types.d.ts.map +1 -0
- package/lib/typescript/src/components/loading/index.d.ts +7 -0
- package/lib/typescript/src/components/loading/index.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/array.d.ts +7 -0
- package/lib/typescript/src/customFunctions/array.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/async.d.ts +9 -0
- package/lib/typescript/src/customFunctions/async.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/date.d.ts +18 -0
- package/lib/typescript/src/customFunctions/date.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/general.d.ts +7 -0
- package/lib/typescript/src/customFunctions/general.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/id.d.ts +4 -0
- package/lib/typescript/src/customFunctions/id.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/index.d.ts +26 -0
- package/lib/typescript/src/customFunctions/index.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/number.d.ts +15 -0
- package/lib/typescript/src/customFunctions/number.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/object.d.ts +6 -0
- package/lib/typescript/src/customFunctions/object.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/string.d.ts +20 -0
- package/lib/typescript/src/customFunctions/string.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/types.d.ts +22 -0
- package/lib/typescript/src/customFunctions/types.d.ts.map +1 -0
- package/lib/typescript/src/customFunctions/validation.d.ts +11 -0
- package/lib/typescript/src/customFunctions/validation.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/errors.d.ts +16 -0
- package/lib/typescript/src/customHooks/errors.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/fetchJson.d.ts +5 -0
- package/lib/typescript/src/customHooks/fetchJson.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/index.d.ts +9 -0
- package/lib/typescript/src/customHooks/index.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/internal.d.ts +12 -0
- package/lib/typescript/src/customHooks/internal.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/types.d.ts +49 -0
- package/lib/typescript/src/customHooks/types.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/useApi.d.ts +13 -0
- package/lib/typescript/src/customHooks/useApi.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/useLazyApi.d.ts +14 -0
- package/lib/typescript/src/customHooks/useLazyApi.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/useMutation.d.ts +15 -0
- package/lib/typescript/src/customHooks/useMutation.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/usePaginatedApi.d.ts +19 -0
- package/lib/typescript/src/customHooks/usePaginatedApi.d.ts.map +1 -0
- package/lib/typescript/src/customHooks/usePollingApi.d.ts +13 -0
- package/lib/typescript/src/customHooks/usePollingApi.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +11 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/lib/typescript/src/multiply.d.ts +2 -0
- package/lib/typescript/src/multiply.d.ts.map +1 -0
- package/package.json +181 -0
- package/src/assets/images/close.png +0 -0
- package/src/components/CustomCheckbox/index.tsx +143 -0
- package/src/components/CustomCheckbox/styles.ts +146 -0
- package/src/components/CustomCheckbox/types.ts +33 -0
- package/src/components/closeButton/index.tsx +40 -0
- package/src/components/closeButton/types.ts +13 -0
- package/src/components/customButton/index.tsx +288 -0
- package/src/components/customButton/styles.ts +247 -0
- package/src/components/customButton/types.ts +71 -0
- package/src/components/customDropDown/DropDownBottomSheet.tsx +70 -0
- package/src/components/customDropDown/DropDownList.tsx +88 -0
- package/src/components/customDropDown/DropDownListItem.tsx +74 -0
- package/src/components/customDropDown/DropDownListModal.tsx +86 -0
- package/src/components/customDropDown/index.tsx +213 -0
- package/src/components/customDropDown/styles.ts +184 -0
- package/src/components/customDropDown/types.ts +48 -0
- package/src/components/customDropDown/utils.ts +24 -0
- package/src/components/customList/ListEmpty.tsx +36 -0
- package/src/components/customList/ListFooterLoader.tsx +11 -0
- package/src/components/customList/defaultKeyExtractor.ts +7 -0
- package/src/components/customList/getFlashList.ts +26 -0
- package/src/components/customList/index.tsx +142 -0
- package/src/components/customList/styles.ts +43 -0
- package/src/components/customList/types.ts +60 -0
- package/src/components/customModal/ModalFooter.tsx +57 -0
- package/src/components/customModal/index.tsx +166 -0
- package/src/components/customModal/styles.ts +131 -0
- package/src/components/customModal/types.ts +48 -0
- package/src/components/customModal/useCustomModal.ts +25 -0
- package/src/components/customNumberPad/NumberPadKey.tsx +81 -0
- package/src/components/customNumberPad/index.tsx +204 -0
- package/src/components/customNumberPad/styles.ts +146 -0
- package/src/components/customNumberPad/types.ts +53 -0
- package/src/components/customNumberPad/useNumberPadInput.ts +56 -0
- package/src/components/customNumberPad/utils.ts +54 -0
- package/src/components/customSlideTabs/AnimatedTabIndicator.tsx +103 -0
- package/src/components/customSlideTabs/TabBarItem.tsx +118 -0
- package/src/components/customSlideTabs/TabScene.tsx +136 -0
- package/src/components/customSlideTabs/index.tsx +385 -0
- package/src/components/customSlideTabs/styles.ts +136 -0
- package/src/components/customSlideTabs/tabBarScroll.ts +92 -0
- package/src/components/customSlideTabs/types.ts +87 -0
- package/src/components/loading/index.tsx +34 -0
- package/src/customFunctions/array.ts +83 -0
- package/src/customFunctions/async.ts +85 -0
- package/src/customFunctions/date.ts +158 -0
- package/src/customFunctions/general.ts +35 -0
- package/src/customFunctions/id.ts +25 -0
- package/src/customFunctions/index.ts +91 -0
- package/src/customFunctions/number.ts +139 -0
- package/src/customFunctions/object.ts +59 -0
- package/src/customFunctions/string.ts +119 -0
- package/src/customFunctions/types.ts +25 -0
- package/src/customFunctions/validation.ts +49 -0
- package/src/customHooks/errors.ts +87 -0
- package/src/customHooks/fetchJson.ts +49 -0
- package/src/customHooks/index.ts +20 -0
- package/src/customHooks/internal.ts +67 -0
- package/src/customHooks/types.ts +71 -0
- package/src/customHooks/useApi.ts +107 -0
- package/src/customHooks/useLazyApi.ts +92 -0
- package/src/customHooks/useMutation.ts +97 -0
- package/src/customHooks/usePaginatedApi.ts +168 -0
- package/src/customHooks/usePollingApi.ts +48 -0
- package/src/index.tsx +63 -0
- package/src/multiply.tsx +3 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Mustafa Hakimji
|
|
4
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
5
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
6
|
+
in the Software without restriction, including without limitation the rights
|
|
7
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
8
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
9
|
+
furnished to do so, subject to the following conditions:
|
|
10
|
+
|
|
11
|
+
The above copyright notice and this permission notice shall be included in all
|
|
12
|
+
copies or substantial portions of the Software.
|
|
13
|
+
|
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
15
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
16
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
17
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
18
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
19
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
20
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,477 @@
|
|
|
1
|
+
# rn-custom-ui
|
|
2
|
+
|
|
3
|
+
A React Native UI component library with reusable components, utility functions, and API hooks. Built for production apps that need consistent buttons, forms, lists, modals, tabs, and common helpers without extra dependencies.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```sh
|
|
8
|
+
npm install rn-custom-ui
|
|
9
|
+
# or
|
|
10
|
+
yarn add rn-custom-ui
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
### Peer dependencies
|
|
14
|
+
|
|
15
|
+
| Package | Required | Notes |
|
|
16
|
+
|---|---|---|
|
|
17
|
+
| `react` | Yes | |
|
|
18
|
+
| `react-native` | Yes | |
|
|
19
|
+
| `@shopify/flash-list` | Optional | Only needed for `CustomList` with `engine="flashList"` |
|
|
20
|
+
|
|
21
|
+
```sh
|
|
22
|
+
yarn add @shopify/flash-list
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick start
|
|
26
|
+
|
|
27
|
+
```tsx
|
|
28
|
+
import {
|
|
29
|
+
CustomButton,
|
|
30
|
+
CustomCheckbox,
|
|
31
|
+
CustomModal,
|
|
32
|
+
formatCurrency,
|
|
33
|
+
useApi,
|
|
34
|
+
} from 'rn-custom-ui';
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Example app
|
|
38
|
+
|
|
39
|
+
An interactive showcase app lives in the `example/` folder:
|
|
40
|
+
|
|
41
|
+
```sh
|
|
42
|
+
yarn example ios
|
|
43
|
+
# or
|
|
44
|
+
yarn example android
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Each component and helper has a dedicated showcase screen with live demos.
|
|
48
|
+
|
|
49
|
+
---
|
|
50
|
+
|
|
51
|
+
## UI Components
|
|
52
|
+
|
|
53
|
+
### CustomButton
|
|
54
|
+
|
|
55
|
+
A flexible button with variants, sizes, icons, images, loading state, badge count, and icon-only mode.
|
|
56
|
+
|
|
57
|
+
**Variants:** `default`, `primary`, `danger`, `warning`, `info`, `success`, `secondary`, `light`, `dark`, `link`, `outline`, `ghost`, `text`
|
|
58
|
+
|
|
59
|
+
**Sizes:** `sm`, `md`, `lg`
|
|
60
|
+
|
|
61
|
+
| Prop | Type | Default | Description |
|
|
62
|
+
|---|---|---|---|
|
|
63
|
+
| `variant` | `ButtonVariant` | `'default'` | Color theme |
|
|
64
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Button size |
|
|
65
|
+
| `text` | `string` | `'Submit'` | Label text |
|
|
66
|
+
| `children` | `ReactNode` | — | Custom content instead of `text` |
|
|
67
|
+
| `contentAlign` | `'left' \| 'center' \| 'right'` | `'center'` | Icon + text alignment |
|
|
68
|
+
| `iconOnly` | `boolean` | `false` | Square icon-only button |
|
|
69
|
+
| `iconOnlyShape` | `'square' \| 'circle'` | `'square'` | Shape when `iconOnly` |
|
|
70
|
+
| `LeftIcon` / `RightIcon` | `IconComponent` | — | Custom icon components |
|
|
71
|
+
| `leftImage` / `rightImage` | `ImageSourcePropType` | — | Image icons |
|
|
72
|
+
| `isLoading` | `boolean` | `false` | Shows loader overlay |
|
|
73
|
+
| `disabled` | `boolean` | `false` | Disables press |
|
|
74
|
+
| `showCount` | `boolean` | `false` | Shows badge |
|
|
75
|
+
| `itemCount` | `number` | — | Badge value |
|
|
76
|
+
| `borderRadius` | `number` | `0` | Corner radius |
|
|
77
|
+
| `accessibilityLabel` | `string` | — | Required for `iconOnly` |
|
|
78
|
+
|
|
79
|
+
```tsx
|
|
80
|
+
<CustomButton
|
|
81
|
+
text="Save"
|
|
82
|
+
variant="primary"
|
|
83
|
+
borderRadius={8}
|
|
84
|
+
LeftIcon={PlusIcon}
|
|
85
|
+
onPress={handleSave}
|
|
86
|
+
/>
|
|
87
|
+
|
|
88
|
+
<CustomButton
|
|
89
|
+
iconOnly
|
|
90
|
+
iconOnlyShape="circle"
|
|
91
|
+
variant="outline"
|
|
92
|
+
LeftIcon={ShareIcon}
|
|
93
|
+
accessibilityLabel="Share"
|
|
94
|
+
onPress={onShare}
|
|
95
|
+
/>
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
---
|
|
99
|
+
|
|
100
|
+
### CustomDropDown
|
|
101
|
+
|
|
102
|
+
Dropdown selector with multiple presentation modes and image support.
|
|
103
|
+
|
|
104
|
+
**Modes:** `modal`, `inline`, `anchored`, `bottomSheet`
|
|
105
|
+
|
|
106
|
+
| Prop | Type | Default | Description |
|
|
107
|
+
|---|---|---|---|
|
|
108
|
+
| `mode` | `DropDownMode` | `'modal'` | How the list opens |
|
|
109
|
+
| `label` | `string` | — | Field label |
|
|
110
|
+
| `selectedText` | `string` | — | Currently selected value |
|
|
111
|
+
| `listItems` | `string[] \| DropDownOption[]` | — | Options list |
|
|
112
|
+
| `onSelect` | `(item, index) => void` | — | Selection callback |
|
|
113
|
+
| `placeholder` | `string` | — | Placeholder when empty |
|
|
114
|
+
| `disabled` | `boolean` | `false` | Disable interaction |
|
|
115
|
+
| `itemImageAlign` | `'left' \| 'right'` | — | Image position in list items |
|
|
116
|
+
| `toggleImageAlign` | `'left' \| 'right'` | — | Image on toggle button |
|
|
117
|
+
| `maxListHeight` | `number` | — | Max height for list |
|
|
118
|
+
|
|
119
|
+
```tsx
|
|
120
|
+
<CustomDropDown
|
|
121
|
+
mode="bottomSheet"
|
|
122
|
+
label="Country"
|
|
123
|
+
selectedText={country}
|
|
124
|
+
listItems={['Canada', 'USA', 'UK']}
|
|
125
|
+
onSelect={(item) => setCountry(item)}
|
|
126
|
+
/>
|
|
127
|
+
```
|
|
128
|
+
|
|
129
|
+
---
|
|
130
|
+
|
|
131
|
+
### CustomCheckbox
|
|
132
|
+
|
|
133
|
+
Checkbox with variants, sizes, shapes, label positions, indeterminate state, and error handling.
|
|
134
|
+
|
|
135
|
+
**Variants:** `default`, `primary`, `success`, `danger`, `warning`, `outline`
|
|
136
|
+
|
|
137
|
+
**Sizes:** `sm`, `md`, `lg` | **Shapes:** `square`, `rounded`, `circle`
|
|
138
|
+
|
|
139
|
+
| Prop | Type | Default | Description |
|
|
140
|
+
|---|---|---|---|
|
|
141
|
+
| `checked` | `boolean` | — | Checked state |
|
|
142
|
+
| `onChange` | `(checked) => void` | — | Change handler |
|
|
143
|
+
| `indeterminate` | `boolean` | `false` | Partial selection (dash) |
|
|
144
|
+
| `label` | `string` | — | Label text |
|
|
145
|
+
| `description` | `string` | — | Subtitle below label |
|
|
146
|
+
| `children` | `ReactNode` | — | Custom label content |
|
|
147
|
+
| `labelPosition` | `'left' \| 'right'` | `'right'` | Label side |
|
|
148
|
+
| `error` | `boolean` | `false` | Error state |
|
|
149
|
+
| `errorMessage` | `string` | — | Error text |
|
|
150
|
+
| `disabled` | `boolean` | `false` | Disable interaction |
|
|
151
|
+
|
|
152
|
+
```tsx
|
|
153
|
+
<CustomCheckbox
|
|
154
|
+
variant="primary"
|
|
155
|
+
label="Accept terms"
|
|
156
|
+
description="You agree to our privacy policy."
|
|
157
|
+
checked={accepted}
|
|
158
|
+
onChange={setAccepted}
|
|
159
|
+
/>
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
---
|
|
163
|
+
|
|
164
|
+
### CustomList
|
|
165
|
+
|
|
166
|
+
List component powered by `FlatList` or optional `FlashList` with built-in loading, empty, refresh, and infinite scroll states.
|
|
167
|
+
|
|
168
|
+
| Prop | Type | Default | Description |
|
|
169
|
+
|---|---|---|---|
|
|
170
|
+
| `data` | `T[]` | — | List data |
|
|
171
|
+
| `renderItem` | `ListRenderItem<T>` | — | Item renderer |
|
|
172
|
+
| `engine` | `'flatList' \| 'flashList'` | `'flatList'` | List engine |
|
|
173
|
+
| `horizontal` | `boolean` | `false` | Horizontal list |
|
|
174
|
+
| `numColumns` | `number` | — | Grid layout |
|
|
175
|
+
| `loading` | `boolean` | `false` | Initial loading state |
|
|
176
|
+
| `loadingMore` | `boolean` | `false` | Footer loader |
|
|
177
|
+
| `refreshing` | `boolean` | `false` | Pull-to-refresh |
|
|
178
|
+
| `onRefresh` | `() => void` | — | Refresh handler |
|
|
179
|
+
| `onEndReached` | `() => void` | — | Infinite scroll |
|
|
180
|
+
| `emptyTitle` | `string` | — | Empty state title |
|
|
181
|
+
| `emptyDescription` | `string` | — | Empty state message |
|
|
182
|
+
|
|
183
|
+
```tsx
|
|
184
|
+
<CustomList
|
|
185
|
+
data={items}
|
|
186
|
+
engine="flashList"
|
|
187
|
+
estimatedItemSize={72}
|
|
188
|
+
loading={isLoading}
|
|
189
|
+
onRefresh={refetch}
|
|
190
|
+
refreshing={isRefreshing}
|
|
191
|
+
renderItem={({ item }) => <ItemRow item={item} />}
|
|
192
|
+
/>
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
---
|
|
196
|
+
|
|
197
|
+
### CustomNumberPad
|
|
198
|
+
|
|
199
|
+
Numeric keypad for PIN entry, amounts, and custom numeric input.
|
|
200
|
+
|
|
201
|
+
| Prop | Type | Default | Description |
|
|
202
|
+
|---|---|---|---|
|
|
203
|
+
| `value` | `string` | — | Controlled value |
|
|
204
|
+
| `onChange` | `(value) => void` | — | Value change handler |
|
|
205
|
+
| `maxLength` | `number` | — | Max digits |
|
|
206
|
+
| `allowDecimal` | `boolean` | `false` | Show decimal key |
|
|
207
|
+
| `decimalPlaces` | `number` | — | Max decimal digits |
|
|
208
|
+
| `variant` | `'default' \| 'primary' \| 'dark'` | `'default'` | Theme |
|
|
209
|
+
| `size` | `'sm' \| 'md' \| 'lg'` | `'md'` | Key size |
|
|
210
|
+
| `bottomLeftKey` | `{ label, onPress }` | — | Custom key (e.g. Clear) |
|
|
211
|
+
| `disabled` | `boolean` | `false` | Disable all keys |
|
|
212
|
+
|
|
213
|
+
**Hook:** `useNumberPadInput` — manages value state with built-in validation.
|
|
214
|
+
|
|
215
|
+
```tsx
|
|
216
|
+
const pinPad = useNumberPadInput({ maxLength: 4 });
|
|
217
|
+
|
|
218
|
+
<CustomNumberPad {...pinPad.numberPadProps} />
|
|
219
|
+
<Text>{pinPad.value}</Text>
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
---
|
|
223
|
+
|
|
224
|
+
### CustomModal
|
|
225
|
+
|
|
226
|
+
Modal dialog with center, bottom sheet, and fullscreen presentations. Includes footer actions and close button.
|
|
227
|
+
|
|
228
|
+
**Presentations:** `center`, `bottom`, `fullscreen`
|
|
229
|
+
|
|
230
|
+
| Prop | Type | Default | Description |
|
|
231
|
+
|---|---|---|---|
|
|
232
|
+
| `visible` | `boolean` | — | Show/hide modal |
|
|
233
|
+
| `onClose` | `() => void` | — | Close handler |
|
|
234
|
+
| `title` | `string` | — | Header title |
|
|
235
|
+
| `description` | `string` | — | Header subtitle |
|
|
236
|
+
| `presentation` | `ModalPresentation` | `'center'` | Layout style |
|
|
237
|
+
| `scrollable` | `boolean` | `false` | Scroll body content |
|
|
238
|
+
| `showCloseButton` | `boolean` | `true` | X button in header |
|
|
239
|
+
| `closeOnBackdropPress` | `boolean` | `true` | Tap outside to close |
|
|
240
|
+
| `primaryAction` | `ModalAction` | — | Primary footer button |
|
|
241
|
+
| `secondaryAction` | `ModalAction` | — | Secondary footer button |
|
|
242
|
+
| `footer` | `ReactNode` | — | Custom footer |
|
|
243
|
+
|
|
244
|
+
**Hook:** `useCustomModal` — `{ visible, open, close, toggle }`
|
|
245
|
+
|
|
246
|
+
```tsx
|
|
247
|
+
const modal = useCustomModal();
|
|
248
|
+
|
|
249
|
+
<CustomButton text="Delete" variant="danger" onPress={modal.open} />
|
|
250
|
+
|
|
251
|
+
<CustomModal
|
|
252
|
+
visible={modal.visible}
|
|
253
|
+
onClose={modal.close}
|
|
254
|
+
title="Delete item?"
|
|
255
|
+
description="This action cannot be undone."
|
|
256
|
+
secondaryAction={{ label: 'Cancel', onPress: modal.close }}
|
|
257
|
+
primaryAction={{ label: 'Confirm', variant: 'danger', onPress: handleDelete }}
|
|
258
|
+
/>
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+
---
|
|
262
|
+
|
|
263
|
+
### CustomSlideTabs
|
|
264
|
+
|
|
265
|
+
Top tab bar with swipeable scenes, animated sliding indicator, per-tab API loading, and customizable headings.
|
|
266
|
+
|
|
267
|
+
| Prop | Type | Default | Description |
|
|
268
|
+
|---|---|---|---|
|
|
269
|
+
| `tabs` | `SlideTabItem[]` | — | Tab config (`key`, `title`, `heading`, `subtitle`, `image`, `badge`) |
|
|
270
|
+
| `renderScene` | `(state) => ReactNode` | — | Screen content per tab |
|
|
271
|
+
| `fetchSceneData` | `(tab, index, signal) => Promise` | — | API call when tab is active |
|
|
272
|
+
| `lazy` | `boolean` | `true` | Mount scenes on first visit |
|
|
273
|
+
| `fetchWhenActive` | `boolean` | `true` | Fetch only when tab is visible |
|
|
274
|
+
| `refetchOnRevisit` | `boolean` | `false` | Re-fetch every time tab is opened |
|
|
275
|
+
| `animatedIndicator` | `boolean` | `true` | Sliding pill + underline |
|
|
276
|
+
| `renderTab` | `(tab, index, isActive) => ReactNode` | — | Custom tab label |
|
|
277
|
+
| `renderSceneHeader` | `(state) => ReactNode` | — | Custom scene heading |
|
|
278
|
+
| `onTabChange` | `(index, tab) => void` | — | Tab change callback |
|
|
279
|
+
|
|
280
|
+
`renderScene` receives: `data`, `error`, `isLoading`, `isSuccess`, `isError`, `refetch`, `isActive`, `tab`, `index`.
|
|
281
|
+
|
|
282
|
+
```tsx
|
|
283
|
+
<CustomSlideTabs
|
|
284
|
+
tabs={[
|
|
285
|
+
{ key: 'all', title: 'All', heading: 'All calls', subtitle: 'Every call' },
|
|
286
|
+
{ key: 'missed', title: 'Missed', heading: 'Missed calls' },
|
|
287
|
+
]}
|
|
288
|
+
fetchSceneData={(tab) => fetchCalls(tab.key)}
|
|
289
|
+
renderScene={({ tab, data, isLoading }) => (
|
|
290
|
+
<CallList data={data} loading={isLoading} />
|
|
291
|
+
)}
|
|
292
|
+
/>
|
|
293
|
+
```
|
|
294
|
+
|
|
295
|
+
---
|
|
296
|
+
|
|
297
|
+
## Custom Functions
|
|
298
|
+
|
|
299
|
+
Dependency-free utility helpers exported from the main package.
|
|
300
|
+
|
|
301
|
+
### Array
|
|
302
|
+
|
|
303
|
+
| Function | Description |
|
|
304
|
+
|---|---|
|
|
305
|
+
| `chunk(items, size)` | Split array into batches |
|
|
306
|
+
| `flatten(items)` | Flatten one level of nesting |
|
|
307
|
+
| `groupBy(items, getKey)` | Group items by key |
|
|
308
|
+
| `shuffle(items)` | Randomize order |
|
|
309
|
+
| `sortBy(items, selector, direction?)` | Sort by selector (`'asc'` / `'desc'`) |
|
|
310
|
+
| `uniqueBy(items, selector)` | Deduplicate by key |
|
|
311
|
+
|
|
312
|
+
### Async
|
|
313
|
+
|
|
314
|
+
| Function | Description |
|
|
315
|
+
|---|---|
|
|
316
|
+
| `debounce(fn, delayMs)` | Delay execution (includes `.cancel()`) |
|
|
317
|
+
| `throttle(fn, intervalMs)` | Limit execution rate |
|
|
318
|
+
| `sleep(ms)` | Promise-based delay |
|
|
319
|
+
| `tryParseJson(value, fallback?)` | Safe `JSON.parse` |
|
|
320
|
+
| `safeStringify(value, space?, fallback?)` | Safe `JSON.stringify` |
|
|
321
|
+
|
|
322
|
+
### Date
|
|
323
|
+
|
|
324
|
+
| Function | Description |
|
|
325
|
+
|---|---|
|
|
326
|
+
| `addDays(date, days)` | Add days to a date |
|
|
327
|
+
| `differenceInDays(a, b)` | Day difference between dates |
|
|
328
|
+
| `differenceInMinutes(a, b)` | Minute difference |
|
|
329
|
+
| `formatDateYYYYMMDD(date)` | Format as `YYYY-MM-DD` |
|
|
330
|
+
| `formatDateTimeLocalized(date, options?)` | Localized date/time string |
|
|
331
|
+
| `formatRelativeTime(date)` | `"5 min ago"`, `"in 2 hours"` |
|
|
332
|
+
| `formatTimestampTo12Hour(timestamp)` | 12-hour time string |
|
|
333
|
+
| `isToday(date)` | Check if date is today |
|
|
334
|
+
| `isSameDay(a, b)` | Compare calendar days |
|
|
335
|
+
| `isOlderThanHours(date, hours)` | Check if date is older than N hours |
|
|
336
|
+
| `parseCompactDateTime(value)` | Parse compact date string |
|
|
337
|
+
| `generateCompactTimestampId()` | Timestamp-based ID |
|
|
338
|
+
| `getIsoTimeWithoutMilliseconds()` | ISO time without ms |
|
|
339
|
+
|
|
340
|
+
### General
|
|
341
|
+
|
|
342
|
+
| Function | Description |
|
|
343
|
+
|---|---|
|
|
344
|
+
| `isDefined(value)` | Type guard for non-null/undefined |
|
|
345
|
+
| `isEmpty(value)` | Check empty string/array/object |
|
|
346
|
+
| `isNullish(value)` | Check `null` or `undefined` |
|
|
347
|
+
| `logger(...args)` | Dev-friendly console logger |
|
|
348
|
+
| `noop()` | Empty function placeholder |
|
|
349
|
+
|
|
350
|
+
### ID
|
|
351
|
+
|
|
352
|
+
| Function | Description |
|
|
353
|
+
|---|---|
|
|
354
|
+
| `generateUuid()` | Random UUID |
|
|
355
|
+
| `generateSessionId()` | Session identifier |
|
|
356
|
+
| `generateRandomAlphanumeric(length?)` | Random alphanumeric string |
|
|
357
|
+
|
|
358
|
+
### Number
|
|
359
|
+
|
|
360
|
+
| Function | Description |
|
|
361
|
+
|---|---|
|
|
362
|
+
| `formatNumberWithCommas(value, options?)` | `1250000` → `"1,250,000"` |
|
|
363
|
+
| `formatCurrency(amount, options?)` | Currency formatting |
|
|
364
|
+
| `formatPercentage(value, decimals?)` | `42.5` → `"42.5%"` |
|
|
365
|
+
| `formatBytes(bytes)` | `1536` → `"1.5 KB"` |
|
|
366
|
+
| `formatDiscountAmount(amount)` | Discount display format |
|
|
367
|
+
| `parseNumberSafe(value)` | Parse number, fallback to `0` |
|
|
368
|
+
| `percentage(part, total)` | Calculate percentage |
|
|
369
|
+
| `sum(values)` / `average(values)` | Array math |
|
|
370
|
+
| `clamp(value, min, max)` | Clamp number in range |
|
|
371
|
+
| `roundToDecimals(value, decimals)` | Round to N decimals |
|
|
372
|
+
| `randomInt(min, max)` | Random integer in range |
|
|
373
|
+
|
|
374
|
+
### Object
|
|
375
|
+
|
|
376
|
+
| Function | Description |
|
|
377
|
+
|---|---|
|
|
378
|
+
| `pick(object, keys)` | Select keys from object |
|
|
379
|
+
| `omit(object, keys)` | Exclude keys from object |
|
|
380
|
+
| `deepClone(value)` | JSON-safe deep copy |
|
|
381
|
+
| `getNestedValue(object, path, fallback?)` | Read `"user.address.city"` |
|
|
382
|
+
| `isPlainObject(value)` | Type guard for plain objects |
|
|
383
|
+
|
|
384
|
+
### String
|
|
385
|
+
|
|
386
|
+
| Function | Description |
|
|
387
|
+
|---|---|
|
|
388
|
+
| `truncate(text, maxLength, suffix?)` | Ellipsis truncation |
|
|
389
|
+
| `capitalizeFirst(text)` | Capitalize first letter |
|
|
390
|
+
| `capitalizeWords(text)` | `"hello world"` → `"Hello World"` |
|
|
391
|
+
| `camelToTitle(text)` | `"firstName"` → `"First Name"` |
|
|
392
|
+
| `slugify(text)` | URL-friendly slug |
|
|
393
|
+
| `maskString(value, options?)` | Mask sensitive strings |
|
|
394
|
+
| `normalizeWhitespace(text)` | Trim and collapse spaces |
|
|
395
|
+
| `initialsFromName(name)` | `"Jane Doe"` → `"JD"` |
|
|
396
|
+
| `removeDuplicates(items)` | Dedupe array |
|
|
397
|
+
| `removeDuplicateStrings(items)` | Dedupe string array |
|
|
398
|
+
| `findItemByProperty(items, key, value)` | Find item in array |
|
|
399
|
+
| `getLocalizedSplitText(text, locale?)` | Locale-aware text split |
|
|
400
|
+
|
|
401
|
+
### Validation
|
|
402
|
+
|
|
403
|
+
| Function | Description |
|
|
404
|
+
|---|---|
|
|
405
|
+
| `isValidEmail(email)` | Email format check |
|
|
406
|
+
| `isValidUrl(url)` | URL format check |
|
|
407
|
+
| `isValidPhone(phone)` | Phone format check |
|
|
408
|
+
| `isNumeric(value)` | Numeric string check |
|
|
409
|
+
| `isStrongPassword(password)` | Password strength rules |
|
|
410
|
+
| `encodePlusInEmail(email)` | Encode `+` in email |
|
|
411
|
+
|
|
412
|
+
### Backward-compatible aliases
|
|
413
|
+
|
|
414
|
+
Legacy names from app helpers are also exported: `getFrAmount`, `getFirstCap`, `getFormattedDate`, `getCurrentTime`, `generateCartSessionId`, `getTextByLanguage`, and others.
|
|
415
|
+
|
|
416
|
+
---
|
|
417
|
+
|
|
418
|
+
## Custom API Hooks
|
|
419
|
+
|
|
420
|
+
React hooks for data fetching with loading, error, and success states. No external dependencies.
|
|
421
|
+
|
|
422
|
+
| Hook | Use case |
|
|
423
|
+
|---|---|
|
|
424
|
+
| `useApi` | Auto-fetch on mount (GET) |
|
|
425
|
+
| `useLazyApi` | Manual fetch (search, button tap) |
|
|
426
|
+
| `useMutation` | POST / PUT / DELETE actions |
|
|
427
|
+
| `usePaginatedApi` | Infinite scroll / pagination |
|
|
428
|
+
| `usePollingApi` | Auto-refresh on interval |
|
|
429
|
+
|
|
430
|
+
### Utilities
|
|
431
|
+
|
|
432
|
+
| Export | Description |
|
|
433
|
+
|---|---|
|
|
434
|
+
| `ApiError` | Standard error with `status`, `code`, `details` |
|
|
435
|
+
| `toApiError(error)` | Normalize any error to `ApiError` |
|
|
436
|
+
| `getApiErrorMessage(error)` | Human-readable error message |
|
|
437
|
+
| `fetchJson(url, options?)` | Typed fetch wrapper |
|
|
438
|
+
|
|
439
|
+
```tsx
|
|
440
|
+
const { data, isLoading, isError, error, refetch } = useApi(
|
|
441
|
+
() => fetchJson<User[]>('/api/users'),
|
|
442
|
+
{ deps: [userId] }
|
|
443
|
+
);
|
|
444
|
+
|
|
445
|
+
const saveUser = useMutation((payload: CreateUserInput) =>
|
|
446
|
+
fetchJson('/api/users', { method: 'POST', body: JSON.stringify(payload) })
|
|
447
|
+
);
|
|
448
|
+
```
|
|
449
|
+
|
|
450
|
+
---
|
|
451
|
+
|
|
452
|
+
## TypeScript
|
|
453
|
+
|
|
454
|
+
Full TypeScript support. Import types alongside components:
|
|
455
|
+
|
|
456
|
+
```tsx
|
|
457
|
+
import {
|
|
458
|
+
CustomButton,
|
|
459
|
+
type ButtonVariant,
|
|
460
|
+
type CustomModalProps,
|
|
461
|
+
type SlideTabItem,
|
|
462
|
+
} from 'rn-custom-ui';
|
|
463
|
+
```
|
|
464
|
+
|
|
465
|
+
## Contributing
|
|
466
|
+
|
|
467
|
+
- [Development workflow](CONTRIBUTING.md#development-workflow)
|
|
468
|
+
- [Sending a pull request](CONTRIBUTING.md#sending-a-pull-request)
|
|
469
|
+
- [Code of conduct](CODE_OF_CONDUCT.md)
|
|
470
|
+
|
|
471
|
+
## License
|
|
472
|
+
|
|
473
|
+
MIT
|
|
474
|
+
|
|
475
|
+
---
|
|
476
|
+
|
|
477
|
+
Made with [create-react-native-library](https://github.com/callstack/react-native-builder-bob)
|
|
Binary file
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useMemo } from 'react';
|
|
4
|
+
import { Text, TouchableOpacity, View } from 'react-native';
|
|
5
|
+
import { shapeStyles, sizeStyles, styles, variantTheme } from "./styles.js";
|
|
6
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
7
|
+
const CustomCheckbox = ({
|
|
8
|
+
checked,
|
|
9
|
+
onChange,
|
|
10
|
+
indeterminate = false,
|
|
11
|
+
disabled = false,
|
|
12
|
+
error = false,
|
|
13
|
+
errorMessage,
|
|
14
|
+
label,
|
|
15
|
+
description,
|
|
16
|
+
children,
|
|
17
|
+
variant = 'default',
|
|
18
|
+
size = 'md',
|
|
19
|
+
shape = 'square',
|
|
20
|
+
labelPosition = 'right',
|
|
21
|
+
containerStyle,
|
|
22
|
+
boxStyle,
|
|
23
|
+
labelStyle,
|
|
24
|
+
descriptionStyle,
|
|
25
|
+
errorStyle,
|
|
26
|
+
accessibilityLabel
|
|
27
|
+
}) => {
|
|
28
|
+
const theme = variantTheme[variant];
|
|
29
|
+
const sizing = sizeStyles[size];
|
|
30
|
+
const isActive = checked || indeterminate;
|
|
31
|
+
const handlePress = () => {
|
|
32
|
+
if (disabled) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
onChange?.(!checked);
|
|
36
|
+
};
|
|
37
|
+
const boxStyles = useMemo(() => [styles.box, sizing.box, shapeStyles[shape], theme.box, isActive && theme.boxChecked, error && styles.boxError, boxStyle], [sizing.box, shape, theme.box, theme.boxChecked, isActive, error, boxStyle]);
|
|
38
|
+
const renderMark = () => {
|
|
39
|
+
if (indeterminate) {
|
|
40
|
+
return /*#__PURE__*/_jsx(View, {
|
|
41
|
+
style: [sizing.indeterminate, {
|
|
42
|
+
backgroundColor: theme.indeterminateColor
|
|
43
|
+
}]
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
if (!checked) {
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
return /*#__PURE__*/_jsx(Text, {
|
|
50
|
+
style: [sizing.check, {
|
|
51
|
+
color: theme.checkColor
|
|
52
|
+
}],
|
|
53
|
+
children: "\u2713"
|
|
54
|
+
});
|
|
55
|
+
};
|
|
56
|
+
const renderLabelContent = () => {
|
|
57
|
+
if (children) {
|
|
58
|
+
return children;
|
|
59
|
+
}
|
|
60
|
+
if (!label && !description) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
64
|
+
style: [styles.labelBlock, labelPosition === 'right' ? styles.labelBlockRight : styles.labelBlockLeft],
|
|
65
|
+
children: [!!label && /*#__PURE__*/_jsx(Text, {
|
|
66
|
+
style: [styles.label, sizing.label, theme.label, labelStyle],
|
|
67
|
+
children: label
|
|
68
|
+
}), !!description && /*#__PURE__*/_jsx(Text, {
|
|
69
|
+
style: [styles.description, descriptionStyle],
|
|
70
|
+
children: description
|
|
71
|
+
})]
|
|
72
|
+
});
|
|
73
|
+
};
|
|
74
|
+
const hasLabelContent = Boolean(children || label || description);
|
|
75
|
+
return /*#__PURE__*/_jsxs(View, {
|
|
76
|
+
style: styles.wrapper,
|
|
77
|
+
children: [/*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
78
|
+
activeOpacity: 0.7,
|
|
79
|
+
disabled: disabled,
|
|
80
|
+
style: [styles.container, labelPosition === 'left' && styles.containerLabelLeft, disabled && styles.containerDisabled, containerStyle],
|
|
81
|
+
accessibilityRole: "checkbox",
|
|
82
|
+
accessibilityState: {
|
|
83
|
+
checked: indeterminate ? 'mixed' : checked,
|
|
84
|
+
disabled
|
|
85
|
+
},
|
|
86
|
+
accessibilityLabel: accessibilityLabel ?? label,
|
|
87
|
+
onPress: handlePress,
|
|
88
|
+
children: [/*#__PURE__*/_jsx(View, {
|
|
89
|
+
style: boxStyles,
|
|
90
|
+
children: renderMark()
|
|
91
|
+
}), hasLabelContent && renderLabelContent()]
|
|
92
|
+
}), error && !!errorMessage && /*#__PURE__*/_jsx(Text, {
|
|
93
|
+
style: [styles.errorMessage, errorStyle],
|
|
94
|
+
children: errorMessage
|
|
95
|
+
})]
|
|
96
|
+
});
|
|
97
|
+
};
|
|
98
|
+
export default CustomCheckbox;
|
|
99
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useMemo","Text","TouchableOpacity","View","shapeStyles","sizeStyles","styles","variantTheme","jsx","_jsx","jsxs","_jsxs","CustomCheckbox","checked","onChange","indeterminate","disabled","error","errorMessage","label","description","children","variant","size","shape","labelPosition","containerStyle","boxStyle","labelStyle","descriptionStyle","errorStyle","accessibilityLabel","theme","sizing","isActive","handlePress","boxStyles","box","boxChecked","boxError","renderMark","style","backgroundColor","indeterminateColor","check","color","checkColor","renderLabelContent","labelBlock","labelBlockRight","labelBlockLeft","hasLabelContent","Boolean","wrapper","activeOpacity","container","containerLabelLeft","containerDisabled","accessibilityRole","accessibilityState","onPress"],"sourceRoot":"../../../../src","sources":["components/CustomCheckbox/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