cdslibrary 1.1.5 → 1.1.6

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "cdslibrary",
3
3
  "license": "0BSD",
4
- "version": "1.1.5",
4
+ "version": "1.1.6",
5
5
  "main": "index.js",
6
6
  "author": "Nat Viramontes",
7
7
  "description": "A library of components for the CDS project",
@@ -1,65 +0,0 @@
1
- import { Animated, FlatList, StyleSheet, Text, View } from "react-native";
2
-
3
-
4
- import { getSlides } from "../assets/onboarding/slides";
5
- import { OnboardingItem } from "./onboardingItem";
6
- import { useTheme } from "../context/CDSThemeContext";
7
- import { CDSBottomSheet } from "./CDSBottomSheet";
8
- import { useEffect, useRef, useState } from "react";
9
- import { Paginator } from "./Paginator";
10
-
11
- export const Onboarding = () => {
12
- const [parentWidth, setParentWidth] = useState(0);
13
- const {theme} = useTheme()
14
- // Función onLayout para obtener las dimensiones del contenedor padre
15
- const handleLayout = (event) => {
16
- const { width } = event.nativeEvent.layout;
17
- setParentWidth(width); // Guardamos el ancho en el estado
18
- };
19
-
20
-
21
- const [currentIndex, setCurrentIndex] = useState(0);
22
-
23
- const viewableItemsChanged = useRef(({ viewableItems }) => {
24
- setCurrentIndex(viewableItems[0].index);
25
- }).current;
26
-
27
- const viewConfig = useRef({ viewAreaCoveragePercentThreshold: 50 }).current;
28
-
29
- const scrollX = useRef(new Animated.Value(0)).current;
30
- const slidesRef = useRef(null);
31
-
32
- const { isDarkMode } = useTheme();
33
- const slides = getSlides(isDarkMode);
34
-
35
-
36
- return (
37
- <View style={[Styles.container, {backgroundColor: theme.surface.background.default}]} onLayout={handleLayout}>
38
- <FlatList data={slides} renderItem={({ item }) => <OnboardingItem item={item} parentWidth={parentWidth} />}
39
- horizontal
40
- showsHorizontalScrollIndicator={false}
41
- pagingEnabled
42
- bounces={false}
43
- keyExtractor={(item) => item.id}
44
- onScroll={Animated.event([{ nativeEvent: { contentOffset: { x: scrollX } } }], { useNativeDriver: false })}
45
- onViewableItemsChanged={viewableItemsChanged}
46
- viewabilityConfig={viewConfig}
47
- scrollEventThrottle={32}
48
- ref={slidesRef}
49
- style={{flex: 0.7,}}
50
- />
51
- {/* <Paginator width={parentWidth} data={slides} scrollX={scrollX}/> */}
52
- </View>
53
- )
54
- }
55
-
56
-
57
-
58
- const Styles = StyleSheet.create({
59
- container: {
60
- flex: 1,
61
- height: 500,
62
- justifyContent: 'center',
63
- width: '100%',
64
- }
65
- })
@@ -1,52 +0,0 @@
1
- import { View, Text, StyleSheet, Animated, useWindowDimensions } from "react-native";
2
- import { useTheme } from "../context/CDSThemeContext";
3
-
4
-
5
-
6
-
7
- export const Paginator = ({ data, scrollX, width }) => {
8
-
9
- const { theme } = useTheme();
10
-
11
- return (
12
- <View style={styles.container}>
13
- {data.map((_, index) => {
14
-
15
- const inputRange = [(index - 1) * width, index * width, (index + 1) * width];
16
- const dotWidth = scrollX.interpolate({
17
- inputRange,
18
- outputRange: [8, 16, 8],
19
- extrapolate: "clamp",
20
- });
21
- const dotColor = scrollX.interpolate({
22
- inputRange,
23
- outputRange: [theme.surface.special.progressbarBg, theme.surface.special.progress, theme.surface.special.progressbarBg],
24
- extrapolate: "clamp",
25
- });
26
- return (
27
- <Animated.View
28
- key={index.toString()}
29
- style={[
30
- styles.dot,
31
- { width: dotWidth, backgroundColor: dotColor },
32
- ]}
33
- />
34
- );
35
- })}
36
- </View>
37
- );
38
- }
39
-
40
- const styles = StyleSheet.create({
41
- container: {
42
- flexDirection: "row",
43
- height: 64,
44
- },
45
- dot: {
46
- width: 8,
47
- height: 8,
48
- borderRadius: 4,
49
- marginHorizontal: 4,
50
- backgroundColor: 'red'
51
- },
52
- });
@@ -1,39 +0,0 @@
1
- import { View, Text, Image, useWindowDimensions, StyleSheet } from "react-native";
2
- import { getSemanticTextStyles } from "../tokens/CDSsemanticTextStyles";
3
- import { useTheme } from "../context/CDSThemeContext";
4
- export const OnboardingItem = ({ item, parentWidth }) => {
5
-
6
- const { theme } = useTheme();
7
-
8
-
9
- return (
10
- <View style={[styles.container, {width: parentWidth}]}>
11
- <View style={[styles.textContainer]}>
12
- <Text style={theme.typography.bold.lg}>{item.title}</Text>
13
- <Text style={theme.typography.regular.md}>{item.description}</Text>
14
- </View>
15
- <Image source={item.image} resizeMode="contain" style={[styles.image,]} />
16
- </View>
17
- );
18
- }
19
-
20
-
21
- const styles = StyleSheet.create({
22
- container: {
23
- flex: 1,
24
- justifyContent: "center",
25
- alignItems: "center",
26
- gap: 40,
27
- flexDirection: 'row',
28
- flexWrap: 'wrap'
29
-
30
- },
31
-
32
- textContainer: {
33
- gap: 16,
34
- },
35
-
36
- image: {
37
- height: 353,
38
- },
39
- });