@tcbs/react-native-mazic-ui 0.1.7 → 0.1.8

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
@@ -13,7 +13,7 @@
13
13
  "react-native-vector-icons"
14
14
  ],
15
15
  "author": "TechCraft By Subrata <subraatakumar@gmail.com>",
16
- "version": "0.1.7",
16
+ "version": "0.1.8",
17
17
  "publishConfig": {
18
18
  "access": "public"
19
19
  },
@@ -0,0 +1,166 @@
1
+ import React from 'react';
2
+ import { View, Text, StyleSheet, ViewStyle, TextStyle, Pressable, GestureResponderEvent } from 'react-native';
3
+ import Ionicons from 'react-native-vector-icons/Ionicons';
4
+ import { useTcbsColorStore } from '../store/themeStore';
5
+ import CustomText from './CustomText';
6
+
7
+ type CardVariant = 'default' | 'outlined';
8
+
9
+ interface CustomCardProps {
10
+ title: string;
11
+ description?: string;
12
+ variant?: CardVariant;
13
+ style?: ViewStyle;
14
+ textStyle?: TextStyle;
15
+ secureText?: string | null;
16
+ secureStrapColor?: string;
17
+ accessibilityLabel?: string;
18
+ accessibilityRole?: 'button' | 'link' | 'header' | 'image' | 'text' | 'adjustable' | 'search' | 'summary' | 'keyboardkey' | 'none';
19
+ accessible?: boolean;
20
+ onPress?: (event: GestureResponderEvent) => void;
21
+ trailingIcon?: string;
22
+ }
23
+
24
+ const CustomCard: React.FC<CustomCardProps> = ({
25
+ title,
26
+ description,
27
+ variant = 'default',
28
+ style,
29
+ textStyle,
30
+ onPress,
31
+ secureText = null,
32
+ secureStrapColor = null,
33
+ accessibilityLabel,
34
+ accessibilityRole,
35
+ accessible,
36
+ trailingIcon = 'chevron-forward',
37
+ }) => {
38
+ const { themeColors: theme } = useTcbsColorStore();
39
+
40
+ const getCardStyle = (): ViewStyle => {
41
+ return variant === 'outlined'
42
+ ? {
43
+ backgroundColor: theme.cardBgColor,
44
+ borderColor: theme.cardBorderColor,
45
+ borderWidth: 1,
46
+ }
47
+ : { backgroundColor: theme.cardBgColor };
48
+ };
49
+
50
+ const Container: any = onPress ? Pressable : View;
51
+
52
+ return (
53
+ <View style={{ width: '100%', marginBottom: 12 }}>
54
+ <View style={{ overflow: 'hidden' }}>
55
+ {secureText && (
56
+ <View style={{ position: 'absolute', zIndex: 3, left: -26, opacity: 1, top: 5, transform: [{ rotate: '-50deg' }] }}>
57
+ <View style={{ backgroundColor: secureStrapColor || theme.successColor, paddingHorizontal: 20, paddingVertical: 6, borderRadius: 4, elevation: 2 }}>
58
+ <CustomText variant="caption" style={{ color: theme.card, fontWeight: '600' }}>
59
+ {secureText}
60
+ </CustomText>
61
+ </View>
62
+ </View>)}
63
+ <Container
64
+ onPress={onPress}
65
+ accessibilityLabel={accessibilityLabel}
66
+ accessibilityRole={accessibilityRole}
67
+ accessible={accessible}
68
+ android_ripple={{ color: theme.warningColor + '22' }}
69
+ style={({ pressed }: { pressed: boolean }) => [
70
+ styles.card,
71
+ getCardStyle(),
72
+ style,
73
+ pressed && { opacity: 0.85 },
74
+ ]}>
75
+ {/* Decorative accents */}
76
+ <View
77
+ style={[
78
+ styles.accentTopRight,
79
+ { backgroundColor: theme.warningColor },
80
+ ]}
81
+ pointerEvents="none"
82
+ />
83
+ <View
84
+ style={[
85
+ styles.accentBottomLeft,
86
+ { backgroundColor: theme.warningColor },
87
+ ]}
88
+ pointerEvents="none"
89
+ />
90
+
91
+ <View style={styles.content}>
92
+ <View style={{ flex: 1 }}>
93
+ <Text style={[styles.title, { color: theme.textPrimary }, textStyle]}>
94
+ {title}
95
+ </Text>
96
+ {description && (
97
+ <Text style={[styles.description, { color: theme.textSecondary }]}>
98
+ {description}
99
+ </Text>
100
+ )}
101
+ </View>
102
+
103
+ {onPress && (
104
+ <Ionicons
105
+ name={trailingIcon}
106
+ size={20}
107
+ color={theme.textPrimary}
108
+ style={styles.icon}
109
+ />
110
+ )}
111
+ </View>
112
+ </Container>
113
+ </View>
114
+ </View>
115
+ );
116
+ };
117
+
118
+ const styles = StyleSheet.create({
119
+ card: {
120
+ padding: 16,
121
+ borderRadius: 10,
122
+ shadowColor: '#000',
123
+ shadowOpacity: 0.1,
124
+ shadowRadius: 4,
125
+ elevation: 3,
126
+ },
127
+ title: {
128
+ fontSize: 18,
129
+ fontWeight: 'bold',
130
+ marginBottom: 8,
131
+ textAlign: 'center',
132
+ },
133
+ description: {
134
+ fontSize: 14,
135
+ },
136
+ content: {
137
+ flexDirection: 'row',
138
+ alignItems: 'center',
139
+ },
140
+ icon: {
141
+ marginLeft: 12,
142
+ },
143
+ accentTopRight: {
144
+ position: 'absolute',
145
+ width: 88,
146
+ height: 88,
147
+ borderRadius: 44,
148
+ right: -24,
149
+ top: -24,
150
+ opacity: 0.12,
151
+ transform: [{ rotate: '20deg' }],
152
+ },
153
+ accentBottomLeft: {
154
+ position: 'absolute',
155
+ width: 140,
156
+ height: 70,
157
+ borderTopLeftRadius: 80,
158
+ borderTopRightRadius: 80,
159
+ left: -40,
160
+ bottom: -20,
161
+ opacity: 0.08,
162
+ transform: [{ rotate: '-10deg' }],
163
+ },
164
+ });
165
+
166
+ export default CustomCard;
@@ -0,0 +1,49 @@
1
+ import React from 'react';
2
+ import {Text, StyleSheet, TextStyle} from 'react-native';
3
+ import { useTcbsColorStore } from '../store/themeStore';
4
+
5
+ type TextVariant = 'title' | 'subtitle' | 'body' | 'caption' | 'button';
6
+
7
+ interface CustomTextProps {
8
+ children: React.ReactNode;
9
+ variant?: TextVariant;
10
+ style?: TextStyle;
11
+ }
12
+
13
+ const CustomText: React.FC<CustomTextProps> = ({
14
+ children,
15
+ variant = 'body',
16
+ style,
17
+ }) => {
18
+ const { themeColors: theme } = useTcbsColorStore();
19
+ return (
20
+ <Text style={[styles[variant], {color: theme.textPrimary}, style]}>
21
+ {children}
22
+ </Text>
23
+ );
24
+ };
25
+
26
+ const styles = StyleSheet.create({
27
+ title: {
28
+ fontSize: 24,
29
+ fontWeight: 'bold',
30
+ },
31
+ subtitle: {
32
+ fontSize: 20,
33
+ fontWeight: '600',
34
+ },
35
+ body: {
36
+ fontSize: 16,
37
+ },
38
+ caption: {
39
+ fontSize: 14,
40
+ color: 'gray',
41
+ },
42
+ button: {
43
+ fontSize: 16,
44
+ fontWeight: 'bold',
45
+ textTransform: 'uppercase',
46
+ },
47
+ });
48
+
49
+ export default CustomText;
package/src/index.ts CHANGED
@@ -13,4 +13,6 @@ export {
13
13
  } from './components/TcbsButton.types';
14
14
  export { useTcbsColorStore } from './store/themeStore';
15
15
  export {ThemeModal} from './components/ThemeModal';
16
- export {AppErrorBoundary} from './components/error/AppErrorBoundary';
16
+ export {AppErrorBoundary} from './components/error/AppErrorBoundary';
17
+ export {default as TcbsCard} from './components/CustomCard';
18
+ export {default as TcbsText} from './components/CustomText';