kaiwen-expo 1.0.0

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 (37) hide show
  1. package/README.md +50 -0
  2. package/dist/components/CustomButton.d.ts +15 -0
  3. package/dist/components/CustomButton.d.ts.map +1 -0
  4. package/dist/components/CustomButton.js +136 -0
  5. package/dist/components/CustomButton.js.map +1 -0
  6. package/dist/components/CustomCard.d.ts +14 -0
  7. package/dist/components/CustomCard.d.ts.map +1 -0
  8. package/dist/components/CustomCard.js +69 -0
  9. package/dist/components/CustomCard.js.map +1 -0
  10. package/dist/constants/colors.d.ts +29 -0
  11. package/dist/constants/colors.d.ts.map +1 -0
  12. package/dist/constants/colors.js +29 -0
  13. package/dist/constants/colors.js.map +1 -0
  14. package/dist/context/LibraryProvider.d.ts +16 -0
  15. package/dist/context/LibraryProvider.d.ts.map +1 -0
  16. package/dist/context/LibraryProvider.js +40 -0
  17. package/dist/context/LibraryProvider.js.map +1 -0
  18. package/dist/hooks/useToggle.d.ts +7 -0
  19. package/dist/hooks/useToggle.d.ts.map +1 -0
  20. package/dist/hooks/useToggle.js +20 -0
  21. package/dist/hooks/useToggle.js.map +1 -0
  22. package/dist/index.d.ts +7 -0
  23. package/dist/index.d.ts.map +1 -0
  24. package/dist/index.js +11 -0
  25. package/dist/index.js.map +1 -0
  26. package/dist/utils/format.d.ts +13 -0
  27. package/dist/utils/format.d.ts.map +1 -0
  28. package/dist/utils/format.js +30 -0
  29. package/dist/utils/format.js.map +1 -0
  30. package/package.json +62 -0
  31. package/src/components/CustomButton.tsx +183 -0
  32. package/src/components/CustomCard.tsx +100 -0
  33. package/src/constants/colors.ts +30 -0
  34. package/src/context/LibraryProvider.tsx +61 -0
  35. package/src/hooks/useToggle.ts +25 -0
  36. package/src/index.ts +13 -0
  37. package/src/utils/format.ts +29 -0
package/README.md ADDED
@@ -0,0 +1,50 @@
1
+ # Welcome to your Expo app 👋
2
+
3
+ This is an [Expo](https://expo.dev) project created with [`create-expo-app`](https://www.npmjs.com/package/create-expo-app).
4
+
5
+ ## Get started
6
+
7
+ 1. Install dependencies
8
+
9
+ ```bash
10
+ npm install
11
+ ```
12
+
13
+ 2. Start the app
14
+
15
+ ```bash
16
+ npx expo start
17
+ ```
18
+
19
+ In the output, you'll find options to open the app in a
20
+
21
+ - [development build](https://docs.expo.dev/develop/development-builds/introduction/)
22
+ - [Android emulator](https://docs.expo.dev/workflow/android-studio-emulator/)
23
+ - [iOS simulator](https://docs.expo.dev/workflow/ios-simulator/)
24
+ - [Expo Go](https://expo.dev/go), a limited sandbox for trying out app development with Expo
25
+
26
+ You can start developing by editing the files inside the **app** directory. This project uses [file-based routing](https://docs.expo.dev/router/introduction).
27
+
28
+ ## Get a fresh project
29
+
30
+ When you're ready, run:
31
+
32
+ ```bash
33
+ npm run reset-project
34
+ ```
35
+
36
+ This command will move the starter code to the **app-example** directory and create a blank **app** directory where you can start developing.
37
+
38
+ ## Learn more
39
+
40
+ To learn more about developing your project with Expo, look at the following resources:
41
+
42
+ - [Expo documentation](https://docs.expo.dev/): Learn fundamentals, or go into advanced topics with our [guides](https://docs.expo.dev/guides).
43
+ - [Learn Expo tutorial](https://docs.expo.dev/tutorial/introduction/): Follow a step-by-step tutorial where you'll create a project that runs on Android, iOS, and the web.
44
+
45
+ ## Join the community
46
+
47
+ Join our community of developers creating universal apps.
48
+
49
+ - [Expo on GitHub](https://github.com/expo/expo): View our open source platform and contribute.
50
+ - [Discord community](https://chat.expo.dev): Chat with Expo users and ask questions.
@@ -0,0 +1,15 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle, TextStyle } from 'react-native';
3
+ export interface CustomButtonProps {
4
+ title: string;
5
+ onPress: () => void;
6
+ variant?: 'primary' | 'secondary' | 'outline' | 'success' | 'danger';
7
+ size?: 'small' | 'medium' | 'large';
8
+ loading?: boolean;
9
+ disabled?: boolean;
10
+ style?: StyleProp<ViewStyle>;
11
+ textStyle?: StyleProp<TextStyle>;
12
+ }
13
+ export declare const CustomButton: React.FC<CustomButtonProps>;
14
+ export default CustomButton;
15
+ //# sourceMappingURL=CustomButton.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomButton.d.ts","sourceRoot":"","sources":["../../src/components/CustomButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAiB,MAAM,OAAO,CAAC;AACtC,OAAO,EAML,SAAS,EACT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AAGtB,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,OAAO,EAAE,MAAM,IAAI,CAAC;IACpB,OAAO,CAAC,EAAE,SAAS,GAAG,WAAW,GAAG,SAAS,GAAG,SAAS,GAAG,QAAQ,CAAC;IACrE,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAClC;AAED,eAAO,MAAM,YAAY,EAAE,KAAK,CAAC,EAAE,CAAC,iBAAiB,CAgHpD,CAAC;AA8CF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,136 @@
1
+ import React, { useRef } from 'react';
2
+ import { Text, StyleSheet, Pressable, Animated, ActivityIndicator, } from 'react-native';
3
+ import { useLibraryTheme } from '../context/LibraryProvider';
4
+ export const CustomButton = ({ title, onPress, variant = 'primary', size = 'medium', loading = false, disabled = false, style, textStyle, }) => {
5
+ const { colors } = useLibraryTheme();
6
+ const scaleAnim = useRef(new Animated.Value(1)).current;
7
+ const handlePressIn = () => {
8
+ if (disabled || loading)
9
+ return;
10
+ Animated.spring(scaleAnim, {
11
+ toValue: 0.96,
12
+ useNativeDriver: true,
13
+ tension: 100,
14
+ friction: 6,
15
+ }).start();
16
+ };
17
+ const handlePressOut = () => {
18
+ if (disabled || loading)
19
+ return;
20
+ Animated.spring(scaleAnim, {
21
+ toValue: 1,
22
+ useNativeDriver: true,
23
+ tension: 100,
24
+ friction: 6,
25
+ }).start();
26
+ };
27
+ // Button styles based on theme and variant
28
+ const getButtonStyles = () => {
29
+ const base = [styles.button];
30
+ // Sizes
31
+ if (size === 'small')
32
+ base.push(styles.small);
33
+ else if (size === 'large')
34
+ base.push(styles.large);
35
+ else
36
+ base.push(styles.medium);
37
+ // Variants
38
+ switch (variant) {
39
+ case 'primary':
40
+ base.push({ backgroundColor: colors.primary });
41
+ break;
42
+ case 'secondary':
43
+ base.push({ backgroundColor: colors.card, borderWidth: 1, borderColor: colors.border });
44
+ break;
45
+ case 'outline':
46
+ base.push({ backgroundColor: 'transparent', borderWidth: 2, borderColor: colors.primary });
47
+ break;
48
+ case 'success':
49
+ base.push({ backgroundColor: colors.success });
50
+ break;
51
+ case 'danger':
52
+ base.push({ backgroundColor: colors.error });
53
+ break;
54
+ }
55
+ if (disabled || loading) {
56
+ base.push({ opacity: 0.6 });
57
+ }
58
+ return base;
59
+ };
60
+ // Text styles based on variant
61
+ const getTextStyles = () => {
62
+ const base = [styles.text];
63
+ // Sizes
64
+ if (size === 'small')
65
+ base.push(styles.textSmall);
66
+ else if (size === 'large')
67
+ base.push(styles.textLarge);
68
+ else
69
+ base.push(styles.textMedium);
70
+ // Color based on variant
71
+ if (variant === 'outline') {
72
+ base.push({ color: colors.primary });
73
+ }
74
+ else if (variant === 'secondary') {
75
+ base.push({ color: colors.text });
76
+ }
77
+ else {
78
+ base.push({ color: '#ffffff' });
79
+ }
80
+ return base;
81
+ };
82
+ return (<Animated.View style={{ transform: [{ scale: scaleAnim }] }}>
83
+ <Pressable onPress={disabled || loading ? undefined : onPress} onPressIn={handlePressIn} onPressOut={handlePressOut} style={({ pressed }) => [
84
+ getButtonStyles(),
85
+ pressed && !disabled && !loading && styles.pressed,
86
+ style,
87
+ ]}>
88
+ {loading ? (<ActivityIndicator color={variant === 'outline' ? colors.primary : variant === 'secondary' ? colors.text : '#ffffff'} size="small"/>) : (<Text style={[getTextStyles(), textStyle]}>{title}</Text>)}
89
+ </Pressable>
90
+ </Animated.View>);
91
+ };
92
+ const styles = StyleSheet.create({
93
+ button: {
94
+ borderRadius: 12,
95
+ alignItems: 'center',
96
+ justifyContent: 'center',
97
+ flexDirection: 'row',
98
+ shadowColor: '#000',
99
+ shadowOffset: { width: 0, height: 2 },
100
+ shadowOpacity: 0.08,
101
+ shadowRadius: 4,
102
+ elevation: 2,
103
+ },
104
+ pressed: {
105
+ opacity: 0.9,
106
+ },
107
+ // Sizes
108
+ small: {
109
+ paddingVertical: 8,
110
+ paddingHorizontal: 16,
111
+ },
112
+ medium: {
113
+ paddingVertical: 12,
114
+ paddingHorizontal: 24,
115
+ },
116
+ large: {
117
+ paddingVertical: 16,
118
+ paddingHorizontal: 32,
119
+ },
120
+ // Text Sizes
121
+ text: {
122
+ fontWeight: '600',
123
+ textAlign: 'center',
124
+ },
125
+ textSmall: {
126
+ fontSize: 14,
127
+ },
128
+ textMedium: {
129
+ fontSize: 16,
130
+ },
131
+ textLarge: {
132
+ fontSize: 18,
133
+ },
134
+ });
135
+ export default CustomButton;
136
+ //# sourceMappingURL=CustomButton.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomButton.js","sourceRoot":"","sources":["../../src/components/CustomButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AACtC,OAAO,EACL,IAAI,EACJ,UAAU,EACV,SAAS,EACT,QAAQ,EACR,iBAAiB,GAIlB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAa7D,MAAM,CAAC,MAAM,YAAY,GAAgC,CAAC,EACxD,KAAK,EACL,OAAO,EACP,OAAO,GAAG,SAAS,EACnB,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG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CAAC,aAAa,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,CAC1D,CACH;MAAA,EAAE,SAAS,CACb;IAAA,EAAE,QAAQ,CAAC,IAAI,CAAC,CACjB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,MAAM,EAAE;QACN,YAAY,EAAE,EAAE;QAChB,UAAU,EAAE,QAAQ;QACpB,cAAc,EAAE,QAAQ;QACxB,aAAa,EAAE,KAAK;QACpB,WAAW,EAAE,MAAM;QACnB,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;QACrC,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,CAAC;KACb;IACD,OAAO,EAAE;QACP,OAAO,EAAE,GAAG;KACb;IACD,QAAQ;IACR,KAAK,EAAE;QACL,eAAe,EAAE,CAAC;QAClB,iBAAiB,EAAE,EAAE;KACtB;IACD,MAAM,EAAE;QACN,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,EAAE;KACtB;IACD,KAAK,EAAE;QACL,eAAe,EAAE,EAAE;QACnB,iBAAiB,EAAE,EAAE;KACtB;IACD,aAAa;IACb,IAAI,EAAE;QACJ,UAAU,EAAE,KAAK;QACjB,SAAS,EAAE,QAAQ;KACpB;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;KACb;IACD,UAAU,EAAE;QACV,QAAQ,EAAE,EAAE;KACb;IACD,SAAS,EAAE;QACT,QAAQ,EAAE,EAAE;KACb;CACF,CAAC,CAAC;AAEH,eAAe,YAAY,CAAC"}
@@ -0,0 +1,14 @@
1
+ import React from 'react';
2
+ import { StyleProp, ViewStyle, TextStyle } from 'react-native';
3
+ export interface CustomCardProps {
4
+ title?: string;
5
+ subtitle?: string;
6
+ children?: React.ReactNode;
7
+ footer?: React.ReactNode;
8
+ style?: StyleProp<ViewStyle>;
9
+ titleStyle?: StyleProp<TextStyle>;
10
+ subtitleStyle?: StyleProp<TextStyle>;
11
+ }
12
+ export declare const CustomCard: React.FC<CustomCardProps>;
13
+ export default CustomCard;
14
+ //# sourceMappingURL=CustomCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomCard.d.ts","sourceRoot":"","sources":["../../src/components/CustomCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAA0B,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAGvF,MAAM,WAAW,eAAe;IAC9B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAC3B,MAAM,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAClC,aAAa,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CACtC;AAED,eAAO,MAAM,UAAU,EAAE,KAAK,CAAC,EAAE,CAAC,eAAe,CA2ChD,CAAC;AA0CF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,69 @@
1
+ import React from 'react';
2
+ import { View, Text, StyleSheet } from 'react-native';
3
+ import { useLibraryTheme } from '../context/LibraryProvider';
4
+ export const CustomCard = ({ title, subtitle, children, footer, style, titleStyle, subtitleStyle, }) => {
5
+ const { colors } = useLibraryTheme();
6
+ return (<View style={[
7
+ styles.card,
8
+ {
9
+ backgroundColor: colors.card,
10
+ borderColor: colors.border,
11
+ shadowColor: colors.shadow,
12
+ },
13
+ style,
14
+ ]}>
15
+ {(title || subtitle) && (<View style={[styles.header, { borderBottomColor: colors.border }]}>
16
+ {title && <Text style={[styles.title, { color: colors.text }, titleStyle]}>{title}</Text>}
17
+ {subtitle && (<Text style={[styles.subtitle, { color: colors.textMuted }, subtitleStyle]}>
18
+ {subtitle}
19
+ </Text>)}
20
+ </View>)}
21
+
22
+ <View style={styles.body}>{children}</View>
23
+
24
+ {footer && (<View style={[styles.footer, { borderTopColor: colors.border }]}>
25
+ {footer}
26
+ </View>)}
27
+ </View>);
28
+ };
29
+ const styles = StyleSheet.create({
30
+ card: {
31
+ borderRadius: 16,
32
+ borderWidth: 1,
33
+ padding: 16,
34
+ marginVertical: 8,
35
+ // Shadow
36
+ shadowOffset: { width: 0, height: 4 },
37
+ shadowOpacity: 0.05,
38
+ shadowRadius: 8,
39
+ elevation: 3,
40
+ },
41
+ header: {
42
+ paddingBottom: 12,
43
+ borderBottomWidth: 1,
44
+ marginBottom: 12,
45
+ },
46
+ title: {
47
+ fontSize: 18,
48
+ fontWeight: '700',
49
+ letterSpacing: -0.2,
50
+ },
51
+ subtitle: {
52
+ fontSize: 13,
53
+ marginTop: 4,
54
+ fontWeight: '400',
55
+ },
56
+ body: {
57
+ flexShrink: 1,
58
+ },
59
+ footer: {
60
+ paddingTop: 12,
61
+ borderTopWidth: 1,
62
+ marginTop: 12,
63
+ flexDirection: 'row',
64
+ justifyContent: 'flex-end',
65
+ alignItems: 'center',
66
+ },
67
+ });
68
+ export default CustomCard;
69
+ //# sourceMappingURL=CustomCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CustomCard.js","sourceRoot":"","sources":["../../src/components/CustomCard.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,UAAU,EAAmC,MAAM,cAAc,CAAC;AACvF,OAAO,EAAE,eAAe,EAAE,MAAM,4BAA4B,CAAC;AAY7D,MAAM,CAAC,MAAM,UAAU,GAA8B,CAAC,EACpD,KAAK,EACL,QAAQ,EACR,QAAQ,EACR,MAAM,EACN,KAAK,EACL,UAAU,EACV,aAAa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AM,CACT;QAAA,EAAE,IAAI,CAAC,CACR,CACH;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,MAAM,GAAG,UAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,YAAY,EAAE,EAAE;QAChB,WAAW,EAAE,CAAC;QACd,OAAO,EAAE,EAAE;QACX,cAAc,EAAE,CAAC;QACjB,SAAS;QACT,YAAY,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,MAAM,EAAE,CAAC,EAAE;QACrC,aAAa,EAAE,IAAI;QACnB,YAAY,EAAE,CAAC;QACf,SAAS,EAAE,CAAC;KACb;IACD,MAAM,EAAE;QACN,aAAa,EAAE,EAAE;QACjB,iBAAiB,EAAE,CAAC;QACpB,YAAY,EAAE,EAAE;KACjB;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,EAAE;QACZ,UAAU,EAAE,KAAK;QACjB,aAAa,EAAE,CAAC,GAAG;KACpB;IACD,QAAQ,EAAE;QACR,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,CAAC;QACZ,UAAU,EAAE,KAAK;KAClB;IACD,IAAI,EAAE;QACJ,UAAU,EAAE,CAAC;KACd;IACD,MAAM,EAAE;QACN,UAAU,EAAE,EAAE;QACd,cAAc,EAAE,CAAC;QACjB,SAAS,EAAE,EAAE;QACb,aAAa,EAAE,KAAK;QACpB,cAAc,EAAE,UAAU;QAC1B,UAAU,EAAE,QAAQ;KACrB;CACF,CAAC,CAAC;AAEH,eAAe,UAAU,CAAC"}
@@ -0,0 +1,29 @@
1
+ export declare const Colors: {
2
+ light: {
3
+ primary: string;
4
+ primaryGradient: string[];
5
+ background: string;
6
+ card: string;
7
+ text: string;
8
+ textMuted: string;
9
+ border: string;
10
+ success: string;
11
+ error: string;
12
+ shadow: string;
13
+ };
14
+ dark: {
15
+ primary: string;
16
+ primaryGradient: string[];
17
+ background: string;
18
+ card: string;
19
+ text: string;
20
+ textMuted: string;
21
+ border: string;
22
+ success: string;
23
+ error: string;
24
+ shadow: string;
25
+ };
26
+ };
27
+ export type ThemeType = 'light' | 'dark';
28
+ export default Colors;
29
+ //# sourceMappingURL=colors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.d.ts","sourceRoot":"","sources":["../../src/constants/colors.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;CAyBlB,CAAC;AAEF,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,MAAM,CAAC;AACzC,eAAe,MAAM,CAAC"}
@@ -0,0 +1,29 @@
1
+ // Premium Harmonious Color Palette
2
+ export const Colors = {
3
+ light: {
4
+ primary: '#6366f1', // Indigo
5
+ primaryGradient: ['#6366f1', '#a855f7'], // Indigo to Purple
6
+ background: '#f8fafc', // Slate 50
7
+ card: '#ffffff',
8
+ text: '#0f172a', // Slate 900
9
+ textMuted: '#64748b', // Slate 500
10
+ border: '#e2e8f0', // Slate 200
11
+ success: '#10b981', // Emerald 500
12
+ error: '#ef4444', // Red 500
13
+ shadow: '#000000',
14
+ },
15
+ dark: {
16
+ primary: '#818cf8', // Indigo lightened for dark theme
17
+ primaryGradient: ['#818cf8', '#c084fc'], // Light Indigo to Light Purple
18
+ background: '#0f172a', // Slate 900
19
+ card: '#1e293b', // Slate 800
20
+ text: '#f8fafc', // Slate 50
21
+ textMuted: '#94a3b8', // Slate 400
22
+ border: '#334155', // Slate 700
23
+ success: '#34d399', // Emerald 400
24
+ error: '#f87171', // Red 400
25
+ shadow: '#000000',
26
+ }
27
+ };
28
+ export default Colors;
29
+ //# sourceMappingURL=colors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"colors.js","sourceRoot":"","sources":["../../src/constants/colors.ts"],"names":[],"mappings":"AAAA,mCAAmC;AACnC,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,KAAK,EAAE;QACL,OAAO,EAAE,SAAS,EAAE,SAAS;QAC7B,eAAe,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,mBAAmB;QAC5D,UAAU,EAAE,SAAS,EAAE,WAAW;QAClC,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,SAAS,EAAE,YAAY;QAC7B,SAAS,EAAE,SAAS,EAAE,YAAY;QAClC,MAAM,EAAE,SAAS,EAAE,YAAY;QAC/B,OAAO,EAAE,SAAS,EAAE,cAAc;QAClC,KAAK,EAAE,SAAS,EAAE,UAAU;QAC5B,MAAM,EAAE,SAAS;KAClB;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,SAAS,EAAE,kCAAkC;QACtD,eAAe,EAAE,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,+BAA+B;QACxE,UAAU,EAAE,SAAS,EAAE,YAAY;QACnC,IAAI,EAAE,SAAS,EAAE,YAAY;QAC7B,IAAI,EAAE,SAAS,EAAE,WAAW;QAC5B,SAAS,EAAE,SAAS,EAAE,YAAY;QAClC,MAAM,EAAE,SAAS,EAAE,YAAY;QAC/B,OAAO,EAAE,SAAS,EAAE,cAAc;QAClC,KAAK,EAAE,SAAS,EAAE,UAAU;QAC5B,MAAM,EAAE,SAAS;KAClB;CACF,CAAC;AAGF,eAAe,MAAM,CAAC"}
@@ -0,0 +1,16 @@
1
+ import React from 'react';
2
+ import Colors, { ThemeType } from '../constants/colors';
3
+ export interface ThemeContextProps {
4
+ theme: ThemeType;
5
+ colors: typeof Colors.light;
6
+ isDark: boolean;
7
+ setTheme: (theme: ThemeType) => void;
8
+ toggleTheme: () => void;
9
+ }
10
+ export declare const LibraryProvider: React.FC<{
11
+ children: React.ReactNode;
12
+ defaultTheme?: ThemeType;
13
+ }>;
14
+ export declare const useLibraryTheme: () => ThemeContextProps;
15
+ export default LibraryProvider;
16
+ //# sourceMappingURL=LibraryProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LibraryProvider.d.ts","sourceRoot":"","sources":["../../src/context/LibraryProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyD,MAAM,OAAO,CAAC;AAE9E,OAAO,MAAM,EAAE,EAAE,SAAS,EAAE,MAAM,qBAAqB,CAAC;AAExD,MAAM,WAAW,iBAAiB;IAChC,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,OAAO,MAAM,CAAC,KAAK,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,CAAC,KAAK,EAAE,SAAS,KAAK,IAAI,CAAC;IACrC,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAID,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,YAAY,CAAC,EAAE,SAAS,CAAA;CAAE,CA6B7F,CAAC;AAEF,eAAO,MAAM,eAAe,yBAa3B,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,40 @@
1
+ import React, { createContext, useContext, useState, useEffect } from 'react';
2
+ import { useColorScheme } from 'react-native';
3
+ import Colors from '../constants/colors';
4
+ const ThemeContext = createContext(undefined);
5
+ export const LibraryProvider = ({ children, defaultTheme, }) => {
6
+ const systemScheme = useColorScheme();
7
+ const [theme, setThemeState] = useState(defaultTheme || systemScheme || 'light');
8
+ useEffect(() => {
9
+ if (!defaultTheme && systemScheme) {
10
+ setThemeState(systemScheme);
11
+ }
12
+ }, [systemScheme, defaultTheme]);
13
+ const setTheme = (newTheme) => {
14
+ setThemeState(newTheme);
15
+ };
16
+ const toggleTheme = () => {
17
+ setThemeState((prev) => (prev === 'light' ? 'dark' : 'light'));
18
+ };
19
+ const currentColors = Colors[theme];
20
+ const isDark = theme === 'dark';
21
+ return (<ThemeContext.Provider value={{ theme, colors: currentColors, isDark, setTheme, toggleTheme }}>
22
+ {children}
23
+ </ThemeContext.Provider>);
24
+ };
25
+ export const useLibraryTheme = () => {
26
+ const context = useContext(ThemeContext);
27
+ if (!context) {
28
+ // If not wrapped in a LibraryProvider, fallback to light mode properties to avoid crashing
29
+ return {
30
+ theme: 'light',
31
+ colors: Colors.light,
32
+ isDark: false,
33
+ setTheme: () => { },
34
+ toggleTheme: () => { },
35
+ };
36
+ }
37
+ return context;
38
+ };
39
+ export default LibraryProvider;
40
+ //# sourceMappingURL=LibraryProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LibraryProvider.js","sourceRoot":"","sources":["../../src/context/LibraryProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,aAAa,EAAE,UAAU,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAC9E,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,MAAqB,MAAM,qBAAqB,CAAC;AAUxD,MAAM,YAAY,GAAG,aAAa,CAAgC,SAAS,CAAC,CAAC;AAE7E,MAAM,CAAC,MAAM,eAAe,GAAsE,CAAC,EACjG,QAAQ,EACR,YAAY,GACb,EAAE,EAAE;IACH,MAAM,YAAY,GAAG,cAAc,EAAE,CAAC;IACtC,MAAM,CAAC,KAAK,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAY,YAAY,IAAI,YAAY,IAAI,OAAO,CAAC,CAAC;IAE5F,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,YAAY,IAAI,YAAY,EAAE,CAAC;YAClC,aAAa,CAAC,YAAY,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,EAAE,CAAC,YAAY,EAAE,YAAY,CAAC,CAAC,CAAC;IAEjC,MAAM,QAAQ,GAAG,CAAC,QAAmB,EAAE,EAAE;QACvC,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC1B,CAAC,CAAC;IAEF,MAAM,WAAW,GAAG,GAAG,EAAE;QACvB,aAAa,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC;IACjE,CAAC,CAAC;IAEF,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;IACpC,MAAM,MAAM,GAAG,KAAK,KAAK,MAAM,CAAC;IAEhC,OAAO,CACL,CAAC,YAAY,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,CAAC,CAC5F;MAAA,CAAC,QAAQ,CACX;IAAA,EAAE,YAAY,CAAC,QAAQ,CAAC,CACzB,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAAG,GAAG,EAAE;IAClC,MAAM,OAAO,GAAG,UAAU,CAAC,YAAY,CAAC,CAAC;IACzC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,2FAA2F;QAC3F,OAAO;YACL,KAAK,EAAE,OAAoB;YAC3B,MAAM,EAAE,MAAM,CAAC,KAAK;YACpB,MAAM,EAAE,KAAK;YACb,QAAQ,EAAE,GAAG,EAAE,GAAE,CAAC;YAClB,WAAW,EAAE,GAAG,EAAE,GAAE,CAAC;SACtB,CAAC;IACJ,CAAC;IACD,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Custom React Hook to toggle boolean states.
3
+ * Returns a tuple containing: [value, toggle, setTrue, setFalse]
4
+ */
5
+ export declare const useToggle: (initialValue?: boolean) => readonly [boolean, () => void, () => void, () => void];
6
+ export default useToggle;
7
+ //# sourceMappingURL=useToggle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToggle.d.ts","sourceRoot":"","sources":["../../src/hooks/useToggle.ts"],"names":[],"mappings":"AAEA;;;GAGG;AACH,eAAO,MAAM,SAAS,GAAI,sBAAoB,2DAgB7C,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { useState, useCallback } from 'react';
2
+ /**
3
+ * Custom React Hook to toggle boolean states.
4
+ * Returns a tuple containing: [value, toggle, setTrue, setFalse]
5
+ */
6
+ export const useToggle = (initialValue = false) => {
7
+ const [value, setValue] = useState(initialValue);
8
+ const toggle = useCallback(() => {
9
+ setValue((prev) => !prev);
10
+ }, []);
11
+ const setTrue = useCallback(() => {
12
+ setValue(true);
13
+ }, []);
14
+ const setFalse = useCallback(() => {
15
+ setValue(false);
16
+ }, []);
17
+ return [value, toggle, setTrue, setFalse];
18
+ };
19
+ export default useToggle;
20
+ //# sourceMappingURL=useToggle.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"useToggle.js","sourceRoot":"","sources":["../../src/hooks/useToggle.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAE9C;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,YAAY,GAAG,KAAK,EAAE,EAAE;IAChD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAU,YAAY,CAAC,CAAC;IAE1D,MAAM,MAAM,GAAG,WAAW,CAAC,GAAG,EAAE;QAC9B,QAAQ,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC;IAC5B,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,OAAO,GAAG,WAAW,CAAC,GAAG,EAAE;QAC/B,QAAQ,CAAC,IAAI,CAAC,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,MAAM,QAAQ,GAAG,WAAW,CAAC,GAAG,EAAE;QAChC,QAAQ,CAAC,KAAK,CAAC,CAAC;IAClB,CAAC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,QAAQ,CAAU,CAAC;AACrD,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
@@ -0,0 +1,7 @@
1
+ export { CustomButton, type CustomButtonProps } from './components/CustomButton';
2
+ export { CustomCard, type CustomCardProps } from './components/CustomCard';
3
+ export { useToggle } from './hooks/useToggle';
4
+ export { capitalize, formatDate, formatCurrency } from './utils/format';
5
+ export { Colors, type ThemeType } from './constants/colors';
6
+ export { LibraryProvider, useLibraryTheme, type ThemeContextProps } from './context/LibraryProvider';
7
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,UAAU,EAAE,KAAK,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAG3E,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAG9C,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAGxE,OAAO,EAAE,MAAM,EAAE,KAAK,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,eAAe,EAAE,KAAK,iBAAiB,EAAE,MAAM,2BAA2B,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,11 @@
1
+ // Export components
2
+ export { CustomButton } from './components/CustomButton';
3
+ export { CustomCard } from './components/CustomCard';
4
+ // Export hooks
5
+ export { useToggle } from './hooks/useToggle';
6
+ // Export utilities
7
+ export { capitalize, formatDate, formatCurrency } from './utils/format';
8
+ // Export theme and constants
9
+ export { Colors } from './constants/colors';
10
+ export { LibraryProvider, useLibraryTheme } from './context/LibraryProvider';
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,OAAO,EAAE,YAAY,EAA0B,MAAM,2BAA2B,CAAC;AACjF,OAAO,EAAE,UAAU,EAAwB,MAAM,yBAAyB,CAAC;AAE3E,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAE9C,mBAAmB;AACnB,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,MAAM,gBAAgB,CAAC;AAExE,6BAA6B;AAC7B,OAAO,EAAE,MAAM,EAAkB,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,eAAe,EAA0B,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Capitalizes the first letter of a string.
3
+ */
4
+ export declare const capitalize: (str: string) => string;
5
+ /**
6
+ * Formats a date string or timestamp into a readable format (e.g., DD.MM.YYYY).
7
+ */
8
+ export declare const formatDate: (dateInput: string | number | Date) => string;
9
+ /**
10
+ * Formats a number to currency format (TL by default).
11
+ */
12
+ export declare const formatCurrency: (amount: number, locale?: string, currency?: string) => string;
13
+ //# sourceMappingURL=format.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,MAGxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,WAAW,MAAM,GAAG,MAAM,GAAG,IAAI,KAAG,MAO9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,EAAE,eAAgB,EAAE,iBAAgB,KAAG,MAKnF,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Capitalizes the first letter of a string.
3
+ */
4
+ export const capitalize = (str) => {
5
+ if (!str)
6
+ return '';
7
+ return str.charAt(0).toUpperCase() + str.slice(1);
8
+ };
9
+ /**
10
+ * Formats a date string or timestamp into a readable format (e.g., DD.MM.YYYY).
11
+ */
12
+ export const formatDate = (dateInput) => {
13
+ const date = new Date(dateInput);
14
+ if (isNaN(date.getTime()))
15
+ return '';
16
+ const day = String(date.getDate()).padStart(2, '0');
17
+ const month = String(date.getMonth() + 1).padStart(2, '0');
18
+ const year = date.getFullYear();
19
+ return `${day}.${month}.${year}`;
20
+ };
21
+ /**
22
+ * Formats a number to currency format (TL by default).
23
+ */
24
+ export const formatCurrency = (amount, locale = 'tr-TR', currency = 'TRY') => {
25
+ return new Intl.NumberFormat(locale, {
26
+ style: 'currency',
27
+ currency: currency,
28
+ }).format(amount);
29
+ };
30
+ //# sourceMappingURL=format.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/utils/format.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,GAAW,EAAU,EAAE;IAChD,IAAI,CAAC,GAAG;QAAE,OAAO,EAAE,CAAC;IACpB,OAAO,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,GAAG,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;AACpD,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,SAAiC,EAAU,EAAE;IACtE,MAAM,IAAI,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,CAAC;IACjC,IAAI,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;QAAE,OAAO,EAAE,CAAC;IACrC,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IACpD,MAAM,KAAK,GAAG,MAAM,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;IAC3D,MAAM,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;IAChC,OAAO,GAAG,GAAG,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;AACnC,CAAC,CAAC;AAEF;;GAEG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAE,MAAM,GAAG,OAAO,EAAE,QAAQ,GAAG,KAAK,EAAU,EAAE;IAC3F,OAAO,IAAI,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE;QACnC,KAAK,EAAE,UAAU;QACjB,QAAQ,EAAE,QAAQ;KACnB,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC;AACpB,CAAC,CAAC"}
package/package.json ADDED
@@ -0,0 +1,62 @@
1
+ {
2
+ "name": "kaiwen-expo",
3
+ "version": "1.0.0",
4
+ "description": "Custom Expo UI components, hooks, and helpers library.",
5
+ "main": "expo-router/entry",
6
+ "react-native": "src/index.ts",
7
+ "module": "dist/index.js",
8
+ "types": "dist/index.d.ts",
9
+ "files": [
10
+ "dist",
11
+ "src",
12
+ "README.md"
13
+ ],
14
+ "scripts": {
15
+ "start": "expo start",
16
+ "reset-project": "node ./scripts/reset-project.js",
17
+ "android": "expo start --android",
18
+ "ios": "expo start --ios",
19
+ "web": "expo start --web",
20
+ "lint": "expo lint",
21
+ "build": "tsc --project tsconfig.build.json"
22
+ },
23
+ "dependencies": {
24
+ "@expo/vector-icons": "^15.0.3",
25
+ "@react-navigation/bottom-tabs": "^7.4.0",
26
+ "@react-navigation/elements": "^2.6.3",
27
+ "@react-navigation/native": "^7.1.8",
28
+ "expo": "~54.0.34",
29
+ "expo-constants": "~18.0.13",
30
+ "expo-font": "~14.0.11",
31
+ "expo-haptics": "~15.0.8",
32
+ "expo-image": "~3.0.11",
33
+ "expo-linking": "~8.0.12",
34
+ "expo-router": "~6.0.23",
35
+ "expo-splash-screen": "~31.0.13",
36
+ "expo-status-bar": "~3.0.9",
37
+ "expo-symbols": "~1.0.8",
38
+ "expo-system-ui": "~6.0.9",
39
+ "expo-web-browser": "~15.0.11",
40
+ "react": "19.1.0",
41
+ "react-dom": "19.1.0",
42
+ "react-native": "0.81.5",
43
+ "react-native-gesture-handler": "~2.28.0",
44
+ "react-native-worklets": "0.5.1",
45
+ "react-native-reanimated": "~4.1.1",
46
+ "react-native-safe-area-context": "~5.6.0",
47
+ "react-native-screens": "~4.16.0",
48
+ "react-native-web": "~0.21.0"
49
+ },
50
+ "peerDependencies": {
51
+ "expo": ">=54.0.0",
52
+ "react": ">=19.0.0",
53
+ "react-native": ">=0.81.0"
54
+ },
55
+ "devDependencies": {
56
+ "@types/react": "~19.1.0",
57
+ "typescript": "~5.9.2",
58
+ "eslint": "^9.25.0",
59
+ "eslint-config-expo": "~10.0.0"
60
+ },
61
+ "private": false
62
+ }
@@ -0,0 +1,183 @@
1
+ import React, { useRef } from 'react';
2
+ import {
3
+ Text,
4
+ StyleSheet,
5
+ Pressable,
6
+ Animated,
7
+ ActivityIndicator,
8
+ StyleProp,
9
+ ViewStyle,
10
+ TextStyle,
11
+ } from 'react-native';
12
+ import { useLibraryTheme } from '../context/LibraryProvider';
13
+
14
+ export interface CustomButtonProps {
15
+ title: string;
16
+ onPress: () => void;
17
+ variant?: 'primary' | 'secondary' | 'outline' | 'success' | 'danger';
18
+ size?: 'small' | 'medium' | 'large';
19
+ loading?: boolean;
20
+ disabled?: boolean;
21
+ style?: StyleProp<ViewStyle>;
22
+ textStyle?: StyleProp<TextStyle>;
23
+ }
24
+
25
+ export const CustomButton: React.FC<CustomButtonProps> = ({
26
+ title,
27
+ onPress,
28
+ variant = 'primary',
29
+ size = 'medium',
30
+ loading = false,
31
+ disabled = false,
32
+ style,
33
+ textStyle,
34
+ }) => {
35
+ const { colors } = useLibraryTheme();
36
+ const scaleAnim = useRef(new Animated.Value(1)).current;
37
+
38
+ const handlePressIn = () => {
39
+ if (disabled || loading) return;
40
+ Animated.spring(scaleAnim, {
41
+ toValue: 0.96,
42
+ useNativeDriver: true,
43
+ tension: 100,
44
+ friction: 6,
45
+ }).start();
46
+ };
47
+
48
+ const handlePressOut = () => {
49
+ if (disabled || loading) return;
50
+ Animated.spring(scaleAnim, {
51
+ toValue: 1,
52
+ useNativeDriver: true,
53
+ tension: 100,
54
+ friction: 6,
55
+ }).start();
56
+ };
57
+
58
+ // Button styles based on theme and variant
59
+ const getButtonStyles = (): any[] => {
60
+ const base: any[] = [styles.button];
61
+
62
+ // Sizes
63
+ if (size === 'small') base.push(styles.small);
64
+ else if (size === 'large') base.push(styles.large);
65
+ else base.push(styles.medium);
66
+
67
+ // Variants
68
+ switch (variant) {
69
+ case 'primary':
70
+ base.push({ backgroundColor: colors.primary });
71
+ break;
72
+ case 'secondary':
73
+ base.push({ backgroundColor: colors.card, borderWidth: 1, borderColor: colors.border });
74
+ break;
75
+ case 'outline':
76
+ base.push({ backgroundColor: 'transparent', borderWidth: 2, borderColor: colors.primary });
77
+ break;
78
+ case 'success':
79
+ base.push({ backgroundColor: colors.success });
80
+ break;
81
+ case 'danger':
82
+ base.push({ backgroundColor: colors.error });
83
+ break;
84
+ }
85
+
86
+ if (disabled || loading) {
87
+ base.push({ opacity: 0.6 });
88
+ }
89
+
90
+ return base;
91
+ };
92
+
93
+ // Text styles based on variant
94
+ const getTextStyles = (): any[] => {
95
+ const base: any[] = [styles.text];
96
+
97
+ // Sizes
98
+ if (size === 'small') base.push(styles.textSmall);
99
+ else if (size === 'large') base.push(styles.textLarge);
100
+ else base.push(styles.textMedium);
101
+
102
+ // Color based on variant
103
+ if (variant === 'outline') {
104
+ base.push({ color: colors.primary });
105
+ } else if (variant === 'secondary') {
106
+ base.push({ color: colors.text });
107
+ } else {
108
+ base.push({ color: '#ffffff' });
109
+ }
110
+
111
+ return base;
112
+ };
113
+
114
+ return (
115
+ <Animated.View style={{ transform: [{ scale: scaleAnim }] }}>
116
+ <Pressable
117
+ onPress={disabled || loading ? undefined : onPress}
118
+ onPressIn={handlePressIn}
119
+ onPressOut={handlePressOut}
120
+ style={({ pressed }) => [
121
+ getButtonStyles(),
122
+ pressed && !disabled && !loading && styles.pressed,
123
+ style,
124
+ ]}
125
+ >
126
+ {loading ? (
127
+ <ActivityIndicator
128
+ color={variant === 'outline' ? colors.primary : variant === 'secondary' ? colors.text : '#ffffff'}
129
+ size="small"
130
+ />
131
+ ) : (
132
+ <Text style={[getTextStyles(), textStyle]}>{title}</Text>
133
+ )}
134
+ </Pressable>
135
+ </Animated.View>
136
+ );
137
+ };
138
+
139
+ const styles = StyleSheet.create({
140
+ button: {
141
+ borderRadius: 12,
142
+ alignItems: 'center',
143
+ justifyContent: 'center',
144
+ flexDirection: 'row',
145
+ shadowColor: '#000',
146
+ shadowOffset: { width: 0, height: 2 },
147
+ shadowOpacity: 0.08,
148
+ shadowRadius: 4,
149
+ elevation: 2,
150
+ },
151
+ pressed: {
152
+ opacity: 0.9,
153
+ },
154
+ // Sizes
155
+ small: {
156
+ paddingVertical: 8,
157
+ paddingHorizontal: 16,
158
+ },
159
+ medium: {
160
+ paddingVertical: 12,
161
+ paddingHorizontal: 24,
162
+ },
163
+ large: {
164
+ paddingVertical: 16,
165
+ paddingHorizontal: 32,
166
+ },
167
+ // Text Sizes
168
+ text: {
169
+ fontWeight: '600',
170
+ textAlign: 'center',
171
+ },
172
+ textSmall: {
173
+ fontSize: 14,
174
+ },
175
+ textMedium: {
176
+ fontSize: 16,
177
+ },
178
+ textLarge: {
179
+ fontSize: 18,
180
+ },
181
+ });
182
+
183
+ export default CustomButton;
@@ -0,0 +1,100 @@
1
+ import React from 'react';
2
+ import { View, Text, StyleSheet, StyleProp, ViewStyle, TextStyle } from 'react-native';
3
+ import { useLibraryTheme } from '../context/LibraryProvider';
4
+
5
+ export interface CustomCardProps {
6
+ title?: string;
7
+ subtitle?: string;
8
+ children?: React.ReactNode;
9
+ footer?: React.ReactNode;
10
+ style?: StyleProp<ViewStyle>;
11
+ titleStyle?: StyleProp<TextStyle>;
12
+ subtitleStyle?: StyleProp<TextStyle>;
13
+ }
14
+
15
+ export const CustomCard: React.FC<CustomCardProps> = ({
16
+ title,
17
+ subtitle,
18
+ children,
19
+ footer,
20
+ style,
21
+ titleStyle,
22
+ subtitleStyle,
23
+ }) => {
24
+ const { colors } = useLibraryTheme();
25
+
26
+ return (
27
+ <View
28
+ style={[
29
+ styles.card,
30
+ {
31
+ backgroundColor: colors.card,
32
+ borderColor: colors.border,
33
+ shadowColor: colors.shadow,
34
+ },
35
+ style,
36
+ ]}
37
+ >
38
+ {(title || subtitle) && (
39
+ <View style={[styles.header, { borderBottomColor: colors.border }]}>
40
+ {title && <Text style={[styles.title, { color: colors.text }, titleStyle]}>{title}</Text>}
41
+ {subtitle && (
42
+ <Text style={[styles.subtitle, { color: colors.textMuted }, subtitleStyle]}>
43
+ {subtitle}
44
+ </Text>
45
+ )}
46
+ </View>
47
+ )}
48
+
49
+ <View style={styles.body}>{children}</View>
50
+
51
+ {footer && (
52
+ <View style={[styles.footer, { borderTopColor: colors.border }]}>
53
+ {footer}
54
+ </View>
55
+ )}
56
+ </View>
57
+ );
58
+ };
59
+
60
+ const styles = StyleSheet.create({
61
+ card: {
62
+ borderRadius: 16,
63
+ borderWidth: 1,
64
+ padding: 16,
65
+ marginVertical: 8,
66
+ // Shadow
67
+ shadowOffset: { width: 0, height: 4 },
68
+ shadowOpacity: 0.05,
69
+ shadowRadius: 8,
70
+ elevation: 3,
71
+ },
72
+ header: {
73
+ paddingBottom: 12,
74
+ borderBottomWidth: 1,
75
+ marginBottom: 12,
76
+ },
77
+ title: {
78
+ fontSize: 18,
79
+ fontWeight: '700',
80
+ letterSpacing: -0.2,
81
+ },
82
+ subtitle: {
83
+ fontSize: 13,
84
+ marginTop: 4,
85
+ fontWeight: '400',
86
+ },
87
+ body: {
88
+ flexShrink: 1,
89
+ },
90
+ footer: {
91
+ paddingTop: 12,
92
+ borderTopWidth: 1,
93
+ marginTop: 12,
94
+ flexDirection: 'row',
95
+ justifyContent: 'flex-end',
96
+ alignItems: 'center',
97
+ },
98
+ });
99
+
100
+ export default CustomCard;
@@ -0,0 +1,30 @@
1
+ // Premium Harmonious Color Palette
2
+ export const Colors = {
3
+ light: {
4
+ primary: '#6366f1', // Indigo
5
+ primaryGradient: ['#6366f1', '#a855f7'], // Indigo to Purple
6
+ background: '#f8fafc', // Slate 50
7
+ card: '#ffffff',
8
+ text: '#0f172a', // Slate 900
9
+ textMuted: '#64748b', // Slate 500
10
+ border: '#e2e8f0', // Slate 200
11
+ success: '#10b981', // Emerald 500
12
+ error: '#ef4444', // Red 500
13
+ shadow: '#000000',
14
+ },
15
+ dark: {
16
+ primary: '#818cf8', // Indigo lightened for dark theme
17
+ primaryGradient: ['#818cf8', '#c084fc'], // Light Indigo to Light Purple
18
+ background: '#0f172a', // Slate 900
19
+ card: '#1e293b', // Slate 800
20
+ text: '#f8fafc', // Slate 50
21
+ textMuted: '#94a3b8', // Slate 400
22
+ border: '#334155', // Slate 700
23
+ success: '#34d399', // Emerald 400
24
+ error: '#f87171', // Red 400
25
+ shadow: '#000000',
26
+ }
27
+ };
28
+
29
+ export type ThemeType = 'light' | 'dark';
30
+ export default Colors;
@@ -0,0 +1,61 @@
1
+ import React, { createContext, useContext, useState, useEffect } from 'react';
2
+ import { useColorScheme } from 'react-native';
3
+ import Colors, { ThemeType } from '../constants/colors';
4
+
5
+ export interface ThemeContextProps {
6
+ theme: ThemeType;
7
+ colors: typeof Colors.light;
8
+ isDark: boolean;
9
+ setTheme: (theme: ThemeType) => void;
10
+ toggleTheme: () => void;
11
+ }
12
+
13
+ const ThemeContext = createContext<ThemeContextProps | undefined>(undefined);
14
+
15
+ export const LibraryProvider: React.FC<{ children: React.ReactNode; defaultTheme?: ThemeType }> = ({
16
+ children,
17
+ defaultTheme,
18
+ }) => {
19
+ const systemScheme = useColorScheme();
20
+ const [theme, setThemeState] = useState<ThemeType>(defaultTheme || systemScheme || 'light');
21
+
22
+ useEffect(() => {
23
+ if (!defaultTheme && systemScheme) {
24
+ setThemeState(systemScheme);
25
+ }
26
+ }, [systemScheme, defaultTheme]);
27
+
28
+ const setTheme = (newTheme: ThemeType) => {
29
+ setThemeState(newTheme);
30
+ };
31
+
32
+ const toggleTheme = () => {
33
+ setThemeState((prev) => (prev === 'light' ? 'dark' : 'light'));
34
+ };
35
+
36
+ const currentColors = Colors[theme];
37
+ const isDark = theme === 'dark';
38
+
39
+ return (
40
+ <ThemeContext.Provider value={{ theme, colors: currentColors, isDark, setTheme, toggleTheme }}>
41
+ {children}
42
+ </ThemeContext.Provider>
43
+ );
44
+ };
45
+
46
+ export const useLibraryTheme = () => {
47
+ const context = useContext(ThemeContext);
48
+ if (!context) {
49
+ // If not wrapped in a LibraryProvider, fallback to light mode properties to avoid crashing
50
+ return {
51
+ theme: 'light' as ThemeType,
52
+ colors: Colors.light,
53
+ isDark: false,
54
+ setTheme: () => {},
55
+ toggleTheme: () => {},
56
+ };
57
+ }
58
+ return context;
59
+ };
60
+
61
+ export default LibraryProvider;
@@ -0,0 +1,25 @@
1
+ import { useState, useCallback } from 'react';
2
+
3
+ /**
4
+ * Custom React Hook to toggle boolean states.
5
+ * Returns a tuple containing: [value, toggle, setTrue, setFalse]
6
+ */
7
+ export const useToggle = (initialValue = false) => {
8
+ const [value, setValue] = useState<boolean>(initialValue);
9
+
10
+ const toggle = useCallback(() => {
11
+ setValue((prev) => !prev);
12
+ }, []);
13
+
14
+ const setTrue = useCallback(() => {
15
+ setValue(true);
16
+ }, []);
17
+
18
+ const setFalse = useCallback(() => {
19
+ setValue(false);
20
+ }, []);
21
+
22
+ return [value, toggle, setTrue, setFalse] as const;
23
+ };
24
+
25
+ export default useToggle;
package/src/index.ts ADDED
@@ -0,0 +1,13 @@
1
+ // Export components
2
+ export { CustomButton, type CustomButtonProps } from './components/CustomButton';
3
+ export { CustomCard, type CustomCardProps } from './components/CustomCard';
4
+
5
+ // Export hooks
6
+ export { useToggle } from './hooks/useToggle';
7
+
8
+ // Export utilities
9
+ export { capitalize, formatDate, formatCurrency } from './utils/format';
10
+
11
+ // Export theme and constants
12
+ export { Colors, type ThemeType } from './constants/colors';
13
+ export { LibraryProvider, useLibraryTheme, type ThemeContextProps } from './context/LibraryProvider';
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Capitalizes the first letter of a string.
3
+ */
4
+ export const capitalize = (str: string): string => {
5
+ if (!str) return '';
6
+ return str.charAt(0).toUpperCase() + str.slice(1);
7
+ };
8
+
9
+ /**
10
+ * Formats a date string or timestamp into a readable format (e.g., DD.MM.YYYY).
11
+ */
12
+ export const formatDate = (dateInput: string | number | Date): string => {
13
+ const date = new Date(dateInput);
14
+ if (isNaN(date.getTime())) return '';
15
+ const day = String(date.getDate()).padStart(2, '0');
16
+ const month = String(date.getMonth() + 1).padStart(2, '0');
17
+ const year = date.getFullYear();
18
+ return `${day}.${month}.${year}`;
19
+ };
20
+
21
+ /**
22
+ * Formats a number to currency format (TL by default).
23
+ */
24
+ export const formatCurrency = (amount: number, locale = 'tr-TR', currency = 'TRY'): string => {
25
+ return new Intl.NumberFormat(locale, {
26
+ style: 'currency',
27
+ currency: currency,
28
+ }).format(amount);
29
+ };