@umituz/react-native-design-system 4.23.80 → 4.23.82

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 (77) hide show
  1. package/package.json +3 -3
  2. package/src/atoms/AtomicInput.tsx +11 -48
  3. package/src/atoms/AtomicPicker.tsx +19 -94
  4. package/src/atoms/EmptyState.tsx +1 -1
  5. package/src/atoms/icon/iconStore.ts +1 -1
  6. package/src/atoms/picker/components/PickerModal.tsx +40 -121
  7. package/src/device/infrastructure/services/PersistentDeviceIdService.ts +4 -4
  8. package/src/device/presentation/hooks/useDeviceInfo.ts +55 -149
  9. package/src/haptics/infrastructure/services/HapticService.ts +1 -1
  10. package/src/image/index.ts +2 -1
  11. package/src/image/presentation/hooks/useImageBatch.ts +2 -1
  12. package/src/infinite-scroll/presentation/components/infinite-scroll-list.tsx +1 -1
  13. package/src/infinite-scroll/presentation/hooks/pagination.helper.ts +0 -5
  14. package/src/infinite-scroll/presentation/hooks/useInfiniteScroll.ts +4 -54
  15. package/src/init/createAppInitializer.ts +1 -1
  16. package/src/init/env/createEnvConfig.ts +0 -1
  17. package/src/init/useAppInitialization.ts +0 -1
  18. package/src/layouts/ScreenHeader/ScreenHeader.tsx +1 -1
  19. package/src/media/infrastructure/services/CardMediaOptimizerService.ts +1 -1
  20. package/src/media/infrastructure/services/CardMediaUploadService.ts +0 -1
  21. package/src/media/presentation/hooks/useCardMediaGeneration.ts +1 -1
  22. package/src/media/presentation/hooks/useCardMediaUpload.ts +1 -1
  23. package/src/media/presentation/hooks/useCardMediaValidation.ts +1 -1
  24. package/src/media/presentation/hooks/useCardMultimediaFlashcard.ts +1 -1
  25. package/src/media/presentation/hooks/useMedia.ts +0 -1
  26. package/src/media/presentation/hooks/useMediaGeneration.ts +1 -1
  27. package/src/media/presentation/hooks/useMediaUpload.ts +1 -1
  28. package/src/media/presentation/hooks/useMediaValidation.ts +1 -1
  29. package/src/media/presentation/hooks/useMultimediaFlashcard.ts +1 -1
  30. package/src/molecules/BaseModal.tsx +2 -3
  31. package/src/molecules/ConfirmationModalContent.tsx +1 -1
  32. package/src/molecules/ConfirmationModalMain.tsx +1 -1
  33. package/src/molecules/bottom-sheet/components/BottomSheetModal.tsx +1 -3
  34. package/src/molecules/bottom-sheet/components/filter/FilterBottomSheet.tsx +100 -179
  35. package/src/molecules/calendar/infrastructure/stores/useCalendarEvents.ts +0 -1
  36. package/src/molecules/confirmation-modal/useConfirmationModal.ts +1 -1
  37. package/src/molecules/countdown/components/Countdown.tsx +1 -1
  38. package/src/molecules/navigation/StackNavigator.tsx +1 -1
  39. package/src/molecules/navigation/TabsNavigator.tsx +1 -1
  40. package/src/molecules/navigation/types.ts +2 -2
  41. package/src/molecules/navigation/utils/AppNavigation.ts +0 -8
  42. package/src/molecules/splash/components/SplashScreen.tsx +0 -4
  43. package/src/offline/infrastructure/events/NetworkEvents.ts +2 -2
  44. package/src/offline/infrastructure/utils/healthCheck.ts +1 -6
  45. package/src/offline/presentation/hooks/useOffline.ts +1 -2
  46. package/src/offline/presentation/hooks/useOfflineWithMutations.ts +1 -3
  47. package/src/onboarding/index.ts +0 -1
  48. package/src/onboarding/infrastructure/hooks/useOnboardingNavigation.ts +0 -1
  49. package/src/onboarding/infrastructure/storage/actions/storageHelpers.ts +1 -3
  50. package/src/onboarding/presentation/hooks/useOnboardingScreenHandlers.ts +2 -4
  51. package/src/onboarding/presentation/hooks/useOnboardingScreenState.ts +0 -1
  52. package/src/onboarding/presentation/screens/OnboardingScreen.tsx +0 -3
  53. package/src/organisms/FormContainer.tsx +1 -1
  54. package/src/services/api/ApiClient.ts +42 -135
  55. package/src/storage/cache/domain/Cache.ts +0 -2
  56. package/src/storage/cache/domain/__tests__/ErrorHandler.test.ts +8 -8
  57. package/src/storage/cache/infrastructure/TTLCache.ts +0 -3
  58. package/src/storage/domain/utils/devUtils.ts +3 -6
  59. package/src/storage/infrastructure/adapters/StorageService.ts +0 -3
  60. package/src/storage/infrastructure/repositories/BaseStorageOperations.ts +0 -1
  61. package/src/tanstack/domain/config/QueryClientAccessor.ts +0 -1
  62. package/src/tanstack/domain/repositories/BaseRepository.ts +4 -4
  63. package/src/tanstack/domain/repositories/IBaseRepository.ts +3 -5
  64. package/src/tanstack/domain/repositories/RepositoryFactory.ts +0 -2
  65. package/src/tanstack/domain/repositories/mixins/repositoryInvalidationMethods.ts +10 -11
  66. package/src/tanstack/domain/repositories/mixins/repositoryQueryMethods.ts +11 -11
  67. package/src/tanstack/domain/utils/ErrorHelpers.ts +1 -2
  68. package/src/tanstack/infrastructure/config/PersisterConfig.ts +6 -13
  69. package/src/tanstack/infrastructure/config/QueryClientConfig.ts +0 -13
  70. package/src/tanstack/infrastructure/monitoring/DevMonitorLogger.ts +0 -5
  71. package/src/tanstack/presentation/hooks/useInvalidateQueries.ts +0 -4
  72. package/src/tanstack/presentation/hooks/useOptimisticUpdate.ts +0 -2
  73. package/src/tanstack/presentation/hooks/usePrefetch.ts +18 -119
  74. package/src/theme/core/CustomColors.ts +4 -122
  75. package/src/theme/infrastructure/storage/ThemeStorage.ts +0 -1
  76. package/src/typography/presentation/utils/textColorUtils.ts +36 -163
  77. package/src/tanstack/presentation/hooks/utils/prefetchLogger.ts +0 -27
@@ -1,200 +1,73 @@
1
1
  /**
2
2
  * Text Color Utilities
3
- *
3
+ *
4
4
  * Helper functions for resolving text colors from design tokens.
5
- * These utilities are used by components like AtomicText to map color variants
6
- * to actual color values from theme.
7
- *
8
- * @fileoverview Provides color resolution utilities for Material Design 3
9
- * @author Ümit UZ <umit@umituz.com>
10
- * @since 1.0.0
11
- * @version 1.2.0
12
- *
13
- * @example
14
- * ```typescript
15
- * import { getTextColor } from '@umituz/react-native-design-system-typography';
16
- * import { useAppDesignTokens } from '@umituz/react-native-design-system-theme';
17
- *
18
- * const MyComponent = () => {
19
- * const tokens = useAppDesignTokens();
20
- * const textColor = getTextColor('textPrimary', tokens);
21
- * return <Text style={{ color: textColor }}>Hello</Text>;
22
- * };
23
- * ```
24
5
  */
25
6
 
26
7
  import type { ColorVariant } from '../../domain/entities/TypographyTypes';
27
8
  import type { DesignTokens } from '../../../theme';
28
9
 
29
- // Cache for color variant validation to improve performance
30
10
  const COLOR_VARIANT_SET = new Set<string>([
31
- 'textPrimary',
32
- 'textSecondary',
33
- 'textTertiary',
34
- 'textDisabled',
35
- 'textInverse',
36
- 'onSurface',
37
- 'onBackground',
38
- 'onPrimary',
39
- 'onSecondary',
40
- 'onSuccess',
41
- 'onError',
42
- 'onWarning',
43
- 'onInfo',
44
- 'success',
45
- 'error',
46
- 'warning',
47
- 'info',
48
- 'primary',
49
- 'secondary',
50
- 'tertiary',
51
- 'disabled',
52
- 'inverse',
53
- 'surfaceVariant',
11
+ 'textPrimary', 'textSecondary', 'textTertiary', 'textDisabled', 'textInverse',
12
+ 'onSurface', 'onBackground', 'onPrimary', 'onSecondary', 'onSuccess', 'onError', 'onWarning', 'onInfo',
13
+ 'success', 'error', 'warning', 'info', 'primary', 'secondary', 'tertiary', 'disabled', 'inverse', 'surfaceVariant',
54
14
  ]);
55
15
 
56
- /**
57
- * Color mapper interface for dependency injection
58
- */
59
- interface ColorMapper {
60
- getColor(color: ColorVariant, tokens: DesignTokens): string;
61
- }
62
-
63
- /**
64
- * Material Design 3 color mapper implementation
65
- */
66
- class MaterialColorMapper implements ColorMapper {
67
- getColor(color: ColorVariant, tokens: DesignTokens): string {
68
- switch (color) {
69
- // General text colors (Material Design 3)
70
- case 'textPrimary':
71
- return tokens.colors.textPrimary;
72
- case 'textSecondary':
73
- return tokens.colors.textSecondary;
74
- case 'textTertiary':
75
- return tokens.colors.textTertiary;
76
- case 'textDisabled':
77
- return tokens.colors.textDisabled;
78
- case 'textInverse':
79
- return tokens.colors.textInverse;
80
-
81
- // Text on surfaces (Material Design 3)
82
- case 'onSurface':
83
- return tokens.colors.onSurface;
84
- case 'onBackground':
85
- return tokens.colors.onBackground;
86
-
87
- // Text on colored backgrounds (Material Design 3)
88
- case 'onPrimary':
89
- return tokens.colors.onPrimary;
90
- case 'onSecondary':
91
- return tokens.colors.onSecondary;
92
- case 'onSuccess':
93
- return tokens.colors.onSuccess;
94
- case 'onError':
95
- return tokens.colors.onError;
96
- case 'onWarning':
97
- return tokens.colors.onWarning;
98
- case 'onInfo':
99
- return tokens.colors.onInfo;
100
-
101
- // Semantic colors (can be used as text)
102
- case 'success':
103
- return tokens.colors.success;
104
- case 'error':
105
- return tokens.colors.error;
106
- case 'warning':
107
- return tokens.colors.warning;
108
- case 'info':
109
- return tokens.colors.info;
110
-
111
- // Brand colors (can be used as text color)
112
- case 'primary':
113
- return tokens.colors.primary;
114
- case 'secondary':
115
- return tokens.colors.secondary;
116
- case 'tertiary':
117
- return tokens.colors.textTertiary;
118
- case 'disabled':
119
- return tokens.colors.textDisabled;
120
- case 'inverse':
121
- return tokens.colors.textInverse;
122
- case 'surfaceVariant':
123
- return tokens.colors.surfaceVariant;
124
-
125
- default:
126
- return tokens.colors.textPrimary;
127
- }
128
- }
129
- }
16
+ const COLOR_MAP: Record<ColorVariant, keyof DesignTokens['colors']> = {
17
+ textPrimary: 'textPrimary',
18
+ textSecondary: 'textSecondary',
19
+ textTertiary: 'textTertiary',
20
+ textDisabled: 'textDisabled',
21
+ textInverse: 'textInverse',
22
+ onSurface: 'onSurface',
23
+ onBackground: 'onBackground',
24
+ onPrimary: 'onPrimary',
25
+ onSecondary: 'onSecondary',
26
+ onSuccess: 'onSuccess',
27
+ onError: 'onError',
28
+ onWarning: 'onWarning',
29
+ onInfo: 'onInfo',
30
+ success: 'success',
31
+ error: 'error',
32
+ warning: 'warning',
33
+ info: 'info',
34
+ primary: 'primary',
35
+ secondary: 'secondary',
36
+ tertiary: 'textTertiary',
37
+ disabled: 'textDisabled',
38
+ inverse: 'textInverse',
39
+ surfaceVariant: 'surfaceVariant',
40
+ };
130
41
 
131
- // Singleton instance for performance
132
- const colorMapper = new MaterialColorMapper();
133
-
134
- // Cache for resolved colors to improve performance
135
42
  const colorCache = new Map<string, string>();
136
43
 
137
- /**
138
- * Clear the color cache
139
- * Useful for testing or theme changes
140
- */
141
44
  export function clearColorCache(): void {
142
45
  colorCache.clear();
143
46
  }
144
47
 
145
- /**
146
- * Get text color from design tokens based on color variant
147
- *
148
- * @param color - Color variant or custom color string
149
- * @param tokens - Design tokens containing color values
150
- * @returns Resolved color string
151
- *
152
- * @example
153
- * ```tsx
154
- * const tokens = useAppDesignTokens();
155
- * const textColor = getTextColor('textPrimary', tokens);
156
- * ```
157
- */
158
48
  export function getTextColor(
159
49
  color: ColorVariant | string | undefined,
160
50
  tokens: DesignTokens,
161
51
  ): string {
162
- // Validate tokens parameter
163
- if (!tokens || !tokens.colors) {
52
+ if (!tokens?.colors) {
164
53
  throw new Error('Invalid design tokens: tokens and tokens.colors are required');
165
54
  }
166
55
 
167
- if (!color) {
168
- return tokens.colors.textPrimary;
169
- }
56
+ if (!color) return tokens.colors.textPrimary;
170
57
 
171
- // If it's a custom color string (not a variant), return as-is
172
- if (typeof color === 'string' && !isColorVariant(color)) {
173
- return color;
174
- }
58
+ if (typeof color === 'string' && !isColorVariant(color)) return color;
175
59
 
176
- // Create cache key - use hash instead of JSON.stringify to prevent memory leaks
177
60
  const cacheKey = `${color}_${Object.keys(tokens.colors).length}_${tokens.colors.textPrimary}`;
178
61
 
179
- // Check cache first
180
- if (colorCache.has(cacheKey)) {
181
- return colorCache.get(cacheKey)!;
182
- }
62
+ if (colorCache.has(cacheKey)) return colorCache.get(cacheKey)!;
183
63
 
184
- // Resolve color and cache it
185
- const resolvedColor = colorMapper.getColor(color as ColorVariant, tokens);
186
- colorCache.set(cacheKey, resolvedColor);
64
+ const colorKey = COLOR_MAP[color as ColorVariant] ?? 'textPrimary';
65
+ const resolvedColor = tokens.colors[colorKey];
187
66
 
67
+ colorCache.set(cacheKey, resolvedColor);
188
68
  return resolvedColor;
189
69
  }
190
70
 
191
- /**
192
- * Check if a string is a valid ColorVariant
193
- * Uses Set for O(1) lookup performance
194
- *
195
- * @param value - String to check
196
- * @returns True if value is a ColorVariant
197
- */
198
71
  function isColorVariant(value: string): value is ColorVariant {
199
72
  return COLOR_VARIANT_SET.has(value);
200
73
  }
@@ -1,27 +0,0 @@
1
- /**
2
- * Prefetch Logger Utility
3
- * Logging utility for prefetch operations
4
- */
5
-
6
- /**
7
- * Logs prefetch operation in development mode
8
- *
9
- * @param message - Log message
10
- * @param data - Additional data to log
11
- */
12
- export function logPrefetch(message: string, data: unknown): void {
13
- if (__DEV__) {
14
- console.log(`[TanStack Query] ${message}`, data);
15
- }
16
- }
17
-
18
- /**
19
- * Logs multiple prefetch operation
20
- *
21
- * @param count - Number of queries prefetched
22
- */
23
- export function logPrefetchMultiple(count: number): void {
24
- if (__DEV__) {
25
- console.log(`[TanStack Query] Prefetched multiple:`, count);
26
- }
27
- }