@towsila/expo-ui-library 4.5.0 → 4.7.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/package.json +1 -1
- package/src/assets/icons/clock.svg +3 -0
- package/src/assets/icons/dark.svg +3 -0
- package/src/assets/icons/destination.svg +3 -0
- package/src/assets/icons/flag.svg +3 -0
- package/src/assets/icons/light.svg +11 -0
- package/src/assets/icons/warning.svg +5 -0
- package/src/components/ui/asidebar.tsx +87 -141
- package/src/components/ui/requestCard.tsx +4 -4
package/package.json
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M6.8338 3.33352V6.8338L9.16732 8.00056M12.6676 6.8338C12.6676 10.0557 10.0557 12.6676 6.8338 12.6676C3.61188 12.6676 1 10.0557 1 6.8338C1 3.61188 3.61188 1 6.8338 1C10.0557 1 12.6676 3.61188 12.6676 6.8338Z" stroke-width="1" stroke-linecap="round" stroke="currentColor"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M10.2891 1.00684C10.1017 1.63863 10 2.3074 10 3C10 6.86599 13.134 10 17 10C17.6924 10 18.3606 9.8972 18.9922 9.70996C18.9952 9.8063 19 9.90292 19 10C19 14.9706 14.9706 19 10 19C5.02944 19 1 14.9706 1 10C1 5.02944 5.02944 1 10 1C10.0967 1 10.1931 1.00381 10.2891 1.00684Z" stroke-width="2" stroke-linejoin="round" stroke="currentColor"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="16" height="19" viewBox="0 0 16 19" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M14.2324 7.56719C14.2324 11.7284 9.61702 16.0621 8.06717 17.4006C7.92279 17.5092 7.74704 17.5679 7.56639 17.5679C7.38574 17.5679 7.20999 17.5092 7.06561 17.4006C5.51576 16.0621 0.900391 11.7284 0.900391 7.56719C0.900391 5.79891 1.6027 4.10306 2.85282 2.8527C4.10293 1.60235 5.79846 0.899902 7.56639 0.899902C9.33432 0.899902 11.0298 1.60235 12.28 2.8527C13.5301 4.10306 14.2324 5.79891 14.2324 7.56719ZM10.0661 7.56719C10.0661 8.94802 8.94696 10.0674 7.56639 10.0674C6.18582 10.0674 5.06664 8.94802 5.06664 7.56719C5.06664 6.18635 6.18582 5.06695 7.56639 5.06695C8.94696 5.06695 10.0661 6.18635 10.0661 7.56719Z" stroke-width="1.8" stroke-linecap="round" stroke="currentColor"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="17" height="21" viewBox="0 0 17 21" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M0.900391 19.2347V13.3016M0.900391 13.3016V2.73338C0.900391 2.59106 0.93352 2.4507 0.997156 2.3234C1.06079 2.19611 1.15319 2.08538 1.26702 1.99999C2.21895 1.28591 3.37677 0.899902 4.56669 0.899902C7.31642 0.899902 9.14957 2.73338 11.2879 2.73338C12.51 2.73338 13.4471 2.48892 14.0991 1.99999C14.2352 1.89784 14.3972 1.83564 14.5667 1.82035C14.7362 1.80506 14.9067 1.83729 15.0589 1.91343C15.2112 1.98956 15.3392 2.1066 15.4287 2.25142C15.5182 2.39625 15.5656 2.56313 15.5656 2.73338V11.9008C15.5656 12.0431 15.5325 12.1835 15.4688 12.3108C15.4052 12.4381 15.3128 12.5488 15.199 12.6342C14.247 13.3483 13.0892 13.7343 11.8993 13.7343C9.14956 13.7343 7.31642 11.9008 4.56669 11.9008C3.21393 11.9008 1.90865 12.3995 0.900391 13.3016Z" stroke-width="1.8" stroke-linecap="round" stroke="currentColor"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<circle cx="12" cy="12" r="4" stroke="currentColor" stroke-width="2" stroke-linejoin="round"/>
|
|
3
|
+
<path d="M20 12H21" stroke-width="2" stroke-linecap="round" stroke="currentColor"/>
|
|
4
|
+
<path d="M3 12H4" stroke-width="2" stroke-linecap="round" stroke="currentColor"/>
|
|
5
|
+
<path d="M12 20L12 21" stroke-width="2" stroke-linecap="round" stroke="currentColor"/>
|
|
6
|
+
<path d="M12 3L12 4" stroke-width="2" stroke-linecap="round" stroke="currentColor"/>
|
|
7
|
+
<path d="M17.6572 17.6569L18.3643 18.364" stroke-width="2" stroke-linecap="round" stroke="currentColor"/>
|
|
8
|
+
<path d="M5.63574 5.63603L6.34285 6.34314" stroke-width="2" stroke-linecap="round" stroke="currentColor"/>
|
|
9
|
+
<path d="M6.34277 17.6569L5.63567 18.364" stroke-width="2" stroke-linecap="round" stroke="currentColor"/>
|
|
10
|
+
<path d="M18.3643 5.63603L17.6572 6.34314" stroke-width="2" stroke-linecap="round" stroke="currentColor"/>
|
|
11
|
+
</svg>
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
<svg width="22" height="22" viewBox="0 0 22 22" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M9.44172 3.57508L1.65005 16.5001C1.49033 16.7766 1.40562 17.0901 1.40431 17.4095C1.403 17.7288 1.48514 18.043 1.64259 18.3208C1.80004 18.5987 2.02734 18.8306 2.30198 18.9936C2.57661 19.1566 2.88906 19.245 3.20838 19.2501H18.7917C19.111 19.245 19.4235 19.1566 19.6981 18.9936C19.9728 18.8306 20.2001 18.5987 20.3575 18.3208C20.515 18.043 20.5971 17.7288 20.5958 17.4095C20.5945 17.0901 20.5098 16.7766 20.35 16.5001L12.5584 3.57508C12.394 3.30978 12.1645 3.09085 11.8918 2.93903C11.6191 2.78721 11.3122 2.70752 11.0001 2.70752C10.6879 2.70752 10.381 2.78721 10.1083 2.93903C9.83557 3.09085 9.60614 3.30978 9.44172 3.57508Z" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor"/>
|
|
3
|
+
<path d="M11 8.25V11.9167" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor"/>
|
|
4
|
+
<path d="M11 15.5835H11.0092" stroke-width="1.8" stroke-linecap="round" stroke-linejoin="round" stroke="currentColor"/>
|
|
5
|
+
</svg>
|
|
@@ -1,154 +1,100 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import ThemeToggle from "./themeToggle";
|
|
1
|
+
import { useRef, useEffect } from "react";
|
|
2
|
+
import { Animated, TouchableOpacity, View, Text } from "react-native";
|
|
3
|
+
import DarkMode from "@/assets/images/icons/dark.svg";
|
|
4
|
+
import LightMode from "@/assets/images/icons/light.svg";
|
|
6
5
|
import { useAppTheme } from "../../context/ThemeContext";
|
|
7
6
|
import { useLanguage } from "../../context/LanguageContext";
|
|
8
|
-
import { Menu } from "../../types/menu";
|
|
9
|
-
import LanguageSelect from "./languageSelect";
|
|
10
7
|
import { Fonts, textSize } from "../../tokens/typography";
|
|
11
|
-
const SIDEBAR_WIDTH = Dimensions.get("window").width * 0.7;
|
|
12
8
|
|
|
13
|
-
interface
|
|
14
|
-
|
|
15
|
-
onClose: () => void;
|
|
16
|
-
logo: React.ReactNode;
|
|
17
|
-
name?: string;
|
|
18
|
-
menu: Menu[];
|
|
19
|
-
onLogout: ()=>void;
|
|
20
|
-
logoutLabel: string;
|
|
21
|
-
onNavigate: (link: string) => void;
|
|
22
|
-
themeLabel?:string;
|
|
9
|
+
interface TextTheme {
|
|
10
|
+
label?: string;
|
|
23
11
|
}
|
|
24
12
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
const fadeAnim = useRef(new Animated.Value(0)).current;
|
|
13
|
+
const TRACK_W = 52;
|
|
14
|
+
const TRACK_H = 30;
|
|
15
|
+
const THUMB = 22;
|
|
16
|
+
const MARGIN = 4;
|
|
17
|
+
const TRAVEL = TRACK_W - THUMB - MARGIN * 2;
|
|
31
18
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
toValue: 0,
|
|
37
|
-
duration: 250,
|
|
38
|
-
useNativeDriver: true,
|
|
39
|
-
}),
|
|
40
|
-
Animated.timing(fadeAnim, {
|
|
41
|
-
toValue: 1,
|
|
42
|
-
duration: 250,
|
|
43
|
-
useNativeDriver: true,
|
|
44
|
-
}),
|
|
45
|
-
]).start();
|
|
46
|
-
} else {
|
|
47
|
-
Animated.parallel([
|
|
48
|
-
Animated.timing(slideAnim, {
|
|
49
|
-
toValue: -SIDEBAR_WIDTH,
|
|
50
|
-
duration: 200,
|
|
51
|
-
useNativeDriver: true,
|
|
52
|
-
}),
|
|
53
|
-
Animated.timing(fadeAnim, {
|
|
54
|
-
toValue: 0,
|
|
55
|
-
duration: 200,
|
|
56
|
-
useNativeDriver: true,
|
|
57
|
-
}),
|
|
58
|
-
]).start();
|
|
59
|
-
}
|
|
60
|
-
}, [visible]);
|
|
19
|
+
export default function ThemeToggle({ label }: TextTheme) {
|
|
20
|
+
const { isDark, toggleTheme, colors } = useAppTheme();
|
|
21
|
+
const { isRTL } = useLanguage();
|
|
22
|
+
const progress = useRef(new Animated.Value(isDark ? 1 : 0)).current;
|
|
61
23
|
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
width: SIDEBAR_WIDTH,
|
|
70
|
-
backgroundColor: colors.background.main,
|
|
71
|
-
paddingHorizontal: 20,
|
|
72
|
-
paddingVertical:50,
|
|
73
|
-
transform: [{ translateX: slideAnim }],
|
|
74
|
-
}}>
|
|
75
|
-
{/* top container */}
|
|
76
|
-
<View style={{flex: 1, gap: 30}}>
|
|
77
|
-
{/* logo, name and language row */}
|
|
78
|
-
<View style={{flexDirection: "row", alignItems:"center", justifyContent:"space-between"}}>
|
|
79
|
-
<View style={{flexDirection: "row", alignItems: "center", gap: 6}}>
|
|
80
|
-
{logo}
|
|
81
|
-
</View>
|
|
82
|
-
<View>
|
|
83
|
-
<LanguageSelect value={language} onChange={setLanguage} />
|
|
84
|
-
</View>
|
|
85
|
-
</View>
|
|
24
|
+
useEffect(() => {
|
|
25
|
+
Animated.spring(progress, {
|
|
26
|
+
toValue: isDark ? 1 : 0,
|
|
27
|
+
useNativeDriver: true,
|
|
28
|
+
bounciness: 6,
|
|
29
|
+
}).start();
|
|
30
|
+
}, [isDark]);
|
|
86
31
|
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
<TouchableOpacity
|
|
93
|
-
key={index}
|
|
94
|
-
style={{
|
|
95
|
-
flexDirection: "row",
|
|
96
|
-
alignItems: "center",
|
|
97
|
-
gap: 12,
|
|
98
|
-
paddingVertical: 14,
|
|
99
|
-
paddingHorizontal: 16,
|
|
100
|
-
borderRadius: 10,
|
|
101
|
-
backgroundColor: isActive ? colors.primary + "20" : "transparent"
|
|
102
|
-
}}
|
|
103
|
-
onPress={() => {
|
|
104
|
-
setActiveIndex(index);
|
|
105
|
-
onNavigate(item.link);
|
|
106
|
-
onClose();
|
|
107
|
-
}}
|
|
108
|
-
>
|
|
109
|
-
{item.iconSvg && (
|
|
110
|
-
<View style={[I18nManager.isRTL && {transform: [{ scaleX: -1 }]} ]}>
|
|
111
|
-
{item.iconSvg(isActive ? colors.primary : "transparent")}
|
|
112
|
-
</View>
|
|
113
|
-
)}
|
|
114
|
-
<Text style={{
|
|
115
|
-
fontFamily: isActive ? Fonts.montserrat.semiBold : Fonts.montserrat.regular,
|
|
116
|
-
fontSize: textSize.md,
|
|
117
|
-
color: isActive ? colors.primary : colors.text.primary,
|
|
118
|
-
flex:1
|
|
119
|
-
}}>
|
|
120
|
-
{item.name}
|
|
121
|
-
</Text>
|
|
122
|
-
</TouchableOpacity>
|
|
123
|
-
);
|
|
124
|
-
})}
|
|
125
|
-
</View>
|
|
126
|
-
</View>
|
|
32
|
+
// in RTL the thumb travels the other way
|
|
33
|
+
const translateX = progress.interpolate({
|
|
34
|
+
inputRange: [0, 1],
|
|
35
|
+
outputRange: isRTL ? [0, TRAVEL] : [0, -TRAVEL],
|
|
36
|
+
});
|
|
127
37
|
|
|
128
|
-
{/* bottom container */}
|
|
129
|
-
<View style={{ gap: 16, paddingHorizontal: 16, }}>
|
|
130
|
-
<TouchableOpacity onPress={onLogout} style={{ flexDirection: "row", alignItems: "center", gap: 10 }}>
|
|
131
|
-
<Logout width={22} height={22} color={colors.semantic.error} style={[I18nManager.isRTL && {transform: [{scale:-1}]}]}/>
|
|
132
|
-
<Text style={{
|
|
133
|
-
fontFamily: Fonts.montserrat.regular,
|
|
134
|
-
fontSize: textSize.md,
|
|
135
|
-
color: colors.text.primary,
|
|
136
|
-
}}>
|
|
137
|
-
{logoutLabel}
|
|
138
|
-
</Text>
|
|
139
|
-
</TouchableOpacity>
|
|
140
|
-
<ThemeToggle label={themeLabel}/>
|
|
141
|
-
</View>
|
|
142
|
-
</Animated.View>
|
|
143
38
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
39
|
+
return (
|
|
40
|
+
<View style={{ flexDirection: isRTL ? "row" : "row-reverse", alignItems: "center",justifyContent:"space-between"}}>
|
|
41
|
+
<View style={{flexDirection: isRTL ? "row" : "row-reverse", gap: isDark ? 20:17}}>
|
|
42
|
+
{isDark ? (
|
|
43
|
+
<DarkMode width={22} height={22} color={colors.text.primary} />
|
|
44
|
+
) : (
|
|
45
|
+
<LightMode width={26} height={26} color={colors.text.primary} />
|
|
46
|
+
)}
|
|
47
|
+
|
|
48
|
+
{label && (
|
|
49
|
+
<Text style={{ fontFamily: Fonts.montserrat.semiBold, fontSize: textSize.md, color: colors.text.primary }}>
|
|
50
|
+
{label}
|
|
51
|
+
</Text>
|
|
52
|
+
)}
|
|
53
|
+
</View>
|
|
54
|
+
<TouchableOpacity
|
|
55
|
+
onPress={toggleTheme}
|
|
56
|
+
activeOpacity={0.9}
|
|
57
|
+
accessibilityRole="switch"
|
|
58
|
+
accessibilityState={{ checked: isDark }}
|
|
59
|
+
>
|
|
60
|
+
<View
|
|
61
|
+
style={{
|
|
62
|
+
width: TRACK_W,
|
|
63
|
+
height: TRACK_H,
|
|
64
|
+
borderRadius: TRACK_H / 2,
|
|
65
|
+
backgroundColor: colors.primary,
|
|
66
|
+
borderWidth: 1,
|
|
67
|
+
borderColor: colors.text.primary,
|
|
68
|
+
justifyContent: "center",
|
|
69
|
+
}}
|
|
70
|
+
>
|
|
71
|
+
<Animated.View
|
|
72
|
+
style={{
|
|
73
|
+
position: "absolute",
|
|
74
|
+
top: (TRACK_H - THUMB) / 2 - 1,
|
|
75
|
+
...(isRTL ? { right: MARGIN - 1 } : { left: MARGIN - 1 }),
|
|
76
|
+
width: THUMB,
|
|
77
|
+
height: THUMB,
|
|
78
|
+
borderRadius: THUMB / 2,
|
|
79
|
+
backgroundColor: colors.text.primary,
|
|
80
|
+
alignItems: "center",
|
|
81
|
+
justifyContent: "center",
|
|
82
|
+
transform: [{ translateX }],
|
|
83
|
+
elevation: 3,
|
|
84
|
+
shadowColor: "#000",
|
|
85
|
+
shadowOffset: { width: 0, height: 2 },
|
|
86
|
+
shadowOpacity: 0.25,
|
|
87
|
+
shadowRadius: 3,
|
|
88
|
+
}}
|
|
89
|
+
>
|
|
90
|
+
{isDark ? (
|
|
91
|
+
<LightMode width={16} height={16} color={colors.background.main} />
|
|
92
|
+
) : (
|
|
93
|
+
<DarkMode width={12} height={12} color={colors.background.main} />
|
|
94
|
+
)}
|
|
95
|
+
</Animated.View>
|
|
151
96
|
</View>
|
|
152
|
-
|
|
153
|
-
|
|
97
|
+
</TouchableOpacity>
|
|
98
|
+
</View>
|
|
99
|
+
);
|
|
154
100
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { View, Text } from "react-native";
|
|
2
|
-
import Clock from "
|
|
3
|
-
import Destination from "
|
|
4
|
-
import Flag from "
|
|
5
|
-
import Warning from "
|
|
2
|
+
import Clock from "../../assets/icons/clock.svg";
|
|
3
|
+
import Destination from "../../assets/icons/destination.svg";
|
|
4
|
+
import Flag from "../../assets/icons/flag.svg";
|
|
5
|
+
import Warning from "../../assets/icons/warning.svg";
|
|
6
6
|
import { SvgProps } from "react-native-svg";
|
|
7
7
|
import { useAppTheme } from "../../context/ThemeContext";
|
|
8
8
|
import { useRelativeTime } from "../../hooks/useRelativeTime";
|