decathlon-ui 0.3.50 → 1.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/dist/components/card-picto/card-picto.component.d.ts.map +1 -1
- package/dist/components/card-picto/card-picto.component.js +1 -11
- package/dist/components/product-card/product-card.component.d.ts.map +1 -1
- package/dist/components/product-card/product-card.component.js +22 -4
- package/dist/components/product-card/product-card.styles.d.ts +19 -3
- package/dist/components/product-card/product-card.styles.d.ts.map +1 -1
- package/dist/components/product-card/product-card.styles.js +27 -9
- package/dist/components/product-card/product-card.types.d.ts +2 -1
- package/dist/components/product-card/product-card.types.d.ts.map +1 -1
- package/dist/components/product-highlight/product-highlight.d.ts +1 -1
- package/dist/components/product-highlight/product-highlight.d.ts.map +1 -1
- package/dist/components/product-highlight/product-highlight.js +1 -1
- package/dist/components/store-card/store-card.component.d.ts.map +1 -1
- package/dist/components/store-card/store-card.component.js +3 -23
- package/package.json +3 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"card-picto.component.d.ts","sourceRoot":"","sources":["../../../src/components/card-picto/card-picto.component.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"card-picto.component.d.ts","sourceRoot":"","sources":["../../../src/components/card-picto/card-picto.component.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,wBAAgB,SAAS,CAAC,EACxB,KAAK,EACL,KAAK,EACL,OAAO,EACP,OAAmB,GACpB,EAAE,cAAc,2CAiBhB"}
|
|
@@ -1,17 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Image, Text, TouchableOpacity } from "react-native";
|
|
3
|
-
let FastImageComponent = null;
|
|
4
|
-
try {
|
|
5
|
-
// Tenta importar o FastImage
|
|
6
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
7
|
-
FastImageComponent = require("react-native-fast-image").default;
|
|
8
|
-
}
|
|
9
|
-
catch (e) {
|
|
10
|
-
// Se não existir, permanece null
|
|
11
|
-
}
|
|
12
|
-
const CardImage = FastImageComponent ? FastImageComponent : Image;
|
|
13
3
|
import { useCardPictoStyles } from "./card-picto.styles";
|
|
14
4
|
export function CardPicto({ title, image, onPress, variant = "default", }) {
|
|
15
5
|
const styles = useCardPictoStyles(variant);
|
|
16
|
-
return (_jsxs(TouchableOpacity, { style: styles.container, onPress: onPress, activeOpacity: 0.7, children: [_jsx(
|
|
6
|
+
return (_jsxs(TouchableOpacity, { style: styles.container, onPress: onPress, activeOpacity: 0.7, children: [_jsx(Image, { source: { uri: image }, style: styles.image, resizeMode: "contain" }), _jsx(Text, { style: styles.title, children: title })] }));
|
|
17
7
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.component.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"product-card.component.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAS/B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA8Q7D,eAAO,MAAM,WAAW,8CAAmC,CAAC"}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Image, Text, TouchableOpacity, View } from "react-native";
|
|
4
|
-
import { HeartFillIcon, HeartIcon, StarIcon } from "../../icons";
|
|
4
|
+
import { AddToBagIcon, HeartFillIcon, HeartIcon, StarIcon } from "../../icons";
|
|
5
5
|
import { useTheme } from "../../themes";
|
|
6
6
|
import { Badge } from "../badge";
|
|
7
7
|
import { Loading } from "../loading";
|
|
8
8
|
import { useProductCardStyles } from "./product-card.styles";
|
|
9
|
-
const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName, rating, reviewCount, price, discountPrice, cashPrice, offerPrice, colorsVariants, isFavorite = false, onFavoritePress, onPress, testID, width, flags = [], showRating = true, isLoadingFavorite = false, customStyles, showFavoriteButton = true, }) => {
|
|
9
|
+
const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName, rating, reviewCount, price, discountPrice, cashPrice, offerPrice, colorsVariants, isFavorite = false, onFavoritePress, onPress, testID, width, flags = [], showRating = true, isLoadingFavorite = false, customStyles, showFavoriteButton = true, onAddToCartPress, }) => {
|
|
10
10
|
const styles = useProductCardStyles(variant, width);
|
|
11
11
|
const theme = useTheme();
|
|
12
12
|
const parsePriceToNumber = React.useCallback((price) => {
|
|
@@ -26,6 +26,10 @@ const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName,
|
|
|
26
26
|
e.stopPropagation();
|
|
27
27
|
onFavoritePress === null || onFavoritePress === void 0 ? void 0 : onFavoritePress();
|
|
28
28
|
}, [onFavoritePress]);
|
|
29
|
+
const handleAddToCartPress = React.useCallback((e) => {
|
|
30
|
+
e.stopPropagation();
|
|
31
|
+
onAddToCartPress === null || onAddToCartPress === void 0 ? void 0 : onAddToCartPress();
|
|
32
|
+
}, [onAddToCartPress]);
|
|
29
33
|
const renderContent = React.useCallback(() => (_jsxs(View, { style: [styles.cardContainer, customStyles], children: [_jsxs(View, { style: styles.imageContainer, children: [_jsx(Image, { resizeMode: "cover", source: { uri: imageUrl }, style: styles.productImage, accessibilityLabel: `Imagem do produto ${productName}` }), (flags === null || flags === void 0 ? void 0 : flags.some((flag) => { var _a; return (_a = flag.text) === null || _a === void 0 ? void 0 : _a.toLowerCase().includes("produto azul"); })) && (_jsx(View, { style: {
|
|
30
34
|
position: "absolute",
|
|
31
35
|
top: 0,
|
|
@@ -35,7 +39,7 @@ const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName,
|
|
|
35
39
|
height: 55,
|
|
36
40
|
}, children: _jsx(Image, { source: {
|
|
37
41
|
uri: "https://decathlonstore.vtexassets.com/assets/vtex.file-manager-graphql/images/43a62e42-1b09-4a1b-9536-56a8fd6efb4a___57609de553b212bd01a55b5a862948b7.png",
|
|
38
|
-
}, style: { width: 50, height: 55 } }) })), ["grid", "shelf"].includes(variant) &&
|
|
42
|
+
}, style: { width: 50, height: 55 } }) })), ["grid", "shelf", "shelfWithAddToCart"].includes(variant) &&
|
|
39
43
|
(flags === null || flags === void 0 ? void 0 : flags.length) > 0 &&
|
|
40
44
|
(flags === null || flags === void 0 ? void 0 : flags.map((flag, index) => {
|
|
41
45
|
var _a;
|
|
@@ -51,19 +55,33 @@ const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName,
|
|
|
51
55
|
}, icon: flag.icon }, flag.name + index + productName));
|
|
52
56
|
})), showFavoriteButton && (_jsx(TouchableOpacity, { style: [
|
|
53
57
|
isFavorite ? styles.favoriteButton : styles.unfavoriteButton,
|
|
54
|
-
], onPress: handleFavoritePress, accessibilityLabel: isFavorite ? "Remover dos favoritos" : "Adicionar aos favoritos", accessibilityRole: "button", children: isLoadingFavorite ? (_jsx(Loading, { size: 16 })) : isFavorite ? (_jsx(HeartFillIcon, { size: 16, color: "#101010" })) : (_jsx(HeartIcon, { size: 16, color: "#101010" })) }))] }), variant !== "lastViewed" && (_jsxs(View, { style: styles.detailsContainer, children: [_jsxs(View, { style: styles.productInfo, children: [_jsx(Text, { style: styles.brandText, children: brand }), _jsx(View, { style: styles.nameContainer, children: _jsx(Text, { numberOfLines: 3, style: styles.nameText, accessibilityLabel: `Nome do produto: ${productName}`, children: productName }) })] }), variant === "grid" && showRating && (_jsxs(View, { style: styles.ratingContainer, accessibilityLabel: `Avaliação: ${rating} estrelas, ${reviewCount} avaliações`, children: [_jsx(StarIcon, { size: 11, color: "#15181B", filled: true }), _jsxs(View, { style: styles.reviewCountWrapper, children: [_jsx(Text, { style: styles.ratingText, children: rating === null || rating === void 0 ? void 0 : rating.toString().replace(/\./g, ",") }), _jsx(Text, { style: styles.reviewCountText, children: reviewCount })] })] })), _jsx(View, { style: styles.priceContainer, children: cashPrice && parsePriceToNumber(cashPrice) < parsePriceToNumber(offerPrice || price) ? (_jsxs(_Fragment, { children: [_jsx(Text, { style: styles.priceText, accessibilityLabel:
|
|
58
|
+
], onPress: handleFavoritePress, accessibilityLabel: isFavorite ? "Remover dos favoritos" : "Adicionar aos favoritos", accessibilityRole: "button", children: isLoadingFavorite ? (_jsx(Loading, { size: 16 })) : isFavorite ? (_jsx(HeartFillIcon, { size: 16, color: "#101010" })) : (_jsx(HeartIcon, { size: 16, color: "#101010" })) })), variant === "shelfWithAddToCart" && (_jsx(TouchableOpacity, { style: styles.addToCartButton, onPress: handleAddToCartPress, accessibilityLabel: "Adicionar ao carrinho", accessibilityRole: "button", children: _jsx(AddToBagIcon, { color: "#FFFFFF", size: 16 }) }))] }), variant !== "lastViewed" && (_jsxs(View, { style: styles.detailsContainer, children: [_jsxs(View, { style: styles.productInfo, children: [variant !== "shelfWithAddToCart" && (_jsx(Text, { style: styles.brandText, children: brand })), _jsx(View, { style: styles.nameContainer, children: _jsx(Text, { numberOfLines: 3, style: styles.nameText, accessibilityLabel: `Nome do produto: ${productName}`, children: productName }) })] }), variant === "grid" && showRating && (_jsxs(View, { style: styles.ratingContainer, accessibilityLabel: `Avaliação: ${rating} estrelas, ${reviewCount} avaliações`, children: [_jsx(StarIcon, { size: 11, color: "#15181B", filled: true }), _jsxs(View, { style: styles.reviewCountWrapper, children: [_jsx(Text, { style: styles.ratingText, children: rating === null || rating === void 0 ? void 0 : rating.toString().replace(/\./g, ",") }), _jsx(Text, { style: styles.reviewCountText, children: reviewCount })] })] })), _jsx(View, { style: styles.priceContainer, children: cashPrice && parsePriceToNumber(cashPrice) < parsePriceToNumber(offerPrice || price) ? (_jsxs(_Fragment, { children: [_jsx(Text, { style: styles.priceText, accessibilityLabel: variant === "shelfWithAddToCart"
|
|
59
|
+
? `Preço: ${cashPrice}`
|
|
60
|
+
: `Preço à vista: ${cashPrice}`, children: variant === "shelfWithAddToCart"
|
|
61
|
+
? cashPrice
|
|
62
|
+
: `${cashPrice} à vista` }), _jsx(Text, { style: styles.priceDiscountText, accessibilityLabel: `Preço original: ${offerPrice || price}`, children: offerPrice || price })] })) : (_jsxs(_Fragment, { children: [_jsx(Text, { style: styles.priceText, accessibilityLabel: `Preço: ${offerPrice || price}`, children: offerPrice || price }), discountPrice && (_jsx(Text, { style: styles.priceDiscountText, children: discountPrice }))] })) }), colorsVariants && (_jsx(Text, { style: styles.colorsText, children: colorsVariants }))] }))] })), [
|
|
55
63
|
brand,
|
|
56
64
|
cashPrice,
|
|
65
|
+
colorsVariants,
|
|
66
|
+
customStyles,
|
|
67
|
+
discountPrice,
|
|
68
|
+
flags,
|
|
69
|
+
handleAddToCartPress,
|
|
57
70
|
handleFavoritePress,
|
|
58
71
|
imageUrl,
|
|
59
72
|
isFavorite,
|
|
73
|
+
isLoadingFavorite,
|
|
60
74
|
offerPrice,
|
|
75
|
+
onAddToCartPress,
|
|
61
76
|
parsePriceToNumber,
|
|
62
77
|
price,
|
|
63
78
|
productName,
|
|
64
79
|
rating,
|
|
65
80
|
reviewCount,
|
|
81
|
+
showFavoriteButton,
|
|
82
|
+
showRating,
|
|
66
83
|
styles,
|
|
84
|
+
theme.spacing.xxs2,
|
|
67
85
|
variant,
|
|
68
86
|
]);
|
|
69
87
|
if (onPress) {
|
|
@@ -9,6 +9,8 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant, custom
|
|
|
9
9
|
justifyContent: "center";
|
|
10
10
|
};
|
|
11
11
|
imageContainer: {
|
|
12
|
+
position?: "relative" | undefined;
|
|
13
|
+
width?: "100%" | undefined;
|
|
12
14
|
borderRadius: number;
|
|
13
15
|
display: "flex";
|
|
14
16
|
flex: number;
|
|
@@ -47,8 +49,8 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant, custom
|
|
|
47
49
|
};
|
|
48
50
|
priceContainer: {
|
|
49
51
|
display: "flex";
|
|
50
|
-
flexDirection: "column";
|
|
51
|
-
alignItems: "flex-start";
|
|
52
|
+
flexDirection: "row" | "column";
|
|
53
|
+
alignItems: "flex-start" | "center";
|
|
52
54
|
marginTop: number;
|
|
53
55
|
gap: number;
|
|
54
56
|
};
|
|
@@ -60,9 +62,10 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant, custom
|
|
|
60
62
|
};
|
|
61
63
|
priceDiscountText: {
|
|
62
64
|
fontFamily: string;
|
|
63
|
-
fontWeight: "
|
|
65
|
+
fontWeight: "400";
|
|
64
66
|
fontStyle: "normal";
|
|
65
67
|
fontSize: number;
|
|
68
|
+
lineHeight: number;
|
|
66
69
|
letterSpacing: number;
|
|
67
70
|
color: string;
|
|
68
71
|
textDecorationLine: "line-through";
|
|
@@ -95,6 +98,7 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant, custom
|
|
|
95
98
|
color: string;
|
|
96
99
|
fontSize: number;
|
|
97
100
|
lineHeight: number;
|
|
101
|
+
display: "none" | "flex";
|
|
98
102
|
};
|
|
99
103
|
favoriteButton: {
|
|
100
104
|
display: "none" | "flex";
|
|
@@ -108,6 +112,18 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant, custom
|
|
|
108
112
|
top: number;
|
|
109
113
|
right: number;
|
|
110
114
|
};
|
|
115
|
+
addToCartButton: {
|
|
116
|
+
display: "none" | "flex";
|
|
117
|
+
position: "absolute";
|
|
118
|
+
right: number;
|
|
119
|
+
bottom: number;
|
|
120
|
+
width: number;
|
|
121
|
+
height: number;
|
|
122
|
+
borderRadius: number;
|
|
123
|
+
backgroundColor: string;
|
|
124
|
+
justifyContent: "center";
|
|
125
|
+
alignItems: "center";
|
|
126
|
+
};
|
|
111
127
|
ratingText: {
|
|
112
128
|
color: string;
|
|
113
129
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.styles.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.styles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,eAAO,MAAM,oBAAoB,GAC/B,UAAS,kBAA2B,EACpC,cAAc,MAAM
|
|
1
|
+
{"version":3,"file":"product-card.styles.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.styles.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAE/D,eAAO,MAAM,oBAAoB,GAC/B,UAAS,kBAA2B,EACpC,cAAc,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6JrB,CAAC"}
|
|
@@ -6,6 +6,7 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
6
6
|
const getImageSize = () => {
|
|
7
7
|
switch (variant) {
|
|
8
8
|
case "shelf":
|
|
9
|
+
case "shelfWithAddToCart":
|
|
9
10
|
return 150;
|
|
10
11
|
case "lastViewed":
|
|
11
12
|
return 112;
|
|
@@ -22,7 +23,7 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
22
23
|
cardContainer: {
|
|
23
24
|
display: "flex",
|
|
24
25
|
width: "100%",
|
|
25
|
-
maxWidth: 184,
|
|
26
|
+
maxWidth: variant === "shelfWithAddToCart" ? 150 : 184,
|
|
26
27
|
flexDirection: "column",
|
|
27
28
|
alignItems: "stretch",
|
|
28
29
|
justifyContent: "center",
|
|
@@ -33,6 +34,9 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
33
34
|
flex: 1,
|
|
34
35
|
justifyContent: "center",
|
|
35
36
|
alignItems: "center",
|
|
37
|
+
...(variant === "shelfWithAddToCart"
|
|
38
|
+
? { position: "relative", width: "100%" }
|
|
39
|
+
: {}),
|
|
36
40
|
},
|
|
37
41
|
productImage: {
|
|
38
42
|
position: "relative",
|
|
@@ -57,17 +61,17 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
57
61
|
fontWeight: "400",
|
|
58
62
|
},
|
|
59
63
|
nameContainer: {
|
|
60
|
-
marginTop: 4,
|
|
64
|
+
marginTop: variant === "shelfWithAddToCart" ? 0 : 4,
|
|
61
65
|
},
|
|
62
66
|
nameText: {
|
|
63
67
|
color: "#101010",
|
|
64
|
-
fontSize: 14,
|
|
65
|
-
lineHeight: 21,
|
|
68
|
+
fontSize: variant === "shelfWithAddToCart" ? 12 : 14,
|
|
69
|
+
lineHeight: variant === "shelfWithAddToCart" ? 18 : 21,
|
|
66
70
|
},
|
|
67
71
|
priceContainer: {
|
|
68
72
|
display: "flex",
|
|
69
|
-
flexDirection: "column",
|
|
70
|
-
alignItems: "flex-start",
|
|
73
|
+
flexDirection: variant === "shelfWithAddToCart" ? "row" : "column",
|
|
74
|
+
alignItems: variant === "shelfWithAddToCart" ? "center" : "flex-start",
|
|
71
75
|
marginTop: 8,
|
|
72
76
|
gap: 8,
|
|
73
77
|
},
|
|
@@ -75,13 +79,14 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
75
79
|
fontSize: 14,
|
|
76
80
|
color: "#101010",
|
|
77
81
|
fontWeight: "500",
|
|
78
|
-
lineHeight: 16.8,
|
|
82
|
+
lineHeight: 16.8, // 120%
|
|
79
83
|
},
|
|
80
84
|
priceDiscountText: {
|
|
81
85
|
fontFamily: "Inter",
|
|
82
|
-
fontWeight: "
|
|
83
|
-
fontStyle: "normal",
|
|
86
|
+
fontWeight: "400",
|
|
87
|
+
fontStyle: "normal",
|
|
84
88
|
fontSize: 10,
|
|
89
|
+
lineHeight: 10,
|
|
85
90
|
letterSpacing: 0,
|
|
86
91
|
color: "#616161",
|
|
87
92
|
textDecorationLine: "line-through",
|
|
@@ -114,6 +119,7 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
114
119
|
color: "#616161",
|
|
115
120
|
fontSize: 10,
|
|
116
121
|
lineHeight: 10,
|
|
122
|
+
display: variant === "shelfWithAddToCart" ? "none" : "flex",
|
|
117
123
|
},
|
|
118
124
|
favoriteButton: {
|
|
119
125
|
display: variant === "grid" ? "flex" : "none",
|
|
@@ -127,6 +133,18 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
127
133
|
top: 12,
|
|
128
134
|
right: 12,
|
|
129
135
|
},
|
|
136
|
+
addToCartButton: {
|
|
137
|
+
display: variant === "shelfWithAddToCart" ? "flex" : "none",
|
|
138
|
+
position: "absolute",
|
|
139
|
+
right: 8,
|
|
140
|
+
bottom: 8,
|
|
141
|
+
width: 32,
|
|
142
|
+
height: 32,
|
|
143
|
+
borderRadius: 16,
|
|
144
|
+
backgroundColor: "#101010",
|
|
145
|
+
justifyContent: "center",
|
|
146
|
+
alignItems: "center",
|
|
147
|
+
},
|
|
130
148
|
ratingText: {
|
|
131
149
|
color: "#383838",
|
|
132
150
|
},
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { StyleProp, ViewProps, ViewStyle } from "react-native";
|
|
2
|
-
export type ProductCardVariant = "grid" | "shelf" | "lastViewed";
|
|
2
|
+
export type ProductCardVariant = "grid" | "shelf" | "lastViewed" | "shelfWithAddToCart";
|
|
3
3
|
export interface ProductCardProps extends ViewProps {
|
|
4
4
|
variant?: ProductCardVariant;
|
|
5
5
|
imageUrl: string;
|
|
@@ -28,5 +28,6 @@ export interface ProductCardProps extends ViewProps {
|
|
|
28
28
|
isLoadingFavorite?: boolean;
|
|
29
29
|
customStyles?: StyleProp<ViewStyle>;
|
|
30
30
|
colorsVariants?: string;
|
|
31
|
+
onAddToCartPress?: () => void;
|
|
31
32
|
}
|
|
32
33
|
//# sourceMappingURL=product-card.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-card.types.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"product-card.types.d.ts","sourceRoot":"","sources":["../../../src/components/product-card/product-card.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/D,MAAM,MAAM,kBAAkB,GAC1B,MAAM,GACN,OAAO,GACP,YAAY,GACZ,oBAAoB,CAAC;AAEzB,MAAM,WAAW,gBAAiB,SAAQ,SAAS;IACjD,OAAO,CAAC,EAAE,kBAAkB,CAAC;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAChC,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC5B,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,IAAI,CAAC;IAC7B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE;QACN,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,KAAK,CAAC,EAAE,MAAM,CAAC;QACf,SAAS,CAAC,EAAE,MAAM,CAAC;KACpB,EAAE,CAAC;IACJ,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,YAAY,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACpC,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { StoryObj } from "@storybook/react
|
|
1
|
+
import type { StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
3
|
declare const meta: Meta<React.NamedExoticComponent<import("./product-highlight.types").ProductHighlightsContainerProps>>;
|
|
4
4
|
export default meta;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"product-highlight.d.ts","sourceRoot":"","sources":["../../../src/components/product-highlight/product-highlight.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"product-highlight.d.ts","sourceRoot":"","sources":["../../../src/components/product-highlight/product-highlight.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAQ,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,QAAA,MAAM,IAAI,uGAcyC,CAAC;AAEpD,eAAe,IAAI,CAAC;AAEpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,IAAI,CAAC,CAAC;AAMnC,eAAO,MAAM,OAAO,EAAE,KAsBrB,CAAC;AAEF,eAAO,MAAM,cAAc,EAAE,KAuB5B,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { ProductHighlight, ProductHighlightsContainer
|
|
3
|
+
import { ProductHighlight, ProductHighlightsContainer } from "./product-highlight.component";
|
|
4
4
|
const meta = {
|
|
5
5
|
title: "Components/ProductHighlight",
|
|
6
6
|
component: ProductHighlightsContainer,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-card.component.d.ts","sourceRoot":"","sources":["../../../src/components/store-card/store-card.component.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"store-card.component.d.ts","sourceRoot":"","sources":["../../../src/components/store-card/store-card.component.tsx"],"names":[],"mappings":"AAMA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,eAAO,MAAM,SAAS,GAAI,oHAWvB,cAAc,4CA8FhB,CAAC"}
|
|
@@ -1,29 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Text, TouchableOpacity, View } from "react-native";
|
|
2
|
+
import { Image, Text, TouchableOpacity, View } from "react-native";
|
|
3
3
|
import { CalendarIcon, MapPinIcon } from "../../icons";
|
|
4
4
|
import { useTheme } from "../../themes";
|
|
5
5
|
import { Badge } from "../badge";
|
|
6
6
|
import { useStoreCardStyles } from "./store-card.styles";
|
|
7
|
-
let FastImageComponent = null;
|
|
8
|
-
try {
|
|
9
|
-
// Tenta importar o FastImage
|
|
10
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
11
|
-
FastImageComponent = require("react-native-fast-image").default;
|
|
12
|
-
}
|
|
13
|
-
catch (e) {
|
|
14
|
-
// Se não existir, permanece null
|
|
15
|
-
}
|
|
16
|
-
// Fallback para quando FastImage não estiver disponível (ex: Storybook web)
|
|
17
|
-
if (!FastImageComponent) {
|
|
18
|
-
FastImageComponent = ({ source, style, ...props }) => (_jsx(View, { style: [
|
|
19
|
-
style,
|
|
20
|
-
{
|
|
21
|
-
backgroundColor: "#e0e0e0",
|
|
22
|
-
justifyContent: "center",
|
|
23
|
-
alignItems: "center",
|
|
24
|
-
},
|
|
25
|
-
], ...props, children: _jsx(Text, { style: { fontSize: 12, color: "#666" }, children: "IMG" }) }));
|
|
26
|
-
}
|
|
27
7
|
export const StoreCard = ({ storeName, address, distance, itemsAvailable, itemsUnavailable, pickupTime, flags, value, onPress, isSelected, }) => {
|
|
28
8
|
const { spacing, fonts, colors, metrics } = useTheme();
|
|
29
9
|
const allAvailable = (itemsUnavailable === null || itemsUnavailable === void 0 ? void 0 : itemsUnavailable.length) === 0;
|
|
@@ -50,9 +30,9 @@ export const StoreCard = ({ storeName, address, distance, itemsAvailable, itemsU
|
|
|
50
30
|
: `${itemsUnavailable === null || itemsUnavailable === void 0 ? void 0 : itemsUnavailable.length} indisponíveis` })] }), _jsxs(View, { style: styles.availableItemsContainerText, children: [_jsx(CalendarIcon, { size: 10 }), _jsx(Text, { style: styles.pickupTime, children: pickupTime })] })] }), _jsxs(View, { style: {
|
|
51
31
|
gap: spacing.sm,
|
|
52
32
|
flexDirection: "row",
|
|
53
|
-
}, children: [itemsAvailable === null || itemsAvailable === void 0 ? void 0 : itemsAvailable.map((item) => (_jsx(
|
|
33
|
+
}, children: [itemsAvailable === null || itemsAvailable === void 0 ? void 0 : itemsAvailable.map((item) => (_jsx(Image, { source: {
|
|
54
34
|
uri: item.imageUrl,
|
|
55
|
-
}, style: styles.image }, item.itemIndex))), itemsUnavailable === null || itemsUnavailable === void 0 ? void 0 : itemsUnavailable.map((item) => (_jsxs(View, { children: [_jsx(
|
|
35
|
+
}, style: styles.image }, item.itemIndex))), itemsUnavailable === null || itemsUnavailable === void 0 ? void 0 : itemsUnavailable.map((item) => (_jsxs(View, { children: [_jsx(Image, { source: {
|
|
56
36
|
uri: item.imageUrl,
|
|
57
37
|
}, style: styles.image }), _jsx(View, { style: styles.unavailableItemContainer, children: _jsx(View, { style: styles.unavailableItem }) })] }, item.itemIndex)))] }), _jsxs(View, { style: styles.footer, children: [_jsx(Text, { style: styles.address, children: address }), _jsxs(View, { style: styles.availableItemsContainerText, children: [_jsx(MapPinIcon, { size: 13 }), _jsx(Text, { style: styles.distance, children: distance })] })] })] }));
|
|
58
38
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "decathlon-ui",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "Biblioteca de componentes React Native com Storybook e documentação via GitHub Pages.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -22,6 +22,7 @@
|
|
|
22
22
|
"lottie-react-native": ">=5.0.0",
|
|
23
23
|
"react": ">=17.0.0",
|
|
24
24
|
"react-native": ">=0.68.0",
|
|
25
|
+
"react-native-fast-image": ">=8.0.0",
|
|
25
26
|
"react-native-svg": ">=12.0.0"
|
|
26
27
|
},
|
|
27
28
|
"devDependencies": {
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
"react": "^19.1.0",
|
|
45
46
|
"react-dom": "^19.1.0",
|
|
46
47
|
"react-native": "^0.78.0",
|
|
48
|
+
"react-native-fast-image": "8.6.3",
|
|
47
49
|
"react-native-image-viewing": "^0.2.2",
|
|
48
50
|
"react-native-safe-area-context": "^5.5.1",
|
|
49
51
|
"react-native-svg": "^15.10.0",
|