@imksh/create 1.0.24 → 1.0.25
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/package.json +1 -1
- package/templates/mern-react-native/client/src/vite-env.d.ts +1 -0
- package/templates/mern-react-native/mobile/babel.config.js +1 -0
- package/templates/mern-react-native/mobile/drizzle.config.ts +8 -0
- package/templates/mern-react-native/mobile/expo-env.d.ts +3 -0
- package/templates/mern-react-native/mobile/package.json +6 -0
- package/templates/mern-react-native/mobile/src/app/(auth)/_layout.tsx +12 -0
- package/templates/mern-react-native/mobile/src/app/(auth)/change-password.tsx +112 -0
- package/templates/mern-react-native/mobile/src/app/(auth)/edit-profile.tsx +160 -0
- package/templates/mern-react-native/mobile/src/app/(auth)/forgot-password.tsx +191 -0
- package/templates/mern-react-native/mobile/src/app/{login.tsx → (auth)/login.tsx} +69 -21
- package/templates/mern-react-native/mobile/src/app/(tabs)/index.tsx +18 -17
- package/templates/mern-react-native/mobile/src/app/(tabs)/profile.tsx +23 -60
- package/templates/mern-react-native/mobile/src/app/_layout.tsx +22 -4
- package/templates/mern-react-native/mobile/src/components/common/AnimatedHeader.tsx +328 -0
- package/templates/mern-react-native/mobile/src/components/common/LocationLoader.tsx +591 -0
- package/templates/mern-react-native/mobile/src/components/common/ScreenHeader.tsx +41 -17
- package/templates/mern-react-native/mobile/src/components/common/TabHeader.tsx +58 -0
- package/templates/mern-react-native/mobile/src/components/common/Typography.tsx +49 -30
- package/templates/mern-react-native/mobile/src/components/common/Welcome.tsx +2 -2
- package/templates/mern-react-native/mobile/src/components/ui/BottomModal.tsx +31 -20
- package/templates/mern-react-native/mobile/src/components/ui/ClassicTabBar.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/CustomTabBar.tsx +108 -71
- package/templates/mern-react-native/mobile/src/components/ui/Sidebar.tsx +81 -56
- package/templates/mern-react-native/mobile/src/components/ui/buttons/Button.tsx +106 -37
- package/templates/mern-react-native/mobile/src/components/ui/buttons/IconButton.tsx +4 -2
- package/templates/mern-react-native/mobile/src/components/ui/data-display/Accordion.tsx +3 -2
- package/templates/mern-react-native/mobile/src/components/ui/data-display/Avatar.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/data-display/Badge.tsx +45 -17
- package/templates/mern-react-native/mobile/src/components/ui/data-display/ImageViewer.tsx +19 -9
- package/templates/mern-react-native/mobile/src/components/ui/feedback/CircularProgress.tsx +5 -4
- package/templates/mern-react-native/mobile/src/components/ui/feedback/ProgressBar.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/feedback/Skeleton.tsx +3 -0
- package/templates/mern-react-native/mobile/src/components/ui/feedback/Spinner.tsx +11 -3
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Checkbox.tsx +3 -2
- package/templates/mern-react-native/mobile/src/components/ui/inputs/DatePicker.tsx +186 -0
- package/templates/mern-react-native/mobile/src/components/ui/inputs/ImagePickerModal.tsx +129 -0
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Input.tsx +54 -14
- package/templates/mern-react-native/mobile/src/components/ui/inputs/LocationPicker.tsx +211 -0
- package/templates/mern-react-native/mobile/src/components/ui/inputs/OTPInput.tsx +32 -9
- package/templates/mern-react-native/mobile/src/components/ui/inputs/PasswordInput.tsx +2 -1
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Radio.tsx +3 -2
- package/templates/mern-react-native/mobile/src/components/ui/inputs/SearchBar.tsx +41 -4
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Slider.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/inputs/Switch.tsx +3 -2
- package/templates/mern-react-native/mobile/src/components/ui/inputs/TextArea.tsx +2 -1
- package/templates/mern-react-native/mobile/src/components/ui/inputs/WebLocationPicker.tsx +321 -0
- package/templates/mern-react-native/mobile/src/components/ui/layout/Grid.tsx +52 -10
- package/templates/mern-react-native/mobile/src/components/ui/layout/Section.tsx +7 -8
- package/templates/mern-react-native/mobile/src/components/ui/navigation/Pagination.tsx +4 -3
- package/templates/mern-react-native/mobile/src/components/ui/navigation/ProgressStepper.tsx +6 -5
- package/templates/mern-react-native/mobile/src/components/ui/navigation/Tabs.tsx +30 -4
- package/templates/mern-react-native/mobile/src/config/api.ts +12 -1
- package/templates/mern-react-native/mobile/src/config/sidebar.config.ts +72 -0
- package/templates/mern-react-native/mobile/src/config/tabNavigation.ts +37 -7
- package/templates/mern-react-native/mobile/src/db/index.ts +9 -0
- package/templates/mern-react-native/mobile/src/db/schema.ts +14 -0
- package/templates/mern-react-native/mobile/src/hooks/useDebounce.ts +17 -0
- package/templates/mern-react-native/mobile/src/services/socket.service.ts +36 -0
- package/templates/mern-react-native/mobile/src/store/useAuthStore.ts +122 -27
- package/templates/mern-react-native/mobile/src/store/useNotificationStore.ts +53 -0
- package/templates/mern-react-native/mobile/src/types/auth.type.ts +14 -0
- package/templates/mern-react-native/mobile/tsconfig.json +1 -0
- package/templates/mern-ts/client/src/vite-env.d.ts +1 -0
- package/templates/react-native/babel.config.js +1 -0
- package/templates/react-native/drizzle.config.ts +8 -0
- package/templates/react-native/expo-env.d.ts +3 -0
- package/templates/react-native/package.json +6 -0
- package/templates/react-native/src/app/(auth)/_layout.tsx +12 -0
- package/templates/react-native/src/app/(auth)/change-password.tsx +112 -0
- package/templates/react-native/src/app/(auth)/edit-profile.tsx +160 -0
- package/templates/react-native/src/app/(auth)/forgot-password.tsx +191 -0
- package/templates/react-native/src/app/{login.tsx → (auth)/login.tsx} +69 -21
- package/templates/react-native/src/app/(tabs)/index.tsx +18 -17
- package/templates/react-native/src/app/(tabs)/profile.tsx +23 -60
- package/templates/react-native/src/app/_layout.tsx +22 -4
- package/templates/react-native/src/components/common/AnimatedHeader.tsx +328 -0
- package/templates/react-native/src/components/common/LocationLoader.tsx +591 -0
- package/templates/react-native/src/components/common/ScreenHeader.tsx +41 -17
- package/templates/react-native/src/components/common/TabHeader.tsx +58 -0
- package/templates/react-native/src/components/common/Typography.tsx +49 -30
- package/templates/react-native/src/components/common/Welcome.tsx +2 -2
- package/templates/react-native/src/components/ui/BottomModal.tsx +31 -20
- package/templates/react-native/src/components/ui/ClassicTabBar.tsx +4 -3
- package/templates/react-native/src/components/ui/CustomTabBar.tsx +108 -71
- package/templates/react-native/src/components/ui/Sidebar.tsx +81 -56
- package/templates/react-native/src/components/ui/buttons/Button.tsx +106 -37
- package/templates/react-native/src/components/ui/buttons/IconButton.tsx +4 -2
- package/templates/react-native/src/components/ui/data-display/Accordion.tsx +3 -2
- package/templates/react-native/src/components/ui/data-display/Avatar.tsx +4 -3
- package/templates/react-native/src/components/ui/data-display/Badge.tsx +45 -17
- package/templates/react-native/src/components/ui/data-display/ImageViewer.tsx +19 -9
- package/templates/react-native/src/components/ui/feedback/CircularProgress.tsx +5 -4
- package/templates/react-native/src/components/ui/feedback/ProgressBar.tsx +4 -3
- package/templates/react-native/src/components/ui/feedback/Skeleton.tsx +3 -0
- package/templates/react-native/src/components/ui/feedback/Spinner.tsx +11 -3
- package/templates/react-native/src/components/ui/inputs/Checkbox.tsx +3 -2
- package/templates/react-native/src/components/ui/inputs/DatePicker.tsx +186 -0
- package/templates/react-native/src/components/ui/inputs/ImagePickerModal.tsx +129 -0
- package/templates/react-native/src/components/ui/inputs/Input.tsx +54 -14
- package/templates/react-native/src/components/ui/inputs/LocationPicker.tsx +211 -0
- package/templates/react-native/src/components/ui/inputs/OTPInput.tsx +32 -9
- package/templates/react-native/src/components/ui/inputs/PasswordInput.tsx +2 -1
- package/templates/react-native/src/components/ui/inputs/Radio.tsx +3 -2
- package/templates/react-native/src/components/ui/inputs/SearchBar.tsx +41 -4
- package/templates/react-native/src/components/ui/inputs/Slider.tsx +4 -3
- package/templates/react-native/src/components/ui/inputs/Switch.tsx +3 -2
- package/templates/react-native/src/components/ui/inputs/TextArea.tsx +2 -1
- package/templates/react-native/src/components/ui/inputs/WebLocationPicker.tsx +321 -0
- package/templates/react-native/src/components/ui/layout/Grid.tsx +52 -10
- package/templates/react-native/src/components/ui/layout/Section.tsx +7 -8
- package/templates/react-native/src/components/ui/navigation/Pagination.tsx +4 -3
- package/templates/react-native/src/components/ui/navigation/ProgressStepper.tsx +6 -5
- package/templates/react-native/src/components/ui/navigation/Tabs.tsx +30 -4
- package/templates/react-native/src/config/api.ts +12 -1
- package/templates/react-native/src/config/sidebar.config.ts +72 -0
- package/templates/react-native/src/config/tabNavigation.ts +37 -7
- package/templates/react-native/src/db/index.ts +9 -0
- package/templates/react-native/src/db/schema.ts +14 -0
- package/templates/react-native/src/hooks/useDebounce.ts +17 -0
- package/templates/react-native/src/services/socket.service.ts +36 -0
- package/templates/react-native/src/store/useAuthStore.ts +122 -27
- package/templates/react-native/src/store/useNotificationStore.ts +53 -0
- package/templates/react-native/src/types/auth.type.ts +14 -0
- package/templates/react-native/tsconfig.json +1 -0
- package/templates/react-ts/src/vite-env.d.ts +1 -0
- package/templates/mern-react-native/mobile/.env.example +0 -2
- package/templates/mern-react-native/mobile/.vscode/extensions.json +0 -1
- package/templates/mern-react-native/mobile/.vscode/settings.json +0 -7
- package/templates/mern-react-native/mobile/README.md +0 -159
- package/templates/mern-react-native/mobile/docs/README.md +0 -17
- package/templates/mern-react-native/mobile/docs/components/buttons.md +0 -40
- package/templates/mern-react-native/mobile/docs/components/data-display.md +0 -44
- package/templates/mern-react-native/mobile/docs/components/feedback.md +0 -36
- package/templates/mern-react-native/mobile/docs/components/gestures.md +0 -60
- package/templates/mern-react-native/mobile/docs/components/inputs.md +0 -41
- package/templates/mern-react-native/mobile/docs/components/layout.md +0 -34
- package/templates/mern-react-native/mobile/docs/components/navigation.md +0 -31
- package/templates/mern-react-native/mobile/docs/features.md +0 -85
- package/templates/mern-react-native/mobile/docs/getting-started.md +0 -47
- package/templates/mern-react-native/mobile/src/components/common/HomeHeader.tsx +0 -43
- package/templates/mern-react-native/mobile/src/components/settings/SettingToggle.tsx +0 -26
- package/templates/mern-react-native/mobile/src/components/settings/SettingsOptions.tsx +0 -47
- package/templates/react-native/.env.example +0 -2
- package/templates/react-native/.vscode/extensions.json +0 -1
- package/templates/react-native/.vscode/settings.json +0 -7
- package/templates/react-native/README.md +0 -159
- package/templates/react-native/docs/README.md +0 -17
- package/templates/react-native/docs/components/buttons.md +0 -40
- package/templates/react-native/docs/components/data-display.md +0 -44
- package/templates/react-native/docs/components/feedback.md +0 -36
- package/templates/react-native/docs/components/gestures.md +0 -60
- package/templates/react-native/docs/components/inputs.md +0 -41
- package/templates/react-native/docs/components/layout.md +0 -34
- package/templates/react-native/docs/components/navigation.md +0 -31
- package/templates/react-native/docs/features.md +0 -85
- package/templates/react-native/docs/getting-started.md +0 -47
- package/templates/react-native/src/components/common/HomeHeader.tsx +0 -43
- package/templates/react-native/src/components/settings/SettingToggle.tsx +0 -26
- package/templates/react-native/src/components/settings/SettingsOptions.tsx +0 -47
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
import React, { useState, useEffect } from "react";
|
|
2
|
+
import { View, Modal, TouchableOpacity, ActivityIndicator } from "react-native";
|
|
3
|
+
import MapView, { Region } from "react-native-maps";
|
|
4
|
+
import * as Location from "expo-location";
|
|
5
|
+
import { Ionicons } from "@expo/vector-icons";
|
|
6
|
+
import { useColorScheme } from "nativewind";
|
|
7
|
+
import { Colors } from "../../../constants/Colors";
|
|
8
|
+
import { Txt } from "../../common/Typography";
|
|
9
|
+
import Button from "../buttons/Button";
|
|
10
|
+
|
|
11
|
+
export interface LocationDetails {
|
|
12
|
+
addressLine1: string;
|
|
13
|
+
addressLine2?: string;
|
|
14
|
+
locality: string;
|
|
15
|
+
city: string;
|
|
16
|
+
state: string;
|
|
17
|
+
pinCode: string;
|
|
18
|
+
latitude: number;
|
|
19
|
+
longitude: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface LocationPickerProps {
|
|
23
|
+
onLocationSelected: (details: LocationDetails) => void;
|
|
24
|
+
initialCoordinate?: { latitude: number; longitude: number };
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
export default function LocationPicker({
|
|
28
|
+
onLocationSelected,
|
|
29
|
+
initialCoordinate,
|
|
30
|
+
}: LocationPickerProps) {
|
|
31
|
+
const { colorScheme } = useColorScheme();
|
|
32
|
+
const theme = Colors[colorScheme ?? "light"];
|
|
33
|
+
|
|
34
|
+
const [modalVisible, setModalVisible] = useState(false);
|
|
35
|
+
const [loading, setLoading] = useState(false);
|
|
36
|
+
const [region, setRegion] = useState<Region>({
|
|
37
|
+
latitude: initialCoordinate?.latitude || 28.6139,
|
|
38
|
+
longitude: initialCoordinate?.longitude || 77.209,
|
|
39
|
+
latitudeDelta: 0.0922,
|
|
40
|
+
longitudeDelta: 0.0421,
|
|
41
|
+
});
|
|
42
|
+
const [currentCenter, setCurrentCenter] = useState({
|
|
43
|
+
latitude: region.latitude,
|
|
44
|
+
longitude: region.longitude,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
useEffect(() => {
|
|
48
|
+
if (initialCoordinate?.latitude && initialCoordinate?.longitude) {
|
|
49
|
+
|
|
50
|
+
setRegion((r) => ({
|
|
51
|
+
...r,
|
|
52
|
+
latitude: initialCoordinate.latitude,
|
|
53
|
+
longitude: initialCoordinate.longitude,
|
|
54
|
+
}));
|
|
55
|
+
setCurrentCenter(initialCoordinate);
|
|
56
|
+
}
|
|
57
|
+
}, [initialCoordinate]);
|
|
58
|
+
|
|
59
|
+
const requestLocationAndOpenMap = async () => {
|
|
60
|
+
setLoading(true);
|
|
61
|
+
let { status } = await Location.requestForegroundPermissionsAsync();
|
|
62
|
+
if (status !== "granted") {
|
|
63
|
+
setLoading(false);
|
|
64
|
+
setModalVisible(true);
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
try {
|
|
69
|
+
if (!initialCoordinate?.latitude) {
|
|
70
|
+
let location = await Location.getCurrentPositionAsync({});
|
|
71
|
+
setRegion({
|
|
72
|
+
...region,
|
|
73
|
+
latitude: location.coords.latitude,
|
|
74
|
+
longitude: location.coords.longitude,
|
|
75
|
+
});
|
|
76
|
+
setCurrentCenter({
|
|
77
|
+
latitude: location.coords.latitude,
|
|
78
|
+
longitude: location.coords.longitude,
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
} catch (e) {
|
|
82
|
+
console.warn(e);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
setLoading(false);
|
|
86
|
+
setModalVisible(true);
|
|
87
|
+
};
|
|
88
|
+
|
|
89
|
+
const handleConfirmLocation = async () => {
|
|
90
|
+
setLoading(true);
|
|
91
|
+
try {
|
|
92
|
+
const [address] = await Location.reverseGeocodeAsync({
|
|
93
|
+
latitude: currentCenter.latitude,
|
|
94
|
+
longitude: currentCenter.longitude,
|
|
95
|
+
});
|
|
96
|
+
|
|
97
|
+
if (address) {
|
|
98
|
+
const details: LocationDetails = {
|
|
99
|
+
addressLine1: address.street || address.name || "",
|
|
100
|
+
locality: address.subregion || address.district || "",
|
|
101
|
+
city: address.city || address.subregion || "",
|
|
102
|
+
state: address.region || "",
|
|
103
|
+
pinCode: address.postalCode || "",
|
|
104
|
+
latitude: currentCenter.latitude,
|
|
105
|
+
longitude: currentCenter.longitude,
|
|
106
|
+
};
|
|
107
|
+
onLocationSelected(details);
|
|
108
|
+
setModalVisible(false);
|
|
109
|
+
}
|
|
110
|
+
} catch (error) {
|
|
111
|
+
console.warn("Geocoding failed", error);
|
|
112
|
+
}
|
|
113
|
+
setLoading(false);
|
|
114
|
+
};
|
|
115
|
+
|
|
116
|
+
return (
|
|
117
|
+
<>
|
|
118
|
+
<TouchableOpacity
|
|
119
|
+
onPress={requestLocationAndOpenMap}
|
|
120
|
+
className="w-full h-14 bg-base-200 rounded-xl mb-4 flex-row items-center justify-between px-4 border border-base-300"
|
|
121
|
+
>
|
|
122
|
+
<View className="flex-row items-center">
|
|
123
|
+
<Ionicons
|
|
124
|
+
name="map-outline"
|
|
125
|
+
size={24}
|
|
126
|
+
color={theme.primary}
|
|
127
|
+
style={{ marginRight: 12 }}
|
|
128
|
+
/>
|
|
129
|
+
<Txt color={theme.baseContent} weight="semibold">
|
|
130
|
+
{initialCoordinate?.latitude
|
|
131
|
+
? "Update Location on Map"
|
|
132
|
+
: "Pick from Map"}
|
|
133
|
+
</Txt>
|
|
134
|
+
</View>
|
|
135
|
+
{loading && !modalVisible ? (
|
|
136
|
+
<ActivityIndicator color={theme.primary} />
|
|
137
|
+
) : (
|
|
138
|
+
<Ionicons name="chevron-forward" size={20} color={theme.secondary} />
|
|
139
|
+
)}
|
|
140
|
+
</TouchableOpacity>
|
|
141
|
+
|
|
142
|
+
<Modal
|
|
143
|
+
animationType="slide"
|
|
144
|
+
transparent={false}
|
|
145
|
+
visible={modalVisible}
|
|
146
|
+
onRequestClose={() => setModalVisible(false)}
|
|
147
|
+
>
|
|
148
|
+
<View className="flex-1 bg-base-100">
|
|
149
|
+
<View
|
|
150
|
+
className="h-16 flex-row items-center justify-between px-4 border-b border-base-300 pt-4 bg-base-100"
|
|
151
|
+
style={{ zIndex: 10 }}
|
|
152
|
+
>
|
|
153
|
+
<TouchableOpacity
|
|
154
|
+
onPress={() => setModalVisible(false)}
|
|
155
|
+
className="p-2"
|
|
156
|
+
>
|
|
157
|
+
<Ionicons name="close" size={24} color={theme.baseContent} />
|
|
158
|
+
</TouchableOpacity>
|
|
159
|
+
<Txt variant="lg" weight="bold">
|
|
160
|
+
Select Location
|
|
161
|
+
</Txt>
|
|
162
|
+
<View className="w-10" />
|
|
163
|
+
</View>
|
|
164
|
+
|
|
165
|
+
<View className="flex-1 relative">
|
|
166
|
+
<MapView
|
|
167
|
+
style={{ flex: 1 }}
|
|
168
|
+
initialRegion={region}
|
|
169
|
+
showsUserLocation={true}
|
|
170
|
+
onRegionChangeComplete={(r) =>
|
|
171
|
+
setCurrentCenter({
|
|
172
|
+
latitude: r.latitude,
|
|
173
|
+
longitude: r.longitude,
|
|
174
|
+
})
|
|
175
|
+
}
|
|
176
|
+
/>
|
|
177
|
+
|
|
178
|
+
{/* Center Pin Overlay */}
|
|
179
|
+
<View
|
|
180
|
+
className="absolute top-0 left-0 right-0 bottom-0 items-center justify-center pointer-events-none"
|
|
181
|
+
pointerEvents="none"
|
|
182
|
+
>
|
|
183
|
+
<View
|
|
184
|
+
className="items-center"
|
|
185
|
+
style={{ transform: [{ translateY: -20 }] }}
|
|
186
|
+
>
|
|
187
|
+
<Ionicons name="location" size={40} color={theme.primary} />
|
|
188
|
+
<View className="w-2 h-2 rounded-full bg-black/20 mt-1" />
|
|
189
|
+
</View>
|
|
190
|
+
</View>
|
|
191
|
+
</View>
|
|
192
|
+
|
|
193
|
+
<View className="p-6 bg-base-100 border-t border-base-300 pb-10">
|
|
194
|
+
<Txt
|
|
195
|
+
variant="sm"
|
|
196
|
+
color={theme.secondary}
|
|
197
|
+
className="mb-4 text-center"
|
|
198
|
+
>
|
|
199
|
+
Drag the map to position the pin exactly on your property.
|
|
200
|
+
</Txt>
|
|
201
|
+
<Button
|
|
202
|
+
label="Confirm Location"
|
|
203
|
+
onPress={handleConfirmLocation}
|
|
204
|
+
isLoading={loading}
|
|
205
|
+
/>
|
|
206
|
+
</View>
|
|
207
|
+
</View>
|
|
208
|
+
</Modal>
|
|
209
|
+
</>
|
|
210
|
+
);
|
|
211
|
+
}
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from "react-native";
|
|
3
3
|
import { OtpInput } from "react-native-otp-entry";
|
|
4
4
|
import { useColorScheme } from "nativewind";
|
|
5
5
|
import { Colors } from "../../../constants/Colors";
|
|
6
|
+
import { Txt } from "../../common/Typography";
|
|
6
7
|
|
|
7
8
|
export interface OTPProps {
|
|
8
9
|
length?: number;
|
|
9
10
|
onTextChange?: (text: string) => void;
|
|
10
11
|
onFilled?: (text: string) => void;
|
|
11
12
|
label?: string;
|
|
13
|
+
labelOnBorder?:boolean;
|
|
12
14
|
error?: string;
|
|
13
15
|
}
|
|
14
16
|
|
|
@@ -18,18 +20,31 @@ export default function OTPInput({
|
|
|
18
20
|
onFilled,
|
|
19
21
|
label,
|
|
20
22
|
error,
|
|
23
|
+
labelOnBorder = false,
|
|
21
24
|
}: OTPProps) {
|
|
22
25
|
const { colorScheme } = useColorScheme();
|
|
23
26
|
const theme = Colors[colorScheme ?? "light"];
|
|
24
27
|
|
|
25
28
|
return (
|
|
26
|
-
<View className=
|
|
27
|
-
{label && (
|
|
28
|
-
<
|
|
29
|
+
<View className={`mb-4 ${labelOnBorder ? 'relative' : ''}`}>
|
|
30
|
+
{!labelOnBorder && label && (
|
|
31
|
+
<Txt
|
|
32
|
+
color={theme.baseContent}
|
|
33
|
+
weight="semibold"
|
|
34
|
+
style={{ marginBottom: 8 }}
|
|
35
|
+
>
|
|
29
36
|
{label}
|
|
30
|
-
</
|
|
37
|
+
</Txt>
|
|
31
38
|
)}
|
|
32
|
-
|
|
39
|
+
|
|
40
|
+
{labelOnBorder && label && (
|
|
41
|
+
<View style={{ position: 'absolute', top: -9, left: 12, backgroundColor: theme.base100, paddingHorizontal: 4, zIndex: 10, elevation: 2 }}>
|
|
42
|
+
<Txt color={error ? theme.error : theme.secondary} variant="xs" weight="semibold">
|
|
43
|
+
{label}
|
|
44
|
+
</Txt>
|
|
45
|
+
</View>
|
|
46
|
+
)}
|
|
47
|
+
|
|
33
48
|
<OtpInput
|
|
34
49
|
numberOfDigits={length}
|
|
35
50
|
onTextChange={onTextChange}
|
|
@@ -46,14 +61,22 @@ export default function OTPInput({
|
|
|
46
61
|
width: 56,
|
|
47
62
|
height: 64,
|
|
48
63
|
},
|
|
49
|
-
pinCodeTextStyle: {
|
|
64
|
+
pinCodeTextStyle: {
|
|
65
|
+
color: theme.baseContent,
|
|
66
|
+
fontSize: 24,
|
|
67
|
+
fontWeight: "700",
|
|
68
|
+
},
|
|
50
69
|
}}
|
|
51
70
|
/>
|
|
52
71
|
|
|
53
72
|
{error && (
|
|
54
|
-
<
|
|
73
|
+
<Txt
|
|
74
|
+
color={theme.error}
|
|
75
|
+
variant="sm"
|
|
76
|
+
style={{ marginTop: 8, marginLeft: 4 }}
|
|
77
|
+
>
|
|
55
78
|
{error}
|
|
56
|
-
</
|
|
79
|
+
</Txt>
|
|
57
80
|
)}
|
|
58
81
|
</View>
|
|
59
82
|
);
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import React, { useState } from "react";
|
|
2
2
|
import Input, { InputProps } from "./Input";
|
|
3
3
|
|
|
4
|
-
export default function PasswordInput(props: Omit<InputProps, "rightIcon" | "onRightIconPress" | "secureTextEntry">) {
|
|
4
|
+
export default function PasswordInput({ labelOnBorder, ...props }: Omit<InputProps, "rightIcon" | "onRightIconPress" | "secureTextEntry">) {
|
|
5
5
|
const [isVisible, setIsVisible] = useState(false);
|
|
6
6
|
|
|
7
7
|
return (
|
|
8
8
|
<Input
|
|
9
|
+
labelOnBorder={labelOnBorder}
|
|
9
10
|
{...props}
|
|
10
11
|
secureTextEntry={!isVisible}
|
|
11
12
|
rightIcon={isVisible ? "eye-off" : "eye"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { TouchableOpacity, View
|
|
2
|
+
import { TouchableOpacity, View } from "react-native";
|
|
3
3
|
import { useColorScheme } from "nativewind";
|
|
4
4
|
import { Colors } from "../../../constants/Colors";
|
|
5
|
+
import { Txt } from "../../common/Typography";
|
|
5
6
|
|
|
6
7
|
export interface RadioProps {
|
|
7
8
|
checked: boolean;
|
|
@@ -47,7 +48,7 @@ export default function Radio({
|
|
|
47
48
|
<View style={{ width: 12, height: 12, borderRadius: 6, backgroundColor: theme.primary }} />
|
|
48
49
|
)}
|
|
49
50
|
</View>
|
|
50
|
-
{label && <
|
|
51
|
+
{label && <Txt color={theme.baseContent} variant="base">{label}</Txt>}
|
|
51
52
|
</TouchableOpacity>
|
|
52
53
|
);
|
|
53
54
|
}
|
|
@@ -1,16 +1,53 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Input, { InputProps } from "./Input";
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export type SearchBarSize = "xs" | "sm" | "base" | "md" | "lg";
|
|
5
|
+
|
|
6
|
+
export interface SearchBarProps extends Omit<InputProps, "leftIcon"> {
|
|
7
|
+
size?: SearchBarSize;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export default function SearchBar({
|
|
11
|
+
size = "base",
|
|
12
|
+
style,
|
|
13
|
+
containerStyle,
|
|
14
|
+
...props
|
|
15
|
+
}: SearchBarProps) {
|
|
16
|
+
const getSizeStyles = () => {
|
|
17
|
+
switch (size) {
|
|
18
|
+
case "xs":
|
|
19
|
+
return { height: 32, px: 10, fontSize: 12 };
|
|
20
|
+
case "sm":
|
|
21
|
+
return { height: 38, px: 12, fontSize: 13 };
|
|
22
|
+
case "base":
|
|
23
|
+
return { height: 44, px: 14, fontSize: 14 };
|
|
24
|
+
case "md":
|
|
25
|
+
return { height: 50, px: 16, fontSize: 15 };
|
|
26
|
+
case "lg":
|
|
27
|
+
return { height: 56, px: 18, fontSize: 16 };
|
|
28
|
+
default:
|
|
29
|
+
return { height: 44, px: 14, fontSize: 14 };
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const s = getSizeStyles();
|
|
34
|
+
|
|
5
35
|
return (
|
|
6
36
|
<Input
|
|
7
37
|
leftIcon="search"
|
|
8
38
|
placeholder="Search..."
|
|
9
|
-
{
|
|
39
|
+
style={[{ fontSize: s.fontSize }, style]}
|
|
10
40
|
containerStyle={[
|
|
11
|
-
{
|
|
12
|
-
|
|
41
|
+
{
|
|
42
|
+
borderRadius: 9999,
|
|
43
|
+
height: s.height,
|
|
44
|
+
paddingHorizontal: s.px,
|
|
45
|
+
backgroundColor: "rgba(0,0,0,0.05)",
|
|
46
|
+
borderWidth: 0,
|
|
47
|
+
},
|
|
48
|
+
containerStyle,
|
|
13
49
|
]}
|
|
50
|
+
{...props}
|
|
14
51
|
/>
|
|
15
52
|
);
|
|
16
53
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import { View
|
|
2
|
+
import { View } from "react-native";
|
|
3
3
|
import CommunitySlider from "@react-native-community/slider";
|
|
4
4
|
import { useColorScheme } from "nativewind";
|
|
5
5
|
import { Colors } from "../../../constants/Colors";
|
|
6
|
+
import { Txt } from "../../common/Typography";
|
|
6
7
|
|
|
7
8
|
export interface SliderProps {
|
|
8
9
|
value: number;
|
|
@@ -28,8 +29,8 @@ export default function Slider({
|
|
|
28
29
|
<View className="mb-4 w-full">
|
|
29
30
|
{label && (
|
|
30
31
|
<View className="flex-row justify-between mb-2">
|
|
31
|
-
<
|
|
32
|
-
<
|
|
32
|
+
<Txt color={theme.baseContent} weight="semibold">{label}</Txt>
|
|
33
|
+
<Txt color={theme.secondary}>{value}</Txt>
|
|
33
34
|
</View>
|
|
34
35
|
)}
|
|
35
36
|
<CommunitySlider
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
import { TouchableOpacity, StyleProp, ViewStyle
|
|
2
|
+
import { TouchableOpacity, StyleProp, ViewStyle } from "react-native";
|
|
3
3
|
import Animated, {
|
|
4
4
|
useSharedValue,
|
|
5
5
|
useAnimatedStyle,
|
|
@@ -8,6 +8,7 @@ import Animated, {
|
|
|
8
8
|
} from "react-native-reanimated";
|
|
9
9
|
import { useColorScheme } from "nativewind";
|
|
10
10
|
import { Colors } from "../../../constants/Colors";
|
|
11
|
+
import { Txt } from "../../common/Typography";
|
|
11
12
|
|
|
12
13
|
export interface SwitchProps {
|
|
13
14
|
checked: boolean;
|
|
@@ -68,7 +69,7 @@ export default function Switch({
|
|
|
68
69
|
]}
|
|
69
70
|
/>
|
|
70
71
|
</Animated.View>
|
|
71
|
-
{label && <
|
|
72
|
+
{label && <Txt color={theme.baseContent} variant="base" style={{ marginLeft: 10 }}>{label}</Txt>}
|
|
72
73
|
</TouchableOpacity>
|
|
73
74
|
);
|
|
74
75
|
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import Input, { InputProps } from "./Input";
|
|
3
3
|
|
|
4
|
-
export default function TextArea(props: InputProps) {
|
|
4
|
+
export default function TextArea({ labelOnBorder, ...props }: InputProps) {
|
|
5
5
|
return (
|
|
6
6
|
<Input
|
|
7
7
|
multiline
|
|
8
8
|
numberOfLines={4}
|
|
9
9
|
containerStyle={[{ height: 120, alignItems: "flex-start", paddingTop: 12 }, props.containerStyle]}
|
|
10
10
|
textAlignVertical="top"
|
|
11
|
+
labelOnBorder={labelOnBorder}
|
|
11
12
|
{...props}
|
|
12
13
|
/>
|
|
13
14
|
);
|