@umituz/react-native-design-system 2.6.79 → 2.6.80

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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-design-system",
3
- "version": "2.6.79",
3
+ "version": "2.6.80",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive and safe area utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -64,17 +64,17 @@ export class AvatarUtils {
64
64
  * Same name always returns same color
65
65
  */
66
66
  static getColorForName(name: string): string {
67
- if (!name) return AVATAR_COLORS[0];
67
+ if (!name) return AVATAR_COLORS[0] ?? '#7E57C2';
68
68
 
69
69
  const hash = this.hashString(name);
70
- return AVATAR_COLORS[hash % AVATAR_COLORS.length];
70
+ return AVATAR_COLORS[hash % AVATAR_COLORS.length] ?? AVATAR_COLORS[0] ?? '#7E57C2';
71
71
  }
72
72
 
73
73
  /**
74
74
  * Get size config
75
75
  */
76
76
  static getSizeConfig(size: AvatarSize): SizeConfig {
77
- return SIZE_CONFIGS[size];
77
+ return SIZE_CONFIGS[size] ?? SIZE_CONFIGS.md;
78
78
  }
79
79
 
80
80
  /**
@@ -84,14 +84,14 @@ export class AvatarUtils {
84
84
  if (shape === 'circle') {
85
85
  return size / 2;
86
86
  }
87
- return SHAPE_CONFIGS[shape];
87
+ return SHAPE_CONFIGS[shape] ?? 0;
88
88
  }
89
89
 
90
90
  /**
91
91
  * Get status color
92
92
  */
93
93
  static getStatusColor(status: 'online' | 'offline' | 'away' | 'busy'): string {
94
- return STATUS_COLORS[status];
94
+ return STATUS_COLORS[status] ?? STATUS_COLORS.offline;
95
95
  }
96
96
 
97
97
  /**
@@ -132,7 +132,3 @@ export class AvatarUtils {
132
132
  return config.type === 'icon' && !!config.icon;
133
133
  }
134
134
  }
135
-
136
- // Re-export types and constants for convenience
137
- export type { AvatarSize, AvatarShape, AvatarType, AvatarConfig, SizeConfig } from './Avatar.types';
138
- export { AVATAR_COLORS, STATUS_COLORS, SHAPE_CONFIGS, SIZE_CONFIGS, AVATAR_CONSTANTS } from './Avatar.constants';
@@ -42,7 +42,7 @@ export const Countdown: React.FC<CountdownProps> = ({
42
42
  () => [target, ...alternateTargets],
43
43
  [target, alternateTargets]
44
44
  );
45
- const currentTarget = allTargets[currentTargetIndex];
45
+ const currentTarget = allTargets[currentTargetIndex] ?? target;
46
46
 
47
47
  const { timeRemaining, setTarget: updateTarget } = useCountdown(currentTarget, {
48
48
  interval,
@@ -50,25 +50,28 @@ export const Countdown: React.FC<CountdownProps> = ({
50
50
  });
51
51
 
52
52
  React.useEffect(() => {
53
- updateTarget(currentTarget);
53
+ if (currentTarget) {
54
+ updateTarget(currentTarget);
55
+ }
54
56
  }, [currentTarget, updateTarget]);
55
57
 
56
58
  const handleToggle = () => {
57
59
  const nextIndex = (currentTargetIndex + 1) % allTargets.length;
58
- setCurrentTargetIndex(nextIndex);
59
- if (onTargetChange) {
60
- onTargetChange(allTargets[nextIndex]);
60
+ const nextTarget = allTargets[nextIndex];
61
+ if (nextTarget) {
62
+ setCurrentTargetIndex(nextIndex);
63
+ onTargetChange?.(nextTarget);
61
64
  }
62
65
  };
63
66
 
64
67
  const defaultFormatLabel = (unit: 'days' | 'hours' | 'minutes' | 'seconds') => {
65
- const labels = {
66
- days: 'DAYS',
67
- hours: 'HOURS',
68
- minutes: 'MINUTES',
69
- seconds: 'SECONDS',
68
+ const labels: Record<string, string> = {
69
+ days: '',
70
+ hours: '',
71
+ minutes: '',
72
+ seconds: '',
70
73
  };
71
- return labels[unit];
74
+ return labels[unit] ?? '';
72
75
  };
73
76
 
74
77
  const labelFormatter = formatLabel || defaultFormatLabel;
@@ -112,9 +115,9 @@ export const Countdown: React.FC<CountdownProps> = ({
112
115
 
113
116
  return (
114
117
  <View style={styles.container}>
115
- {showLabel && (
118
+ {showLabel && currentTarget && (
116
119
  <CountdownHeader
117
- title={currentTarget.label || 'Countdown'}
120
+ title={currentTarget.label || ''}
118
121
  icon={currentTarget.icon as IconName}
119
122
  showToggle={showToggle}
120
123
  onToggle={handleToggle}