@umituz/react-native-settings 4.23.111 → 4.23.115
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 -1
- package/src/domains/feedback/presentation/components/FeedbackForm.tsx +1 -15
- package/src/domains/feedback/presentation/components/FeedbackFormProps.ts +26 -0
- package/src/domains/feedback/presentation/components/FeedbackModal.tsx +1 -1
- package/src/domains/gamification/components/AchievementCard.tsx +1 -2
- package/src/domains/gamification/components/AchievementItem.tsx +6 -92
- package/src/domains/gamification/components/GamificationScreen/AchievementsList.tsx +1 -1
- package/src/domains/gamification/components/GamificationScreen/types.ts +1 -1
- package/src/domains/gamification/components/index.ts +2 -1
- package/src/domains/gamification/components/styles/achievementItemStyles.ts +74 -0
- package/src/domains/gamification/components/types/AchievementItemProps.ts +25 -0
- package/src/infrastructure/utils/styleUtils.ts +3 -186
- package/src/infrastructure/utils/styles/componentStyles.ts +90 -0
- package/src/infrastructure/utils/styles/index.ts +9 -0
- package/src/infrastructure/utils/styles/layoutStyles.ts +56 -0
- package/src/infrastructure/utils/styles/spacingStyles.ts +33 -0
- package/src/infrastructure/utils/styles/styleHelpers.ts +22 -0
- package/src/presentation/hooks/useSettingsScreenConfig.ts +3 -3
- package/src/presentation/navigation/utils/navigationTranslations.ts +1 -1
- package/src/presentation/screens/components/SettingsContent.tsx +6 -74
- package/src/presentation/screens/components/types/SettingsContentProps.ts +51 -0
- package/src/presentation/screens/components/utils/featureChecker.ts +32 -0
- package/src/presentation/screens/types/SettingsConfig.ts +1 -136
- package/src/presentation/screens/types/SettingsTranslations.ts +152 -0
- package/src/presentation/screens/types/index.ts +2 -1
- package/src/presentation/utils/accountConfigUtils.ts +27 -10
- package/src/presentation/utils/useAuthHandlers.ts +1 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-settings",
|
|
3
|
-
"version": "4.23.
|
|
3
|
+
"version": "4.23.115",
|
|
4
4
|
"description": "Complete settings hub for React Native apps - consolidated package with settings, localization, about, legal, appearance, feedback, FAQs, rating, and gamification",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -8,23 +8,9 @@ import { View, TouchableOpacity, ScrollView, TextInput } from "react-native";
|
|
|
8
8
|
import { useAppDesignTokens, AtomicText, AtomicButton, AtomicIcon } from "@umituz/react-native-design-system";
|
|
9
9
|
import type { FeedbackType, FeedbackRating } from "../../domain/entities/FeedbackEntity";
|
|
10
10
|
import { validateFeedbackForm } from "../../../../infrastructure/utils/validation";
|
|
11
|
-
|
|
11
|
+
import type { FeedbackFormProps } from "./FeedbackFormProps";
|
|
12
12
|
import { getFeedbackFormStyles as getStyles } from "./FeedbackForm.styles";
|
|
13
13
|
|
|
14
|
-
export interface FeedbackFormProps {
|
|
15
|
-
onSubmit: (data: { type: FeedbackType; rating: FeedbackRating; description: string; title: string }) => Promise<void>;
|
|
16
|
-
texts: {
|
|
17
|
-
ratingLabel: string;
|
|
18
|
-
descriptionPlaceholder: string;
|
|
19
|
-
submitButton: string;
|
|
20
|
-
submittingButton: string;
|
|
21
|
-
feedbackTypes: Array<{ type: FeedbackType; label: string }>;
|
|
22
|
-
defaultTitle: (type: FeedbackType) => string;
|
|
23
|
-
};
|
|
24
|
-
initialType?: FeedbackType;
|
|
25
|
-
isSubmitting?: boolean;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
14
|
export const FeedbackForm: React.FC<FeedbackFormProps> = ({
|
|
29
15
|
onSubmit,
|
|
30
16
|
texts,
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* FeedbackForm Props Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { FeedbackType, FeedbackRating } from "../../domain/entities/FeedbackEntity";
|
|
6
|
+
|
|
7
|
+
export interface FeedbackFormTexts {
|
|
8
|
+
ratingLabel: string;
|
|
9
|
+
descriptionPlaceholder: string;
|
|
10
|
+
submitButton: string;
|
|
11
|
+
submittingButton: string;
|
|
12
|
+
feedbackTypes: Array<{ type: FeedbackType; label: string }>;
|
|
13
|
+
defaultTitle: (type: FeedbackType) => string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export interface FeedbackFormProps {
|
|
17
|
+
onSubmit: (data: {
|
|
18
|
+
type: FeedbackType;
|
|
19
|
+
rating: FeedbackRating;
|
|
20
|
+
description: string;
|
|
21
|
+
title: string;
|
|
22
|
+
}) => Promise<void>;
|
|
23
|
+
texts: FeedbackFormTexts;
|
|
24
|
+
initialType?: FeedbackType;
|
|
25
|
+
isSubmitting?: boolean;
|
|
26
|
+
}
|
|
@@ -8,7 +8,7 @@ import { View, StyleSheet, TouchableOpacity } from "react-native";
|
|
|
8
8
|
import { useAppDesignTokens, AtomicText, AtomicIcon, BaseModal, ScreenLayout } from "@umituz/react-native-design-system";
|
|
9
9
|
import { FeedbackForm } from "./FeedbackForm";
|
|
10
10
|
import type { FeedbackType, FeedbackRating } from "../../domain/entities/FeedbackEntity";
|
|
11
|
-
import type { FeedbackFormProps } from "./
|
|
11
|
+
import type { FeedbackFormProps } from "./FeedbackFormProps";
|
|
12
12
|
|
|
13
13
|
export interface FeedbackModalProps {
|
|
14
14
|
visible: boolean;
|
|
@@ -90,7 +90,7 @@ export const AchievementCard: React.FC<AchievementCardProps> = ({
|
|
|
90
90
|
|
|
91
91
|
{isUnlocked && (
|
|
92
92
|
<View style={[styles.checkmark, { backgroundColor: finalUnlockedColor }]}>
|
|
93
|
-
<AtomicText style={styles.checkmarkText}>✓</AtomicText>
|
|
93
|
+
<AtomicText style={[styles.checkmarkText, { color: tokens.colors.onPrimary }]}>✓</AtomicText>
|
|
94
94
|
</View>
|
|
95
95
|
)}
|
|
96
96
|
</View>
|
|
@@ -142,7 +142,6 @@ const styles = StyleSheet.create({
|
|
|
142
142
|
alignItems: "center",
|
|
143
143
|
},
|
|
144
144
|
checkmarkText: {
|
|
145
|
-
color: "#FFFFFF",
|
|
146
145
|
fontSize: 14,
|
|
147
146
|
fontWeight: "bold",
|
|
148
147
|
},
|
|
@@ -4,28 +4,10 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import React from "react";
|
|
7
|
-
import { View
|
|
7
|
+
import { View } from "react-native";
|
|
8
8
|
import { useAppDesignTokens, AtomicText, AtomicIcon, withAlpha } from "@umituz/react-native-design-system";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
title: string;
|
|
12
|
-
description: string;
|
|
13
|
-
icon: React.ReactNode | string;
|
|
14
|
-
isUnlocked: boolean;
|
|
15
|
-
progress: number;
|
|
16
|
-
threshold: number;
|
|
17
|
-
progressLabel?: string;
|
|
18
|
-
// Customization
|
|
19
|
-
containerStyle?: ViewStyle;
|
|
20
|
-
titleStyle?: TextStyle;
|
|
21
|
-
descriptionStyle?: TextStyle;
|
|
22
|
-
// Colors
|
|
23
|
-
accentColor?: string;
|
|
24
|
-
backgroundColor?: string;
|
|
25
|
-
textColor?: string;
|
|
26
|
-
subtextColor?: string;
|
|
27
|
-
lockedOpacity?: number;
|
|
28
|
-
}
|
|
9
|
+
import type { AchievementItemProps } from "./types/AchievementItemProps";
|
|
10
|
+
import { achievementItemStyles as styles } from "./styles/achievementItemStyles";
|
|
29
11
|
|
|
30
12
|
export const AchievementItem: React.FC<AchievementItemProps> = ({
|
|
31
13
|
title,
|
|
@@ -78,7 +60,9 @@ export const AchievementItem: React.FC<AchievementItemProps> = ({
|
|
|
78
60
|
</AtomicText>
|
|
79
61
|
{isUnlocked && (
|
|
80
62
|
<View style={[styles.checkmark, { backgroundColor: finalAccentColor }]}>
|
|
81
|
-
<AtomicText style={styles.checkmarkText}
|
|
63
|
+
<AtomicText style={[styles.checkmarkText, { color: tokens.colors.background }]}>
|
|
64
|
+
✓
|
|
65
|
+
</AtomicText>
|
|
82
66
|
</View>
|
|
83
67
|
)}
|
|
84
68
|
</View>
|
|
@@ -116,73 +100,3 @@ export const AchievementItem: React.FC<AchievementItemProps> = ({
|
|
|
116
100
|
</View>
|
|
117
101
|
);
|
|
118
102
|
};
|
|
119
|
-
|
|
120
|
-
const styles = StyleSheet.create({
|
|
121
|
-
container: {
|
|
122
|
-
flexDirection: "row",
|
|
123
|
-
alignItems: "center",
|
|
124
|
-
padding: 12,
|
|
125
|
-
borderRadius: 12,
|
|
126
|
-
marginBottom: 8,
|
|
127
|
-
},
|
|
128
|
-
iconContainer: {
|
|
129
|
-
width: 48,
|
|
130
|
-
height: 48,
|
|
131
|
-
borderRadius: 24,
|
|
132
|
-
alignItems: "center",
|
|
133
|
-
justifyContent: "center",
|
|
134
|
-
marginRight: 12,
|
|
135
|
-
},
|
|
136
|
-
content: {
|
|
137
|
-
flex: 1,
|
|
138
|
-
},
|
|
139
|
-
header: {
|
|
140
|
-
flexDirection: "row",
|
|
141
|
-
alignItems: "center",
|
|
142
|
-
justifyContent: "space-between",
|
|
143
|
-
marginBottom: 4,
|
|
144
|
-
},
|
|
145
|
-
title: {
|
|
146
|
-
fontSize: 16,
|
|
147
|
-
fontWeight: "600",
|
|
148
|
-
flex: 1,
|
|
149
|
-
},
|
|
150
|
-
checkmark: {
|
|
151
|
-
width: 20,
|
|
152
|
-
height: 20,
|
|
153
|
-
borderRadius: 10,
|
|
154
|
-
alignItems: "center",
|
|
155
|
-
justifyContent: "center",
|
|
156
|
-
marginLeft: 8,
|
|
157
|
-
},
|
|
158
|
-
checkmarkText: {
|
|
159
|
-
color: "#000",
|
|
160
|
-
fontSize: 12,
|
|
161
|
-
fontWeight: "bold",
|
|
162
|
-
},
|
|
163
|
-
description: {
|
|
164
|
-
fontSize: 13,
|
|
165
|
-
lineHeight: 18,
|
|
166
|
-
},
|
|
167
|
-
progressContainer: {
|
|
168
|
-
marginTop: 8,
|
|
169
|
-
flexDirection: "row",
|
|
170
|
-
alignItems: "center",
|
|
171
|
-
gap: 8,
|
|
172
|
-
},
|
|
173
|
-
progressBar: {
|
|
174
|
-
flex: 1,
|
|
175
|
-
height: 4,
|
|
176
|
-
borderRadius: 2,
|
|
177
|
-
overflow: "hidden",
|
|
178
|
-
},
|
|
179
|
-
progressFill: {
|
|
180
|
-
height: "100%",
|
|
181
|
-
borderRadius: 2,
|
|
182
|
-
},
|
|
183
|
-
progressText: {
|
|
184
|
-
fontSize: 11,
|
|
185
|
-
minWidth: 40,
|
|
186
|
-
textAlign: "right",
|
|
187
|
-
},
|
|
188
|
-
});
|
|
@@ -7,7 +7,7 @@ import { View, type TextStyle } from "react-native";
|
|
|
7
7
|
import { AtomicText } from "@umituz/react-native-design-system";
|
|
8
8
|
import { AchievementItem } from "../AchievementItem";
|
|
9
9
|
import { styles } from "./styles";
|
|
10
|
-
import type { AchievementItemProps } from "../
|
|
10
|
+
import type { AchievementItemProps } from "../types/AchievementItemProps";
|
|
11
11
|
|
|
12
12
|
export interface AchievementsListProps {
|
|
13
13
|
achievementsTitle: string;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
import type React from 'react';
|
|
7
7
|
import type { LevelProgressProps } from "../LevelProgress";
|
|
8
8
|
import type { StatsCardProps } from "../StatsCard";
|
|
9
|
-
import type { AchievementItemProps } from "../
|
|
9
|
+
import type { AchievementItemProps } from "../types/AchievementItemProps";
|
|
10
10
|
import type { StreakDisplayProps } from "../StreakDisplay";
|
|
11
11
|
import type { ViewStyle, TextStyle } from "react-native";
|
|
12
12
|
import type { GamificationConfig } from "../../types";
|
|
@@ -9,6 +9,7 @@ export { AchievementCard, type AchievementCardProps } from "./AchievementCard";
|
|
|
9
9
|
export { AchievementToast, type AchievementToastProps } from "./AchievementToast";
|
|
10
10
|
export { StreakDisplay, type StreakDisplayProps } from "./StreakDisplay";
|
|
11
11
|
export { StatsCard, type StatsCardProps } from "./StatsCard";
|
|
12
|
-
export { AchievementItem
|
|
12
|
+
export { AchievementItem } from "./AchievementItem";
|
|
13
|
+
export type { AchievementItemProps } from "./types/AchievementItemProps";
|
|
13
14
|
export { GamificationScreen } from "./GamificationScreen/index";
|
|
14
15
|
export type { GamificationScreenProps, GamificationConfigProps } from "./GamificationScreen/types";
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AchievementItem Styles
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import { StyleSheet } from 'react-native';
|
|
6
|
+
|
|
7
|
+
export const achievementItemStyles = StyleSheet.create({
|
|
8
|
+
container: {
|
|
9
|
+
flexDirection: "row",
|
|
10
|
+
alignItems: "center",
|
|
11
|
+
padding: 12,
|
|
12
|
+
borderRadius: 12,
|
|
13
|
+
marginBottom: 8,
|
|
14
|
+
},
|
|
15
|
+
iconContainer: {
|
|
16
|
+
width: 48,
|
|
17
|
+
height: 48,
|
|
18
|
+
borderRadius: 24,
|
|
19
|
+
alignItems: "center",
|
|
20
|
+
justifyContent: "center",
|
|
21
|
+
marginRight: 12,
|
|
22
|
+
},
|
|
23
|
+
content: {
|
|
24
|
+
flex: 1,
|
|
25
|
+
},
|
|
26
|
+
header: {
|
|
27
|
+
flexDirection: "row",
|
|
28
|
+
alignItems: "center",
|
|
29
|
+
justifyContent: "space-between",
|
|
30
|
+
marginBottom: 4,
|
|
31
|
+
},
|
|
32
|
+
title: {
|
|
33
|
+
fontSize: 16,
|
|
34
|
+
fontWeight: "600",
|
|
35
|
+
flex: 1,
|
|
36
|
+
},
|
|
37
|
+
checkmark: {
|
|
38
|
+
width: 20,
|
|
39
|
+
height: 20,
|
|
40
|
+
borderRadius: 10,
|
|
41
|
+
alignItems: "center",
|
|
42
|
+
justifyContent: "center",
|
|
43
|
+
marginLeft: 8,
|
|
44
|
+
},
|
|
45
|
+
checkmarkText: {
|
|
46
|
+
fontSize: 12,
|
|
47
|
+
fontWeight: "bold",
|
|
48
|
+
},
|
|
49
|
+
description: {
|
|
50
|
+
fontSize: 13,
|
|
51
|
+
lineHeight: 18,
|
|
52
|
+
},
|
|
53
|
+
progressContainer: {
|
|
54
|
+
marginTop: 8,
|
|
55
|
+
flexDirection: "row",
|
|
56
|
+
alignItems: "center",
|
|
57
|
+
gap: 8,
|
|
58
|
+
},
|
|
59
|
+
progressBar: {
|
|
60
|
+
flex: 1,
|
|
61
|
+
height: 4,
|
|
62
|
+
borderRadius: 2,
|
|
63
|
+
overflow: "hidden",
|
|
64
|
+
},
|
|
65
|
+
progressFill: {
|
|
66
|
+
height: "100%",
|
|
67
|
+
borderRadius: 2,
|
|
68
|
+
},
|
|
69
|
+
progressText: {
|
|
70
|
+
fontSize: 11,
|
|
71
|
+
minWidth: 40,
|
|
72
|
+
textAlign: "right",
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AchievementItem Props Types
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
import type { ViewStyle, TextStyle } from 'react-native';
|
|
6
|
+
|
|
7
|
+
export interface AchievementItemProps {
|
|
8
|
+
title: string;
|
|
9
|
+
description: string;
|
|
10
|
+
icon: React.ReactNode | string;
|
|
11
|
+
isUnlocked: boolean;
|
|
12
|
+
progress: number;
|
|
13
|
+
threshold: number;
|
|
14
|
+
progressLabel?: string;
|
|
15
|
+
// Customization
|
|
16
|
+
containerStyle?: ViewStyle;
|
|
17
|
+
titleStyle?: TextStyle;
|
|
18
|
+
descriptionStyle?: TextStyle;
|
|
19
|
+
// Colors
|
|
20
|
+
accentColor?: string;
|
|
21
|
+
backgroundColor?: string;
|
|
22
|
+
textColor?: string;
|
|
23
|
+
subtextColor?: string;
|
|
24
|
+
lockedOpacity?: number;
|
|
25
|
+
}
|
|
@@ -1,190 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Style Utilities
|
|
3
|
-
*
|
|
3
|
+
* Re-exports from organized style modules
|
|
4
|
+
* @deprecated Import from specific modules instead: styles/layoutStyles, styles/componentStyles, etc.
|
|
4
5
|
*/
|
|
5
|
-
import { StyleSheet, ViewStyle, TextStyle, ImageStyle } from 'react-native';
|
|
6
|
-
import type { DesignTokens } from '@umituz/react-native-design-system';
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
* Creates a container style with flex 1
|
|
10
|
-
*/
|
|
11
|
-
export const createContainerStyle = (overrides: ViewStyle = {}): ViewStyle => ({
|
|
12
|
-
flex: 1,
|
|
13
|
-
...overrides,
|
|
14
|
-
});
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Creates a centered container style
|
|
18
|
-
*/
|
|
19
|
-
export const createCenteredContainerStyle = (overrides: ViewStyle = {}): ViewStyle => ({
|
|
20
|
-
flex: 1,
|
|
21
|
-
justifyContent: 'center',
|
|
22
|
-
alignItems: 'center',
|
|
23
|
-
...overrides,
|
|
24
|
-
});
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* Creates a row style for horizontal layouts
|
|
28
|
-
*/
|
|
29
|
-
export const createRowStyle = (overrides: ViewStyle = {}): ViewStyle => ({
|
|
30
|
-
flexDirection: 'row',
|
|
31
|
-
alignItems: 'center',
|
|
32
|
-
...overrides,
|
|
33
|
-
});
|
|
34
|
-
|
|
35
|
-
/**
|
|
36
|
-
* Creates a header style
|
|
37
|
-
*/
|
|
38
|
-
export const createHeaderStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
39
|
-
paddingHorizontal: tokens.spacing.lg,
|
|
40
|
-
paddingVertical: tokens.spacing.md,
|
|
41
|
-
...overrides,
|
|
42
|
-
});
|
|
43
|
-
|
|
44
|
-
/**
|
|
45
|
-
* Creates a section style
|
|
46
|
-
*/
|
|
47
|
-
export const createSectionStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
48
|
-
padding: tokens.spacing.lg,
|
|
49
|
-
...overrides,
|
|
50
|
-
});
|
|
51
|
-
|
|
52
|
-
/**
|
|
53
|
-
* Creates a card style
|
|
54
|
-
*/
|
|
55
|
-
export const createCardStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
56
|
-
backgroundColor: tokens.colors.surface,
|
|
57
|
-
borderRadius: tokens.borders.radius.md,
|
|
58
|
-
padding: tokens.spacing.lg,
|
|
59
|
-
...overrides,
|
|
60
|
-
});
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Creates a title text style
|
|
64
|
-
*/
|
|
65
|
-
export const createTitleStyle = (tokens: DesignTokens, overrides: TextStyle = {}): TextStyle => ({
|
|
66
|
-
fontSize: tokens.typography.headlineMedium.responsiveFontSize,
|
|
67
|
-
fontWeight: '600',
|
|
68
|
-
color: tokens.colors.textPrimary,
|
|
69
|
-
...overrides,
|
|
70
|
-
});
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Creates a subtitle text style
|
|
74
|
-
*/
|
|
75
|
-
export const createSubtitleStyle = (tokens: DesignTokens, overrides: TextStyle = {}): TextStyle => ({
|
|
76
|
-
fontSize: tokens.typography.bodyMedium.responsiveFontSize,
|
|
77
|
-
color: tokens.colors.textSecondary,
|
|
78
|
-
...overrides,
|
|
79
|
-
});
|
|
80
|
-
|
|
81
|
-
/**
|
|
82
|
-
* Creates a button style
|
|
83
|
-
*/
|
|
84
|
-
export const createButtonStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
85
|
-
backgroundColor: tokens.colors.primary,
|
|
86
|
-
borderRadius: tokens.borders.radius.md,
|
|
87
|
-
paddingVertical: tokens.spacing.md,
|
|
88
|
-
paddingHorizontal: tokens.spacing.lg,
|
|
89
|
-
...overrides,
|
|
90
|
-
});
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Creates an icon container style
|
|
94
|
-
*/
|
|
95
|
-
export const createIconContainerStyle = (
|
|
96
|
-
size: number = 48,
|
|
97
|
-
tokens: DesignTokens,
|
|
98
|
-
overrides: ViewStyle = {}
|
|
99
|
-
): ViewStyle => ({
|
|
100
|
-
width: size,
|
|
101
|
-
height: size,
|
|
102
|
-
borderRadius: size / 2,
|
|
103
|
-
justifyContent: 'center',
|
|
104
|
-
alignItems: 'center',
|
|
105
|
-
backgroundColor: tokens.colors.surfaceSecondary,
|
|
106
|
-
...overrides,
|
|
107
|
-
});
|
|
108
|
-
|
|
109
|
-
/**
|
|
110
|
-
* Creates a scroll content style
|
|
111
|
-
*/
|
|
112
|
-
export const createScrollContentStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
113
|
-
padding: tokens.spacing.lg,
|
|
114
|
-
...overrides,
|
|
115
|
-
});
|
|
116
|
-
|
|
117
|
-
/**
|
|
118
|
-
* Creates a separator/border style
|
|
119
|
-
*/
|
|
120
|
-
export const createSeparatorStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
121
|
-
height: 1,
|
|
122
|
-
backgroundColor: tokens.colors.border,
|
|
123
|
-
...overrides,
|
|
124
|
-
});
|
|
125
|
-
|
|
126
|
-
/**
|
|
127
|
-
* Creates a margin utility style
|
|
128
|
-
*/
|
|
129
|
-
export const createMarginStyle = (
|
|
130
|
-
spacing: 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
|
131
|
-
tokens: DesignTokens,
|
|
132
|
-
overrides: ViewStyle = {}
|
|
133
|
-
): ViewStyle => ({
|
|
134
|
-
margin: tokens.spacing[spacing],
|
|
135
|
-
...overrides,
|
|
136
|
-
});
|
|
137
|
-
|
|
138
|
-
/**
|
|
139
|
-
* Creates a padding utility style
|
|
140
|
-
*/
|
|
141
|
-
export const createPaddingStyle = (
|
|
142
|
-
spacing: 'xs' | 'sm' | 'md' | 'lg' | 'xl',
|
|
143
|
-
tokens: DesignTokens,
|
|
144
|
-
overrides: ViewStyle = {}
|
|
145
|
-
): ViewStyle => ({
|
|
146
|
-
padding: tokens.spacing[spacing],
|
|
147
|
-
...overrides,
|
|
148
|
-
});
|
|
149
|
-
|
|
150
|
-
/**
|
|
151
|
-
* Combines multiple styles into one
|
|
152
|
-
*/
|
|
153
|
-
export const combineStyles = (
|
|
154
|
-
...styles: (ViewStyle | TextStyle | ImageStyle | undefined | false)[]
|
|
155
|
-
): ViewStyle | TextStyle | ImageStyle => {
|
|
156
|
-
return StyleSheet.flatten(styles.filter(Boolean));
|
|
157
|
-
};
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Creates a responsive style based on screen dimensions
|
|
161
|
-
*/
|
|
162
|
-
export const createResponsiveStyle = (
|
|
163
|
-
_tokens: DesignTokens,
|
|
164
|
-
phoneStyle: ViewStyle,
|
|
165
|
-
_tabletStyle?: ViewStyle
|
|
166
|
-
): ViewStyle => {
|
|
167
|
-
// For now, return phone style. Can be enhanced with actual responsive logic
|
|
168
|
-
return phoneStyle;
|
|
169
|
-
};
|
|
170
|
-
|
|
171
|
-
/**
|
|
172
|
-
* Type guard for ViewStyle
|
|
173
|
-
*/
|
|
174
|
-
export const isViewStyle = (style: any): style is ViewStyle => {
|
|
175
|
-
return style && typeof style === 'object';
|
|
176
|
-
};
|
|
177
|
-
|
|
178
|
-
/**
|
|
179
|
-
* Creates a safe area aware style
|
|
180
|
-
*/
|
|
181
|
-
export const createSafeAreaStyle = (
|
|
182
|
-
insets: { top?: number; bottom?: number; left?: number; right?: number },
|
|
183
|
-
overrides: ViewStyle = {}
|
|
184
|
-
): ViewStyle => ({
|
|
185
|
-
paddingTop: insets.top,
|
|
186
|
-
paddingBottom: insets.bottom,
|
|
187
|
-
paddingLeft: insets.left,
|
|
188
|
-
paddingRight: insets.right,
|
|
189
|
-
...overrides,
|
|
190
|
-
});
|
|
7
|
+
export * from './styles';
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component Style Utilities
|
|
3
|
+
* Reusable component styling patterns
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { ViewStyle, TextStyle } from 'react-native';
|
|
7
|
+
import type { DesignTokens } from '@umituz/react-native-design-system';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a header style
|
|
11
|
+
*/
|
|
12
|
+
export const createHeaderStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
13
|
+
paddingHorizontal: tokens.spacing.lg,
|
|
14
|
+
paddingVertical: tokens.spacing.md,
|
|
15
|
+
...overrides,
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Creates a section style
|
|
20
|
+
*/
|
|
21
|
+
export const createSectionStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
22
|
+
padding: tokens.spacing.lg,
|
|
23
|
+
...overrides,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* Creates a card style
|
|
28
|
+
*/
|
|
29
|
+
export const createCardStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
30
|
+
backgroundColor: tokens.colors.surface,
|
|
31
|
+
borderRadius: tokens.borders.radius.md,
|
|
32
|
+
padding: tokens.spacing.lg,
|
|
33
|
+
...overrides,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Creates a button style
|
|
38
|
+
*/
|
|
39
|
+
export const createButtonStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
40
|
+
backgroundColor: tokens.colors.primary,
|
|
41
|
+
borderRadius: tokens.borders.radius.md,
|
|
42
|
+
paddingVertical: tokens.spacing.md,
|
|
43
|
+
paddingHorizontal: tokens.spacing.lg,
|
|
44
|
+
...overrides,
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* Creates an icon container style
|
|
49
|
+
*/
|
|
50
|
+
export const createIconContainerStyle = (
|
|
51
|
+
size: number = 48,
|
|
52
|
+
tokens: DesignTokens,
|
|
53
|
+
overrides: ViewStyle = {}
|
|
54
|
+
): ViewStyle => ({
|
|
55
|
+
width: size,
|
|
56
|
+
height: size,
|
|
57
|
+
borderRadius: size / 2,
|
|
58
|
+
justifyContent: 'center',
|
|
59
|
+
alignItems: 'center',
|
|
60
|
+
backgroundColor: tokens.colors.surfaceSecondary,
|
|
61
|
+
...overrides,
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
/**
|
|
65
|
+
* Creates a separator/border style
|
|
66
|
+
*/
|
|
67
|
+
export const createSeparatorStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
68
|
+
height: 1,
|
|
69
|
+
backgroundColor: tokens.colors.border,
|
|
70
|
+
...overrides,
|
|
71
|
+
});
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Creates a title text style
|
|
75
|
+
*/
|
|
76
|
+
export const createTitleStyle = (tokens: DesignTokens, overrides: TextStyle = {}): TextStyle => ({
|
|
77
|
+
fontSize: tokens.typography.headlineMedium.responsiveFontSize,
|
|
78
|
+
fontWeight: '600',
|
|
79
|
+
color: tokens.colors.textPrimary,
|
|
80
|
+
...overrides,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Creates a subtitle text style
|
|
85
|
+
*/
|
|
86
|
+
export const createSubtitleStyle = (tokens: DesignTokens, overrides: TextStyle = {}): TextStyle => ({
|
|
87
|
+
fontSize: tokens.typography.bodyMedium.responsiveFontSize,
|
|
88
|
+
color: tokens.colors.textSecondary,
|
|
89
|
+
...overrides,
|
|
90
|
+
});
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Layout Style Utilities
|
|
3
|
+
* Common layout patterns
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import type { ViewStyle } from 'react-native';
|
|
7
|
+
import type { DesignTokens } from '@umituz/react-native-design-system';
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Creates a container style with flex 1
|
|
11
|
+
*/
|
|
12
|
+
export const createContainerStyle = (overrides: ViewStyle = {}): ViewStyle => ({
|
|
13
|
+
flex: 1,
|
|
14
|
+
...overrides,
|
|
15
|
+
});
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Creates a centered container style
|
|
19
|
+
*/
|
|
20
|
+
export const createCenteredContainerStyle = (overrides: ViewStyle = {}): ViewStyle => ({
|
|
21
|
+
flex: 1,
|
|
22
|
+
justifyContent: 'center',
|
|
23
|
+
alignItems: 'center',
|
|
24
|
+
...overrides,
|
|
25
|
+
});
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* Creates a row style for horizontal layouts
|
|
29
|
+
*/
|
|
30
|
+
export const createRowStyle = (overrides: ViewStyle = {}): ViewStyle => ({
|
|
31
|
+
flexDirection: 'row',
|
|
32
|
+
alignItems: 'center',
|
|
33
|
+
...overrides,
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Creates a scroll content style
|
|
38
|
+
*/
|
|
39
|
+
export const createScrollContentStyle = (tokens: DesignTokens, overrides: ViewStyle = {}): ViewStyle => ({
|
|
40
|
+
padding: tokens.spacing.lg,
|
|
41
|
+
...overrides,
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Creates a safe area aware style
|
|
46
|
+
*/
|
|
47
|
+
export const createSafeAreaStyle = (
|
|
48
|
+
insets: { top?: number; bottom?: number; left?: number; right?: number },
|
|
49
|
+
overrides: ViewStyle = {}
|
|
50
|
+
): ViewStyle => ({
|
|
51
|
+
paddingTop: insets.top,
|
|
52
|
+
paddingBottom: insets.bottom,
|
|
53
|
+
paddingLeft: insets.left,
|
|
54
|
+
paddingRight: insets.right,
|
|
55
|
+
...overrides,
|
|
56
|
+
});
|