@umituz/react-native-design-system 2.0.0 → 2.0.1
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/AtomicCard.tsx +84 -0
- package/src/atoms/index.ts +30 -30
- package/src/index.ts +4 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@umituz/react-native-design-system",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.1",
|
|
4
4
|
"description": "Universal design system for React Native apps - Consolidated package with atoms, molecules, organisms, theme, typography and responsive utilities",
|
|
5
5
|
"main": "./src/index.ts",
|
|
6
6
|
"types": "./src/index.ts",
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AtomicCard Component
|
|
3
|
+
*
|
|
4
|
+
* A simple, styled card container component
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import React from 'react';
|
|
8
|
+
import { View, StyleSheet, type ViewStyle, type StyleProp } from 'react-native';
|
|
9
|
+
import { useAppDesignTokens } from '../theme';
|
|
10
|
+
|
|
11
|
+
export type AtomicCardVariant = 'elevated' | 'outlined' | 'filled';
|
|
12
|
+
export type AtomicCardPadding = 'none' | 'sm' | 'md' | 'lg';
|
|
13
|
+
|
|
14
|
+
export interface AtomicCardProps {
|
|
15
|
+
children: React.ReactNode;
|
|
16
|
+
variant?: AtomicCardVariant;
|
|
17
|
+
padding?: AtomicCardPadding;
|
|
18
|
+
style?: StyleProp<ViewStyle>;
|
|
19
|
+
testID?: string;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const AtomicCard: React.FC<AtomicCardProps> = ({
|
|
23
|
+
children,
|
|
24
|
+
variant = 'elevated',
|
|
25
|
+
padding = 'md',
|
|
26
|
+
style,
|
|
27
|
+
testID,
|
|
28
|
+
}) => {
|
|
29
|
+
const tokens = useAppDesignTokens();
|
|
30
|
+
|
|
31
|
+
const paddingValues: Record<AtomicCardPadding, number> = {
|
|
32
|
+
none: 0,
|
|
33
|
+
sm: tokens.spacing.sm,
|
|
34
|
+
md: tokens.spacing.md,
|
|
35
|
+
lg: tokens.spacing.lg,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
const getVariantStyle = (): ViewStyle => {
|
|
39
|
+
switch (variant) {
|
|
40
|
+
case 'elevated':
|
|
41
|
+
return {
|
|
42
|
+
backgroundColor: tokens.colors.surface,
|
|
43
|
+
shadowColor: '#000',
|
|
44
|
+
shadowOffset: { width: 0, height: 2 },
|
|
45
|
+
shadowOpacity: 0.1,
|
|
46
|
+
shadowRadius: 4,
|
|
47
|
+
elevation: 2,
|
|
48
|
+
};
|
|
49
|
+
case 'outlined':
|
|
50
|
+
return {
|
|
51
|
+
backgroundColor: tokens.colors.surface,
|
|
52
|
+
borderWidth: 1,
|
|
53
|
+
borderColor: tokens.colors.outline,
|
|
54
|
+
};
|
|
55
|
+
case 'filled':
|
|
56
|
+
return {
|
|
57
|
+
backgroundColor: tokens.colors.surfaceVariant,
|
|
58
|
+
};
|
|
59
|
+
default:
|
|
60
|
+
return {};
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
return (
|
|
65
|
+
<View
|
|
66
|
+
style={[
|
|
67
|
+
styles.card,
|
|
68
|
+
{ borderRadius: tokens.borders.radius.md },
|
|
69
|
+
{ padding: paddingValues[padding] },
|
|
70
|
+
getVariantStyle(),
|
|
71
|
+
style,
|
|
72
|
+
]}
|
|
73
|
+
testID={testID}
|
|
74
|
+
>
|
|
75
|
+
{children}
|
|
76
|
+
</View>
|
|
77
|
+
);
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
const styles = StyleSheet.create({
|
|
81
|
+
card: {
|
|
82
|
+
overflow: 'hidden',
|
|
83
|
+
},
|
|
84
|
+
});
|
package/src/atoms/index.ts
CHANGED
|
@@ -5,39 +5,39 @@
|
|
|
5
5
|
|
|
6
6
|
// Button
|
|
7
7
|
export {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
AtomicButton,
|
|
9
|
+
type AtomicButtonProps,
|
|
10
|
+
type ButtonVariant,
|
|
11
|
+
type ButtonSize,
|
|
12
12
|
} from './AtomicButton';
|
|
13
13
|
|
|
14
14
|
// Text
|
|
15
15
|
export { AtomicText, type AtomicTextProps } from './AtomicText';
|
|
16
16
|
|
|
17
|
-
// Card
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
17
|
+
// Card
|
|
18
|
+
export {
|
|
19
|
+
AtomicCard,
|
|
20
|
+
type AtomicCardProps,
|
|
21
|
+
type AtomicCardVariant,
|
|
22
|
+
type AtomicCardPadding,
|
|
23
|
+
} from './AtomicCard';
|
|
24
24
|
|
|
25
25
|
// Input
|
|
26
26
|
export {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
AtomicInput,
|
|
28
|
+
type AtomicInputProps,
|
|
29
|
+
type AtomicInputVariant,
|
|
30
|
+
type AtomicInputState,
|
|
31
|
+
type AtomicInputSize,
|
|
32
32
|
} from './AtomicInput';
|
|
33
33
|
|
|
34
34
|
// Icon
|
|
35
35
|
export {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
36
|
+
AtomicIcon,
|
|
37
|
+
type AtomicIconProps,
|
|
38
|
+
type IconSize,
|
|
39
|
+
type IconColor,
|
|
40
|
+
type IconName,
|
|
41
41
|
} from './AtomicIcon';
|
|
42
42
|
|
|
43
43
|
// Avatar
|
|
@@ -51,19 +51,19 @@ export { AtomicProgress, type AtomicProgressProps } from './AtomicProgress';
|
|
|
51
51
|
|
|
52
52
|
// Fab
|
|
53
53
|
export {
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
54
|
+
AtomicFab,
|
|
55
|
+
type AtomicFabProps,
|
|
56
|
+
type FabSize,
|
|
57
|
+
type FabVariant,
|
|
58
|
+
getFabVariants,
|
|
59
59
|
} from './AtomicFab';
|
|
60
60
|
|
|
61
61
|
// Picker
|
|
62
62
|
export {
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
63
|
+
AtomicPicker,
|
|
64
|
+
type AtomicPickerProps,
|
|
65
|
+
type PickerOption,
|
|
66
|
+
type PickerSize,
|
|
67
67
|
} from './AtomicPicker';
|
|
68
68
|
|
|
69
69
|
// DatePicker
|
package/src/index.ts
CHANGED
|
@@ -116,6 +116,7 @@ export {
|
|
|
116
116
|
AtomicIcon,
|
|
117
117
|
AtomicButton,
|
|
118
118
|
AtomicInput,
|
|
119
|
+
AtomicCard,
|
|
119
120
|
AtomicFab,
|
|
120
121
|
AtomicAvatar,
|
|
121
122
|
AtomicChip,
|
|
@@ -134,6 +135,9 @@ export {
|
|
|
134
135
|
type AtomicInputVariant,
|
|
135
136
|
type AtomicInputState,
|
|
136
137
|
type AtomicInputSize,
|
|
138
|
+
type AtomicCardProps,
|
|
139
|
+
type AtomicCardVariant,
|
|
140
|
+
type AtomicCardPadding,
|
|
137
141
|
type AtomicFabProps,
|
|
138
142
|
type FabSize,
|
|
139
143
|
type FabVariant,
|