@umituz/react-native-design-system 4.25.61 → 4.25.63

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 (28) hide show
  1. package/package.json +1 -1
  2. package/src/atoms/AtomicPicker.tsx +1 -1
  3. package/src/atoms/AtomicTextArea.tsx +1 -1
  4. package/src/atoms/button/AtomicButton.tsx +1 -1
  5. package/src/atoms/card/AtomicCard.tsx +2 -2
  6. package/src/atoms/datepicker/components/DatePickerModal.tsx +3 -3
  7. package/src/atoms/input/components/InputIcon.tsx +13 -5
  8. package/src/atoms/picker/components/PickerChips.tsx +3 -1
  9. package/src/carousel/CarouselDots.tsx +2 -1
  10. package/src/carousel/useCarouselScroll.ts +5 -3
  11. package/src/image/presentation/components/GalleryHeader.tsx +4 -0
  12. package/src/image/presentation/components/ImageGallery.tsx +5 -2
  13. package/src/image/presentation/components/editor/TextEditorSheet.tsx +1 -1
  14. package/src/molecules/FormField.tsx +2 -2
  15. package/src/molecules/SearchBar/SearchHistory.tsx +2 -0
  16. package/src/molecules/action-footer/ActionFooter.tsx +5 -0
  17. package/src/molecules/circular-menu/CircularMenuItem.tsx +2 -2
  18. package/src/molecules/countdown/components/CountdownHeader.tsx +2 -0
  19. package/src/molecules/info-grid/InfoGrid.tsx +3 -3
  20. package/src/molecules/navigation/components/FabButton.tsx +6 -9
  21. package/src/molecules/navigation/components/NavigationHeader.tsx +6 -1
  22. package/src/molecules/swipe-actions/presentation/components/SwipeActionButton.tsx +10 -7
  23. package/src/onboarding/presentation/components/BaseSlide.tsx +1 -0
  24. package/src/onboarding/presentation/components/OnboardingFooter.tsx +3 -0
  25. package/src/onboarding/presentation/components/OnboardingHeader.tsx +7 -1
  26. package/src/onboarding/presentation/components/OnboardingSlide.tsx +2 -2
  27. package/src/onboarding/presentation/components/questions/QuestionOptionItem.tsx +5 -2
  28. package/src/onboarding/presentation/components/questions/RatingQuestion.tsx +10 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umituz/react-native-design-system",
3
- "version": "4.25.61",
3
+ "version": "4.25.63",
4
4
  "description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography, responsive, safe area, exception, infinite scroll, UUID, image, timezone, offline, onboarding, and loading utilities",
5
5
  "main": "./src/index.ts",
6
6
  "types": "./src/index.ts",
@@ -64,7 +64,7 @@ export const AtomicPicker: React.FC<AtomicPickerProps> = ({
64
64
  onPress={() => !disabled && pickerState.openModal()}
65
65
  disabled={disabled}
66
66
  accessibilityRole="button"
67
- accessibilityLabel={label || placeholder}
67
+ accessibilityLabel={label || placeholder || 'Select option'}
68
68
  accessibilityState={{ disabled }}
69
69
  testID={testID}
70
70
  style={StyleSheet.flatten([
@@ -120,7 +120,7 @@ export const AtomicTextArea = forwardRef<React.ElementRef<typeof TextInput>, Ato
120
120
  {maxLength && value !== undefined && (
121
121
  <AtomicText
122
122
  type="labelSmall"
123
- color="secondary"
123
+ color={hasError ? 'error' : 'secondary'}
124
124
  style={styles.characterCount}
125
125
  >
126
126
  {value.length}/{maxLength}
@@ -94,7 +94,7 @@ export const AtomicButton: React.FC<AtomicButtonProps> = React.memo(({
94
94
  color={iconColor as string}
95
95
  style={iconPosition === 'right' ? buttonStyles.iconRight : buttonStyles.iconLeft}
96
96
  />
97
- ) : (showIcon && icon) ? (
97
+ ) : showIcon ? (
98
98
  <AtomicIcon
99
99
  name={icon}
100
100
  customSize={config.iconSize}
@@ -39,7 +39,7 @@ interface CardContentProps {
39
39
  children?: React.ReactNode;
40
40
  }
41
41
 
42
- const CardContent: React.FC<CardContentProps> = ({
42
+ const CardContent: React.FC<CardContentProps> = React.memo(({
43
43
  badge,
44
44
  image,
45
45
  imageAspectRatio,
@@ -137,7 +137,7 @@ const CardContent: React.FC<CardContentProps> = ({
137
137
  </View>
138
138
  </>
139
139
  );
140
- };
140
+ });
141
141
 
142
142
  const AtomicCardComponent: React.FC<AtomicCardProps> = ({
143
143
  children,
@@ -113,7 +113,7 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
113
113
  transparent
114
114
  animationType="none"
115
115
  onRequestClose={onClose}
116
- testID={`${testID}-modal`}
116
+ testID={testID ? `${testID}-modal` : undefined}
117
117
  accessibilityViewIsModal={true}
118
118
  >
119
119
  <View style={modalStyles.overlay}>
@@ -131,7 +131,7 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
131
131
  <TouchableOpacity
132
132
  onPress={onClose}
133
133
  style={modalStyles.doneButton}
134
- testID={`${testID}-done`}
134
+ testID={testID ? `${testID}-done` : undefined}
135
135
  >
136
136
  <AtomicText style={modalStyles.doneButtonText}>{doneButtonText}</AtomicText>
137
137
  </TouchableOpacity>
@@ -146,7 +146,7 @@ export const DatePickerModal: React.FC<DatePickerModalProps> = ({
146
146
  maximumDate={maximumDate}
147
147
  display="spinner"
148
148
  style={{ alignSelf: 'center' }}
149
- testID={`${testID}-picker`}
149
+ testID={testID ? `${testID}-picker` : undefined}
150
150
  />
151
151
  </View>
152
152
  </View>
@@ -23,19 +23,27 @@ export const InputIcon: React.FC<InputIconProps> = ({
23
23
 
24
24
  if (onPress) {
25
25
  return (
26
- <Pressable onPress={onPress} style={style} testID={testID} hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}>
26
+ <Pressable
27
+ onPress={onPress}
28
+ style={style}
29
+ testID={testID}
30
+ hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
31
+ accessibilityRole="button"
32
+ accessibilityLabel={name}
33
+ >
27
34
  <AtomicIcon name={name} customSize={size} customColor={color} />
28
35
  </Pressable>
29
36
  );
30
37
  }
31
38
 
32
39
  return (
33
- <AtomicIcon
34
- name={name}
35
- customSize={size}
36
- customColor={color}
40
+ <AtomicIcon
41
+ name={name}
42
+ customSize={size}
43
+ customColor={color}
37
44
  style={style}
38
45
  testID={testID}
46
+ accessibilityRole="image"
39
47
  />
40
48
  );
41
49
  };
@@ -46,7 +46,9 @@ export const PickerChips: React.FC<PickerChipsProps> = React.memo(({
46
46
  e.stopPropagation();
47
47
  onRemoveChip(opt.value);
48
48
  }}
49
- hitSlop={{ top: 4, bottom: 4, left: 4, right: 4 }}
49
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
50
+ accessibilityRole="button"
51
+ accessibilityLabel={`Remove ${opt.label}`}
50
52
  >
51
53
  <AtomicIcon name={closeIcon} size="sm" color="primary" />
52
54
  </TouchableOpacity>
@@ -3,7 +3,7 @@ import { View, StyleSheet } from "react-native";
3
3
  import { useAppDesignTokens } from "../theme";
4
4
  import type { CarouselDotsProps } from "./types";
5
5
 
6
- export const CarouselDots: React.FC<CarouselDotsProps> = ({
6
+ const CarouselDotsComponent: React.FC<CarouselDotsProps> = ({
7
7
  count,
8
8
  currentIndex,
9
9
  activeColor,
@@ -35,6 +35,7 @@ export const CarouselDots: React.FC<CarouselDotsProps> = ({
35
35
  </View>
36
36
  );
37
37
  };
38
+ export const CarouselDots = React.memo(CarouselDotsComponent);
38
39
 
39
40
  const styles = StyleSheet.create({
40
41
  container: {
@@ -1,4 +1,4 @@
1
- import { useState, useCallback } from "react";
1
+ import { useState, useCallback, useRef } from "react";
2
2
  import { NativeScrollEvent, NativeSyntheticEvent } from "react-native";
3
3
  import { calculateIndexFromScroll } from "./carouselCalculations";
4
4
 
@@ -12,18 +12,20 @@ export const useCarouselScroll = ({
12
12
  onIndexChange,
13
13
  }: UseCarouselScrollOptions) => {
14
14
  const [currentIndex, setCurrentIndex] = useState(0);
15
+ const currentIndexRef = useRef(0);
15
16
 
16
17
  const handleScroll = useCallback(
17
18
  (event: NativeSyntheticEvent<NativeScrollEvent>) => {
18
19
  const scrollPosition = event.nativeEvent.contentOffset.x;
19
20
  const newIndex = calculateIndexFromScroll(scrollPosition, itemWidth);
20
21
 
21
- if (newIndex !== currentIndex) {
22
+ if (newIndex !== currentIndexRef.current) {
23
+ currentIndexRef.current = newIndex;
22
24
  setCurrentIndex(newIndex);
23
25
  onIndexChange?.(newIndex);
24
26
  }
25
27
  },
26
- [itemWidth, currentIndex, onIndexChange],
28
+ [itemWidth, onIndexChange],
27
29
  );
28
30
 
29
31
  return {
@@ -33,6 +33,8 @@ export function GalleryHeader({ onEdit, onClose, title }: GalleryHeaderProps) {
33
33
  style={[styles.actionButton, { backgroundColor: 'rgba(255, 255, 255, 0.15)' }]}
34
34
  onPress={onEdit}
35
35
  activeOpacity={0.7}
36
+ accessibilityRole="button"
37
+ accessibilityLabel="Edit"
36
38
  >
37
39
  <AtomicText style={styles.buttonText}>Edit</AtomicText>
38
40
  </TouchableOpacity>
@@ -55,6 +57,8 @@ export function GalleryHeader({ onEdit, onClose, title }: GalleryHeaderProps) {
55
57
  onPress={onClose}
56
58
  activeOpacity={0.7}
57
59
  hitSlop={{ top: 20, bottom: 20, left: 20, right: 20 }}
60
+ accessibilityRole="button"
61
+ accessibilityLabel="Close gallery"
58
62
  >
59
63
  <AtomicText style={styles.closeIcon}>✕</AtomicText>
60
64
  </TouchableOpacity>
@@ -76,13 +76,14 @@ export const ImageGallery: React.FC<ImageGalleryProps> = ({
76
76
  }, [images, onImageChange]);
77
77
 
78
78
  const handleScroll = useCallback((event: NativeSyntheticEvent<NativeScrollEvent>) => {
79
- const nextIndex = Math.round(event.nativeEvent.contentOffset.x / SCREEN_WIDTH);
79
+ const rawIndex = Math.round(event.nativeEvent.contentOffset.x / SCREEN_WIDTH);
80
+ const nextIndex = Math.max(0, Math.min(rawIndex, images.length - 1));
80
81
  if (nextIndex !== currentIndexRef.current) {
81
82
  currentIndexRef.current = nextIndex;
82
83
  onIndexChange?.(nextIndex);
83
84
  forceRender();
84
85
  }
85
- }, [onIndexChange, SCREEN_WIDTH]);
86
+ }, [onIndexChange, SCREEN_WIDTH, images.length]);
86
87
 
87
88
  const renderItem = useCallback(({ item }: { item: ImageViewerItem }) => (
88
89
  <View style={styles.imageWrapper}>
@@ -92,12 +93,14 @@ export const ImageGallery: React.FC<ImageGalleryProps> = ({
92
93
  style={styles.fullImage}
93
94
  contentFit="contain"
94
95
  cachePolicy="memory-disk"
96
+ onError={() => { if (__DEV__) console.warn('[ImageGallery] Failed to load image:', item.uri); }}
95
97
  />
96
98
  ) : (
97
99
  <RNImage
98
100
  source={{ uri: item.uri }}
99
101
  style={styles.fullImage}
100
102
  resizeMode="contain"
103
+ onError={() => { if (__DEV__) console.warn('[ImageGallery] Failed to load image:', item.uri); }}
101
104
  />
102
105
  )}
103
106
  </View>
@@ -68,7 +68,7 @@ export const TextEditorSheet = forwardRef<BottomSheetModalRef, TextEditorSheetPr
68
68
  ))}
69
69
  </View>
70
70
 
71
- <ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={{ paddingBottom: 60 }}>
71
+ <ScrollView showsVerticalScrollIndicator={false} contentContainerStyle={{ paddingBottom: 60 }} keyboardShouldPersistTaps="handled">
72
72
  {activeTab === 'content' && <TextContentTab text={props.text} onTextChange={props.onTextChange} t={t} />}
73
73
  {activeTab === 'style' && (
74
74
  <TextStyleTab
@@ -7,7 +7,7 @@
7
7
  * Composition: AtomicText + AtomicInput
8
8
  */
9
9
 
10
- import React from 'react';
10
+ import React, { useMemo } from 'react';
11
11
  import { View, ViewStyle } from 'react-native';
12
12
  import { useAppDesignTokens } from '../theme';
13
13
  import { AtomicText, AtomicInput, type AtomicInputProps } from '../atoms';
@@ -96,7 +96,7 @@ export const FormField: React.FC<FormFieldProps> = ({
96
96
  }) => {
97
97
  const tokens = useAppDesignTokens();
98
98
  const inputState = error ? 'error' : 'default';
99
- const styles = getStyles(tokens);
99
+ const styles = useMemo(() => getStyles(tokens), [tokens]);
100
100
 
101
101
  return (
102
102
  <View style={[styles.container, containerStyle || style]}>
@@ -80,6 +80,8 @@ export const SearchHistory: React.FC<SearchHistoryProps> = ({
80
80
  onPress={() => onRemoveItem(item.id)}
81
81
  style={styles.removeButton}
82
82
  hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
83
+ accessibilityRole="button"
84
+ accessibilityLabel={`Remove ${item.query} from history`}
83
85
  >
84
86
  <AtomicIcon
85
87
  name={closeIcon}
@@ -67,6 +67,8 @@ export const ActionFooter: React.FC<ActionFooterProps> = ({
67
67
  onPress={onBack}
68
68
  activeOpacity={0.7}
69
69
  testID="action-footer-back"
70
+ accessibilityRole="button"
71
+ accessibilityLabel="Go back"
70
72
  >
71
73
  <AtomicIcon
72
74
  name={backIcon}
@@ -81,6 +83,9 @@ export const ActionFooter: React.FC<ActionFooterProps> = ({
81
83
  activeOpacity={0.9}
82
84
  disabled={loading}
83
85
  testID="action-footer-action"
86
+ accessibilityRole="button"
87
+ accessibilityLabel={actionLabel}
88
+ accessibilityState={{ disabled: loading, busy: loading }}
84
89
  >
85
90
  <View style={themedStyles.actionContent}>
86
91
  <AtomicText style={themedStyles.actionText}>{actionLabel}</AtomicText>
@@ -11,7 +11,7 @@ export interface CircularMenuItemProps {
11
11
  onPress: () => void;
12
12
  }
13
13
 
14
- export const CircularMenuItem: React.FC<CircularMenuItemProps> = ({
14
+ export const CircularMenuItem: React.FC<CircularMenuItemProps> = React.memo(({
15
15
  icon,
16
16
  label,
17
17
  onPress,
@@ -49,7 +49,7 @@ export const CircularMenuItem: React.FC<CircularMenuItemProps> = ({
49
49
  </AtomicText>
50
50
  </TouchableOpacity>
51
51
  );
52
- };
52
+ });
53
53
 
54
54
  const styles = StyleSheet.create({
55
55
  container: {
@@ -53,6 +53,8 @@ export const CountdownHeader: React.FC<CountdownHeaderProps> = ({
53
53
  },
54
54
  ]}
55
55
  onPress={onToggle}
56
+ accessibilityRole="button"
57
+ accessibilityLabel="Toggle view"
56
58
  >
57
59
  <AtomicIcon
58
60
  name={swapIcon}
@@ -1,5 +1,5 @@
1
1
 
2
- import React from 'react';
2
+ import React, { useMemo } from 'react';
3
3
  import { View, StyleSheet } from 'react-native';
4
4
  import { AtomicText } from '../../atoms/AtomicText';
5
5
  import { AtomicIcon } from '../../atoms';
@@ -16,7 +16,7 @@ export const InfoGrid: React.FC<InfoGridProps> = ({
16
16
  }) => {
17
17
  const tokens = useAppDesignTokens();
18
18
 
19
- const styles = StyleSheet.create({
19
+ const styles = useMemo(() => StyleSheet.create({
20
20
  container: {
21
21
  gap: tokens.spacing.md,
22
22
  },
@@ -68,7 +68,7 @@ export const InfoGrid: React.FC<InfoGridProps> = ({
68
68
  color: tokens.colors.textPrimary,
69
69
  fontWeight: '500',
70
70
  },
71
- });
71
+ }), [tokens, columns]);
72
72
 
73
73
  return (
74
74
  <View style={[styles.container, style]}>
@@ -1,4 +1,4 @@
1
- import React from 'react';
1
+ import React, { useMemo } from 'react';
2
2
  import { StyleSheet, View, type ViewStyle } from 'react-native';
3
3
  import { useAppDesignTokens } from '../../../theme';
4
4
 
@@ -18,16 +18,13 @@ export const FabButton: React.FC<FabButtonProps> = ({
18
18
  style,
19
19
  }) => {
20
20
  const tokens = useAppDesignTokens();
21
+ const themedStyle = useMemo(() => ({
22
+ backgroundColor: tokens.colors.primary,
23
+ borderColor: tokens.colors.onPrimary,
24
+ }), [tokens.colors.primary, tokens.colors.onPrimary]);
21
25
 
22
26
  return (
23
- <View style={[
24
- styles.container,
25
- {
26
- backgroundColor: tokens.colors.primary,
27
- borderColor: tokens.colors.onPrimary,
28
- },
29
- style
30
- ]}>
27
+ <View style={[styles.container, themedStyle, style]}>
31
28
  {children}
32
29
  </View>
33
30
  );
@@ -50,7 +50,12 @@ export const NavigationHeader: React.FC<NavigationHeaderProps> = ({
50
50
  return (
51
51
  <View style={styles.container}>
52
52
  {onBackPress && (
53
- <TouchableOpacity onPress={onBackPress} style={styles.backButton}>
53
+ <TouchableOpacity
54
+ onPress={onBackPress}
55
+ style={styles.backButton}
56
+ accessibilityRole="button"
57
+ accessibilityLabel="Go back"
58
+ >
54
59
  <AtomicIcon
55
60
  name={arrowLeftIcon}
56
61
  size="md"
@@ -86,14 +86,15 @@ export const SwipeActionButton: React.FC<SwipeActionButtonProps> = ({
86
86
  const backgroundColor = getBackgroundColor();
87
87
 
88
88
  const handlePress = async () => {
89
- // Trigger haptic feedback
90
- if (enableHaptics) {
91
- const intensity = getHapticsIntensity(action);
92
- await HapticService.impact(intensity);
89
+ try {
90
+ if (enableHaptics) {
91
+ const intensity = getHapticsIntensity(action);
92
+ await HapticService.impact(intensity);
93
+ }
94
+ await action.onPress();
95
+ } catch (error) {
96
+ if (__DEV__) console.warn('[SwipeActionButton] Action failed:', error);
93
97
  }
94
-
95
- // Execute action
96
- await action.onPress();
97
98
  };
98
99
 
99
100
  return (
@@ -111,6 +112,8 @@ export const SwipeActionButton: React.FC<SwipeActionButtonProps> = ({
111
112
  ]}
112
113
  onPress={handlePress}
113
114
  activeOpacity={0.7}
115
+ accessibilityRole="button"
116
+ accessibilityLabel={label}
114
117
  >
115
118
  <View style={styles.content}>
116
119
  <AtomicIcon
@@ -39,6 +39,7 @@ export const BaseSlide = ({
39
39
  contentContainerStyle={contentContainerStyle}
40
40
  showsVerticalScrollIndicator={false}
41
41
  bounces={false}
42
+ keyboardShouldPersistTaps="handled"
42
43
  >
43
44
  <View style={slideContainerStyle}>{children}</View>
44
45
  </ScrollView>
@@ -66,6 +66,9 @@ export const OnboardingFooter = ({
66
66
  onPress={onNext}
67
67
  disabled={disabled}
68
68
  activeOpacity={0.7}
69
+ accessibilityRole="button"
70
+ accessibilityLabel={buttonText}
71
+ accessibilityState={{ disabled }}
69
72
  style={[
70
73
  styles.button,
71
74
  {
@@ -49,7 +49,13 @@ export const OnboardingHeader = ({
49
49
  <View style={styles.headerButton} />
50
50
  )}
51
51
  {showSkipButton && skipButtonText ? (
52
- <TouchableOpacity onPress={onSkip} activeOpacity={0.7}>
52
+ <TouchableOpacity
53
+ onPress={onSkip}
54
+ activeOpacity={0.7}
55
+ accessibilityRole="button"
56
+ accessibilityLabel={skipButtonText}
57
+ hitSlop={{ top: 10, bottom: 10, left: 10, right: 10 }}
58
+ >
53
59
  <AtomicText
54
60
  type="labelLarge"
55
61
  style={[styles.skipText, { color: colors.textColor }]}
@@ -16,7 +16,7 @@ export interface OnboardingSlideProps {
16
16
  variant?: "default" | "card" | "minimal" | "fullscreen";
17
17
  }
18
18
 
19
- export const OnboardingSlide = ({
19
+ export const OnboardingSlide = React.memo(({
20
20
  slide,
21
21
  variant = "default",
22
22
  }: OnboardingSlideProps) => {
@@ -89,7 +89,7 @@ export const OnboardingSlide = ({
89
89
  )}
90
90
  </BaseSlide>
91
91
  );
92
- };
92
+ });
93
93
 
94
94
  const styles = StyleSheet.create({
95
95
  iconBox: {
@@ -16,7 +16,7 @@ export interface QuestionOptionItemProps {
16
16
  colors: OnboardingColors;
17
17
  }
18
18
 
19
- export const QuestionOptionItem = ({
19
+ export const QuestionOptionItem = React.memo(({
20
20
  option,
21
21
  isSelected,
22
22
  onPress,
@@ -36,6 +36,9 @@ export const QuestionOptionItem = ({
36
36
  ]}
37
37
  onPress={onPress}
38
38
  activeOpacity={0.8}
39
+ accessibilityRole="button"
40
+ accessibilityLabel={option.label}
41
+ accessibilityState={{ selected: isSelected }}
39
42
  >
40
43
  {option.icon && (
41
44
  <View style={[
@@ -83,7 +86,7 @@ export const QuestionOptionItem = ({
83
86
  </View>
84
87
  </TouchableOpacity>
85
88
  );
86
- };
89
+ });
87
90
 
88
91
  const styles = StyleSheet.create({
89
92
  option: {
@@ -26,7 +26,16 @@ export const RatingQuestion = ({
26
26
  {Array.from({ length: max }).map((_, i) => {
27
27
  const isFilled = i < value;
28
28
  return (
29
- <TouchableOpacity key={i} onPress={() => onChange(i + 1)} activeOpacity={0.8} style={styles.star}>
29
+ <TouchableOpacity
30
+ key={i}
31
+ onPress={() => onChange(i + 1)}
32
+ activeOpacity={0.8}
33
+ style={styles.star}
34
+ hitSlop={{ top: 8, bottom: 8, left: 8, right: 8 }}
35
+ accessibilityRole="button"
36
+ accessibilityLabel={`Rate ${i + 1} out of ${max}`}
37
+ accessibilityState={{ selected: isFilled }}
38
+ >
30
39
  <AtomicIcon
31
40
  name={isFilled ? "star" : "star-outline"}
32
41
  customSize={48}