@trafilea/afrodita-components 5.0.0-beta.301 → 5.0.0-beta.303

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
@@ -5266,9 +5266,9 @@ var H3$3 = newStyled.h3(templateObject_2$$ || (templateObject_2$$ = __makeTempla
5266
5266
  return (_b = getStylesBySize$8(size)) === null || _b === void 0 ? void 0 : _b.lineHeight;
5267
5267
  });
5268
5268
  var DiscountTag = function (_a) {
5269
- var discount = _a.discount, offText = _a.offText, disabled = _a.disabled, _b = _a.backgroundColor, backgroundColor = _b === void 0 ? '#fff' : _b, _c = _a.borderColor, borderColor = _c === void 0 ? 'transparent' : _c, _d = _a.textColor, textColor = _d === void 0 ? '#fff' : _d, _e = _a.size, size = _e === void 0 ? exports.ComponentSize.Medium : _e, style = _a.style;
5269
+ var discount = _a.discount, offText = _a.offText, savings = _a.savings, _b = _a.showSavings, showSavings = _b === void 0 ? false : _b, disabled = _a.disabled, _c = _a.backgroundColor, backgroundColor = _c === void 0 ? '#fff' : _c, _d = _a.borderColor, borderColor = _d === void 0 ? 'transparent' : _d, _e = _a.textColor, textColor = _e === void 0 ? '#fff' : _e, _f = _a.size, size = _f === void 0 ? exports.ComponentSize.Medium : _f, style = _a.style;
5270
5270
  var theme = useTheme();
5271
- return (jsxRuntime.jsx(Container$11, __assign$1({ backgroundColor: disabled ? theme.colors.shades['50'].color : backgroundColor, borderColor: disabled ? theme.colors.shades['50'].color : borderColor, size: size, "data-testid": "discount-container", style: style }, { children: jsxRuntime.jsxs(H3$3, __assign$1({ textColor: disabled ? theme.colors.shades['250'].color : textColor, size: size, style: style }, { children: [discount, "% ", offText] }), void 0) }), void 0));
5271
+ return (jsxRuntime.jsx(Container$11, __assign$1({ backgroundColor: disabled ? theme.colors.shades['50'].color : backgroundColor, borderColor: disabled ? theme.colors.shades['50'].color : borderColor, size: size, "data-testid": "discount-container", style: style }, { children: jsxRuntime.jsxs(H3$3, __assign$1({ textColor: disabled ? theme.colors.shades['250'].color : textColor, size: size, style: style }, { children: [discount, "% ", offText, " ", showSavings && savings && "- ".concat(savings)] }), void 0) }), void 0));
5272
5272
  };
5273
5273
  var templateObject_1$1u, templateObject_2$$;
5274
5274
 
@@ -5461,7 +5461,7 @@ var templateObject_1$1s, templateObject_2$Z;
5461
5461
  var FinalPriceStyledContainer = newStyled.div(templateObject_1$1r || (templateObject_1$1r = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
5462
5462
  var PriceLabelV2 = function (_a) {
5463
5463
  var _b;
5464
- var finalPrice = _a.finalPrice, originalPrice = _a.originalPrice, discount = _a.discount, clubOffer = _a.clubOffer, color = _a.color, testId = _a.testId, _c = _a.originalPriceStyled, originalPriceStyled = _c === void 0 ? false : _c, _d = _a.originalPriceUnderlined, originalPriceUnderlined = _d === void 0 ? true : _d, _e = _a.size, size = _e === void 0 ? exports.ComponentSize.Medium : _e;
5464
+ var finalPrice = _a.finalPrice, originalPrice = _a.originalPrice, discount = _a.discount, clubOffer = _a.clubOffer, color = _a.color, testId = _a.testId, _c = _a.originalPriceStyled, originalPriceStyled = _c === void 0 ? false : _c, _d = _a.originalPriceUnderlined, originalPriceUnderlined = _d === void 0 ? true : _d, _e = _a.size, size = _e === void 0 ? exports.ComponentSize.Medium : _e, _f = _a.savingsDisplay, savingsDisplay = _f === void 0 ? true : _f;
5465
5465
  var theme = useTheme();
5466
5466
  var isDiffFinalAndOriginalPrice = originalPrice !== finalPrice;
5467
5467
  var isOriginalPrice = originalPrice && isDiffFinalAndOriginalPrice;
@@ -5488,8 +5488,26 @@ var PriceLabelV2 = function (_a) {
5488
5488
  : color || theme.colors.pallete.secondary.color,
5489
5489
  weight: 700,
5490
5490
  };
5491
+ var originalPriceNum, finalPriceNum;
5492
+ if (typeof originalPrice === 'string' && typeof finalPrice === 'string') {
5493
+ originalPriceNum = Number(originalPrice.replace(currencySymbol, ''));
5494
+ finalPriceNum = Number(finalPrice.replace(currencySymbol, ''));
5495
+ }
5496
+ else {
5497
+ originalPriceNum = typeof originalPrice === 'number' ? originalPrice : 0;
5498
+ finalPriceNum = typeof finalPrice === 'number' ? finalPrice : 0;
5499
+ }
5500
+ var saveto = originalPriceNum - finalPriceNum;
5501
+ var decimalPart = Number((saveto - Math.floor(saveto)).toFixed(2));
5502
+ if (decimalPart >= 0.01 && decimalPart < 0.5) {
5503
+ saveto = Math.floor(saveto) + 0.0;
5504
+ }
5505
+ else if (decimalPart >= 0.51 && decimalPart < 1.0) {
5506
+ saveto = Math.floor(saveto) + 0.5;
5507
+ }
5508
+ var savetoString = saveto.toFixed(2);
5491
5509
  var OriginalPrice = function () { return (jsxRuntime.jsx(Price, __assign$1({ size: originalPriceStyled ? size : exports.ComponentSize.Small, color: theme.colors.shades['300'].color, margin: true, underlined: originalPriceUnderlined, "data-testid": getTestId(testId, 'original-product-price') }, { children: originalPrice }), void 0)); };
5492
- return (jsxRuntime.jsxs(Container$10, { children: [isOriginalPrice && jsxRuntime.jsx(OriginalPrice, {}, void 0), jsxRuntime.jsxs(FinalPriceStyledContainer, __assign$1({ "data-testid": getTestId(testId, 'final-product-price') }, { children: [jsxRuntime.jsx(Price, __assign$1({ margin: true, finalPriceStyledSmall: true, style: { fontSize: '14px', marginTop: '-5px' } }, priceCommonProps, { children: currencySymbol }), void 0), jsxRuntime.jsx(Price, __assign$1({ finalPriceStyled: true }, priceCommonProps, { children: finalPriceArray[0] ? finalPriceArray[0] : (_b = "".concat(finalPrice)) === null || _b === void 0 ? void 0 : _b.split(currencySymbol)[1] }), void 0), jsxRuntime.jsx(Price, __assign$1({ finalPriceStyledSmall: true, style: { fontSize: '14px', marginTop: '-6px' } }, priceCommonProps, { children: finalPriceArray[1] ? finalPriceArray[1] : '00' }), void 0)] }), void 0), isDiscount && (jsxRuntime.jsx(TagContainer, __assign$1({ size: exports.ComponentSize.Small }, { children: discount && (jsxRuntime.jsx(DiscountTag, __assign$1({}, discount, { size: exports.ComponentSize.Medium, style: { fontSize: '14px', letterSpacing: '-0.05rem' } }), void 0)) }), void 0)), isClubOffer && (jsxRuntime.jsx(TagContainer, __assign$1({ size: exports.ComponentSize.Medium }, { children: clubOffer && (jsxRuntime.jsx(ClubOfferTag, __assign$1({}, clubOffer, { size: exports.ComponentSize.Small, style: {
5510
+ return (jsxRuntime.jsxs(Container$10, { children: [isOriginalPrice && jsxRuntime.jsx(OriginalPrice, {}, void 0), jsxRuntime.jsxs(FinalPriceStyledContainer, __assign$1({ "data-testid": getTestId(testId, 'final-product-price') }, { children: [jsxRuntime.jsx(Price, __assign$1({ margin: true, finalPriceStyledSmall: true, style: { fontSize: '14px', marginTop: '-5px' } }, priceCommonProps, { children: currencySymbol }), void 0), jsxRuntime.jsx(Price, __assign$1({ finalPriceStyled: true }, priceCommonProps, { children: finalPriceArray[0] ? finalPriceArray[0] : (_b = "".concat(finalPrice)) === null || _b === void 0 ? void 0 : _b.split(currencySymbol)[1] }), void 0), jsxRuntime.jsx(Price, __assign$1({ finalPriceStyledSmall: true, style: { fontSize: '14px', marginTop: '-6px' } }, priceCommonProps, { children: finalPriceArray[1] ? finalPriceArray[1] : '00' }), void 0)] }), void 0), isDiscount && (jsxRuntime.jsx(TagContainer, __assign$1({ size: exports.ComponentSize.Small }, { children: discount && (jsxRuntime.jsx(DiscountTag, __assign$1({}, discount, { size: exports.ComponentSize.Medium, style: { fontSize: '14px', letterSpacing: '-0.05rem' }, savings: savingsDisplay ? "Save ".concat(currencySymbol).concat(savetoString) : undefined }), void 0)) }), void 0)), isClubOffer && (jsxRuntime.jsx(TagContainer, __assign$1({ size: exports.ComponentSize.Medium }, { children: clubOffer && (jsxRuntime.jsx(ClubOfferTag, __assign$1({}, clubOffer, { size: exports.ComponentSize.Small, style: {
5493
5511
  borderRadius: '8px',
5494
5512
  width: '107px',
5495
5513
  height: '28px',
@@ -14054,8 +14072,8 @@ function usePreventVerticalScroll(ref, dragThreshold) {
14054
14072
  if (Math.abs(clientX.current) > dragThreshold) {
14055
14073
  if (e.cancelable) {
14056
14074
  e.preventDefault();
14075
+ e.returnValue = false;
14057
14076
  }
14058
- e.returnValue = false;
14059
14077
  return false;
14060
14078
  }
14061
14079
  return true;