@umituz/react-native-ai-generation-content 1.17.107 → 1.17.109

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.17.107",
3
+ "version": "1.17.109",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
package/src/index.ts CHANGED
@@ -175,6 +175,7 @@ export {
175
175
  getProgressForStatus,
176
176
  interpolateProgress,
177
177
  createProgressTracker,
178
+ calculatePollingProgress,
178
179
  // Status checking
179
180
  checkStatusForErrors,
180
181
  isJobComplete,
@@ -305,7 +306,6 @@ export {
305
306
  ImagePickerBox,
306
307
  DualImagePicker,
307
308
  // New Generic Sections
308
- AIGenerationProgressInline,
309
309
  PromptInput,
310
310
  AIGenerationHero,
311
311
  ExamplePrompts,
@@ -360,7 +360,6 @@ export type {
360
360
  // Image Picker
361
361
  ImagePickerBoxProps,
362
362
  DualImagePickerProps,
363
- AIGenerationProgressInlineProps,
364
363
  PromptInputProps,
365
364
  AIGenerationHeroProps,
366
365
  ExamplePromptsProps,
@@ -45,6 +45,27 @@ export function interpolateProgress(
45
45
  return Math.round(progress);
46
46
  }
47
47
 
48
+ /**
49
+ * Calculate progress for polling-based operations
50
+ * Returns a rounded integer between minProgress and maxProgress
51
+ *
52
+ * @param currentAttempt - Current polling attempt (1-based)
53
+ * @param maxAttempts - Maximum number of polling attempts
54
+ * @param minProgress - Starting progress percentage (default: 10)
55
+ * @param maxProgress - Maximum progress percentage before completion (default: 95)
56
+ * @returns Rounded progress percentage
57
+ */
58
+ export function calculatePollingProgress(
59
+ currentAttempt: number,
60
+ maxAttempts: number,
61
+ minProgress: number = 10,
62
+ maxProgress: number = 95,
63
+ ): number {
64
+ const ratio = currentAttempt / maxAttempts;
65
+ const progress = minProgress + ratio * (maxProgress - minProgress);
66
+ return Math.round(Math.min(maxProgress, progress));
67
+ }
68
+
48
69
  export function createProgressTracker(stages?: ProgressStageConfig[]) {
49
70
  const effectiveStages = stages ?? DEFAULT_PROGRESS_STAGES;
50
71
  let currentStatus: GenerationStatus = "idle";
@@ -13,8 +13,8 @@ import { AspectRatioSelector } from "./selectors/AspectRatioSelector";
13
13
  import { PromptInput } from "./PromptInput";
14
14
  import { GenerateButton } from "./buttons/GenerateButton";
15
15
  import { ExamplePrompts } from "./prompts/ExamplePrompts";
16
- import { AIGenerationProgressInline } from "./AIGenerationProgressInline";
17
16
  import { StylePresetsGrid } from "./StylePresetsGrid";
17
+ import { GenerationProgressModal } from "./GenerationProgressModal";
18
18
  import type { AIGenerationFormProps } from "./AIGenerationForm.types";
19
19
 
20
20
  export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
@@ -36,6 +36,7 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
36
36
  isGenerating,
37
37
  hideGenerateButton,
38
38
  progress,
39
+ progressIcon,
39
40
  generateButtonProps,
40
41
  showAdvanced,
41
42
  onAdvancedToggle,
@@ -155,13 +156,14 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
155
156
  </>
156
157
  )}
157
158
 
158
- {isGenerating && progress !== undefined && (
159
- <AIGenerationProgressInline
160
- progress={progress}
161
- title={translations.progressTitle || translations.generatingButton}
162
- hint={translations.progressHint}
163
- />
164
- )}
159
+ {/* MANDATORY: Progress Modal shows automatically when isGenerating */}
160
+ <GenerationProgressModal
161
+ visible={isGenerating}
162
+ progress={progress ?? 0}
163
+ icon={progressIcon || "sparkles-outline"}
164
+ title={translations.progressTitle || translations.generatingButton}
165
+ message={translations.progressMessage || translations.progressHint}
166
+ />
165
167
  </>
166
168
  );
167
169
  };
@@ -14,7 +14,9 @@ export interface AIGenerationFormTranslations {
14
14
  examplePromptsTitle?: string;
15
15
  generateButton: string;
16
16
  generatingButton: string;
17
+ // Progress Modal (mandatory when isGenerating)
17
18
  progressTitle?: string;
19
+ progressMessage?: string;
18
20
  progressHint?: string;
19
21
  presetsTitle?: string;
20
22
  showAdvancedLabel?: string;
@@ -54,7 +56,8 @@ export interface AIGenerationFormProps extends PropsWithChildren {
54
56
 
55
57
  // Optional: Generation Progress
56
58
  progress?: number;
57
-
59
+ progressIcon?: string;
60
+
58
61
  // Custom Generate Button Props
59
62
  generateButtonProps?: {
60
63
  costLabel?: string;
@@ -4,7 +4,6 @@ export { GenerationProgressBar } from "./GenerationProgressBar";
4
4
  export { PendingJobCard } from "./PendingJobCard";
5
5
  export { PendingJobProgressBar } from "./PendingJobProgressBar";
6
6
  export { PendingJobCardActions } from "./PendingJobCardActions";
7
- export { AIGenerationProgressInline } from "./AIGenerationProgressInline";
8
7
  export { PromptInput } from "./PromptInput";
9
8
  export { AIGenerationHero } from "./AIGenerationHero";
10
9
  export * from "./StylePresetsGrid";
@@ -26,7 +25,6 @@ export type {
26
25
 
27
26
  export type { PendingJobProgressBarProps } from "./PendingJobProgressBar";
28
27
  export type { PendingJobCardActionsProps } from "./PendingJobCardActions";
29
- export type { AIGenerationProgressInlineProps } from "./AIGenerationProgressInline";
30
28
  export type { PromptInputProps } from "./PromptInput";
31
29
  export type { AIGenerationHeroProps } from "./AIGenerationHero";
32
30
 
@@ -1,106 +0,0 @@
1
- /**
2
- * AIGenerationProgressInline Component
3
- * Generic inline generation progress display
4
- * Props-driven for 100+ apps compatibility
5
- */
6
-
7
- import React from "react";
8
- import { View, StyleSheet } from "react-native";
9
- import {
10
- AtomicText,
11
- useAppDesignTokens,
12
- AtomicProgress,
13
- AtomicSpinner,
14
- } from "@umituz/react-native-design-system";
15
-
16
- export interface AIGenerationProgressInlineProps {
17
- readonly progress: number;
18
- readonly title?: string;
19
- readonly message?: string;
20
- readonly hint?: string;
21
- readonly backgroundColor?: string;
22
- readonly accentColor?: string;
23
- }
24
-
25
- export const AIGenerationProgressInline: React.FC<
26
- AIGenerationProgressInlineProps
27
- > = ({
28
- progress,
29
- title,
30
- message,
31
- hint,
32
- backgroundColor,
33
- accentColor,
34
- }) => {
35
- const tokens = useAppDesignTokens();
36
- const primaryColor = accentColor || tokens.colors.primary;
37
- const bgColor = backgroundColor || tokens.colors.surface;
38
-
39
- const clampedProgress = Math.max(0, Math.min(100, progress));
40
-
41
- return (
42
- <View style={[styles.container, { backgroundColor: bgColor }]}>
43
- <AtomicSpinner size="lg" color={primaryColor} />
44
-
45
- {title && (
46
- <AtomicText
47
- type="bodyMedium"
48
- style={[styles.title, { color: tokens.colors.textPrimary }]}
49
- >
50
- {title}
51
- </AtomicText>
52
- )}
53
-
54
- {message && (
55
- <AtomicText
56
- type="bodySmall"
57
- style={[styles.message, { color: tokens.colors.textSecondary }]}
58
- >
59
- {message}
60
- </AtomicText>
61
- )}
62
-
63
- <View style={styles.progressBarWrapper}>
64
- <AtomicProgress
65
- value={clampedProgress}
66
- height={8}
67
- color={primaryColor}
68
- backgroundColor={tokens.colors.surfaceVariant}
69
- shape="rounded"
70
- showPercentage={false}
71
- />
72
- </View>
73
-
74
- <AtomicText
75
- type="labelSmall"
76
- style={[styles.progressLabel, { color: tokens.colors.textSecondary }]}
77
- >
78
- {clampedProgress}%{hint ? ` • ${hint}` : ""}
79
- </AtomicText>
80
- </View>
81
- );
82
- };
83
-
84
- const styles = StyleSheet.create({
85
- container: {
86
- margin: 16,
87
- padding: 24,
88
- borderRadius: 16,
89
- alignItems: "center",
90
- },
91
- title: {
92
- marginTop: 16,
93
- fontWeight: "600",
94
- },
95
- message: {
96
- marginTop: 8,
97
- textAlign: "center",
98
- },
99
- progressBarWrapper: {
100
- width: "100%",
101
- marginTop: 16,
102
- },
103
- progressLabel: {
104
- marginTop: 8,
105
- },
106
- });