decathlon-ui 2.0.0 → 2.0.1
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 +9 -4
- package/dist/components/delivery-option-card/delivery-option-card.component.d.ts.map +1 -1
- package/dist/components/delivery-option-card/delivery-option-card.component.js +26 -2
- package/dist/components/delivery-option-card/delivery-option-card.styles.d.ts +6 -0
- package/dist/components/delivery-option-card/delivery-option-card.styles.d.ts.map +1 -1
- package/dist/components/delivery-option-card/delivery-option-card.styles.js +6 -0
- package/dist/components/delivery-option-card/delivery-option-card.types.d.ts +7 -0
- package/dist/components/delivery-option-card/delivery-option-card.types.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -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;AA6IhD,eAAO,MAAM,KAAK,qHAzHf,UAAU,oDAyHkC,CAAC"}
|
|
@@ -12,9 +12,12 @@ const BadgeComponent = ({ text, children, variant, tone, filled = false, size =
|
|
|
12
12
|
const tagMode = tone != null ||
|
|
13
13
|
(isRenderable(children) && text === undefined);
|
|
14
14
|
const tagToneResolved = tone !== null && tone !== void 0 ? tone : "neutral";
|
|
15
|
-
const legacyVariant = variant
|
|
15
|
+
const legacyVariant = variant;
|
|
16
16
|
const tagStyles = useCheckoutTagStyles(tagToneResolved, filled);
|
|
17
|
-
const legacyStyles = useBadgeStyles(legacyVariant, size);
|
|
17
|
+
const legacyStyles = useBadgeStyles(legacyVariant !== null && legacyVariant !== void 0 ? legacyVariant : "default", size);
|
|
18
|
+
const legacyVariantColors = legacyVariant
|
|
19
|
+
? legacyStyles[legacyVariant]
|
|
20
|
+
: undefined;
|
|
18
21
|
const renderIconTag = (tagIcon) => {
|
|
19
22
|
if (typeof tagIcon === "string" && tagIcon.includes(".svg")) {
|
|
20
23
|
if (Platform.OS !== "web") {
|
|
@@ -64,14 +67,16 @@ const BadgeComponent = ({ text, children, variant, tone, filled = false, size =
|
|
|
64
67
|
};
|
|
65
68
|
return (_jsxs(View, { style: [
|
|
66
69
|
legacyStyles.container,
|
|
67
|
-
|
|
70
|
+
legacyVariantColors && {
|
|
71
|
+
backgroundColor: legacyVariantColors.backgroundColor,
|
|
72
|
+
},
|
|
68
73
|
style,
|
|
69
74
|
], children: [icon != null && iconPosition === "left"
|
|
70
75
|
? renderIconLegacy(icon)
|
|
71
76
|
: null, _jsx(Text, { style: [
|
|
72
77
|
legacyStyles.text,
|
|
73
78
|
getSizeStyle(),
|
|
74
|
-
|
|
79
|
+
legacyVariantColors && { color: legacyVariantColors.color },
|
|
75
80
|
textStyle,
|
|
76
81
|
], children: text }), icon != null && iconPosition === "right"
|
|
77
82
|
? renderIconLegacy(icon)
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-option-card.component.d.ts","sourceRoot":"","sources":["../../../src/components/delivery-option-card/delivery-option-card.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"delivery-option-card.component.d.ts","sourceRoot":"","sources":["../../../src/components/delivery-option-card/delivery-option-card.component.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAc1B,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,8BAA8B,CAAC;AAwL5E,eAAO,MAAM,kBAAkB,qDAA0C,CAAC"}
|
|
@@ -4,7 +4,16 @@ import { Text, TouchableOpacity, View, } from "react-native";
|
|
|
4
4
|
import { BagIcon, ChevronRightIcon, StarIcon, } from "../../icons";
|
|
5
5
|
import { useTheme } from "../../themes";
|
|
6
6
|
import { useDeliveryOptionCardStyles } from "./delivery-option-card.styles";
|
|
7
|
-
|
|
7
|
+
function renderDescriptionWithStoreName(description, storeName, styles) {
|
|
8
|
+
const index = description.indexOf(storeName);
|
|
9
|
+
if (index === -1) {
|
|
10
|
+
return _jsx(Text, { style: styles.subtitleText, children: description });
|
|
11
|
+
}
|
|
12
|
+
const before = description.slice(0, index);
|
|
13
|
+
const after = description.slice(index + storeName.length);
|
|
14
|
+
return (_jsxs(Text, { style: styles.subtitleText, children: [before, _jsx(Text, { style: styles.subtitleStoreName, children: storeName }), after] }));
|
|
15
|
+
}
|
|
16
|
+
const DeliveryOptionCardComponent = ({ testID, style, tone = "featured", disabled = false, selected = false, tags, onPress, leadingIcon, showRecommendedBadge, recommendedBadgeIcon, advantageousLabel, title, trailingTitle, subtitle, description, pickupDescriptionPrefix, pickupStoreName, showAvailabilityIndicator, availabilitySummary, changeStoreLabel, onChangeStorePress, }) => {
|
|
8
17
|
const theme = useTheme();
|
|
9
18
|
const styles = useDeliveryOptionCardStyles({
|
|
10
19
|
tone,
|
|
@@ -13,10 +22,25 @@ const DeliveryOptionCardComponent = ({ testID, style, tone = "featured", disable
|
|
|
13
22
|
});
|
|
14
23
|
const subtitleContent = subtitle !== null && subtitle !== void 0 ? subtitle : description;
|
|
15
24
|
const effectiveSelected = selected && !disabled;
|
|
25
|
+
const renderSubtitle = () => {
|
|
26
|
+
if (pickupStoreName) {
|
|
27
|
+
if (pickupDescriptionPrefix != null) {
|
|
28
|
+
return (_jsxs(Text, { style: styles.subtitleText, children: [pickupDescriptionPrefix, _jsx(Text, { style: styles.subtitleStoreName, children: pickupStoreName })] }));
|
|
29
|
+
}
|
|
30
|
+
if (typeof subtitleContent === "string") {
|
|
31
|
+
return renderDescriptionWithStoreName(subtitleContent, pickupStoreName, styles);
|
|
32
|
+
}
|
|
33
|
+
return (_jsx(Text, { style: styles.subtitleStoreName, children: pickupStoreName }));
|
|
34
|
+
}
|
|
35
|
+
if (typeof subtitleContent === "string") {
|
|
36
|
+
return _jsx(Text, { style: styles.subtitleText, children: subtitleContent });
|
|
37
|
+
}
|
|
38
|
+
return subtitleContent;
|
|
39
|
+
};
|
|
16
40
|
const badgesSection = tags !== null && tags !== void 0 ? tags : (_jsxs(_Fragment, { children: [showRecommendedBadge ? (_jsxs(View, { style: styles.recommendedBadge, children: [recommendedBadgeIcon !== null && recommendedBadgeIcon !== void 0 ? recommendedBadgeIcon : (_jsx(StarIcon, { size: 12, color: theme.colors.white })), _jsx(Text, { style: styles.recommendedText, children: "Recomendado" })] })) : null, advantageousLabel ? (_jsx(View, { style: styles.advantageousBadge, children: _jsx(Text, { style: styles.advantageousText, children: advantageousLabel }) })) : null] }));
|
|
17
41
|
const cardBody = (_jsxs(_Fragment, { children: [_jsxs(View, { style: styles.topRow, children: [_jsxs(View, { style: styles.leadingCluster, children: [leadingIcon !== null && leadingIcon !== void 0 ? leadingIcon : (_jsx(BagIcon, { size: 20, color: theme.colors.iconPrimary })), _jsx(View, { style: styles.badgesColumn, children: badgesSection })] }), _jsx(View, { style: effectiveSelected
|
|
18
42
|
? styles.radioOuterSelected
|
|
19
|
-
: styles.radioOuterIdle, children: effectiveSelected ? _jsx(View, { style: styles.radioInner }) : null })] }), _jsxs(View, { style: styles.titleRow, children: [_jsx(Text, { style: styles.title, numberOfLines: 2, children: title }), trailingTitle ? (_jsx(Text, { style: styles.trailingTitle, children: trailingTitle })) : null] }), subtitleContent ? (_jsx(View, { style: styles.subtitle, children:
|
|
43
|
+
: styles.radioOuterIdle, children: effectiveSelected ? _jsx(View, { style: styles.radioInner }) : null })] }), _jsxs(View, { style: styles.titleRow, children: [_jsx(Text, { style: styles.title, numberOfLines: 2, children: title }), trailingTitle ? (_jsx(Text, { style: styles.trailingTitle, children: trailingTitle })) : null] }), subtitleContent || pickupStoreName ? (_jsx(View, { style: styles.subtitle, children: renderSubtitle() })) : null, availabilitySummary ? (_jsxs(View, { style: styles.availabilityRow, children: [showAvailabilityIndicator ? (_jsx(View, { style: styles.availabilityBar })) : null, _jsx(View, { style: { flex: 1 }, children: availabilitySummary })] })) : null, changeStoreLabel && onChangeStorePress && !disabled ? (_jsxs(TouchableOpacity, { onPress: onChangeStorePress, style: styles.footerLink, hitSlop: { top: 8, bottom: 8, left: 4, right: 8 }, accessibilityRole: "link", children: [_jsx(Text, { style: styles.footerLinkText, children: changeStoreLabel }), _jsx(ChevronRightIcon, { size: 14, color: theme.colors.primary })] })) : null] }));
|
|
20
44
|
if (onPress && !disabled) {
|
|
21
45
|
return (_jsx(TouchableOpacity, { testID: testID, accessibilityRole: "button", accessibilityState: { disabled: false }, style: [styles.card, style], onPress: onPress, activeOpacity: 0.85, children: cardBody }));
|
|
22
46
|
}
|
|
@@ -138,6 +138,12 @@ export declare const useDeliveryOptionCardStyles: ({ tone, selected, disabled, }
|
|
|
138
138
|
lineHeight: number;
|
|
139
139
|
color: "#4A5565";
|
|
140
140
|
};
|
|
141
|
+
subtitleStoreName: {
|
|
142
|
+
fontFamily: "Inter-SemiBold";
|
|
143
|
+
fontSize: number;
|
|
144
|
+
lineHeight: number;
|
|
145
|
+
color: "#101010";
|
|
146
|
+
};
|
|
141
147
|
availabilityRow: {
|
|
142
148
|
flexDirection: "row";
|
|
143
149
|
alignItems: "flex-start";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-option-card.styles.d.ts","sourceRoot":"","sources":["../../../src/components/delivery-option-card/delivery-option-card.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,+BAIzC,OAAO
|
|
1
|
+
{"version":3,"file":"delivery-option-card.styles.d.ts","sourceRoot":"","sources":["../../../src/components/delivery-option-card/delivery-option-card.styles.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,8BAA8B,CAAC;AAEvE,KAAK,OAAO,GAAG;IACb,IAAI,EAAE,kBAAkB,CAAC;IACzB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,eAAO,MAAM,2BAA2B,GAAI,+BAIzC,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoLT,CAAC"}
|
|
@@ -138,6 +138,12 @@ export const useDeliveryOptionCardStyles = ({ tone, selected, disabled = false,
|
|
|
138
138
|
lineHeight: 17.88,
|
|
139
139
|
color: theme.colors.textDeliveryMuted,
|
|
140
140
|
},
|
|
141
|
+
subtitleStoreName: {
|
|
142
|
+
fontFamily: theme.fonts.inter.semiBold,
|
|
143
|
+
fontSize: 13,
|
|
144
|
+
lineHeight: 17.88,
|
|
145
|
+
color: theme.colors.textPrimary,
|
|
146
|
+
},
|
|
141
147
|
availabilityRow: {
|
|
142
148
|
flexDirection: "row",
|
|
143
149
|
alignItems: "flex-start",
|
|
@@ -23,6 +23,13 @@ export type DeliveryOptionCardProps = {
|
|
|
23
23
|
subtitle?: ReactNode;
|
|
24
24
|
/** Alias de `subtitle` (layouts antigos) */
|
|
25
25
|
description?: ReactNode;
|
|
26
|
+
/**
|
|
27
|
+
* Texto antes do nome da loja (ex.: "Retire disponível após 2 horas do pagamento na ").
|
|
28
|
+
* Com `pickupStoreName`, renderiza o nome em negrito.
|
|
29
|
+
*/
|
|
30
|
+
pickupDescriptionPrefix?: string;
|
|
31
|
+
/** Nome da loja de retirada — exibido em negrito (com prefixo ou destacado dentro de `description` string). */
|
|
32
|
+
pickupStoreName?: string;
|
|
26
33
|
/** Barra lateral de contexto (ex.: aviso misto casa/loja) */
|
|
27
34
|
showAvailabilityIndicator?: boolean;
|
|
28
35
|
availabilitySummary?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"delivery-option-card.types.d.ts","sourceRoot":"","sources":["../../../src/components/delivery-option-card/delivery-option-card.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,yFAAyF;AACzF,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,gGAAgG;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sHAAsH;IACtH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,6DAA6D;IAC7D,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC,CAAC"}
|
|
1
|
+
{"version":3,"file":"delivery-option-card.types.d.ts","sourceRoot":"","sources":["../../../src/components/delivery-option-card/delivery-option-card.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzD,yFAAyF;AACzF,MAAM,MAAM,kBAAkB,GAAG,UAAU,GAAG,SAAS,CAAC;AAExD,MAAM,MAAM,uBAAuB,GAAG;IACpC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,gGAAgG;IAChG,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,sHAAsH;IACtH,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,iCAAiC;IACjC,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IACrB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,oBAAoB,CAAC,EAAE,OAAO,CAAC;IAC/B,oBAAoB,CAAC,EAAE,SAAS,CAAC;IACjC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,4CAA4C;IAC5C,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB;;;OAGG;IACH,uBAAuB,CAAC,EAAE,MAAM,CAAC;IACjC,+GAA+G;IAC/G,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,6DAA6D;IAC7D,yBAAyB,CAAC,EAAE,OAAO,CAAC;IACpC,mBAAmB,CAAC,EAAE,SAAS,CAAC;IAChC,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,kBAAkB,CAAC,EAAE,MAAM,IAAI,CAAC;CACjC,CAAC"}
|