@gem-sdk/components 2.0.0-dev.897 → 2.0.0-dev.899
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/dist/cjs/button/components/Button.liquid.js +3 -3
- package/dist/cjs/ignoreHashClasses.js +2 -1
- package/dist/cjs/product/components/ProductTag.js +1 -1
- package/dist/cjs/product/components/ProductVariants/variants/Base.liquid.js +3 -3
- package/dist/esm/button/components/Button.liquid.js +10 -10
- package/dist/esm/ignoreHashClasses.js +2 -1
- package/dist/esm/product/components/ProductTag.js +1 -1
- package/dist/esm/product/components/ProductVariants/variants/Base.liquid.js +11 -11
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../helpers.js");const Button=({className:e,builderProps:t,builderAttrs:o,pageContext:a,setting:r={},styles:l={},style:s,wrapClassName:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers=require("../../helpers.js");const Button=({className:e,builderProps:t,builderAttrs:o,pageContext:a,setting:r={},styles:l={},style:s,wrapClassName:i="",advanced:p})=>{let n=["#","mailto:","tel:"],g=["product.url"],{align:c,size:d,backgroundColor:h,textColor:u,roundedBtn:b,spacing:m,globalSize:y}=l,{label:v,iconSvg:$,btnLink:f,htmlType:S,disabled:w,loading:k,iconAlign:C,iconVisible:x,translate:B}=r,z=f?.link!==void 0&&""!==f.link,[G,j]=core.splitStyle(["pos","top","left","bottom","right","z"],s),R=f?.link||"",_=new RegExp(/^https?:\/\//i),q=new RegExp(/^\/?(?:collections|pages|products|blogs)\/?/i),A=z&&!_.test(R)&&q.test(R),E=z&&_.test(R);A&&(R="{{ request.origin }}{{ routes.root_url | split: '/' | join: '/' }}"+R);let I=()=>!!(n.find(e=>R.startsWith(e))||g.find(e=>R.includes(e))),M=E||A||I()||"/"===R?"a":"button",T=E||A||I()||"/"===R?{href:R,target:f?.target}:z?{href:R,target:f?.target,type:S}:{type:S},D="left"===C?core.makeStyle({mr:m}):core.makeStyle({ml:m});w&&(delete h?.hover,delete h?.focus);let F=core.makeGlobalSize(y),H=core.composeTypographyClassName(l?.typo,l?.typography),L=core.composeTypographyStyle(l?.typo,l?.typography),N=`
|
|
2
2
|
.${t?.uid}.gp-button-base::before {
|
|
3
3
|
content: "";
|
|
4
4
|
height: 100%;
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
<div
|
|
19
19
|
${{...o}}
|
|
20
20
|
style="${{...j,...core.makeStyleResponsive("ta",c)}}"
|
|
21
|
-
class="${core.cls(
|
|
21
|
+
class="${core.cls(i,e?.includes("gp-button-atc")?"":p?.cssClass)}"
|
|
22
22
|
>
|
|
23
23
|
<style>${N}</style>
|
|
24
24
|
<${M}
|
|
25
25
|
${{...T,"data-id":t?.uid,"aria-label":r?.label?.toString().replaceAll("'","'"),...w&&"boolean"==typeof w||w?{disabled:"disabled"}:{}}}
|
|
26
26
|
data-state="${k?"loading":"idle"}"
|
|
27
|
-
class="${core.cls(t?.uid,"gp-button-base gp-rounded-none gp-max-w-full gp-relative gp-group gp-inline-flex gp-items-center gp-justify-center gp-no-underline gp-transition-colors gp-duration-300 disabled:gp-btn-disabled disabled:gp-opacity-30 disabled:gp-pointer-events-none",core.getGlobalColorStateClass("bg",h),{"gp-animate-bounce":l?.animation?.normal==="bounce","hover:gp-animate-bounce":l?.animation?.hover==="bounce","gp-scale-[1.1]":l?.animation?.normal==="grow","hover:gp-scale-[1.1]":l?.animation?.hover==="grow","gp-flex-row-reverse":"right"===C},core.getGlobalColorStateClass("text",u),H,e,e?.includes("gp-button-atc")&&
|
|
27
|
+
class="${core.cls(t?.uid,"gp-button-base gp-rounded-none gp-max-w-full gp-relative gp-group gp-inline-flex gp-items-center gp-justify-center gp-no-underline gp-transition-colors gp-duration-300 disabled:gp-btn-disabled disabled:gp-opacity-30 disabled:gp-pointer-events-none",core.getGlobalColorStateClass("bg",h),{"gp-animate-bounce":l?.animation?.normal==="bounce","hover:gp-animate-bounce":l?.animation?.hover==="bounce","gp-scale-[1.1]":l?.animation?.normal==="grow","hover:gp-scale-[1.1]":l?.animation?.hover==="grow","gp-flex-row-reverse":"right"===C},core.getGlobalColorStateClass("text",u),H,e,e?.includes("gp-button-atc")&&p?p?.cssClass:"")}"
|
|
28
28
|
style="${{...core.getGlobalColorStateStyle("bg",h),...core.composeRadius(b),...core.getStyleShadowState(l?.boxShadowBtn,"box-shadow",l?.hasBoxShadowBtn),...core.getGlobalColorStateStyle("c",u),...l?.btnSpacing?.type?{}:core.composeSize(l?.btnSpacing?.custom),...F.width,...F.height,...F.padding,...core.makeStyle({tt:l.transform}),...L,...core.getGradientBgrStyleForButton(h)}}"
|
|
29
29
|
>
|
|
30
30
|
<svg
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),Text=require("../../text/components/Text.js"),productBundle=require("./constants/product-bundle.js");const ProductTag=({setting:e,styles:t,builderProps:r,bundleItem:s})=>{let{customContent:u}=e??{},{textAlign:o,backgroundColor:i,roundedTag:n,borderTag:c,textColor:a}=t??{},l=core.useEditorMode(),d=core.useProduct(),p=core.useCurrentVariant(),{quantity:x}=core.useQuantity(),g=React.useMemo(()=>s?.quantity?s.quantity:x??1,[x,s?.quantity]),m=p?.price??0,y=p?.salePrice??0,f=y-m,j=core.useFormatMoney(f<0?0:f,e?.moneyWithCurrentFormat||!1),b=React.useMemo(()=>{if(!y||!m)return`${u?.unit==="percentage"?"0%":j}`;if(u?.unit==="percentage"){let e=Math.round(f/(y/100));return`${e<0?0:e}%`}return`${j}`},[u?.unit,j,m,f,y]),R=React.useMemo(()=>{let e=parseInt(s?.discountValue);return s?.discountType===productBundle.DiscountType.Percentage?m*g*e/100:s?.discountType===productBundle.DiscountType.FixedAmount?e:0},[s?.discountType,s?.discountValue,m,g]),T=React.useMemo(()=>{if(!s)return b;if(s?.discountType===productBundle.DiscountType.NoDiscount)return 0;if(u?.unit==="percentage"){let e=Math.round(R/(g*m)*100);return`${e<0?0:e}%`}return Math.round(100*R)/100},[s,u?.unit,R,b,g,m]),h=core.getGlobalColorClass("border",c?.color),M=core.getGlobalColorClass("text",a),C=core.getGlobalColorClass("bg",i);function S(e){return"none"===e?"gp-g-s-none":`gp-g-s-tag-${e}`}let q=d?.baseID?.replace("gid://shopify/Product/","");return jsxRuntime.jsx("div",{className:core.cls({"gp-opacity-0 ":"edit"!==l&&(y<=0||0>=Math.ceil(f/(y/100))),"gp-opacity-20 ":"edit"===l&&(y<=0||0>=Math.ceil(f/(y/100)))}),style:{...core.makeStyleResponsive("ta",o)},id:`shopify-text-element-${r?.uid}`,"data-product-id":q,children:d?jsxRuntime.jsx("div",{className:core.cls("gp-inline-flex gp-flex-wrap gp-items-end gp-gap-3"),style:{},children:jsxRuntime.jsx("div",{className:core.cls("gp-inline-block",h,M,C,t?.tagSpacing?.type?S(t?.tagSpacing?.type):""),style:{...core.makeStyle({bs:c?.border,bw:c?.width,bc:""===h?c?.color:void 0,c:""===M?a:void 0,bg:""===C?i:void 0}),...n?.radiusType!=="custom"?core.getRadiusCSSFromGlobal("normal",n?.radiusType):{},...core.getCustomRadius("normal",n),...t?.tagSpacing?.type?{}:core.composeSize(t?.tagSpacing?.custom)},children:jsxRuntime.jsxs("div",{className:"gp-flex gp-break-all",children:[jsxRuntime.jsx(Text.default,{styles:t,setting:{...e,text:u?.prefix?.replaceAll(" "," "),options:{useState:!0,uniqueId:`${r?.uid}-prefix`},excludeFlex:!0}}),jsxRuntime.jsx(Text.default,{styles:t,setting:{...e,text:T,options:{isCannotEditing:!0},excludeFlex:!0}}),jsxRuntime.jsx(Text.default,{styles:t,setting:{...e,text:u?.suffix?.replaceAll(" "," "),excludeFlex:!0,options:{useState:!0,uniqueId:`${r?.uid}-suffix`}}})]})})}):null})};exports.default=ProductTag;
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),React=require("react"),Text=require("../../text/components/Text.js"),productBundle=require("./constants/product-bundle.js");const ProductTag=({setting:e,styles:t,builderProps:r,bundleItem:s})=>{let{customContent:u}=e??{},{textAlign:o,backgroundColor:i,roundedTag:n,borderTag:c,textColor:a}=t??{},l=core.useEditorMode(),d=core.useProduct(),p=core.useCurrentVariant(),{quantity:x}=core.useQuantity(),g=React.useMemo(()=>s?.quantity?s.quantity:x??1,[x,s?.quantity]),m=p?.price??0,y=p?.salePrice??0,f=y-m,j=core.useFormatMoney(f<0?0:f,e?.moneyWithCurrentFormat||!1),b=React.useMemo(()=>{if(!y&&0!==y||!m&&0!==m)return`${u?.unit==="percentage"?"0%":j}`;if(u?.unit==="percentage"){let e=Math.round(f/(y/100));return`${e<0?0:e}%`}return`${j}`},[u?.unit,j,m,f,y]),R=React.useMemo(()=>{let e=parseInt(s?.discountValue);return s?.discountType===productBundle.DiscountType.Percentage?m*g*e/100:s?.discountType===productBundle.DiscountType.FixedAmount?e:0},[s?.discountType,s?.discountValue,m,g]),T=React.useMemo(()=>{if(!s)return b;if(s?.discountType===productBundle.DiscountType.NoDiscount)return 0;if(u?.unit==="percentage"){let e=Math.round(R/(g*m)*100);return`${e<0?0:e}%`}return Math.round(100*R)/100},[s,u?.unit,R,b,g,m]),h=core.getGlobalColorClass("border",c?.color),M=core.getGlobalColorClass("text",a),C=core.getGlobalColorClass("bg",i);function S(e){return"none"===e?"gp-g-s-none":`gp-g-s-tag-${e}`}let q=d?.baseID?.replace("gid://shopify/Product/","");return jsxRuntime.jsx("div",{className:core.cls({"gp-opacity-0 ":"edit"!==l&&(y<=0||0>=Math.ceil(f/(y/100))),"gp-opacity-20 ":"edit"===l&&(y<=0||0>=Math.ceil(f/(y/100)))}),style:{...core.makeStyleResponsive("ta",o)},id:`shopify-text-element-${r?.uid}`,"data-product-id":q,children:d?jsxRuntime.jsx("div",{className:core.cls("gp-inline-flex gp-flex-wrap gp-items-end gp-gap-3"),style:{},children:jsxRuntime.jsx("div",{className:core.cls("gp-inline-block",h,M,C,t?.tagSpacing?.type?S(t?.tagSpacing?.type):""),style:{...core.makeStyle({bs:c?.border,bw:c?.width,bc:""===h?c?.color:void 0,c:""===M?a:void 0,bg:""===C?i:void 0}),...n?.radiusType!=="custom"?core.getRadiusCSSFromGlobal("normal",n?.radiusType):{},...core.getCustomRadius("normal",n),...t?.tagSpacing?.type?{}:core.composeSize(t?.tagSpacing?.custom)},children:jsxRuntime.jsxs("div",{className:"gp-flex gp-break-all",children:[jsxRuntime.jsx(Text.default,{styles:t,setting:{...e,text:u?.prefix?.replaceAll(" "," "),options:{useState:!0,uniqueId:`${r?.uid}-prefix`},excludeFlex:!0}}),jsxRuntime.jsx(Text.default,{styles:t,setting:{...e,text:T,options:{isCannotEditing:!0},excludeFlex:!0}}),jsxRuntime.jsx(Text.default,{styles:t,setting:{...e,text:u?.suffix?.replaceAll(" "," "),excludeFlex:!0,options:{useState:!0,uniqueId:`${r?.uid}-suffix`}}})]})})}):null})};exports.default=ProductTag;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),_function=require("../../../helpers/function.js");const BaseVariant=({optionTransform:e,optionTypography:o,optionBgColor:t,optionTextColor:l,optionBorder:
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),_function=require("../../../helpers/function.js");const BaseVariant=({optionTransform:e,optionTypography:o,optionBgColor:t,optionTextColor:l,optionBorder:a,optionRounded:r,optionHasShadow:i,optionShadow:p,optionTypo:c,type:d})=>{let n="color"===d,s="image"===d||"image_shopify"===d,g=e=>core.makeStyle({bg:e&&core.getSingleColorVariable(t?.active),bs:a?.active?.border,bw:a?.active?.width,bc:core.getSingleColorVariable(a?.active?.color)}),f=core.composeTypographyStyle(c,o),u=`${core.composeTypographyClassName(c,o)}`,v=()=>`
|
|
2
2
|
{%- if selectedValue == value -%}
|
|
3
3
|
${core.cls("gp-relative gp-cursor-pointer gp-items-center gp-justify-center gp-text-center option-value-wrapper gp-overflow-hidden !gp-w-full gp-h-full","data-[disabled='disabled']:gp-pointer-events-none data-[disabled='disabled']:!gp-cursor-not-allowed data-[hidden='true']:gp-hidden data-[hidden='false']:gp-flex",x())}
|
|
4
4
|
{%- else -%}
|
|
5
5
|
${core.cls("gp-relative gp-cursor-pointer gp-items-center gp-justify-center gp-text-center option-value-wrapper gp-overflow-hidden !gp-w-full gp-h-full","data-[disabled='disabled']:gp-pointer-events-none data-[disabled='disabled']:!gp-cursor-not-allowed data-[hidden='true']:gp-hidden data-[hidden='false']:gp-flex",x())}
|
|
6
6
|
{%- endif -%}
|
|
7
|
-
`,b=()=>_function.getStyleOfObject({...g(!0),...!n&&!s&&core.makeStyle({c:e}),...!n&&!s&&core.makeStyle({c:core.getSingleColorVariable(l?.active)}),...core.getStyleShadow({value:p?.active,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:i?.active},!0),...core.getRadiusStyleActiveState(
|
|
7
|
+
`,b=()=>_function.getStyleOfObject({...g(!0),...!n&&!s&&core.makeStyle({c:e}),...!n&&!s&&core.makeStyle({c:core.getSingleColorVariable(l?.active)}),...core.getStyleShadow({value:p?.active,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:i?.active},!0),...core.getRadiusStyleActiveState(r),...f}),h=()=>_function.getStyleOfObject({...!n&&!s&&core.getGlobalColorStateStyle("bg",t),...!n&&!s&&core.makeStyle({c:e}),...!n&&!s&&core.getGlobalColorStateStyle("c",l),...core.composeRadius(r),...core.getStyleShadowState(p,"box-shadow",i),...!n&&core.handleConvertBorderStyle(a),...!n&&core.handleConvertBorderWidth(a),...!n&&core.handleConvertBorderColor(a),...f}),m=()=>core.template`
|
|
8
8
|
{%- for color in colors -%}
|
|
9
9
|
{% assign backgroundType = "background-color" %}
|
|
10
10
|
{% if color contains "linear-gradient" %}
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
<span class="${core.cls("gp-text-center",{"gp-overflow-hidden gp-text-ellipsis gp-px-1":n||s},u)}">{{value}}</span>
|
|
22
22
|
</div>
|
|
23
23
|
`,w=()=>core.template`
|
|
24
|
-
<img class="gp-h-full gp-object-cover gp-w-full gp-rounded-none" src="{{imageUrl}}" alt="" />
|
|
24
|
+
<img class="gp-shopify-image gp-h-full gp-object-cover gp-w-full gp-rounded-none" src="{{imageUrl}}" alt="" />
|
|
25
25
|
`,C=()=>{switch(d){case"color":return core.template`{%- if colors != null and colors.size > 0 -%} ${m()} {% else %} ${y()} {%- endif -%}`;case"image":case"image_shopify":return core.template`{%- if imageUrl != null and imageUrl != "" -%} ${w()} {% else %} ${y()} {%- endif -%}`;default:return core.template`${y()}`}},S=()=>`
|
|
26
26
|
{%- if selectedValue == value -%}
|
|
27
27
|
${b()}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{splitStyle as t,makeStyle as e,makeGlobalSize as o,composeTypographyClassName as a,composeTypographyStyle as i,composeBorderCss as p,composeCornerCss as
|
|
1
|
+
import{splitStyle as t,makeStyle as e,makeGlobalSize as o,composeTypographyClassName as a,composeTypographyStyle as i,composeBorderCss as p,composeCornerCss as s,template as l,makeStyleResponsive as n,cls as r,getGlobalColorStateClass as g,getGlobalColorStateStyle as d,composeRadius as h,getStyleShadowState as c,composeSize as b,getGradientBgrStyleForButton as u,RenderIf as m}from"@gem-sdk/core";import{getDynamicSourceLocales as v}from"../../helpers.js";let Button=({className:$,builderProps:f,builderAttrs:y,pageContext:w,setting:x={},styles:k={},style:B,wrapClassName:z="",advanced:C})=>{let S=["#","mailto:","tel:"],j=["product.url"],{align:_,size:A,backgroundColor:E,textColor:R,roundedBtn:q,spacing:H,globalSize:I}=k,{label:M,iconSvg:V,btnLink:W,htmlType:D,disabled:F,loading:G,iconAlign:J,iconVisible:K,translate:L}=x,N=W?.link!==void 0&&""!==W.link,[O,P]=t(["pos","top","left","bottom","right","z"],B),Q=W?.link||"",T=new RegExp(/^https?:\/\//i),U=new RegExp(/^\/?(?:collections|pages|products|blogs)\/?/i),X=N&&!T.test(Q)&&U.test(Q),Y=N&&T.test(Q);X&&(Q="{{ request.origin }}{{ routes.root_url | split: '/' | join: '/' }}"+Q);let Z=()=>!!(S.find(t=>Q.startsWith(t))||j.find(t=>Q.includes(t))),tt=Y||X||Z()||"/"===Q?"a":"button",te=Y||X||Z()||"/"===Q?{href:Q,target:W?.target}:N?{href:Q,target:W?.target,type:D}:{type:D},to="left"===J?e({mr:H}):e({ml:H});F&&(delete E?.hover,delete E?.focus);let ta=o(I),ti=a(k?.typo,k?.typography),tp=i(k?.typo,k?.typography),ts=`
|
|
2
2
|
.${f?.uid}.gp-button-base::before {
|
|
3
3
|
content: "";
|
|
4
4
|
height: 100%;
|
|
@@ -6,26 +6,26 @@ import{splitStyle as t,makeStyle as e,makeGlobalSize as o,composeTypographyClass
|
|
|
6
6
|
position: absolute;
|
|
7
7
|
pointer-events: none;
|
|
8
8
|
${p(k?.borderBtn?.normal)}
|
|
9
|
-
${
|
|
9
|
+
${s(k?.roundedBtn?.normal)}
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.${f?.uid}:hover::before {
|
|
13
13
|
${p(k?.borderBtn?.hover)}
|
|
14
|
-
${
|
|
14
|
+
${s(k?.roundedBtn?.hover)}
|
|
15
15
|
}
|
|
16
|
-
`,
|
|
16
|
+
`,tl=v({val:M,uid:f?.uid,settingId:L??"label",pageContext:w,isCapitalize:k?.typo?.attrs?.transform==="capitalize"});return l`
|
|
17
17
|
<gp-button style="${{...O}}">
|
|
18
18
|
<div
|
|
19
19
|
${{...y}}
|
|
20
20
|
style="${{...P,...n("ta",_)}}"
|
|
21
21
|
class="${r(z,$?.includes("gp-button-atc")?"":C?.cssClass)}"
|
|
22
22
|
>
|
|
23
|
-
<style>${
|
|
23
|
+
<style>${ts}</style>
|
|
24
24
|
<${tt}
|
|
25
25
|
${{...te,"data-id":f?.uid,"aria-label":x?.label?.toString().replaceAll("'","'"),...F&&"boolean"==typeof F||F?{disabled:"disabled"}:{}}}
|
|
26
26
|
data-state="${G?"loading":"idle"}"
|
|
27
27
|
class="${r(f?.uid,"gp-button-base gp-rounded-none gp-max-w-full gp-relative gp-group gp-inline-flex gp-items-center gp-justify-center gp-no-underline gp-transition-colors gp-duration-300 disabled:gp-btn-disabled disabled:gp-opacity-30 disabled:gp-pointer-events-none",g("bg",E),{"gp-animate-bounce":k?.animation?.normal==="bounce","hover:gp-animate-bounce":k?.animation?.hover==="bounce","gp-scale-[1.1]":k?.animation?.normal==="grow","hover:gp-scale-[1.1]":k?.animation?.hover==="grow","gp-flex-row-reverse":"right"===J},g("text",R),ti,$,$?.includes("gp-button-atc")&&C?C?.cssClass:"")}"
|
|
28
|
-
style="${{...d("bg",E),...h(
|
|
28
|
+
style="${{...d("bg",E),...h(q),...c(k?.boxShadowBtn,"box-shadow",k?.hasBoxShadowBtn),...d("c",R),...k?.btnSpacing?.type?{}:b(k?.btnSpacing?.custom),...ta.width,...ta.height,...ta.padding,...e({tt:k.transform}),...tp,...u(E)}}"
|
|
29
29
|
>
|
|
30
30
|
<svg
|
|
31
31
|
class="gp-invisible gp-absolute gp-h-5 gp-w-5 group-data-[state=loading]:gp-animate-spin group-data-[state=loading]:gp-visible"
|
|
@@ -48,15 +48,15 @@ import{splitStyle as t,makeStyle as e,makeGlobalSize as o,composeTypographyClass
|
|
|
48
48
|
></path>
|
|
49
49
|
</svg>
|
|
50
50
|
|
|
51
|
-
${m(!!
|
|
51
|
+
${m(!!V&&K,l`<span
|
|
52
52
|
class="${"gp-inline-flex gp-shrink-0 gp-items-center gp-justify-center group-data-[state=loading]:gp-invisible gp-z-1 [&>*]:!gp-h-[var(--height-desktop)] [&>*]:!gp-w-auto tablet:[&>*]:!gp-h-[var(--height-tablet)] mobile:[&>*]:!gp-h-[var(--height-mobile)]"}"
|
|
53
|
-
style="${{...
|
|
54
|
-
>${
|
|
53
|
+
style="${{...M?to:{},"--height-desktop":`${A?.desktop}`,"--height-tablet":`${A?.desktop??A?.tablet}`,"--height-mobile":`${A?.mobile??A?.tablet??A?.desktop}`}}"
|
|
54
|
+
>${V}</span>`)}
|
|
55
55
|
<span
|
|
56
56
|
class="${`gp-break-words group-data-[state=loading]:gp-invisible [&_p]:gp-whitespace-pre-line gp-z-1 gp-h-full gp-flex gp-items-center gp-overflow-hidden ${k?.typo?.attrs?.italic?"[&:not(:has(p))]:gp-pr-[0.2em] [&_p]:[&:has(p)]:gp-pr-[0.2em]":""}`}"
|
|
57
57
|
style="${{...e({tt:k?.transform})}}"
|
|
58
58
|
>
|
|
59
|
-
${
|
|
59
|
+
${tl}
|
|
60
60
|
</span>
|
|
61
61
|
</${tt}>
|
|
62
62
|
</div>
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useEditorMode as i,useProduct as n,useCurrentVariant as r,useQuantity as o,useFormatMoney as a,getGlobalColorClass as u,cls as s,makeStyleResponsive as l,makeStyle as p,getRadiusCSSFromGlobal as c,getCustomRadius as d,composeSize as g}from"@gem-sdk/core";import{useMemo as m}from"react";import f from"../../text/components/Text.js";import{DiscountType as x}from"./constants/product-bundle.js";let ProductTag=({setting:y,styles:b,builderProps:h,bundleItem:T})=>{let{customContent:$}=y??{},{textAlign:v,backgroundColor:S,roundedTag:q,borderTag:F,textColor:M}=b??{},N=i(),P=n(),I=r(),{quantity:j}=o(),k=m(()=>T?.quantity?T.quantity:j??1,[j,T?.quantity]),w=I?.price??0,A=I?.salePrice??0,C=A-w,D=a(C<0?0:C,y?.moneyWithCurrentFormat||!1),V=m(()=>{if(!A||!w)return`${$?.unit==="percentage"?"0%":D}`;if($?.unit==="percentage"){let e=Math.round(C/(A/100));return`${e<0?0:e}%`}return`${D}`},[$?.unit,D,w,C,A]),E=m(()=>{let e=parseInt(T?.discountValue);return T?.discountType===x.Percentage?w*k*e/100:T?.discountType===x.FixedAmount?e:0},[T?.discountType,T?.discountValue,w,k]),W=m(()=>{if(!T)return V;if(T?.discountType===x.NoDiscount)return 0;if($?.unit==="percentage"){let e=Math.round(E/(k*w)*100);return`${e<0?0:e}%`}return Math.round(100*E)/100},[T,$?.unit,E,V,k,w]),z=u("border",F?.color),B=u("text",M),G=u("bg",S);function H(e){return"none"===e?"gp-g-s-none":`gp-g-s-tag-${e}`}let J=P?.baseID?.replace("gid://shopify/Product/","");return e("div",{className:s({"gp-opacity-0 ":"edit"!==N&&(A<=0||0>=Math.ceil(C/(A/100))),"gp-opacity-20 ":"edit"===N&&(A<=0||0>=Math.ceil(C/(A/100)))}),style:{...l("ta",v)},id:`shopify-text-element-${h?.uid}`,"data-product-id":J,children:P?e("div",{className:s("gp-inline-flex gp-flex-wrap gp-items-end gp-gap-3"),style:{},children:e("div",{className:s("gp-inline-block",z,B,G,b?.tagSpacing?.type?H(b?.tagSpacing?.type):""),style:{...p({bs:F?.border,bw:F?.width,bc:""===z?F?.color:void 0,c:""===B?M:void 0,bg:""===G?S:void 0}),...q?.radiusType!=="custom"?c("normal",q?.radiusType):{},...d("normal",q),...b?.tagSpacing?.type?{}:g(b?.tagSpacing?.custom)},children:t("div",{className:"gp-flex gp-break-all",children:[e(f,{styles:b,setting:{...y,text:$?.prefix?.replaceAll(" "," "),options:{useState:!0,uniqueId:`${h?.uid}-prefix`},excludeFlex:!0}}),e(f,{styles:b,setting:{...y,text:W,options:{isCannotEditing:!0},excludeFlex:!0}}),e(f,{styles:b,setting:{...y,text:$?.suffix?.replaceAll(" "," "),excludeFlex:!0,options:{useState:!0,uniqueId:`${h?.uid}-suffix`}}})]})})}):null})};export{ProductTag as default};
|
|
1
|
+
import{jsx as e,jsxs as t}from"react/jsx-runtime";import{useEditorMode as i,useProduct as n,useCurrentVariant as r,useQuantity as o,useFormatMoney as a,getGlobalColorClass as u,cls as s,makeStyleResponsive as l,makeStyle as p,getRadiusCSSFromGlobal as c,getCustomRadius as d,composeSize as g}from"@gem-sdk/core";import{useMemo as m}from"react";import f from"../../text/components/Text.js";import{DiscountType as x}from"./constants/product-bundle.js";let ProductTag=({setting:y,styles:b,builderProps:h,bundleItem:T})=>{let{customContent:$}=y??{},{textAlign:v,backgroundColor:S,roundedTag:q,borderTag:F,textColor:M}=b??{},N=i(),P=n(),I=r(),{quantity:j}=o(),k=m(()=>T?.quantity?T.quantity:j??1,[j,T?.quantity]),w=I?.price??0,A=I?.salePrice??0,C=A-w,D=a(C<0?0:C,y?.moneyWithCurrentFormat||!1),V=m(()=>{if(!A&&0!==A||!w&&0!==w)return`${$?.unit==="percentage"?"0%":D}`;if($?.unit==="percentage"){let e=Math.round(C/(A/100));return`${e<0?0:e}%`}return`${D}`},[$?.unit,D,w,C,A]),E=m(()=>{let e=parseInt(T?.discountValue);return T?.discountType===x.Percentage?w*k*e/100:T?.discountType===x.FixedAmount?e:0},[T?.discountType,T?.discountValue,w,k]),W=m(()=>{if(!T)return V;if(T?.discountType===x.NoDiscount)return 0;if($?.unit==="percentage"){let e=Math.round(E/(k*w)*100);return`${e<0?0:e}%`}return Math.round(100*E)/100},[T,$?.unit,E,V,k,w]),z=u("border",F?.color),B=u("text",M),G=u("bg",S);function H(e){return"none"===e?"gp-g-s-none":`gp-g-s-tag-${e}`}let J=P?.baseID?.replace("gid://shopify/Product/","");return e("div",{className:s({"gp-opacity-0 ":"edit"!==N&&(A<=0||0>=Math.ceil(C/(A/100))),"gp-opacity-20 ":"edit"===N&&(A<=0||0>=Math.ceil(C/(A/100)))}),style:{...l("ta",v)},id:`shopify-text-element-${h?.uid}`,"data-product-id":J,children:P?e("div",{className:s("gp-inline-flex gp-flex-wrap gp-items-end gp-gap-3"),style:{},children:e("div",{className:s("gp-inline-block",z,B,G,b?.tagSpacing?.type?H(b?.tagSpacing?.type):""),style:{...p({bs:F?.border,bw:F?.width,bc:""===z?F?.color:void 0,c:""===B?M:void 0,bg:""===G?S:void 0}),...q?.radiusType!=="custom"?c("normal",q?.radiusType):{},...d("normal",q),...b?.tagSpacing?.type?{}:g(b?.tagSpacing?.custom)},children:t("div",{className:"gp-flex gp-break-all",children:[e(f,{styles:b,setting:{...y,text:$?.prefix?.replaceAll(" "," "),options:{useState:!0,uniqueId:`${h?.uid}-prefix`},excludeFlex:!0}}),e(f,{styles:b,setting:{...y,text:W,options:{isCannotEditing:!0},excludeFlex:!0}}),e(f,{styles:b,setting:{...y,text:$?.suffix?.replaceAll(" "," "),excludeFlex:!0,options:{useState:!0,uniqueId:`${h?.uid}-suffix`}}})]})})}):null})};export{ProductTag as default};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import{composeTypographyStyle as e,composeTypographyClassName as a,template as
|
|
1
|
+
import{composeTypographyStyle as e,composeTypographyClassName as a,template as i,cls as l,makeStyle as t,getSingleColorVariable as o,getStyleShadow as p,getRadiusStyleActiveState as r,getGlobalColorStateStyle as d,composeRadius as n,getStyleShadowState as s,handleConvertBorderStyle as g,handleConvertBorderWidth as c,handleConvertBorderColor as f}from"@gem-sdk/core";import{getStyleOfObject as u}from"../../../helpers/function.js";let BaseVariant=({optionTransform:v,optionTypography:b,optionBgColor:h,optionTextColor:w,optionBorder:m,optionRounded:$,optionHasShadow:x,optionShadow:C,optionTypo:y,type:k})=>{let D="color"===k,j="image"===k||"image_shopify"===k,L=e=>t({bg:e&&o(h?.active),bs:m?.active?.border,bw:m?.active?.width,bc:o(m?.active?.color)}),T=e(y,b),V=`${a(y,b)}`,_=()=>`
|
|
2
2
|
{%- if selectedValue == value -%}
|
|
3
|
-
${
|
|
3
|
+
${l("gp-relative gp-cursor-pointer gp-items-center gp-justify-center gp-text-center option-value-wrapper gp-overflow-hidden !gp-w-full gp-h-full","data-[disabled='disabled']:gp-pointer-events-none data-[disabled='disabled']:!gp-cursor-not-allowed data-[hidden='true']:gp-hidden data-[hidden='false']:gp-flex",S())}
|
|
4
4
|
{%- else -%}
|
|
5
|
-
${
|
|
5
|
+
${l("gp-relative gp-cursor-pointer gp-items-center gp-justify-center gp-text-center option-value-wrapper gp-overflow-hidden !gp-w-full gp-h-full","data-[disabled='disabled']:gp-pointer-events-none data-[disabled='disabled']:!gp-cursor-not-allowed data-[hidden='true']:gp-hidden data-[hidden='false']:gp-flex",S())}
|
|
6
6
|
{%- endif -%}
|
|
7
|
-
`,B=()=>u({...L(!0),...!D&&!j&&t({c:v}),...!D&&!j&&t({c:o(w?.active)}),...p({value:C?.active,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:x?.active},!0),...r($),...T}),U=()=>u({...!D&&!j&&d("bg",h),...!D&&!j&&t({c:v}),...!D&&!j&&d("c",w),...n($),...s(C,"box-shadow",x),...!D&&g(m),...!D&&c(m),...!D&&f(m),...T}),z=()=>
|
|
7
|
+
`,B=()=>u({...L(!0),...!D&&!j&&t({c:v}),...!D&&!j&&t({c:o(w?.active)}),...p({value:C?.active,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:x?.active},!0),...r($),...T}),U=()=>u({...!D&&!j&&d("bg",h),...!D&&!j&&t({c:v}),...!D&&!j&&d("c",w),...n($),...s(C,"box-shadow",x),...!D&&g(m),...!D&&c(m),...!D&&f(m),...T}),z=()=>i`
|
|
8
8
|
{%- for color in colors -%}
|
|
9
9
|
{% assign backgroundType = "background-color" %}
|
|
10
10
|
{% if color contains "linear-gradient" %}
|
|
@@ -15,21 +15,21 @@ import{composeTypographyStyle as e,composeTypographyClassName as a,template as l
|
|
|
15
15
|
data-test="{{ backgroundType }}: {{ color }}"
|
|
16
16
|
style="{{ backgroundType }}: {{ color }}"></div>
|
|
17
17
|
{%- endfor -%}
|
|
18
|
-
`,A=()=>
|
|
18
|
+
`,A=()=>i`
|
|
19
19
|
<div class="option-value gp-overflow-hidden gp-relative gp-h-full gp-w-full gp-flex gp-items-center gp-justify-center ${j?"gp-flex-col gp-gap-[6px]":""}">
|
|
20
20
|
${j?'<svg width="15" height="12" viewBox="0 0 15 12" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="2" cy="2" r="2" fill="#D6D6D6"></circle><path d="M0.196854 10.6453L2.40968 8.05946C2.4846 7.97175 2.57719 7.9008 2.68141 7.85124C2.78562 7.80168 2.89913 7.77461 3.01452 7.77181C3.12991 7.76902 3.2446 7.79055 3.3511 7.835C3.45761 7.87945 3.55353 7.94583 3.63262 8.02981L4.66733 9.12714L8.71205 4.29464C8.79123 4.19995 8.89077 4.1243 9.00325 4.07333C9.11573 4.02236 9.23827 3.99737 9.36176 4.00022C9.48524 4.00307 9.6065 4.03369 9.71651 4.08979C9.82651 4.1459 9.92245 4.22605 9.99717 4.32429L14.8329 10.6772C14.9254 10.7989 14.982 10.9441 14.9964 11.0962C15.0107 11.2484 14.9823 11.4016 14.9144 11.5385C14.8464 11.6754 14.7415 11.7907 14.6115 11.8713C14.4815 11.952 14.3316 11.9948 14.1786 11.995L0.822048 12C0.664945 11.9999 0.511148 11.9549 0.378853 11.8703C0.246557 11.7857 0.141299 11.6649 0.0755311 11.5224C0.00976323 11.3799 -0.013762 11.2216 0.00773837 11.0661C0.0292388 10.9107 0.0948652 10.7646 0.196854 10.6453Z" fill="#D6D6D6"></path></svg>':""}
|
|
21
|
-
<span class="${
|
|
21
|
+
<span class="${l("gp-text-center",{"gp-overflow-hidden gp-text-ellipsis gp-px-1":D||j},V)}">{{value}}</span>
|
|
22
22
|
</div>
|
|
23
|
-
`,E=()=>
|
|
24
|
-
<img class="gp-h-full gp-object-cover gp-w-full gp-rounded-none" src="{{imageUrl}}" alt="" />
|
|
25
|
-
`,F=()=>{switch(k){case"color":return
|
|
23
|
+
`,E=()=>i`
|
|
24
|
+
<img class="gp-shopify-image gp-h-full gp-object-cover gp-w-full gp-rounded-none" src="{{imageUrl}}" alt="" />
|
|
25
|
+
`,F=()=>{switch(k){case"color":return i`{%- if colors != null and colors.size > 0 -%} ${z()} {% else %} ${A()} {%- endif -%}`;case"image":case"image_shopify":return i`{%- if imageUrl != null and imageUrl != "" -%} ${E()} {% else %} ${A()} {%- endif -%}`;default:return i`${A()}`}},M=()=>`
|
|
26
26
|
{%- if selectedValue == value -%}
|
|
27
27
|
${B()}
|
|
28
28
|
{%- else -%}
|
|
29
29
|
${U()}
|
|
30
30
|
{%- endif -%}
|
|
31
|
-
`,S=()=>D?`${V} gp-p-[4px]`:`${V}`;return
|
|
32
|
-
class="${
|
|
31
|
+
`,S=()=>D?`${V} gp-p-[4px]`:`${V}`;return i`<div
|
|
32
|
+
class="${l(_())}"
|
|
33
33
|
style="${M()}"
|
|
34
34
|
id="value-wrapper-{{option.name | escape | strip}}-{{value | escape | strip}}"
|
|
35
35
|
option-data="{{option.name | escape}}"
|