@popp0102/nova 0.6.6 → 0.6.7
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/lib/components/Badge/config.js +21 -0
- package/lib/components/{Badge.js → Badge/index.js} +3 -22
- package/lib/components/Card/config.js +12 -0
- package/lib/components/{Card.js → Card/index.js} +2 -12
- package/lib/components/IconButton/config.js +10 -0
- package/lib/components/{IconButton.js → IconButton/index.js} +2 -10
- package/lib/components/Modal/config.js +42 -0
- package/lib/components/{Modal.js → Modal/index.js} +3 -45
- package/lib/components/Subtitle/config.js +13 -0
- package/lib/components/Subtitle/index.js +12 -0
- package/lib/components/Title/config.js +14 -0
- package/lib/components/Title/index.js +12 -0
- package/lib/components/animations/FadeView/config.js +6 -0
- package/lib/components/animations/FadeView/index.js +27 -0
- package/lib/components/animations/ShakeView/config.js +5 -0
- package/lib/components/animations/{ShakeView.js → ShakeView/index.js} +4 -3
- package/lib/components/animations/SlideView/config.js +8 -0
- package/lib/components/animations/{SlideView.js → SlideView/index.js} +8 -16
- package/package.json +1 -1
- package/lib/components/Subtitle.js +0 -23
- package/lib/components/Title.js +0 -24
- package/lib/components/animations/FadeView.js +0 -33
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const sizes = {
|
|
4
|
+
small: 12,
|
|
5
|
+
medium: 14,
|
|
6
|
+
large: 16,
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export const styles = StyleSheet.create({
|
|
10
|
+
container: {
|
|
11
|
+
flexDirection: 'row',
|
|
12
|
+
alignItems: 'center',
|
|
13
|
+
gap: 4,
|
|
14
|
+
padding: 8,
|
|
15
|
+
borderRadius: 24,
|
|
16
|
+
alignSelf: "flex-start",
|
|
17
|
+
},
|
|
18
|
+
text: {
|
|
19
|
+
fontWeight: '600',
|
|
20
|
+
},
|
|
21
|
+
});
|
|
@@ -1,11 +1,6 @@
|
|
|
1
|
-
import { View, Text
|
|
1
|
+
import { View, Text } from 'react-native';
|
|
2
2
|
import { MaterialIcons } from '@expo/vector-icons';
|
|
3
|
-
|
|
4
|
-
const SIZES = {
|
|
5
|
-
small: 12,
|
|
6
|
-
medium: 14,
|
|
7
|
-
large: 16,
|
|
8
|
-
};
|
|
3
|
+
import { sizes, styles } from './config';
|
|
9
4
|
|
|
10
5
|
export default function Badge({
|
|
11
6
|
children,
|
|
@@ -17,7 +12,7 @@ export default function Badge({
|
|
|
17
12
|
size = 'large',
|
|
18
13
|
style
|
|
19
14
|
}) {
|
|
20
|
-
const fontSize =
|
|
15
|
+
const fontSize = sizes[size] || sizes.large;
|
|
21
16
|
|
|
22
17
|
return (
|
|
23
18
|
<View style={style}>
|
|
@@ -29,17 +24,3 @@ export default function Badge({
|
|
|
29
24
|
</View>
|
|
30
25
|
);
|
|
31
26
|
}
|
|
32
|
-
|
|
33
|
-
const styles = StyleSheet.create({
|
|
34
|
-
container: {
|
|
35
|
-
flexDirection: 'row',
|
|
36
|
-
alignItems: 'center',
|
|
37
|
-
gap: 4,
|
|
38
|
-
padding: 8,
|
|
39
|
-
borderRadius: 24,
|
|
40
|
-
alignSelf: "flex-start",
|
|
41
|
-
},
|
|
42
|
-
text: {
|
|
43
|
-
fontWeight: '600',
|
|
44
|
-
},
|
|
45
|
-
});
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import { View, Pressable
|
|
1
|
+
import { View, Pressable } from "react-native";
|
|
2
|
+
import { styles } from './config';
|
|
2
3
|
|
|
3
4
|
export default function Card({ children, onPress, style }) {
|
|
4
5
|
const cardContent = (
|
|
@@ -20,14 +21,3 @@ export default function Card({ children, onPress, style }) {
|
|
|
20
21
|
|
|
21
22
|
return cardContent;
|
|
22
23
|
}
|
|
23
|
-
|
|
24
|
-
const styles = StyleSheet.create({
|
|
25
|
-
card: {
|
|
26
|
-
backgroundColor: 'white',
|
|
27
|
-
borderRadius: 16,
|
|
28
|
-
padding: 16,
|
|
29
|
-
},
|
|
30
|
-
cardPressed: {
|
|
31
|
-
opacity: 0.5,
|
|
32
|
-
},
|
|
33
|
-
});
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { Pressable
|
|
1
|
+
import { Pressable } from "react-native";
|
|
2
2
|
import { MaterialIcons } from '@expo/vector-icons';
|
|
3
|
+
import { styles } from './config';
|
|
3
4
|
|
|
4
5
|
export default function IconButton({ name, size = 24, color = 'black', onPress }) {
|
|
5
6
|
return (
|
|
@@ -14,12 +15,3 @@ export default function IconButton({ name, size = 24, color = 'black', onPress }
|
|
|
14
15
|
</Pressable>
|
|
15
16
|
);
|
|
16
17
|
}
|
|
17
|
-
|
|
18
|
-
const styles = StyleSheet.create({
|
|
19
|
-
button: {
|
|
20
|
-
padding: 4,
|
|
21
|
-
},
|
|
22
|
-
pressed: {
|
|
23
|
-
opacity: 0.5,
|
|
24
|
-
},
|
|
25
|
-
});
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { StyleSheet } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export const styles = StyleSheet.create({
|
|
4
|
+
backdrop: {
|
|
5
|
+
flex: 1,
|
|
6
|
+
alignItems: "center",
|
|
7
|
+
justifyContent: "center",
|
|
8
|
+
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
|
9
|
+
},
|
|
10
|
+
container: {
|
|
11
|
+
width: "75%",
|
|
12
|
+
padding: 8,
|
|
13
|
+
borderRadius: 24,
|
|
14
|
+
backgroundColor: "#CCCCCC",
|
|
15
|
+
},
|
|
16
|
+
header: {
|
|
17
|
+
width: "100%",
|
|
18
|
+
paddingTop: 16,
|
|
19
|
+
paddingHorizontal: 16,
|
|
20
|
+
},
|
|
21
|
+
title: {
|
|
22
|
+
marginTop: 16,
|
|
23
|
+
fontSize: 24,
|
|
24
|
+
fontWeight: "bold",
|
|
25
|
+
color: "black",
|
|
26
|
+
},
|
|
27
|
+
body: {
|
|
28
|
+
paddingHorizontal: 16,
|
|
29
|
+
paddingVertical: 24,
|
|
30
|
+
gap: 8,
|
|
31
|
+
},
|
|
32
|
+
footer: {
|
|
33
|
+
flexDirection: "row",
|
|
34
|
+
alignItems: "center",
|
|
35
|
+
justifyContent: "flex-end",
|
|
36
|
+
gap: 8,
|
|
37
|
+
paddingVertical: 8,
|
|
38
|
+
},
|
|
39
|
+
button: {
|
|
40
|
+
flex: 0.25,
|
|
41
|
+
},
|
|
42
|
+
});
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { View, Text, Modal as RNModal
|
|
1
|
+
import { View, Text, Modal as RNModal } from "react-native";
|
|
2
2
|
import { SafeAreaView } from "react-native-safe-area-context";
|
|
3
|
-
|
|
4
|
-
import
|
|
3
|
+
import Button from "../Button";
|
|
4
|
+
import { styles } from './config';
|
|
5
5
|
|
|
6
6
|
export default function Modal({ visible, title, onConfirm, onClose, children, includeFooter = true }) {
|
|
7
7
|
return (
|
|
@@ -25,45 +25,3 @@ export default function Modal({ visible, title, onConfirm, onClose, children, in
|
|
|
25
25
|
</RNModal>
|
|
26
26
|
);
|
|
27
27
|
}
|
|
28
|
-
|
|
29
|
-
const styles = StyleSheet.create({
|
|
30
|
-
backdrop: {
|
|
31
|
-
flex: 1,
|
|
32
|
-
alignItems: "center",
|
|
33
|
-
justifyContent: "center",
|
|
34
|
-
backgroundColor: "rgba(0, 0, 0, 0.75)",
|
|
35
|
-
},
|
|
36
|
-
container: {
|
|
37
|
-
width: "75%",
|
|
38
|
-
padding: 8,
|
|
39
|
-
borderRadius: 24,
|
|
40
|
-
backgroundColor: "#CCCCCC",
|
|
41
|
-
},
|
|
42
|
-
header: {
|
|
43
|
-
width: "100%",
|
|
44
|
-
paddingTop: 16,
|
|
45
|
-
paddingHorizontal: 16,
|
|
46
|
-
},
|
|
47
|
-
title: {
|
|
48
|
-
marginTop: 16,
|
|
49
|
-
fontSize: 24,
|
|
50
|
-
fontWeight: "bold",
|
|
51
|
-
color: "black",
|
|
52
|
-
},
|
|
53
|
-
body: {
|
|
54
|
-
paddingHorizontal: 16,
|
|
55
|
-
paddingVertical: 24,
|
|
56
|
-
gap: 8,
|
|
57
|
-
},
|
|
58
|
-
footer: {
|
|
59
|
-
flexDirection: "row",
|
|
60
|
-
alignItems: "center",
|
|
61
|
-
justifyContent: "flex-end",
|
|
62
|
-
gap: 8,
|
|
63
|
-
paddingVertical: 8,
|
|
64
|
-
},
|
|
65
|
-
button: {
|
|
66
|
-
flex: 0.25,
|
|
67
|
-
},
|
|
68
|
-
});
|
|
69
|
-
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Text } from "react-native";
|
|
2
|
+
import { sizes, styles } from './config';
|
|
3
|
+
|
|
4
|
+
export default function Subtitle({ children, color = '#777', size = 'medium' }) {
|
|
5
|
+
const fontSize = sizes[size] || sizes.medium;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Text style={[styles.subtitle, { color, fontSize }]}>
|
|
9
|
+
{children}
|
|
10
|
+
</Text>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Text } from "react-native";
|
|
2
|
+
import { sizes, styles } from './config';
|
|
3
|
+
|
|
4
|
+
export default function Title({ children, color = 'black', size = 'medium' }) {
|
|
5
|
+
const fontSize = sizes[size] || sizes.medium;
|
|
6
|
+
|
|
7
|
+
return (
|
|
8
|
+
<Text style={[styles.title, { color, fontSize }]}>
|
|
9
|
+
{children}
|
|
10
|
+
</Text>
|
|
11
|
+
);
|
|
12
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Animated } from 'react-native';
|
|
2
|
+
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { directions, validDirections } from './config';
|
|
4
|
+
|
|
5
|
+
export default function FadeView({ children, direction = directions.IN, duration = 1000, style }) {
|
|
6
|
+
if (!validDirections.includes(direction)) {
|
|
7
|
+
throw new Error(`FadeView: direction must be one of ${validDirections.join(', ')}. Got: ${direction}`);
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const fadeAnimationValue = useRef(
|
|
11
|
+
new Animated.Value(direction === directions.IN ? 0 : 1)
|
|
12
|
+
).current;
|
|
13
|
+
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
Animated.timing(fadeAnimationValue, {
|
|
16
|
+
toValue: direction === directions.IN ? 1 : 0,
|
|
17
|
+
duration,
|
|
18
|
+
useNativeDriver: true
|
|
19
|
+
}).start();
|
|
20
|
+
}, []);
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Animated.View style={[style, { opacity: fadeAnimationValue }]}>
|
|
24
|
+
{children}
|
|
25
|
+
</Animated.View>
|
|
26
|
+
);
|
|
27
|
+
}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { useEffect, useRef } from 'react';
|
|
2
2
|
import { Animated } from 'react-native';
|
|
3
|
+
import { defaults } from './config';
|
|
3
4
|
|
|
4
5
|
export default function ShakeView({
|
|
5
6
|
shake,
|
|
6
7
|
children,
|
|
7
8
|
style,
|
|
8
|
-
duration =
|
|
9
|
-
distance =
|
|
10
|
-
intensity =
|
|
9
|
+
duration = defaults.duration,
|
|
10
|
+
distance = defaults.distance,
|
|
11
|
+
intensity = defaults.intensity
|
|
11
12
|
}) {
|
|
12
13
|
const shakeAnim = useRef(new Animated.Value(0)).current;
|
|
13
14
|
|
|
@@ -1,36 +1,28 @@
|
|
|
1
1
|
import { Animated } from 'react-native';
|
|
2
2
|
import { useRef, useEffect } from 'react';
|
|
3
|
+
import { directions, validDirections } from './config';
|
|
3
4
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
UP: 'up',
|
|
8
|
-
DOWN: 'down',
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const VALID_DIRECTIONS = Object.values(DIRECTIONS);
|
|
12
|
-
|
|
13
|
-
export default function SlideView({ children, direction = DIRECTIONS.LEFT, duration = 1000, style }) {
|
|
14
|
-
if (!VALID_DIRECTIONS.includes(direction)) {
|
|
15
|
-
throw new Error(`SlideView: direction must be one of ${VALID_DIRECTIONS.join(', ')}. Got: ${direction}`);
|
|
5
|
+
export default function SlideView({ children, direction = directions.LEFT, duration = 1000, style }) {
|
|
6
|
+
if (!validDirections.includes(direction)) {
|
|
7
|
+
throw new Error(`SlideView: direction must be one of ${validDirections.join(', ')}. Got: ${direction}`);
|
|
16
8
|
}
|
|
17
9
|
let initialValue = 300;
|
|
18
10
|
let transformProperty = 'translateX';
|
|
19
11
|
|
|
20
12
|
switch(direction) {
|
|
21
|
-
case
|
|
13
|
+
case directions.LEFT:
|
|
22
14
|
initialValue = 300;
|
|
23
15
|
transformProperty = 'translateX';
|
|
24
16
|
break;
|
|
25
|
-
case
|
|
17
|
+
case directions.RIGHT:
|
|
26
18
|
initialValue = -300;
|
|
27
19
|
transformProperty = 'translateX';
|
|
28
20
|
break;
|
|
29
|
-
case
|
|
21
|
+
case directions.UP:
|
|
30
22
|
initialValue = 300;
|
|
31
23
|
transformProperty = 'translateY';
|
|
32
24
|
break;
|
|
33
|
-
case
|
|
25
|
+
case directions.DOWN:
|
|
34
26
|
initialValue = -300;
|
|
35
27
|
transformProperty = 'translateY';
|
|
36
28
|
break;
|
package/package.json
CHANGED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { Text, StyleSheet } from "react-native";
|
|
2
|
-
|
|
3
|
-
const SIZES = {
|
|
4
|
-
small: 12,
|
|
5
|
-
medium: 14,
|
|
6
|
-
large: 16,
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
export default function Subtitle({ children, color = '#777', size = 'medium' }) {
|
|
10
|
-
const fontSize = SIZES[size] || SIZES.medium;
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<Text style={[styles.subtitle, { color, fontSize }]}>
|
|
14
|
-
{children}
|
|
15
|
-
</Text>
|
|
16
|
-
);
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
const styles = StyleSheet.create({
|
|
20
|
-
subtitle: {
|
|
21
|
-
fontStyle: 'italic',
|
|
22
|
-
},
|
|
23
|
-
});
|
package/lib/components/Title.js
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { Text, StyleSheet } from "react-native";
|
|
2
|
-
|
|
3
|
-
const SIZES = {
|
|
4
|
-
tiny: 16,
|
|
5
|
-
small: 20,
|
|
6
|
-
medium: 24,
|
|
7
|
-
large: 28,
|
|
8
|
-
};
|
|
9
|
-
|
|
10
|
-
export default function Title({ children, color = 'black', size = 'medium' }) {
|
|
11
|
-
const fontSize = SIZES[size] || SIZES.medium;
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<Text style={[styles.title, { color, fontSize }]}>
|
|
15
|
-
{children}
|
|
16
|
-
</Text>
|
|
17
|
-
);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
const styles = StyleSheet.create({
|
|
21
|
-
title: {
|
|
22
|
-
fontWeight: 'bold',
|
|
23
|
-
},
|
|
24
|
-
});
|
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
import { Animated } from 'react-native';
|
|
2
|
-
import { useRef, useEffect } from 'react';
|
|
3
|
-
|
|
4
|
-
const DIRECTIONS = {
|
|
5
|
-
IN: 'in',
|
|
6
|
-
OUT: 'out'
|
|
7
|
-
};
|
|
8
|
-
|
|
9
|
-
const VALID_DIRECTIONS = Object.values(DIRECTIONS);
|
|
10
|
-
|
|
11
|
-
export default function FadeView({ children, direction = DIRECTIONS.IN, duration = 1000, style }) {
|
|
12
|
-
if (!VALID_DIRECTIONS.includes(direction)) {
|
|
13
|
-
throw new Error(`FadeView: direction must be one of ${VALID_DIRECTIONS.join(', ')}. Got: ${direction}`);
|
|
14
|
-
}
|
|
15
|
-
|
|
16
|
-
const fadeAnimationValue = useRef(
|
|
17
|
-
new Animated.Value(direction === DIRECTIONS.IN ? 0 : 1)
|
|
18
|
-
).current;
|
|
19
|
-
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
Animated.timing(fadeAnimationValue, {
|
|
22
|
-
toValue: direction === DIRECTIONS.IN ? 1 : 0,
|
|
23
|
-
duration,
|
|
24
|
-
useNativeDriver: true
|
|
25
|
-
}).start();
|
|
26
|
-
}, []);
|
|
27
|
-
|
|
28
|
-
return (
|
|
29
|
-
<Animated.View style={[style, { opacity: fadeAnimationValue }]}>
|
|
30
|
-
{children}
|
|
31
|
-
</Animated.View>
|
|
32
|
-
);
|
|
33
|
-
}
|