@finspringinnovations/fdsdk 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +184 -0
- package/lib/api/applicationApi.d.ts +1 -0
- package/lib/api/applicationApi.js +11 -0
- package/lib/api/bankApi.d.ts +352 -0
- package/lib/api/bankApi.js +54 -0
- package/lib/api/baseApi.d.ts +8 -0
- package/lib/api/baseApi.js +456 -0
- package/lib/api/customerApi.d.ts +855 -0
- package/lib/api/customerApi.js +213 -0
- package/lib/api/fdApi.d.ts +979 -0
- package/lib/api/fdApi.js +112 -0
- package/lib/api/fdCalculatorApi.d.ts +179 -0
- package/lib/api/fdCalculatorApi.js +36 -0
- package/lib/api/index.d.ts +14 -0
- package/lib/api/index.js +45 -0
- package/lib/api/interestRateApi.d.ts +585 -0
- package/lib/api/interestRateApi.js +101 -0
- package/lib/api/kycApi.d.ts +486 -0
- package/lib/api/kycApi.js +71 -0
- package/lib/api/masterDataApi.d.ts +158 -0
- package/lib/api/masterDataApi.js +32 -0
- package/lib/api/nomineeApi.d.ts +325 -0
- package/lib/api/nomineeApi.js +46 -0
- package/lib/api/onboardingApi.d.ts +192 -0
- package/lib/api/onboardingApi.js +41 -0
- package/lib/api/panApi.d.ts +0 -0
- package/lib/api/panApi.js +23 -0
- package/lib/api/paymentApi.d.ts +325 -0
- package/lib/api/paymentApi.js +46 -0
- package/lib/api/workflowApi.d.ts +654 -0
- package/lib/api/workflowApi.js +90 -0
- package/lib/assets/images/images.d.ts +4 -0
- package/lib/assets/images/images.js +10 -0
- package/lib/components/AadhaarInput.d.ts +13 -0
- package/lib/components/AadhaarInput.js +47 -0
- package/lib/components/ActionButton.d.ts +12 -0
- package/lib/components/ActionButton.js +87 -0
- package/lib/components/ActiveFDCard.d.ts +16 -0
- package/lib/components/ActiveFDCard.js +95 -0
- package/lib/components/AmountInput.d.ts +20 -0
- package/lib/components/AmountInput.js +144 -0
- package/lib/components/CheckboxOption.d.ts +11 -0
- package/lib/components/CheckboxOption.js +41 -0
- package/lib/components/CompanyHeader.d.ts +7 -0
- package/lib/components/CompanyHeader.js +57 -0
- package/lib/components/DropdownSelector.d.ts +9 -0
- package/lib/components/DropdownSelector.js +49 -0
- package/lib/components/EmptyState.d.ts +17 -0
- package/lib/components/EmptyState.js +44 -0
- package/lib/components/ErrorDisplay.d.ts +17 -0
- package/lib/components/ErrorDisplay.js +69 -0
- package/lib/components/FAQItem.d.ts +9 -0
- package/lib/components/FAQItem.js +52 -0
- package/lib/components/FDCard.d.ts +21 -0
- package/lib/components/FDCard.js +96 -0
- package/lib/components/FormDropdown.d.ts +18 -0
- package/lib/components/FormDropdown.js +155 -0
- package/lib/components/FormSection.d.ts +14 -0
- package/lib/components/FormSection.js +38 -0
- package/lib/components/Header.d.ts +14 -0
- package/lib/components/Header.js +52 -0
- package/lib/components/IFSCSearchResultCard.d.ts +13 -0
- package/lib/components/IFSCSearchResultCard.js +70 -0
- package/lib/components/InfoBox.d.ts +8 -0
- package/lib/components/InfoBox.js +39 -0
- package/lib/components/InterestRateCard.d.ts +8 -0
- package/lib/components/InterestRateCard.js +46 -0
- package/lib/components/LoadingIndicator.d.ts +12 -0
- package/lib/components/LoadingIndicator.js +30 -0
- package/lib/components/OTPInput.d.ts +17 -0
- package/lib/components/OTPInput.js +144 -0
- package/lib/components/PaymentDetailsCard.d.ts +20 -0
- package/lib/components/PaymentDetailsCard.js +68 -0
- package/lib/components/PendingFDBottomSheet.d.ts +18 -0
- package/lib/components/PendingFDBottomSheet.js +122 -0
- package/lib/components/SafeAreaWrapper.d.ts +13 -0
- package/lib/components/SafeAreaWrapper.js +41 -0
- package/lib/components/ScreenHeader.d.ts +11 -0
- package/lib/components/ScreenHeader.js +46 -0
- package/lib/components/StatusDisplay.d.ts +15 -0
- package/lib/components/StatusDisplay.js +88 -0
- package/lib/components/TextFieldWithLabel.d.ts +46 -0
- package/lib/components/TextFieldWithLabel.js +326 -0
- package/lib/components/TrustBox.d.ts +8 -0
- package/lib/components/TrustBox.js +45 -0
- package/lib/components/ValidationErrorAlert.d.ts +23 -0
- package/lib/components/ValidationErrorAlert.js +39 -0
- package/lib/components/ValidationMessage.d.ts +9 -0
- package/lib/components/ValidationMessage.js +98 -0
- package/lib/components/index.d.ts +35 -0
- package/lib/components/index.js +64 -0
- package/lib/config/apiConfig.d.ts +34 -0
- package/lib/config/apiConfig.js +158 -0
- package/lib/config/appDataConfig.d.ts +114 -0
- package/lib/config/appDataConfig.js +264 -0
- package/lib/config/encryptionConfig.d.ts +21 -0
- package/lib/config/encryptionConfig.js +61 -0
- package/lib/config/workflowConstants.d.ts +37 -0
- package/lib/config/workflowConstants.js +38 -0
- package/lib/constants/strings/bank.d.ts +72 -0
- package/lib/constants/strings/bank.js +86 -0
- package/lib/constants/strings/base64Images.d.ts +25 -0
- package/lib/constants/strings/base64Images.js +28 -0
- package/lib/constants/strings/common.d.ts +53 -0
- package/lib/constants/strings/common.js +62 -0
- package/lib/constants/strings/employee.d.ts +61 -0
- package/lib/constants/strings/employee.js +77 -0
- package/lib/constants/strings/faq.d.ts +14 -0
- package/lib/constants/strings/faq.js +20 -0
- package/lib/constants/strings/fd.d.ts +122 -0
- package/lib/constants/strings/fd.js +151 -0
- package/lib/constants/strings/home.d.ts +49 -0
- package/lib/constants/strings/home.js +62 -0
- package/lib/constants/strings/index.d.ts +16 -0
- package/lib/constants/strings/index.js +44 -0
- package/lib/constants/strings/kyc.d.ts +80 -0
- package/lib/constants/strings/kyc.js +94 -0
- package/lib/constants/strings/nominee.d.ts +64 -0
- package/lib/constants/strings/nominee.js +81 -0
- package/lib/hooks/useAuth.d.ts +25 -0
- package/lib/hooks/useAuth.js +39 -0
- package/lib/hooks/useFDData.d.ts +11 -0
- package/lib/hooks/useFDData.js +40 -0
- package/lib/index.d.ts +69 -0
- package/lib/index.js +182 -0
- package/lib/navigation/RootNavigator.d.ts +8 -0
- package/lib/navigation/RootNavigator.js +205 -0
- package/lib/navigation/SimpleNavigator.d.ts +11 -0
- package/lib/navigation/SimpleNavigator.js +107 -0
- package/lib/navigation/helpers.d.ts +11 -0
- package/lib/navigation/helpers.js +83 -0
- package/lib/navigation/index.d.ts +15 -0
- package/lib/navigation/index.js +42 -0
- package/lib/navigation/types.d.ts +113 -0
- package/lib/navigation/types.js +2 -0
- package/lib/navigation/workflowNavigator.d.ts +22 -0
- package/lib/navigation/workflowNavigator.js +104 -0
- package/lib/providers/ApiProvider.d.ts +7 -0
- package/lib/providers/ApiProvider.js +34 -0
- package/lib/providers/MasterDataProvider.d.ts +10 -0
- package/lib/providers/MasterDataProvider.js +54 -0
- package/lib/screens/AadhaarVerification.d.ts +7 -0
- package/lib/screens/AadhaarVerification.js +627 -0
- package/lib/screens/AddBankAccount.d.ts +22 -0
- package/lib/screens/AddBankAccount.js +381 -0
- package/lib/screens/BankDetail.d.ts +16 -0
- package/lib/screens/BankDetail.js +596 -0
- package/lib/screens/BookFD.d.ts +0 -0
- package/lib/screens/BookFD.js +315 -0
- package/lib/screens/Employee.d.ts +18 -0
- package/lib/screens/Employee.js +594 -0
- package/lib/screens/FDCalculator.d.ts +18 -0
- package/lib/screens/FDCalculator.js +759 -0
- package/lib/screens/FDList.d.ts +27 -0
- package/lib/screens/FDList.js +1008 -0
- package/lib/screens/FindIFSC.d.ts +16 -0
- package/lib/screens/FindIFSC.js +248 -0
- package/lib/screens/Home.d.ts +0 -0
- package/lib/screens/Home.js +143 -0
- package/lib/screens/NomineeDetail.d.ts +17 -0
- package/lib/screens/NomineeDetail.js +592 -0
- package/lib/screens/PayNow.d.ts +14 -0
- package/lib/screens/PayNow.js +230 -0
- package/lib/screens/Payment.d.ts +11 -0
- package/lib/screens/Payment.js +191 -0
- package/lib/screens/PaymentStatus.d.ts +16 -0
- package/lib/screens/PaymentStatus.js +397 -0
- package/lib/screens/ReviewKYC.d.ts +21 -0
- package/lib/screens/ReviewKYC.js +660 -0
- package/lib/state/paymentSession.d.ts +8 -0
- package/lib/state/paymentSession.js +13 -0
- package/lib/store/fdListSelectedSlice.d.ts +21 -0
- package/lib/store/fdListSelectedSlice.js +26 -0
- package/lib/store/hooks.d.ts +8 -0
- package/lib/store/hooks.js +31 -0
- package/lib/store/index.d.ts +3 -0
- package/lib/store/index.js +8 -0
- package/lib/store/onboardingSlice.d.ts +12 -0
- package/lib/store/onboardingSlice.js +32 -0
- package/lib/store/store.d.ts +13 -0
- package/lib/store/store.js +33 -0
- package/lib/theme/ThemeContext.d.ts +210 -0
- package/lib/theme/ThemeContext.js +90 -0
- package/lib/theme/colors.d.ts +80 -0
- package/lib/theme/colors.js +85 -0
- package/lib/theme/index.d.ts +34 -0
- package/lib/theme/index.js +69 -0
- package/lib/theme/shadows.d.ts +53 -0
- package/lib/theme/shadows.js +58 -0
- package/lib/theme/typography.d.ts +134 -0
- package/lib/theme/typography.js +143 -0
- package/lib/types/dataTypes.d.ts +34 -0
- package/lib/types/dataTypes.js +2 -0
- package/lib/types/workflowTypes.d.ts +2 -0
- package/lib/types/workflowTypes.js +2 -0
- package/lib/utils/apiLogger.d.ts +48 -0
- package/lib/utils/apiLogger.js +105 -0
- package/lib/utils/encryption.d.ts +28 -0
- package/lib/utils/encryption.js +113 -0
- package/lib/utils/getFDData.d.ts +48 -0
- package/lib/utils/getFDData.js +154 -0
- package/lib/utils/globalData.d.ts +2 -0
- package/lib/utils/globalData.js +10 -0
- package/package.json +76 -0
- package/src/api/applicationApi.ts +12 -0
- package/src/api/bankApi.ts +42 -0
- package/src/api/baseApi.ts +513 -0
- package/src/api/customerApi.ts +291 -0
- package/src/api/fdApi.ts +150 -0
- package/src/api/fdCalculatorApi.ts +41 -0
- package/src/api/index.ts +29 -0
- package/src/api/interestRateApi.ts +143 -0
- package/src/api/kycApi.ts +63 -0
- package/src/api/masterDataApi.ts +34 -0
- package/src/api/nomineeApi.ts +34 -0
- package/src/api/onboardingApi.ts +64 -0
- package/src/api/panApi.ts +25 -0
- package/src/api/paymentApi.ts +34 -0
- package/src/api/workflowApi.ts +94 -0
- package/src/assets/images/arrow-filled.png +0 -0
- package/src/assets/images/arrow-left.png +0 -0
- package/src/assets/images/backicon.png +0 -0
- package/src/assets/images/calendar.png +0 -0
- package/src/assets/images/chevron-down.png +0 -0
- package/src/assets/images/chevron-down@2x.png +0 -0
- package/src/assets/images/chevron-down@3x.png +0 -0
- package/src/assets/images/images.js +8 -0
- package/src/components/AadhaarInput.tsx +91 -0
- package/src/components/ActionButton.tsx +129 -0
- package/src/components/ActiveFDCard.tsx +158 -0
- package/src/components/AmountInput.tsx +217 -0
- package/src/components/CheckboxOption.tsx +93 -0
- package/src/components/CompanyHeader.tsx +78 -0
- package/src/components/DropdownSelector.tsx +77 -0
- package/src/components/EmptyState.tsx +109 -0
- package/src/components/ErrorDisplay.tsx +135 -0
- package/src/components/FAQItem.tsx +90 -0
- package/src/components/FDCard.tsx +165 -0
- package/src/components/FormDropdown.tsx +214 -0
- package/src/components/FormSection.tsx +86 -0
- package/src/components/Header.tsx +110 -0
- package/src/components/IFSCSearchResultCard.tsx +139 -0
- package/src/components/InfoBox.tsx +55 -0
- package/src/components/InterestRateCard.tsx +77 -0
- package/src/components/LoadingIndicator.tsx +63 -0
- package/src/components/OTPInput.tsx +213 -0
- package/src/components/PaymentDetailsCard.tsx +120 -0
- package/src/components/PendingFDBottomSheet.tsx +235 -0
- package/src/components/README.md +210 -0
- package/src/components/SafeAreaWrapper.tsx +68 -0
- package/src/components/ScreenHeader.tsx +83 -0
- package/src/components/StatusDisplay.tsx +139 -0
- package/src/components/TextFieldWithLabel.tsx +502 -0
- package/src/components/TrustBox.tsx +63 -0
- package/src/components/ValidationErrorAlert.tsx +57 -0
- package/src/components/ValidationMessage.tsx +134 -0
- package/src/components/index.tsx +47 -0
- package/src/config/apiConfig.ts +217 -0
- package/src/config/appDataConfig.ts +279 -0
- package/src/config/encryptionConfig.ts +65 -0
- package/src/config/workflowConstants.ts +43 -0
- package/src/constants/strings/README.md +146 -0
- package/src/constants/strings/bank.ts +92 -0
- package/src/constants/strings/base64Images.ts +29 -0
- package/src/constants/strings/common.ts +63 -0
- package/src/constants/strings/employee.ts +85 -0
- package/src/constants/strings/faq.ts +23 -0
- package/src/constants/strings/fd.ts +172 -0
- package/src/constants/strings/home.ts +67 -0
- package/src/constants/strings/index.ts +21 -0
- package/src/constants/strings/kyc.ts +100 -0
- package/src/constants/strings/nominee.ts +90 -0
- package/src/hooks/useAuth.ts +42 -0
- package/src/hooks/useFDData.ts +48 -0
- package/src/index.tsx +173 -0
- package/src/navigation/RootNavigator.tsx +352 -0
- package/src/navigation/SimpleNavigator.tsx +107 -0
- package/src/navigation/helpers.ts +85 -0
- package/src/navigation/index.tsx +81 -0
- package/src/navigation/types.ts +124 -0
- package/src/navigation/workflowNavigator.ts +131 -0
- package/src/providers/ApiProvider.tsx +43 -0
- package/src/providers/MasterDataProvider.tsx +30 -0
- package/src/screens/AadhaarVerification.tsx +809 -0
- package/src/screens/AddBankAccount.tsx +541 -0
- package/src/screens/BankDetail.tsx +826 -0
- package/src/screens/BookFD.tsx +330 -0
- package/src/screens/Employee.tsx +822 -0
- package/src/screens/FDCalculator.tsx +987 -0
- package/src/screens/FDList.tsx +1284 -0
- package/src/screens/FindIFSC.tsx +332 -0
- package/src/screens/Home.tsx +152 -0
- package/src/screens/NomineeDetail.tsx +800 -0
- package/src/screens/PayNow.tsx +282 -0
- package/src/screens/Payment.tsx +224 -0
- package/src/screens/PaymentStatus.tsx +561 -0
- package/src/screens/ReviewKYC.tsx +956 -0
- package/src/state/paymentSession.ts +13 -0
- package/src/store/fdListSelectedSlice.ts +42 -0
- package/src/store/hooks.ts +27 -0
- package/src/store/index.ts +3 -0
- package/src/store/onboardingSlice.ts +37 -0
- package/src/store/store.ts +35 -0
- package/src/theme/ThemeContext.tsx +82 -0
- package/src/theme/colors.ts +90 -0
- package/src/theme/index.ts +64 -0
- package/src/theme/shadows.ts +61 -0
- package/src/theme/typography.ts +151 -0
- package/src/types/dataTypes.ts +37 -0
- package/src/types/env.d.ts +93 -0
- package/src/types/workflowTypes.ts +12 -0
- package/src/utils/apiLogger.ts +166 -0
- package/src/utils/encryption.ts +159 -0
- package/src/utils/getFDData.ts +175 -0
- package/src/utils/globalData.ts +7 -0
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
# Reusable Components Library
|
|
2
|
+
|
|
3
|
+
This document provides an overview of the reusable components available in the Shriram SDK, following coding standards and best practices.
|
|
4
|
+
|
|
5
|
+
## Form Components
|
|
6
|
+
|
|
7
|
+
### FormDropdown
|
|
8
|
+
A reusable dropdown component for form inputs with consistent styling and behavior.
|
|
9
|
+
|
|
10
|
+
**Features:**
|
|
11
|
+
- Consistent styling with theme integration
|
|
12
|
+
- Support for required fields and validation
|
|
13
|
+
- Disabled state support
|
|
14
|
+
- Customizable styling options
|
|
15
|
+
- Accessibility support with testID
|
|
16
|
+
|
|
17
|
+
**Usage:**
|
|
18
|
+
```tsx
|
|
19
|
+
<FormDropdown
|
|
20
|
+
label="Account Type"
|
|
21
|
+
value={selectedValue}
|
|
22
|
+
options={['Saving', 'Current', 'Fixed Deposit']}
|
|
23
|
+
onSelect={handleSelect}
|
|
24
|
+
placeholder="Select account type"
|
|
25
|
+
required={true}
|
|
26
|
+
error={validationError}
|
|
27
|
+
/>
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### FormSection
|
|
31
|
+
A container component for organizing form fields into logical sections.
|
|
32
|
+
|
|
33
|
+
**Features:**
|
|
34
|
+
- Optional title and subtitle
|
|
35
|
+
- Consistent spacing and layout
|
|
36
|
+
- Optional divider support
|
|
37
|
+
- Customizable styling
|
|
38
|
+
|
|
39
|
+
**Usage:**
|
|
40
|
+
```tsx
|
|
41
|
+
<FormSection
|
|
42
|
+
title="Personal Information"
|
|
43
|
+
subtitle="Please provide your personal details"
|
|
44
|
+
showDivider={true}
|
|
45
|
+
>
|
|
46
|
+
<TextFieldWithLabel label="Name" value={name} onChangeText={setName} />
|
|
47
|
+
<TextFieldWithLabel label="Email" value={email} onChangeText={setEmail} />
|
|
48
|
+
</FormSection>
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
## Status and Display Components
|
|
52
|
+
|
|
53
|
+
### StatusDisplay
|
|
54
|
+
A reusable component for displaying status information with icons and messages.
|
|
55
|
+
|
|
56
|
+
**Features:**
|
|
57
|
+
- Support for success, error, warning, and info states
|
|
58
|
+
- Customizable icons and colors
|
|
59
|
+
- Consistent styling across the app
|
|
60
|
+
- Optional subtitle support
|
|
61
|
+
|
|
62
|
+
**Usage:**
|
|
63
|
+
```tsx
|
|
64
|
+
<StatusDisplay
|
|
65
|
+
status="success"
|
|
66
|
+
title="Payment Successful"
|
|
67
|
+
subtitle="Your transaction has been completed"
|
|
68
|
+
showIcon={true}
|
|
69
|
+
/>
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
### LoadingIndicator
|
|
73
|
+
A reusable loading indicator with optional message and overlay support.
|
|
74
|
+
|
|
75
|
+
**Features:**
|
|
76
|
+
- Small and large size options
|
|
77
|
+
- Customizable colors
|
|
78
|
+
- Optional overlay mode
|
|
79
|
+
- Customizable messages
|
|
80
|
+
|
|
81
|
+
**Usage:**
|
|
82
|
+
```tsx
|
|
83
|
+
<LoadingIndicator
|
|
84
|
+
message="Loading your data..."
|
|
85
|
+
size="large"
|
|
86
|
+
overlay={true}
|
|
87
|
+
/>
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
### ErrorDisplay
|
|
91
|
+
A reusable error display component with retry functionality.
|
|
92
|
+
|
|
93
|
+
**Features:**
|
|
94
|
+
- Support for error, warning, and info variants
|
|
95
|
+
- Optional retry button
|
|
96
|
+
- Customizable icons and messages
|
|
97
|
+
- Consistent error styling
|
|
98
|
+
|
|
99
|
+
**Usage:**
|
|
100
|
+
```tsx
|
|
101
|
+
<ErrorDisplay
|
|
102
|
+
title="Connection Error"
|
|
103
|
+
message="Unable to connect to the server"
|
|
104
|
+
onRetry={handleRetry}
|
|
105
|
+
retryText="Try Again"
|
|
106
|
+
variant="error"
|
|
107
|
+
/>
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### EmptyState
|
|
111
|
+
A reusable component for displaying empty states with optional actions.
|
|
112
|
+
|
|
113
|
+
**Features:**
|
|
114
|
+
- Customizable icons and messages
|
|
115
|
+
- Optional action button
|
|
116
|
+
- Consistent empty state styling
|
|
117
|
+
- Flexible content layout
|
|
118
|
+
|
|
119
|
+
**Usage:**
|
|
120
|
+
```tsx
|
|
121
|
+
<EmptyState
|
|
122
|
+
iconName="document-outline"
|
|
123
|
+
title="No Data Available"
|
|
124
|
+
subtitle="There are no items to display at the moment"
|
|
125
|
+
actionText="Add New Item"
|
|
126
|
+
onAction={handleAddNew}
|
|
127
|
+
/>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
## Payment Components
|
|
131
|
+
|
|
132
|
+
### PaymentDetailsCard
|
|
133
|
+
A reusable card component for displaying payment and FD details.
|
|
134
|
+
|
|
135
|
+
**Features:**
|
|
136
|
+
- Consistent payment information layout
|
|
137
|
+
- Optional company line separator
|
|
138
|
+
- Customizable styling
|
|
139
|
+
- Theme integration
|
|
140
|
+
|
|
141
|
+
**Usage:**
|
|
142
|
+
```tsx
|
|
143
|
+
<PaymentDetailsCard
|
|
144
|
+
companyName="Shriram Finance Ltd"
|
|
145
|
+
amount={25000}
|
|
146
|
+
fdRate="8.35% p.a."
|
|
147
|
+
tenure="3 Y 9 M"
|
|
148
|
+
interestPayout="Yearly"
|
|
149
|
+
showCompanyLine={true}
|
|
150
|
+
/>
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Design Principles
|
|
154
|
+
|
|
155
|
+
### 1. Consistency
|
|
156
|
+
All components follow the same design patterns and use the theme system for consistent styling.
|
|
157
|
+
|
|
158
|
+
### 2. Accessibility
|
|
159
|
+
Components include proper accessibility support with testID props and semantic markup.
|
|
160
|
+
|
|
161
|
+
### 3. Flexibility
|
|
162
|
+
Components are designed to be flexible with extensive customization options through props.
|
|
163
|
+
|
|
164
|
+
### 4. Type Safety
|
|
165
|
+
All components are fully typed with TypeScript interfaces for better development experience.
|
|
166
|
+
|
|
167
|
+
### 5. Theme Integration
|
|
168
|
+
Components automatically use the current theme colors, typography, and spacing.
|
|
169
|
+
|
|
170
|
+
## Best Practices
|
|
171
|
+
|
|
172
|
+
### 1. Component Composition
|
|
173
|
+
Use smaller, focused components to build larger, more complex UIs.
|
|
174
|
+
|
|
175
|
+
### 2. Props Design
|
|
176
|
+
- Use clear, descriptive prop names
|
|
177
|
+
- Provide sensible defaults
|
|
178
|
+
- Use TypeScript interfaces for type safety
|
|
179
|
+
- Group related props logically
|
|
180
|
+
|
|
181
|
+
### 3. Styling
|
|
182
|
+
- Use the theme system for all styling
|
|
183
|
+
- Provide customization options through style props
|
|
184
|
+
- Maintain consistent spacing and typography
|
|
185
|
+
|
|
186
|
+
### 4. State Management
|
|
187
|
+
- Keep components stateless when possible
|
|
188
|
+
- Use controlled components for form inputs
|
|
189
|
+
- Handle loading and error states appropriately
|
|
190
|
+
|
|
191
|
+
### 5. Performance
|
|
192
|
+
- Use React.memo for expensive components
|
|
193
|
+
- Implement proper key props for lists
|
|
194
|
+
- Avoid unnecessary re-renders
|
|
195
|
+
|
|
196
|
+
## Usage Guidelines
|
|
197
|
+
|
|
198
|
+
1. **Import from index**: Always import components from the main index file
|
|
199
|
+
2. **Use theme hooks**: Use `useColors()` and `useTypography()` for consistent styling
|
|
200
|
+
3. **Handle errors**: Always provide error handling and loading states
|
|
201
|
+
4. **Test thoroughly**: Write tests for component behavior and edge cases
|
|
202
|
+
5. **Document props**: Keep component documentation up to date
|
|
203
|
+
|
|
204
|
+
## Future Enhancements
|
|
205
|
+
|
|
206
|
+
- Animation support for status transitions
|
|
207
|
+
- More form input components (date picker, file upload, etc.)
|
|
208
|
+
- Advanced layout components (grid, masonry, etc.)
|
|
209
|
+
- Enhanced accessibility features
|
|
210
|
+
- Storybook integration for component documentation
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, StyleSheet, ViewStyle, StatusBar } from 'react-native';
|
|
3
|
+
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
+
import { useColors, useTheme } from '../theme/ThemeContext';
|
|
5
|
+
|
|
6
|
+
interface SafeAreaWrapperProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
style?: ViewStyle;
|
|
9
|
+
includeTop?: boolean;
|
|
10
|
+
includeBottom?: boolean;
|
|
11
|
+
bottomPadding?: number;
|
|
12
|
+
statusBarColor?: string;
|
|
13
|
+
statusBarStyle?: 'default' | 'light-content' | 'dark-content';
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const SafeAreaWrapper: React.FC<SafeAreaWrapperProps> = ({
|
|
17
|
+
children,
|
|
18
|
+
style,
|
|
19
|
+
includeTop = true,
|
|
20
|
+
includeBottom = true,
|
|
21
|
+
bottomPadding = 20,
|
|
22
|
+
statusBarColor,
|
|
23
|
+
statusBarStyle,
|
|
24
|
+
}) => {
|
|
25
|
+
const insets = useSafeAreaInsets();
|
|
26
|
+
const colors = useColors();
|
|
27
|
+
const { themeName } = useTheme();
|
|
28
|
+
|
|
29
|
+
// Determine status bar style based on theme if not explicitly provided
|
|
30
|
+
// Use light-content for dark backgrounds (black or very dark colors)
|
|
31
|
+
const defaultStatusBarStyle = colors.background === '#000000'
|
|
32
|
+
? 'light-content'
|
|
33
|
+
: 'dark-content';
|
|
34
|
+
|
|
35
|
+
const finalStatusBarStyle = statusBarStyle || defaultStatusBarStyle;
|
|
36
|
+
const finalStatusBarColor = statusBarColor || colors.background;
|
|
37
|
+
|
|
38
|
+
const containerStyle = [
|
|
39
|
+
styles.container,
|
|
40
|
+
{
|
|
41
|
+
backgroundColor: colors.background,
|
|
42
|
+
paddingTop: includeTop ? insets.top : 0,
|
|
43
|
+
paddingBottom: includeBottom ? insets.bottom + bottomPadding : 0,
|
|
44
|
+
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
45
|
+
borderBottomColor: themeName === 'dark' ? '#000000' : '#ffffff',
|
|
46
|
+
},
|
|
47
|
+
style,
|
|
48
|
+
];
|
|
49
|
+
|
|
50
|
+
return (
|
|
51
|
+
<>
|
|
52
|
+
<StatusBar
|
|
53
|
+
backgroundColor={finalStatusBarColor}
|
|
54
|
+
barStyle={finalStatusBarStyle}
|
|
55
|
+
translucent={false}
|
|
56
|
+
/>
|
|
57
|
+
<View style={containerStyle}>{children}</View>
|
|
58
|
+
</>
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
const styles = StyleSheet.create({
|
|
63
|
+
container: {
|
|
64
|
+
flex: 1,
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
export default SafeAreaWrapper;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, TouchableOpacity, StyleSheet, Image } from 'react-native';
|
|
3
|
+
import { base64Images } from '../constants/strings/base64Images';
|
|
4
|
+
import { useColors, useTypography } from '../theme/ThemeContext';
|
|
5
|
+
|
|
6
|
+
export interface ScreenHeaderProps {
|
|
7
|
+
title: string;
|
|
8
|
+
onGoBack?: () => void;
|
|
9
|
+
showBackButton?: boolean;
|
|
10
|
+
rightComponent?: React.ReactNode;
|
|
11
|
+
backgroundColor?: string;
|
|
12
|
+
textColor?: string;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
const ScreenHeader: React.FC<ScreenHeaderProps> = ({
|
|
16
|
+
title,
|
|
17
|
+
onGoBack,
|
|
18
|
+
showBackButton = true,
|
|
19
|
+
rightComponent,
|
|
20
|
+
backgroundColor,
|
|
21
|
+
textColor = 'white',
|
|
22
|
+
}) => {
|
|
23
|
+
const colors = useColors();
|
|
24
|
+
const typography = useTypography();
|
|
25
|
+
const styles = createStyles(colors, typography, backgroundColor, textColor);
|
|
26
|
+
|
|
27
|
+
return (
|
|
28
|
+
<View style={styles.header}>
|
|
29
|
+
{showBackButton ? (
|
|
30
|
+
<TouchableOpacity onPress={onGoBack} style={styles.backButton}>
|
|
31
|
+
<Image
|
|
32
|
+
source={{ uri: base64Images.backArrow }}
|
|
33
|
+
style={[styles.backIcon, { tintColor: textColor }]}
|
|
34
|
+
resizeMode="contain"
|
|
35
|
+
/>
|
|
36
|
+
</TouchableOpacity>
|
|
37
|
+
) : (
|
|
38
|
+
<View style={styles.backButton} />
|
|
39
|
+
)}
|
|
40
|
+
|
|
41
|
+
<Text style={styles.headerTitle}>{title}</Text>
|
|
42
|
+
|
|
43
|
+
<View style={styles.rightContainer}>
|
|
44
|
+
{rightComponent || <View style={styles.placeholder} />}
|
|
45
|
+
</View>
|
|
46
|
+
</View>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const createStyles = (colors: any, typography: any, backgroundColor?: string, textColor?: string) => StyleSheet.create({
|
|
51
|
+
header: {
|
|
52
|
+
flexDirection: 'row',
|
|
53
|
+
alignItems: 'center',
|
|
54
|
+
justifyContent: 'space-between',
|
|
55
|
+
paddingHorizontal: 16,
|
|
56
|
+
paddingVertical: 16,
|
|
57
|
+
backgroundColor: backgroundColor || colors.primary,
|
|
58
|
+
},
|
|
59
|
+
backButton: {
|
|
60
|
+
padding: 8,
|
|
61
|
+
minWidth: 40,
|
|
62
|
+
},
|
|
63
|
+
backIcon: {
|
|
64
|
+
width: 24,
|
|
65
|
+
height: 24,
|
|
66
|
+
},
|
|
67
|
+
headerTitle: {
|
|
68
|
+
...typography.styles.h3,
|
|
69
|
+
color: textColor || 'white',
|
|
70
|
+
fontWeight: '600',
|
|
71
|
+
flex: 1,
|
|
72
|
+
textAlign: 'center',
|
|
73
|
+
},
|
|
74
|
+
rightContainer: {
|
|
75
|
+
minWidth: 40,
|
|
76
|
+
alignItems: 'flex-end',
|
|
77
|
+
},
|
|
78
|
+
placeholder: {
|
|
79
|
+
width: 40,
|
|
80
|
+
},
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
export default ScreenHeader;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { View, Text, StyleSheet } from 'react-native';
|
|
3
|
+
import Icon from 'react-native-vector-icons/Ionicons';
|
|
4
|
+
import { useColors, useTypography } from '../theme/ThemeContext';
|
|
5
|
+
|
|
6
|
+
export interface StatusDisplayProps {
|
|
7
|
+
status: 'success' | 'error' | 'warning' | 'info';
|
|
8
|
+
title: string;
|
|
9
|
+
subtitle?: string;
|
|
10
|
+
iconName?: string;
|
|
11
|
+
iconSize?: number;
|
|
12
|
+
showIcon?: boolean;
|
|
13
|
+
containerStyle?: object;
|
|
14
|
+
titleStyle?: object;
|
|
15
|
+
subtitleStyle?: object;
|
|
16
|
+
iconContainerStyle?: object;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const StatusDisplay: React.FC<StatusDisplayProps> = ({
|
|
20
|
+
status,
|
|
21
|
+
title,
|
|
22
|
+
subtitle,
|
|
23
|
+
iconName,
|
|
24
|
+
iconSize = 48,
|
|
25
|
+
showIcon = true,
|
|
26
|
+
containerStyle,
|
|
27
|
+
titleStyle,
|
|
28
|
+
subtitleStyle,
|
|
29
|
+
iconContainerStyle,
|
|
30
|
+
}) => {
|
|
31
|
+
const colors = useColors();
|
|
32
|
+
const typography = useTypography();
|
|
33
|
+
const styles = createStyles(colors, typography, status);
|
|
34
|
+
|
|
35
|
+
const getStatusConfig = () => {
|
|
36
|
+
switch (status) {
|
|
37
|
+
case 'success':
|
|
38
|
+
return {
|
|
39
|
+
icon: iconName || 'checkmark',
|
|
40
|
+
color: '#4CAF50',
|
|
41
|
+
bgColor: 'rgba(76, 175, 80, 0.1)',
|
|
42
|
+
innerBgColor: 'rgba(76, 175, 80, 0.2)',
|
|
43
|
+
};
|
|
44
|
+
case 'error':
|
|
45
|
+
return {
|
|
46
|
+
icon: iconName || 'alert',
|
|
47
|
+
color: '#F44336',
|
|
48
|
+
bgColor: 'rgba(244, 67, 54, 0.1)',
|
|
49
|
+
innerBgColor: 'rgba(244, 67, 54, 0.2)',
|
|
50
|
+
};
|
|
51
|
+
case 'warning':
|
|
52
|
+
return {
|
|
53
|
+
icon: iconName || 'warning',
|
|
54
|
+
color: '#FF9800',
|
|
55
|
+
bgColor: 'rgba(255, 152, 0, 0.1)',
|
|
56
|
+
innerBgColor: 'rgba(255, 152, 0, 0.2)',
|
|
57
|
+
};
|
|
58
|
+
case 'info':
|
|
59
|
+
return {
|
|
60
|
+
icon: iconName || 'information',
|
|
61
|
+
color: '#2196F3',
|
|
62
|
+
bgColor: 'rgba(33, 150, 243, 0.1)',
|
|
63
|
+
innerBgColor: 'rgba(33, 150, 243, 0.2)',
|
|
64
|
+
};
|
|
65
|
+
default:
|
|
66
|
+
return {
|
|
67
|
+
icon: iconName || 'information',
|
|
68
|
+
color: '#2196F3',
|
|
69
|
+
bgColor: 'rgba(33, 150, 243, 0.1)',
|
|
70
|
+
innerBgColor: 'rgba(33, 150, 243, 0.2)',
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
|
|
75
|
+
const statusConfig = getStatusConfig();
|
|
76
|
+
|
|
77
|
+
return (
|
|
78
|
+
<View style={[styles.container, containerStyle]}>
|
|
79
|
+
{/* Icon */}
|
|
80
|
+
{showIcon && (
|
|
81
|
+
<View style={[styles.iconContainer, iconContainerStyle]}>
|
|
82
|
+
<View style={[styles.iconCircleOuter, { backgroundColor: statusConfig.bgColor }]}>
|
|
83
|
+
<View style={[styles.iconCircleInner, { backgroundColor: statusConfig.innerBgColor }]}>
|
|
84
|
+
<Icon name={statusConfig.icon} size={iconSize} color={statusConfig.color} />
|
|
85
|
+
</View>
|
|
86
|
+
</View>
|
|
87
|
+
</View>
|
|
88
|
+
)}
|
|
89
|
+
|
|
90
|
+
{/* Title */}
|
|
91
|
+
<Text style={[styles.title, titleStyle]}>{title}</Text>
|
|
92
|
+
|
|
93
|
+
{/* Subtitle */}
|
|
94
|
+
{subtitle && (
|
|
95
|
+
<Text style={[styles.subtitle, subtitleStyle]}>{subtitle}</Text>
|
|
96
|
+
)}
|
|
97
|
+
</View>
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
const createStyles = (colors: any, typography: any, status: string) => StyleSheet.create({
|
|
102
|
+
container: {
|
|
103
|
+
alignItems: 'center',
|
|
104
|
+
paddingVertical: 20,
|
|
105
|
+
},
|
|
106
|
+
iconContainer: {
|
|
107
|
+
alignItems: 'center',
|
|
108
|
+
marginBottom: 24,
|
|
109
|
+
},
|
|
110
|
+
iconCircleOuter: {
|
|
111
|
+
width: 120,
|
|
112
|
+
height: 120,
|
|
113
|
+
borderRadius: 60,
|
|
114
|
+
alignItems: 'center',
|
|
115
|
+
justifyContent: 'center',
|
|
116
|
+
},
|
|
117
|
+
iconCircleInner: {
|
|
118
|
+
width: 60,
|
|
119
|
+
height: 60,
|
|
120
|
+
borderRadius: 30,
|
|
121
|
+
alignItems: 'center',
|
|
122
|
+
justifyContent: 'center',
|
|
123
|
+
},
|
|
124
|
+
title: {
|
|
125
|
+
...typography.styles.h1,
|
|
126
|
+
color: colors.text,
|
|
127
|
+
textAlign: 'center',
|
|
128
|
+
marginBottom: 8,
|
|
129
|
+
letterSpacing: 0.5,
|
|
130
|
+
},
|
|
131
|
+
subtitle: {
|
|
132
|
+
...typography.styles.bodyMedium,
|
|
133
|
+
color: colors.textLight,
|
|
134
|
+
textAlign: 'center',
|
|
135
|
+
lineHeight: 20,
|
|
136
|
+
},
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
export default StatusDisplay;
|