@umituz/react-native-ai-generation-content 1.17.16 → 1.17.18
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 +1 -4
- package/src/domains/creations/presentation/components/CreationDetail/DetailImage.tsx +14 -14
- package/src/domains/creations/presentation/components/CreationDetail/DetailVideo.tsx +51 -58
- package/src/domains/creations/presentation/screens/CreationDetailScreen.tsx +36 -29
- package/src/domains/creations/presentation/screens/CreationsGalleryScreen.tsx +98 -69
- package/src/features/text-to-image/index.ts +92 -4
- package/src/features/text-to-image/presentation/components/AspectRatioSelector.tsx +98 -0
- package/src/features/text-to-image/presentation/components/ExamplePrompts.tsx +88 -0
- package/src/features/text-to-image/presentation/components/ImageSizeSelector.tsx +98 -0
- package/src/features/text-to-image/presentation/components/NumImagesSelector.tsx +93 -0
- package/src/features/text-to-image/presentation/components/OutputFormatSelector.tsx +98 -0
- package/src/features/text-to-image/presentation/components/SettingsSheet.tsx +139 -0
- package/src/features/text-to-image/presentation/components/StyleSelector.tsx +110 -0
- package/src/features/text-to-image/presentation/components/TextToImageGenerateButton.tsx +84 -0
- package/src/features/text-to-image/presentation/components/TextToImagePromptInput.tsx +90 -0
- package/src/features/text-to-image/presentation/components/index.ts +44 -0
- package/src/features/text-to-image/presentation/hooks/index.ts +25 -0
- package/src/features/text-to-image/presentation/hooks/useFormState.ts +103 -0
- package/src/features/text-to-image/presentation/hooks/useGeneration.ts +98 -0
- package/src/features/text-to-image/presentation/hooks/useTextToImageForm.ts +58 -0
- package/src/features/text-to-image/presentation/index.ts +6 -0
- package/src/features/text-to-voice/domain/types/component.types.ts +91 -0
- package/src/features/text-to-voice/domain/types/config.types.ts +34 -0
- package/src/features/text-to-voice/domain/types/form.types.ts +39 -0
- package/src/features/text-to-voice/domain/types/generation.types.ts +43 -0
- package/src/features/text-to-voice/domain/types/index.ts +31 -3
- package/src/features/text-to-voice/infrastructure/services/text-to-voice-executor.ts +2 -10
- package/src/features/text-to-voice/domain/types/text-to-voice.types.ts +0 -65
|
@@ -3,25 +3,113 @@
|
|
|
3
3
|
* Provider-agnostic text-to-image generation feature
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
//
|
|
6
|
+
// =============================================================================
|
|
7
|
+
// DOMAIN LAYER - Types
|
|
8
|
+
// =============================================================================
|
|
9
|
+
|
|
10
|
+
// Form Types
|
|
11
|
+
export type {
|
|
12
|
+
AspectRatio,
|
|
13
|
+
ImageSize,
|
|
14
|
+
OutputFormat,
|
|
15
|
+
NumImages,
|
|
16
|
+
StyleOption,
|
|
17
|
+
TextToImageFormState,
|
|
18
|
+
TextToImageFormActions,
|
|
19
|
+
TextToImageFormDefaults,
|
|
20
|
+
} from "./domain";
|
|
21
|
+
|
|
22
|
+
// Config Types
|
|
23
|
+
export type {
|
|
24
|
+
GenerationRequest,
|
|
25
|
+
GenerationResult,
|
|
26
|
+
GenerationResultSuccess,
|
|
27
|
+
GenerationResultError,
|
|
28
|
+
TextToImageCallbacks,
|
|
29
|
+
TextToImageFormConfig,
|
|
30
|
+
TextToImageTranslations,
|
|
31
|
+
} from "./domain";
|
|
32
|
+
|
|
33
|
+
// Provider Types
|
|
7
34
|
export type {
|
|
8
35
|
TextToImageOptions,
|
|
9
36
|
TextToImageRequest,
|
|
10
37
|
TextToImageResult,
|
|
11
38
|
TextToImageFeatureState,
|
|
12
|
-
TextToImageTranslations,
|
|
13
39
|
TextToImageInputBuilder,
|
|
14
40
|
TextToImageResultExtractor,
|
|
15
41
|
TextToImageFeatureConfig,
|
|
16
42
|
} from "./domain";
|
|
17
43
|
|
|
18
|
-
//
|
|
44
|
+
// =============================================================================
|
|
45
|
+
// DOMAIN LAYER - Constants
|
|
46
|
+
// =============================================================================
|
|
47
|
+
|
|
48
|
+
export {
|
|
49
|
+
DEFAULT_IMAGE_STYLES,
|
|
50
|
+
DEFAULT_NUM_IMAGES_OPTIONS,
|
|
51
|
+
DEFAULT_ASPECT_RATIO_OPTIONS,
|
|
52
|
+
DEFAULT_SIZE_OPTIONS,
|
|
53
|
+
DEFAULT_OUTPUT_FORMAT_OPTIONS,
|
|
54
|
+
DEFAULT_FORM_VALUES,
|
|
55
|
+
} from "./domain";
|
|
56
|
+
|
|
57
|
+
// =============================================================================
|
|
58
|
+
// INFRASTRUCTURE LAYER
|
|
59
|
+
// =============================================================================
|
|
60
|
+
|
|
19
61
|
export { executeTextToImage, hasTextToImageSupport } from "./infrastructure";
|
|
20
62
|
export type { ExecuteTextToImageOptions } from "./infrastructure";
|
|
21
63
|
|
|
22
|
-
//
|
|
64
|
+
// =============================================================================
|
|
65
|
+
// PRESENTATION LAYER - Hooks
|
|
66
|
+
// =============================================================================
|
|
67
|
+
|
|
68
|
+
export { useFormState, useGeneration, useTextToImageForm } from "./presentation";
|
|
69
|
+
export type {
|
|
70
|
+
UseFormStateOptions,
|
|
71
|
+
UseFormStateReturn,
|
|
72
|
+
GenerationState,
|
|
73
|
+
UseGenerationOptions,
|
|
74
|
+
UseGenerationReturn,
|
|
75
|
+
UseTextToImageFormOptions,
|
|
76
|
+
UseTextToImageFormReturn,
|
|
77
|
+
} from "./presentation";
|
|
78
|
+
|
|
79
|
+
// Provider-based Feature Hook
|
|
23
80
|
export { useTextToImageFeature } from "./presentation";
|
|
24
81
|
export type {
|
|
25
82
|
UseTextToImageFeatureProps,
|
|
26
83
|
UseTextToImageFeatureReturn,
|
|
27
84
|
} from "./presentation";
|
|
85
|
+
|
|
86
|
+
// =============================================================================
|
|
87
|
+
// PRESENTATION LAYER - Components
|
|
88
|
+
// =============================================================================
|
|
89
|
+
|
|
90
|
+
export {
|
|
91
|
+
TextToImagePromptInput,
|
|
92
|
+
TextToImageExamplePrompts,
|
|
93
|
+
TextToImageNumImagesSelector,
|
|
94
|
+
TextToImageStyleSelector,
|
|
95
|
+
TextToImageAspectRatioSelector,
|
|
96
|
+
TextToImageSizeSelector,
|
|
97
|
+
TextToImageOutputFormatSelector,
|
|
98
|
+
TextToImageGenerateButton,
|
|
99
|
+
TextToImageSettingsSheet,
|
|
100
|
+
} from "./presentation";
|
|
101
|
+
|
|
102
|
+
export type {
|
|
103
|
+
TextToImagePromptInputProps,
|
|
104
|
+
TextToImageExamplePromptsProps,
|
|
105
|
+
TextToImageNumImagesSelectorProps,
|
|
106
|
+
TextToImageStyleSelectorProps,
|
|
107
|
+
TextToImageAspectRatioSelectorProps,
|
|
108
|
+
TextToImageAspectRatioOption,
|
|
109
|
+
TextToImageSizeSelectorProps,
|
|
110
|
+
TextToImageSizeOption,
|
|
111
|
+
TextToImageOutputFormatSelectorProps,
|
|
112
|
+
TextToImageOutputFormatOption,
|
|
113
|
+
TextToImageGenerateButtonProps,
|
|
114
|
+
TextToImageSettingsSheetProps,
|
|
115
|
+
} from "./presentation";
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Aspect Ratio Selector Component
|
|
3
|
+
* Button group for selecting image aspect ratio
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
8
|
+
import {
|
|
9
|
+
AtomicText,
|
|
10
|
+
useAppDesignTokens,
|
|
11
|
+
} from "@umituz/react-native-design-system";
|
|
12
|
+
import type { AspectRatio } from "../../domain/types/form.types";
|
|
13
|
+
|
|
14
|
+
export interface AspectRatioOption {
|
|
15
|
+
value: AspectRatio;
|
|
16
|
+
label: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface AspectRatioSelectorProps {
|
|
20
|
+
value: AspectRatio;
|
|
21
|
+
onChange: (ratio: AspectRatio) => void;
|
|
22
|
+
options: AspectRatioOption[];
|
|
23
|
+
label: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const AspectRatioSelector: React.FC<AspectRatioSelectorProps> = ({
|
|
27
|
+
value,
|
|
28
|
+
onChange,
|
|
29
|
+
options,
|
|
30
|
+
label,
|
|
31
|
+
}) => {
|
|
32
|
+
const tokens = useAppDesignTokens();
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View style={styles.container}>
|
|
36
|
+
<AtomicText
|
|
37
|
+
type="bodyMedium"
|
|
38
|
+
style={[styles.label, { color: tokens.colors.textPrimary }]}
|
|
39
|
+
>
|
|
40
|
+
{label}
|
|
41
|
+
</AtomicText>
|
|
42
|
+
<View style={styles.optionsRow}>
|
|
43
|
+
{options.map((option) => {
|
|
44
|
+
const isSelected = value === option.value;
|
|
45
|
+
return (
|
|
46
|
+
<TouchableOpacity
|
|
47
|
+
key={option.value}
|
|
48
|
+
style={[
|
|
49
|
+
styles.option,
|
|
50
|
+
{
|
|
51
|
+
backgroundColor: isSelected
|
|
52
|
+
? tokens.colors.primary
|
|
53
|
+
: tokens.colors.surface,
|
|
54
|
+
borderColor: isSelected
|
|
55
|
+
? tokens.colors.primary
|
|
56
|
+
: tokens.colors.borderLight,
|
|
57
|
+
},
|
|
58
|
+
]}
|
|
59
|
+
onPress={() => onChange(option.value)}
|
|
60
|
+
activeOpacity={0.7}
|
|
61
|
+
>
|
|
62
|
+
<AtomicText
|
|
63
|
+
type="bodySmall"
|
|
64
|
+
style={{
|
|
65
|
+
color: isSelected ? "#FFFFFF" : tokens.colors.textPrimary,
|
|
66
|
+
fontWeight: isSelected ? "600" : "400",
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{option.label}
|
|
70
|
+
</AtomicText>
|
|
71
|
+
</TouchableOpacity>
|
|
72
|
+
);
|
|
73
|
+
})}
|
|
74
|
+
</View>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
container: {
|
|
81
|
+
marginBottom: 20,
|
|
82
|
+
},
|
|
83
|
+
label: {
|
|
84
|
+
fontWeight: "600",
|
|
85
|
+
marginBottom: 12,
|
|
86
|
+
},
|
|
87
|
+
optionsRow: {
|
|
88
|
+
flexDirection: "row",
|
|
89
|
+
gap: 8,
|
|
90
|
+
},
|
|
91
|
+
option: {
|
|
92
|
+
flex: 1,
|
|
93
|
+
padding: 12,
|
|
94
|
+
borderRadius: 8,
|
|
95
|
+
borderWidth: 1,
|
|
96
|
+
alignItems: "center",
|
|
97
|
+
},
|
|
98
|
+
});
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Example Prompts Component
|
|
3
|
+
* Horizontal scrollable list of example prompts
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { View, ScrollView, TouchableOpacity, StyleSheet } from "react-native";
|
|
8
|
+
import {
|
|
9
|
+
AtomicText,
|
|
10
|
+
useAppDesignTokens,
|
|
11
|
+
} from "@umituz/react-native-design-system";
|
|
12
|
+
|
|
13
|
+
export interface ExamplePromptsProps {
|
|
14
|
+
prompts: string[];
|
|
15
|
+
onSelectPrompt: (prompt: string) => void;
|
|
16
|
+
label: string;
|
|
17
|
+
cardWidth?: number;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const ExamplePrompts: React.FC<ExamplePromptsProps> = ({
|
|
21
|
+
prompts,
|
|
22
|
+
onSelectPrompt,
|
|
23
|
+
label,
|
|
24
|
+
cardWidth = 180,
|
|
25
|
+
}) => {
|
|
26
|
+
const tokens = useAppDesignTokens();
|
|
27
|
+
|
|
28
|
+
if (prompts.length === 0) {
|
|
29
|
+
return null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<View style={styles.container}>
|
|
34
|
+
<AtomicText
|
|
35
|
+
type="bodyMedium"
|
|
36
|
+
style={[styles.label, { color: tokens.colors.textPrimary }]}
|
|
37
|
+
>
|
|
38
|
+
{label}
|
|
39
|
+
</AtomicText>
|
|
40
|
+
<ScrollView
|
|
41
|
+
horizontal
|
|
42
|
+
showsHorizontalScrollIndicator={false}
|
|
43
|
+
contentContainerStyle={styles.scrollContent}
|
|
44
|
+
>
|
|
45
|
+
{prompts.map((prompt, index) => (
|
|
46
|
+
<TouchableOpacity
|
|
47
|
+
key={`prompt-${index}`}
|
|
48
|
+
style={[
|
|
49
|
+
styles.card,
|
|
50
|
+
{
|
|
51
|
+
backgroundColor: tokens.colors.surface,
|
|
52
|
+
width: cardWidth,
|
|
53
|
+
},
|
|
54
|
+
]}
|
|
55
|
+
onPress={() => onSelectPrompt(prompt)}
|
|
56
|
+
activeOpacity={0.7}
|
|
57
|
+
>
|
|
58
|
+
<AtomicText
|
|
59
|
+
type="bodySmall"
|
|
60
|
+
style={{ color: tokens.colors.textPrimary }}
|
|
61
|
+
numberOfLines={2}
|
|
62
|
+
>
|
|
63
|
+
{prompt}
|
|
64
|
+
</AtomicText>
|
|
65
|
+
</TouchableOpacity>
|
|
66
|
+
))}
|
|
67
|
+
</ScrollView>
|
|
68
|
+
</View>
|
|
69
|
+
);
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
const styles = StyleSheet.create({
|
|
73
|
+
container: {
|
|
74
|
+
marginBottom: 24,
|
|
75
|
+
},
|
|
76
|
+
label: {
|
|
77
|
+
fontWeight: "600",
|
|
78
|
+
marginBottom: 12,
|
|
79
|
+
},
|
|
80
|
+
scrollContent: {
|
|
81
|
+
paddingRight: 16,
|
|
82
|
+
},
|
|
83
|
+
card: {
|
|
84
|
+
padding: 12,
|
|
85
|
+
borderRadius: 8,
|
|
86
|
+
marginRight: 12,
|
|
87
|
+
},
|
|
88
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Image Size Selector Component
|
|
3
|
+
* Selection for image output size
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
8
|
+
import {
|
|
9
|
+
AtomicText,
|
|
10
|
+
useAppDesignTokens,
|
|
11
|
+
} from "@umituz/react-native-design-system";
|
|
12
|
+
import type { ImageSize } from "../../domain/types/form.types";
|
|
13
|
+
|
|
14
|
+
export interface ImageSizeOption {
|
|
15
|
+
value: ImageSize;
|
|
16
|
+
label: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface ImageSizeSelectorProps {
|
|
20
|
+
value: ImageSize;
|
|
21
|
+
onChange: (size: ImageSize) => void;
|
|
22
|
+
options: ImageSizeOption[];
|
|
23
|
+
label: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const ImageSizeSelector: React.FC<ImageSizeSelectorProps> = ({
|
|
27
|
+
value,
|
|
28
|
+
onChange,
|
|
29
|
+
options,
|
|
30
|
+
label,
|
|
31
|
+
}) => {
|
|
32
|
+
const tokens = useAppDesignTokens();
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View style={styles.container}>
|
|
36
|
+
<AtomicText
|
|
37
|
+
type="bodyMedium"
|
|
38
|
+
style={[styles.label, { color: tokens.colors.textPrimary }]}
|
|
39
|
+
>
|
|
40
|
+
{label}
|
|
41
|
+
</AtomicText>
|
|
42
|
+
<View style={styles.optionsGrid}>
|
|
43
|
+
{options.map((option) => {
|
|
44
|
+
const isSelected = value === option.value;
|
|
45
|
+
return (
|
|
46
|
+
<TouchableOpacity
|
|
47
|
+
key={option.value}
|
|
48
|
+
style={[
|
|
49
|
+
styles.option,
|
|
50
|
+
{
|
|
51
|
+
backgroundColor: isSelected
|
|
52
|
+
? tokens.colors.primary
|
|
53
|
+
: tokens.colors.surface,
|
|
54
|
+
borderColor: isSelected
|
|
55
|
+
? tokens.colors.primary
|
|
56
|
+
: tokens.colors.borderLight,
|
|
57
|
+
},
|
|
58
|
+
]}
|
|
59
|
+
onPress={() => onChange(option.value)}
|
|
60
|
+
activeOpacity={0.7}
|
|
61
|
+
>
|
|
62
|
+
<AtomicText
|
|
63
|
+
type="bodySmall"
|
|
64
|
+
style={{
|
|
65
|
+
color: isSelected ? "#FFFFFF" : tokens.colors.textPrimary,
|
|
66
|
+
fontWeight: isSelected ? "600" : "400",
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{option.label}
|
|
70
|
+
</AtomicText>
|
|
71
|
+
</TouchableOpacity>
|
|
72
|
+
);
|
|
73
|
+
})}
|
|
74
|
+
</View>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
container: {
|
|
81
|
+
marginBottom: 20,
|
|
82
|
+
},
|
|
83
|
+
label: {
|
|
84
|
+
fontWeight: "600",
|
|
85
|
+
marginBottom: 12,
|
|
86
|
+
},
|
|
87
|
+
optionsGrid: {
|
|
88
|
+
flexDirection: "row",
|
|
89
|
+
flexWrap: "wrap",
|
|
90
|
+
gap: 8,
|
|
91
|
+
},
|
|
92
|
+
option: {
|
|
93
|
+
paddingHorizontal: 16,
|
|
94
|
+
paddingVertical: 10,
|
|
95
|
+
borderRadius: 8,
|
|
96
|
+
borderWidth: 1,
|
|
97
|
+
},
|
|
98
|
+
});
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Number of Images Selector Component
|
|
3
|
+
* Grid of buttons to select number of images to generate
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
8
|
+
import {
|
|
9
|
+
AtomicText,
|
|
10
|
+
useAppDesignTokens,
|
|
11
|
+
} from "@umituz/react-native-design-system";
|
|
12
|
+
import type { NumImages } from "../../domain/types/form.types";
|
|
13
|
+
|
|
14
|
+
export interface NumImagesSelectorProps {
|
|
15
|
+
value: NumImages;
|
|
16
|
+
onChange: (num: NumImages) => void;
|
|
17
|
+
options: NumImages[];
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const NumImagesSelector: React.FC<NumImagesSelectorProps> = ({
|
|
22
|
+
value,
|
|
23
|
+
onChange,
|
|
24
|
+
options,
|
|
25
|
+
label,
|
|
26
|
+
}) => {
|
|
27
|
+
const tokens = useAppDesignTokens();
|
|
28
|
+
|
|
29
|
+
return (
|
|
30
|
+
<View style={styles.container}>
|
|
31
|
+
<AtomicText
|
|
32
|
+
type="bodyMedium"
|
|
33
|
+
style={[styles.label, { color: tokens.colors.textPrimary }]}
|
|
34
|
+
>
|
|
35
|
+
{label}
|
|
36
|
+
</AtomicText>
|
|
37
|
+
<View style={styles.grid}>
|
|
38
|
+
{options.map((num) => {
|
|
39
|
+
const isSelected = value === num;
|
|
40
|
+
return (
|
|
41
|
+
<TouchableOpacity
|
|
42
|
+
key={num}
|
|
43
|
+
style={[
|
|
44
|
+
styles.button,
|
|
45
|
+
{
|
|
46
|
+
backgroundColor: isSelected
|
|
47
|
+
? tokens.colors.primary
|
|
48
|
+
: tokens.colors.surface,
|
|
49
|
+
borderColor: isSelected
|
|
50
|
+
? tokens.colors.primary
|
|
51
|
+
: tokens.colors.borderLight,
|
|
52
|
+
},
|
|
53
|
+
]}
|
|
54
|
+
onPress={() => onChange(num)}
|
|
55
|
+
activeOpacity={0.7}
|
|
56
|
+
>
|
|
57
|
+
<AtomicText
|
|
58
|
+
type="bodyLarge"
|
|
59
|
+
style={{
|
|
60
|
+
color: isSelected ? "#FFFFFF" : tokens.colors.textPrimary,
|
|
61
|
+
fontWeight: isSelected ? "700" : "400",
|
|
62
|
+
}}
|
|
63
|
+
>
|
|
64
|
+
{num}
|
|
65
|
+
</AtomicText>
|
|
66
|
+
</TouchableOpacity>
|
|
67
|
+
);
|
|
68
|
+
})}
|
|
69
|
+
</View>
|
|
70
|
+
</View>
|
|
71
|
+
);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const styles = StyleSheet.create({
|
|
75
|
+
container: {
|
|
76
|
+
marginBottom: 24,
|
|
77
|
+
},
|
|
78
|
+
label: {
|
|
79
|
+
fontWeight: "600",
|
|
80
|
+
marginBottom: 12,
|
|
81
|
+
},
|
|
82
|
+
grid: {
|
|
83
|
+
flexDirection: "row",
|
|
84
|
+
gap: 12,
|
|
85
|
+
},
|
|
86
|
+
button: {
|
|
87
|
+
flex: 1,
|
|
88
|
+
padding: 16,
|
|
89
|
+
borderRadius: 12,
|
|
90
|
+
borderWidth: 2,
|
|
91
|
+
alignItems: "center",
|
|
92
|
+
},
|
|
93
|
+
});
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output Format Selector Component
|
|
3
|
+
* Selection for image output format
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import React from "react";
|
|
7
|
+
import { View, TouchableOpacity, StyleSheet } from "react-native";
|
|
8
|
+
import {
|
|
9
|
+
AtomicText,
|
|
10
|
+
useAppDesignTokens,
|
|
11
|
+
} from "@umituz/react-native-design-system";
|
|
12
|
+
import type { OutputFormat } from "../../domain/types/form.types";
|
|
13
|
+
|
|
14
|
+
export interface OutputFormatOption {
|
|
15
|
+
value: OutputFormat;
|
|
16
|
+
label: string;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export interface OutputFormatSelectorProps {
|
|
20
|
+
value: OutputFormat;
|
|
21
|
+
onChange: (format: OutputFormat) => void;
|
|
22
|
+
options: OutputFormatOption[];
|
|
23
|
+
label: string;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export const OutputFormatSelector: React.FC<OutputFormatSelectorProps> = ({
|
|
27
|
+
value,
|
|
28
|
+
onChange,
|
|
29
|
+
options,
|
|
30
|
+
label,
|
|
31
|
+
}) => {
|
|
32
|
+
const tokens = useAppDesignTokens();
|
|
33
|
+
|
|
34
|
+
return (
|
|
35
|
+
<View style={styles.container}>
|
|
36
|
+
<AtomicText
|
|
37
|
+
type="bodyMedium"
|
|
38
|
+
style={[styles.label, { color: tokens.colors.textPrimary }]}
|
|
39
|
+
>
|
|
40
|
+
{label}
|
|
41
|
+
</AtomicText>
|
|
42
|
+
<View style={styles.optionsRow}>
|
|
43
|
+
{options.map((option) => {
|
|
44
|
+
const isSelected = value === option.value;
|
|
45
|
+
return (
|
|
46
|
+
<TouchableOpacity
|
|
47
|
+
key={option.value}
|
|
48
|
+
style={[
|
|
49
|
+
styles.option,
|
|
50
|
+
{
|
|
51
|
+
backgroundColor: isSelected
|
|
52
|
+
? tokens.colors.primary
|
|
53
|
+
: tokens.colors.surface,
|
|
54
|
+
borderColor: isSelected
|
|
55
|
+
? tokens.colors.primary
|
|
56
|
+
: tokens.colors.borderLight,
|
|
57
|
+
},
|
|
58
|
+
]}
|
|
59
|
+
onPress={() => onChange(option.value)}
|
|
60
|
+
activeOpacity={0.7}
|
|
61
|
+
>
|
|
62
|
+
<AtomicText
|
|
63
|
+
type="bodyMedium"
|
|
64
|
+
style={{
|
|
65
|
+
color: isSelected ? "#FFFFFF" : tokens.colors.textPrimary,
|
|
66
|
+
fontWeight: isSelected ? "600" : "400",
|
|
67
|
+
}}
|
|
68
|
+
>
|
|
69
|
+
{option.label}
|
|
70
|
+
</AtomicText>
|
|
71
|
+
</TouchableOpacity>
|
|
72
|
+
);
|
|
73
|
+
})}
|
|
74
|
+
</View>
|
|
75
|
+
</View>
|
|
76
|
+
);
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const styles = StyleSheet.create({
|
|
80
|
+
container: {
|
|
81
|
+
marginBottom: 20,
|
|
82
|
+
},
|
|
83
|
+
label: {
|
|
84
|
+
fontWeight: "600",
|
|
85
|
+
marginBottom: 12,
|
|
86
|
+
},
|
|
87
|
+
optionsRow: {
|
|
88
|
+
flexDirection: "row",
|
|
89
|
+
gap: 12,
|
|
90
|
+
},
|
|
91
|
+
option: {
|
|
92
|
+
flex: 1,
|
|
93
|
+
padding: 14,
|
|
94
|
+
borderRadius: 8,
|
|
95
|
+
borderWidth: 1,
|
|
96
|
+
alignItems: "center",
|
|
97
|
+
},
|
|
98
|
+
});
|