@umituz/react-native-design-system 4.25.61 → 4.25.62
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 +1 -1
- package/src/atoms/AtomicPicker.tsx +1 -1
- package/src/atoms/AtomicTextArea.tsx +1 -1
- package/src/atoms/button/AtomicButton.tsx +1 -1
- package/src/atoms/card/AtomicCard.tsx +2 -2
- package/src/atoms/datepicker/components/DatePickerModal.tsx +3 -3
- package/src/atoms/input/components/InputIcon.tsx +13 -5
- package/src/atoms/picker/components/PickerChips.tsx +3 -1
- package/src/carousel/useCarouselScroll.ts +5 -3
- package/src/image/presentation/components/ImageGallery.tsx +5 -2
- package/src/molecules/FormField.tsx +2 -2
- package/src/molecules/action-footer/ActionFooter.tsx +5 -0
- package/src/molecules/countdown/components/CountdownHeader.tsx +2 -0
- package/src/molecules/info-grid/InfoGrid.tsx +3 -3
- package/src/molecules/navigation/components/NavigationHeader.tsx +6 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "4.25.
|
|
3
|
+
"version": "4.25.62",
|
|
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=
|
|
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
|
-
) :
|
|
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
|
|
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:
|
|
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>
|
|
@@ -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 !==
|
|
22
|
+
if (newIndex !== currentIndexRef.current) {
|
|
23
|
+
currentIndexRef.current = newIndex;
|
|
22
24
|
setCurrentIndex(newIndex);
|
|
23
25
|
onIndexChange?.(newIndex);
|
|
24
26
|
}
|
|
25
27
|
},
|
|
26
|
-
[itemWidth,
|
|
28
|
+
[itemWidth, onIndexChange],
|
|
27
29
|
);
|
|
28
30
|
|
|
29
31
|
return {
|
|
@@ -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
|
|
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>
|
|
@@ -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]}>
|
|
@@ -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>
|
|
@@ -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]}>
|
|
@@ -50,7 +50,12 @@ export const NavigationHeader: React.FC<NavigationHeaderProps> = ({
|
|
|
50
50
|
return (
|
|
51
51
|
<View style={styles.container}>
|
|
52
52
|
{onBackPress && (
|
|
53
|
-
<TouchableOpacity
|
|
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"
|