@umituz/react-native-design-system 2.4.10 → 2.4.12
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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.4.
|
|
3
|
+
"version": "2.4.12",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
package/src/index.ts
CHANGED
|
@@ -414,10 +414,6 @@ export {
|
|
|
414
414
|
type CountdownTarget,
|
|
415
415
|
type CountdownFormatOptions,
|
|
416
416
|
type CountdownDisplayConfig,
|
|
417
|
-
// Photo Upload
|
|
418
|
-
PhotoUploadCard,
|
|
419
|
-
type PhotoUploadCardProps,
|
|
420
|
-
type PhotoUploadCardConfig,
|
|
421
417
|
// Step Header
|
|
422
418
|
StepHeader,
|
|
423
419
|
type StepHeaderProps,
|
package/src/molecules/index.ts
CHANGED
|
@@ -1,241 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PhotoUploadCard Component
|
|
3
|
-
* Beautiful photo upload card with validation status and responsive design
|
|
4
|
-
*
|
|
5
|
-
* @package @umituz/react-native-design-system
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
import React, { useMemo } from "react";
|
|
9
|
-
import {
|
|
10
|
-
View,
|
|
11
|
-
Image,
|
|
12
|
-
StyleSheet,
|
|
13
|
-
Pressable,
|
|
14
|
-
TouchableOpacity,
|
|
15
|
-
ActivityIndicator,
|
|
16
|
-
type ViewStyle,
|
|
17
|
-
type StyleProp,
|
|
18
|
-
} from "react-native";
|
|
19
|
-
import { LinearGradient } from "expo-linear-gradient";
|
|
20
|
-
import { AtomicText } from "../../atoms/AtomicText";
|
|
21
|
-
import { AtomicIcon } from "../../atoms/AtomicIcon";
|
|
22
|
-
import { useAppDesignTokens } from "../../theme/hooks/useAppDesignTokens";
|
|
23
|
-
|
|
24
|
-
export interface PhotoUploadCardConfig {
|
|
25
|
-
aspectRatio?: number;
|
|
26
|
-
borderRadius?: number;
|
|
27
|
-
iconSize?: number;
|
|
28
|
-
showValidationStatus?: boolean;
|
|
29
|
-
allowChange?: boolean;
|
|
30
|
-
borderStyle?: "solid" | "dashed";
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
export interface PhotoUploadCardProps {
|
|
34
|
-
imageUri: string | null;
|
|
35
|
-
onPress: () => void;
|
|
36
|
-
isValidating?: boolean;
|
|
37
|
-
isValid?: boolean | null;
|
|
38
|
-
disabled?: boolean;
|
|
39
|
-
config?: PhotoUploadCardConfig;
|
|
40
|
-
translations: {
|
|
41
|
-
tapToUpload: string;
|
|
42
|
-
selectPhoto: string;
|
|
43
|
-
change: string;
|
|
44
|
-
analyzing?: string;
|
|
45
|
-
};
|
|
46
|
-
style?: StyleProp<ViewStyle>;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
const DEFAULT_CONFIG: PhotoUploadCardConfig = {
|
|
50
|
-
aspectRatio: 1,
|
|
51
|
-
borderRadius: 28,
|
|
52
|
-
iconSize: 40,
|
|
53
|
-
showValidationStatus: true,
|
|
54
|
-
allowChange: true,
|
|
55
|
-
borderStyle: "dashed",
|
|
56
|
-
};
|
|
57
|
-
|
|
58
|
-
export const PhotoUploadCard: React.FC<PhotoUploadCardProps> = ({
|
|
59
|
-
imageUri,
|
|
60
|
-
onPress,
|
|
61
|
-
isValidating = false,
|
|
62
|
-
isValid = null,
|
|
63
|
-
disabled = false,
|
|
64
|
-
config = DEFAULT_CONFIG,
|
|
65
|
-
translations,
|
|
66
|
-
style,
|
|
67
|
-
}) => {
|
|
68
|
-
const tokens = useAppDesignTokens();
|
|
69
|
-
const cfg = { ...DEFAULT_CONFIG, ...config };
|
|
70
|
-
|
|
71
|
-
const borderColor = useMemo(() => {
|
|
72
|
-
if (!cfg.showValidationStatus) {
|
|
73
|
-
return `${tokens.colors.primary}40`;
|
|
74
|
-
}
|
|
75
|
-
if (isValidating) return tokens.colors.primary;
|
|
76
|
-
if (isValid === true) return tokens.colors.success;
|
|
77
|
-
if (isValid === false) return tokens.colors.error;
|
|
78
|
-
return `${tokens.colors.primary}40`;
|
|
79
|
-
}, [isValidating, isValid, tokens, cfg.showValidationStatus]);
|
|
80
|
-
|
|
81
|
-
const styles = useMemo(
|
|
82
|
-
() =>
|
|
83
|
-
StyleSheet.create({
|
|
84
|
-
container: {
|
|
85
|
-
marginHorizontal: 24,
|
|
86
|
-
marginBottom: 24,
|
|
87
|
-
},
|
|
88
|
-
card: {
|
|
89
|
-
aspectRatio: cfg.aspectRatio,
|
|
90
|
-
backgroundColor: tokens.colors.surfaceSecondary,
|
|
91
|
-
borderRadius: cfg.borderRadius,
|
|
92
|
-
justifyContent: "center",
|
|
93
|
-
alignItems: "center",
|
|
94
|
-
overflow: "hidden",
|
|
95
|
-
borderWidth: 2,
|
|
96
|
-
borderStyle: imageUri ? "solid" : cfg.borderStyle,
|
|
97
|
-
},
|
|
98
|
-
placeholder: {
|
|
99
|
-
alignItems: "center",
|
|
100
|
-
padding: 32,
|
|
101
|
-
},
|
|
102
|
-
iconCircle: {
|
|
103
|
-
width: 88,
|
|
104
|
-
height: 88,
|
|
105
|
-
borderRadius: 44,
|
|
106
|
-
justifyContent: "center",
|
|
107
|
-
alignItems: "center",
|
|
108
|
-
marginBottom: 20,
|
|
109
|
-
borderWidth: 2,
|
|
110
|
-
borderColor: `${tokens.colors.primary}30`,
|
|
111
|
-
},
|
|
112
|
-
iconGradient: {
|
|
113
|
-
width: 88,
|
|
114
|
-
height: 88,
|
|
115
|
-
borderRadius: 44,
|
|
116
|
-
justifyContent: "center",
|
|
117
|
-
alignItems: "center",
|
|
118
|
-
},
|
|
119
|
-
title: {
|
|
120
|
-
fontSize: 20,
|
|
121
|
-
fontWeight: "700",
|
|
122
|
-
color: tokens.colors.textPrimary,
|
|
123
|
-
marginBottom: 8,
|
|
124
|
-
letterSpacing: 0.3,
|
|
125
|
-
},
|
|
126
|
-
subtitle: {
|
|
127
|
-
fontSize: 14,
|
|
128
|
-
color: tokens.colors.textSecondary,
|
|
129
|
-
textAlign: "center",
|
|
130
|
-
lineHeight: 20,
|
|
131
|
-
maxWidth: 240,
|
|
132
|
-
},
|
|
133
|
-
image: {
|
|
134
|
-
width: "100%",
|
|
135
|
-
height: "100%",
|
|
136
|
-
resizeMode: "cover",
|
|
137
|
-
},
|
|
138
|
-
imageOverlay: {
|
|
139
|
-
...StyleSheet.absoluteFillObject,
|
|
140
|
-
backgroundColor: "rgba(0,0,0,0.15)",
|
|
141
|
-
},
|
|
142
|
-
changeButton: {
|
|
143
|
-
position: "absolute",
|
|
144
|
-
bottom: 20,
|
|
145
|
-
right: 20,
|
|
146
|
-
backgroundColor: tokens.colors.surface,
|
|
147
|
-
paddingHorizontal: 18,
|
|
148
|
-
paddingVertical: 12,
|
|
149
|
-
borderRadius: 28,
|
|
150
|
-
flexDirection: "row",
|
|
151
|
-
alignItems: "center",
|
|
152
|
-
gap: 8,
|
|
153
|
-
},
|
|
154
|
-
changeText: {
|
|
155
|
-
fontSize: 14,
|
|
156
|
-
fontWeight: "700",
|
|
157
|
-
color: tokens.colors.primary,
|
|
158
|
-
},
|
|
159
|
-
validatingContainer: {
|
|
160
|
-
alignItems: "center",
|
|
161
|
-
padding: 32,
|
|
162
|
-
},
|
|
163
|
-
validatingText: {
|
|
164
|
-
fontSize: 16,
|
|
165
|
-
fontWeight: "600",
|
|
166
|
-
color: tokens.colors.primary,
|
|
167
|
-
marginTop: 20,
|
|
168
|
-
},
|
|
169
|
-
pulseRing: {
|
|
170
|
-
position: "absolute",
|
|
171
|
-
width: 100,
|
|
172
|
-
height: 100,
|
|
173
|
-
borderRadius: 50,
|
|
174
|
-
borderWidth: 2,
|
|
175
|
-
borderColor: `${tokens.colors.primary}30`,
|
|
176
|
-
},
|
|
177
|
-
}),
|
|
178
|
-
[tokens, imageUri, cfg],
|
|
179
|
-
);
|
|
180
|
-
|
|
181
|
-
return (
|
|
182
|
-
<View style={[styles.container, style]}>
|
|
183
|
-
<Pressable
|
|
184
|
-
style={[styles.card, { borderColor }]}
|
|
185
|
-
onPress={onPress}
|
|
186
|
-
disabled={disabled || isValidating}
|
|
187
|
-
>
|
|
188
|
-
{isValidating ? (
|
|
189
|
-
<View style={styles.validatingContainer}>
|
|
190
|
-
<View style={styles.pulseRing} />
|
|
191
|
-
<ActivityIndicator size="large" color={tokens.colors.primary} />
|
|
192
|
-
<AtomicText style={styles.validatingText}>
|
|
193
|
-
{translations.analyzing || "Analyzing..."}
|
|
194
|
-
</AtomicText>
|
|
195
|
-
</View>
|
|
196
|
-
) : imageUri ? (
|
|
197
|
-
<>
|
|
198
|
-
<Image source={{ uri: imageUri }} style={styles.image} />
|
|
199
|
-
<View style={styles.imageOverlay} />
|
|
200
|
-
{cfg.allowChange && (
|
|
201
|
-
<TouchableOpacity style={styles.changeButton} onPress={onPress}>
|
|
202
|
-
<AtomicIcon
|
|
203
|
-
name="camera"
|
|
204
|
-
size={18}
|
|
205
|
-
customColor={tokens.colors.primary}
|
|
206
|
-
/>
|
|
207
|
-
<AtomicText style={styles.changeText}>
|
|
208
|
-
{translations.change}
|
|
209
|
-
</AtomicText>
|
|
210
|
-
</TouchableOpacity>
|
|
211
|
-
)}
|
|
212
|
-
</>
|
|
213
|
-
) : (
|
|
214
|
-
<View style={styles.placeholder}>
|
|
215
|
-
<View style={styles.iconCircle}>
|
|
216
|
-
<LinearGradient
|
|
217
|
-
colors={[
|
|
218
|
-
`${tokens.colors.primary}20`,
|
|
219
|
-
`${tokens.colors.primary}10`,
|
|
220
|
-
]}
|
|
221
|
-
style={styles.iconGradient}
|
|
222
|
-
>
|
|
223
|
-
<AtomicIcon
|
|
224
|
-
name="camera"
|
|
225
|
-
size={cfg.iconSize}
|
|
226
|
-
customColor={tokens.colors.primary}
|
|
227
|
-
/>
|
|
228
|
-
</LinearGradient>
|
|
229
|
-
</View>
|
|
230
|
-
<AtomicText style={styles.title}>
|
|
231
|
-
{translations.tapToUpload}
|
|
232
|
-
</AtomicText>
|
|
233
|
-
<AtomicText style={styles.subtitle}>
|
|
234
|
-
{translations.selectPhoto}
|
|
235
|
-
</AtomicText>
|
|
236
|
-
</View>
|
|
237
|
-
)}
|
|
238
|
-
</Pressable>
|
|
239
|
-
</View>
|
|
240
|
-
);
|
|
241
|
-
};
|