@umituz/react-native-ai-generation-content 1.4.0 → 1.5.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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-ai-generation-content",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "Provider-agnostic AI generation orchestration for React Native",
|
|
5
5
|
"main": "src/index.ts",
|
|
6
6
|
"types": "src/index.ts",
|
|
@@ -28,13 +28,16 @@
|
|
|
28
28
|
"url": "git+https://github.com/umituz/react-native-ai-generation-content.git"
|
|
29
29
|
},
|
|
30
30
|
"peerDependencies": {
|
|
31
|
-
"react": ">=18.0.0"
|
|
31
|
+
"react": ">=18.0.0",
|
|
32
|
+
"react-native": ">=0.74.0"
|
|
32
33
|
},
|
|
33
34
|
"devDependencies": {
|
|
34
35
|
"@types/react": "^19.0.0",
|
|
36
|
+
"@types/react-native": "^0.73.0",
|
|
35
37
|
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
36
38
|
"@typescript-eslint/parser": "^7.0.0",
|
|
37
39
|
"eslint": "^8.57.0",
|
|
40
|
+
"react-native": "^0.76.0",
|
|
38
41
|
"typescript": "^5.3.0"
|
|
39
42
|
},
|
|
40
43
|
"publishConfig": {
|
package/src/index.ts
CHANGED
|
@@ -132,3 +132,14 @@ export type {
|
|
|
132
132
|
UseGenerationOptions,
|
|
133
133
|
UseGenerationReturn,
|
|
134
134
|
} from "./presentation/hooks";
|
|
135
|
+
|
|
136
|
+
// =============================================================================
|
|
137
|
+
// PRESENTATION LAYER - Components
|
|
138
|
+
// =============================================================================
|
|
139
|
+
|
|
140
|
+
export { GenerationProgressModal } from "./presentation/components";
|
|
141
|
+
|
|
142
|
+
export type {
|
|
143
|
+
GenerationProgressModalProps,
|
|
144
|
+
GenerationProgressRenderProps,
|
|
145
|
+
} from "./presentation/components";
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GenerationProgressModal
|
|
3
|
+
* Generic AI generation progress modal with customizable rendering
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { Modal, View, Text, StyleSheet } from "react-native";
|
|
8
|
+
|
|
9
|
+
export interface GenerationProgressModalProps {
|
|
10
|
+
visible: boolean;
|
|
11
|
+
progress: number;
|
|
12
|
+
title?: string;
|
|
13
|
+
message?: string;
|
|
14
|
+
hint?: string;
|
|
15
|
+
overlayColor?: string;
|
|
16
|
+
modalBackgroundColor?: string;
|
|
17
|
+
textColor?: string;
|
|
18
|
+
progressColor?: string;
|
|
19
|
+
progressBackgroundColor?: string;
|
|
20
|
+
renderContent?: (props: GenerationProgressRenderProps) => React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export interface GenerationProgressRenderProps {
|
|
24
|
+
progress: number;
|
|
25
|
+
title?: string;
|
|
26
|
+
message?: string;
|
|
27
|
+
hint?: string;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
export const GenerationProgressModal: React.FC<
|
|
31
|
+
GenerationProgressModalProps
|
|
32
|
+
> = ({
|
|
33
|
+
visible,
|
|
34
|
+
progress,
|
|
35
|
+
title,
|
|
36
|
+
message,
|
|
37
|
+
hint,
|
|
38
|
+
overlayColor = "rgba(0, 0, 0, 0.7)",
|
|
39
|
+
modalBackgroundColor = "#1C1C1E",
|
|
40
|
+
textColor = "#FFFFFF",
|
|
41
|
+
progressColor = "#007AFF",
|
|
42
|
+
progressBackgroundColor = "#3A3A3C",
|
|
43
|
+
renderContent,
|
|
44
|
+
}) => {
|
|
45
|
+
const clampedProgress = Math.max(0, Math.min(100, progress));
|
|
46
|
+
|
|
47
|
+
if (renderContent) {
|
|
48
|
+
return (
|
|
49
|
+
<Modal
|
|
50
|
+
visible={visible}
|
|
51
|
+
transparent
|
|
52
|
+
animationType="fade"
|
|
53
|
+
statusBarTranslucent
|
|
54
|
+
>
|
|
55
|
+
<View style={[styles.overlay, { backgroundColor: overlayColor }]}>
|
|
56
|
+
{renderContent({ progress: clampedProgress, title, message, hint })}
|
|
57
|
+
</View>
|
|
58
|
+
</Modal>
|
|
59
|
+
);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<Modal
|
|
64
|
+
visible={visible}
|
|
65
|
+
transparent
|
|
66
|
+
animationType="fade"
|
|
67
|
+
statusBarTranslucent
|
|
68
|
+
>
|
|
69
|
+
<View style={[styles.overlay, { backgroundColor: overlayColor }]}>
|
|
70
|
+
<View
|
|
71
|
+
style={[styles.modal, { backgroundColor: modalBackgroundColor }]}
|
|
72
|
+
>
|
|
73
|
+
{title && (
|
|
74
|
+
<Text style={[styles.title, { color: textColor }]}>{title}</Text>
|
|
75
|
+
)}
|
|
76
|
+
|
|
77
|
+
{message && (
|
|
78
|
+
<Text style={[styles.message, { color: textColor }]}>
|
|
79
|
+
{message}
|
|
80
|
+
</Text>
|
|
81
|
+
)}
|
|
82
|
+
|
|
83
|
+
<View style={styles.progressContainer}>
|
|
84
|
+
<View
|
|
85
|
+
style={[
|
|
86
|
+
styles.progressBackground,
|
|
87
|
+
{ backgroundColor: progressBackgroundColor },
|
|
88
|
+
]}
|
|
89
|
+
>
|
|
90
|
+
<View
|
|
91
|
+
style={[
|
|
92
|
+
styles.progressFill,
|
|
93
|
+
{
|
|
94
|
+
backgroundColor: progressColor,
|
|
95
|
+
width: `${clampedProgress}%`,
|
|
96
|
+
},
|
|
97
|
+
]}
|
|
98
|
+
/>
|
|
99
|
+
</View>
|
|
100
|
+
<Text style={[styles.progressText, { color: textColor }]}>
|
|
101
|
+
{Math.round(clampedProgress)}%
|
|
102
|
+
</Text>
|
|
103
|
+
</View>
|
|
104
|
+
|
|
105
|
+
{hint && (
|
|
106
|
+
<Text style={[styles.hint, { color: textColor }]}>{hint}</Text>
|
|
107
|
+
)}
|
|
108
|
+
</View>
|
|
109
|
+
</View>
|
|
110
|
+
</Modal>
|
|
111
|
+
);
|
|
112
|
+
};
|
|
113
|
+
|
|
114
|
+
const styles = StyleSheet.create({
|
|
115
|
+
overlay: {
|
|
116
|
+
flex: 1,
|
|
117
|
+
justifyContent: "center",
|
|
118
|
+
alignItems: "center",
|
|
119
|
+
padding: 20,
|
|
120
|
+
},
|
|
121
|
+
modal: {
|
|
122
|
+
width: "100%",
|
|
123
|
+
maxWidth: 400,
|
|
124
|
+
borderRadius: 24,
|
|
125
|
+
padding: 32,
|
|
126
|
+
alignItems: "center",
|
|
127
|
+
},
|
|
128
|
+
title: {
|
|
129
|
+
fontSize: 20,
|
|
130
|
+
fontWeight: "700",
|
|
131
|
+
marginBottom: 12,
|
|
132
|
+
textAlign: "center",
|
|
133
|
+
},
|
|
134
|
+
message: {
|
|
135
|
+
fontSize: 16,
|
|
136
|
+
marginBottom: 24,
|
|
137
|
+
textAlign: "center",
|
|
138
|
+
opacity: 0.8,
|
|
139
|
+
},
|
|
140
|
+
progressContainer: {
|
|
141
|
+
width: "100%",
|
|
142
|
+
marginBottom: 16,
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
},
|
|
145
|
+
progressBackground: {
|
|
146
|
+
width: "100%",
|
|
147
|
+
height: 8,
|
|
148
|
+
borderRadius: 4,
|
|
149
|
+
overflow: "hidden",
|
|
150
|
+
},
|
|
151
|
+
progressFill: {
|
|
152
|
+
height: "100%",
|
|
153
|
+
borderRadius: 4,
|
|
154
|
+
},
|
|
155
|
+
progressText: {
|
|
156
|
+
fontSize: 14,
|
|
157
|
+
fontWeight: "600",
|
|
158
|
+
marginTop: 8,
|
|
159
|
+
},
|
|
160
|
+
hint: {
|
|
161
|
+
fontSize: 14,
|
|
162
|
+
textAlign: "center",
|
|
163
|
+
fontStyle: "italic",
|
|
164
|
+
opacity: 0.6,
|
|
165
|
+
},
|
|
166
|
+
});
|