@umituz/react-native-ai-generation-content 1.17.55 → 1.17.57

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.55",
3
+ "version": "1.17.57",
4
4
  "description": "Provider-agnostic AI generation orchestration for React Native",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",
@@ -1,34 +1,59 @@
1
- import React from "react";
1
+ import React, { PropsWithChildren } from "react";
2
2
  import { StyleSelector } from "./selectors/StyleSelector";
3
3
  import { DurationSelector } from "./selectors/DurationSelector";
4
+ import { AspectRatioSelector } from "./selectors/AspectRatioSelector";
4
5
  import { PromptInput } from "./PromptInput";
5
6
  import { GenerateButton } from "./buttons/GenerateButton";
7
+ import { ExamplePrompts } from "./prompts/ExamplePrompts";
6
8
  import type { StyleOption } from "./selectors/types";
9
+ import type { AspectRatioOption } from "./selectors/types";
7
10
 
8
11
  export interface AIGenerationFormTranslations {
9
12
  promptTitle: string;
10
13
  promptPlaceholder: string;
11
- styleTitle: string;
12
- durationTitle: string;
14
+ styleTitle?: string;
15
+ durationTitle?: string;
16
+ aspectRatioTitle?: string;
17
+ examplePromptsTitle?: string;
13
18
  generateButton: string;
14
19
  generatingButton: string;
15
20
  }
16
21
 
17
- export interface AIGenerationFormProps {
22
+ export interface AIGenerationFormProps extends PropsWithChildren {
18
23
  prompt: string;
19
24
  onPromptChange: (text: string) => void;
20
25
 
21
- styles: StyleOption[];
22
- selectedStyle: string;
23
- onStyleSelect: (styleId: string) => void;
26
+ // Optional: Example Prompts
27
+ examplePrompts?: readonly string[];
28
+ onExamplePromptSelect?: (prompt: string) => void;
24
29
 
25
- duration: number;
26
- durationOptions: readonly number[];
27
- onDurationSelect: (duration: number) => void;
30
+ // Optional: Style Selection
31
+ styles?: StyleOption[];
32
+ selectedStyle?: string;
33
+ onStyleSelect?: (styleId: string) => void;
34
+
35
+ // Optional: Duration Selection
36
+ duration?: number;
37
+ durationOptions?: readonly number[];
38
+ onDurationSelect?: (duration: number) => void;
39
+ formatDurationLabel?: (duration: number) => string;
40
+
41
+ // Optional: Aspect Ratio Selection
42
+ aspectRatios?: AspectRatioOption[];
43
+ selectedAspectRatio?: string;
44
+ onAspectRatioSelect?: (ratio: string) => void;
28
45
 
29
46
  onGenerate: () => void;
30
47
  isGenerating: boolean;
31
48
 
49
+ // Custom Generate Button Props
50
+ generateButtonProps?: {
51
+ costLabel?: string;
52
+ accessoryRight?: React.ReactNode;
53
+ onAccessoryRightPress?: () => void;
54
+ icon?: string;
55
+ };
56
+
32
57
  translations: AIGenerationFormTranslations;
33
58
  }
34
59
 
@@ -36,6 +61,9 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
36
61
  prompt,
37
62
  onPromptChange,
38
63
 
64
+ examplePrompts,
65
+ onExamplePromptSelect,
66
+
39
67
  styles,
40
68
  selectedStyle,
41
69
  onStyleSelect,
@@ -43,11 +71,19 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
43
71
  duration,
44
72
  durationOptions,
45
73
  onDurationSelect,
74
+ formatDurationLabel,
75
+
76
+ aspectRatios,
77
+ selectedAspectRatio,
78
+ onAspectRatioSelect,
46
79
 
47
80
  onGenerate,
48
81
  isGenerating,
49
82
 
83
+ generateButtonProps,
84
+
50
85
  translations,
86
+ children,
51
87
  }) => {
52
88
  return (
53
89
  <>
@@ -58,19 +94,44 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
58
94
  onChangeText={onPromptChange}
59
95
  />
60
96
 
61
- <StyleSelector
62
- styles={styles}
63
- selectedStyle={selectedStyle}
64
- onStyleSelect={onStyleSelect}
65
- title={translations.styleTitle}
66
- />
97
+ {examplePrompts && examplePrompts.length > 0 && onExamplePromptSelect && (
98
+ <ExamplePrompts
99
+ prompts={examplePrompts}
100
+ onSelectPrompt={onExamplePromptSelect}
101
+ title={translations.examplePromptsTitle}
102
+ />
103
+ )}
67
104
 
68
- <DurationSelector
69
- duration={duration}
70
- durationOptions={durationOptions}
71
- onDurationSelect={onDurationSelect}
72
- title={translations.durationTitle}
73
- />
105
+ {styles && styles.length > 0 && selectedStyle && onStyleSelect && translations.styleTitle && (
106
+ <StyleSelector
107
+ styles={styles}
108
+ selectedStyle={selectedStyle}
109
+ onStyleSelect={onStyleSelect}
110
+ title={translations.styleTitle}
111
+ />
112
+ )}
113
+
114
+ {aspectRatios && aspectRatios.length > 0 && selectedAspectRatio && onAspectRatioSelect && translations.aspectRatioTitle && (
115
+ <AspectRatioSelector
116
+ ratios={aspectRatios}
117
+ selectedRatio={selectedAspectRatio}
118
+ onRatioSelect={onAspectRatioSelect}
119
+ title={translations.aspectRatioTitle}
120
+ />
121
+ )}
122
+
123
+ {duration && durationOptions && onDurationSelect && translations.durationTitle && (
124
+ <DurationSelector
125
+ duration={duration}
126
+ durationOptions={durationOptions}
127
+ onDurationSelect={onDurationSelect}
128
+ title={translations.durationTitle}
129
+ formatLabel={formatDurationLabel}
130
+ />
131
+ )}
132
+
133
+ {/* Custom children injected here */}
134
+ {children}
74
135
 
75
136
  <GenerateButton
76
137
  onPress={onGenerate}
@@ -79,7 +140,10 @@ export const AIGenerationForm: React.FC<AIGenerationFormProps> = ({
79
140
  text={translations.generateButton}
80
141
  processingText={translations.generatingButton}
81
142
  variant="solid"
82
- icon="sparkles-outline"
143
+ icon={generateButtonProps?.icon || "sparkles-outline"}
144
+ costLabel={generateButtonProps?.costLabel}
145
+ accessoryRight={generateButtonProps?.accessoryRight}
146
+ onAccessoryRightPress={generateButtonProps?.onAccessoryRightPress}
83
147
  />
84
148
  </>
85
149
  );