@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.js CHANGED
@@ -3146,11 +3146,23 @@ var formatPrice = function (value, _a) {
3146
3146
  // this prevents `Intl.NumberFormat` from rounding the number
3147
3147
  var valueToFormat = parseFloat("".concat(integer, ".").concat((_b = fraction === null || fraction === void 0 ? void 0 : fraction.slice(0, 2)) !== null && _b !== void 0 ? _b : 0));
3148
3148
  var overridedLocale = (_c = localeOverrideByCurrency[currency]) !== null && _c !== void 0 ? _c : locale;
3149
- return new Intl.NumberFormat(overridedLocale, {
3149
+ var result = new Intl.NumberFormat(overridedLocale, {
3150
3150
  style: 'currency',
3151
3151
  currency: currency,
3152
3152
  maximumFractionDigits: 3,
3153
3153
  }).format(valueToFormat);
3154
+ if (currency === 'NZD') {
3155
+ // intlFormat does not support NZD$ currency format
3156
+ var resultOverridden = result.replace('NZ$', 'NZD$');
3157
+ return resultOverridden;
3158
+ }
3159
+ if (currency === 'SGD') {
3160
+ // intlFormat does not support singapure currency
3161
+ var onlyValue = result.slice(result.indexOf('SGD') + 4);
3162
+ var resultOverridden = "SGD$".concat(onlyValue);
3163
+ return resultOverridden;
3164
+ }
3165
+ return result;
3154
3166
  };
3155
3167
 
3156
3168
  exports.CardSectionType = void 0;
@@ -7057,7 +7069,7 @@ var LikeCount = newStyled.span(templateObject_1$1v || (templateObject_1$1v = __m
7057
7069
  var theme = _a.theme;
7058
7070
  return theme.colors.shades.black.color;
7059
7071
  });
7060
- 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 &:hover {\n .like-count {\n color: ", ";\n }\n }\n"], ["\n position: ", ";\n top: ", ";\n right: ", ";\n z-index: ", ";\n padding: ", ";\n box-sizing: ", ";\n background-color: transparent;\n border: none;\n\n &:hover {\n .like-count {\n color: ", ";\n }\n }\n"])), function (_a) {
7072
+ 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) {
7061
7073
  var _b = _a.position, position = _b === void 0 ? 'absolute' : _b;
7062
7074
  return position;
7063
7075
  }, function (_a) {
@@ -7075,9 +7087,6 @@ var LikeBtnContainer = newStyled.button(templateObject_2$19 || (templateObject_2
7075
7087
  }, function (_a) {
7076
7088
  var _b = _a.boxSizing, boxSizing = _b === void 0 ? 'border-box' : _b;
7077
7089
  return boxSizing;
7078
- }, function (_a) {
7079
- var theme = _a.theme;
7080
- return theme.colors.shades.white.color;
7081
7090
  });
7082
7091
  var templateObject_1$1v, templateObject_2$19;
7083
7092
 
@@ -7153,7 +7162,7 @@ var LikeButton = function (_a) {
7153
7162
  regular: theme.colors.shades.black.color,
7154
7163
  solid: theme.colors.semantic.urgent.color,
7155
7164
  } : _e, background = _d.background;
7156
- return (jsxRuntime.jsx(LikeBtnContainer, __assign$1({ className: className }, containerProps, { children: jsxRuntime.jsxs(IconButton, __assign$1({ onClick: onClick, backgroundColor: background, hasText: !!likes, boxShadow: "0 6px 16px rgba(0, 0, 0, 0.12)" }, { children: [jsxRuntime.jsx(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" }, isLiked.toString()), !!likes && jsxRuntime.jsx(LikeCount, __assign$1({ className: "like-count" }, { children: likes }), void 0)] }), void 0) }), void 0));
7165
+ return (jsxRuntime.jsx(LikeBtnContainer, __assign$1({ className: className }, containerProps, { children: jsxRuntime.jsxs(IconButton, __assign$1({ onClick: onClick, backgroundColor: background, hasText: !!likes, boxShadow: "0 6px 16px rgba(0, 0, 0, 0.12)" }, { children: [jsxRuntime.jsx(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 && jsxRuntime.jsx(LikeCount, __assign$1({ className: "like-count" }, { children: likes }), void 0)] }), isLiked.toString()) }), void 0));
7157
7166
  };
7158
7167
 
7159
7168
  var STYLES_BY_THEME = {
@@ -7294,12 +7303,12 @@ var ClubOfferPriceLabelWrapper = newStyled.div(templateObject_8$l || (templateOb
7294
7303
  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;
7295
7304
 
7296
7305
  var ProductItemMobile = function (_a) {
7297
- var _b, _c;
7298
- var title = _a.title, image = _a.image, imageHover = _a.imageHover, price = _a.price, rating = _a.rating, size = _a.size, _d = _a.alignName, alignName = _d === void 0 ? 'center' : _d, url = _a.url, className = _a.className, topTag = _a.topTag, bottomTag = _a.bottomTag, onClick = _a.onClick, _e = _a.priceDisplayType, priceDisplayType = _e === void 0 ? 'default' : _e, priceAtBottom = _a.priceAtBottom, ratingOnTop = _a.ratingOnTop, priceLoading = _a.priceLoading, _f = _a.noFollow, noFollow = _f === void 0 ? false : _f, _g = _a.colorPicker, colorPicker = _g === void 0 ? {
7306
+ var _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
7307
+ 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 ? {
7299
7308
  display: false,
7300
7309
  position: 'top',
7301
7310
  component: undefined,
7302
- } : _g, _h = _a.isBNPL, isBNPL = _h === void 0 ? {
7311
+ } : _r, _s = _a.isBNPL, isBNPL = _s === void 0 ? {
7303
7312
  displayBNPL: false,
7304
7313
  installments: 4,
7305
7314
  installmentPrice: '',
@@ -7308,10 +7317,10 @@ var ProductItemMobile = function (_a) {
7308
7317
  showLogo: true,
7309
7318
  iconColor: '#292929',
7310
7319
  fontSize: '12px',
7311
- } : _h, _j = _a.hasStrength, hasStrength = _j === void 0 ? {
7320
+ } : _s, _t = _a.hasStrength, hasStrength = _t === void 0 ? {
7312
7321
  strength: -1,
7313
7322
  description: '',
7314
- } : _j, _k = _a.clubPrice, clubPrice = _k === void 0 ? '' : _k, _l = _a.showClubPriceLabel, showClubPriceLabel = _l === void 0 ? false : _l, isRatingLoading = _a.isRatingLoading, _m = _a.version, version = _m === void 0 ? 1 : _m, _o = _a.showDiscountPercentageTag, showDiscountPercentageTag = _o === void 0 ? false : _o, discountTagLoading = _a.discountTagLoading, discountTag = _a.discountTag, _p = _a.isOnViewport, isOnViewport = _p === void 0 ? false : _p, _q = _a.hasDefaultSize, hasDefaultSize = _q === void 0 ? false : _q, clubOffer = _a.clubOffer, likeBtn = _a.likeBtn, onClickBottomButton = _a.onClickBottomButton;
7323
+ } : _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;
7315
7324
  var theme = useTheme();
7316
7325
  var styles = getStylesBySize$b(size);
7317
7326
  var isMobile = useWindowDimensions().isMobile;
@@ -7354,8 +7363,8 @@ var ProductItemMobile = function (_a) {
7354
7363
  return jsx(Fragment, {}, void 0);
7355
7364
  return (jsx(Rating, { size: size === exports.ComponentSize.Large ? exports.ComponentSize.Small : exports.ComponentSize.XSmall, rating: rating.rating, reviews: rating.reviews, reviewsText: "", wrapWithParenthesis: true }, void 0));
7356
7365
  };
7357
- var _r = React$2.useState((_b = likeBtn === null || likeBtn === void 0 ? void 0 : likeBtn.isLiked) !== null && _b !== void 0 ? _b : false), isLiked = _r[0], setIsLiked = _r[1];
7358
- var _s = React$2.useState((_c = likeBtn === null || likeBtn === void 0 ? void 0 : likeBtn.likes) !== null && _c !== void 0 ? _c : 0), likesCount = _s[0], setLikesCount = _s[1];
7366
+ var _0 = React$2.useState((_b = likeBtn === null || likeBtn === void 0 ? void 0 : likeBtn.isLiked) !== null && _b !== void 0 ? _b : false), isLiked = _0[0], setIsLiked = _0[1];
7367
+ var _1 = React$2.useState((_c = likeBtn === null || likeBtn === void 0 ? void 0 : likeBtn.likes) !== null && _c !== void 0 ? _c : 0), likesCount = _1[0], setLikesCount = _1[1];
7359
7368
  var handleLikeClick = function (e) {
7360
7369
  e.stopPropagation();
7361
7370
  if (isLiked) {
@@ -7369,7 +7378,8 @@ var ProductItemMobile = function (_a) {
7369
7378
  };
7370
7379
  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: {
7371
7380
  background: {
7372
- active: theme.colors.shades.white.color,
7381
+ 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,
7382
+ 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,
7373
7383
  },
7374
7384
  } }, 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: exports.ComponentSize.Small }, { children: discountTag && (jsx(DiscountTag$3, __assign$1({}, discountTag, { size: exports.ComponentSize.Medium, style: {
7375
7385
  letterSpacing: '-0.05rem',
@@ -7755,9 +7765,11 @@ var ButtonPrimary = function (_a) {
7755
7765
  letterSpacing: theme.component.button.letterSpacing,
7756
7766
  minWidth: theme.component.button.minWidth,
7757
7767
  minHeight: theme.component.button.minHeight,
7758
- '&:hover': {
7759
- backgroundColor: theme.component.button.primary.hover.backgroundColor,
7760
- color: theme.component.button.primary.hover.color,
7768
+ '@media (hover: hover) and (pointer: fine)': {
7769
+ '&:hover': {
7770
+ backgroundColor: theme.component.button.primary.hover.backgroundColor,
7771
+ color: theme.component.button.primary.hover.color,
7772
+ },
7761
7773
  },
7762
7774
  '&:disabled': {
7763
7775
  backgroundColor: theme.colors.background.disabled,
@@ -7773,8 +7785,10 @@ var ButtonSecondary = function (props) {
7773
7785
  color: theme.component.button.secondary.active.color,
7774
7786
  border: theme.component.button.border,
7775
7787
  fontFamily: 'inherit',
7776
- '&:hover': {
7777
- backgroundColor: theme.component.button.secondary.hover.backgroundColor,
7788
+ '@media (hover: hover) and (pointer: fine)': {
7789
+ '&:hover': {
7790
+ backgroundColor: theme.component.button.secondary.hover.backgroundColor,
7791
+ },
7778
7792
  },
7779
7793
  '&:disabled': {
7780
7794
  backgroundColor: theme.colors.shades['50'].color,