@umituz/react-native-onboarding 2.5.1 → 2.5.3
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-onboarding",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.3",
|
|
4
4
|
"description": "Advanced onboarding flow for React Native apps with personalization questions, theme-aware colors, animations, and customizable slides. SOLID, DRY, KISS principles applied.",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Checkbox style question for multiple selections
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React from "react";
|
|
7
|
+
import React, { useMemo } from "react";
|
|
8
8
|
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
9
9
|
import { AtomicIcon } from "@umituz/react-native-design-system-atoms";
|
|
10
|
+
import { useAppDesignTokens, withAlpha } from "@umituz/react-native-design-system-theme";
|
|
10
11
|
import type { OnboardingQuestion, QuestionOption } from "../../../domain/entities/OnboardingQuestion";
|
|
11
12
|
|
|
12
13
|
export interface MultipleChoiceQuestionProps {
|
|
@@ -20,6 +21,9 @@ export const MultipleChoiceQuestion: React.FC<MultipleChoiceQuestionProps> = ({
|
|
|
20
21
|
value = [],
|
|
21
22
|
onChange,
|
|
22
23
|
}) => {
|
|
24
|
+
const tokens = useAppDesignTokens();
|
|
25
|
+
const styles = useMemo(() => getStyles(tokens), [tokens]);
|
|
26
|
+
|
|
23
27
|
const isEmoji = (icon: string) =>
|
|
24
28
|
/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/u.test(icon);
|
|
25
29
|
|
|
@@ -57,7 +61,7 @@ export const MultipleChoiceQuestion: React.FC<MultipleChoiceQuestionProps> = ({
|
|
|
57
61
|
<AtomicIcon
|
|
58
62
|
name={option.icon as any}
|
|
59
63
|
customSize={24}
|
|
60
|
-
customColor={isSelected ?
|
|
64
|
+
customColor={isSelected ? tokens.colors.primary : tokens.colors.textSecondary}
|
|
61
65
|
/>
|
|
62
66
|
)}
|
|
63
67
|
</View>
|
|
@@ -67,7 +71,7 @@ export const MultipleChoiceQuestion: React.FC<MultipleChoiceQuestionProps> = ({
|
|
|
67
71
|
</Text>
|
|
68
72
|
<View style={[styles.checkbox, isSelected && styles.checkboxSelected]}>
|
|
69
73
|
{isSelected && (
|
|
70
|
-
<AtomicIcon name="Check" customSize={16} customColor=
|
|
74
|
+
<AtomicIcon name="Check" customSize={16} customColor={tokens.colors.primary} />
|
|
71
75
|
)}
|
|
72
76
|
</View>
|
|
73
77
|
</TouchableOpacity>
|
|
@@ -86,58 +90,59 @@ export const MultipleChoiceQuestion: React.FC<MultipleChoiceQuestionProps> = ({
|
|
|
86
90
|
);
|
|
87
91
|
};
|
|
88
92
|
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
93
|
+
const getStyles = (tokens: ReturnType<typeof useAppDesignTokens>) =>
|
|
94
|
+
StyleSheet.create({
|
|
95
|
+
container: {
|
|
96
|
+
width: "100%",
|
|
97
|
+
gap: 12,
|
|
98
|
+
},
|
|
99
|
+
option: {
|
|
100
|
+
flexDirection: "row",
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
backgroundColor: withAlpha(tokens.colors.primary, 0.05),
|
|
103
|
+
borderRadius: 12,
|
|
104
|
+
padding: 16,
|
|
105
|
+
borderWidth: 2,
|
|
106
|
+
borderColor: tokens.colors.borderLight,
|
|
107
|
+
},
|
|
108
|
+
optionSelected: {
|
|
109
|
+
backgroundColor: withAlpha(tokens.colors.primary, 0.1),
|
|
110
|
+
borderColor: tokens.colors.primary,
|
|
111
|
+
},
|
|
112
|
+
optionIcon: {
|
|
113
|
+
marginRight: 12,
|
|
114
|
+
},
|
|
115
|
+
emoji: {
|
|
116
|
+
fontSize: 24,
|
|
117
|
+
},
|
|
118
|
+
optionLabel: {
|
|
119
|
+
flex: 1,
|
|
120
|
+
fontSize: 16,
|
|
121
|
+
color: tokens.colors.textPrimary,
|
|
122
|
+
fontWeight: "500",
|
|
123
|
+
},
|
|
124
|
+
optionLabelSelected: {
|
|
125
|
+
color: tokens.colors.primary,
|
|
126
|
+
fontWeight: "600",
|
|
127
|
+
},
|
|
128
|
+
checkbox: {
|
|
129
|
+
width: 24,
|
|
130
|
+
height: 24,
|
|
131
|
+
borderRadius: 6,
|
|
132
|
+
borderWidth: 2,
|
|
133
|
+
borderColor: tokens.colors.border,
|
|
134
|
+
alignItems: "center",
|
|
135
|
+
justifyContent: "center",
|
|
136
|
+
},
|
|
137
|
+
checkboxSelected: {
|
|
138
|
+
borderColor: tokens.colors.primary,
|
|
139
|
+
backgroundColor: withAlpha(tokens.colors.primary, 0.1),
|
|
140
|
+
},
|
|
141
|
+
hint: {
|
|
142
|
+
fontSize: 13,
|
|
143
|
+
color: tokens.colors.textSecondary,
|
|
144
|
+
textAlign: "center",
|
|
145
|
+
marginTop: 4,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
143
148
|
|
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Radio button style question for single selection
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import React from "react";
|
|
7
|
+
import React, { useMemo } from "react";
|
|
8
8
|
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
9
9
|
import { AtomicIcon } from "@umituz/react-native-design-system-atoms";
|
|
10
|
+
import { useAppDesignTokens, withAlpha } from "@umituz/react-native-design-system-theme";
|
|
10
11
|
import type { OnboardingQuestion, QuestionOption } from "../../../domain/entities/OnboardingQuestion";
|
|
11
12
|
|
|
12
13
|
export interface SingleChoiceQuestionProps {
|
|
@@ -20,6 +21,9 @@ export const SingleChoiceQuestion: React.FC<SingleChoiceQuestionProps> = ({
|
|
|
20
21
|
value,
|
|
21
22
|
onChange,
|
|
22
23
|
}) => {
|
|
24
|
+
const tokens = useAppDesignTokens();
|
|
25
|
+
const styles = useMemo(() => getStyles(tokens), [tokens]);
|
|
26
|
+
|
|
23
27
|
const isEmoji = (icon: string) =>
|
|
24
28
|
/[\u{1F300}-\u{1F9FF}]|[\u{2600}-\u{26FF}]|[\u{2700}-\u{27BF}]/u.test(icon);
|
|
25
29
|
|
|
@@ -41,7 +45,7 @@ export const SingleChoiceQuestion: React.FC<SingleChoiceQuestionProps> = ({
|
|
|
41
45
|
<AtomicIcon
|
|
42
46
|
name={option.icon as any}
|
|
43
47
|
customSize={24}
|
|
44
|
-
customColor={isSelected ?
|
|
48
|
+
customColor={isSelected ? tokens.colors.primary : tokens.colors.textSecondary}
|
|
45
49
|
/>
|
|
46
50
|
)}
|
|
47
51
|
</View>
|
|
@@ -63,57 +67,58 @@ export const SingleChoiceQuestion: React.FC<SingleChoiceQuestionProps> = ({
|
|
|
63
67
|
);
|
|
64
68
|
};
|
|
65
69
|
|
|
66
|
-
const
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
}
|
|
70
|
+
const getStyles = (tokens: ReturnType<typeof useAppDesignTokens>) =>
|
|
71
|
+
StyleSheet.create({
|
|
72
|
+
container: {
|
|
73
|
+
width: "100%",
|
|
74
|
+
gap: 12,
|
|
75
|
+
},
|
|
76
|
+
option: {
|
|
77
|
+
flexDirection: "row",
|
|
78
|
+
alignItems: "center",
|
|
79
|
+
backgroundColor: withAlpha(tokens.colors.primary, 0.05),
|
|
80
|
+
borderRadius: 12,
|
|
81
|
+
padding: 16,
|
|
82
|
+
borderWidth: 2,
|
|
83
|
+
borderColor: tokens.colors.borderLight,
|
|
84
|
+
},
|
|
85
|
+
optionSelected: {
|
|
86
|
+
backgroundColor: withAlpha(tokens.colors.primary, 0.1),
|
|
87
|
+
borderColor: tokens.colors.primary,
|
|
88
|
+
},
|
|
89
|
+
optionIcon: {
|
|
90
|
+
marginRight: 12,
|
|
91
|
+
},
|
|
92
|
+
emoji: {
|
|
93
|
+
fontSize: 24,
|
|
94
|
+
},
|
|
95
|
+
optionLabel: {
|
|
96
|
+
flex: 1,
|
|
97
|
+
fontSize: 16,
|
|
98
|
+
color: tokens.colors.textPrimary,
|
|
99
|
+
fontWeight: "500",
|
|
100
|
+
},
|
|
101
|
+
optionLabelSelected: {
|
|
102
|
+
color: tokens.colors.primary,
|
|
103
|
+
fontWeight: "600",
|
|
104
|
+
},
|
|
105
|
+
radio: {
|
|
106
|
+
width: 24,
|
|
107
|
+
height: 24,
|
|
108
|
+
borderRadius: 12,
|
|
109
|
+
borderWidth: 2,
|
|
110
|
+
borderColor: tokens.colors.border,
|
|
111
|
+
alignItems: "center",
|
|
112
|
+
justifyContent: "center",
|
|
113
|
+
},
|
|
114
|
+
radioSelected: {
|
|
115
|
+
borderColor: tokens.colors.primary,
|
|
116
|
+
},
|
|
117
|
+
radioInner: {
|
|
118
|
+
width: 12,
|
|
119
|
+
height: 12,
|
|
120
|
+
borderRadius: 6,
|
|
121
|
+
backgroundColor: tokens.colors.primary,
|
|
122
|
+
},
|
|
123
|
+
});
|
|
119
124
|
|