@fadyshawky/react-native-magic 2.0.1 → 2.0.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 +1 -1
- package/template/src/common/components/Cards.tsx +5 -5
- package/template/src/common/components/EmptyView.tsx +1 -1
- package/template/src/common/components/ImageCropPickerButton.tsx +1 -1
- package/template/src/common/components/OTPInput.tsx +5 -5
- package/template/src/common/components/PhotoTakingButton.tsx +2 -2
- package/template/src/common/components/PrimaryButton.tsx +19 -19
- package/template/src/common/components/PrimaryTextInput.tsx +195 -129
- package/template/src/common/components/RadioButton.tsx +2 -2
- package/template/src/common/components/RadioIcon.tsx +4 -4
- package/template/src/common/components/SearchBar.tsx +13 -13
- package/template/src/common/components/Separator.tsx +1 -1
- package/template/src/common/components/Stepper.tsx +153 -0
- package/template/src/common/components/TryAgain.tsx +3 -3
- package/template/src/common/helpers/defaultKeyIdExtractor.ts +1 -1
- package/template/src/common/helpers/shareHelpers.ts +47 -0
- package/template/src/common/helpers/stringsHelpers.ts +0 -4
- package/template/src/core/api/errorHandler.ts +1 -2
- package/template/src/core/store/app/appSlice.ts +5 -13
- package/template/src/core/store/app/appState.ts +2 -10
- package/template/src/core/theme/colors.ts +94 -72
- package/template/src/core/theme/commonSizes.ts +110 -43
- package/template/src/core/theme/commonStyles.ts +22 -22
- package/template/src/core/theme/fonts.ts +13 -14
- package/template/src/core/theme/shadows.ts +135 -0
- package/template/src/core/theme/themes.ts +386 -75
- package/template/src/core/theme/types.ts +145 -18
- package/template/src/navigation/HeaderComponents.tsx +1 -1
- package/template/src/navigation/MainNavigation.tsx +1 -2
- package/template/src/navigation/MainStack.tsx +1 -1
- package/template/src/navigation/TabBar.tsx +3 -3
- package/template/src/navigation/TopTabBar.tsx +5 -3
- package/template/src/screens/Login/Login.tsx +0 -14
- package/template/src/screens/home/HomeScreen.tsx +14 -14
- package/template/src/screens/home/components/CarouselSection.tsx +9 -9
- package/template/src/screens/home/components/FeaturedCarousel.tsx +10 -10
- package/template/src/screens/registration/RegistrationScreen.tsx +6 -6
- package/template/src/screens/resetPassword/ForgotPasswordScreen.tsx +6 -6
- package/template/src/types/react-native-config.d.ts +8 -0
|
@@ -2,59 +2,126 @@ import {ISize} from './types';
|
|
|
2
2
|
|
|
3
3
|
export const CommonSizes = {
|
|
4
4
|
font: {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
5
|
+
// Body Text Sizes
|
|
6
|
+
bodySmall: 12, // Body Small
|
|
7
|
+
bodyMedium: 14, // Body Medium
|
|
8
|
+
bodyLarge: 16, // Body Large
|
|
9
|
+
bodyXLarge: 18, // Body XLarge
|
|
10
|
+
|
|
11
|
+
// Heading Sizes
|
|
12
|
+
heading6: 18, // Heading 6 / Bold / 18px
|
|
13
|
+
heading4: 24, // Heading 4 / Bold / 24px
|
|
14
|
+
heading3: 32, // Heading 3 / Bold / 32px
|
|
15
|
+
heading2: 48, // Heading 2 / Bold / 48px
|
|
16
|
+
heading1: 64, // Heading 1 / Bold / 64px
|
|
17
|
+
|
|
18
|
+
// Legacy support - keeping these for backward compatibility
|
|
19
|
+
extraSmall: 12, // Maps to bodySmall
|
|
20
|
+
extraSmallPlus: 14, // Maps to bodyMedium
|
|
21
|
+
small: 14, // Maps to bodyMedium
|
|
22
|
+
smallPlus: 16, // Maps to bodyLarge
|
|
23
|
+
medium: 16, // Maps to bodyLarge
|
|
24
|
+
mediumPlus: 18, // Maps to bodyXLarge
|
|
25
|
+
extraMedium: 24, // Maps to heading4
|
|
26
|
+
large: 32, // Maps to heading3
|
|
27
|
+
largePlus: 48, // Maps to heading2
|
|
28
|
+
extraLarge: 64, // Maps to heading1
|
|
29
|
+
extraLargePlus: 64, // Maps to heading1
|
|
16
30
|
} as Readonly<ISize['font']>,
|
|
17
31
|
letterSpacing: {
|
|
18
|
-
|
|
32
|
+
// Default letter spacing for Almarai
|
|
33
|
+
bodySmall: 0,
|
|
34
|
+
bodyMedium: 0,
|
|
35
|
+
bodyLarge: 0,
|
|
36
|
+
bodyXLarge: 0,
|
|
37
|
+
heading6: 0,
|
|
38
|
+
heading4: 0,
|
|
39
|
+
heading3: 0,
|
|
40
|
+
heading2: 0,
|
|
41
|
+
heading1: 0,
|
|
42
|
+
|
|
43
|
+
// Legacy support
|
|
44
|
+
extraSmall: 0,
|
|
19
45
|
extraSmallPlus: 0,
|
|
20
|
-
small:
|
|
21
|
-
smallPlus:
|
|
22
|
-
medium:
|
|
23
|
-
mediumPlus: 0
|
|
24
|
-
large: 0
|
|
25
|
-
largePlus: 0
|
|
26
|
-
extraLarge: 0
|
|
27
|
-
extraLargePlus: 0
|
|
46
|
+
small: 0,
|
|
47
|
+
smallPlus: 0,
|
|
48
|
+
medium: 0,
|
|
49
|
+
mediumPlus: 0,
|
|
50
|
+
large: 0,
|
|
51
|
+
largePlus: 0,
|
|
52
|
+
extraLarge: 0,
|
|
53
|
+
extraLargePlus: 0,
|
|
28
54
|
} as Readonly<ISize['letterSpacing']>,
|
|
29
55
|
lineHeight: {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
56
|
+
// Line heights optimized for Almarai's large x-height
|
|
57
|
+
bodySmall: 16, // ~1.33 line height
|
|
58
|
+
bodyMedium: 20, // ~1.43 line height
|
|
59
|
+
bodyLarge: 24, // ~1.5 line height
|
|
60
|
+
bodyXLarge: 26, // ~1.44 line height
|
|
61
|
+
heading6: 24, // ~1.33 line height
|
|
62
|
+
heading4: 32, // ~1.33 line height
|
|
63
|
+
heading3: 40, // ~1.25 line height
|
|
64
|
+
heading2: 56, // ~1.17 line height
|
|
65
|
+
heading1: 72, // ~1.125 line height
|
|
66
|
+
|
|
67
|
+
// Legacy support
|
|
68
|
+
extraSmall: 16,
|
|
69
|
+
extraSmallPlus: 20,
|
|
70
|
+
small: 20,
|
|
71
|
+
smallPlus: 24,
|
|
72
|
+
medium: 24,
|
|
73
|
+
mediumPlus: 26,
|
|
74
|
+
large: 40,
|
|
75
|
+
largePlus: 56,
|
|
76
|
+
extraLarge: 72,
|
|
77
|
+
extraLargePlus: 72,
|
|
40
78
|
} as Readonly<ISize['lineHeight']>,
|
|
41
79
|
spacing: {
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
80
|
+
none: 0, // space / 0
|
|
81
|
+
xSmall: 2, // space / 2
|
|
82
|
+
small: 4, // space / 4
|
|
83
|
+
medium: 8, // space / 8
|
|
84
|
+
large: 12, // space / 12
|
|
85
|
+
xLarge: 16, // space / 16
|
|
86
|
+
xxLarge: 24, // space / 24 (2X-Large)
|
|
87
|
+
xxxLarge: 32, // space / 32 (3X-Large)
|
|
88
|
+
xxxxLarge: 48, // space / 48 (4X-Large)
|
|
89
|
+
xxxxxLarge: 64, // space / 64 (5X-Large)
|
|
90
|
+
xxxxxxLarge: 80, // space / 80 (6X-Large)
|
|
91
|
+
full: 100, // space / 100 (Full)
|
|
92
|
+
|
|
93
|
+
// Legacy support - keeping these for backward compatibility
|
|
94
|
+
xs: 4, // Maps to small
|
|
95
|
+
sm: 8, // Maps to medium
|
|
96
|
+
md: 16, // Maps to xLarge
|
|
97
|
+
lg: 24, // Maps to xxLarge
|
|
98
|
+
xl: 32, // Maps to xxxLarge
|
|
47
99
|
} as Readonly<ISize['spacing']>,
|
|
48
100
|
borderRadius: {
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
101
|
+
none: 0, // Border / 0
|
|
102
|
+
xSmall: 2, // Border / 2
|
|
103
|
+
small: 4, // Border / 4
|
|
104
|
+
medium: 8, // Border / 8
|
|
105
|
+
large: 12, // Border / 12
|
|
106
|
+
xLarge: 16, // Border / 16
|
|
107
|
+
xxLarge: 24, // Border / 24 (2X-Large)
|
|
108
|
+
full: 1000, // Border / 1000 (Full)
|
|
109
|
+
|
|
110
|
+
// Legacy support - keeping these for backward compatibility
|
|
111
|
+
xs: 4, // Maps to small
|
|
112
|
+
sm: 8, // Maps to medium
|
|
113
|
+
md: 12, // Maps to large
|
|
114
|
+
lg: 16, // Maps to xLarge
|
|
115
|
+
xl: 24, // Maps to xxLarge
|
|
54
116
|
} as Readonly<ISize['borderRadius']>,
|
|
55
117
|
borderWidth: {
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
118
|
+
none: 0, // Stroke / 0
|
|
119
|
+
xSmall: 0.5, // Stroke / 0.5
|
|
120
|
+
small: 1, // Stroke / 1
|
|
121
|
+
medium: 1.5, // Stroke / 1.5
|
|
122
|
+
large: 2, // Stroke / 2
|
|
123
|
+
|
|
124
|
+
// Legacy support - keeping these for backward compatibility
|
|
125
|
+
extraSmall: 0.5, // Maps to xSmall
|
|
59
126
|
} as Readonly<ISize['borderWidth']>,
|
|
60
127
|
};
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
ViewStyle,
|
|
7
7
|
} from 'react-native';
|
|
8
8
|
import {Theme} from './types';
|
|
9
|
-
import {FontSizes, LineHeight, Spacing} from './commonSizes';
|
|
10
9
|
import {Fonts} from './fonts';
|
|
10
|
+
import {CommonSizes} from './commonSizes';
|
|
11
11
|
|
|
12
12
|
export const screenComponentWidth = Dimensions.get('screen').width - 60;
|
|
13
13
|
export const screenWidth = Dimensions.get('screen').width;
|
|
@@ -131,34 +131,34 @@ export const createThemedStyles = (theme: Theme) =>
|
|
|
131
131
|
} as TextStyle,
|
|
132
132
|
h4_semiBold: {
|
|
133
133
|
fontFamily: Fonts.semiBold,
|
|
134
|
-
fontSize:
|
|
135
|
-
lineHeight:
|
|
134
|
+
fontSize: CommonSizes.font.medium,
|
|
135
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
136
136
|
} as TextStyle,
|
|
137
137
|
h4_regular: {
|
|
138
138
|
fontFamily: Fonts.regular,
|
|
139
|
-
fontSize:
|
|
140
|
-
lineHeight:
|
|
139
|
+
fontSize: CommonSizes.font.medium,
|
|
140
|
+
lineHeight: CommonSizes.lineHeight.medium,
|
|
141
141
|
} as TextStyle,
|
|
142
142
|
body_bold: {
|
|
143
143
|
fontFamily: Fonts.bold,
|
|
144
|
-
fontSize:
|
|
145
|
-
lineHeight:
|
|
144
|
+
fontSize: CommonSizes.font.small,
|
|
145
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
146
146
|
} as TextStyle,
|
|
147
147
|
body_bold_underlined: {
|
|
148
148
|
fontFamily: Fonts.bold,
|
|
149
|
-
fontSize:
|
|
150
|
-
lineHeight:
|
|
149
|
+
fontSize: CommonSizes.font.small,
|
|
150
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
151
151
|
textDecorationLine: 'underline',
|
|
152
152
|
} as TextStyle,
|
|
153
153
|
body_semiBold: {
|
|
154
154
|
fontFamily: Fonts.semiBold,
|
|
155
|
-
fontSize:
|
|
156
|
-
lineHeight:
|
|
155
|
+
fontSize: CommonSizes.font.small,
|
|
156
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
157
157
|
} as TextStyle,
|
|
158
158
|
body_regular: {
|
|
159
159
|
fontFamily: Fonts.regular,
|
|
160
|
-
fontSize:
|
|
161
|
-
lineHeight:
|
|
160
|
+
fontSize: CommonSizes.font.small,
|
|
161
|
+
lineHeight: CommonSizes.lineHeight.small,
|
|
162
162
|
} as TextStyle,
|
|
163
163
|
tabBar_bold: {
|
|
164
164
|
fontFamily: Fonts.bold,
|
|
@@ -204,47 +204,47 @@ export const CommonStyles = createThemedStyles({
|
|
|
204
204
|
text: {
|
|
205
205
|
header1: {
|
|
206
206
|
fontFamily: Fonts.medium,
|
|
207
|
-
fontSize:
|
|
207
|
+
fontSize: CommonSizes.font.large,
|
|
208
208
|
color: '#000000',
|
|
209
209
|
},
|
|
210
210
|
header2: {
|
|
211
211
|
fontFamily: Fonts.normal,
|
|
212
|
-
fontSize:
|
|
212
|
+
fontSize: CommonSizes.font.largePlus,
|
|
213
213
|
color: '#000000',
|
|
214
214
|
},
|
|
215
215
|
body1: {
|
|
216
216
|
fontFamily: Fonts.light,
|
|
217
|
-
fontSize:
|
|
217
|
+
fontSize: CommonSizes.font.medium,
|
|
218
218
|
color: '#000000',
|
|
219
219
|
},
|
|
220
220
|
body2: {
|
|
221
221
|
fontFamily: Fonts.regular,
|
|
222
|
-
fontSize:
|
|
222
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
223
223
|
color: '#000000',
|
|
224
224
|
},
|
|
225
225
|
button: {
|
|
226
226
|
fontFamily: Fonts.regular,
|
|
227
|
-
fontSize:
|
|
227
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
228
228
|
color: '#FFFFFF',
|
|
229
229
|
},
|
|
230
230
|
cards: {
|
|
231
231
|
fontFamily: Fonts.semiBold,
|
|
232
|
-
fontSize:
|
|
232
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
233
233
|
color: '#000000',
|
|
234
234
|
},
|
|
235
235
|
SearchBar: {
|
|
236
236
|
fontFamily: Fonts.light,
|
|
237
|
-
fontSize:
|
|
237
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
238
238
|
color: '#000000',
|
|
239
239
|
},
|
|
240
240
|
label: {
|
|
241
241
|
fontFamily: Fonts.light,
|
|
242
|
-
fontSize:
|
|
242
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
243
243
|
color: '#000000',
|
|
244
244
|
},
|
|
245
245
|
hyperlink: {
|
|
246
246
|
fontFamily: Fonts.light,
|
|
247
|
-
fontSize:
|
|
247
|
+
fontSize: CommonSizes.font.mediumPlus,
|
|
248
248
|
color: '#000000',
|
|
249
249
|
textDecorationLine: 'underline',
|
|
250
250
|
},
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
export const Fonts = {
|
|
2
|
-
//
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
// Almarai Font Family
|
|
3
|
+
light: 'Almarai-Light',
|
|
4
|
+
regular: 'Almarai-Regular',
|
|
5
|
+
bold: 'Almarai-Bold',
|
|
6
|
+
extraBold: 'Almarai-ExtraBold',
|
|
5
7
|
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
bold: 'Inter-Bold',
|
|
15
|
-
extraBold: 'Inter-ExtraBold',
|
|
16
|
-
black: 'Inter-Black',
|
|
8
|
+
// Legacy support - keeping these for backward compatibility
|
|
9
|
+
// but they now map to Almarai equivalents
|
|
10
|
+
thin: 'Almarai-Light',
|
|
11
|
+
normal: 'Almarai-Regular',
|
|
12
|
+
medium: 'Almarai-Regular',
|
|
13
|
+
semiBold: 'Almarai-Bold',
|
|
14
|
+
black: 'Almarai-ExtraBold',
|
|
15
|
+
italic: 'Almarai-Regular', // Almarai doesn't have italic variant
|
|
17
16
|
};
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export interface ShadowConfig {
|
|
2
|
+
shadowColor: string;
|
|
3
|
+
shadowOffset: {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
};
|
|
7
|
+
shadowOpacity: number;
|
|
8
|
+
shadowRadius: number;
|
|
9
|
+
elevation?: number; // For Android
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ElevationShadow {
|
|
13
|
+
primary: ShadowConfig;
|
|
14
|
+
secondary: ShadowConfig;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export const Shadows: Record<number, ElevationShadow> = {
|
|
18
|
+
1: {
|
|
19
|
+
primary: {
|
|
20
|
+
shadowColor: '#000000',
|
|
21
|
+
shadowOffset: {
|
|
22
|
+
width: 0,
|
|
23
|
+
height: 1,
|
|
24
|
+
},
|
|
25
|
+
shadowOpacity: 0.02, // 2%
|
|
26
|
+
shadowRadius: 1,
|
|
27
|
+
elevation: 1,
|
|
28
|
+
},
|
|
29
|
+
secondary: {
|
|
30
|
+
shadowColor: '#000000',
|
|
31
|
+
shadowOffset: {
|
|
32
|
+
width: 0,
|
|
33
|
+
height: 2,
|
|
34
|
+
},
|
|
35
|
+
shadowOpacity: 0.04, // 4%
|
|
36
|
+
shadowRadius: 4,
|
|
37
|
+
elevation: 1,
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
2: {
|
|
41
|
+
primary: {
|
|
42
|
+
shadowColor: '#000000',
|
|
43
|
+
shadowOffset: {
|
|
44
|
+
width: 0,
|
|
45
|
+
height: 1,
|
|
46
|
+
},
|
|
47
|
+
shadowOpacity: 0.04, // 4%
|
|
48
|
+
shadowRadius: 4,
|
|
49
|
+
elevation: 2,
|
|
50
|
+
},
|
|
51
|
+
secondary: {
|
|
52
|
+
shadowColor: '#000000',
|
|
53
|
+
shadowOffset: {
|
|
54
|
+
width: 0,
|
|
55
|
+
height: 4,
|
|
56
|
+
},
|
|
57
|
+
shadowOpacity: 0.08, // 8%
|
|
58
|
+
shadowRadius: 10,
|
|
59
|
+
elevation: 2,
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
3: {
|
|
63
|
+
primary: {
|
|
64
|
+
shadowColor: '#000000',
|
|
65
|
+
shadowOffset: {
|
|
66
|
+
width: 0,
|
|
67
|
+
height: 2,
|
|
68
|
+
},
|
|
69
|
+
shadowOpacity: 0.04, // 4%
|
|
70
|
+
shadowRadius: 20,
|
|
71
|
+
elevation: 3,
|
|
72
|
+
},
|
|
73
|
+
secondary: {
|
|
74
|
+
shadowColor: '#000000',
|
|
75
|
+
shadowOffset: {
|
|
76
|
+
width: 0,
|
|
77
|
+
height: 8,
|
|
78
|
+
},
|
|
79
|
+
shadowOpacity: 0.08, // 8%
|
|
80
|
+
shadowRadius: 32,
|
|
81
|
+
elevation: 3,
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
4: {
|
|
85
|
+
primary: {
|
|
86
|
+
shadowColor: '#000000',
|
|
87
|
+
shadowOffset: {
|
|
88
|
+
width: 0,
|
|
89
|
+
height: 8,
|
|
90
|
+
},
|
|
91
|
+
shadowOpacity: 0.06, // 6%
|
|
92
|
+
shadowRadius: 20,
|
|
93
|
+
elevation: 4,
|
|
94
|
+
},
|
|
95
|
+
secondary: {
|
|
96
|
+
shadowColor: '#000000',
|
|
97
|
+
shadowOffset: {
|
|
98
|
+
width: 0,
|
|
99
|
+
height: 24,
|
|
100
|
+
},
|
|
101
|
+
shadowOpacity: 0.12, // 12%
|
|
102
|
+
shadowRadius: 60,
|
|
103
|
+
elevation: 4,
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
// Helper function to get shadow styles for a specific elevation
|
|
109
|
+
export const getShadowStyle = (
|
|
110
|
+
elevation: number,
|
|
111
|
+
useSecondary = false,
|
|
112
|
+
): ShadowConfig => {
|
|
113
|
+
const shadow = Shadows[elevation];
|
|
114
|
+
if (!shadow) {
|
|
115
|
+
throw new Error(
|
|
116
|
+
`Elevation ${elevation} is not defined. Available elevations: ${Object.keys(
|
|
117
|
+
Shadows,
|
|
118
|
+
).join(', ')}`,
|
|
119
|
+
);
|
|
120
|
+
}
|
|
121
|
+
return useSecondary ? shadow.secondary : shadow.primary;
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
// Helper function to get both primary and secondary shadows for an elevation
|
|
125
|
+
export const getElevationShadows = (elevation: number): ElevationShadow => {
|
|
126
|
+
const shadow = Shadows[elevation];
|
|
127
|
+
if (!shadow) {
|
|
128
|
+
throw new Error(
|
|
129
|
+
`Elevation ${elevation} is not defined. Available elevations: ${Object.keys(
|
|
130
|
+
Shadows,
|
|
131
|
+
).join(', ')}`,
|
|
132
|
+
);
|
|
133
|
+
}
|
|
134
|
+
return shadow;
|
|
135
|
+
};
|