decathlon-ui 0.3.47 → 0.3.48
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/badge/badge.component.d.ts.map +1 -1
- package/dist/components/badge/badge.component.js +12 -3
- 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/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/product-card/product-card.component.d.ts.map +1 -1
- package/dist/components/product-card/product-card.component.js +18 -4
- package/dist/components/product-card/product-card.styles.d.ts +17 -3
- package/dist/components/product-card/product-card.styles.d.ts.map +1 -1
- package/dist/components/product-card/product-card.styles.js +24 -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 -9
- package/dist/components/product-highlight/product-highlight.d.ts.map +1 -1
- package/dist/components/search-input/index.d.ts +3 -0
- package/dist/components/search-input/index.d.ts.map +1 -0
- package/dist/components/search-input/index.js +1 -0
- package/dist/components/search-input/search-input.component.d.ts +4 -0
- package/dist/components/search-input/search-input.component.d.ts.map +1 -0
- package/dist/components/search-input/search-input.component.js +46 -0
- package/dist/components/search-input/search-input.styles.d.ts +56 -0
- package/dist/components/search-input/search-input.styles.d.ts.map +1 -0
- package/dist/components/search-input/search-input.styles.js +60 -0
- package/dist/components/search-input/search-input.types.d.ts +13 -0
- package/dist/components/search-input/search-input.types.d.ts.map +1 -0
- package/dist/components/search-input/search-input.types.js +1 -0
- 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 +7 -5
- package/dist/components/button/button.types.d.ts +0 -23
- package/dist/components/button/button.types.d.ts.map +0 -1
- package/dist/components/button/button.types.js +0 -14
- package/dist/components/store-card/styles.d.ts +0 -103
- package/dist/components/store-card/styles.d.ts.map +0 -1
- package/dist/components/store-card/styles.js +0 -103
- package/dist/icons/components/Alipay.d.ts +0 -4
- package/dist/icons/components/Alipay.d.ts.map +0 -1
- package/dist/icons/components/Alipay.js +0 -4
- package/dist/icons/components/Amex.d.ts +0 -4
- package/dist/icons/components/Amex.d.ts.map +0 -1
- package/dist/icons/components/Amex.js +0 -4
- package/dist/icons/components/CodeFront.d.ts +0 -4
- package/dist/icons/components/CodeFront.d.ts.map +0 -1
- package/dist/icons/components/CodeFront.js +0 -16
- package/dist/icons/components/Diners.d.ts +0 -4
- package/dist/icons/components/Diners.d.ts.map +0 -1
- package/dist/icons/components/Diners.js +0 -4
- package/dist/icons/components/Discover.d.ts +0 -4
- package/dist/icons/components/Discover.d.ts.map +0 -1
- package/dist/icons/components/Discover.js +0 -4
- package/dist/icons/components/Elo.d.ts +0 -4
- package/dist/icons/components/Elo.d.ts.map +0 -1
- package/dist/icons/components/Elo.js +0 -4
- package/dist/icons/components/Generic.d.ts +0 -4
- package/dist/icons/components/Generic.d.ts.map +0 -1
- package/dist/icons/components/Generic.js +0 -4
- package/dist/icons/components/Hiper.d.ts +0 -4
- package/dist/icons/components/Hiper.d.ts.map +0 -1
- package/dist/icons/components/Hiper.js +0 -6
- package/dist/icons/components/Hipercard.d.ts +0 -4
- package/dist/icons/components/Hipercard.d.ts.map +0 -1
- package/dist/icons/components/Hipercard.js +0 -4
- package/dist/icons/components/Jcb.d.ts +0 -4
- package/dist/icons/components/Jcb.d.ts.map +0 -1
- package/dist/icons/components/Jcb.js +0 -4
- package/dist/icons/components/Maestro.d.ts +0 -4
- package/dist/icons/components/Maestro.d.ts.map +0 -1
- package/dist/icons/components/Maestro.js +0 -4
- package/dist/icons/components/Mastercard.d.ts +0 -4
- package/dist/icons/components/Mastercard.d.ts.map +0 -1
- package/dist/icons/components/Mastercard.js +0 -4
- package/dist/icons/components/Mir.d.ts +0 -4
- package/dist/icons/components/Mir.d.ts.map +0 -1
- package/dist/icons/components/Mir.js +0 -10
- package/dist/icons/components/MoneyIcon.d.ts +0 -4
- package/dist/icons/components/MoneyIcon.d.ts.map +0 -1
- package/dist/icons/components/MoneyIcon.js +0 -4
- package/dist/icons/components/StarFill.d.ts +0 -4
- package/dist/icons/components/StarFill.d.ts.map +0 -1
- package/dist/icons/components/StarFill.js +0 -4
- package/dist/icons/components/Unionpay.d.ts +0 -4
- package/dist/icons/components/Unionpay.d.ts.map +0 -1
- package/dist/icons/components/Unionpay.js +0 -4
- package/dist/icons/components/Visa.d.ts +0 -4
- package/dist/icons/components/Visa.d.ts.map +0 -1
- package/dist/icons/components/Visa.js +0 -4
- package/dist/icons/components/index.d.ts +0 -272
- package/dist/icons/components/index.d.ts.map +0 -1
- package/dist/icons/components/index.js +0 -270
|
@@ -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;
|
|
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;AAkFhD,eAAO,MAAM,KAAK,6FApEf,UAAU,6CAoEkC,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { Text, View } from "react-native";
|
|
2
|
+
import { Platform, Text, View } from "react-native";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { SvgUri } from "react-native-svg";
|
|
5
4
|
import { useBadgeStyles } from "./badge.styles";
|
|
6
5
|
/**
|
|
7
6
|
* Badge - Componente para exibição de etiquetas ou marcadores
|
|
@@ -14,7 +13,17 @@ const BadgeComponent = ({ text, variant, size = "medium", style, textStyle, icon
|
|
|
14
13
|
return null;
|
|
15
14
|
}
|
|
16
15
|
if (typeof icon === "string" && icon.includes(".svg")) {
|
|
17
|
-
|
|
16
|
+
// Suporte a URIs SVG apenas em plataformas nativas, onde SvgUri está disponível.
|
|
17
|
+
if (Platform.OS !== "web") {
|
|
18
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-var-requires
|
|
19
|
+
const { SvgUri } = require("react-native-svg");
|
|
20
|
+
if (SvgUri) {
|
|
21
|
+
return (_jsx(View, { style: styles.iconContainer, children: _jsx(SvgUri, { uri: icon, width: 12, height: 12 }) }));
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
// No ambiente web (storybook) ou quando SvgUri não estiver disponível,
|
|
25
|
+
// o ícone via string é ignorado para evitar erros de build.
|
|
26
|
+
return null;
|
|
18
27
|
}
|
|
19
28
|
return _jsx(View, { style: styles.iconContainer, children: icon });
|
|
20
29
|
};
|
|
@@ -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
|
}
|
|
@@ -27,6 +27,7 @@ export * from "./radio/index";
|
|
|
27
27
|
export * from "./range-slider/index";
|
|
28
28
|
export * from "./search-button/index";
|
|
29
29
|
export * from "./search-pill/index";
|
|
30
|
+
export * from "./search-input/index";
|
|
30
31
|
export * from "./select/index";
|
|
31
32
|
export * from "./seller-box/index";
|
|
32
33
|
export * from "./stars-rating/index";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uCAAuC,CAAC;AACtD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AAEvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,cAAc,uBAAuB,CAAC;AACtC,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uCAAuC,CAAC;AACtD,cAAc,6BAA6B,CAAC;AAC5C,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,uBAAuB,CAAC;AACtC,cAAc,kBAAkB,CAAC;AACjC,cAAc,oBAAoB,CAAC;AACnC,cAAc,qBAAqB,CAAC;AACpC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,wBAAwB,CAAC;AACvC,cAAc,iBAAiB,CAAC;AAChC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,2BAA2B,CAAC;AAC1C,cAAc,wBAAwB,CAAC;AAEvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,eAAe,CAAC;AAC9B,cAAc,sBAAsB,CAAC;AACrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,qBAAqB,CAAC;AACpC,cAAc,sBAAsB,CAAC;AACrC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,oBAAoB,CAAC;AACnC,cAAc,eAAe,CAAC;AAC9B,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC"}
|
package/dist/components/index.js
CHANGED
|
@@ -27,6 +27,7 @@ export * from "./radio/index";
|
|
|
27
27
|
export * from "./range-slider/index";
|
|
28
28
|
export * from "./search-button/index";
|
|
29
29
|
export * from "./search-pill/index";
|
|
30
|
+
export * from "./search-input/index";
|
|
30
31
|
export * from "./select/index";
|
|
31
32
|
export * from "./seller-box/index";
|
|
32
33
|
export * from "./stars-rating/index";
|
|
@@ -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;AAwQ7D,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,29 @@ 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: `Preço à vista: ${cashPrice}`, children: `${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 }))] }))] })), [
|
|
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: `Preço à vista: ${cashPrice}`, children: `${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
59
|
brand,
|
|
56
60
|
cashPrice,
|
|
61
|
+
colorsVariants,
|
|
62
|
+
customStyles,
|
|
63
|
+
discountPrice,
|
|
64
|
+
flags,
|
|
65
|
+
handleAddToCartPress,
|
|
57
66
|
handleFavoritePress,
|
|
58
67
|
imageUrl,
|
|
59
68
|
isFavorite,
|
|
69
|
+
isLoadingFavorite,
|
|
60
70
|
offerPrice,
|
|
71
|
+
onAddToCartPress,
|
|
61
72
|
parsePriceToNumber,
|
|
62
73
|
price,
|
|
63
74
|
productName,
|
|
64
75
|
rating,
|
|
65
76
|
reviewCount,
|
|
77
|
+
showFavoriteButton,
|
|
78
|
+
showRating,
|
|
66
79
|
styles,
|
|
80
|
+
theme.spacing.xxs2,
|
|
67
81
|
variant,
|
|
68
82
|
]);
|
|
69
83
|
if (onPress) {
|
|
@@ -47,8 +47,8 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant, custom
|
|
|
47
47
|
};
|
|
48
48
|
priceContainer: {
|
|
49
49
|
display: "flex";
|
|
50
|
-
flexDirection: "column";
|
|
51
|
-
alignItems: "flex-start";
|
|
50
|
+
flexDirection: "row" | "column";
|
|
51
|
+
alignItems: "flex-start" | "center";
|
|
52
52
|
marginTop: number;
|
|
53
53
|
gap: number;
|
|
54
54
|
};
|
|
@@ -60,9 +60,10 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant, custom
|
|
|
60
60
|
};
|
|
61
61
|
priceDiscountText: {
|
|
62
62
|
fontFamily: string;
|
|
63
|
-
fontWeight: "
|
|
63
|
+
fontWeight: "400";
|
|
64
64
|
fontStyle: "normal";
|
|
65
65
|
fontSize: number;
|
|
66
|
+
lineHeight: number;
|
|
66
67
|
letterSpacing: number;
|
|
67
68
|
color: string;
|
|
68
69
|
textDecorationLine: "line-through";
|
|
@@ -95,6 +96,7 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant, custom
|
|
|
95
96
|
color: string;
|
|
96
97
|
fontSize: number;
|
|
97
98
|
lineHeight: number;
|
|
99
|
+
display: "none" | "flex";
|
|
98
100
|
};
|
|
99
101
|
favoriteButton: {
|
|
100
102
|
display: "none" | "flex";
|
|
@@ -108,6 +110,18 @@ export declare const useProductCardStyles: (variant?: ProductCardVariant, custom
|
|
|
108
110
|
top: number;
|
|
109
111
|
right: number;
|
|
110
112
|
};
|
|
113
|
+
addToCartButton: {
|
|
114
|
+
display: "none" | "flex";
|
|
115
|
+
position: "absolute";
|
|
116
|
+
right: number;
|
|
117
|
+
bottom: number;
|
|
118
|
+
width: number;
|
|
119
|
+
height: number;
|
|
120
|
+
borderRadius: number;
|
|
121
|
+
backgroundColor: string;
|
|
122
|
+
justifyContent: "center";
|
|
123
|
+
alignItems: "center";
|
|
124
|
+
};
|
|
111
125
|
ratingText: {
|
|
112
126
|
color: string;
|
|
113
127
|
};
|
|
@@ -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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0JrB,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",
|
|
@@ -57,17 +58,17 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
57
58
|
fontWeight: "400",
|
|
58
59
|
},
|
|
59
60
|
nameContainer: {
|
|
60
|
-
marginTop: 4,
|
|
61
|
+
marginTop: variant === "shelfWithAddToCart" ? 0 : 4,
|
|
61
62
|
},
|
|
62
63
|
nameText: {
|
|
63
64
|
color: "#101010",
|
|
64
|
-
fontSize: 14,
|
|
65
|
-
lineHeight: 21,
|
|
65
|
+
fontSize: variant === "shelfWithAddToCart" ? 12 : 14,
|
|
66
|
+
lineHeight: variant === "shelfWithAddToCart" ? 18 : 21,
|
|
66
67
|
},
|
|
67
68
|
priceContainer: {
|
|
68
69
|
display: "flex",
|
|
69
|
-
flexDirection: "column",
|
|
70
|
-
alignItems: "flex-start",
|
|
70
|
+
flexDirection: variant === "shelfWithAddToCart" ? "row" : "column",
|
|
71
|
+
alignItems: variant === "shelfWithAddToCart" ? "center" : "flex-start",
|
|
71
72
|
marginTop: 8,
|
|
72
73
|
gap: 8,
|
|
73
74
|
},
|
|
@@ -75,13 +76,14 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
75
76
|
fontSize: 14,
|
|
76
77
|
color: "#101010",
|
|
77
78
|
fontWeight: "500",
|
|
78
|
-
lineHeight: 16.8,
|
|
79
|
+
lineHeight: 16.8, // 120%
|
|
79
80
|
},
|
|
80
81
|
priceDiscountText: {
|
|
81
82
|
fontFamily: "Inter",
|
|
82
|
-
fontWeight: "
|
|
83
|
-
fontStyle: "normal",
|
|
83
|
+
fontWeight: "400",
|
|
84
|
+
fontStyle: "normal",
|
|
84
85
|
fontSize: 10,
|
|
86
|
+
lineHeight: 10,
|
|
85
87
|
letterSpacing: 0,
|
|
86
88
|
color: "#616161",
|
|
87
89
|
textDecorationLine: "line-through",
|
|
@@ -114,6 +116,7 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
114
116
|
color: "#616161",
|
|
115
117
|
fontSize: 10,
|
|
116
118
|
lineHeight: 10,
|
|
119
|
+
display: variant === "shelfWithAddToCart" ? "none" : "flex",
|
|
117
120
|
},
|
|
118
121
|
favoriteButton: {
|
|
119
122
|
display: variant === "grid" ? "flex" : "none",
|
|
@@ -127,6 +130,18 @@ export const useProductCardStyles = (variant = "grid", customWidth) => {
|
|
|
127
130
|
top: 12,
|
|
128
131
|
right: 12,
|
|
129
132
|
},
|
|
133
|
+
addToCartButton: {
|
|
134
|
+
display: variant === "shelfWithAddToCart" ? "flex" : "none",
|
|
135
|
+
position: "absolute",
|
|
136
|
+
right: 8,
|
|
137
|
+
bottom: -16,
|
|
138
|
+
width: 32,
|
|
139
|
+
height: 32,
|
|
140
|
+
borderRadius: 16,
|
|
141
|
+
backgroundColor: "#101010",
|
|
142
|
+
justifyContent: "center",
|
|
143
|
+
alignItems: "center",
|
|
144
|
+
},
|
|
130
145
|
ratingText: {
|
|
131
146
|
color: "#383838",
|
|
132
147
|
},
|
|
@@ -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,14 +1,6 @@
|
|
|
1
1
|
import type { StoryObj } from "@storybook/react";
|
|
2
2
|
import React from "react";
|
|
3
|
-
declare const meta:
|
|
4
|
-
title: string;
|
|
5
|
-
component: React.NamedExoticComponent<import("./product-highlight.types").ProductHighlightsContainerProps>;
|
|
6
|
-
argTypes: {};
|
|
7
|
-
args: {
|
|
8
|
-
children: import("react/jsx-runtime").JSX.Element;
|
|
9
|
-
};
|
|
10
|
-
decorators: ((Story: React.FC<any>) => import("react/jsx-runtime").JSX.Element)[];
|
|
11
|
-
};
|
|
3
|
+
declare const meta: Meta<React.NamedExoticComponent<import("./product-highlight.types").ProductHighlightsContainerProps>>;
|
|
12
4
|
export default meta;
|
|
13
5
|
type Story = StoryObj<typeof meta>;
|
|
14
6
|
export declare const Default: Story;
|
|
@@ -1 +1 @@
|
|
|
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
|
|
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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/search-input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { SearchInput } from "./search-input.component";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-input.component.d.ts","sourceRoot":"","sources":["../../../src/components/search-input/search-input.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAM1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AA2F7D,eAAO,MAAM,WAAW,8CAAmC,CAAC"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Text, TextInput, View, TouchableOpacity } from "react-native";
|
|
4
|
+
import { SearchIcon } from "../../icons";
|
|
5
|
+
import { useTheme } from "../../themes";
|
|
6
|
+
import { useSearchInputStyles } from "./search-input.styles";
|
|
7
|
+
const SearchInputComponent = ({ value: controlledValue, onChangeText, placeholder, onClearPress, testID, onFocus, onBlur, ...rest }) => {
|
|
8
|
+
const styles = useSearchInputStyles();
|
|
9
|
+
const theme = useTheme();
|
|
10
|
+
const [isFocused, setIsFocused] = React.useState(false);
|
|
11
|
+
const [uncontrolledValue, setUncontrolledValue] = React.useState("");
|
|
12
|
+
const isControlled = controlledValue !== undefined;
|
|
13
|
+
const value = isControlled ? controlledValue : uncontrolledValue;
|
|
14
|
+
const isFilled = !!value && value.length > 0;
|
|
15
|
+
const handleChangeText = (text) => {
|
|
16
|
+
if (!isControlled) {
|
|
17
|
+
setUncontrolledValue(text);
|
|
18
|
+
}
|
|
19
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText(text);
|
|
20
|
+
};
|
|
21
|
+
const handleClear = () => {
|
|
22
|
+
if (!isControlled) {
|
|
23
|
+
setUncontrolledValue("");
|
|
24
|
+
}
|
|
25
|
+
onClearPress === null || onClearPress === void 0 ? void 0 : onClearPress();
|
|
26
|
+
onChangeText === null || onChangeText === void 0 ? void 0 : onChangeText("");
|
|
27
|
+
};
|
|
28
|
+
const handleFocus = (event) => {
|
|
29
|
+
setIsFocused(true);
|
|
30
|
+
onFocus === null || onFocus === void 0 ? void 0 : onFocus(event);
|
|
31
|
+
};
|
|
32
|
+
const handleBlur = (event) => {
|
|
33
|
+
setIsFocused(false);
|
|
34
|
+
onBlur === null || onBlur === void 0 ? void 0 : onBlur(event);
|
|
35
|
+
};
|
|
36
|
+
const fieldStateStyle = isFilled
|
|
37
|
+
? styles.fieldFilled
|
|
38
|
+
: isFocused
|
|
39
|
+
? styles.fieldActive
|
|
40
|
+
: styles.fieldDefault;
|
|
41
|
+
return (_jsx(View, { style: styles.container, testID: testID, children: _jsxs(View, { style: [styles.fieldBase, fieldStateStyle], children: [_jsx(View, { style: styles.icon, children: _jsx(SearchIcon, { size: 24, color: isFilled || isFocused
|
|
42
|
+
? theme.colors.iconPrimary
|
|
43
|
+
: theme.colors.iconTertiary }) }), _jsx(TextInput, { style: [styles.input, !isFilled && styles.placeholderText], placeholder: placeholder, value: value, onChangeText: handleChangeText, onFocus: handleFocus, onBlur: handleBlur, placeholderTextColor: theme.colors.textTertiary, ...rest }), isFilled && (_jsx(TouchableOpacity, { accessibilityRole: "button", accessibilityLabel: "Limpar busca", style: styles.clearButton, onPress: handleClear, hitSlop: theme.hitSlopWidth.sm, children: _jsx(Text, { style: styles.clearText, children: "Limpar" }) }))] }) }));
|
|
44
|
+
};
|
|
45
|
+
export const SearchInput = React.memo(SearchInputComponent);
|
|
46
|
+
SearchInput.displayName = "SearchInput";
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
export declare const useSearchInputStyles: () => {
|
|
2
|
+
container: {
|
|
3
|
+
width: "100%";
|
|
4
|
+
};
|
|
5
|
+
fieldBase: {
|
|
6
|
+
flexDirection: "row";
|
|
7
|
+
alignItems: "center";
|
|
8
|
+
borderRadius: 360;
|
|
9
|
+
paddingHorizontal: 16;
|
|
10
|
+
paddingVertical: 12;
|
|
11
|
+
gap: 8;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
fieldDefault: {
|
|
15
|
+
backgroundColor: string;
|
|
16
|
+
};
|
|
17
|
+
fieldActive: {
|
|
18
|
+
backgroundColor: "#FFFFFF";
|
|
19
|
+
borderWidth: 2;
|
|
20
|
+
borderColor: "#3643BA";
|
|
21
|
+
};
|
|
22
|
+
fieldFilled: {
|
|
23
|
+
backgroundColor: "#FFFFFF";
|
|
24
|
+
borderWidth: 2;
|
|
25
|
+
borderColor: "#3643BA";
|
|
26
|
+
};
|
|
27
|
+
icon: {
|
|
28
|
+
width: number;
|
|
29
|
+
height: number;
|
|
30
|
+
justifyContent: "center";
|
|
31
|
+
alignItems: "center";
|
|
32
|
+
};
|
|
33
|
+
input: {
|
|
34
|
+
flex: number;
|
|
35
|
+
padding: number;
|
|
36
|
+
margin: number;
|
|
37
|
+
fontFamily: "Inter-Regular";
|
|
38
|
+
fontSize: 14;
|
|
39
|
+
lineHeight: number;
|
|
40
|
+
color: "#383838";
|
|
41
|
+
};
|
|
42
|
+
placeholderText: {
|
|
43
|
+
color: "#616161";
|
|
44
|
+
};
|
|
45
|
+
clearButton: {
|
|
46
|
+
marginLeft: number;
|
|
47
|
+
};
|
|
48
|
+
clearText: {
|
|
49
|
+
fontFamily: "Inter-Medium";
|
|
50
|
+
fontSize: 14;
|
|
51
|
+
lineHeight: number;
|
|
52
|
+
letterSpacing: number;
|
|
53
|
+
color: "#3643BA";
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
//# sourceMappingURL=search-input.styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-input.styles.d.ts","sourceRoot":"","sources":["../../../src/components/search-input/search-input.styles.ts"],"names":[],"mappings":"AAGA,eAAO,MAAM,oBAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0DhC,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { useTheme } from "../../themes";
|
|
3
|
+
export const useSearchInputStyles = () => {
|
|
4
|
+
const theme = useTheme();
|
|
5
|
+
return StyleSheet.create({
|
|
6
|
+
container: {
|
|
7
|
+
width: "100%",
|
|
8
|
+
},
|
|
9
|
+
fieldBase: {
|
|
10
|
+
flexDirection: "row",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
borderRadius: theme.radius.round,
|
|
13
|
+
paddingHorizontal: theme.spacing.md,
|
|
14
|
+
paddingVertical: theme.spacing.sm,
|
|
15
|
+
gap: theme.spacing.xs,
|
|
16
|
+
height: 56,
|
|
17
|
+
},
|
|
18
|
+
fieldDefault: {
|
|
19
|
+
backgroundColor: "#F5F4F5",
|
|
20
|
+
},
|
|
21
|
+
fieldActive: {
|
|
22
|
+
backgroundColor: theme.colors.backgroundPrimary,
|
|
23
|
+
borderWidth: theme.borderWidth.md,
|
|
24
|
+
borderColor: theme.colors.borderInformation,
|
|
25
|
+
},
|
|
26
|
+
fieldFilled: {
|
|
27
|
+
backgroundColor: theme.colors.backgroundPrimary,
|
|
28
|
+
borderWidth: theme.borderWidth.md,
|
|
29
|
+
borderColor: theme.colors.borderInformation,
|
|
30
|
+
},
|
|
31
|
+
icon: {
|
|
32
|
+
width: 24,
|
|
33
|
+
height: 24,
|
|
34
|
+
justifyContent: "center",
|
|
35
|
+
alignItems: "center",
|
|
36
|
+
},
|
|
37
|
+
input: {
|
|
38
|
+
flex: 1,
|
|
39
|
+
padding: 0,
|
|
40
|
+
margin: 0,
|
|
41
|
+
fontFamily: theme.fonts.inter.regular,
|
|
42
|
+
fontSize: theme.fonts.sizes.xs,
|
|
43
|
+
lineHeight: 21,
|
|
44
|
+
color: theme.colors.textSecondary,
|
|
45
|
+
},
|
|
46
|
+
placeholderText: {
|
|
47
|
+
color: theme.colors.textTertiary,
|
|
48
|
+
},
|
|
49
|
+
clearButton: {
|
|
50
|
+
marginLeft: theme.spacing.xs * 2,
|
|
51
|
+
},
|
|
52
|
+
clearText: {
|
|
53
|
+
fontFamily: theme.fonts.inter.medium,
|
|
54
|
+
fontSize: theme.fonts.sizes.xs,
|
|
55
|
+
lineHeight: 21,
|
|
56
|
+
letterSpacing: -0.01,
|
|
57
|
+
color: theme.colors.textAction,
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { TextInputProps } from "react-native";
|
|
2
|
+
export interface SearchInputProps extends Omit<TextInputProps, "onChangeText" | "value"> {
|
|
3
|
+
value?: string;
|
|
4
|
+
onChangeText?: (text: string) => void;
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Callback disparado quando o usuário toca em "Limpar".
|
|
8
|
+
* Caso não seja informado, o componente limpará o texto internamente.
|
|
9
|
+
*/
|
|
10
|
+
onClearPress?: () => void;
|
|
11
|
+
testID?: string;
|
|
12
|
+
}
|
|
13
|
+
//# sourceMappingURL=search-input.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"search-input.types.d.ts","sourceRoot":"","sources":["../../../src/components/search-input/search-input.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAEnD,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,cAAc,EAAE,cAAc,GAAG,OAAO,CAAC;IACtD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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
|
};
|