@trafilea/afrodita-components 7.5.0 → 7.5.2

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.
@@ -1,2 +1,2 @@
1
- import{__assign as o}from"tslib";import{jsxs as r,jsx as e}from"react/jsx-runtime";import{useTheme as s}from"../../../core/theme/Theme.js";import{ComponentSize as d}from"../../../types/enums.js";import{Container as i,IconContainer as t,H3 as n}from"./styled.js";var c=function(c){var l=c.discount,a=c.offText,m=c.savings,f=c.showSavings,v=void 0!==f&&f,h=c.disabled,u=c.backgroundColor,p=void 0===u?"#fff":u,b=c.borderColor,C=void 0===b?"transparent":b,x=c.textColor,y=void 0===x?"#fff":x,g=c.size,j=void 0===g?d.Medium:g,w=c.style,z=c.bordersRounded,k=void 0!==z&&z,R=c.icon,S=s();return r(i,o({backgroundColor:h?S.colors.shades[50].color:p,borderColor:h?S.colors.shades[50].color:C,size:j,"data-testid":"discount-container",style:w,bordersRounded:k},{children:[R&&e(t,{children:R},void 0),r(n,o({textColor:h?S.colors.shades[250].color:y,size:j,style:o(o({},w),{whiteSpace:"nowrap"}),theme:S},{children:[l,"% ",a," ",v&&m&&"- ".concat(m)]}),void 0)]}),void 0)};export{c as DiscountTag};
1
+ import{__assign as o}from"tslib";import{jsxs as r,jsx as i,Fragment as s}from"react/jsx-runtime";import{useTheme as e}from"../../../core/theme/Theme.js";import{ComponentSize as n}from"../../../types/enums.js";import{Container as t,IconContainer as d,H3 as c}from"./styled.js";var a=function(o){var r=o.discount,e=o.offText,n=o.savings,t=o.showSavings,d=void 0!==t&&t,c=o.showOnlySavings;if(void 0!==c&&c&&n)return i(s,{children:n},void 0);var a="".concat(r,"% ").concat(e),v=d&&n?" - ".concat(n):"";return i(s,{children:"".concat(a).concat(v).trim()},void 0)},v=function(s){var v=s.discount,l=s.offText,f=s.savings,h=s.showSavings,m=void 0!==h&&h,u=s.showOnlySavings,g=void 0!==u&&u,p=s.disabled,b=s.backgroundColor,w=void 0===b?"#fff":b,y=s.borderColor,x=void 0===y?"transparent":y,S=s.textColor,C=void 0===S?"#fff":S,j=s.size,T=void 0===j?n.Medium:j,z=s.style,O=s.bordersRounded,k=void 0!==O&&O,R=s.icon,M=e();return r(t,o({backgroundColor:p?M.colors.shades[50].color:w,borderColor:p?M.colors.shades[50].color:x,size:T,"data-testid":"discount-container",style:z,bordersRounded:k},{children:[R&&i(d,{children:R},void 0),i(c,o({textColor:p?M.colors.shades[250].color:C,size:T,style:o(o({},z),{whiteSpace:"nowrap"}),theme:M},{children:i(a,{discount:v,offText:l,savings:f,showSavings:m,showOnlySavings:g},void 0)}),void 0)]}),void 0)};export{v as DiscountTag,a as SavingsText};
2
2
  //# sourceMappingURL=DiscountTag.js.map
@@ -1,2 +1,2 @@
1
- import{__assign as t}from"tslib";import{jsxs as r,jsx as e}from"react/jsx-runtime";import{useTheme as o}from"../../../../core/theme/Theme.js";import{Text as i}from"../../../text/Text.js";import{Footer as n}from"../Footer/Footer.js";import{ProductItem as m}from"../ProductItem/ProductItem.js";import{Container as d,Header as c,OptionsList as l,OptionItem as h,Anchor as p}from"./styled.js";var s=function(s){var v=s.options,a=s.header,f=s.footer,u=s.onViewAll,j=s.testId,x=s.onItemClick,I=o();return r(d,t({"data-testid":j,theme:I},{children:[a&&e(c,t({theme:I},{children:e(i,t({variant:"heading6",weight:"demi"},{children:a}),void 0)}),void 0),e(l,{children:v.map((function(r){var o=r.optionUrl,i=r.price,n=r.src,d=r.title;return e(h,t({theme:I},{children:e(p,t({href:o,onClick:function(){return t={optionUrl:o,price:i,src:n,title:d},void(null==x||x(t));var t}},{children:e(m,{src:n,title:d,price:i},void 0)}),void 0)}),d)}))},void 0),f&&e(n,{text:f,onClick:u},void 0)]}),void 0)};export{s as ResultsPanel};
1
+ import{__assign as t,__rest as r}from"tslib";import{jsxs as e,jsx as i}from"react/jsx-runtime";import{useTheme as o}from"../../../../core/theme/Theme.js";import{Text as n}from"../../../text/Text.js";import{Footer as m}from"../Footer/Footer.js";import{ProductItem as c}from"../ProductItem/ProductItem.js";import{Container as d,Header as l,OptionsList as p,OptionItem as h,Anchor as s}from"./styled.js";var v=function(v){var a=v.options,f=v.header,u=v.footer,j=v.onViewAll,x=v.testId,I=v.onItemClick,k=o();return e(d,t({"data-testid":x,theme:k},{children:[f&&i(l,t({theme:k},{children:i(n,t({variant:"heading6",weight:"demi"},{children:f}),void 0)}),void 0),i(p,{children:a.map((function(e){var o=e.optionUrl,n=e.price,m=e.src,d=e.title,l=r(e,["optionUrl","price","src","title"]);return i(h,t({theme:k},{children:i(s,t({href:o,onClick:function(){return r=t({optionUrl:o,price:n,src:m,title:d},l),void(null==I||I(r));var r}},{children:i(c,{src:m,title:d,price:n},void 0)}),void 0)}),d)}))},void 0),u&&i(m,{text:u,onClick:j},void 0)]}),void 0)};export{v as ResultsPanel};
2
2
  //# sourceMappingURL=ResultsPanel.js.map
package/build/index.d.ts CHANGED
@@ -90,6 +90,7 @@ interface DiscountTagProps$1 {
90
90
  offText: string;
91
91
  savings?: string;
92
92
  showSavings?: boolean;
93
+ showOnlySavings?: boolean;
93
94
  disabled?: boolean;
94
95
  backgroundColor?: string;
95
96
  borderColor?: string;
@@ -99,7 +100,7 @@ interface DiscountTagProps$1 {
99
100
  bordersRounded?: boolean;
100
101
  icon?: ReactNode;
101
102
  }
102
- declare const DiscountTag: ({ discount, offText, savings, showSavings, disabled, backgroundColor, borderColor, textColor, size, style, bordersRounded, icon, }: DiscountTagProps$1) => JSX.Element;
103
+ declare const DiscountTag: ({ discount, offText, savings, showSavings, showOnlySavings, disabled, backgroundColor, borderColor, textColor, size, style, bordersRounded, icon, }: DiscountTagProps$1) => JSX.Element;
103
104
 
104
105
  interface PriceLabelProps {
105
106
  finalPrice: string | number;
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),o=require("react/jsx-runtime"),s=require("../../../core/theme/Theme.js"),r=require("../../../types/enums.js"),i=require("./styled.js");exports.DiscountTag=function(t){var n=t.discount,d=t.offText,a=t.savings,c=t.showSavings,l=void 0!==c&&c,u=t.disabled,v=t.backgroundColor,h=void 0===v?"#fff":v,f=t.borderColor,_=void 0===f?"transparent":f,b=t.textColor,g=void 0===b?"#fff":b,x=t.size,C=void 0===x?r.ComponentSize.Medium:x,j=t.style,m=t.bordersRounded,p=void 0!==m&&m,y=t.icon,q=s.useTheme();return o.jsxs(i.Container,e.__assign({backgroundColor:u?q.colors.shades[50].color:h,borderColor:u?q.colors.shades[50].color:_,size:C,"data-testid":"discount-container",style:j,bordersRounded:p},{children:[y&&o.jsx(i.IconContainer,{children:y},void 0),o.jsxs(i.H3,e.__assign({textColor:u?q.colors.shades[250].color:g,size:C,style:e.__assign(e.__assign({},j),{whiteSpace:"nowrap"}),theme:q},{children:[n,"% ",d," ",l&&a&&"- ".concat(a)]}),void 0)]}),void 0)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var o=require("tslib"),e=require("react/jsx-runtime"),s=require("../../../core/theme/Theme.js"),r=require("../../../types/enums.js"),i=require("./styled.js"),n=function(o){var s=o.discount,r=o.offText,i=o.savings,n=o.showSavings,t=void 0!==n&&n,d=o.showOnlySavings;if(void 0!==d&&d&&i)return e.jsx(e.Fragment,{children:i},void 0);var a="".concat(s,"% ").concat(r),c=t&&i?" - ".concat(i):"";return e.jsx(e.Fragment,{children:"".concat(a).concat(c).trim()},void 0)};exports.DiscountTag=function(t){var d=t.discount,a=t.offText,c=t.savings,v=t.showSavings,l=void 0!==v&&v,u=t.showOnlySavings,g=void 0!==u&&u,h=t.disabled,f=t.backgroundColor,x=void 0===f?"#fff":f,j=t.borderColor,m=void 0===j?"transparent":j,_=t.textColor,b=void 0===_?"#fff":_,p=t.size,y=void 0===p?r.ComponentSize.Medium:p,C=t.style,S=t.bordersRounded,w=void 0!==S&&S,T=t.icon,q=s.useTheme();return e.jsxs(i.Container,o.__assign({backgroundColor:h?q.colors.shades[50].color:x,borderColor:h?q.colors.shades[50].color:m,size:y,"data-testid":"discount-container",style:C,bordersRounded:w},{children:[T&&e.jsx(i.IconContainer,{children:T},void 0),e.jsx(i.H3,o.__assign({textColor:h?q.colors.shades[250].color:b,size:y,style:o.__assign(o.__assign({},C),{whiteSpace:"nowrap"}),theme:q},{children:e.jsx(n,{discount:d,offText:a,savings:c,showSavings:l,showOnlySavings:g},void 0)}),void 0)]}),void 0)},exports.SavingsText=n;
2
2
  //# sourceMappingURL=DiscountTag.js.map
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),t=require("../../../../core/theme/Theme.js"),i=require("../../../text/Text.js"),s=require("../Footer/Footer.js"),o=require("../ProductItem/ProductItem.js"),n=require("./styled.js");exports.ResultsPanel=function(d){var c=d.options,l=d.header,u=d.footer,a=d.onViewAll,h=d.testId,j=d.onItemClick,x=t.useTheme();return r.jsxs(n.Container,e.__assign({"data-testid":h,theme:x},{children:[l&&r.jsx(n.Header,e.__assign({theme:x},{children:r.jsx(i.Text,e.__assign({variant:"heading6",weight:"demi"},{children:l}),void 0)}),void 0),r.jsx(n.OptionsList,{children:c.map((function(t){var i=t.optionUrl,s=t.price,d=t.src,c=t.title;return r.jsx(n.OptionItem,e.__assign({theme:x},{children:r.jsx(n.Anchor,e.__assign({href:i,onClick:function(){return e={optionUrl:i,price:s,src:d,title:c},void(null==j||j(e));var e}},{children:r.jsx(o.ProductItem,{src:d,title:c,price:s},void 0)}),void 0)}),c)}))},void 0),u&&r.jsx(s.Footer,{text:u,onClick:a},void 0)]}),void 0)};
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("tslib"),r=require("react/jsx-runtime"),t=require("../../../../core/theme/Theme.js"),i=require("../../../text/Text.js"),s=require("../Footer/Footer.js"),o=require("../ProductItem/ProductItem.js"),n=require("./styled.js");exports.ResultsPanel=function(c){var d=c.options,l=c.header,u=c.footer,a=c.onViewAll,h=c.testId,_=c.onItemClick,j=t.useTheme();return r.jsxs(n.Container,e.__assign({"data-testid":h,theme:j},{children:[l&&r.jsx(n.Header,e.__assign({theme:j},{children:r.jsx(i.Text,e.__assign({variant:"heading6",weight:"demi"},{children:l}),void 0)}),void 0),r.jsx(n.OptionsList,{children:d.map((function(t){var i=t.optionUrl,s=t.price,c=t.src,d=t.title,l=e.__rest(t,["optionUrl","price","src","title"]);return r.jsx(n.OptionItem,e.__assign({theme:j},{children:r.jsx(n.Anchor,e.__assign({href:i,onClick:function(){return r=e.__assign({optionUrl:i,price:s,src:c,title:d},l),void(null==_||_(r));var r}},{children:r.jsx(o.ProductItem,{src:c,title:d,price:s},void 0)}),void 0)}),d)}))},void 0),u&&r.jsx(s.Footer,{text:u,onClick:a},void 0)]}),void 0)};
2
2
  //# sourceMappingURL=ResultsPanel.js.map
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "description": "Trafilea's Design System",
4
4
  "author": "Trafilea",
5
5
  "repository": "https://github.com/trafilea/afrodita-components",
6
- "version": "7.5.0",
6
+ "version": "7.5.2",
7
7
  "private": false,
8
8
  "main": "build/lib/index.js",
9
9
  "style": "build/es/index.css",