@gem-sdk/components 2.0.0-staging.837 → 2.0.0-staging.838
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/product/components/product-variants/common/base/styles.js +1 -1
- package/dist/cjs/product/components/product-variants/components/base/base.liquid.js +14 -14
- package/dist/esm/product/components/product-variants/common/base/styles.js +1 -1
- package/dist/esm/product/components/product-variants/components/base/base.liquid.js +14 -14
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../../../../helpers.js");const getWrapperStyleActive=e=>{let{preset:t,optionTransform:o,optionTypography:r,optionTypo:l,typeOfOption:a}=e,p=t?.optionBgColor,i=t?.optionTextColor,c=t?.optionBorder,d=t?.optionHasShadow,h=t?.optionShadow,
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../../../../helpers.js");const getWrapperStyleActive=e=>{let{preset:t,optionTransform:o,optionTypography:r,optionTypo:l,typeOfOption:a}=e,p=t?.optionBgColor,i=t?.optionTextColor,c=t?.optionBorder,d=t?.optionHasShadow,h=t?.optionShadow,n=t?.optionRounded,g="color"===a,S="image"===a||"image_shopify"===a,s=core.composeTypographyStyle(l,r),y=e=>core.makeStyle({bg:e&&core.getSingleColorVariable(p?.active),bs:c?.active?.border,bw:c?.active?.width,bc:core.getSingleColorVariable(c?.active?.color)});return helpers.filterTruthyObject({...y(!g),...core.getRadiusStyleActiveState(n),...core.getStyleShadow({value:h?.active,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:d?.active},!0),...!g&&!S&&core.makeStyle({c:o}),...!g&&!S&&core.makeStyle({c:core.getSingleColorVariable(i?.active)}),...s,...core.makeStyle({h:t?.height})})},getWrapperStyleNormalAndHover=e=>{let{preset:t,optionTransform:o,optionTypography:r,optionTypo:l,typeOfOption:a}=e,p=t?.optionBgColor,i=t?.optionTextColor,c=t?.optionBorder,d=t?.optionHasShadow,h=t?.optionShadow,n=t?.optionRounded,g="color"===a,S="image"===a||"image_shopify"===a,s=core.composeTypographyStyle(l,r),y=["normal","hover"].reduce((e,t)=>({...e,...core.getStyleShadow({value:h?.[t],state:t,styleAppliedFor:"box-shadow",isEnableShadow:d?.[t]})}),{});return helpers.filterTruthyObject({...core.composeRadius(n),...y,...!g&&core.getGlobalColorStateStyle("bg",p),...!g&&core.handleConvertBorderStyle(c),...!g&&core.handleConvertBorderWidth(c),...!g&&core.handleConvertBorderColor(c),...!g&&!S&&core.makeStyle({c:o}),...!g&&!S&&core.getGlobalColorStateStyle("c",i),...s,...core.makeStyle({h:t?.height})})},getWrapperTextStyle=e=>{let{preset:t,typeOfOption:o}=e,r="color"===o,l=()=>{let e="16px",o={"--pl":"0px","--pr":"0px","--pl-tablet":"0px","--pr-tablet":"0px","--pl-mobile":"0px","--pr-mobile":"0px","--pt":"0px","--pb":"0px"};return t?.width?.desktop?.toLowerCase()!=="auto"&&t?.width?.desktop||(o["--pl"]=e,o["--pr"]=e),t?.width?.tablet?.toLowerCase()!=="auto"&&t?.width?.tablet||(o["--pl-tablet"]=e,o["--pr-tablet"]=e),t?.width?.mobile?.toLowerCase()!=="auto"&&t?.width?.mobile||(o["--pl-mobile"]=e,o["--pr-mobile"]=e),(t?.height?.toLowerCase()==="auto"||t?.height)&&(o["--pt"]="8px",o["--pb"]="8px"),o};return helpers.filterTruthyObject({...r?{}:l()})},getColorStyle=({optionBorder:e,optionRounded:t,isActive:o,color:r})=>{let l=()=>r?r?.startsWith("linear-gradient")?{backgroundImage:r}:{backgroundColor:r}:{},a=o=>({"--d":"flex","--jc":"center"," --ai":"center","--w":"100%","--h":"100%","--of":"hidden","--bs":o?"none":"solid",...core.handleConvertBorderWidth(e),...core.handleConvertBorderColor(e),...core.composeRadius(t),...l()});return a(!!o)},getTextStyle=({optionTypo:e,optionTypography:t,optionTextColor:o,selected:r})=>{let l=core.composeTypographyStyle(e,t);return helpers.filterTruthyObject({...l,...o&&r?core.getGlobalColorStyle(o?.active):core.getGlobalColorStateStyle("c",o)})};exports.getColorStyle=getColorStyle,exports.getTextStyle=getTextStyle,exports.getWrapperStyleActive=getWrapperStyleActive,exports.getWrapperStyleNormalAndHover=getWrapperStyleNormalAndHover,exports.getWrapperTextStyle=getWrapperTextStyle;
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),_function=require("../../../../helpers/function.js"),classes=require("../../common/base/classes.js"),system=require("@gem-sdk/system"),attrs=require("../../common/base/attrs.js"),styles=require("../../common/base/styles.js");const BaseVariant=e=>{let{optionTypography:s,optionBorder:t,optionRounded:l,optionTypo:r,typeOfOption:a
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),_function=require("../../../../helpers/function.js"),classes=require("../../common/base/classes.js"),system=require("@gem-sdk/system"),attrs=require("../../common/base/attrs.js"),styles=require("../../common/base/styles.js");const BaseVariant=e=>{let{optionTypography:s,optionBorder:t,optionRounded:l,optionTypo:r,typeOfOption:a}=e,c="color"===a,i="image"===a||"image_shopify"===a,o=system.createClass(classes.getColorClass({})),y=()=>core.template`
|
|
2
2
|
${system.LiquidFor("color in colors",`
|
|
3
3
|
${system.Liquid('{% assign backgroundType = "background-color" %}')}
|
|
4
4
|
${system.LiquidIf('color contains "linear-gradient"',system.Liquid('{% assign backgroundType = "background-image" %}'))}
|
|
5
5
|
<div
|
|
6
|
-
class="${
|
|
6
|
+
class="${o}"
|
|
7
7
|
data-test="{{ backgroundType }}: {{ color }}"
|
|
8
|
-
style="{{ backgroundType }}: {{ color }}; ${
|
|
8
|
+
style="{{ backgroundType }}: {{ color }}; ${u()}"></div>
|
|
9
9
|
`)}
|
|
10
|
-
`,
|
|
10
|
+
`,n=system.createStyle(styles.getColorStyle({optionBorder:t,optionRounded:l,isActive:!0})),m=system.createStyle(styles.getColorStyle({optionBorder:t,optionRounded:l,isActive:!1})),u=()=>system.LiquidIf("selectedValue == value",_function.getStyleOfObject(n),_function.getStyleOfObject(m)),g=system.createClass(classes.getWrapperTextClass(i)),d=system.createStyle({...styles.getWrapperTextStyle(e)}),p=system.createClass(classes.getTextClass({optionTypo:r,optionTypography:s,isColorType:c,isUploadImageType:i})),C=system.createStyle(styles.getTextStyle({optionTypo:r,optionTypography:s})),f=()=>core.template`
|
|
11
11
|
<div
|
|
12
|
-
class="${
|
|
13
|
-
style="${
|
|
14
|
-
${system.If(
|
|
15
|
-
<span class="${
|
|
12
|
+
class="${g}"
|
|
13
|
+
style="${c?u():""} ${_function.getStyleOfObject(d)}">
|
|
14
|
+
${system.If(i,'<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>'," ")}
|
|
15
|
+
<span class="${p}" style="${C}">{{value}}</span>
|
|
16
16
|
</div>
|
|
17
|
-
`,
|
|
17
|
+
`,v=()=>core.template`
|
|
18
18
|
<img class="gp-object-cover gp-rounded-none" style="width: 64px; height: 64px" src="{{imageUrl}}" alt="" />
|
|
19
|
-
`,
|
|
19
|
+
`,b=()=>{switch(a){case"color":return core.template`${system.LiquidIf("colors != null and colors.size > 0",y(),f())}`;case"image":case"image_shopify":return core.template`${system.LiquidIf('imageUrl != null and imageUrl != ""',v(),f())}`;default:return f()}},S=system.createClass(classes.getWrapperClass({...e,available:!0})),$=system.createAttr(attrs.getWrapperAttr(e,"Liquid")),q=system.createStyle(styles.getWrapperStyleActive(e)),L=system.createStyle(styles.getWrapperStyleNormalAndHover(e));return core.template`
|
|
20
20
|
<div
|
|
21
|
-
${
|
|
22
|
-
class="${
|
|
23
|
-
style="${system.LiquidIf("selectedValue == value",_function.getStyleOfObject({...
|
|
24
|
-
${
|
|
21
|
+
${$}
|
|
22
|
+
class="${S}"
|
|
23
|
+
style="${system.LiquidIf("selectedValue == value",_function.getStyleOfObject({...q,...n}),_function.getStyleOfObject({...L,...m}))}">
|
|
24
|
+
${b()}
|
|
25
25
|
</div>`};exports.default=BaseVariant;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{composeTypographyStyle as e,getRadiusStyleActiveState as t,getStyleShadow as o,makeStyle as r,getSingleColorVariable as
|
|
1
|
+
import{composeTypographyStyle as e,getRadiusStyleActiveState as t,getStyleShadow as o,makeStyle as r,getSingleColorVariable as p,composeRadius as l,getGlobalColorStateStyle as a,handleConvertBorderStyle as i,handleConvertBorderWidth as d,handleConvertBorderColor as n,getGlobalColorStyle as h}from"@gem-sdk/core";import{filterTruthyObject as c}from"../../../../../helpers.js";let getWrapperStyleActive=l=>{let{preset:a,optionTransform:i,optionTypography:d,optionTypo:n,typeOfOption:h}=l,b=a?.optionBgColor,g=a?.optionTextColor,s=a?.optionBorder,w=a?.optionHasShadow,x=a?.optionShadow,m=a?.optionRounded,u="color"===h,v="image"===h||"image_shopify"===h,S=e(n,d),y=e=>r({bg:e&&p(b?.active),bs:s?.active?.border,bw:s?.active?.width,bc:p(s?.active?.color)});return c({...y(!u),...t(m),...o({value:x?.active,state:"active",styleAppliedFor:"box-shadow",isEnableShadow:w?.active},!0),...!u&&!v&&r({c:i}),...!u&&!v&&r({c:p(g?.active)}),...S,...r({h:a?.height})})},getWrapperStyleNormalAndHover=t=>{let{preset:p,optionTransform:h,optionTypography:b,optionTypo:g,typeOfOption:s}=t,w=p?.optionBgColor,x=p?.optionTextColor,m=p?.optionBorder,u=p?.optionHasShadow,v=p?.optionShadow,S=p?.optionRounded,y="color"===s,C="image"===s||"image_shopify"===s,W=e(g,b),f=["normal","hover"].reduce((e,t)=>({...e,...o({value:v?.[t],state:t,styleAppliedFor:"box-shadow",isEnableShadow:u?.[t]})}),{});return c({...l(S),...f,...!y&&a("bg",w),...!y&&i(m),...!y&&d(m),...!y&&n(m),...!y&&!C&&r({c:h}),...!y&&!C&&a("c",x),...W,...r({h:p?.height})})},getWrapperTextStyle=e=>{let{preset:t,typeOfOption:o}=e,r="color"===o,p=()=>{let e="16px",o={"--pl":"0px","--pr":"0px","--pl-tablet":"0px","--pr-tablet":"0px","--pl-mobile":"0px","--pr-mobile":"0px","--pt":"0px","--pb":"0px"};return t?.width?.desktop?.toLowerCase()!=="auto"&&t?.width?.desktop||(o["--pl"]=e,o["--pr"]=e),t?.width?.tablet?.toLowerCase()!=="auto"&&t?.width?.tablet||(o["--pl-tablet"]=e,o["--pr-tablet"]=e),t?.width?.mobile?.toLowerCase()!=="auto"&&t?.width?.mobile||(o["--pl-mobile"]=e,o["--pr-mobile"]=e),(t?.height?.toLowerCase()==="auto"||t?.height)&&(o["--pt"]="8px",o["--pb"]="8px"),o};return c({...r?{}:p()})},getColorStyle=({optionBorder:e,optionRounded:t,isActive:o,color:r})=>{let p=()=>r?r?.startsWith("linear-gradient")?{backgroundImage:r}:{backgroundColor:r}:{},a=o=>({"--d":"flex","--jc":"center"," --ai":"center","--w":"100%","--h":"100%","--of":"hidden","--bs":o?"none":"solid",...d(e),...n(e),...l(t),...p()});return a(!!o)},getTextStyle=({optionTypo:t,optionTypography:o,optionTextColor:r,selected:p})=>{let l=e(t,o);return c({...l,...r&&p?h(r?.active):a("c",r)})};export{getColorStyle,getTextStyle,getWrapperStyleActive,getWrapperStyleNormalAndHover,getWrapperTextStyle};
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import{template as e}from"@gem-sdk/core";import{getStyleOfObject as s}from"../../../../helpers/function.js";import{getColorClass as a,getWrapperTextClass as o,getTextClass as l,getWrapperClass as r}from"../../common/base/classes.js";import{createClass as i,createStyle as t,createAttr as c,LiquidIf as n,LiquidFor as m,Liquid as d,If as g}from"@gem-sdk/system";import{getWrapperAttr as p}from"../../common/base/attrs.js";import{getColorStyle as u,getWrapperTextStyle as v,getTextStyle as $,getWrapperStyleActive as C,getWrapperStyleNormalAndHover as f}from"../../common/base/styles.js";let BaseVariant=y=>{let{optionTypography:h,optionBorder:b,optionRounded:k,optionTypo:w,typeOfOption:x
|
|
1
|
+
import{template as e}from"@gem-sdk/core";import{getStyleOfObject as s}from"../../../../helpers/function.js";import{getColorClass as a,getWrapperTextClass as o,getTextClass as l,getWrapperClass as r}from"../../common/base/classes.js";import{createClass as i,createStyle as t,createAttr as c,LiquidIf as n,LiquidFor as m,Liquid as d,If as g}from"@gem-sdk/system";import{getWrapperAttr as p}from"../../common/base/attrs.js";import{getColorStyle as u,getWrapperTextStyle as v,getTextStyle as $,getWrapperStyleActive as C,getWrapperStyleNormalAndHover as f}from"../../common/base/styles.js";let BaseVariant=y=>{let{optionTypography:h,optionBorder:b,optionRounded:k,optionTypo:w,typeOfOption:x}=y,D="color"===x,L="image"===x||"image_shopify"===x,j=i(a({})),T=()=>e`
|
|
2
2
|
${m("color in colors",`
|
|
3
3
|
${d('{% assign backgroundType = "background-color" %}')}
|
|
4
4
|
${n('color contains "linear-gradient"',d('{% assign backgroundType = "background-image" %}'))}
|
|
5
5
|
<div
|
|
6
|
-
class="${
|
|
6
|
+
class="${j}"
|
|
7
7
|
data-test="{{ backgroundType }}: {{ color }}"
|
|
8
|
-
style="{{ backgroundType }}: {{ color }}; ${
|
|
8
|
+
style="{{ backgroundType }}: {{ color }}; ${U()}"></div>
|
|
9
9
|
`)}
|
|
10
|
-
`,
|
|
10
|
+
`,V=t(u({optionBorder:b,optionRounded:k,isActive:!0})),B=t(u({optionBorder:b,optionRounded:k,isActive:!1})),U=()=>n("selectedValue == value",s(V),s(B)),A=i(o(L)),_=t({...v(y)}),q=i(l({optionTypo:w,optionTypography:h,isColorType:D,isUploadImageType:L})),z=t($({optionTypo:w,optionTypography:h})),M=()=>e`
|
|
11
11
|
<div
|
|
12
|
-
class="${
|
|
13
|
-
style="${
|
|
14
|
-
${g(
|
|
15
|
-
<span class="${
|
|
12
|
+
class="${A}"
|
|
13
|
+
style="${D?U():""} ${s(_)}">
|
|
14
|
+
${g(L,'<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>'," ")}
|
|
15
|
+
<span class="${q}" style="${z}">{{value}}</span>
|
|
16
16
|
</div>
|
|
17
|
-
`,
|
|
17
|
+
`,Z=()=>e`
|
|
18
18
|
<img class="gp-object-cover gp-rounded-none" style="width: 64px; height: 64px" src="{{imageUrl}}" alt="" />
|
|
19
|
-
`,
|
|
19
|
+
`,E=()=>{switch(x){case"color":return e`${n("colors != null and colors.size > 0",T(),M())}`;case"image":case"image_shopify":return e`${n('imageUrl != null and imageUrl != ""',Z(),M())}`;default:return M()}},F=i(r({...y,available:!0})),G=c(p(y,"Liquid")),H=t(C(y)),I=t(f(y));return e`
|
|
20
20
|
<div
|
|
21
|
-
${
|
|
22
|
-
class="${
|
|
23
|
-
style="${n("selectedValue == value",s({...
|
|
24
|
-
${
|
|
21
|
+
${G}
|
|
22
|
+
class="${F}"
|
|
23
|
+
style="${n("selectedValue == value",s({...H,...V}),s({...I,...B}))}">
|
|
24
|
+
${E()}
|
|
25
25
|
</div>`};export{BaseVariant as default};
|