react-native-football-formation 1.0.0

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.
Files changed (65) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +447 -0
  3. package/dist/assets/index.d.ts +13 -0
  4. package/dist/assets/index.d.ts.map +1 -0
  5. package/dist/assets/index.js +15 -0
  6. package/dist/components/FormationField.d.ts +5 -0
  7. package/dist/components/FormationField.d.ts.map +1 -0
  8. package/dist/components/FormationField.js +147 -0
  9. package/dist/components/PlayerCard.d.ts +5 -0
  10. package/dist/components/PlayerCard.d.ts.map +1 -0
  11. package/dist/components/PlayerCard.js +365 -0
  12. package/dist/components/index.d.ts +3 -0
  13. package/dist/components/index.d.ts.map +1 -0
  14. package/dist/components/index.js +10 -0
  15. package/dist/index.d.ts +11 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/index.js +35 -0
  18. package/dist/theme/defaultTheme.d.ts +12 -0
  19. package/dist/theme/defaultTheme.d.ts.map +1 -0
  20. package/dist/theme/defaultTheme.js +70 -0
  21. package/dist/theme/index.d.ts +2 -0
  22. package/dist/theme/index.d.ts.map +1 -0
  23. package/dist/theme/index.js +17 -0
  24. package/dist/types/component.types.d.ts +48 -0
  25. package/dist/types/component.types.d.ts.map +1 -0
  26. package/dist/types/component.types.js +2 -0
  27. package/dist/types/formation.types.d.ts +59 -0
  28. package/dist/types/formation.types.d.ts.map +1 -0
  29. package/dist/types/formation.types.js +5 -0
  30. package/dist/types/index.d.ts +4 -0
  31. package/dist/types/index.d.ts.map +1 -0
  32. package/dist/types/index.js +19 -0
  33. package/dist/types/theme.types.d.ts +44 -0
  34. package/dist/types/theme.types.d.ts.map +1 -0
  35. package/dist/types/theme.types.js +5 -0
  36. package/dist/utils/formationCoordinates.d.ts +10 -0
  37. package/dist/utils/formationCoordinates.d.ts.map +1 -0
  38. package/dist/utils/formationCoordinates.js +311 -0
  39. package/dist/utils/index.d.ts +3 -0
  40. package/dist/utils/index.d.ts.map +1 -0
  41. package/dist/utils/index.js +18 -0
  42. package/dist/utils/transformLineup.d.ts +21 -0
  43. package/dist/utils/transformLineup.d.ts.map +1 -0
  44. package/dist/utils/transformLineup.js +126 -0
  45. package/package.json +60 -0
  46. package/src/assets/images/field.png +0 -0
  47. package/src/assets/images/football.png +0 -0
  48. package/src/assets/images/kicker.png +0 -0
  49. package/src/assets/images/ownGoals.png +0 -0
  50. package/src/assets/images/playerPlaceholder.png +0 -0
  51. package/src/assets/images/renewal.png +0 -0
  52. package/src/assets/index.ts +12 -0
  53. package/src/components/FormationField.tsx +182 -0
  54. package/src/components/PlayerCard.tsx +452 -0
  55. package/src/components/index.ts +2 -0
  56. package/src/index.ts +20 -0
  57. package/src/theme/defaultTheme.ts +74 -0
  58. package/src/theme/index.ts +1 -0
  59. package/src/types/component.types.ts +72 -0
  60. package/src/types/formation.types.ts +88 -0
  61. package/src/types/index.ts +3 -0
  62. package/src/types/theme.types.ts +48 -0
  63. package/src/utils/formationCoordinates.ts +335 -0
  64. package/src/utils/index.ts +2 -0
  65. package/src/utils/transformLineup.ts +158 -0
@@ -0,0 +1,365 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const react_1 = __importDefault(require("react"));
7
+ const react_native_1 = require("react-native");
8
+ const assets_1 = require("../assets");
9
+ const PlayerCard = ({ player, fieldWidth, fieldHeight, theme, onPress, style, nameStyle, playerPlaceholder = assets_1.defaultAssets.playerPlaceholder, footballIcon = assets_1.defaultAssets.football, kickerIcon = assets_1.defaultAssets.kicker, renewalIcon = assets_1.defaultAssets.renewal, ownGoalIcon = assets_1.defaultAssets.ownGoals, }) => {
10
+ const getFirst10Chars = (str) => {
11
+ const trimmed = [...str].slice(0, 10).join('');
12
+ return str?.length > 10 ? trimmed + '…' : trimmed;
13
+ };
14
+ const playerX = (Number(player?.x) / 100) * fieldWidth - theme.spacing.playerCardWidth / 2;
15
+ const playerY = (Number(player?.y) / 100) * fieldHeight - theme.spacing.playerCardHeight / 2;
16
+ const cardContent = (<react_native_1.View style={[
17
+ styles.playerCard,
18
+ {
19
+ left: playerX,
20
+ top: playerY,
21
+ width: theme.spacing.playerCardWidth,
22
+ height: theme.spacing.playerCardHeight,
23
+ },
24
+ style,
25
+ ]}>
26
+ <react_native_1.View style={[
27
+ styles.playerImageContainer,
28
+ {
29
+ width: theme.spacing.playerImageSize,
30
+ height: theme.spacing.playerImageSize,
31
+ borderRadius: theme.borderRadius.playerImage,
32
+ borderColor: theme.colors.white,
33
+ },
34
+ ]}>
35
+ <react_native_1.Image source={player?.photo ? { uri: player.photo } : playerPlaceholder} style={[
36
+ styles.playerImage,
37
+ { borderRadius: theme.borderRadius.playerImage },
38
+ ]}/>
39
+
40
+ {/* Jersey Number */}
41
+ <react_native_1.View style={[
42
+ styles.jerseyNumber,
43
+ react_native_1.I18nManager.isRTL ? { right: -5 } : { left: -5 },
44
+ ]}>
45
+ <react_native_1.View style={[
46
+ styles.jerseyNumberWrapper,
47
+ {
48
+ width: theme.spacing.jerseyNumberSize,
49
+ height: theme.spacing.jerseyNumberSize,
50
+ borderRadius: theme.spacing.jerseyNumberSize,
51
+ backgroundColor: theme.colors.white,
52
+ borderColor: theme.colors.border,
53
+ },
54
+ ]}>
55
+ <react_native_1.Text style={[
56
+ styles.jerseyText,
57
+ {
58
+ fontSize: theme.typography.jerseyNumberSize,
59
+ color: theme.colors.text,
60
+ fontFamily: theme.typography.fontFamily,
61
+ },
62
+ ]}>
63
+ {player?.shirtNumber}
64
+ </react_native_1.Text>
65
+ </react_native_1.View>
66
+ </react_native_1.View>
67
+
68
+ {/* Goal Assist Icon */}
69
+ {player?.isGoalAssist && (<react_native_1.View style={[
70
+ styles.assistIconWrapper,
71
+ react_native_1.I18nManager.isRTL ? { right: -8 } : { left: -8 },
72
+ ]}>
73
+ <react_native_1.Image source={kickerIcon} style={[
74
+ styles.assistIcon,
75
+ {
76
+ width: theme.spacing.iconSize,
77
+ height: theme.spacing.iconSize,
78
+ borderRadius: theme.spacing.iconSize,
79
+ },
80
+ ]}/>
81
+ </react_native_1.View>)}
82
+
83
+ {/* Own Goals */}
84
+ {player?.isOwnGoal && (<react_native_1.View style={[
85
+ styles.ownGoalsWrapper,
86
+ react_native_1.I18nManager.isRTL ? { right: -4 } : { left: -4 },
87
+ ]}>
88
+ <react_native_1.View style={[
89
+ styles.ownGoalsContainer,
90
+ {
91
+ height: theme.spacing.iconSize,
92
+ borderRadius: theme.spacing.iconSize,
93
+ backgroundColor: theme.colors.white,
94
+ borderColor: theme.colors.error,
95
+ },
96
+ Number(player?.ownGoals) > 1 && react_native_1.I18nManager.isRTL
97
+ ? { paddingLeft: 3 }
98
+ : { paddingRight: 3 },
99
+ ]}>
100
+ <react_native_1.View style={{
101
+ flexDirection: react_native_1.I18nManager.isRTL ? 'row' : 'row-reverse',
102
+ }}>
103
+ {Number(player?.ownGoals) > 1 && (<react_native_1.View style={[
104
+ react_native_1.I18nManager.isRTL ? { paddingRight: 2 } : { paddingLeft: 2 },
105
+ ]}>
106
+ <react_native_1.Text style={[
107
+ styles.goalsText,
108
+ {
109
+ fontSize: theme.typography.goalCountSize,
110
+ color: theme.colors.newError,
111
+ fontFamily: theme.typography.fontFamilyBold,
112
+ },
113
+ ]}>
114
+ {player?.ownGoals}
115
+ </react_native_1.Text>
116
+ </react_native_1.View>)}
117
+ <react_native_1.Image source={ownGoalIcon} style={[
118
+ styles.assistIcon,
119
+ {
120
+ width: theme.spacing.iconSize,
121
+ height: theme.spacing.iconSize,
122
+ borderRadius: theme.spacing.iconSize,
123
+ },
124
+ ]}/>
125
+ </react_native_1.View>
126
+ </react_native_1.View>
127
+ </react_native_1.View>)}
128
+
129
+ {/* Goals Scored */}
130
+ {player?.isScorer && (<react_native_1.View style={[
131
+ styles.footballIconWrapper,
132
+ react_native_1.I18nManager.isRTL
133
+ ? { left: Number(player?.goals) > 1 ? -10 : -2.8 }
134
+ : { right: Number(player?.goals) > 1 ? -10 : -2.8 },
135
+ ]}>
136
+ <react_native_1.View style={[
137
+ styles.goalsContainer,
138
+ {
139
+ height: theme.spacing.iconSize,
140
+ borderRadius: theme.spacing.iconSize,
141
+ borderColor: theme.colors.success,
142
+ backgroundColor: theme.colors.white,
143
+ },
144
+ Number(player?.goals) > 1 && react_native_1.I18nManager.isRTL
145
+ ? { paddingRight: 3 }
146
+ : { paddingLeft: 3 },
147
+ ]}>
148
+ <react_native_1.View style={{
149
+ flexDirection: react_native_1.I18nManager.isRTL ? 'row-reverse' : 'row',
150
+ }}>
151
+ {Number(player?.goals) > 1 && (<react_native_1.View style={[
152
+ react_native_1.I18nManager.isRTL ? { paddingLeft: 2 } : { paddingRight: 2 },
153
+ ]}>
154
+ <react_native_1.Text style={[
155
+ styles.goalsText,
156
+ {
157
+ fontSize: theme.typography.goalCountSize,
158
+ color: theme.colors.text,
159
+ fontFamily: theme.typography.fontFamilyBold,
160
+ },
161
+ ]}>
162
+ {player?.goals}
163
+ </react_native_1.Text>
164
+ </react_native_1.View>)}
165
+ <react_native_1.Image source={footballIcon} style={[
166
+ styles.footballIcon,
167
+ {
168
+ width: theme.spacing.iconSize,
169
+ height: theme.spacing.iconSize,
170
+ borderRadius: theme.spacing.iconSize,
171
+ },
172
+ ]}/>
173
+ </react_native_1.View>
174
+ </react_native_1.View>
175
+ </react_native_1.View>)}
176
+
177
+ {/* Yellow Card */}
178
+ {player?.isYellowCard && (<react_native_1.View style={[
179
+ styles.yellowCardWrapper,
180
+ react_native_1.I18nManager.isRTL ? { left: -8 } : { right: -8 },
181
+ ]}>
182
+ <react_native_1.View style={[
183
+ styles.yellowCardContainer,
184
+ {
185
+ width: theme.spacing.iconSize,
186
+ height: theme.spacing.iconSize,
187
+ borderRadius: theme.spacing.iconSize,
188
+ backgroundColor: theme.colors.white,
189
+ borderColor: theme.colors.border,
190
+ },
191
+ ]}>
192
+ <react_native_1.View style={[
193
+ styles.yellowCard,
194
+ {
195
+ borderRadius: theme.borderRadius.card,
196
+ backgroundColor: theme.colors.warning,
197
+ },
198
+ ]}/>
199
+ </react_native_1.View>
200
+ </react_native_1.View>)}
201
+
202
+ {/* Red Card */}
203
+ {player?.isRedCard && (<react_native_1.View style={[
204
+ styles.redCardWrapper,
205
+ react_native_1.I18nManager.isRTL ? { left: -8 } : { right: -8 },
206
+ ]}>
207
+ <react_native_1.View style={[
208
+ styles.redCardContainer,
209
+ {
210
+ width: theme.spacing.iconSize,
211
+ height: theme.spacing.iconSize,
212
+ borderRadius: theme.spacing.iconSize,
213
+ backgroundColor: theme.colors.white,
214
+ borderColor: theme.colors.border,
215
+ },
216
+ ]}>
217
+ <react_native_1.View style={[
218
+ styles.redCard,
219
+ {
220
+ borderRadius: theme.borderRadius.card,
221
+ backgroundColor: theme.colors.error,
222
+ },
223
+ ]}/>
224
+ </react_native_1.View>
225
+ </react_native_1.View>)}
226
+
227
+ {/* Substitute Icon */}
228
+ {player?.isSubstitute && (<react_native_1.View style={[
229
+ styles.playerSubstituteWrapper,
230
+ react_native_1.I18nManager.isRTL ? { left: -4 } : { right: -4 },
231
+ ]}>
232
+ <react_native_1.View style={[
233
+ styles.playerSubstituteContainer,
234
+ {
235
+ width: theme.spacing.iconSize,
236
+ height: theme.spacing.iconSize,
237
+ backgroundColor: theme.colors.white,
238
+ borderRadius: theme.spacing.iconSize,
239
+ },
240
+ ]}>
241
+ <react_native_1.Image source={renewalIcon} style={styles.playerSubstituteIcon}/>
242
+ </react_native_1.View>
243
+ </react_native_1.View>)}
244
+ </react_native_1.View>
245
+
246
+ <react_native_1.Text numberOfLines={1} style={[
247
+ styles.playerName,
248
+ {
249
+ fontSize: theme.typography.playerNameSize,
250
+ color: theme.colors.text,
251
+ fontFamily: theme.typography.fontFamily,
252
+ },
253
+ nameStyle,
254
+ ]}>
255
+ {getFirst10Chars(player?.matchName)}
256
+ </react_native_1.Text>
257
+ </react_native_1.View>);
258
+ if (onPress) {
259
+ return (<react_native_1.TouchableOpacity onPress={() => onPress(player)} activeOpacity={0.7}>
260
+ {cardContent}
261
+ </react_native_1.TouchableOpacity>);
262
+ }
263
+ return cardContent;
264
+ };
265
+ const styles = react_native_1.StyleSheet.create({
266
+ playerCard: {
267
+ position: 'absolute',
268
+ borderRadius: 50,
269
+ alignItems: 'center',
270
+ justifyContent: 'center',
271
+ },
272
+ playerImageContainer: {
273
+ borderWidth: 1,
274
+ },
275
+ playerImage: {
276
+ width: '100%',
277
+ height: '100%',
278
+ resizeMode: 'cover',
279
+ },
280
+ jerseyNumber: {
281
+ position: 'absolute',
282
+ top: -4,
283
+ zIndex: 3,
284
+ },
285
+ jerseyNumberWrapper: {
286
+ borderWidth: 0.3,
287
+ alignItems: 'center',
288
+ justifyContent: 'center',
289
+ },
290
+ jerseyText: {
291
+ includeFontPadding: false,
292
+ },
293
+ assistIconWrapper: {
294
+ position: 'absolute',
295
+ top: 16,
296
+ zIndex: 3,
297
+ },
298
+ assistIcon: {},
299
+ ownGoalsWrapper: {
300
+ position: 'absolute',
301
+ bottom: -1,
302
+ zIndex: 3,
303
+ },
304
+ ownGoalsContainer: {
305
+ borderWidth: 0.3,
306
+ alignItems: 'center',
307
+ justifyContent: 'center',
308
+ },
309
+ footballIconWrapper: {
310
+ position: 'absolute',
311
+ top: -3,
312
+ },
313
+ goalsContainer: {
314
+ borderWidth: 0.3,
315
+ justifyContent: 'center',
316
+ alignItems: 'center',
317
+ },
318
+ goalsText: {
319
+ includeFontPadding: false,
320
+ lineHeight: 13.8,
321
+ },
322
+ footballIcon: {},
323
+ yellowCardWrapper: {
324
+ position: 'absolute',
325
+ top: 16,
326
+ },
327
+ yellowCardContainer: {
328
+ borderWidth: 0.3,
329
+ justifyContent: 'center',
330
+ alignItems: 'center',
331
+ },
332
+ yellowCard: {
333
+ width: 6,
334
+ height: 8,
335
+ },
336
+ redCardWrapper: {
337
+ position: 'absolute',
338
+ top: 16,
339
+ },
340
+ redCardContainer: {
341
+ borderWidth: 0.3,
342
+ justifyContent: 'center',
343
+ alignItems: 'center',
344
+ },
345
+ redCard: {
346
+ width: 6,
347
+ height: 8,
348
+ },
349
+ playerSubstituteWrapper: {
350
+ position: 'absolute',
351
+ bottom: -1,
352
+ },
353
+ playerSubstituteContainer: {
354
+ justifyContent: 'center',
355
+ alignItems: 'center',
356
+ },
357
+ playerSubstituteIcon: {
358
+ width: 7.6,
359
+ height: 7.6,
360
+ },
361
+ playerName: {
362
+ marginTop: 2,
363
+ },
364
+ });
365
+ exports.default = react_1.default.memo(PlayerCard);
@@ -0,0 +1,3 @@
1
+ export { default as FormationField } from './FormationField';
2
+ export { default as PlayerCard } from './PlayerCard';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,cAAc,CAAC"}
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.PlayerCard = exports.FormationField = void 0;
7
+ var FormationField_1 = require("./FormationField");
8
+ Object.defineProperty(exports, "FormationField", { enumerable: true, get: function () { return __importDefault(FormationField_1).default; } });
9
+ var PlayerCard_1 = require("./PlayerCard");
10
+ Object.defineProperty(exports, "PlayerCard", { enumerable: true, get: function () { return __importDefault(PlayerCard_1).default; } });
@@ -0,0 +1,11 @@
1
+ /**
2
+ * React Native Football Formation
3
+ * A highly customizable component for displaying football/soccer team formations
4
+ * @author Arbab Rafiq
5
+ */
6
+ export { FormationField, PlayerCard } from './components';
7
+ export * from './types';
8
+ export * from './utils';
9
+ export * from './theme';
10
+ export { defaultAssets } from './assets';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAGH,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1D,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAGxB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,35 @@
1
+ "use strict";
2
+ /**
3
+ * React Native Football Formation
4
+ * A highly customizable component for displaying football/soccer team formations
5
+ * @author Arbab Rafiq
6
+ */
7
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
8
+ if (k2 === undefined) k2 = k;
9
+ var desc = Object.getOwnPropertyDescriptor(m, k);
10
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
11
+ desc = { enumerable: true, get: function() { return m[k]; } };
12
+ }
13
+ Object.defineProperty(o, k2, desc);
14
+ }) : (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ o[k2] = m[k];
17
+ }));
18
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
19
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
20
+ };
21
+ Object.defineProperty(exports, "__esModule", { value: true });
22
+ exports.defaultAssets = exports.PlayerCard = exports.FormationField = void 0;
23
+ // Main Components
24
+ var components_1 = require("./components");
25
+ Object.defineProperty(exports, "FormationField", { enumerable: true, get: function () { return components_1.FormationField; } });
26
+ Object.defineProperty(exports, "PlayerCard", { enumerable: true, get: function () { return components_1.PlayerCard; } });
27
+ // Types
28
+ __exportStar(require("./types"), exports);
29
+ // Utilities
30
+ __exportStar(require("./utils"), exports);
31
+ // Theme
32
+ __exportStar(require("./theme"), exports);
33
+ // Assets
34
+ var assets_1 = require("./assets");
35
+ Object.defineProperty(exports, "defaultAssets", { enumerable: true, get: function () { return assets_1.defaultAssets; } });
@@ -0,0 +1,12 @@
1
+ import { FormationTheme } from '../types';
2
+ /**
3
+ * Default theme configuration for the Formation Field component
4
+ * All values can be customized by passing a partial theme object to the component
5
+ */
6
+ export declare const defaultTheme: FormationTheme;
7
+ /**
8
+ * Deep merge theme objects
9
+ * Allows users to override only specific theme values
10
+ */
11
+ export declare const mergeTheme: (customTheme?: Partial<FormationTheme>) => FormationTheme;
12
+ //# sourceMappingURL=defaultTheme.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"defaultTheme.d.ts","sourceRoot":"","sources":["../../src/theme/defaultTheme.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,UAAU,CAAC;AAE1C;;;GAGG;AACH,eAAO,MAAM,YAAY,EAAE,cAsC1B,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,UAAU,GACrB,cAAc,OAAO,CAAC,cAAc,CAAC,KACpC,cAqBF,CAAC"}
@@ -0,0 +1,70 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.mergeTheme = exports.defaultTheme = void 0;
4
+ /**
5
+ * Default theme configuration for the Formation Field component
6
+ * All values can be customized by passing a partial theme object to the component
7
+ */
8
+ exports.defaultTheme = {
9
+ colors: {
10
+ primary: '#A8FF03',
11
+ blue: '#2194FF',
12
+ white: '#ffffff',
13
+ text: '#13151F',
14
+ border: '#96CBCB',
15
+ warning: '#FFA500',
16
+ success: '#34C759',
17
+ error: '#dc3545',
18
+ newError: '#FF4A4A',
19
+ formationBadge: '#41854A',
20
+ },
21
+ spacing: {
22
+ playerCardWidth: 70,
23
+ playerCardHeight: 50,
24
+ playerImageSize: 44,
25
+ jerseyNumberSize: 16,
26
+ iconSize: 12,
27
+ badgeMinWidth: 20,
28
+ badgeHeight: 14,
29
+ },
30
+ typography: {
31
+ playerNameSize: 12,
32
+ formationSize: 14,
33
+ jerseyNumberSize: 8,
34
+ goalCountSize: 8,
35
+ fontFamily: undefined,
36
+ fontFamilyBold: undefined,
37
+ },
38
+ borderRadius: {
39
+ playerImage: 44,
40
+ badge: 12,
41
+ card: 1,
42
+ },
43
+ };
44
+ /**
45
+ * Deep merge theme objects
46
+ * Allows users to override only specific theme values
47
+ */
48
+ const mergeTheme = (customTheme) => {
49
+ if (!customTheme)
50
+ return exports.defaultTheme;
51
+ return {
52
+ colors: {
53
+ ...exports.defaultTheme.colors,
54
+ ...customTheme.colors,
55
+ },
56
+ spacing: {
57
+ ...exports.defaultTheme.spacing,
58
+ ...customTheme.spacing,
59
+ },
60
+ typography: {
61
+ ...exports.defaultTheme.typography,
62
+ ...customTheme.typography,
63
+ },
64
+ borderRadius: {
65
+ ...exports.defaultTheme.borderRadius,
66
+ ...customTheme.borderRadius,
67
+ },
68
+ };
69
+ };
70
+ exports.mergeTheme = mergeTheme;
@@ -0,0 +1,2 @@
1
+ export * from './defaultTheme';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/theme/index.ts"],"names":[],"mappings":"AAAA,cAAc,gBAAgB,CAAC"}
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./defaultTheme"), exports);
@@ -0,0 +1,48 @@
1
+ import { ReactNode } from 'react';
2
+ import { ImageSourcePropType, ViewStyle, TextStyle } from 'react-native';
3
+ import { LineupFormationPlayer, TeamLineup } from './formation.types';
4
+ import { FormationTheme } from './theme.types';
5
+ /**
6
+ * Props for the main FormationField component
7
+ */
8
+ export interface FormationFieldProps {
9
+ lineup: TeamLineup;
10
+ width?: number;
11
+ height?: number;
12
+ theme?: Partial<FormationTheme>;
13
+ fieldImage?: ImageSourcePropType;
14
+ playerPlaceholder?: ImageSourcePropType;
15
+ footballIcon?: ImageSourcePropType;
16
+ kickerIcon?: ImageSourcePropType;
17
+ renewalIcon?: ImageSourcePropType;
18
+ ownGoalIcon?: ImageSourcePropType;
19
+ logoImage?: ImageSourcePropType;
20
+ renderPlayerCard?: (player: LineupFormationPlayer, fieldWidth: number, fieldHeight: number) => ReactNode;
21
+ renderFooter?: (formation: string) => ReactNode;
22
+ onPlayerPress?: (player: LineupFormationPlayer) => void;
23
+ showLogo?: boolean;
24
+ showFormation?: boolean;
25
+ showRating?: boolean;
26
+ containerStyle?: ViewStyle;
27
+ playerCardStyle?: ViewStyle;
28
+ playerNameStyle?: TextStyle;
29
+ getPlayerPhotoUrl?: (playerId: string) => string;
30
+ }
31
+ /**
32
+ * Props for the PlayerCard component
33
+ */
34
+ export interface PlayerCardProps {
35
+ player: LineupFormationPlayer;
36
+ fieldWidth: number;
37
+ fieldHeight: number;
38
+ theme: FormationTheme;
39
+ onPress?: (player: LineupFormationPlayer) => void;
40
+ style?: ViewStyle;
41
+ nameStyle?: TextStyle;
42
+ playerPlaceholder?: ImageSourcePropType;
43
+ footballIcon?: ImageSourcePropType;
44
+ kickerIcon?: ImageSourcePropType;
45
+ renewalIcon?: ImageSourcePropType;
46
+ ownGoalIcon?: ImageSourcePropType;
47
+ }
48
+ //# sourceMappingURL=component.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"component.types.d.ts","sourceRoot":"","sources":["../../src/types/component.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,mBAAmB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AACzE,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAE/C;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAElC,MAAM,EAAE,UAAU,CAAC;IAGnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAGhB,KAAK,CAAC,EAAE,OAAO,CAAC,cAAc,CAAC,CAAC;IAGhC,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;IACxC,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,SAAS,CAAC,EAAE,mBAAmB,CAAC;IAGhC,gBAAgB,CAAC,EAAE,CACjB,MAAM,EAAE,qBAAqB,EAC7B,UAAU,EAAE,MAAM,EAClB,WAAW,EAAE,MAAM,KAChB,SAAS,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,SAAS,CAAC;IAGhD,aAAa,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAGxD,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,UAAU,CAAC,EAAE,OAAO,CAAC;IAGrB,cAAc,CAAC,EAAE,SAAS,CAAC;IAC3B,eAAe,CAAC,EAAE,SAAS,CAAC;IAC5B,eAAe,CAAC,EAAE,SAAS,CAAC;IAG5B,iBAAiB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC;CAClD;AAED;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,qBAAqB,CAAC;IAC9B,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,KAAK,EAAE,cAAc,CAAC;IACtB,OAAO,CAAC,EAAE,CAAC,MAAM,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAClD,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IAGtB,iBAAiB,CAAC,EAAE,mBAAmB,CAAC;IACxC,YAAY,CAAC,EAAE,mBAAmB,CAAC;IACnC,UAAU,CAAC,EAAE,mBAAmB,CAAC;IACjC,WAAW,CAAC,EAAE,mBAAmB,CAAC;IAClC,WAAW,CAAC,EAAE,mBAAmB,CAAC;CACnC"}
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,59 @@
1
+ /**
2
+ * Type definitions for React Native Football Formation component
3
+ */
4
+ export interface PlayerStats {
5
+ type: string;
6
+ value: string | number;
7
+ }
8
+ export interface Player {
9
+ rating: string;
10
+ playerId: string;
11
+ position: string;
12
+ matchName: string;
13
+ shirtNumber: number;
14
+ positionSide?: string;
15
+ formationPosition?: string;
16
+ formationPlace?: string;
17
+ stats: PlayerStats[] | null[];
18
+ }
19
+ export interface TeamLineup {
20
+ players: Player[];
21
+ formationUsed: string;
22
+ }
23
+ export interface LineupFormationPlayer {
24
+ rating: string;
25
+ playerId: string;
26
+ position: string;
27
+ matchName: string;
28
+ shirtNumber: number;
29
+ isScorer: boolean;
30
+ isSubstitute: boolean;
31
+ isYellowCard: boolean;
32
+ isRedCard: boolean;
33
+ isOwnGoal: boolean;
34
+ ownGoals: number;
35
+ isGoalAssist: boolean;
36
+ goals: number;
37
+ formationPlace: string;
38
+ photo: string;
39
+ x: string | number;
40
+ y: string | number;
41
+ }
42
+ /**
43
+ * Supported formation types
44
+ */
45
+ export type FormationType = '4-4-2' | '4-1-2-1-2' | '4-3-3' | '4-5-1' | '4-4-1-1' | '4-1-4-1' | '4-2-3-1' | '4-3-2-1' | '5-3-2' | '5-4-1' | '3-5-2' | '3-4-3' | '4-2-2-2' | '3-5-1-1' | '3-4-2-1' | '3-4-1-2' | '3-1-4-2' | '3-4-3d' | '4-1-3-2' | '4-2-4-0' | '4-3-1-2' | '3-2-4-1' | '3-3-3-1';
46
+ /**
47
+ * Coordinate for player positioning on the field
48
+ */
49
+ export interface FieldCoordinate {
50
+ x: number;
51
+ y: number;
52
+ }
53
+ /**
54
+ * Formation coordinates mapping
55
+ */
56
+ export type FormationCoordinates = {
57
+ [key: string]: FieldCoordinate;
58
+ };
59
+ //# sourceMappingURL=formation.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"formation.types.d.ts","sourceRoot":"","sources":["../../src/types/formation.types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,MAAM;IACrB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,EAAE,WAAW,EAAE,GAAG,IAAI,EAAE,CAAC;CAC/B;AAED,MAAM,WAAW,UAAU;IACzB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,qBAAqB;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,YAAY,EAAE,OAAO,CAAC;IACtB,YAAY,EAAE,OAAO,CAAC;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,OAAO,CAAC;IACtB,KAAK,EAAE,MAAM,CAAC;IACd,cAAc,EAAE,MAAM,CAAC;IACvB,KAAK,EAAE,MAAM,CAAC;IACd,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACnB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,aAAa,GACrB,OAAO,GACP,WAAW,GACX,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,OAAO,GACP,OAAO,GACP,OAAO,GACP,OAAO,GACP,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,QAAQ,GACR,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,GACT,SAAS,CAAC;AAEd;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B,CAAC,EAAE,MAAM,CAAC;IACV,CAAC,EAAE,MAAM,CAAC;CACX;AAED;;GAEG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,CAAC,GAAG,EAAE,MAAM,GAAG,eAAe,CAAC;CAChC,CAAC"}
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+ /**
3
+ * Type definitions for React Native Football Formation component
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });