@trafilea/afrodita-components 6.3.0 → 6.4.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/build/index.js CHANGED
@@ -3133,6 +3133,20 @@ var formatPrice = function (value, _a) {
3133
3133
  }).format(valueToFormat);
3134
3134
  };
3135
3135
 
3136
+ var Viewports = {
3137
+ mobile: 'mobile',
3138
+ tablet: 'tablet',
3139
+ desktop: 'desktop',
3140
+ desktopLarge: 'desktopLarge',
3141
+ };
3142
+
3143
+ //ANNOTATION: Those values are up to.
3144
+ var DEFAULT_BREAKPOINTS = {
3145
+ mobile: 640,
3146
+ tablet: 1024,
3147
+ desktop: 1280,
3148
+ };
3149
+
3136
3150
  var Container$17 = newStyled.div(templateObject_1$1O || (templateObject_1$1O = __makeTemplateObject(["\n @keyframes shimmer {\n 100% {\n transform: translateX(100%);\n }\n }\n\n display: inline-block;\n height: ", ";\n width: ", ";\n position: relative;\n overflow: hidden;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n\n ::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n transform: translateX(-100%);\n background-image: linear-gradient(\n 90deg,\n ", ",\n ", ",\n ", "\n );\n animation: shimmer 2s infinite;\n content: '';\n box-sizing: border-box;\n }\n"], ["\n @keyframes shimmer {\n 100% {\n transform: translateX(100%);\n }\n }\n\n display: inline-block;\n height: ", ";\n width: ", ";\n position: relative;\n overflow: hidden;\n background-color: ", ";\n border-radius: ", ";\n box-sizing: border-box;\n\n ::after {\n position: absolute;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0;\n transform: translateX(-100%);\n background-image: linear-gradient(\n 90deg,\n ", ",\n ", ",\n ", "\n );\n animation: shimmer 2s infinite;\n content: '';\n box-sizing: border-box;\n }\n"])), function (_a) {
3137
3151
  var height = _a.height;
3138
3152
  return (height ? height : '1.5em');
@@ -5242,12 +5256,6 @@ var DiscountTag = function (_a) {
5242
5256
  };
5243
5257
  var templateObject_1$1A, templateObject_2$10;
5244
5258
 
5245
- //TODO Move this to types with ThemeBreakpoints
5246
- var Viewports = {
5247
- mobile: 'mobile',
5248
- tablet: 'tablet',
5249
- desktop: 'desktop',
5250
- };
5251
5259
  function getWindowDimensions() {
5252
5260
  if (typeof window === 'undefined')
5253
5261
  return { width: 0, height: 0 };
@@ -5260,19 +5268,22 @@ function getWindowDimensions() {
5260
5268
  var getViewport = function (breakpoints, width) {
5261
5269
  if (width <= breakpoints.mobile)
5262
5270
  return Viewports.mobile;
5263
- if (breakpoints.tablet && width <= breakpoints.tablet) {
5271
+ if (width <= breakpoints.tablet)
5264
5272
  return Viewports.tablet;
5265
- }
5266
- return Viewports.desktop;
5273
+ if (width <= breakpoints.desktop)
5274
+ return Viewports.desktop;
5275
+ return Viewports.desktopLarge;
5267
5276
  };
5268
- var useWindowDimensions = function (breakpoints, shouldListenChanges) {
5269
- var _a = React$2.useState(function () {
5277
+ var useWindowDimensions = function (breakpoints, _a) {
5278
+ if (breakpoints === void 0) { breakpoints = DEFAULT_BREAKPOINTS; }
5279
+ var _b = _a === void 0 ? {} : _a, shouldListenChanges = _b.shouldListenChanges;
5280
+ var _c = React$2.useState(function () {
5270
5281
  var dimension = getWindowDimensions();
5271
5282
  return {
5272
5283
  windowDimensions: dimension,
5273
5284
  viewport: getViewport(breakpoints, dimension.width),
5274
5285
  };
5275
- }), state = _a[0], setState = _a[1];
5286
+ }), state = _c[0], setState = _c[1];
5276
5287
  React$2.useEffect(function () {
5277
5288
  function handleResize() {
5278
5289
  var newDimension = getWindowDimensions();
@@ -5294,7 +5305,7 @@ var useWindowDimensions = function (breakpoints, shouldListenChanges) {
5294
5305
  }, [shouldListenChanges]);
5295
5306
  var isMobile = state.viewport === Viewports.mobile;
5296
5307
  var isTablet = state.viewport === Viewports.tablet;
5297
- var isDesktop = state.viewport === Viewports.desktop;
5308
+ var isDesktop = state.viewport === Viewports.desktop || state.viewport === Viewports.desktopLarge;
5298
5309
  return __assign$1(__assign$1({}, state), { isMobile: isMobile, isTablet: isTablet, isDesktop: isDesktop });
5299
5310
  };
5300
5311
 
@@ -5378,7 +5389,7 @@ function getTestId() {
5378
5389
  var PriceLabel = function (_a) {
5379
5390
  var finalPrice = _a.finalPrice, originalPrice = _a.originalPrice, discount = _a.discount, color = _a.color, testId = _a.testId, _b = _a.finalPriceStyled, finalPriceStyled = _b === void 0 ? false : _b, finalPriceStyle = _a.finalPriceStyle, _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.clubStyle, clubStyle = _f === void 0 ? false : _f, rest = __rest(_a, ["finalPrice", "originalPrice", "discount", "color", "testId", "finalPriceStyled", "finalPriceStyle", "originalPriceStyled", "originalPriceUnderlined", "size", "clubStyle"]);
5380
5391
  var theme = useTheme();
5381
- var isMobile = useWindowDimensions({ mobile: 0, desktop: 768 }).isMobile;
5392
+ var isMobile = useWindowDimensions().isMobile;
5382
5393
  var priceCommonProps = {
5383
5394
  size: finalPriceStyled ? exports.ComponentSize.Small : size,
5384
5395
  color: color || theme.colors.pallete.secondary.color,
@@ -5924,7 +5935,7 @@ var DesktopDollarPart = newStyled(DollarPart)(templateObject_7$e || (templateObj
5924
5935
  var DesktopClubMembersText = newStyled(ClubMembersText)(templateObject_8$a || (templateObject_8$a = __makeTemplateObject(["\n font-size: 13px;\n"], ["\n font-size: 13px;\n"])));
5925
5936
  var ClubPriceLabel = function (_a) {
5926
5937
  var clubPrice = _a.clubPrice;
5927
- var isMobile = useWindowDimensions({ mobile: 0, desktop: 768 }).isMobile;
5938
+ var isMobile = useWindowDimensions().isMobile;
5928
5939
  return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: isMobile ? (jsxRuntime.jsxs(MobileContainer, { children: [jsxRuntime.jsx(MobileDollarPart, { children: clubPrice }, void 0), jsxRuntime.jsx(MobileClubMembersText, { children: "FOR CLUB MEMBERS" }, void 0)] }, void 0)) : (jsxRuntime.jsxs(Container$S, { children: [jsxRuntime.jsx(DesktopDollarPart, { children: clubPrice }, void 0), jsxRuntime.jsx(DesktopClubMembersText, { children: "FOR CLUB MEMBERS" }, void 0)] }, void 0)) }, void 0));
5929
5940
  };
5930
5941
  var templateObject_1$1h, templateObject_2$T, templateObject_3$I, templateObject_4$x, templateObject_5$m, templateObject_6$k, templateObject_7$e, templateObject_8$a;
@@ -6121,7 +6132,7 @@ var ProductItemMobile = function (_a) {
6121
6132
  } : _g, _h = _a.clubPrice, clubPrice = _h === void 0 ? '' : _h, _j = _a.showClubPriceLabel, showClubPriceLabel = _j === void 0 ? false : _j, isRatingLoading = _a.isRatingLoading;
6122
6133
  var theme = useTheme();
6123
6134
  var styles = getStylesBySize$9(size);
6124
- var isMobile = useWindowDimensions({ mobile: 0, desktop: 768 }).isMobile;
6135
+ var isMobile = useWindowDimensions().isMobile;
6125
6136
  var space = React$2.useMemo(function () {
6126
6137
  var _a;
6127
6138
  return (_a = {},
@@ -6220,7 +6231,7 @@ var ProductItemTK = function (_a) {
6220
6231
  } : _h, _j = _a.clubPrice, clubPrice = _j === void 0 ? '' : _j, _k = _a.showClubPriceLabel, showClubPriceLabel = _k === void 0 ? false : _k;
6221
6232
  var theme = useTheme();
6222
6233
  var styles = getStylesBySize$8(size);
6223
- var isMobile = useWindowDimensions({ mobile: 0, desktop: 768 }).isMobile;
6234
+ var isMobile = useWindowDimensions().isMobile;
6224
6235
  var space = React$2.useMemo(function () {
6225
6236
  var _a;
6226
6237
  return (_a = {},
@@ -13106,7 +13117,7 @@ var IconWrapper = newStyled.div(function (props) { return ({
13106
13117
  var IconsWithTitle = function (_a) {
13107
13118
  var _b;
13108
13119
  var iconName = _a.iconName, iconTitle = _a.iconTitle, _c = _a.iconFolder, iconFolder = _c === void 0 ? 'MyAccount' : _c, _d = _a.withWrapper, withWrapper = _d === void 0 ? true : _d, backgroundColor = _a.backgroundColor, iconColor = _a.iconColor, _e = _a.iconSizeDesktop, iconSizeDesktop = _e === void 0 ? 4 : _e, _f = _a.iconSizeMobile, iconSizeMobile = _f === void 0 ? 3 : _f, _g = _a.iconTitlePosition, iconTitlePosition = _g === void 0 ? 'bottom' : _g, _h = _a.iconTitleStyle, iconTitleStyle = _h === void 0 ? '' : _h, _j = _a.iconStyle, iconStyle = _j === void 0 ? '' : _j, _k = _a.isTitleInnerHtml, isTitleInnerHtml = _k === void 0 ? false : _k;
13109
- var isMobile = useWindowDimensions({ mobile: 0, desktop: 768 }).isMobile;
13120
+ var isMobile = useWindowDimensions().isMobile;
13110
13121
  // @ts-ignore
13111
13122
  var IconComponent = (_b = Icon[iconFolder][iconName]) !== null && _b !== void 0 ? _b : (function () { return 'Not found'; });
13112
13123
  if (IconComponent == null) {
@@ -13141,7 +13152,7 @@ var StyledTitle = newStyled.div(templateObject_3$s || (templateObject_3$s = __ma
13141
13152
  });
13142
13153
  var ImageCardWithDescription = function (_a) {
13143
13154
  var image = _a.image, title = _a.title, description = _a.description, _b = _a.titlePosition, titlePosition = _b === void 0 ? 'left' : _b;
13144
- var isMobile = useWindowDimensions({ desktop: 768, mobile: 0 }).isMobile;
13155
+ var isMobile = useWindowDimensions().isMobile;
13145
13156
  return (jsxRuntime.jsxs(Container$B, __assign$1({ "data-testid": "Container", isMobile: isMobile }, { children: [jsxRuntime.jsx(ImageContainer$2, __assign$1({ "data-testid": "ImageContainer", isMobile: isMobile }, { children: jsxRuntime.jsx(Image$3, { src: image, borderRadius: "40px", alt: "before", height: "100%", width: "100%" }, void 0) }), void 0), jsxRuntime.jsx(StyledTitle, __assign$1({ titlePosition: titlePosition, "data-testid": "StyledTitle" }, { children: isMobile ? (jsxRuntime.jsx(Text$8, __assign$1({ variant: "link", weight: "demi" }, { children: title }), void 0)) : (jsxRuntime.jsx(Text$8, __assign$1({ variant: "heading6", weight: "demi" }, { children: title }), void 0)) }), void 0), jsxRuntime.jsx(Text$8, __assign$1({ variant: "link", weight: "regular" }, { children: description }), void 0)] }), void 0));
13146
13157
  };
13147
13158
  var templateObject_1$P, templateObject_2$y, templateObject_3$s;
@@ -19011,7 +19022,7 @@ var TextContainer = newStyled.div(templateObject_4$4 || (templateObject_4$4 = __
19011
19022
  var TextWithImage = function (_a) {
19012
19023
  var _b, _c, _d, _e;
19013
19024
  var title = _a.title, text = _a.text, children = _a.children, buttomText = _a.buttomText, backgroundColor = _a.backgroundColor, imageLeftSide = _a.imageLeftSide, titleStyle = _a.titleStyle, textStyle = _a.textStyle, _f = _a.buttonWideOnMobile, buttonWideOnMobile = _f === void 0 ? false : _f, props = __rest(_a, ["title", "text", "children", "buttomText", "backgroundColor", "imageLeftSide", "titleStyle", "textStyle", "buttonWideOnMobile"]);
19014
- var isMobile = useWindowDimensions({ desktop: 768, mobile: 0 }).isMobile;
19025
+ var isMobile = useWindowDimensions().isMobile;
19015
19026
  var ImageTitle = function () { return (jsx(Fragment, { children: !isMobile ? (jsx(Text$8, __assign$1({ variant: "heading2", weight: "bold", style: titleStyle
19016
19027
  ? titleStyle
19017
19028
  : {