@umituz/react-native-ai-generation-content 1.17.206 → 1.17.208
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
|
@@ -24,3 +24,4 @@ export { analyzeImageForFace } from "./infrastructure/analyzers/faceAnalyzer";
|
|
|
24
24
|
export { useFaceDetection } from "./presentation/hooks/useFaceDetection";
|
|
25
25
|
|
|
26
26
|
export { FaceValidationStatus } from "./presentation/components/FaceValidationStatus";
|
|
27
|
+
export { FaceDetectionToggle } from "./presentation/components/FaceDetectionToggle";
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FaceDetectionToggle Component
|
|
3
|
+
*
|
|
4
|
+
* A simple toggle switch for enabling/disabling AI face detection.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from "react";
|
|
8
|
+
import { View, StyleSheet, Switch } from "react-native";
|
|
9
|
+
import {
|
|
10
|
+
AtomicText,
|
|
11
|
+
AtomicIcon,
|
|
12
|
+
useAppDesignTokens,
|
|
13
|
+
} from "@umituz/react-native-design-system";
|
|
14
|
+
|
|
15
|
+
interface FaceDetectionToggleProps {
|
|
16
|
+
isEnabled: boolean;
|
|
17
|
+
onToggle: (value: boolean) => void;
|
|
18
|
+
label: string;
|
|
19
|
+
/** Hide the toggle temporarily - set to true to hide without removing the component */
|
|
20
|
+
hidden?: boolean;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export const FaceDetectionToggle: React.FC<FaceDetectionToggleProps> = ({
|
|
24
|
+
isEnabled,
|
|
25
|
+
onToggle,
|
|
26
|
+
label,
|
|
27
|
+
hidden = false,
|
|
28
|
+
}) => {
|
|
29
|
+
const tokens = useAppDesignTokens();
|
|
30
|
+
|
|
31
|
+
// Return null if hidden - component is still here but not rendered
|
|
32
|
+
if (hidden) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<View
|
|
38
|
+
style={[
|
|
39
|
+
styles.container,
|
|
40
|
+
{
|
|
41
|
+
backgroundColor: tokens.colors.surfaceSecondary,
|
|
42
|
+
borderColor: isEnabled
|
|
43
|
+
? tokens.colors.primary
|
|
44
|
+
: tokens.colors.borderLight,
|
|
45
|
+
},
|
|
46
|
+
]}
|
|
47
|
+
>
|
|
48
|
+
<View style={styles.content}>
|
|
49
|
+
<View
|
|
50
|
+
style={[
|
|
51
|
+
styles.iconContainer,
|
|
52
|
+
{
|
|
53
|
+
backgroundColor: isEnabled
|
|
54
|
+
? tokens.colors.primary + "20"
|
|
55
|
+
: tokens.colors.backgroundPrimary,
|
|
56
|
+
},
|
|
57
|
+
]}
|
|
58
|
+
>
|
|
59
|
+
<AtomicIcon
|
|
60
|
+
name="scan"
|
|
61
|
+
size={20}
|
|
62
|
+
customColor={
|
|
63
|
+
isEnabled ? tokens.colors.primary : tokens.colors.textSecondary
|
|
64
|
+
}
|
|
65
|
+
/>
|
|
66
|
+
</View>
|
|
67
|
+
<AtomicText
|
|
68
|
+
style={[styles.label, { color: tokens.colors.textPrimary }]}
|
|
69
|
+
>
|
|
70
|
+
{label}
|
|
71
|
+
</AtomicText>
|
|
72
|
+
</View>
|
|
73
|
+
<Switch
|
|
74
|
+
value={isEnabled}
|
|
75
|
+
onValueChange={onToggle}
|
|
76
|
+
trackColor={{
|
|
77
|
+
false: tokens.colors.borderLight,
|
|
78
|
+
true: tokens.colors.primary,
|
|
79
|
+
}}
|
|
80
|
+
thumbColor={tokens.colors.onPrimary}
|
|
81
|
+
ios_backgroundColor={tokens.colors.borderLight}
|
|
82
|
+
/>
|
|
83
|
+
</View>
|
|
84
|
+
);
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
const styles = StyleSheet.create({
|
|
88
|
+
container: {
|
|
89
|
+
flexDirection: "row",
|
|
90
|
+
alignItems: "center",
|
|
91
|
+
justifyContent: "space-between",
|
|
92
|
+
marginHorizontal: 24,
|
|
93
|
+
marginBottom: 24,
|
|
94
|
+
padding: 16,
|
|
95
|
+
borderRadius: 16,
|
|
96
|
+
borderWidth: 1,
|
|
97
|
+
},
|
|
98
|
+
content: {
|
|
99
|
+
flexDirection: "row",
|
|
100
|
+
alignItems: "center",
|
|
101
|
+
gap: 12,
|
|
102
|
+
},
|
|
103
|
+
iconContainer: {
|
|
104
|
+
width: 36,
|
|
105
|
+
height: 36,
|
|
106
|
+
borderRadius: 18,
|
|
107
|
+
justifyContent: "center",
|
|
108
|
+
alignItems: "center",
|
|
109
|
+
},
|
|
110
|
+
label: {
|
|
111
|
+
fontSize: 16,
|
|
112
|
+
fontWeight: "600",
|
|
113
|
+
},
|
|
114
|
+
});
|