@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.
- package/package.json +3 -3
- package/src/atoms/AtomicInput.tsx +11 -48
- package/src/atoms/AtomicPicker.tsx +19 -94
- package/src/atoms/EmptyState.tsx +1 -1
- package/src/atoms/icon/iconStore.ts +1 -1
- package/src/atoms/picker/components/PickerModal.tsx +40 -121
- package/src/device/infrastructure/services/PersistentDeviceIdService.ts +4 -4
- package/src/device/presentation/hooks/useDeviceInfo.ts +55 -149
- package/src/haptics/infrastructure/services/HapticService.ts +1 -1
- package/src/image/index.ts +2 -1
- package/src/image/presentation/hooks/useImageBatch.ts +2 -1
- package/src/infinite-scroll/presentation/components/infinite-scroll-list.tsx +1 -1
- package/src/infinite-scroll/presentation/hooks/pagination.helper.ts +0 -5
- package/src/infinite-scroll/presentation/hooks/useInfiniteScroll.ts +4 -54
- package/src/init/createAppInitializer.ts +1 -1
- package/src/init/env/createEnvConfig.ts +0 -1
- package/src/init/useAppInitialization.ts +0 -1
- package/src/layouts/ScreenHeader/ScreenHeader.tsx +1 -1
- package/src/media/infrastructure/services/CardMediaOptimizerService.ts +1 -1
- package/src/media/infrastructure/services/CardMediaUploadService.ts +0 -1
- package/src/media/presentation/hooks/useCardMediaGeneration.ts +1 -1
- package/src/media/presentation/hooks/useCardMediaUpload.ts +1 -1
- package/src/media/presentation/hooks/useCardMediaValidation.ts +1 -1
- package/src/media/presentation/hooks/useCardMultimediaFlashcard.ts +1 -1
- package/src/media/presentation/hooks/useMedia.ts +0 -1
- package/src/media/presentation/hooks/useMediaGeneration.ts +1 -1
- package/src/media/presentation/hooks/useMediaUpload.ts +1 -1
- package/src/media/presentation/hooks/useMediaValidation.ts +1 -1
- package/src/media/presentation/hooks/useMultimediaFlashcard.ts +1 -1
- package/src/molecules/BaseModal.tsx +2 -3
- package/src/molecules/ConfirmationModalContent.tsx +1 -1
- package/src/molecules/ConfirmationModalMain.tsx +1 -1
- package/src/molecules/bottom-sheet/components/BottomSheetModal.tsx +1 -3
- package/src/molecules/bottom-sheet/components/filter/FilterBottomSheet.tsx +100 -179
- package/src/molecules/calendar/infrastructure/stores/useCalendarEvents.ts +0 -1
- package/src/molecules/confirmation-modal/useConfirmationModal.ts +1 -1
- package/src/molecules/countdown/components/Countdown.tsx +1 -1
- package/src/molecules/navigation/StackNavigator.tsx +1 -1
- package/src/molecules/navigation/TabsNavigator.tsx +1 -1
- package/src/molecules/navigation/types.ts +2 -2
- package/src/molecules/navigation/utils/AppNavigation.ts +0 -8
- package/src/molecules/splash/components/SplashScreen.tsx +0 -4
- package/src/offline/infrastructure/events/NetworkEvents.ts +2 -2
- package/src/offline/infrastructure/utils/healthCheck.ts +1 -6
- package/src/offline/presentation/hooks/useOffline.ts +1 -2
- package/src/offline/presentation/hooks/useOfflineWithMutations.ts +1 -3
- package/src/onboarding/index.ts +0 -1
- package/src/onboarding/infrastructure/hooks/useOnboardingNavigation.ts +0 -1
- package/src/onboarding/infrastructure/storage/actions/storageHelpers.ts +1 -3
- package/src/onboarding/presentation/hooks/useOnboardingScreenHandlers.ts +2 -4
- package/src/onboarding/presentation/hooks/useOnboardingScreenState.ts +0 -1
- package/src/onboarding/presentation/screens/OnboardingScreen.tsx +0 -3
- package/src/organisms/FormContainer.tsx +1 -1
- package/src/services/api/ApiClient.ts +42 -135
- package/src/storage/cache/domain/Cache.ts +0 -2
- package/src/storage/cache/domain/__tests__/ErrorHandler.test.ts +8 -8
- package/src/storage/cache/infrastructure/TTLCache.ts +0 -3
- package/src/storage/domain/utils/devUtils.ts +3 -6
- package/src/storage/infrastructure/adapters/StorageService.ts +0 -3
- package/src/storage/infrastructure/repositories/BaseStorageOperations.ts +0 -1
- package/src/tanstack/domain/config/QueryClientAccessor.ts +0 -1
- package/src/tanstack/domain/repositories/BaseRepository.ts +4 -4
- package/src/tanstack/domain/repositories/IBaseRepository.ts +3 -5
- package/src/tanstack/domain/repositories/RepositoryFactory.ts +0 -2
- package/src/tanstack/domain/repositories/mixins/repositoryInvalidationMethods.ts +10 -11
- package/src/tanstack/domain/repositories/mixins/repositoryQueryMethods.ts +11 -11
- package/src/tanstack/domain/utils/ErrorHelpers.ts +1 -2
- package/src/tanstack/infrastructure/config/PersisterConfig.ts +6 -13
- package/src/tanstack/infrastructure/config/QueryClientConfig.ts +0 -13
- package/src/tanstack/infrastructure/monitoring/DevMonitorLogger.ts +0 -5
- package/src/tanstack/presentation/hooks/useInvalidateQueries.ts +0 -4
- package/src/tanstack/presentation/hooks/useOptimisticUpdate.ts +0 -2
- package/src/tanstack/presentation/hooks/usePrefetch.ts +18 -119
- package/src/theme/core/CustomColors.ts +4 -122
- package/src/theme/infrastructure/storage/ThemeStorage.ts +0 -1
- package/src/typography/presentation/utils/textColorUtils.ts +36 -163
- 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
|
-
'
|
|
33
|
-
'
|
|
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
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
180
|
-
if (colorCache.has(cacheKey)) {
|
|
181
|
-
return colorCache.get(cacheKey)!;
|
|
182
|
-
}
|
|
62
|
+
if (colorCache.has(cacheKey)) return colorCache.get(cacheKey)!;
|
|
183
63
|
|
|
184
|
-
|
|
185
|
-
const resolvedColor =
|
|
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
|
-
}
|