@trafilea/afrodita-components 6.5.2 → 6.5.4
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.d.ts +2 -2
- package/build/index.esm.js +29 -26
- package/build/index.esm.js.map +1 -1
- package/build/index.js +29 -26
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.js
CHANGED
|
@@ -5480,31 +5480,26 @@ var templateObject_1$1A, templateObject_2$10, templateObject_3$Q;
|
|
|
5480
5480
|
var FinalPriceStyledContainer$1 = newStyled.div(templateObject_1$1z || (templateObject_1$1z = __makeTemplateObject(["\n display: flex;\n"], ["\n display: flex;\n"])));
|
|
5481
5481
|
var PriceLabelV2 = function (_a) {
|
|
5482
5482
|
var _b;
|
|
5483
|
-
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.Small : _e, _f = _a.bordersRounded, bordersRounded = _f === void 0 ? false : _f, _g = _a.savingsDisplay, savingsDisplay = _g === void 0 ? true : _g,
|
|
5483
|
+
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.Small : _e, _f = _a.bordersRounded, bordersRounded = _f === void 0 ? false : _f, _g = _a.savingsDisplay, savingsDisplay = _g === void 0 ? true : _g, pricePerItem = _a.pricePerItem, rest = __rest(_a, ["finalPrice", "originalPrice", "discount", "clubOffer", "color", "testId", "originalPriceStyled", "originalPriceUnderlined", "size", "bordersRounded", "savingsDisplay", "pricePerItem"]);
|
|
5484
5484
|
var theme = useTheme();
|
|
5485
|
-
var
|
|
5485
|
+
var productFinalPrice = pricePerItem ? pricePerItem : finalPrice;
|
|
5486
|
+
var isDiffFinalAndOriginalPrice = originalPrice !== productFinalPrice;
|
|
5486
5487
|
var isOriginalPrice = originalPrice && isDiffFinalAndOriginalPrice;
|
|
5487
5488
|
var isDiscount = discount && isDiffFinalAndOriginalPrice;
|
|
5488
5489
|
var isClubOffer = clubOffer && isDiffFinalAndOriginalPrice;
|
|
5489
5490
|
var supportedCurrencies = ['A$', 'CA$', '£'];
|
|
5490
5491
|
var currencySymbol = '$';
|
|
5491
|
-
if (typeof
|
|
5492
|
+
if (typeof productFinalPrice === 'string') {
|
|
5492
5493
|
supportedCurrencies.forEach(function (availableCurrency) {
|
|
5493
|
-
if (
|
|
5494
|
+
if (productFinalPrice.includes(availableCurrency)) {
|
|
5494
5495
|
currencySymbol = availableCurrency;
|
|
5495
5496
|
}
|
|
5496
5497
|
});
|
|
5497
5498
|
}
|
|
5498
|
-
var
|
|
5499
|
-
|
|
5500
|
-
|
|
5501
|
-
|
|
5502
|
-
? "".concat(currencySymbol).concat((Number(priceSymbolRemoved) / quantity).toFixed(2))
|
|
5503
|
-
: finalPrice;
|
|
5504
|
-
var finalPriceArray = typeof finalPricePerQuantity === 'string' &&
|
|
5505
|
-
finalPricePerQuantity.includes('.') &&
|
|
5506
|
-
finalPricePerQuantity.includes(currencySymbol)
|
|
5507
|
-
? finalPricePerQuantity.split(currencySymbol)[1].split('.')
|
|
5499
|
+
var finalPriceArray = typeof productFinalPrice === 'string' &&
|
|
5500
|
+
productFinalPrice.includes('.') &&
|
|
5501
|
+
productFinalPrice.includes(currencySymbol)
|
|
5502
|
+
? productFinalPrice.split(currencySymbol)[1].split('.')
|
|
5508
5503
|
: ['', ''];
|
|
5509
5504
|
var priceCommonProps = {
|
|
5510
5505
|
size: exports.ComponentSize.Small,
|
|
@@ -5514,13 +5509,13 @@ var PriceLabelV2 = function (_a) {
|
|
|
5514
5509
|
weight: 700,
|
|
5515
5510
|
};
|
|
5516
5511
|
var originalPriceNum, finalPriceNum;
|
|
5517
|
-
if (typeof originalPrice === 'string' && typeof
|
|
5512
|
+
if (typeof originalPrice === 'string' && typeof productFinalPrice === 'string') {
|
|
5518
5513
|
originalPriceNum = Number(originalPrice.replace(currencySymbol, ''));
|
|
5519
|
-
finalPriceNum = Number(
|
|
5514
|
+
finalPriceNum = Number(productFinalPrice.replace(currencySymbol, ''));
|
|
5520
5515
|
}
|
|
5521
5516
|
else {
|
|
5522
5517
|
originalPriceNum = typeof originalPrice === 'number' ? originalPrice : 0;
|
|
5523
|
-
finalPriceNum = typeof
|
|
5518
|
+
finalPriceNum = typeof productFinalPrice === 'number' ? productFinalPrice : 0;
|
|
5524
5519
|
}
|
|
5525
5520
|
var saveto = originalPriceNum - finalPriceNum;
|
|
5526
5521
|
var decimalPart = Number((saveto - Math.floor(saveto)).toFixed(2));
|
|
@@ -5535,9 +5530,11 @@ var PriceLabelV2 = function (_a) {
|
|
|
5535
5530
|
theme.colors.shades['300'].color, margin: true, underlined: originalPriceUnderlined, "data-testid": getTestId(testId, 'original-product-price') }, { children: originalPrice }), void 0)); };
|
|
5536
5531
|
return (jsxRuntime.jsxs(Container$Z, __assign$1({}, rest, { children: [isOriginalPrice && jsxRuntime.jsx(OriginalPrice, {}, void 0), jsxRuntime.jsxs(FinalPriceStyledContainer$1, __assign$1({ "data-testid": getTestId(testId, 'final-product-price') }, { children: [jsxRuntime.jsx(Price, __assign$1({ margin: true, finalPriceStyledSmall: true, style: {
|
|
5537
5532
|
marginTop: '-5px',
|
|
5538
|
-
} }, priceCommonProps, { size: size }, { children: currencySymbol }), void 0), jsxRuntime.jsx(Price, __assign$1({ finalPriceStyled: true }, priceCommonProps, { size: size }, { children: finalPriceArray[0]
|
|
5533
|
+
} }, priceCommonProps, { size: size }, { children: currencySymbol }), void 0), jsxRuntime.jsx(Price, __assign$1({ finalPriceStyled: true }, priceCommonProps, { size: size }, { children: finalPriceArray[0]
|
|
5534
|
+
? finalPriceArray[0]
|
|
5535
|
+
: (_b = "".concat(productFinalPrice)) === null || _b === void 0 ? void 0 : _b.split(currencySymbol)[1] }), void 0), jsxRuntime.jsx(Price, __assign$1({ finalPriceStyledSmall: true, style: {
|
|
5539
5536
|
marginTop: '-6px',
|
|
5540
|
-
} }, priceCommonProps, { size: size }, { children: finalPriceArray[1] ? finalPriceArray[1] : '00' }), void 0),
|
|
5537
|
+
} }, priceCommonProps, { size: size }, { children: finalPriceArray[1] ? finalPriceArray[1] : '00' }), void 0), pricePerItem && (jsxRuntime.jsx(Price, __assign$1({ size: exports.ComponentSize.Small, color: theme.colors.pallete.secondary.color }, { children: "/each" }), 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: {
|
|
5541
5538
|
letterSpacing: '-0.05rem',
|
|
5542
5539
|
}, bordersRounded: bordersRounded, 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: {
|
|
5543
5540
|
borderRadius: '8px',
|
|
@@ -5556,7 +5553,7 @@ var ContainerDirectionColumn = newStyled.div(templateObject_2$$ || (templateObje
|
|
|
5556
5553
|
var DiscountEachOneContainer = newStyled.div(templateObject_3$P || (templateObject_3$P = __makeTemplateObject(["\n display: flex;\n padding-left: 0.5rem;\n"], ["\n display: flex;\n padding-left: 0.5rem;\n"])));
|
|
5557
5554
|
var PriceLabelV3 = function (_a) {
|
|
5558
5555
|
var _b;
|
|
5559
|
-
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.Small : _e, _f = _a.bordersRounded, bordersRounded = _f === void 0 ? false : _f, _g = _a.savingsDisplay, savingsDisplay = _g === void 0 ? true : _g, itemsQuantity = _a.itemsQuantity, rest = __rest(_a, ["finalPrice", "originalPrice", "discount", "clubOffer", "color", "testId", "originalPriceStyled", "originalPriceUnderlined", "size", "bordersRounded", "savingsDisplay", "itemsQuantity"]);
|
|
5556
|
+
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.Small : _e, _f = _a.bordersRounded, bordersRounded = _f === void 0 ? false : _f, _g = _a.savingsDisplay, savingsDisplay = _g === void 0 ? true : _g, itemsQuantity = _a.itemsQuantity, packUnitPrice = _a.packUnitPrice, rest = __rest(_a, ["finalPrice", "originalPrice", "discount", "clubOffer", "color", "testId", "originalPriceStyled", "originalPriceUnderlined", "size", "bordersRounded", "savingsDisplay", "itemsQuantity", "packUnitPrice"]);
|
|
5560
5557
|
var theme = useTheme();
|
|
5561
5558
|
var isDiffFinalAndOriginalPrice = originalPrice !== finalPrice;
|
|
5562
5559
|
var isOriginalPrice = originalPrice && isDiffFinalAndOriginalPrice;
|
|
@@ -5604,17 +5601,15 @@ var PriceLabelV3 = function (_a) {
|
|
|
5604
5601
|
var OriginalPrice = function () { return (jsxRuntime.jsx(Price, __assign$1({ size: originalPriceStyled ? size : exports.ComponentSize.Small, color: theme.component.pricing.priceLabel.price.originalPriceColor ||
|
|
5605
5602
|
theme.colors.shades['300'].color, margin: true, underlined: originalPriceUnderlined, "data-testid": getTestId(testId, 'original-product-price') }, { children: originalPrice }), void 0)); };
|
|
5606
5603
|
var DiscountedPriceOfEach = function () {
|
|
5607
|
-
var priceEachOne;
|
|
5608
5604
|
if (!itemsQuantity || itemsQuantity < 2)
|
|
5609
5605
|
return null;
|
|
5610
|
-
|
|
5611
|
-
return (jsxRuntime.jsxs(DiscountEachOneContainer, __assign$1({ "data-testid": getTestId(testId, 'each-one-price') }, { children: [jsxRuntime.jsxs(Price, __assign$1({}, priceCommonProps, { weight: 600 }, { children: ["(", currencySymbol, priceEachOne] }), void 0), jsxRuntime.jsx(Price, __assign$1({}, priceCommonProps, { weight: 400 }, { children: "/each" }), void 0), jsxRuntime.jsx(Price, __assign$1({}, priceCommonProps, { weight: 600 }, { children: ")" }), void 0)] }), void 0));
|
|
5606
|
+
return (jsxRuntime.jsxs(DiscountEachOneContainer, __assign$1({ "data-testid": getTestId(testId, 'each-one-price') }, { children: [jsxRuntime.jsxs(Price, __assign$1({}, priceCommonProps, { weight: 600 }, { children: ["(", packUnitPrice] }), void 0), jsxRuntime.jsx(Price, __assign$1({}, priceCommonProps, { weight: 400 }, { children: "/each" }), void 0), jsxRuntime.jsx(Price, __assign$1({}, priceCommonProps, { weight: 600 }, { children: ")" }), void 0)] }), void 0));
|
|
5612
5607
|
};
|
|
5613
5608
|
return (jsxRuntime.jsxs(ContainerDirectionColumn, __assign$1({}, rest, { children: [jsxRuntime.jsx(Container$Z, __assign$1({ style: { paddingBottom: '0.5rem' } }, { children: isOriginalPrice && jsxRuntime.jsx(OriginalPrice, {}, void 0) }), void 0), jsxRuntime.jsxs(Container$Z, { children: [jsxRuntime.jsxs(FinalPriceStyledContainer, __assign$1({ "data-testid": getTestId(testId, 'final-product-price') }, { children: [jsxRuntime.jsx(Price, __assign$1({ margin: true, finalPriceStyledSmall: true, style: {
|
|
5614
5609
|
marginTop: '-5px',
|
|
5615
5610
|
} }, priceCommonProps, { size: size }, { children: currencySymbol }), void 0), jsxRuntime.jsx(Price, __assign$1({ finalPriceStyled: true }, priceCommonProps, { size: size }, { 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: {
|
|
5616
5611
|
marginTop: '-6px',
|
|
5617
|
-
} }, priceCommonProps, { size: size }, { children: finalPriceArray[1] ? finalPriceArray[1] : '00' }), void 0)] }), void 0),
|
|
5612
|
+
} }, priceCommonProps, { size: size }, { children: finalPriceArray[1] ? finalPriceArray[1] : '00' }), void 0)] }), void 0), jsxRuntime.jsx(DiscountedPriceOfEach, {}, 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: {
|
|
5618
5613
|
letterSpacing: '-0.05rem',
|
|
5619
5614
|
}, bordersRounded: bordersRounded, savings: savingsDisplay ? "SAVE ".concat(currencySymbol).concat(savetoString) : undefined, showSavings: true }), 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: {
|
|
5620
5615
|
borderRadius: '8px',
|
|
@@ -18896,14 +18891,22 @@ var ButtonsContainer = newStyled.div(templateObject_1$c || (templateObject_1$c =
|
|
|
18896
18891
|
var Row = newStyled.div(templateObject_2$8 || (templateObject_2$8 = __makeTemplateObject(["\n gap: 5px;\n display: flex;\n margin: 5px 0 3px;\n flex-wrap: wrap;\n\n & button {\n font-weight: 600;\n }\n"], ["\n gap: 5px;\n display: flex;\n margin: 5px 0 3px;\n flex-wrap: wrap;\n\n & button {\n font-weight: 600;\n }\n"])));
|
|
18897
18892
|
var templateObject_1$c, templateObject_2$8;
|
|
18898
18893
|
|
|
18894
|
+
var getPreLabel = function (sizeLabel) {
|
|
18895
|
+
if (sizeLabel === '3XL' || sizeLabel === '4XL') {
|
|
18896
|
+
return 'Runs big - ';
|
|
18897
|
+
}
|
|
18898
|
+
if (sizeLabel === 'M' || sizeLabel === 'L' || sizeLabel === 'M / L') {
|
|
18899
|
+
return 'Runs small - ';
|
|
18900
|
+
}
|
|
18901
|
+
return '';
|
|
18902
|
+
};
|
|
18899
18903
|
var SizeSelector = function (_a) {
|
|
18900
18904
|
var label = _a.label, sizes = _a.sizes, selectedValue = _a.selectedValue, onChange = _a.onChange, onClickSizeTip = _a.onClickSizeTip, _b = _a.inline, inline = _b === void 0 ? false : _b, width = _a.width, _c = _a.hasSizeGuide, hasSizeGuide = _c === void 0 ? false : _c;
|
|
18901
|
-
var isLarge = selectedValue.label === '3XL' || selectedValue.label === '4XL';
|
|
18902
18905
|
return (jsxs("div", __assign$1({ css: {
|
|
18903
18906
|
display: 'flex',
|
|
18904
18907
|
flexDirection: inline ? 'row' : 'column',
|
|
18905
18908
|
alignItems: inline ? 'center' : 'start',
|
|
18906
|
-
} }, { children: [jsxs(Text$8, __assign$1({ variant: "body", weight: "regular", size: "small", css: { alignSelf: inline ? 'start' : 'inherit', padding: inline ? '0.75rem 0' : '0' } }, { children: [label, !inline && (jsx(Text$8, __assign$1({ variant: "label", weight: "demi", size: "regular" }, { children: selectedValue.description }), void 0))] }), void 0), hasSizeGuide && (jsxs(Row, { children: [jsx(Icon.Actions.CircleInfo, { width: 1.2 }, void 0), jsx(Text$8, __assign$1({ variant: "body", weight: "demi", size: "small", css: { display: 'flex' } }, { children: "Sizing Tip:" }), void 0),
|
|
18909
|
+
} }, { children: [jsxs(Text$8, __assign$1({ variant: "body", weight: "regular", size: "small", css: { alignSelf: inline ? 'start' : 'inherit', padding: inline ? '0.75rem 0' : '0' } }, { children: [label, !inline && (jsx(Text$8, __assign$1({ variant: "label", weight: "demi", size: "regular" }, { children: selectedValue.description }), void 0))] }), void 0), hasSizeGuide && (jsxs(Row, { children: [jsx(Icon.Actions.CircleInfo, { width: 1.2 }, void 0), jsx(Text$8, __assign$1({ variant: "body", weight: "demi", size: "small", css: { display: 'flex' } }, { children: "Sizing Tip:" }), void 0), jsxs(Text$8, __assign$1({ variant: "body", weight: "regular", size: "small" }, { children: [getPreLabel(selectedValue.label), "Refer to our"] }), void 0), onClickSizeTip && (jsx(SizeFitGuide, { title: "Size and Fit Guide", onClick: onClickSizeTip, hideIcon: true }, void 0))] }, void 0)), jsx(ButtonsContainer, __assign$1({ inline: inline }, { children: sizes.map(function (size) {
|
|
18907
18910
|
var active = !size.disabled && size.label === selectedValue.label;
|
|
18908
18911
|
return (jsx(SelectorSecondary, { css: {
|
|
18909
18912
|
padding: '0.75rem 1rem 0.625rem',
|