@trafilea/afrodita-components 6.42.0 → 6.42.3
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/build/index.esm.js +33 -19
- package/build/index.esm.js.map +1 -1
- package/build/index.js +33 -19
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.esm.js
CHANGED
|
@@ -3120,11 +3120,23 @@ var formatPrice = function (value, _a) {
|
|
|
3120
3120
|
// this prevents `Intl.NumberFormat` from rounding the number
|
|
3121
3121
|
var valueToFormat = parseFloat("".concat(integer, ".").concat((_b = fraction === null || fraction === void 0 ? void 0 : fraction.slice(0, 2)) !== null && _b !== void 0 ? _b : 0));
|
|
3122
3122
|
var overridedLocale = (_c = localeOverrideByCurrency[currency]) !== null && _c !== void 0 ? _c : locale;
|
|
3123
|
-
|
|
3123
|
+
var result = new Intl.NumberFormat(overridedLocale, {
|
|
3124
3124
|
style: 'currency',
|
|
3125
3125
|
currency: currency,
|
|
3126
3126
|
maximumFractionDigits: 3,
|
|
3127
3127
|
}).format(valueToFormat);
|
|
3128
|
+
if (currency === 'NZD') {
|
|
3129
|
+
// intlFormat does not support NZD$ currency format
|
|
3130
|
+
var resultOverridden = result.replace('NZ$', 'NZD$');
|
|
3131
|
+
return resultOverridden;
|
|
3132
|
+
}
|
|
3133
|
+
if (currency === 'SGD') {
|
|
3134
|
+
// intlFormat does not support singapure currency
|
|
3135
|
+
var onlyValue = result.slice(result.indexOf('SGD') + 4);
|
|
3136
|
+
var resultOverridden = "SGD$".concat(onlyValue);
|
|
3137
|
+
return resultOverridden;
|
|
3138
|
+
}
|
|
3139
|
+
return result;
|
|
3128
3140
|
};
|
|
3129
3141
|
|
|
3130
3142
|
var CardSectionType;
|
|
@@ -7031,7 +7043,7 @@ var LikeCount = newStyled.span(templateObject_1$1v || (templateObject_1$1v = __m
|
|
|
7031
7043
|
var theme = _a.theme;
|
|
7032
7044
|
return theme.colors.shades.black.color;
|
|
7033
7045
|
});
|
|
7034
|
-
var LikeBtnContainer = newStyled.button(templateObject_2$19 || (templateObject_2$19 = __makeTemplateObject(["\n position: ", ";\n top: ", ";\n right: ", ";\n z-index: ", ";\n padding: ", ";\n box-sizing: ", ";\n background-color: transparent;\n border: none;\n
|
|
7046
|
+
var LikeBtnContainer = newStyled.button(templateObject_2$19 || (templateObject_2$19 = __makeTemplateObject(["\n position: ", ";\n top: ", ";\n right: ", ";\n z-index: ", ";\n padding: ", ";\n box-sizing: ", ";\n background-color: transparent;\n border: none;\n"], ["\n position: ", ";\n top: ", ";\n right: ", ";\n z-index: ", ";\n padding: ", ";\n box-sizing: ", ";\n background-color: transparent;\n border: none;\n"])), function (_a) {
|
|
7035
7047
|
var _b = _a.position, position = _b === void 0 ? 'absolute' : _b;
|
|
7036
7048
|
return position;
|
|
7037
7049
|
}, function (_a) {
|
|
@@ -7049,9 +7061,6 @@ var LikeBtnContainer = newStyled.button(templateObject_2$19 || (templateObject_2
|
|
|
7049
7061
|
}, function (_a) {
|
|
7050
7062
|
var _b = _a.boxSizing, boxSizing = _b === void 0 ? 'border-box' : _b;
|
|
7051
7063
|
return boxSizing;
|
|
7052
|
-
}, function (_a) {
|
|
7053
|
-
var theme = _a.theme;
|
|
7054
|
-
return theme.colors.shades.white.color;
|
|
7055
7064
|
});
|
|
7056
7065
|
var templateObject_1$1v, templateObject_2$19;
|
|
7057
7066
|
|
|
@@ -7127,7 +7136,7 @@ var LikeButton = function (_a) {
|
|
|
7127
7136
|
regular: theme.colors.shades.black.color,
|
|
7128
7137
|
solid: theme.colors.semantic.urgent.color,
|
|
7129
7138
|
} : _e, background = _d.background;
|
|
7130
|
-
return (jsx$1(LikeBtnContainer, __assign$1({ className: className }, containerProps, { children: jsxs$1(IconButton, __assign$1({ onClick: onClick, backgroundColor: background, hasText: !!likes, boxShadow: "0 6px 16px rgba(0, 0, 0, 0.12)" }, { children: [jsx$1(Icon$1, { name: isLiked ? 'actions/like_solid' : 'actions/like', fill: isLiked ? iconFill.solid : (_b = iconFill.regular) !== null && _b !== void 0 ? _b : iconFill.solid, width: "24px", height: "24px" },
|
|
7139
|
+
return (jsx$1(LikeBtnContainer, __assign$1({ className: className }, containerProps, { children: jsxs$1(IconButton, __assign$1({ onClick: onClick, backgroundColor: background, hasText: !!likes, boxShadow: "0 6px 16px rgba(0, 0, 0, 0.12)" }, { children: [jsx$1(Icon$1, { name: isLiked ? 'actions/like_solid' : 'actions/like', fill: isLiked ? iconFill.solid : (_b = iconFill.regular) !== null && _b !== void 0 ? _b : iconFill.solid, width: "24px", height: "24px" }, void 0), !!likes && jsx$1(LikeCount, __assign$1({ className: "like-count" }, { children: likes }), void 0)] }), isLiked.toString()) }), void 0));
|
|
7131
7140
|
};
|
|
7132
7141
|
|
|
7133
7142
|
var STYLES_BY_THEME = {
|
|
@@ -7268,12 +7277,12 @@ var ClubOfferPriceLabelWrapper = newStyled.div(templateObject_8$l || (templateOb
|
|
|
7268
7277
|
var templateObject_1$1t, templateObject_2$18, templateObject_3$X, templateObject_4$L, templateObject_5$C, templateObject_6$y, templateObject_7$s, templateObject_8$l;
|
|
7269
7278
|
|
|
7270
7279
|
var ProductItemMobile = function (_a) {
|
|
7271
|
-
var _b, _c;
|
|
7272
|
-
var title = _a.title, image = _a.image, imageHover = _a.imageHover, price = _a.price, rating = _a.rating, size = _a.size,
|
|
7280
|
+
var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
7281
|
+
var title = _a.title, image = _a.image, imageHover = _a.imageHover, price = _a.price, rating = _a.rating, size = _a.size, _o = _a.alignName, alignName = _o === void 0 ? 'center' : _o, url = _a.url, className = _a.className, topTag = _a.topTag, bottomTag = _a.bottomTag, onClick = _a.onClick, _p = _a.priceDisplayType, priceDisplayType = _p === void 0 ? 'default' : _p, priceAtBottom = _a.priceAtBottom, ratingOnTop = _a.ratingOnTop, priceLoading = _a.priceLoading, _q = _a.noFollow, noFollow = _q === void 0 ? false : _q, _r = _a.colorPicker, colorPicker = _r === void 0 ? {
|
|
7273
7282
|
display: false,
|
|
7274
7283
|
position: 'top',
|
|
7275
7284
|
component: undefined,
|
|
7276
|
-
} :
|
|
7285
|
+
} : _r, _s = _a.isBNPL, isBNPL = _s === void 0 ? {
|
|
7277
7286
|
displayBNPL: false,
|
|
7278
7287
|
installments: 4,
|
|
7279
7288
|
installmentPrice: '',
|
|
@@ -7282,10 +7291,10 @@ var ProductItemMobile = function (_a) {
|
|
|
7282
7291
|
showLogo: true,
|
|
7283
7292
|
iconColor: '#292929',
|
|
7284
7293
|
fontSize: '12px',
|
|
7285
|
-
} :
|
|
7294
|
+
} : _s, _t = _a.hasStrength, hasStrength = _t === void 0 ? {
|
|
7286
7295
|
strength: -1,
|
|
7287
7296
|
description: '',
|
|
7288
|
-
} :
|
|
7297
|
+
} : _t, _u = _a.clubPrice, clubPrice = _u === void 0 ? '' : _u, _v = _a.showClubPriceLabel, showClubPriceLabel = _v === void 0 ? false : _v, isRatingLoading = _a.isRatingLoading, _w = _a.version, version = _w === void 0 ? 1 : _w, _x = _a.showDiscountPercentageTag, showDiscountPercentageTag = _x === void 0 ? false : _x, discountTagLoading = _a.discountTagLoading, discountTag = _a.discountTag, _y = _a.isOnViewport, isOnViewport = _y === void 0 ? false : _y, _z = _a.hasDefaultSize, hasDefaultSize = _z === void 0 ? false : _z, clubOffer = _a.clubOffer, likeBtn = _a.likeBtn, onClickBottomButton = _a.onClickBottomButton;
|
|
7289
7298
|
var theme = useTheme();
|
|
7290
7299
|
var styles = getStylesBySize$b(size);
|
|
7291
7300
|
var isMobile = useWindowDimensions().isMobile;
|
|
@@ -7328,8 +7337,8 @@ var ProductItemMobile = function (_a) {
|
|
|
7328
7337
|
return jsx(Fragment, {}, void 0);
|
|
7329
7338
|
return (jsx(Rating, { size: size === ComponentSize.Large ? ComponentSize.Small : ComponentSize.XSmall, rating: rating.rating, reviews: rating.reviews, reviewsText: "", wrapWithParenthesis: true }, void 0));
|
|
7330
7339
|
};
|
|
7331
|
-
var
|
|
7332
|
-
var
|
|
7340
|
+
var _0 = useState((_b = likeBtn === null || likeBtn === void 0 ? void 0 : likeBtn.isLiked) !== null && _b !== void 0 ? _b : false), isLiked = _0[0], setIsLiked = _0[1];
|
|
7341
|
+
var _1 = useState((_c = likeBtn === null || likeBtn === void 0 ? void 0 : likeBtn.likes) !== null && _c !== void 0 ? _c : 0), likesCount = _1[0], setLikesCount = _1[1];
|
|
7333
7342
|
var handleLikeClick = function (e) {
|
|
7334
7343
|
e.stopPropagation();
|
|
7335
7344
|
if (isLiked) {
|
|
@@ -7343,7 +7352,8 @@ var ProductItemMobile = function (_a) {
|
|
|
7343
7352
|
};
|
|
7344
7353
|
return (jsxs(ProdCardContainer$4, __assign$1({ className: className, "data-testid": "product-card-container-div" }, { children: [jsxs(Container$10, __assign$1({ as: url ? 'a' : 'div', href: url, rel: noFollow ? 'nofollow' : '', className: "picContainer", onClick: onClick }, { children: [!!likeBtn && (jsx(LikeButton, { isLiked: isLiked, likes: likesCount, onClick: handleLikeClick, colors: {
|
|
7345
7354
|
background: {
|
|
7346
|
-
active: theme.colors.shades.white.color,
|
|
7355
|
+
active: (_f = (_e = (_d = likeBtn.colors) === null || _d === void 0 ? void 0 : _d.background) === null || _e === void 0 ? void 0 : _e.active) !== null && _f !== void 0 ? _f : theme.colors.shades.white.color,
|
|
7356
|
+
hover: (_m = (_j = (_h = (_g = likeBtn.colors) === null || _g === void 0 ? void 0 : _g.background) === null || _h === void 0 ? void 0 : _h.hover) !== null && _j !== void 0 ? _j : (_l = (_k = likeBtn.colors) === null || _k === void 0 ? void 0 : _k.background) === null || _l === void 0 ? void 0 : _l.active) !== null && _m !== void 0 ? _m : theme.colors.shades.white.color,
|
|
7347
7357
|
},
|
|
7348
7358
|
} }, void 0)), !!topTag || !!bottomTag ? (jsxs(ImageContainer$6, __assign$1({ width: styles === null || styles === void 0 ? void 0 : styles.width, height: styles === null || styles === void 0 ? void 0 : styles.height, "data-testid": "tags-image-container" }, { children: [jsx(Image$3, { src: image.src, srcSet: getSrcSet(image.src, 180, 360, 720, 960), alt: image.alt, width: hasDefaultSize ? styles === null || styles === void 0 ? void 0 : styles.width : '100%', height: hasDefaultSize ? styles === null || styles === void 0 ? void 0 : styles.height : '100%', loading: isOnViewport ? 'eager' : 'lazy', decoding: isOnViewport ? 'sync' : 'async', borderRadius: STYLES_BY_THEME[theme.name].image.borderRadius }, void 0), jsx(TopTagContainer$9, __assign$1({ style: { width: colorPicker.display ? '100%' : 'inherit' } }, { children: topTag }), void 0), jsx(BottomTagContainer$9, __assign$1({ style: { width: colorPicker.display ? '100%' : 'inherit' } }, { children: bottomTag }), void 0)] }), void 0)) : (jsx(Image$3, { src: image.src, srcSet: getSrcSet(image.src, 180, 360, 720, 960), alt: image.alt, width: styles === null || styles === void 0 ? void 0 : styles.width, height: styles === null || styles === void 0 ? void 0 : styles.height, loading: isOnViewport ? 'eager' : 'lazy', decoding: isOnViewport ? 'sync' : 'async', borderRadius: STYLES_BY_THEME[theme.name].image.borderRadius }, void 0)), imageHover ? (jsx(ImageHoverContainer$3, { className: "hover__image", src: imageHover.src, srcSet: getSrcSet(imageHover.src, 180, 360, 720, 960), loading: "lazy", decoding: "async", alt: imageHover.alt, width: styles === null || styles === void 0 ? void 0 : styles.width, height: styles === null || styles === void 0 ? void 0 : styles.height }, void 0)) : null] }), void 0), colorPicker.display && colorPicker.position === 'top' && (jsxs(Fragment, { children: [jsx(Spacing, { size: space }, void 0), colorPicker.component] }, void 0)), ratingOnTop && (jsxs(Fragment, { children: [jsx(Spacing, { size: space }, void 0), jsx(Spacing, { size: space }, void 0), jsx(RatingDisplay, {}, void 0)] }, void 0)), jsxs(Container$10, __assign$1({ as: url ? 'a' : 'div', href: url, rel: noFollow ? 'nofollow' : '', onClick: onClick, className: "textContainer", style: { alignItems: showClubPriceLabel ? 'flex-start' : 'center' } }, { children: [jsx(Spacing, { size: space }, void 0), jsx(Title$8, __assign$1({ theme: theme, align: showClubPriceLabel ? 'left' : alignName, "data-testid": "product-card-title" }, { children: title }), void 0), jsx(Spacing, { size: space }, void 0), hasStrength && hasStrength.strength !== -1 && (jsxs(Fragment, { children: [jsx(StrengthBars, { barsFilled: hasStrength.strength, supportText: hasStrength.description }, void 0), jsx(Spacing, { size: 10 }, void 0)] }, void 0)), priceAtBottom && !ratingOnTop ? (jsxs(Fragment, { children: [jsx(RatingDisplay, {}, void 0), jsx(Spacing, { size: space }, void 0), jsxs(MarginTopContainer$1, __assign$1({ style: { marginTop: (clubOffer === null || clubOffer === void 0 ? void 0 : clubOffer.isClubOffer) ? 0 : 8 } }, { children: [priceLoading ? jsx(SkeletonBox, { height: "20px", width: "140px" }, void 0) : PriceLabelDisplay(), (clubOffer === null || clubOffer === void 0 ? void 0 : clubOffer.isClubOffer) && PriceLabelDisplay(5)] }), void 0)] }, void 0)) : (jsxs(Fragment, { children: [priceLoading ? (jsx(SkeletonBox, { height: "20px", width: "140px" }, void 0)) : (jsxs(Fragment, { children: [!(clubOffer === null || clubOffer === void 0 ? void 0 : clubOffer.isClubMember) && PriceLabelDisplay(), (clubOffer === null || clubOffer === void 0 ? void 0 : clubOffer.isClubOffer) && PriceLabelDisplay(5), jsx(BuyNowPayLater, { displayBNPL: isBNPL === null || isBNPL === void 0 ? void 0 : isBNPL.displayBNPL, installments: (isBNPL === null || isBNPL === void 0 ? void 0 : isBNPL.installments) || 0, installmentPrice: (isBNPL === null || isBNPL === void 0 ? void 0 : isBNPL.installmentPrice) || '', iconFolder: isBNPL === null || isBNPL === void 0 ? void 0 : isBNPL.iconFolder, iconName: (isBNPL === null || isBNPL === void 0 ? void 0 : isBNPL.iconName) || '', showLogo: isBNPL === null || isBNPL === void 0 ? void 0 : isBNPL.showLogo, iconColor: isBNPL === null || isBNPL === void 0 ? void 0 : isBNPL.iconColor, fontSize: isBNPL === null || isBNPL === void 0 ? void 0 : isBNPL.fontSize }, void 0)] }, void 0)), showClubPriceLabel && jsx(ClubPriceLabel, { clubPrice: clubPrice }, void 0), discountTagLoading ? (jsx(SkeletonBox, { height: "22px", width: "75px" }, void 0)) : (showDiscountPercentageTag && (jsx(TagContainer, __assign$1({ size: ComponentSize.Small }, { children: discountTag && (jsx(DiscountTag$3, __assign$1({}, discountTag, { size: ComponentSize.Medium, style: {
|
|
7349
7359
|
letterSpacing: '-0.05rem',
|
|
@@ -7729,9 +7739,11 @@ var ButtonPrimary = function (_a) {
|
|
|
7729
7739
|
letterSpacing: theme.component.button.letterSpacing,
|
|
7730
7740
|
minWidth: theme.component.button.minWidth,
|
|
7731
7741
|
minHeight: theme.component.button.minHeight,
|
|
7732
|
-
'
|
|
7733
|
-
|
|
7734
|
-
|
|
7742
|
+
'@media (hover: hover) and (pointer: fine)': {
|
|
7743
|
+
'&:hover': {
|
|
7744
|
+
backgroundColor: theme.component.button.primary.hover.backgroundColor,
|
|
7745
|
+
color: theme.component.button.primary.hover.color,
|
|
7746
|
+
},
|
|
7735
7747
|
},
|
|
7736
7748
|
'&:disabled': {
|
|
7737
7749
|
backgroundColor: theme.colors.background.disabled,
|
|
@@ -7747,8 +7759,10 @@ var ButtonSecondary = function (props) {
|
|
|
7747
7759
|
color: theme.component.button.secondary.active.color,
|
|
7748
7760
|
border: theme.component.button.border,
|
|
7749
7761
|
fontFamily: 'inherit',
|
|
7750
|
-
'
|
|
7751
|
-
|
|
7762
|
+
'@media (hover: hover) and (pointer: fine)': {
|
|
7763
|
+
'&:hover': {
|
|
7764
|
+
backgroundColor: theme.component.button.secondary.hover.backgroundColor,
|
|
7765
|
+
},
|
|
7752
7766
|
},
|
|
7753
7767
|
'&:disabled': {
|
|
7754
7768
|
backgroundColor: theme.colors.shades['50'].color,
|