ripal-ui 1.0.1 → 1.0.2
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/README.md +0 -0
- package/components/BottomSheet.tsx +197 -0
- package/components/Carousel.tsx +61 -0
- package/components/Circle.tsx +44 -0
- package/components/Tab.tsx +90 -0
- package/components/{Table.jsx → Table.tsx} +32 -10
- package/components/index.ts +5 -0
- package/config.js +3 -78
- package/dist/BottomSheet.js +186 -0
- package/dist/Carousel.js +52 -0
- package/dist/Toast.js +72 -0
- package/dist/index.js +74 -12
- package/elements/{Button.jsx → Button.tsx} +51 -26
- package/elements/Dialog.tsx +87 -0
- package/elements/Dropdown.tsx +88 -0
- package/elements/Inline.tsx +38 -0
- package/elements/Input.tsx +75 -0
- package/elements/ProgressBar.tsx +52 -0
- package/elements/Separator.tsx +72 -0
- package/elements/Skeleton.tsx +64 -0
- package/elements/Switch.tsx +64 -0
- package/elements/Text.tsx +73 -0
- package/elements/Toast.tsx +65 -0
- package/elements/Toggle.tsx +59 -0
- package/elements/index.js +2 -1
- package/package.json +6 -3
- package/scripts/generateConfig.js +10 -4
- package/components/Circle.jsx +0 -24
- package/components/Tab.jsx +0 -71
- package/components/index.js +0 -4
- package/elements/Dialog.jsx +0 -64
- package/elements/Dropdown.jsx +0 -66
- package/elements/Inline.jsx +0 -16
- package/elements/Input.jsx +0 -48
- package/elements/ProgressBar.jsx +0 -29
- package/elements/Separator.jsx +0 -32
- package/elements/Skeleton.jsx +0 -50
- package/elements/Switch.jsx +0 -49
- package/elements/Text.jsx +0 -42
- package/elements/Toggle.jsx +0 -48
package/README.md
ADDED
|
File without changes
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import React, { useEffect, useRef, useState, ReactNode } from 'react';
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
View,
|
|
5
|
+
TouchableOpacity,
|
|
6
|
+
StyleSheet,
|
|
7
|
+
Dimensions,
|
|
8
|
+
PanResponder,
|
|
9
|
+
TouchableWithoutFeedback,
|
|
10
|
+
ScrollView,
|
|
11
|
+
Keyboard,
|
|
12
|
+
} from 'react-native';
|
|
13
|
+
import { Separator, Text } from '../elements';
|
|
14
|
+
import config from '../config';
|
|
15
|
+
|
|
16
|
+
const { height: screenHeight } = Dimensions.get('window');
|
|
17
|
+
|
|
18
|
+
// Define props interface
|
|
19
|
+
interface BottomSheetProps {
|
|
20
|
+
isVisible: boolean;
|
|
21
|
+
onClose: () => void;
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
height?: number | string;
|
|
24
|
+
scroll?: boolean;
|
|
25
|
+
style?: object;
|
|
26
|
+
contentContainerStyle?: object;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const BottomSheet: React.FC<BottomSheetProps> = ({
|
|
30
|
+
isVisible,
|
|
31
|
+
onClose,
|
|
32
|
+
children,
|
|
33
|
+
height = 'auto',
|
|
34
|
+
scroll = false,
|
|
35
|
+
style,
|
|
36
|
+
contentContainerStyle,
|
|
37
|
+
}) => {
|
|
38
|
+
const [visible, setVisible] = useState(isVisible);
|
|
39
|
+
const translateY = useRef(new Animated.Value(screenHeight)).current;
|
|
40
|
+
const scrollOffset = useRef(0); // Keep track of ScrollView offset
|
|
41
|
+
const keyboardHeight = useRef(new Animated.Value(0)).current; // Use Animated.Value for keyboard height
|
|
42
|
+
|
|
43
|
+
// Create a PanResponder to handle the dragging gesture
|
|
44
|
+
const panResponder = useRef(
|
|
45
|
+
PanResponder.create({
|
|
46
|
+
onMoveShouldSetPanResponder: (evt, gestureState) => {
|
|
47
|
+
return Math.abs(gestureState.dy) > 5;
|
|
48
|
+
},
|
|
49
|
+
onPanResponderMove: (evt, gestureState) => {
|
|
50
|
+
translateY.setValue(Math.max(gestureState.dy, 0));
|
|
51
|
+
},
|
|
52
|
+
onPanResponderRelease: (evt, gestureState) => {
|
|
53
|
+
const isClosing = gestureState.dy > 100;
|
|
54
|
+
if (isClosing) {
|
|
55
|
+
Animated.timing(translateY, {
|
|
56
|
+
toValue: screenHeight,
|
|
57
|
+
duration: 300,
|
|
58
|
+
useNativeDriver: false,
|
|
59
|
+
}).start(() => setVisible(false));
|
|
60
|
+
onClose();
|
|
61
|
+
} else {
|
|
62
|
+
Animated.timing(translateY, {
|
|
63
|
+
toValue: 0,
|
|
64
|
+
duration: 300,
|
|
65
|
+
useNativeDriver: false,
|
|
66
|
+
}).start();
|
|
67
|
+
}
|
|
68
|
+
},
|
|
69
|
+
})
|
|
70
|
+
).current;
|
|
71
|
+
|
|
72
|
+
useEffect(() => {
|
|
73
|
+
if (isVisible) {
|
|
74
|
+
setVisible(true);
|
|
75
|
+
Animated.timing(translateY, {
|
|
76
|
+
toValue: 0,
|
|
77
|
+
duration: 300,
|
|
78
|
+
useNativeDriver: false,
|
|
79
|
+
}).start();
|
|
80
|
+
} else {
|
|
81
|
+
Animated.timing(translateY, {
|
|
82
|
+
toValue: screenHeight,
|
|
83
|
+
duration: 300,
|
|
84
|
+
useNativeDriver: false,
|
|
85
|
+
}).start(() => setVisible(false));
|
|
86
|
+
}
|
|
87
|
+
}, [isVisible]);
|
|
88
|
+
|
|
89
|
+
useEffect(() => {
|
|
90
|
+
// Handle keyboard show and hide
|
|
91
|
+
const keyboardDidShowListener = Keyboard.addListener(
|
|
92
|
+
'keyboardDidShow',
|
|
93
|
+
(event) => {
|
|
94
|
+
Animated.timing(keyboardHeight, {
|
|
95
|
+
toValue: event.endCoordinates.height,
|
|
96
|
+
duration: 300,
|
|
97
|
+
useNativeDriver: false, // Layout animation
|
|
98
|
+
}).start();
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
const keyboardDidHideListener = Keyboard.addListener(
|
|
102
|
+
'keyboardDidHide',
|
|
103
|
+
() => {
|
|
104
|
+
Animated.timing(keyboardHeight, {
|
|
105
|
+
toValue: 0,
|
|
106
|
+
duration: 300,
|
|
107
|
+
useNativeDriver: false, // Layout animation
|
|
108
|
+
}).start();
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
|
|
112
|
+
// Cleanup listeners on component unmount
|
|
113
|
+
return () => {
|
|
114
|
+
keyboardDidShowListener.remove();
|
|
115
|
+
keyboardDidHideListener.remove();
|
|
116
|
+
};
|
|
117
|
+
}, []);
|
|
118
|
+
|
|
119
|
+
if (!visible) return null;
|
|
120
|
+
|
|
121
|
+
return (
|
|
122
|
+
<View style={StyleSheet.absoluteFill}>
|
|
123
|
+
{/* Background Overlay */}
|
|
124
|
+
<TouchableWithoutFeedback onPress={onClose}>
|
|
125
|
+
<View style={styles.overlay} />
|
|
126
|
+
</TouchableWithoutFeedback>
|
|
127
|
+
|
|
128
|
+
{/* Bottom Sheet */}
|
|
129
|
+
<Animated.View
|
|
130
|
+
{...panResponder.panHandlers}
|
|
131
|
+
style={[
|
|
132
|
+
styles.sheet,
|
|
133
|
+
{ height: height, ...style },
|
|
134
|
+
{
|
|
135
|
+
transform: [
|
|
136
|
+
{ translateY },
|
|
137
|
+
{ translateY: keyboardHeight.interpolate({
|
|
138
|
+
inputRange: [0, 1],
|
|
139
|
+
outputRange: [0, -1], // Interpolate for smoother transition
|
|
140
|
+
}) }
|
|
141
|
+
]
|
|
142
|
+
},
|
|
143
|
+
]}
|
|
144
|
+
>
|
|
145
|
+
{/* Children */}
|
|
146
|
+
<View style={styles.dragIndicatorContainer}>
|
|
147
|
+
<TouchableWithoutFeedback {...panResponder.panHandlers}>
|
|
148
|
+
<Separator height={6} style={{ borderRadius: 99 }} width='12%' color={config.colors.slate[300]} />
|
|
149
|
+
</TouchableWithoutFeedback>
|
|
150
|
+
</View>
|
|
151
|
+
|
|
152
|
+
<TouchableWithoutFeedback onPress={Keyboard.dismiss}>
|
|
153
|
+
<View>
|
|
154
|
+
{scroll ? (
|
|
155
|
+
<ScrollView
|
|
156
|
+
onScroll={(e) => (scrollOffset.current = e.nativeEvent.contentOffset.y)} // Update scrollOffset correctly
|
|
157
|
+
scrollEventThrottle={16}
|
|
158
|
+
showsVerticalScrollIndicator={false}
|
|
159
|
+
contentContainerStyle={contentContainerStyle}
|
|
160
|
+
>
|
|
161
|
+
{children}
|
|
162
|
+
</ScrollView>
|
|
163
|
+
) : (
|
|
164
|
+
children
|
|
165
|
+
)}
|
|
166
|
+
</View>
|
|
167
|
+
</TouchableWithoutFeedback>
|
|
168
|
+
</Animated.View>
|
|
169
|
+
</View>
|
|
170
|
+
);
|
|
171
|
+
};
|
|
172
|
+
|
|
173
|
+
const styles = StyleSheet.create({
|
|
174
|
+
overlay: {
|
|
175
|
+
...StyleSheet.absoluteFillObject,
|
|
176
|
+
backgroundColor: 'rgba(0, 0, 0, 0.7)', // Semi-transparent black
|
|
177
|
+
},
|
|
178
|
+
sheet: {
|
|
179
|
+
position: 'absolute',
|
|
180
|
+
bottom: 0,
|
|
181
|
+
left: 0,
|
|
182
|
+
right: 0,
|
|
183
|
+
paddingHorizontal: 20,
|
|
184
|
+
paddingBottom: 20,
|
|
185
|
+
backgroundColor: '#fff',
|
|
186
|
+
borderTopLeftRadius: 20,
|
|
187
|
+
borderTopRightRadius: 20,
|
|
188
|
+
elevation: 5,
|
|
189
|
+
},
|
|
190
|
+
dragIndicatorContainer: {
|
|
191
|
+
width: '100%',
|
|
192
|
+
alignItems: 'center',
|
|
193
|
+
paddingVertical: 10,
|
|
194
|
+
},
|
|
195
|
+
});
|
|
196
|
+
|
|
197
|
+
export default BottomSheet;
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Dimensions, Pressable, ScrollView, StyleSheet, View, ViewStyle } from "react-native";
|
|
3
|
+
import { Text } from "../elements";
|
|
4
|
+
|
|
5
|
+
// Define types for the CarouselItem props
|
|
6
|
+
interface CarouselItemProps {
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
itemWidth: number;
|
|
9
|
+
onPress?: () => void;
|
|
10
|
+
style?: ViewStyle;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
// Define the CarouselItem component
|
|
14
|
+
const CarouselItem: React.FC<CarouselItemProps> = ({ children, itemWidth, onPress, style }) => {
|
|
15
|
+
return (
|
|
16
|
+
<Pressable style={{ width: itemWidth, ...style }} onPress={onPress}>
|
|
17
|
+
{children}
|
|
18
|
+
</Pressable>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
// Define types for the Carousel props
|
|
23
|
+
interface CarouselProps {
|
|
24
|
+
children: React.ReactNode;
|
|
25
|
+
itemWidth?: number;
|
|
26
|
+
showIndicator?: boolean;
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
// Define the Carousel component
|
|
30
|
+
const Carousel: React.FC<CarouselProps> = ({
|
|
31
|
+
children,
|
|
32
|
+
itemWidth = 0.6 * Dimensions.get('window').width,
|
|
33
|
+
showIndicator = false,
|
|
34
|
+
}) => {
|
|
35
|
+
return (
|
|
36
|
+
<ScrollView
|
|
37
|
+
horizontal
|
|
38
|
+
showsHorizontalScrollIndicator={showIndicator}
|
|
39
|
+
contentContainerStyle={styles.container}
|
|
40
|
+
>
|
|
41
|
+
<View></View>
|
|
42
|
+
{React.Children.map(children, (child) =>
|
|
43
|
+
React.cloneElement(child as React.ReactElement<any>, { itemWidth })
|
|
44
|
+
)}
|
|
45
|
+
<View></View>
|
|
46
|
+
</ScrollView>
|
|
47
|
+
);
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
// Define styles
|
|
51
|
+
const styles = StyleSheet.create({
|
|
52
|
+
area: {
|
|
53
|
+
// Add any specific styles if needed
|
|
54
|
+
},
|
|
55
|
+
container: {
|
|
56
|
+
gap: 20,
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// Export components
|
|
61
|
+
export { Carousel, CarouselItem };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Pressable, StyleSheet, PressableProps, ViewStyle } from "react-native";
|
|
3
|
+
import config from "../config";
|
|
4
|
+
|
|
5
|
+
interface CircleProps extends PressableProps {
|
|
6
|
+
size?: number; // Optional size for the circle
|
|
7
|
+
color?: string; // Optional color for the circle
|
|
8
|
+
rounded?: number; // Optional rounded value for the border radius
|
|
9
|
+
children?: React.ReactNode; // Allows for any valid React node
|
|
10
|
+
onPress?: () => void; // Optional onPress function
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const Circle: React.FC<CircleProps> = ({
|
|
14
|
+
size = 24,
|
|
15
|
+
color = config.colors.primary,
|
|
16
|
+
children,
|
|
17
|
+
onPress,
|
|
18
|
+
rounded = 999,
|
|
19
|
+
}) => {
|
|
20
|
+
return (
|
|
21
|
+
<Pressable
|
|
22
|
+
onPress={onPress}
|
|
23
|
+
style={{
|
|
24
|
+
...styles.area,
|
|
25
|
+
backgroundColor: color,
|
|
26
|
+
height: size,
|
|
27
|
+
width: size, // Added width to maintain aspect ratio
|
|
28
|
+
borderRadius: rounded,
|
|
29
|
+
}}
|
|
30
|
+
>
|
|
31
|
+
{children}
|
|
32
|
+
</Pressable>
|
|
33
|
+
);
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
const styles = StyleSheet.create({
|
|
37
|
+
area: {
|
|
38
|
+
aspectRatio: 1,
|
|
39
|
+
alignItems: 'center',
|
|
40
|
+
justifyContent: 'center',
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
|
|
44
|
+
export default Circle;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import React, { useState, ReactNode } from "react";
|
|
2
|
+
import { Pressable, ScrollView, StyleSheet, View } from "react-native";
|
|
3
|
+
import Text from "../elements/Text";
|
|
4
|
+
import Inline from "../elements/Inline";
|
|
5
|
+
import config from "../config";
|
|
6
|
+
|
|
7
|
+
// Define the props for the TabScreen component
|
|
8
|
+
interface TabScreenProps {
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
// TabScreen component
|
|
13
|
+
const TabScreen: React.FC<TabScreenProps> = ({ children }) => {
|
|
14
|
+
return <>{children}</>;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
// Define the props for the Tab component
|
|
18
|
+
interface TabProps {
|
|
19
|
+
children: React.ReactElement<{ title: string }>[];
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
// Tab component
|
|
23
|
+
const Tab: React.FC<TabProps> = ({ children }) => {
|
|
24
|
+
const [index, setIndex] = useState(0);
|
|
25
|
+
|
|
26
|
+
return (
|
|
27
|
+
<View>
|
|
28
|
+
{
|
|
29
|
+
children.length > 3 ? (
|
|
30
|
+
<ScrollView horizontal showsHorizontalScrollIndicator={false} contentContainerStyle={styles.tab_area}>
|
|
31
|
+
{children.map((child, c) => {
|
|
32
|
+
const isActive = c === index;
|
|
33
|
+
return (
|
|
34
|
+
<Pressable
|
|
35
|
+
key={c}
|
|
36
|
+
style={{
|
|
37
|
+
...styles.tab_item,
|
|
38
|
+
borderBottomColor: isActive ? config.colors.primary : config.colors.slate[200],
|
|
39
|
+
}}
|
|
40
|
+
onPress={() => setIndex(c)}
|
|
41
|
+
>
|
|
42
|
+
<Text
|
|
43
|
+
color={isActive ? config.colors.primary : config.colors.slate[500]}
|
|
44
|
+
weight={isActive ? "600SemiBold" : "400Regular"}
|
|
45
|
+
>
|
|
46
|
+
{child.props.title}
|
|
47
|
+
</Text>
|
|
48
|
+
</Pressable>
|
|
49
|
+
);
|
|
50
|
+
})}
|
|
51
|
+
</ScrollView>
|
|
52
|
+
) : (
|
|
53
|
+
<Inline style={styles.tab_area} gap={0}>
|
|
54
|
+
{children.map((child, c) => {
|
|
55
|
+
const isActive = c === index;
|
|
56
|
+
return (
|
|
57
|
+
<Inline justifyContent="center" key={c} style={{
|
|
58
|
+
...styles.tab_item,
|
|
59
|
+
borderBottomColor: isActive ? config.colors.primary : config.colors.slate[200],
|
|
60
|
+
}} onPress={() => setIndex(c)}>
|
|
61
|
+
<Text
|
|
62
|
+
color={isActive ? config.colors.primary : config.colors.slate[500]}
|
|
63
|
+
weight={isActive ? "600SemiBold" : "400Regular"}
|
|
64
|
+
>
|
|
65
|
+
{child.props.title}
|
|
66
|
+
</Text>
|
|
67
|
+
</Inline>
|
|
68
|
+
);
|
|
69
|
+
})}
|
|
70
|
+
</Inline>
|
|
71
|
+
)
|
|
72
|
+
}
|
|
73
|
+
{children[index]}
|
|
74
|
+
</View>
|
|
75
|
+
);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
const styles = StyleSheet.create({
|
|
79
|
+
tab_area: {
|
|
80
|
+
marginBottom: 10,
|
|
81
|
+
},
|
|
82
|
+
tab_item: {
|
|
83
|
+
paddingHorizontal: 20,
|
|
84
|
+
paddingVertical: 12,
|
|
85
|
+
flexGrow: 1,
|
|
86
|
+
borderBottomWidth: 1,
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
export { Tab, TabScreen };
|
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import { View, ScrollView, StyleSheet } from 'react-native';
|
|
2
|
+
import { View, ScrollView, StyleSheet, ViewStyle } from 'react-native';
|
|
3
3
|
import Text from '../elements/Text';
|
|
4
4
|
import config from '../config';
|
|
5
5
|
|
|
6
|
+
// Define the types for the Cell component props
|
|
7
|
+
interface CellProps {
|
|
8
|
+
children: React.ReactNode;
|
|
9
|
+
isHeader?: boolean;
|
|
10
|
+
width?: number;
|
|
11
|
+
flexible?: boolean;
|
|
12
|
+
}
|
|
13
|
+
|
|
6
14
|
// Cell component
|
|
7
|
-
const Cell = ({ children, isHeader, width, flexible }) => {
|
|
15
|
+
const Cell: React.FC<CellProps> = ({ children, isHeader = false, width, flexible = false }) => {
|
|
8
16
|
return (
|
|
9
17
|
<View style={[styles.cell, { width: flexible ? 'auto' : width, flex: flexible ? 1 : undefined }]}>
|
|
10
18
|
<Text weight={isHeader ? '600SemiBold' : '400Regular'}>
|
|
@@ -14,37 +22,51 @@ const Cell = ({ children, isHeader, width, flexible }) => {
|
|
|
14
22
|
);
|
|
15
23
|
};
|
|
16
24
|
|
|
25
|
+
// Define the types for the Row component props
|
|
26
|
+
interface RowProps {
|
|
27
|
+
children: React.ReactNode;
|
|
28
|
+
isHeader?: boolean;
|
|
29
|
+
cellWidth?: number;
|
|
30
|
+
flexible?: boolean;
|
|
31
|
+
}
|
|
32
|
+
|
|
17
33
|
// Row component
|
|
18
|
-
const Row = ({ children, isHeader, cellWidth, flexible }) => {
|
|
34
|
+
const Row: React.FC<RowProps> = ({ children, isHeader = false, cellWidth, flexible = false }) => {
|
|
19
35
|
return (
|
|
20
36
|
<View style={styles.row}>
|
|
21
37
|
{React.Children.map(children, (child) =>
|
|
22
|
-
React.cloneElement(child, { isHeader, width: cellWidth, flexible })
|
|
38
|
+
React.cloneElement(child as React.ReactElement, { isHeader, width: cellWidth, flexible })
|
|
23
39
|
)}
|
|
24
40
|
</View>
|
|
25
41
|
);
|
|
26
42
|
};
|
|
27
43
|
|
|
44
|
+
// Define the types for the Table component props
|
|
45
|
+
interface TableProps {
|
|
46
|
+
children: React.ReactNode;
|
|
47
|
+
cellWidth?: number;
|
|
48
|
+
}
|
|
49
|
+
|
|
28
50
|
// Table component with dynamic width adjustment and scroll if more than 3 cells
|
|
29
|
-
const Table = ({ children, cellWidth = 100 }) => {
|
|
51
|
+
const Table: React.FC<TableProps> = ({ children, cellWidth = 100 }) => {
|
|
30
52
|
// Determine if any row has more than 3 cells
|
|
31
53
|
const hasManyCells = React.Children.toArray(children).some(child => {
|
|
32
|
-
return React.Children.count(child.props.children) > 3;
|
|
54
|
+
return React.Children.count((child as React.ReactElement).props.children) > 3;
|
|
33
55
|
});
|
|
34
56
|
|
|
35
57
|
return hasManyCells ? (
|
|
36
58
|
<ScrollView horizontal>
|
|
37
|
-
<View
|
|
59
|
+
<View>
|
|
38
60
|
{React.Children.map(children, (child, index) => (
|
|
39
61
|
// Automatically pass `isHeader` for the first row (index 0)
|
|
40
|
-
React.cloneElement(child, { isHeader: index === 0, cellWidth, flexible: false })
|
|
62
|
+
React.cloneElement(child as React.ReactElement, { isHeader: index === 0, cellWidth, flexible: false })
|
|
41
63
|
))}
|
|
42
64
|
</View>
|
|
43
65
|
</ScrollView>
|
|
44
66
|
) : (
|
|
45
|
-
<View
|
|
67
|
+
<View>
|
|
46
68
|
{React.Children.map(children, (child, index) => (
|
|
47
|
-
React.cloneElement(child, { isHeader: index === 0, cellWidth, flexible: true })
|
|
69
|
+
React.cloneElement(child as React.ReactElement, { isHeader: index === 0, cellWidth, flexible: true })
|
|
48
70
|
))}
|
|
49
71
|
</View>
|
|
50
72
|
);
|
package/config.js
CHANGED
|
@@ -1,79 +1,4 @@
|
|
|
1
|
-
// config.js
|
|
2
|
-
import
|
|
3
|
-
import fs from 'fs';
|
|
1
|
+
// import config from "../../ripal-ui.config.js"
|
|
2
|
+
import config from "../ripal-ui.config.js"
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
// Define the default config
|
|
8
|
-
const defaultConfig = {
|
|
9
|
-
appName: "",
|
|
10
|
-
appLangs: {
|
|
11
|
-
default: null,
|
|
12
|
-
en: require('./lang/en.json')
|
|
13
|
-
},
|
|
14
|
-
colors: {
|
|
15
|
-
primary: "#3B82F6",
|
|
16
|
-
transparent: "#ffffff00",
|
|
17
|
-
white: "#fff",
|
|
18
|
-
slate: {
|
|
19
|
-
100: "#F1F5F9",200: "#E2E8F0",300: "#CBD5E1",
|
|
20
|
-
400: "#94A3B8",500: "#64748B",600: "#475569",
|
|
21
|
-
700: "#334155",800: "#1E293B",900: "#0F172A",
|
|
22
|
-
},
|
|
23
|
-
green: {
|
|
24
|
-
100: "#DCFCE7",200: "#BBF7D0",300: "#86EFAC ",
|
|
25
|
-
400: "#4ADE7F",500: "#22C55E",600: "#16A34A",
|
|
26
|
-
700: "#15803D",800: "#166534",900: "#14532D",
|
|
27
|
-
},
|
|
28
|
-
orange: {
|
|
29
|
-
100: "#FFEDD5",200: "#FED7AA",300: "#FDBA74",
|
|
30
|
-
400: "#FB923C",500: "#F87316",600: "#EA580C",
|
|
31
|
-
700: "#C2410C",800: "#9A3412",900: "#7C2D12",
|
|
32
|
-
},
|
|
33
|
-
purple: {
|
|
34
|
-
100: "#F3E8FF",200: "#E9D5FF",300: "#D8B4FE",
|
|
35
|
-
400: "#C084FC",500: "#A855F7",600: "#9333EA",
|
|
36
|
-
700: "#7E22CE",800: "#6B21A8",900: "#581C87",
|
|
37
|
-
},
|
|
38
|
-
blue: {
|
|
39
|
-
100: "#D8EAFE",200: "#BFD8FE",300: "#94C5FD",
|
|
40
|
-
400: "#60A5FA",500: "#3B82F6",600: "#2563EB",
|
|
41
|
-
700: "#1D4ED8",800: "#1E41AF",900: "#1E3A8A",
|
|
42
|
-
},
|
|
43
|
-
red: {
|
|
44
|
-
100: "#FEE2E2",200: "#FECACA",300: "#FCA5A5",
|
|
45
|
-
400: "#F87171",500: "#EF4444",600: "#DC2626",
|
|
46
|
-
700: "#B91C1C",800: "#991B1B",900: "#7F1D1D",
|
|
47
|
-
},
|
|
48
|
-
lime: {
|
|
49
|
-
100: "#ECFCCB",200: "#D9F99D",300: "#BEF264",
|
|
50
|
-
400: "#A3E635",500: "#84CC16",600: "#65A30D",
|
|
51
|
-
700: "#4D7C0F",800: "#3F6212",900: "#365314",
|
|
52
|
-
},
|
|
53
|
-
yellow: {
|
|
54
|
-
100: "#FEF9C3",200: "#FEF08A",300: "#FDE047",
|
|
55
|
-
400: "#FACC15",500: "#EAB308",600: "#CA8A04",
|
|
56
|
-
700: "#A16207",800: "#854D0E",900: "#713F12",
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
try {
|
|
62
|
-
// Resolve the path to ripal-ui.config.js in the user's project root
|
|
63
|
-
const configFilePath = path.resolve(process.cwd(), 'ripal-ui.config.js');
|
|
64
|
-
|
|
65
|
-
// Check if the config file exists
|
|
66
|
-
if (fs.existsSync(configFilePath)) {
|
|
67
|
-
// Load and parse the config file
|
|
68
|
-
config = require(configFilePath);
|
|
69
|
-
} else {
|
|
70
|
-
console.warn("ripal-ui.config.js not found. Using default config.");
|
|
71
|
-
config = defaultConfig;
|
|
72
|
-
}
|
|
73
|
-
} catch (error) {
|
|
74
|
-
console.error("Error loading ripal-ui.config.js:", error);
|
|
75
|
-
config = defaultConfig; // Fallback to default config in case of an error
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
// Export the loaded config
|
|
79
|
-
export default config;
|
|
4
|
+
export default config
|