decathlon-ui 0.3.20 → 0.3.23
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.component.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.component.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"badge.component.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.component.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAkEhD,eAAO,MAAM,KAAK,6FApDf,UAAU,6CAoDkC,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { useBadgeStyles } from "./badge.styles";
|
|
|
6
6
|
* Badge - Componente para exibição de etiquetas ou marcadores
|
|
7
7
|
* Suporta ícones SVG
|
|
8
8
|
*/
|
|
9
|
-
const BadgeComponent = ({ text, variant
|
|
9
|
+
const BadgeComponent = ({ text, variant, size = "medium", style, textStyle, icon, iconPosition = "left", }) => {
|
|
10
10
|
const styles = useBadgeStyles(variant, size);
|
|
11
11
|
const renderIcon = () => {
|
|
12
12
|
if (!icon) {
|
|
@@ -26,7 +26,15 @@ const BadgeComponent = ({ text, variant = "default", size = "medium", style, tex
|
|
|
26
26
|
return styles.medium;
|
|
27
27
|
}
|
|
28
28
|
};
|
|
29
|
-
return (_jsxs(View, { style: [
|
|
29
|
+
return (_jsxs(View, { style: [
|
|
30
|
+
!variant && style ? style : styles.container,
|
|
31
|
+
variant && styles[variant],
|
|
32
|
+
], children: [icon && iconPosition === "left" && renderIcon(), _jsx(Text, { style: [
|
|
33
|
+
styles.text,
|
|
34
|
+
getSizeStyle(),
|
|
35
|
+
variant && styles[variant],
|
|
36
|
+
textStyle,
|
|
37
|
+
], children: text }), icon && iconPosition === "right" && renderIcon()] }));
|
|
30
38
|
};
|
|
31
39
|
export const Badge = React.memo(BadgeComponent);
|
|
32
40
|
Badge.displayName = "Badge";
|
|
@@ -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;
|
|
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;AAgK7D,eAAO,MAAM,WAAW,8CAAmC,CAAC"}
|
|
@@ -2,22 +2,25 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import * as React from "react";
|
|
3
3
|
import { Image, Text, TouchableOpacity, View } from "react-native";
|
|
4
4
|
import { HeartFillIcon, HeartIcon, StarIcon } from "../../icons";
|
|
5
|
+
import { useTheme } from "../../themes";
|
|
5
6
|
import { Badge } from "../badge";
|
|
6
7
|
import { Loading } from "../loading";
|
|
7
8
|
import { useProductCardStyles } from "./product-card.styles";
|
|
8
9
|
const ProductCardComponent = ({ variant = "grid", imageUrl, brand, productName, rating, reviewCount, price, isFavorite = false, onFavoritePress, onPress, testID, width, flags = [], showRating = true, isLoadingFavorite = false, customStyles, showFavoriteButton = true, }) => {
|
|
9
10
|
const styles = useProductCardStyles(variant, width);
|
|
11
|
+
const theme = useTheme();
|
|
10
12
|
const handleFavoritePress = React.useCallback((e) => {
|
|
11
13
|
e.stopPropagation();
|
|
12
14
|
onFavoritePress === null || onFavoritePress === void 0 ? void 0 : onFavoritePress();
|
|
13
15
|
}, [onFavoritePress]);
|
|
14
16
|
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}` }), ["grid", "shelf"].includes(variant) &&
|
|
15
17
|
(flags === null || flags === void 0 ? void 0 : flags.length) > 0 &&
|
|
16
|
-
(flags === null || flags === void 0 ? void 0 : flags.map((flag, index) => (_jsx(Badge, { text: flag.text, textStyle: { color: flag.textColor }, iconPosition: "right", size: "
|
|
18
|
+
(flags === null || flags === void 0 ? void 0 : flags.map((flag, index) => (_jsx(Badge, { text: flag.text, textStyle: { color: flag.textColor }, iconPosition: "right", size: "medium", style: {
|
|
17
19
|
position: "absolute",
|
|
18
20
|
top: 0,
|
|
19
21
|
left: 0,
|
|
20
22
|
backgroundColor: flag.color,
|
|
23
|
+
padding: theme.spacing.xxs2,
|
|
21
24
|
}, icon: flag.icon }, flag.name + index + productName)))), isFavorite && showFavoriteButton && (_jsx(TouchableOpacity, { style: [
|
|
22
25
|
isFavorite ? styles.favoriteButton : styles.unfavoriteButton,
|
|
23
26
|
], 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: "#101010", fill: "#101010" }), _jsxs(View, { style: styles.reviewCountWrapper, children: [_jsx(Text, { style: styles.ratingText, children: rating }), _jsxs(Text, { style: styles.reviewCountText, children: ["(", reviewCount, ")"] })] })] })), _jsx(View, { style: styles.priceContainer, children: _jsx(Text, { style: styles.priceText, accessibilityLabel: `Preço: ${price}`, children: price }) })] }))] })), [
|