ripal-ui 1.1.394 → 2.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.
- package/README.md +3 -0
- package/components/Alert.jsx +74 -0
- package/components/Avatar.jsx +157 -0
- package/components/Button.jsx +58 -0
- package/components/COLORS.js +138 -0
- package/components/Checkbox.jsx +51 -0
- package/components/Dialog.jsx +221 -0
- package/components/Divider.jsx +62 -0
- package/components/Dropdown.jsx +229 -0
- package/components/Inline.jsx +37 -0
- package/components/Input.jsx +89 -0
- package/components/Rate.jsx +39 -0
- package/components/Slider.jsx +219 -0
- package/components/Switch.jsx +45 -0
- package/components/Table.jsx +67 -0
- package/components/Text.jsx +56 -0
- package/components/Toggle.jsx +88 -0
- package/index.js +16 -2
- package/package.json +20 -20
- package/babel.config.js +0 -3
- package/components/BottomSheet.tsx +0 -197
- package/components/Carousel.tsx +0 -61
- package/components/Circle.tsx +0 -44
- package/components/DatePicker.jsx +0 -181
- package/components/Tab.tsx +0 -90
- package/components/Table.tsx +0 -95
- package/components/index.ts +0 -5
- package/config.js +0 -4
- package/dist/BottomSheet.js +0 -186
- package/dist/Button.js +0 -109
- package/dist/Carousel.js +0 -52
- package/dist/Circle.js +0 -42
- package/dist/DatePicker.js +0 -199
- package/dist/Dialog.js +0 -81
- package/dist/Dropdown.js +0 -97
- package/dist/Inline.js +0 -38
- package/dist/Input.js +0 -88
- package/dist/ProgressBar.js +0 -64
- package/dist/Separator.js +0 -47
- package/dist/Skeleton.js +0 -62
- package/dist/Switch.js +0 -74
- package/dist/Tab.js +0 -85
- package/dist/Table.js +0 -96
- package/dist/Text.js +0 -78
- package/dist/Toast.js +0 -72
- package/dist/Toggle.js +0 -54
- package/dist/index.js +0 -96
- package/elements/Button.tsx +0 -121
- package/elements/ColorPicker.tsx +0 -70
- package/elements/Dialog.tsx +0 -87
- package/elements/Dropdown.tsx +0 -88
- package/elements/Inline.tsx +0 -52
- package/elements/Input.tsx +0 -83
- package/elements/ProgressBar.tsx +0 -52
- package/elements/SecureStorage.js +0 -27
- package/elements/Separator.tsx +0 -71
- package/elements/Skeleton.tsx +0 -64
- package/elements/Slider.tsx +0 -133
- package/elements/Switch.tsx +0 -63
- package/elements/Text.tsx +0 -95
- package/elements/Toast.tsx +0 -71
- package/elements/Toggle.tsx +0 -59
- package/elements/index.js +0 -14
- package/index.d.ts +0 -237
- package/scripts/generateConfig.js +0 -80
|
@@ -1,197 +0,0 @@
|
|
|
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;
|
package/components/Carousel.tsx
DELETED
|
@@ -1,61 +0,0 @@
|
|
|
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 };
|
package/components/Circle.tsx
DELETED
|
@@ -1,44 +0,0 @@
|
|
|
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;
|
|
@@ -1,181 +0,0 @@
|
|
|
1
|
-
import React, { useState } from 'react';
|
|
2
|
-
import { View, TouchableOpacity, StyleSheet } from 'react-native';
|
|
3
|
-
import moment from 'moment';
|
|
4
|
-
import config from '../config';
|
|
5
|
-
import Text from '../elements/Text';
|
|
6
|
-
import Circle from './Circle';
|
|
7
|
-
import { Ionicons } from '@expo/vector-icons';
|
|
8
|
-
|
|
9
|
-
// Calendar component
|
|
10
|
-
const CalendarView = () => {
|
|
11
|
-
const [selectedDate, setSelectedDate] = useState(moment());
|
|
12
|
-
|
|
13
|
-
// Get the start of the current month
|
|
14
|
-
const startOfMonth = selectedDate.clone().startOf('month');
|
|
15
|
-
|
|
16
|
-
// Get the days to display in the calendar
|
|
17
|
-
const daysInMonth = selectedDate.daysInMonth();
|
|
18
|
-
const startDayOfWeek = startOfMonth.day(); // Get the day of the week (0-6)
|
|
19
|
-
|
|
20
|
-
// Get current day (to highlight it)
|
|
21
|
-
const currentDay = moment();
|
|
22
|
-
|
|
23
|
-
// Function to handle month navigation
|
|
24
|
-
const changeMonth = (direction) => {
|
|
25
|
-
const newDate = selectedDate.clone().add(direction, 'month');
|
|
26
|
-
setSelectedDate(newDate);
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
// Function to handle date selection
|
|
30
|
-
const selectDate = (day) => {
|
|
31
|
-
const newSelectedDate = selectedDate.clone().date(day);
|
|
32
|
-
setSelectedDate(newSelectedDate);
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
// Render the day headers (Sun, Mon, etc.)
|
|
36
|
-
const renderDayHeaders = () => {
|
|
37
|
-
const dayNames = moment.weekdaysShort(); // ['Sun', 'Mon', ...]
|
|
38
|
-
return (
|
|
39
|
-
<View style={styles.dayHeaderRow}>
|
|
40
|
-
{dayNames.map((day, index) => (
|
|
41
|
-
<Text weight='600SemiBold' color={config.colors.slate[600]} key={index}>{day}</Text>
|
|
42
|
-
))}
|
|
43
|
-
</View>
|
|
44
|
-
);
|
|
45
|
-
};
|
|
46
|
-
|
|
47
|
-
// Generate the list of days for the calendar (including blank days for padding)
|
|
48
|
-
const renderCalendarDays = () => {
|
|
49
|
-
const days = [];
|
|
50
|
-
// Add blank spaces for the days before the start of the month
|
|
51
|
-
for (let i = 0; i < startDayOfWeek; i++) {
|
|
52
|
-
days.push(null);
|
|
53
|
-
}
|
|
54
|
-
// Add actual days of the month
|
|
55
|
-
for (let i = 1; i <= daysInMonth; i++) {
|
|
56
|
-
days.push(i);
|
|
57
|
-
}
|
|
58
|
-
return days;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
return (
|
|
62
|
-
<View style={styles.container}>
|
|
63
|
-
{/* Month Navigation */}
|
|
64
|
-
<View style={styles.monthContainer}>
|
|
65
|
-
<Circle color='#fff' onPress={() => changeMonth(-1)}>
|
|
66
|
-
<Ionicons name="chevron-back-outline" />
|
|
67
|
-
</Circle>
|
|
68
|
-
<Text style={{flexGrow: 1}} align='center' color={config.colors.primary} weight='600SemiBold'>
|
|
69
|
-
{selectedDate.format('MMMM YYYY')}
|
|
70
|
-
</Text>
|
|
71
|
-
<Circle color='#fff' onPress={() => changeMonth(1)}>
|
|
72
|
-
<Ionicons name="chevron-forward-outline" />
|
|
73
|
-
</Circle>
|
|
74
|
-
</View>
|
|
75
|
-
|
|
76
|
-
<Text>{selectedDate.format('Y-mm-DD')}</Text>
|
|
77
|
-
|
|
78
|
-
{/* Day Headers */}
|
|
79
|
-
{renderDayHeaders()}
|
|
80
|
-
|
|
81
|
-
{/* Calendar Days */}
|
|
82
|
-
<View style={styles.daysGrid}>
|
|
83
|
-
{renderCalendarDays().map((day, index) => {
|
|
84
|
-
let isActive = day === selectedDate.date() && selectedDate.isSame(currentDay, 'month');
|
|
85
|
-
return (
|
|
86
|
-
(
|
|
87
|
-
<TouchableOpacity
|
|
88
|
-
key={index}
|
|
89
|
-
style={{
|
|
90
|
-
...styles.dayContainer,
|
|
91
|
-
backgroundColor: isActive ? config.colors.primary : '#fff'
|
|
92
|
-
}}
|
|
93
|
-
onPress={() => day && selectDate(day)}
|
|
94
|
-
>
|
|
95
|
-
{day ? (
|
|
96
|
-
<Text color={isActive ? '#fff' : config.colors.slate[500]} style={[
|
|
97
|
-
styles.dayText,
|
|
98
|
-
// Highlight current day in bold
|
|
99
|
-
day === currentDay.date() && selectedDate.isSame(currentDay, 'month') ? styles.currentDayText : null,
|
|
100
|
-
]}>
|
|
101
|
-
{day}
|
|
102
|
-
</Text>
|
|
103
|
-
) : (
|
|
104
|
-
<Text style={styles.blankDay}></Text>
|
|
105
|
-
)}
|
|
106
|
-
</TouchableOpacity>
|
|
107
|
-
)
|
|
108
|
-
)
|
|
109
|
-
})}
|
|
110
|
-
</View>
|
|
111
|
-
</View>
|
|
112
|
-
);
|
|
113
|
-
};
|
|
114
|
-
|
|
115
|
-
const styles = StyleSheet.create({
|
|
116
|
-
container: {
|
|
117
|
-
padding: 16,
|
|
118
|
-
backgroundColor: '#fff',
|
|
119
|
-
flex: 1,
|
|
120
|
-
},
|
|
121
|
-
monthContainer: {
|
|
122
|
-
flexDirection: 'row',
|
|
123
|
-
justifyContent: 'space-between',
|
|
124
|
-
alignItems: 'center',
|
|
125
|
-
marginBottom: 16,
|
|
126
|
-
},
|
|
127
|
-
monthText: {
|
|
128
|
-
fontSize: 20,
|
|
129
|
-
fontWeight: 'bold',
|
|
130
|
-
},
|
|
131
|
-
navButton: {
|
|
132
|
-
fontSize: 16,
|
|
133
|
-
color: '#007bff',
|
|
134
|
-
},
|
|
135
|
-
dayHeaderRow: {
|
|
136
|
-
flexDirection: 'row',
|
|
137
|
-
justifyContent: 'space-between',
|
|
138
|
-
marginBottom: 10,
|
|
139
|
-
},
|
|
140
|
-
dayHeaderText: {
|
|
141
|
-
width: '14%', // Ensure each day header takes up 1/7 of the row
|
|
142
|
-
textAlign: 'center',
|
|
143
|
-
fontWeight: 'bold',
|
|
144
|
-
},
|
|
145
|
-
daysGrid: {
|
|
146
|
-
flexDirection: 'row',
|
|
147
|
-
flexWrap: 'wrap',
|
|
148
|
-
},
|
|
149
|
-
dayContainer: {
|
|
150
|
-
width: '14.28%', // Ensures 7 items per row (100 / 7 = 14.28)
|
|
151
|
-
height: 46,
|
|
152
|
-
justifyContent: 'center',
|
|
153
|
-
alignItems: 'center',
|
|
154
|
-
borderRadius: 999,
|
|
155
|
-
},
|
|
156
|
-
dayText: {
|
|
157
|
-
fontSize: 16,
|
|
158
|
-
},
|
|
159
|
-
selectedDayText: {
|
|
160
|
-
backgroundColor: '#007bff',
|
|
161
|
-
color: '#fff',
|
|
162
|
-
borderRadius: 20,
|
|
163
|
-
// paddingHorizontal: 10,
|
|
164
|
-
// paddingVertical: 5,
|
|
165
|
-
},
|
|
166
|
-
selectedDayHighlight: {
|
|
167
|
-
backgroundColor: '#007bff',
|
|
168
|
-
color: '#fff',
|
|
169
|
-
borderRadius: 20,
|
|
170
|
-
paddingHorizontal: 10,
|
|
171
|
-
paddingVertical: 5,
|
|
172
|
-
},
|
|
173
|
-
currentDayText: {
|
|
174
|
-
fontWeight: 'bold', // Bold the current day
|
|
175
|
-
},
|
|
176
|
-
blankDay: {
|
|
177
|
-
height: 0,
|
|
178
|
-
},
|
|
179
|
-
});
|
|
180
|
-
|
|
181
|
-
export default CalendarView;
|
package/components/Tab.tsx
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
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 };
|
package/components/Table.tsx
DELETED
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { View, ScrollView, StyleSheet, ViewStyle } from 'react-native';
|
|
3
|
-
import Text from '../elements/Text';
|
|
4
|
-
import config from '../config';
|
|
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
|
-
|
|
14
|
-
// Cell component
|
|
15
|
-
const Cell: React.FC<CellProps> = ({ children, isHeader = false, width, flexible = false }) => {
|
|
16
|
-
return (
|
|
17
|
-
<View style={[styles.cell, { width: flexible ? 'auto' : width, flex: flexible ? 1 : undefined }]}>
|
|
18
|
-
<Text weight={isHeader ? '600SemiBold' : '400Regular'}>
|
|
19
|
-
{children}
|
|
20
|
-
</Text>
|
|
21
|
-
</View>
|
|
22
|
-
);
|
|
23
|
-
};
|
|
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
|
-
|
|
33
|
-
// Row component
|
|
34
|
-
const Row: React.FC<RowProps> = ({ children, isHeader = false, cellWidth, flexible = false }) => {
|
|
35
|
-
return (
|
|
36
|
-
<View style={styles.row}>
|
|
37
|
-
{React.Children.map(children, (child) =>
|
|
38
|
-
React.cloneElement(child as React.ReactElement, { isHeader, width: cellWidth, flexible })
|
|
39
|
-
)}
|
|
40
|
-
</View>
|
|
41
|
-
);
|
|
42
|
-
};
|
|
43
|
-
|
|
44
|
-
// Define the types for the Table component props
|
|
45
|
-
interface TableProps {
|
|
46
|
-
children: React.ReactNode;
|
|
47
|
-
cellWidth?: number;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
// Table component with dynamic width adjustment and scroll if more than 3 cells
|
|
51
|
-
const Table: React.FC<TableProps> = ({ children, cellWidth = 100 }) => {
|
|
52
|
-
// Determine if any row has more than 3 cells
|
|
53
|
-
const hasManyCells = React.Children.toArray(children).some(child => {
|
|
54
|
-
return React.Children.count((child as React.ReactElement).props.children) > 3;
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
return hasManyCells ? (
|
|
58
|
-
<ScrollView horizontal>
|
|
59
|
-
<View>
|
|
60
|
-
{React.Children.map(children, (child, index) => (
|
|
61
|
-
// Automatically pass `isHeader` for the first row (index 0)
|
|
62
|
-
React.cloneElement(child as React.ReactElement, { isHeader: index === 0, cellWidth, flexible: false })
|
|
63
|
-
))}
|
|
64
|
-
</View>
|
|
65
|
-
</ScrollView>
|
|
66
|
-
) : (
|
|
67
|
-
<View>
|
|
68
|
-
{React.Children.map(children, (child, index) => (
|
|
69
|
-
React.cloneElement(child as React.ReactElement, { isHeader: index === 0, cellWidth, flexible: true })
|
|
70
|
-
))}
|
|
71
|
-
</View>
|
|
72
|
-
);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
export { Table, Row, Cell };
|
|
76
|
-
|
|
77
|
-
const styles = StyleSheet.create({
|
|
78
|
-
row: {
|
|
79
|
-
flexDirection: 'row',
|
|
80
|
-
borderBottomWidth: 1,
|
|
81
|
-
borderColor: config.colors.slate[200],
|
|
82
|
-
},
|
|
83
|
-
cell: {
|
|
84
|
-
padding: 10,
|
|
85
|
-
borderColor: config.colors.slate[200],
|
|
86
|
-
justifyContent: 'center',
|
|
87
|
-
},
|
|
88
|
-
cellText: {
|
|
89
|
-
fontSize: 16,
|
|
90
|
-
},
|
|
91
|
-
headerText: {
|
|
92
|
-
fontSize: 16,
|
|
93
|
-
fontWeight: 'bold',
|
|
94
|
-
}
|
|
95
|
-
});
|
package/components/index.ts
DELETED
package/config.js
DELETED