@umituz/react-native-ai-generation-content 1.20.12 → 1.20.13

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.
Files changed (31) hide show
  1. package/package.json +1 -1
  2. package/src/features/ai-hug/presentation/components/AIHugFeature.tsx +2 -14
  3. package/src/features/ai-kiss/presentation/components/AIKissFeature.tsx +2 -17
  4. package/src/features/anime-selfie/presentation/components/AnimeSelfieFeature.tsx +2 -19
  5. package/src/features/anime-selfie/presentation/hooks/useAnimeSelfieFeature.ts +1 -1
  6. package/src/features/face-swap/presentation/components/FaceSwapFeature.tsx +2 -18
  7. package/src/features/hd-touch-up/presentation/components/HDTouchUpFeature.tsx +2 -18
  8. package/src/features/image-to-image/presentation/hooks/useDualImageFeature.ts +1 -1
  9. package/src/features/image-to-image/presentation/hooks/useImageWithPromptFeature.ts +1 -1
  10. package/src/features/image-to-image/presentation/hooks/useSingleImageFeature.ts +2 -5
  11. package/src/features/photo-restoration/presentation/components/PhotoRestoreFeature.tsx +2 -18
  12. package/src/features/remove-background/presentation/components/RemoveBackgroundFeature.tsx +2 -14
  13. package/src/features/remove-object/presentation/components/RemoveObjectFeature.tsx +5 -26
  14. package/src/features/remove-object/presentation/hooks/useRemoveObjectFeature.ts +1 -1
  15. package/src/features/replace-background/presentation/components/ReplaceBackgroundFeature.tsx +2 -18
  16. package/src/features/shared/dual-image-video/presentation/hooks/useDualImageVideoFeature.ts +1 -1
  17. package/src/features/text-to-video/presentation/hooks/useTextToVideoFeature.ts +1 -1
  18. package/src/features/upscaling/presentation/components/UpscaleFeature.tsx +2 -18
  19. package/src/features/wizard/presentation/components/AIGenerationWizard.tsx +2 -6
  20. package/src/index.ts +10 -11
  21. package/src/presentation/components/AIGenerationForm.tsx +0 -16
  22. package/src/presentation/components/index.ts +0 -6
  23. package/src/presentation/layouts/DualImageFeatureLayout.tsx +65 -56
  24. package/src/presentation/layouts/DualImageVideoFeatureLayout.tsx +65 -56
  25. package/src/presentation/layouts/SingleImageFeatureLayout.tsx +63 -54
  26. package/src/presentation/layouts/SingleImageWithPromptFeatureLayout.tsx +65 -56
  27. package/src/presentation/layouts/index.ts +0 -7
  28. package/src/presentation/layouts/types/index.ts +1 -5
  29. package/src/presentation/layouts/types/layout-props.ts +13 -21
  30. package/src/presentation/layouts/types/result-props.ts +0 -8
  31. package/src/presentation/components/GenerationProgressModal.tsx +0 -134
@@ -2,11 +2,12 @@
2
2
  * SingleImageWithPromptFeatureLayout
3
3
  * Centralized layout for single-image + prompt processing features
4
4
  * (e.g., replace-background, remove-object)
5
- * Handles: Modal, ScrollView, AIGenerationForm, AIGenerationResult
5
+ * Handles: ScrollView, AIGenerationForm, AIGenerationResult, GenerationProgressContent
6
+ * Note: No Modal wrapper - shows fullscreen progress when processing (FutureUS pattern)
6
7
  */
7
8
 
8
9
  import React, { useCallback } from "react";
9
- import { ScrollView, StyleSheet } from "react-native";
10
+ import { View, ScrollView, StyleSheet } from "react-native";
10
11
  import {
11
12
  useAppDesignTokens,
12
13
  useResponsive,
@@ -14,7 +15,7 @@ import {
14
15
  } from "@umituz/react-native-design-system";
15
16
  import { AIGenerationForm } from "../components/AIGenerationForm";
16
17
  import { AIGenerationResult } from "../components/display/AIGenerationResult";
17
- import { GenerationProgressModal } from "../components/GenerationProgressModal";
18
+ import { GenerationProgressContent } from "../components/GenerationProgressContent";
18
19
  import type { SingleImageWithPromptFeatureLayoutProps } from "./types";
19
20
 
20
21
  export const SingleImageWithPromptFeatureLayout: React.FC<SingleImageWithPromptFeatureLayoutProps> = ({
@@ -25,7 +26,6 @@ export const SingleImageWithPromptFeatureLayout: React.FC<SingleImageWithPromptF
25
26
  renderInput,
26
27
  renderResult,
27
28
  description,
28
- renderProcessingModal,
29
29
  children,
30
30
  }) => {
31
31
  const tokens = useAppDesignTokens();
@@ -51,19 +51,29 @@ export const SingleImageWithPromptFeatureLayout: React.FC<SingleImageWithPromptF
51
51
  [feature],
52
52
  );
53
53
 
54
- // Default modal
55
- const defaultModal = (
56
- <GenerationProgressModal
57
- visible={feature.isProcessing}
58
- progress={feature.progress}
59
- icon={modalIcon}
60
- title={modalTranslations.title}
61
- message={modalTranslations.message}
62
- hint={modalTranslations.hint}
63
- backgroundHint={modalTranslations.backgroundHint}
64
- onClose={() => {}}
65
- />
66
- );
54
+ // Processing view - fullscreen (FutureUS pattern, no Modal)
55
+ if (feature.isProcessing) {
56
+ return (
57
+ <View
58
+ style={[
59
+ styles.processingContainer,
60
+ { backgroundColor: tokens.colors.backgroundPrimary },
61
+ ]}
62
+ >
63
+ <GenerationProgressContent
64
+ progress={feature.progress}
65
+ icon={modalIcon}
66
+ title={modalTranslations.title}
67
+ message={modalTranslations.message}
68
+ hint={modalTranslations.hint}
69
+ backgroundHint={modalTranslations.backgroundHint}
70
+ backgroundColor={tokens.colors.surface}
71
+ textColor={tokens.colors.textPrimary}
72
+ progressColor={tokens.colors.primary}
73
+ />
74
+ </View>
75
+ );
76
+ }
67
77
 
68
78
  // Result view
69
79
  if (feature.processedUrl) {
@@ -92,48 +102,42 @@ export const SingleImageWithPromptFeatureLayout: React.FC<SingleImageWithPromptF
92
102
 
93
103
  // Input view
94
104
  return (
95
- <>
96
- <ScrollView
97
- style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}
98
- contentContainerStyle={styles.content}
99
- showsVerticalScrollIndicator={false}
105
+ <ScrollView
106
+ style={[styles.container, { backgroundColor: tokens.colors.backgroundPrimary }]}
107
+ contentContainerStyle={styles.content}
108
+ showsVerticalScrollIndicator={false}
109
+ >
110
+ <AIGenerationForm
111
+ onGenerate={handleProcess}
112
+ isGenerating={feature.isProcessing}
113
+ progress={feature.progress}
114
+ translations={{
115
+ generateButton: translations.processButtonText,
116
+ generatingButton: translations.processingText,
117
+ progressTitle: translations.processingText,
118
+ }}
100
119
  >
101
- <AIGenerationForm
102
- onGenerate={handleProcess}
103
- isGenerating={feature.isProcessing}
104
- progress={feature.progress}
105
- translations={{
106
- generateButton: translations.processButtonText,
107
- generatingButton: translations.processingText,
108
- progressTitle: translations.processingText,
109
- }}
110
- >
111
- {description && (
112
- <AtomicText
113
- type="bodyLarge"
114
- style={[styles.description, { color: tokens.colors.textSecondary }]}
115
- >
116
- {description}
117
- </AtomicText>
118
- )}
120
+ {description && (
121
+ <AtomicText
122
+ type="bodyLarge"
123
+ style={[styles.description, { color: tokens.colors.textSecondary }]}
124
+ >
125
+ {description}
126
+ </AtomicText>
127
+ )}
119
128
 
120
- {children}
129
+ {children}
121
130
 
122
- {renderInput({
123
- imageUri: feature.imageUri,
124
- onSelect: handleSelectImage,
125
- isDisabled: feature.isProcessing,
126
- isProcessing: feature.isProcessing,
127
- prompt: feature.prompt,
128
- onPromptChange: handlePromptChange,
129
- })}
130
- </AIGenerationForm>
131
- </ScrollView>
132
-
133
- {renderProcessingModal
134
- ? renderProcessingModal({ visible: feature.isProcessing, progress: feature.progress })
135
- : defaultModal}
136
- </>
131
+ {renderInput({
132
+ imageUri: feature.imageUri,
133
+ onSelect: handleSelectImage,
134
+ isDisabled: feature.isProcessing,
135
+ isProcessing: feature.isProcessing,
136
+ prompt: feature.prompt,
137
+ onPromptChange: handlePromptChange,
138
+ })}
139
+ </AIGenerationForm>
140
+ </ScrollView>
137
141
  );
138
142
  };
139
143
 
@@ -150,4 +154,9 @@ const styles = StyleSheet.create({
150
154
  marginBottom: 24,
151
155
  lineHeight: 24,
152
156
  },
157
+ processingContainer: {
158
+ flex: 1,
159
+ justifyContent: "center",
160
+ alignItems: "center",
161
+ },
153
162
  });
@@ -1,9 +1,3 @@
1
- /**
2
- * Feature Layout Types
3
- * Shared types for SingleImageFeatureLayout and DualImageFeatureLayout
4
- */
5
-
6
- // Re-export all partial types
7
1
  export type {
8
2
  ModalTranslations,
9
3
  BaseLayoutTranslations,
@@ -12,7 +6,6 @@ export type {
12
6
  DualImageInputRenderProps,
13
7
  SingleImageWithPromptInputRenderProps,
14
8
  ResultRenderProps,
15
- ProcessingModalRenderProps,
16
9
  CustomResultRenderProps,
17
10
  DualImageVideoFeatureState,
18
11
  SingleImageWithPromptFeatureState,
@@ -16,11 +16,7 @@ export type {
16
16
  SingleImageWithPromptInputRenderProps,
17
17
  } from "./input-props";
18
18
 
19
- export type {
20
- ResultRenderProps,
21
- ProcessingModalRenderProps,
22
- CustomResultRenderProps,
23
- } from "./result-props";
19
+ export type { ResultRenderProps, CustomResultRenderProps } from "./result-props";
24
20
 
25
21
  export type {
26
22
  DualImageVideoFeatureState,
@@ -18,11 +18,7 @@ import type {
18
18
  DualImageInputRenderProps,
19
19
  SingleImageWithPromptInputRenderProps,
20
20
  } from "./input-props";
21
- import type {
22
- ResultRenderProps,
23
- ProcessingModalRenderProps,
24
- CustomResultRenderProps,
25
- } from "./result-props";
21
+ import type { ResultRenderProps, CustomResultRenderProps } from "./result-props";
26
22
  import type {
27
23
  DualImageVideoFeatureState,
28
24
  SingleImageWithPromptFeatureState,
@@ -30,15 +26,16 @@ import type {
30
26
 
31
27
  /**
32
28
  * Single image feature layout props
29
+ * Note: No modal - shows fullscreen progress when processing (FutureUS pattern)
33
30
  */
34
31
  export interface SingleImageFeatureLayoutProps {
35
32
  /** Feature hook return */
36
33
  feature: BaseSingleImageHookReturn;
37
34
  /** UI translations */
38
35
  translations: BaseLayoutTranslations & PhotoUploadTranslations;
39
- /** Modal translations */
36
+ /** Progress screen translations */
40
37
  modalTranslations: ModalTranslations;
41
- /** Modal icon */
38
+ /** Progress screen icon */
42
39
  modalIcon?: string;
43
40
  /** Render the input section (photo upload) */
44
41
  renderInput: (props: SingleImageInputRenderProps) => ReactNode;
@@ -48,23 +45,22 @@ export interface SingleImageFeatureLayoutProps {
48
45
  renderCustomResult?: (props: CustomResultRenderProps) => ReactNode;
49
46
  /** Optional description text */
50
47
  description?: string;
51
- /** Optional custom processing modal */
52
- renderProcessingModal?: (props: ProcessingModalRenderProps) => ReactNode;
53
48
  /** Optional children to render before the input */
54
49
  children?: ReactNode;
55
50
  }
56
51
 
57
52
  /**
58
53
  * Dual image feature layout props
54
+ * Note: No modal - shows fullscreen progress when processing (FutureUS pattern)
59
55
  */
60
56
  export interface DualImageFeatureLayoutProps {
61
57
  /** Feature hook return */
62
58
  feature: BaseDualImageHookReturn;
63
59
  /** UI translations */
64
60
  translations: BaseLayoutTranslations;
65
- /** Modal translations */
61
+ /** Progress screen translations */
66
62
  modalTranslations: ModalTranslations;
67
- /** Modal icon */
63
+ /** Progress screen icon */
68
64
  modalIcon?: string;
69
65
  /** Render the input section (dual image picker) */
70
66
  renderInput: (props: DualImageInputRenderProps) => ReactNode;
@@ -72,45 +68,43 @@ export interface DualImageFeatureLayoutProps {
72
68
  renderResult: (props: ResultRenderProps) => ReactNode;
73
69
  /** Optional description text */
74
70
  description?: string;
75
- /** Optional custom processing modal */
76
- renderProcessingModal?: (props: ProcessingModalRenderProps) => ReactNode;
77
71
  /** Optional children to render before the input */
78
72
  children?: ReactNode;
79
73
  }
80
74
 
81
75
  /**
82
76
  * Dual image video feature layout props
77
+ * Note: No modal - shows fullscreen progress when processing (FutureUS pattern)
83
78
  */
84
79
  export interface DualImageVideoFeatureLayoutProps {
85
80
  /** Feature hook return */
86
81
  feature: DualImageVideoFeatureState;
87
82
  /** UI translations */
88
83
  translations: BaseLayoutTranslations;
89
- /** Modal translations */
84
+ /** Progress screen translations */
90
85
  modalTranslations: ModalTranslations;
91
- /** Modal icon */
86
+ /** Progress screen icon */
92
87
  modalIcon?: string;
93
88
  /** Render the input section (dual image picker) */
94
89
  renderInput: (props: DualImageInputRenderProps) => ReactNode;
95
90
  /** Optional description text */
96
91
  description?: string;
97
- /** Optional custom processing modal */
98
- renderProcessingModal?: (props: ProcessingModalRenderProps) => ReactNode;
99
92
  /** Optional children to render before the input */
100
93
  children?: ReactNode;
101
94
  }
102
95
 
103
96
  /**
104
97
  * Single image with prompt feature layout props
98
+ * Note: No modal - shows fullscreen progress when processing (FutureUS pattern)
105
99
  */
106
100
  export interface SingleImageWithPromptFeatureLayoutProps {
107
101
  /** Feature hook return */
108
102
  feature: SingleImageWithPromptFeatureState;
109
103
  /** UI translations */
110
104
  translations: BaseLayoutTranslations & PhotoUploadTranslations;
111
- /** Modal translations */
105
+ /** Progress screen translations */
112
106
  modalTranslations: ModalTranslations;
113
- /** Modal icon */
107
+ /** Progress screen icon */
114
108
  modalIcon?: string;
115
109
  /** Render the input section (photo upload + prompt) */
116
110
  renderInput: (props: SingleImageWithPromptInputRenderProps) => ReactNode;
@@ -118,8 +112,6 @@ export interface SingleImageWithPromptFeatureLayoutProps {
118
112
  renderResult: (props: ResultRenderProps) => ReactNode;
119
113
  /** Optional description text */
120
114
  description?: string;
121
- /** Optional custom processing modal */
122
- renderProcessingModal?: (props: ProcessingModalRenderProps) => ReactNode;
123
115
  /** Optional children to render before the input */
124
116
  children?: ReactNode;
125
117
  }
@@ -11,14 +11,6 @@ export interface ResultRenderProps {
11
11
  imageSize: number;
12
12
  }
13
13
 
14
- /**
15
- * Processing modal render props
16
- */
17
- export interface ProcessingModalRenderProps {
18
- visible: boolean;
19
- progress: number;
20
- }
21
-
22
14
  /**
23
15
  * Custom result render props (includes feature state for comparison views)
24
16
  */
@@ -1,134 +0,0 @@
1
- /**
2
- * GenerationProgressModal
3
- * Generic AI generation progress modal using BaseModal
4
- * Props-driven for 100+ apps compatibility
5
- */
6
-
7
- import React, { useEffect } from "react";
8
- import { StyleSheet } from "react-native";
9
- import {
10
- BaseModal,
11
- useAppDesignTokens,
12
- } from "@umituz/react-native-design-system";
13
- import {
14
- GenerationProgressContent,
15
- type GenerationProgressContentProps,
16
- } from "./GenerationProgressContent";
17
-
18
- declare const __DEV__: boolean;
19
-
20
- export interface GenerationProgressRenderProps {
21
- readonly progress: number;
22
- readonly icon?: string;
23
- readonly title?: string;
24
- readonly message?: string;
25
- readonly hint?: string;
26
- readonly onDismiss?: () => void;
27
- readonly onClose?: () => void;
28
- }
29
-
30
- export interface GenerationProgressModalProps
31
- extends Omit<GenerationProgressContentProps, "backgroundColor"> {
32
- readonly visible: boolean;
33
- readonly modalBackgroundColor?: string;
34
- readonly renderContent?: (
35
- props: GenerationProgressRenderProps
36
- ) => React.ReactNode;
37
- }
38
-
39
- export const GenerationProgressModal: React.FC<
40
- GenerationProgressModalProps
41
- > = ({
42
- visible,
43
- progress,
44
- icon,
45
- title,
46
- message,
47
- hint,
48
- dismissLabel,
49
- onDismiss,
50
- onClose,
51
- backgroundHint,
52
- modalBackgroundColor,
53
- textColor,
54
- hintColor,
55
- progressColor,
56
- progressBackgroundColor,
57
- dismissButtonColor,
58
- renderContent,
59
- }) => {
60
- const tokens = useAppDesignTokens();
61
- const clampedProgress = Math.max(0, Math.min(100, progress));
62
-
63
- // Debug logging
64
- useEffect(() => {
65
- if (typeof __DEV__ !== "undefined" && __DEV__) {
66
- console.log("[GenerationProgressModal] Mounted/Updated:", {
67
- visible,
68
- progress: clampedProgress,
69
- hasTitle: !!title,
70
- hasMessage: !!message,
71
- });
72
- }
73
- }, [visible, clampedProgress, title, message]);
74
-
75
- useEffect(() => {
76
- if (typeof __DEV__ !== "undefined" && __DEV__ && visible) {
77
- console.log("[GenerationProgressModal] VISIBLE - Modal should be showing now");
78
- }
79
- }, [visible]);
80
-
81
- const handleClose = React.useCallback(() => {
82
- onDismiss?.();
83
- }, [onDismiss]);
84
-
85
- const content = renderContent ? (
86
- renderContent({
87
- progress: clampedProgress,
88
- icon,
89
- title,
90
- message,
91
- hint,
92
- onDismiss,
93
- onClose,
94
- })
95
- ) : (
96
- <GenerationProgressContent
97
- progress={clampedProgress}
98
- icon={icon}
99
- title={title}
100
- message={message}
101
- hint={hint}
102
- dismissLabel={dismissLabel}
103
- onDismiss={onDismiss}
104
- onClose={onClose}
105
- backgroundHint={backgroundHint}
106
- backgroundColor={modalBackgroundColor || tokens.colors.surface}
107
- textColor={textColor || tokens.colors.textPrimary}
108
- hintColor={hintColor || tokens.colors.textTertiary}
109
- progressColor={progressColor || tokens.colors.primary}
110
- progressBackgroundColor={
111
- progressBackgroundColor || tokens.colors.surfaceVariant
112
- }
113
- dismissButtonColor={dismissButtonColor || tokens.colors.primary}
114
- />
115
- );
116
-
117
- return (
118
- <BaseModal
119
- visible={visible}
120
- onClose={handleClose}
121
- dismissOnBackdrop={false}
122
- contentStyle={styles.modalContent}
123
- >
124
- {content}
125
- </BaseModal>
126
- );
127
- };
128
-
129
- const styles = StyleSheet.create({
130
- modalContent: {
131
- backgroundColor: "transparent",
132
- borderWidth: 0,
133
- },
134
- });