decathlon-ui 0.3.50 → 2.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/.DS_Store +0 -0
- package/dist/components/badge/badge.component.d.ts +1 -1
- package/dist/components/badge/badge.component.d.ts.map +1 -1
- package/dist/components/badge/badge.component.js +53 -22
- package/dist/components/badge/badge.styles.d.ts +27 -1
- package/dist/components/badge/badge.styles.d.ts.map +1 -1
- package/dist/components/badge/badge.styles.js +76 -24
- package/dist/components/badge/badge.types.d.ts +15 -16
- package/dist/components/badge/badge.types.d.ts.map +1 -1
- package/dist/components/badge/index.d.ts +1 -1
- package/dist/components/badge/index.d.ts.map +1 -1
- 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/delivery-option-card/delivery-option-card.component.d.ts +4 -0
- package/dist/components/delivery-option-card/delivery-option-card.component.d.ts.map +1 -0
- package/dist/components/delivery-option-card/delivery-option-card.component.js +26 -0
- package/dist/components/delivery-option-card/delivery-option-card.styles.d.ts +169 -0
- package/dist/components/delivery-option-card/delivery-option-card.styles.d.ts.map +1 -0
- package/dist/components/delivery-option-card/delivery-option-card.styles.js +168 -0
- package/dist/components/delivery-option-card/delivery-option-card.types.d.ts +32 -0
- package/dist/components/delivery-option-card/delivery-option-card.types.d.ts.map +1 -0
- package/dist/components/delivery-option-card/delivery-option-card.types.js +1 -0
- package/dist/components/delivery-option-card/index.d.ts +3 -0
- package/dist/components/delivery-option-card/index.d.ts.map +1 -0
- package/dist/components/delivery-option-card/index.js +1 -0
- package/dist/components/delivery-orientation-banner/delivery-orientation-banner.component.d.ts +4 -0
- package/dist/components/delivery-orientation-banner/delivery-orientation-banner.component.d.ts.map +1 -0
- package/dist/components/delivery-orientation-banner/delivery-orientation-banner.component.js +13 -0
- package/dist/components/delivery-orientation-banner/delivery-orientation-banner.styles.d.ts +38 -0
- package/dist/components/delivery-orientation-banner/delivery-orientation-banner.styles.d.ts.map +1 -0
- package/dist/components/delivery-orientation-banner/delivery-orientation-banner.styles.js +42 -0
- package/dist/components/delivery-orientation-banner/delivery-orientation-banner.types.d.ts +17 -0
- package/dist/components/delivery-orientation-banner/delivery-orientation-banner.types.d.ts.map +1 -0
- package/dist/components/delivery-orientation-banner/delivery-orientation-banner.types.js +1 -0
- package/dist/components/delivery-orientation-banner/index.d.ts +3 -0
- package/dist/components/delivery-orientation-banner/index.d.ts.map +1 -0
- package/dist/components/delivery-orientation-banner/index.js +1 -0
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +2 -0
- 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/dist/themes/dark.d.ts +22 -0
- package/dist/themes/dark.d.ts.map +1 -1
- package/dist/themes/dark.js +22 -0
- package/dist/themes/index.d.ts +22 -0
- package/dist/themes/index.d.ts.map +1 -1
- package/dist/themes/light.d.ts +24 -0
- package/dist/themes/light.d.ts.map +1 -1
- package/dist/themes/light.js +24 -0
- package/package.json +3 -1
package/dist/.DS_Store
ADDED
|
Binary file
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import React from "react";
|
|
2
2
|
import type { BadgeProps } from "./badge.types";
|
|
3
|
-
export declare const Badge: React.MemoExoticComponent<({ text, variant, size, style, textStyle, icon, iconPosition, }: BadgeProps) => import("react/jsx-runtime").JSX.Element>;
|
|
3
|
+
export declare const Badge: React.MemoExoticComponent<({ text, children, variant, tone, filled, size, style, textStyle, icon, iconPosition, }: BadgeProps) => import("react/jsx-runtime").JSX.Element | null>;
|
|
4
4
|
//# sourceMappingURL=badge.component.d.ts.map
|
|
@@ -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;AAuIhD,eAAO,MAAM,KAAK,qHAnHf,UAAU,oDAmHkC,CAAC"}
|
|
@@ -1,50 +1,81 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Platform, Text, View } from "react-native";
|
|
3
3
|
import React from "react";
|
|
4
|
-
import { useBadgeStyles } from "./badge.styles";
|
|
4
|
+
import { useBadgeStyles, useCheckoutTagStyles } from "./badge.styles";
|
|
5
|
+
const isRenderable = (n) => n != null && n !== false && n !== true;
|
|
5
6
|
/**
|
|
6
|
-
* Badge
|
|
7
|
-
*
|
|
7
|
+
* Badge — etiquetas da lib; suporta o modelo de **Tag** do handoff de checkout
|
|
8
|
+
* (`tone`, `filled`, `children`, `icon`) e a API legada (`text`, `variant`).
|
|
8
9
|
*/
|
|
9
|
-
const BadgeComponent = ({ text, variant, size = "medium", style, textStyle, icon, iconPosition = "left", }) => {
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
|
|
10
|
+
const BadgeComponent = ({ text, children, variant, tone, filled = false, size = "medium", style, textStyle, icon, iconPosition = "left", }) => {
|
|
11
|
+
const label = children !== null && children !== void 0 ? children : text;
|
|
12
|
+
const tagMode = tone != null ||
|
|
13
|
+
(isRenderable(children) && text === undefined);
|
|
14
|
+
const tagToneResolved = tone !== null && tone !== void 0 ? tone : "neutral";
|
|
15
|
+
const legacyVariant = variant !== null && variant !== void 0 ? variant : "default";
|
|
16
|
+
const tagStyles = useCheckoutTagStyles(tagToneResolved, filled);
|
|
17
|
+
const legacyStyles = useBadgeStyles(legacyVariant, size);
|
|
18
|
+
const renderIconTag = (tagIcon) => {
|
|
19
|
+
if (typeof tagIcon === "string" && tagIcon.includes(".svg")) {
|
|
20
|
+
if (Platform.OS !== "web") {
|
|
21
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
22
|
+
const { SvgUri } = require("react-native-svg");
|
|
23
|
+
if (SvgUri) {
|
|
24
|
+
return (_jsx(SvgUri, { uri: tagIcon, width: 12, height: 12 }));
|
|
25
|
+
}
|
|
26
|
+
}
|
|
13
27
|
return null;
|
|
14
28
|
}
|
|
15
|
-
|
|
16
|
-
|
|
29
|
+
return tagIcon;
|
|
30
|
+
};
|
|
31
|
+
const renderIconLegacy = (tagIcon) => {
|
|
32
|
+
if (typeof tagIcon === "string" && tagIcon.includes(".svg")) {
|
|
17
33
|
if (Platform.OS !== "web") {
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
34
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
19
35
|
const { SvgUri } = require("react-native-svg");
|
|
20
36
|
if (SvgUri) {
|
|
21
|
-
return (_jsx(View, { style:
|
|
37
|
+
return (_jsx(View, { style: legacyStyles.iconContainer, children: _jsx(SvgUri, { uri: tagIcon, width: 12, height: 12 }) }));
|
|
22
38
|
}
|
|
23
39
|
}
|
|
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
40
|
return null;
|
|
27
41
|
}
|
|
28
|
-
return _jsx(View, { style:
|
|
42
|
+
return _jsx(View, { style: legacyStyles.iconContainer, children: tagIcon });
|
|
29
43
|
};
|
|
30
|
-
|
|
44
|
+
if (tagMode) {
|
|
45
|
+
if (!isRenderable(label)) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const primitiveLabel = typeof label === "string" || typeof label === "number";
|
|
49
|
+
return (_jsxs(View, { style: [tagStyles.container, style], accessibilityRole: "text", children: [icon != null && iconPosition === "left" ? (_jsx(View, { style: tagStyles.iconWrap, children: renderIconTag(icon) })) : null, primitiveLabel ? (_jsx(Text, { style: [tagStyles.label, textStyle], children: String(label) })) : (_jsx(View, { style: { flexShrink: 1 }, children: label })), icon != null && iconPosition === "right" ? (_jsx(View, { style: tagStyles.iconWrap, children: renderIconTag(icon) })) : null] }));
|
|
50
|
+
}
|
|
51
|
+
if (!isRenderable(text)) {
|
|
52
|
+
return null;
|
|
53
|
+
}
|
|
31
54
|
const getSizeStyle = () => {
|
|
32
55
|
switch (size) {
|
|
33
56
|
case "small":
|
|
34
|
-
return
|
|
57
|
+
return legacyStyles.small;
|
|
35
58
|
case "large":
|
|
36
|
-
return
|
|
59
|
+
return legacyStyles.large;
|
|
37
60
|
case "medium":
|
|
38
61
|
default:
|
|
39
|
-
return
|
|
62
|
+
return legacyStyles.medium;
|
|
40
63
|
}
|
|
41
64
|
};
|
|
42
|
-
return (_jsxs(View, { style: [
|
|
43
|
-
|
|
65
|
+
return (_jsxs(View, { style: [
|
|
66
|
+
legacyStyles.container,
|
|
67
|
+
!style && legacyVariant && legacyStyles[legacyVariant],
|
|
68
|
+
style,
|
|
69
|
+
], children: [icon != null && iconPosition === "left"
|
|
70
|
+
? renderIconLegacy(icon)
|
|
71
|
+
: null, _jsx(Text, { style: [
|
|
72
|
+
legacyStyles.text,
|
|
44
73
|
getSizeStyle(),
|
|
45
|
-
|
|
74
|
+
legacyVariant && legacyStyles[legacyVariant],
|
|
46
75
|
textStyle,
|
|
47
|
-
], children: text }), icon && iconPosition === "right"
|
|
76
|
+
], children: text }), icon != null && iconPosition === "right"
|
|
77
|
+
? renderIconLegacy(icon)
|
|
78
|
+
: null] }));
|
|
48
79
|
};
|
|
49
80
|
export const Badge = React.memo(BadgeComponent);
|
|
50
81
|
Badge.displayName = "Badge";
|
|
@@ -1,4 +1,30 @@
|
|
|
1
|
-
import type { BadgeSize, BadgeVariant } from "./badge.types";
|
|
1
|
+
import type { BadgeSize, BadgeTone, BadgeVariant } from "./badge.types";
|
|
2
|
+
export declare const useCheckoutTagStyles: (tone: BadgeTone, filled: boolean) => {
|
|
3
|
+
container: {
|
|
4
|
+
flexDirection: "row";
|
|
5
|
+
alignItems: "center";
|
|
6
|
+
alignSelf: "flex-start";
|
|
7
|
+
backgroundColor: string;
|
|
8
|
+
paddingHorizontal: 8;
|
|
9
|
+
paddingVertical: number;
|
|
10
|
+
gap: 4;
|
|
11
|
+
borderRadius: 360;
|
|
12
|
+
};
|
|
13
|
+
label: {
|
|
14
|
+
fontFamily: "Inter-Bold";
|
|
15
|
+
fontSize: 10;
|
|
16
|
+
lineHeight: number;
|
|
17
|
+
letterSpacing: number;
|
|
18
|
+
textTransform: "uppercase";
|
|
19
|
+
color: string;
|
|
20
|
+
};
|
|
21
|
+
iconWrap: {
|
|
22
|
+
width: number;
|
|
23
|
+
height: number;
|
|
24
|
+
alignItems: "center";
|
|
25
|
+
justifyContent: "center";
|
|
26
|
+
};
|
|
27
|
+
};
|
|
2
28
|
export declare const useBadgeStyles: (variant?: BadgeVariant, size?: BadgeSize) => {
|
|
3
29
|
container: {
|
|
4
30
|
padding: 6;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.styles.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"badge.styles.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAMxE,eAAO,MAAM,oBAAoB,GAAI,MAAM,SAAS,EAAE,QAAQ,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;CAqCpE,CAAC;AAiDF,eAAO,MAAM,cAAc,GACzB,UAAS,YAAwB,EACjC,OAAM,SAAoB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoE3B,CAAC"}
|
|
@@ -1,20 +1,80 @@
|
|
|
1
1
|
import { useMemo } from "react";
|
|
2
2
|
import { StyleSheet } from "react-native";
|
|
3
3
|
import { useTheme } from "../../themes";
|
|
4
|
+
export const useCheckoutTagStyles = (tone, filled) => {
|
|
5
|
+
const theme = useTheme();
|
|
6
|
+
return useMemo(() => {
|
|
7
|
+
const { backgroundColor, color } = resolveTagColors(theme.colors, tone, filled);
|
|
8
|
+
return StyleSheet.create({
|
|
9
|
+
container: {
|
|
10
|
+
flexDirection: "row",
|
|
11
|
+
alignItems: "center",
|
|
12
|
+
alignSelf: "flex-start",
|
|
13
|
+
backgroundColor,
|
|
14
|
+
paddingHorizontal: theme.spacing.xs,
|
|
15
|
+
paddingVertical: 5.5,
|
|
16
|
+
gap: theme.spacing.xxs,
|
|
17
|
+
borderRadius: theme.radius.round,
|
|
18
|
+
},
|
|
19
|
+
label: {
|
|
20
|
+
fontFamily: theme.fonts.inter.bold,
|
|
21
|
+
fontSize: theme.fonts.sizes.xxxs,
|
|
22
|
+
lineHeight: 15,
|
|
23
|
+
letterSpacing: 0.25,
|
|
24
|
+
textTransform: "uppercase",
|
|
25
|
+
color,
|
|
26
|
+
},
|
|
27
|
+
iconWrap: {
|
|
28
|
+
width: 12,
|
|
29
|
+
height: 12,
|
|
30
|
+
alignItems: "center",
|
|
31
|
+
justifyContent: "center",
|
|
32
|
+
},
|
|
33
|
+
});
|
|
34
|
+
}, [theme, tone, filled]);
|
|
35
|
+
};
|
|
36
|
+
function resolveTagColors(c, tone, filled) {
|
|
37
|
+
switch (tone) {
|
|
38
|
+
case "success":
|
|
39
|
+
return filled
|
|
40
|
+
? { backgroundColor: c.deliveryOptionFeatured, color: c.white }
|
|
41
|
+
: {
|
|
42
|
+
backgroundColor: c.backgroundDeliveryAdvantageBadge,
|
|
43
|
+
color: c.textDeliveryAdvantageBadge,
|
|
44
|
+
};
|
|
45
|
+
case "warning":
|
|
46
|
+
return filled
|
|
47
|
+
? { backgroundColor: c.backgroundTagWarningFilled, color: c.white }
|
|
48
|
+
: {
|
|
49
|
+
backgroundColor: c.backgroundDeliveryExpressBadge,
|
|
50
|
+
color: c.textDeliveryExpressBadge,
|
|
51
|
+
};
|
|
52
|
+
case "brand":
|
|
53
|
+
return filled
|
|
54
|
+
? { backgroundColor: c.primary, color: c.white }
|
|
55
|
+
: {
|
|
56
|
+
backgroundColor: c.backgroundTagBrandSubtle,
|
|
57
|
+
color: c.textTagBrandSubtle,
|
|
58
|
+
};
|
|
59
|
+
case "marketplace":
|
|
60
|
+
return filled
|
|
61
|
+
? { backgroundColor: c.backgroundTagMarketplaceFilled, color: c.white }
|
|
62
|
+
: {
|
|
63
|
+
backgroundColor: c.backgroundTagMarketplaceSubtle,
|
|
64
|
+
color: c.textTagMarketplaceSubtle,
|
|
65
|
+
};
|
|
66
|
+
case "neutral":
|
|
67
|
+
default:
|
|
68
|
+
return filled
|
|
69
|
+
? { backgroundColor: c.backgroundTagNeutralFilled, color: c.white }
|
|
70
|
+
: {
|
|
71
|
+
backgroundColor: c.backgroundSecondary,
|
|
72
|
+
color: c.textSecondary,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
}
|
|
4
76
|
export const useBadgeStyles = (variant = "default", size = "medium") => {
|
|
5
77
|
const theme = useTheme();
|
|
6
|
-
const getHeightStyle = () => {
|
|
7
|
-
switch (size) {
|
|
8
|
-
case "small":
|
|
9
|
-
return 19;
|
|
10
|
-
case "medium":
|
|
11
|
-
return 22;
|
|
12
|
-
case "large":
|
|
13
|
-
return 48;
|
|
14
|
-
default:
|
|
15
|
-
return 30;
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
78
|
return useMemo(() => StyleSheet.create({
|
|
19
79
|
container: {
|
|
20
80
|
padding: theme.spacing.xxs2,
|
|
@@ -26,29 +86,26 @@ export const useBadgeStyles = (variant = "default", size = "medium") => {
|
|
|
26
86
|
text: {
|
|
27
87
|
color: theme.colors.textPrimary,
|
|
28
88
|
},
|
|
29
|
-
// Estilos de tamanho
|
|
30
89
|
medium: {
|
|
31
90
|
fontFamily: "Inter",
|
|
32
91
|
fontWeight: "500",
|
|
33
|
-
fontStyle: "normal",
|
|
92
|
+
fontStyle: "normal",
|
|
34
93
|
fontSize: 12,
|
|
35
|
-
lineHeight: 18,
|
|
94
|
+
lineHeight: 18,
|
|
36
95
|
letterSpacing: 0,
|
|
37
|
-
// leading-trim: NONE; // Não suportado no React Native
|
|
38
96
|
},
|
|
39
97
|
small: {
|
|
40
98
|
fontFamily: "Inter",
|
|
41
99
|
fontWeight: "400",
|
|
42
100
|
fontStyle: "normal",
|
|
43
101
|
fontSize: 10,
|
|
44
|
-
lineHeight: 10,
|
|
102
|
+
lineHeight: 10,
|
|
45
103
|
letterSpacing: 0,
|
|
46
|
-
// leading-trim: CAP_HEIGHT; // Não suportado diretamente no React Native
|
|
47
104
|
},
|
|
48
105
|
large: {
|
|
49
106
|
fontFamily: theme.fonts.inter.medium,
|
|
50
107
|
fontSize: 14,
|
|
51
|
-
lineHeight: 20,
|
|
108
|
+
lineHeight: 20,
|
|
52
109
|
letterSpacing: 0,
|
|
53
110
|
},
|
|
54
111
|
iconContainer: {
|
|
@@ -57,27 +114,22 @@ export const useBadgeStyles = (variant = "default", size = "medium") => {
|
|
|
57
114
|
alignItems: "center",
|
|
58
115
|
justifyContent: "center",
|
|
59
116
|
},
|
|
60
|
-
// Variante padrão
|
|
61
117
|
default: {
|
|
62
118
|
backgroundColor: theme.colors.backgroundAction1,
|
|
63
119
|
color: theme.colors.white,
|
|
64
120
|
},
|
|
65
|
-
// Variante black
|
|
66
121
|
black: {
|
|
67
122
|
backgroundColor: "#000000",
|
|
68
123
|
color: theme.colors.white,
|
|
69
124
|
},
|
|
70
|
-
// Variante discount
|
|
71
125
|
discount: {
|
|
72
126
|
backgroundColor: theme.colors.secondary,
|
|
73
127
|
color: "#000000",
|
|
74
128
|
},
|
|
75
|
-
// Variante cashback
|
|
76
129
|
cashback: {
|
|
77
130
|
backgroundColor: theme.colors.backgroundMint3,
|
|
78
131
|
color: theme.colors.black,
|
|
79
132
|
},
|
|
80
|
-
// Variante express
|
|
81
133
|
express: {
|
|
82
134
|
backgroundColor: theme.colors.black,
|
|
83
135
|
color: theme.colors.white,
|
|
@@ -1,37 +1,36 @@
|
|
|
1
1
|
import { StyleProp, TextStyle, ViewStyle } from "react-native";
|
|
2
2
|
import { ReactNode } from "react";
|
|
3
3
|
export type BadgeVariant = "default" | "black" | "discount" | "cashback" | "express";
|
|
4
|
+
/** Tons do handoff (catálogo · <Tag />) — exposto como `Badge`. */
|
|
5
|
+
export type BadgeTone = "success" | "warning" | "brand" | "neutral" | "marketplace";
|
|
4
6
|
export type BadgeSize = "small" | "medium" | "large";
|
|
5
7
|
export type IconPosition = "left" | "right";
|
|
6
8
|
export interface BadgeProps {
|
|
7
9
|
/**
|
|
8
|
-
*
|
|
10
|
+
* Legado — conteúdo em string. Se `children` existir sem `text`, ativa o modo Tag do handoff.
|
|
9
11
|
*/
|
|
10
|
-
text
|
|
12
|
+
text?: string;
|
|
11
13
|
/**
|
|
12
|
-
*
|
|
14
|
+
* Conteúdo do Tag (handoff). Com `tone`, composição canónica do DS de checkout.
|
|
13
15
|
*/
|
|
14
|
-
|
|
16
|
+
children?: ReactNode;
|
|
15
17
|
/**
|
|
16
|
-
*
|
|
18
|
+
* Variante legada (cores do catálogo anterior)
|
|
17
19
|
*/
|
|
18
|
-
|
|
20
|
+
variant?: BadgeVariant;
|
|
19
21
|
/**
|
|
20
|
-
*
|
|
22
|
+
* Tom do Tag (handoff). Se omitido e só `children` for usado — default `neutral`.
|
|
21
23
|
*/
|
|
22
|
-
|
|
24
|
+
tone?: BadgeTone;
|
|
23
25
|
/**
|
|
24
|
-
*
|
|
26
|
+
* Versão preenchida (texto branco sobre fundo sólido do tom)
|
|
27
|
+
* @default false
|
|
25
28
|
*/
|
|
29
|
+
filled?: boolean;
|
|
30
|
+
size?: BadgeSize;
|
|
31
|
+
style?: StyleProp<ViewStyle>;
|
|
26
32
|
textStyle?: StyleProp<TextStyle>;
|
|
27
|
-
/**
|
|
28
|
-
* Ícone SVG a ser exibido junto com o texto do badge
|
|
29
|
-
*/
|
|
30
33
|
icon?: ReactNode;
|
|
31
|
-
/**
|
|
32
|
-
* Posição do ícone em relação ao texto
|
|
33
|
-
* @default 'left'
|
|
34
|
-
*/
|
|
35
34
|
iconPosition?: IconPosition;
|
|
36
35
|
}
|
|
37
36
|
//# sourceMappingURL=badge.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"badge.types.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AAEd,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"badge.types.d.ts","sourceRoot":"","sources":["../../../src/components/badge/badge.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE/D,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,MAAM,MAAM,YAAY,GACpB,SAAS,GACT,OAAO,GACP,UAAU,GACV,UAAU,GACV,SAAS,CAAC;AAEd,yEAAyE;AACzE,MAAM,MAAM,SAAS,GACjB,SAAS,GACT,SAAS,GACT,OAAO,GACP,SAAS,GACT,aAAa,CAAC;AAElB,MAAM,MAAM,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAErD,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,UAAU;IACzB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,CAAC;IAEvB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;OAGG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAE7B,SAAS,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAEjC,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,YAAY,EACV,UAAU,EACV,SAAS,EACT,YAAY,EACZ,YAAY,GACb,MAAM,eAAe,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/badge/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,YAAY,EACV,UAAU,EACV,SAAS,EACT,SAAS,EACT,YAAY,EACZ,YAAY,GACb,MAAM,eAAe,CAAC"}
|
|
@@ -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
|
}
|
|
@@ -0,0 +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;AAuI5E,eAAO,MAAM,kBAAkB,qDAA0C,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Text, TouchableOpacity, View, } from "react-native";
|
|
4
|
+
import { BagIcon, ChevronRightIcon, StarIcon, } from "../../icons";
|
|
5
|
+
import { useTheme } from "../../themes";
|
|
6
|
+
import { useDeliveryOptionCardStyles } from "./delivery-option-card.styles";
|
|
7
|
+
const DeliveryOptionCardComponent = ({ testID, style, tone = "featured", disabled = false, selected = false, tags, onPress, leadingIcon, showRecommendedBadge, recommendedBadgeIcon, advantageousLabel, title, trailingTitle, subtitle, description, showAvailabilityIndicator, availabilitySummary, changeStoreLabel, onChangeStorePress, }) => {
|
|
8
|
+
const theme = useTheme();
|
|
9
|
+
const styles = useDeliveryOptionCardStyles({
|
|
10
|
+
tone,
|
|
11
|
+
selected,
|
|
12
|
+
disabled,
|
|
13
|
+
});
|
|
14
|
+
const subtitleContent = subtitle !== null && subtitle !== void 0 ? subtitle : description;
|
|
15
|
+
const effectiveSelected = selected && !disabled;
|
|
16
|
+
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
|
+
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
|
+
? 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: typeof subtitleContent === "string" ? (_jsx(Text, { style: styles.subtitleText, children: subtitleContent })) : (subtitleContent) })) : 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
|
+
if (onPress && !disabled) {
|
|
21
|
+
return (_jsx(TouchableOpacity, { testID: testID, accessibilityRole: "button", accessibilityState: { disabled: false }, style: [styles.card, style], onPress: onPress, activeOpacity: 0.85, children: cardBody }));
|
|
22
|
+
}
|
|
23
|
+
return (_jsx(View, { testID: testID, accessibilityState: { disabled }, style: [styles.card, style], children: cardBody }));
|
|
24
|
+
};
|
|
25
|
+
export const DeliveryOptionCard = React.memo(DeliveryOptionCardComponent);
|
|
26
|
+
DeliveryOptionCard.displayName = "DeliveryOptionCard";
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import type { DeliveryOptionTone } from "./delivery-option-card.types";
|
|
2
|
+
type Options = {
|
|
3
|
+
tone: DeliveryOptionTone;
|
|
4
|
+
selected: boolean;
|
|
5
|
+
disabled?: boolean;
|
|
6
|
+
};
|
|
7
|
+
export declare const useDeliveryOptionCardStyles: ({ tone, selected, disabled, }: Options) => {
|
|
8
|
+
card: {
|
|
9
|
+
shadowColor: "#3643BA" | "#00A859";
|
|
10
|
+
shadowOffset: {
|
|
11
|
+
width: number;
|
|
12
|
+
height: number;
|
|
13
|
+
};
|
|
14
|
+
shadowOpacity: number;
|
|
15
|
+
shadowRadius: number;
|
|
16
|
+
backgroundColor: "#FFFFFF";
|
|
17
|
+
borderRadius: 0;
|
|
18
|
+
borderWidth: 1 | 2;
|
|
19
|
+
borderColor: "#3643BA" | "#00A859" | "#E5E7EB";
|
|
20
|
+
paddingHorizontal: 14;
|
|
21
|
+
paddingVertical: 12;
|
|
22
|
+
opacity: number;
|
|
23
|
+
} | {
|
|
24
|
+
shadowColor?: undefined;
|
|
25
|
+
shadowOffset?: undefined;
|
|
26
|
+
shadowOpacity?: undefined;
|
|
27
|
+
shadowRadius?: undefined;
|
|
28
|
+
backgroundColor: "#FFFFFF";
|
|
29
|
+
borderRadius: 0;
|
|
30
|
+
borderWidth: 1 | 2;
|
|
31
|
+
borderColor: "#3643BA" | "#00A859" | "#E5E7EB";
|
|
32
|
+
paddingHorizontal: 14;
|
|
33
|
+
paddingVertical: 12;
|
|
34
|
+
opacity: number;
|
|
35
|
+
};
|
|
36
|
+
topRow: {
|
|
37
|
+
flexDirection: "row";
|
|
38
|
+
alignItems: "flex-start";
|
|
39
|
+
justifyContent: "space-between";
|
|
40
|
+
};
|
|
41
|
+
leadingCluster: {
|
|
42
|
+
flexDirection: "row";
|
|
43
|
+
alignItems: "flex-start";
|
|
44
|
+
flex: number;
|
|
45
|
+
marginRight: 8;
|
|
46
|
+
};
|
|
47
|
+
badgesColumn: {
|
|
48
|
+
flex: number;
|
|
49
|
+
marginLeft: 8;
|
|
50
|
+
};
|
|
51
|
+
recommendedBadge: {
|
|
52
|
+
flexDirection: "row";
|
|
53
|
+
alignItems: "center";
|
|
54
|
+
alignSelf: "flex-start";
|
|
55
|
+
backgroundColor: "#00A859";
|
|
56
|
+
paddingHorizontal: 8;
|
|
57
|
+
paddingVertical: number;
|
|
58
|
+
gap: 4;
|
|
59
|
+
};
|
|
60
|
+
recommendedText: {
|
|
61
|
+
fontFamily: "Inter-Bold";
|
|
62
|
+
fontSize: 10;
|
|
63
|
+
lineHeight: number;
|
|
64
|
+
letterSpacing: number;
|
|
65
|
+
textTransform: "uppercase";
|
|
66
|
+
color: "#FFFFFF";
|
|
67
|
+
};
|
|
68
|
+
advantageousBadge: {
|
|
69
|
+
alignSelf: "flex-start";
|
|
70
|
+
marginTop: 4;
|
|
71
|
+
backgroundColor: "#E8F7EF";
|
|
72
|
+
paddingHorizontal: 8;
|
|
73
|
+
paddingVertical: number;
|
|
74
|
+
};
|
|
75
|
+
advantageousText: {
|
|
76
|
+
fontFamily: "Inter-Bold";
|
|
77
|
+
fontSize: 10;
|
|
78
|
+
lineHeight: number;
|
|
79
|
+
letterSpacing: number;
|
|
80
|
+
textTransform: "uppercase";
|
|
81
|
+
color: "#006B39";
|
|
82
|
+
};
|
|
83
|
+
radioOuterSelected: {
|
|
84
|
+
width: number;
|
|
85
|
+
height: number;
|
|
86
|
+
borderRadius: 360;
|
|
87
|
+
borderWidth: 2;
|
|
88
|
+
borderColor: "#3643BA" | "#00A859";
|
|
89
|
+
backgroundColor: "#3643BA" | "#00A859";
|
|
90
|
+
alignItems: "center";
|
|
91
|
+
justifyContent: "center";
|
|
92
|
+
marginLeft: 8;
|
|
93
|
+
};
|
|
94
|
+
radioOuterIdle: {
|
|
95
|
+
width: number;
|
|
96
|
+
height: number;
|
|
97
|
+
borderRadius: 360;
|
|
98
|
+
borderWidth: 2;
|
|
99
|
+
borderColor: "#D1D5DC";
|
|
100
|
+
backgroundColor: "#FFFFFF";
|
|
101
|
+
alignItems: "center";
|
|
102
|
+
justifyContent: "center";
|
|
103
|
+
marginLeft: 8;
|
|
104
|
+
};
|
|
105
|
+
radioInner: {
|
|
106
|
+
width: number;
|
|
107
|
+
height: number;
|
|
108
|
+
borderRadius: 360;
|
|
109
|
+
backgroundColor: "#FFFFFF";
|
|
110
|
+
};
|
|
111
|
+
titleRow: {
|
|
112
|
+
flexDirection: "row";
|
|
113
|
+
alignItems: "center";
|
|
114
|
+
justifyContent: "space-between";
|
|
115
|
+
marginTop: 12;
|
|
116
|
+
};
|
|
117
|
+
title: {
|
|
118
|
+
fontFamily: "Inter-SemiBold";
|
|
119
|
+
fontSize: number;
|
|
120
|
+
lineHeight: number;
|
|
121
|
+
color: "#101010";
|
|
122
|
+
flex: number;
|
|
123
|
+
marginRight: 12;
|
|
124
|
+
};
|
|
125
|
+
trailingTitle: {
|
|
126
|
+
fontFamily: "Inter-SemiBold";
|
|
127
|
+
fontSize: number;
|
|
128
|
+
lineHeight: number;
|
|
129
|
+
color: "#101010";
|
|
130
|
+
textAlign: "right";
|
|
131
|
+
};
|
|
132
|
+
subtitle: {
|
|
133
|
+
marginTop: 4;
|
|
134
|
+
};
|
|
135
|
+
subtitleText: {
|
|
136
|
+
fontFamily: "Inter-Regular";
|
|
137
|
+
fontSize: number;
|
|
138
|
+
lineHeight: number;
|
|
139
|
+
color: "#4A5565";
|
|
140
|
+
};
|
|
141
|
+
availabilityRow: {
|
|
142
|
+
flexDirection: "row";
|
|
143
|
+
alignItems: "flex-start";
|
|
144
|
+
marginTop: 12;
|
|
145
|
+
};
|
|
146
|
+
availabilityBar: {
|
|
147
|
+
width: number;
|
|
148
|
+
height: number;
|
|
149
|
+
marginRight: 8;
|
|
150
|
+
marginTop: number;
|
|
151
|
+
backgroundColor: "#E85D04";
|
|
152
|
+
borderRadius: 0;
|
|
153
|
+
};
|
|
154
|
+
footerLink: {
|
|
155
|
+
flexDirection: "row";
|
|
156
|
+
alignItems: "center";
|
|
157
|
+
marginTop: 12;
|
|
158
|
+
alignSelf: "flex-start";
|
|
159
|
+
gap: 4;
|
|
160
|
+
};
|
|
161
|
+
footerLinkText: {
|
|
162
|
+
fontFamily: "Inter-SemiBold";
|
|
163
|
+
fontSize: number;
|
|
164
|
+
lineHeight: number;
|
|
165
|
+
color: "#3643BA";
|
|
166
|
+
};
|
|
167
|
+
};
|
|
168
|
+
export {};
|
|
169
|
+
//# sourceMappingURL=delivery-option-card.styles.d.ts.map
|
|
@@ -0,0 +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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8KT,CAAC"}
|