@umituz/react-native-design-system 2.5.16 → 2.5.18
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.5.
|
|
3
|
+
"version": "2.5.18",
|
|
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",
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { StyleSheet, StyleProp, ViewStyle, TextStyle, TouchableOpacity, View } from 'react-native';
|
|
2
|
+
import { StyleSheet, StyleProp, ViewStyle, TextStyle, TouchableOpacity, View, ActivityIndicator } from 'react-native';
|
|
3
3
|
import { AtomicText } from './AtomicText';
|
|
4
4
|
import { AtomicIcon } from './AtomicIcon';
|
|
5
5
|
import { useAppDesignTokens } from '../theme';
|
|
@@ -15,6 +15,7 @@ export interface AtomicButtonProps {
|
|
|
15
15
|
variant?: ButtonVariant;
|
|
16
16
|
size?: ButtonSize;
|
|
17
17
|
disabled?: boolean;
|
|
18
|
+
loading?: boolean;
|
|
18
19
|
icon?: IconName;
|
|
19
20
|
fullWidth?: boolean;
|
|
20
21
|
style?: StyleProp<ViewStyle>;
|
|
@@ -30,6 +31,7 @@ export const AtomicButton: React.FC<AtomicButtonProps> = React.memo(({
|
|
|
30
31
|
variant = 'primary',
|
|
31
32
|
size = 'md',
|
|
32
33
|
disabled = false,
|
|
34
|
+
loading = false,
|
|
33
35
|
icon,
|
|
34
36
|
fullWidth = false,
|
|
35
37
|
style,
|
|
@@ -40,11 +42,13 @@ export const AtomicButton: React.FC<AtomicButtonProps> = React.memo(({
|
|
|
40
42
|
const tokens = useAppDesignTokens();
|
|
41
43
|
|
|
42
44
|
const handlePress = () => {
|
|
43
|
-
if (!disabled) {
|
|
45
|
+
if (!disabled && !loading) {
|
|
44
46
|
onPress();
|
|
45
47
|
}
|
|
46
48
|
};
|
|
47
49
|
|
|
50
|
+
const isDisabled = disabled || loading;
|
|
51
|
+
|
|
48
52
|
// Size configurations
|
|
49
53
|
const sizeConfig = {
|
|
50
54
|
sm: {
|
|
@@ -166,7 +170,7 @@ export const AtomicButton: React.FC<AtomicButtonProps> = React.memo(({
|
|
|
166
170
|
},
|
|
167
171
|
variantStyles.container,
|
|
168
172
|
fullWidth ? styles.fullWidth : undefined,
|
|
169
|
-
|
|
173
|
+
isDisabled ? styles.disabled : undefined,
|
|
170
174
|
style,
|
|
171
175
|
];
|
|
172
176
|
|
|
@@ -176,7 +180,7 @@ export const AtomicButton: React.FC<AtomicButtonProps> = React.memo(({
|
|
|
176
180
|
fontWeight: '600',
|
|
177
181
|
},
|
|
178
182
|
variantStyles.text,
|
|
179
|
-
|
|
183
|
+
isDisabled ? styles.disabledText : undefined,
|
|
180
184
|
textStyle,
|
|
181
185
|
];
|
|
182
186
|
|
|
@@ -189,11 +193,17 @@ export const AtomicButton: React.FC<AtomicButtonProps> = React.memo(({
|
|
|
189
193
|
style={containerStyle}
|
|
190
194
|
onPress={handlePress}
|
|
191
195
|
activeOpacity={activeOpacity}
|
|
192
|
-
disabled={
|
|
196
|
+
disabled={isDisabled}
|
|
193
197
|
testID={testID}
|
|
194
198
|
>
|
|
195
199
|
<View style={styles.content}>
|
|
196
|
-
{
|
|
200
|
+
{loading ? (
|
|
201
|
+
<ActivityIndicator
|
|
202
|
+
size="small"
|
|
203
|
+
color={iconColor as string}
|
|
204
|
+
style={styles.icon}
|
|
205
|
+
/>
|
|
206
|
+
) : showIcon ? (
|
|
197
207
|
<AtomicIcon
|
|
198
208
|
name={icon}
|
|
199
209
|
customSize={config.iconSize}
|
package/src/atoms/AtomicText.tsx
CHANGED
|
@@ -4,21 +4,24 @@ import { useAppDesignTokens } from '../theme';
|
|
|
4
4
|
import { getTextColor, type TextStyleVariant, type ColorVariant } from '../typography';
|
|
5
5
|
|
|
6
6
|
export interface AtomicTextProps extends TextProps {
|
|
7
|
+
/** Typographic style variant from tokens (alias for 'type') */
|
|
8
|
+
variant?: TextStyleVariant;
|
|
9
|
+
|
|
7
10
|
/** Typographic style variant from tokens */
|
|
8
11
|
type?: TextStyleVariant;
|
|
9
|
-
|
|
12
|
+
|
|
10
13
|
/** Color variant from tokens or custom hex color */
|
|
11
14
|
color?: ColorVariant | string;
|
|
12
|
-
|
|
15
|
+
|
|
13
16
|
/** Text alignment */
|
|
14
17
|
align?: TextStyle['textAlign'];
|
|
15
|
-
|
|
18
|
+
|
|
16
19
|
/** Content to render */
|
|
17
20
|
children: React.ReactNode;
|
|
18
|
-
|
|
21
|
+
|
|
19
22
|
/** Custom text style */
|
|
20
23
|
style?: StyleProp<TextStyle>;
|
|
21
|
-
|
|
24
|
+
|
|
22
25
|
/** Test ID for automation */
|
|
23
26
|
testID?: string;
|
|
24
27
|
}
|
|
@@ -31,6 +34,7 @@ export interface AtomicTextProps extends TextProps {
|
|
|
31
34
|
* ✅ SOLID, DRY, KISS
|
|
32
35
|
*/
|
|
33
36
|
export const AtomicText = ({
|
|
37
|
+
variant,
|
|
34
38
|
type = 'bodyMedium',
|
|
35
39
|
color = 'textPrimary',
|
|
36
40
|
align,
|
|
@@ -41,8 +45,11 @@ export const AtomicText = ({
|
|
|
41
45
|
}: AtomicTextProps) => {
|
|
42
46
|
const tokens = useAppDesignTokens();
|
|
43
47
|
|
|
48
|
+
// Support both 'variant' and 'type' props for backward compatibility
|
|
49
|
+
const textType = variant || type;
|
|
50
|
+
|
|
44
51
|
// Get typography style from tokens
|
|
45
|
-
const typographyStyle = (tokens.typography as Record<string, any>)[
|
|
52
|
+
const typographyStyle = (tokens.typography as Record<string, any>)[textType];
|
|
46
53
|
|
|
47
54
|
// Use responsive font size if available
|
|
48
55
|
const fontSize = typographyStyle?.responsiveFontSize || typographyStyle?.fontSize;
|
|
@@ -19,6 +19,7 @@ export interface AtomicTextAreaProps {
|
|
|
19
19
|
errorText?: string;
|
|
20
20
|
maxLength?: number;
|
|
21
21
|
numberOfLines?: number;
|
|
22
|
+
rows?: number;
|
|
22
23
|
disabled?: boolean;
|
|
23
24
|
style?: ViewStyle;
|
|
24
25
|
testID?: string;
|
|
@@ -32,11 +33,13 @@ export const AtomicTextArea: React.FC<AtomicTextAreaProps> = ({
|
|
|
32
33
|
helperText,
|
|
33
34
|
errorText,
|
|
34
35
|
maxLength,
|
|
35
|
-
numberOfLines
|
|
36
|
+
numberOfLines,
|
|
37
|
+
rows = 4,
|
|
36
38
|
disabled = false,
|
|
37
39
|
style,
|
|
38
40
|
testID,
|
|
39
41
|
}) => {
|
|
42
|
+
const lineCount = numberOfLines ?? rows;
|
|
40
43
|
const tokens = useAppDesignTokens();
|
|
41
44
|
const hasError = !!errorText;
|
|
42
45
|
|
|
@@ -56,7 +59,7 @@ export const AtomicTextArea: React.FC<AtomicTextAreaProps> = ({
|
|
|
56
59
|
placeholder={placeholder}
|
|
57
60
|
placeholderTextColor={tokens.colors.textTertiary}
|
|
58
61
|
maxLength={maxLength}
|
|
59
|
-
numberOfLines={
|
|
62
|
+
numberOfLines={lineCount}
|
|
60
63
|
multiline
|
|
61
64
|
editable={!disabled}
|
|
62
65
|
textAlignVertical="top"
|
|
@@ -66,7 +69,7 @@ export const AtomicTextArea: React.FC<AtomicTextAreaProps> = ({
|
|
|
66
69
|
backgroundColor: tokens.colors.surface,
|
|
67
70
|
borderColor: hasError ? tokens.colors.error : tokens.colors.border,
|
|
68
71
|
color: tokens.colors.textPrimary,
|
|
69
|
-
minHeight:
|
|
72
|
+
minHeight: lineCount * 24,
|
|
70
73
|
},
|
|
71
74
|
disabled && { opacity: 0.5 },
|
|
72
75
|
]}
|
|
@@ -30,8 +30,8 @@ export interface AtomicPickerProps {
|
|
|
30
30
|
onChange: (value: string | string[]) => void;
|
|
31
31
|
options: PickerOption[];
|
|
32
32
|
label?: string;
|
|
33
|
-
/** Placeholder text -
|
|
34
|
-
placeholder
|
|
33
|
+
/** Placeholder text - pass translated string for i18n */
|
|
34
|
+
placeholder?: string;
|
|
35
35
|
error?: string;
|
|
36
36
|
disabled?: boolean;
|
|
37
37
|
multiple?: boolean;
|
|
@@ -41,14 +41,14 @@ export interface AtomicPickerProps {
|
|
|
41
41
|
color?: IconColor;
|
|
42
42
|
size?: PickerSize;
|
|
43
43
|
modalTitle?: string;
|
|
44
|
-
/** Empty state message -
|
|
45
|
-
emptyMessage
|
|
46
|
-
/** Search placeholder text -
|
|
47
|
-
searchPlaceholder
|
|
48
|
-
/** Clear button accessibility label -
|
|
49
|
-
clearAccessibilityLabel
|
|
50
|
-
/** Close button accessibility label -
|
|
51
|
-
closeAccessibilityLabel
|
|
44
|
+
/** Empty state message - pass translated string for i18n */
|
|
45
|
+
emptyMessage?: string;
|
|
46
|
+
/** Search placeholder text - pass translated string for i18n */
|
|
47
|
+
searchPlaceholder?: string;
|
|
48
|
+
/** Clear button accessibility label - pass translated string for i18n */
|
|
49
|
+
clearAccessibilityLabel?: string;
|
|
50
|
+
/** Close button accessibility label - pass translated string for i18n */
|
|
51
|
+
closeAccessibilityLabel?: string;
|
|
52
52
|
style?: ViewStyle | ViewStyle[];
|
|
53
53
|
labelStyle?: TextStyle | TextStyle[];
|
|
54
54
|
testID?: string;
|