@umituz/react-native-design-system 2.5.9 → 2.5.11

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 (34) hide show
  1. package/README.md +1 -1
  2. package/package.json +3 -1
  3. package/src/atoms/AtomicButton.tsx +2 -5
  4. package/src/atoms/AtomicChip.tsx +13 -13
  5. package/src/atoms/AtomicIcon.tsx +1 -8
  6. package/src/atoms/AtomicPicker.tsx +6 -5
  7. package/src/atoms/__tests__/AtomicIcon.test.tsx +0 -6
  8. package/src/atoms/input/hooks/useInputState.ts +0 -6
  9. package/src/atoms/picker/components/PickerModal.tsx +15 -6
  10. package/src/atoms/picker/types/index.ts +17 -4
  11. package/src/device/detection/deviceDetection.ts +7 -20
  12. package/src/layouts/ScreenHeader/ScreenHeader.tsx +1 -2
  13. package/src/molecules/alerts/AlertToast.tsx +1 -1
  14. package/src/molecules/animation/presentation/hooks/useFireworks.ts +1 -3
  15. package/src/molecules/animation/presentation/providers/AnimationThemeProvider.tsx +1 -3
  16. package/src/molecules/avatar/Avatar.tsx +2 -2
  17. package/src/molecules/bottom-sheet/components/BottomSheetModal.tsx +0 -6
  18. package/src/molecules/calendar/infrastructure/storage/CalendarStore.ts +243 -245
  19. package/src/molecules/navigation/StackNavigator.tsx +6 -9
  20. package/src/molecules/navigation/TabsNavigator.tsx +9 -13
  21. package/src/molecules/navigation/utils/AppNavigation.ts +0 -2
  22. package/src/molecules/navigation/utils/LabelProcessor.ts +1 -10
  23. package/src/molecules/navigation/utils/NavigationCleanup.ts +4 -8
  24. package/src/molecules/navigation/utils/NavigationValidator.ts +2 -11
  25. package/src/presentation/utils/variants/compound.ts +0 -4
  26. package/src/presentation/utils/variants/core.ts +0 -4
  27. package/src/presentation/utils/variants/helpers.ts +0 -6
  28. package/src/safe-area/components/SafeAreaProvider.tsx +0 -10
  29. package/src/safe-area/utils/validation.ts +3 -27
  30. package/src/theme/core/CustomColors.ts +2 -8
  31. package/src/theme/core/colors/ColorUtils.ts +0 -6
  32. package/src/theme/infrastructure/storage/ThemeStorage.ts +2 -16
  33. package/src/typography/presentation/utils/textColorUtils.ts +0 -3
  34. package/src/utilities/clipboard/ClipboardUtils.ts +1 -5
@@ -36,10 +36,8 @@ export class NavigationCleanupManager {
36
36
  unsubscribers.forEach(unsubscribe => {
37
37
  try {
38
38
  unsubscribe();
39
- } catch (error) {
40
- if (__DEV__) {
41
- console.warn('[NavigationCleanupManager] Error during cleanup:', error);
42
- }
39
+ } catch {
40
+ // Silent cleanup error handling
43
41
  }
44
42
  });
45
43
  };
@@ -52,10 +50,8 @@ export class NavigationCleanupManager {
52
50
  return () => {
53
51
  try {
54
52
  unsubscribe();
55
- } catch (error) {
56
- if (__DEV__) {
57
- console.warn('[NavigationCleanupManager] Error during cleanup:', error);
58
- }
53
+ } catch {
54
+ // Silent cleanup error handling
59
55
  }
60
56
  };
61
57
  }
@@ -7,9 +7,6 @@ export class NavigationValidator {
7
7
  }
8
8
 
9
9
  if (screens.length === 0) {
10
- if (__DEV__) {
11
- console.warn(`[NavigationValidator] No screens provided for ${type} navigator`);
12
- }
13
10
  return;
14
11
  }
15
12
 
@@ -43,11 +40,8 @@ export class NavigationValidator {
43
40
  }
44
41
  }
45
42
 
46
- if (tabScreen.icon !== undefined && (typeof tabScreen.icon !== "string" || tabScreen.icon.trim() === "")) {
47
- if (__DEV__) {
48
- console.warn(`[NavigationValidator] Tab screen '${screen.name}' has invalid icon, it will be ignored`);
49
- }
50
- }
43
+ // Invalid icon check - silently handled
44
+ void (tabScreen.icon !== undefined && (typeof tabScreen.icon !== "string" || tabScreen.icon.trim() === ""));
51
45
  }
52
46
  });
53
47
  }
@@ -55,9 +49,6 @@ export class NavigationValidator {
55
49
  static validateInitialRoute(initialRouteName: string | undefined, screens: TabScreen[] | StackScreen[]): void {
56
50
  if (initialRouteName && !screens.find(screen => screen.name === initialRouteName)) {
57
51
  const error = `Initial route '${initialRouteName}' not found in screens. Available screens: ${screens.map(s => s.name).join(", ")}`;
58
- if (__DEV__) {
59
- console.error(`[NavigationValidator] ${error}`);
60
- }
61
52
  throw new Error(error);
62
53
  }
63
54
  }
@@ -18,10 +18,6 @@ export function createAdvancedVariants<T extends Record<string, Record<string, S
18
18
  return (props: VariantProps<T> = {}): Style => {
19
19
  let result = baseVariantFn(props);
20
20
 
21
- if (__DEV__) {
22
- console.log('[Design System] Creating advanced variant with compound conditions');
23
- }
24
-
25
21
  if (config.compoundVariants) {
26
22
  config.compoundVariants.forEach(compound => {
27
23
  const conditionsMet = Object.entries(compound.conditions).every(
@@ -18,10 +18,6 @@ export function createVariants<T extends Record<string, Record<string, Style>>>(
18
18
  return (props: VariantProps<T> = {}): Style => {
19
19
  let result: Style = { ...config.base };
20
20
 
21
- if (__DEV__) {
22
- console.log('[Design System] Creating variant with props:', props);
23
- }
24
-
25
21
  // Apply default variants
26
22
  if (config.defaultVariants) {
27
23
  Object.entries(config.defaultVariants).forEach(([variantKey, defaultValue]) => {
@@ -14,9 +14,6 @@ export function conditionalStyle<T extends Style>(
14
14
  trueStyle: T,
15
15
  falseStyle?: T
16
16
  ): T | undefined {
17
- if (__DEV__) {
18
- console.log('[Design System] Conditional style applied:', condition);
19
- }
20
17
  return condition ? trueStyle : falseStyle;
21
18
  }
22
19
 
@@ -25,9 +22,6 @@ export function responsiveStyle<T extends Style>(
25
22
  medium?: T,
26
23
  large?: T
27
24
  ): T {
28
- if (__DEV__) {
29
- console.log('[Design System] Responsive style - using small breakpoint');
30
- }
31
25
  void medium;
32
26
  void large;
33
27
  return small;
@@ -36,16 +36,6 @@ export const SafeAreaProvider: React.FC<SafeAreaProviderProps> = ({
36
36
  }) => {
37
37
  const mergedConfig = { ...DEFAULT_CONFIG, ...config };
38
38
 
39
- if (__DEV__) {
40
- if (config) {
41
- Object.entries(config).forEach(([key, value]) => {
42
- if (typeof value !== 'number' && typeof value !== 'boolean') {
43
- console.warn(`SafeAreaProvider: ${key} must be a number or boolean, got ${typeof value}`);
44
- }
45
- });
46
- }
47
- }
48
-
49
39
  return (
50
40
  <SafeAreaConfigContext.Provider value={mergedConfig}>
51
41
  <NativeSafeAreaProvider {...nativeProps}>
@@ -39,33 +39,9 @@ export const validateNumericInput = (
39
39
  return isValid;
40
40
  };
41
41
 
42
- // Throttled console warning to prevent spam
43
- // Uses requestAnimationFrame for better performance
44
- const warningTimes = new Map<string, number>();
45
- const WARNING_THROTTLE = 1000; // 1 second
46
-
47
- export const throttledWarn = (message: string): void => {
48
- if (!__DEV__) {
49
- return;
50
- }
51
-
52
- const now = Date.now();
53
- const lastTime = warningTimes.get(message) || 0;
54
-
55
- if (now - lastTime > WARNING_THROTTLE) {
56
- console.warn(message);
57
- warningTimes.set(message, now);
58
-
59
- // Clean up old entries to prevent memory leaks
60
- if (warningTimes.size > 50) {
61
- const cutoffTime = now - WARNING_THROTTLE * 10;
62
- for (const [key, time] of warningTimes.entries()) {
63
- if (time < cutoffTime) {
64
- warningTimes.delete(key);
65
- }
66
- }
67
- }
68
- }
42
+ export const throttledWarn = (_message: string): void => {
43
+ // Silent validation - no console output in production
44
+ void _message;
69
45
  };
70
46
 
71
47
  // Cleanup function to clear validation cache
@@ -31,16 +31,13 @@ export interface CustomThemeColors {
31
31
  */
32
32
  export const validateCustomColors = (customColors: CustomThemeColors): boolean => {
33
33
  const colorValues = Object.values(customColors).filter(Boolean) as string[];
34
-
34
+
35
35
  for (const color of colorValues) {
36
36
  if (!isValidHexColor(color)) {
37
- if (__DEV__) {
38
- console.warn('[validateCustomColors] Invalid hex color:', color);
39
- }
40
37
  return false;
41
38
  }
42
39
  }
43
-
40
+
44
41
  return true;
45
42
  };
46
43
 
@@ -60,9 +57,6 @@ export const applyCustomColors = (
60
57
 
61
58
  // Validate custom colors
62
59
  if (!validateCustomColors(customColors)) {
63
- if (__DEV__) {
64
- console.error('[applyCustomColors] Invalid custom colors provided, using defaults');
65
- }
66
60
  return palette;
67
61
  }
68
62
 
@@ -27,16 +27,10 @@ export const isValidHexColor = (hexColor: string): boolean => {
27
27
  */
28
28
  export const withAlpha = (hexColor: string, alpha: number): string => {
29
29
  if (!isValidHexColor(hexColor)) {
30
- if (__DEV__) {
31
- console.warn('[withAlpha] Invalid hex color format:', hexColor);
32
- }
33
30
  return hexColor;
34
31
  }
35
32
 
36
33
  if (typeof alpha !== 'number' || alpha < 0 || alpha > 1) {
37
- if (__DEV__) {
38
- console.warn('[withAlpha] Invalid alpha value, must be 0-1:', alpha);
39
- }
40
34
  return hexColor;
41
35
  }
42
36
 
@@ -28,15 +28,8 @@ export class ThemeStorage {
28
28
  return value as ThemeMode;
29
29
  }
30
30
 
31
- if (__DEV__) {
32
- console.warn('[ThemeStorage] Invalid theme mode value stored:', value);
33
- }
34
31
  return null;
35
- } catch (error) {
36
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
37
- if (__DEV__) {
38
- console.error('[ThemeStorage] Error getting theme mode:', errorMessage);
39
- }
32
+ } catch {
40
33
  // Return null instead of throwing to prevent app crashes
41
34
  return null;
42
35
  }
@@ -55,9 +48,6 @@ export class ThemeStorage {
55
48
  await AsyncStorage.setItem(STORAGE_KEY, mode);
56
49
  } catch (error) {
57
50
  const errorMessage = error instanceof Error ? error.message : 'Unknown error';
58
- if (__DEV__) {
59
- console.error('[ThemeStorage] Error saving theme mode:', errorMessage);
60
- }
61
51
  // Re-throw validation errors but swallow storage errors to prevent app crashes
62
52
  if (errorMessage.includes('Invalid theme mode')) {
63
53
  throw error;
@@ -71,11 +61,7 @@ export class ThemeStorage {
71
61
  static async clearThemeMode(): Promise<void> {
72
62
  try {
73
63
  await AsyncStorage.removeItem(STORAGE_KEY);
74
- } catch (error) {
75
- const errorMessage = error instanceof Error ? error.message : 'Unknown error';
76
- if (__DEV__) {
77
- console.error('[ThemeStorage] Error clearing theme mode:', errorMessage);
78
- }
64
+ } catch {
79
65
  // Don't throw - clearing storage is not critical
80
66
  }
81
67
  }
@@ -123,9 +123,6 @@ class MaterialColorMapper implements ColorMapper {
123
123
  return tokens.colors.textSecondary;
124
124
 
125
125
  default:
126
- if (__DEV__) {
127
- console.warn(`Unknown color variant: ${color}`);
128
- }
129
126
  return tokens.colors.textPrimary;
130
127
  }
131
128
  }
@@ -28,7 +28,6 @@ export class ClipboardUtils {
28
28
  try {
29
29
  await Clipboard.setStringAsync(text);
30
30
  } catch (error) {
31
- console.error('[ClipboardUtils] Failed to copy to clipboard:', error);
32
31
  throw error;
33
32
  }
34
33
  }
@@ -40,7 +39,6 @@ export class ClipboardUtils {
40
39
  try {
41
40
  return await Clipboard.getStringAsync();
42
41
  } catch (error) {
43
- console.error('[ClipboardUtils] Failed to get from clipboard:', error);
44
42
  throw error;
45
43
  }
46
44
  }
@@ -51,8 +49,7 @@ export class ClipboardUtils {
51
49
  static async hasContent(): Promise<boolean> {
52
50
  try {
53
51
  return await Clipboard.hasStringAsync();
54
- } catch (error) {
55
- console.error('[ClipboardUtils] Failed to check clipboard:', error);
52
+ } catch {
56
53
  return false;
57
54
  }
58
55
  }
@@ -64,7 +61,6 @@ export class ClipboardUtils {
64
61
  try {
65
62
  await Clipboard.setStringAsync('');
66
63
  } catch (error) {
67
- console.error('[ClipboardUtils] Failed to clear clipboard:', error);
68
64
  throw error;
69
65
  }
70
66
  }