@gem-sdk/components 2.0.0-staging.754 → 2.0.0-staging.756

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
1
  'use client';
2
- "use strict";var core=require("@gem-sdk/core"),getInnerRadius=require("./getInnerRadius.js"),system=require("@gem-sdk/system"),helpers=require("./helpers.js"),helper=require("../../../post-purchase/utils/helper.js");const getRowStyle=e=>{let{children:t,setting:r,builderProps:o,styles:s,style:i,advanced:p,isNotFullWidth:l,parentStyle:a}=e,{isSection:n,layout:c,horizontalAlign:d,responsive:m,inlineAlignment:y}=r??{},{width:g,columnGap:u,rowGap:v,fullWidth:S,background:k,verticalGutter:h,verticalGutterMobile:R,enablePagePadding:b,height:x}=s??{},f=getInnerRadius.getInnerRadiusExcludeBorder(p?.border,p?.rounded),w=e=>{let t=e?.normal;if(!t||"square"===t.radiusType||"none"===t.radiusType)return!1;for(let e in t)if(Object.hasOwn(t,e)&&"0px"!==t[e])return!0;return!1},j=core.makeStyleResponsive("of",{desktop:w(f.desktop)?"hidden":void 0,tablet:w(f.tablet)?"hidden":void 0,mobile:w(f.mobile)?"hidden":void 0}),q=o?.builderData?.childrens?.length,B={...core.makeStyleResponsive("aspect",{desktop:"16/9"})},I=core.isEmptyChildren(t)||!q,D=helpers.createStyleObject(g,S),[O,C]=core.splitStyle(["pos","top","left","bottom","right","z"],i),E=()=>({...n?C:i,...core.makeStyleResponsive("cg",h),...core.makeStyleResponsive("rg",R),...c?core.composeGridLayout(c):core.makeStyleResponsive("gtc",m),...core.makeStyleResponsive("w",D.content),...core.makeStyleResponsive("h",x),...n?{}:j}),G=()=>({"--mb":"0px","--mt":"0px",...core.makeStyleResponsive("cg",u),...core.makeStyle({pc:y,rg:v?helper.postPurchaseViewSpacing[v]:"0px"})}),L=e=>({...core.getStyleBackgroundByDevice(k,e),...core.getGradientBgrStyleByDevice(k,{desktop:!0,tablet:!0,mobile:!0}),...core.makeStyleResponsive("pc",d)}),T=()=>{let e=l&&!I;return e?{marginLeft:"0px",marginRight:"0px"}:{}},z=()=>({...core.composeRadius(f)}),H=(e=!1)=>system.createStyle({...E(),...L(),...T(),...e?G():{},...r?.sameHeightSubgridContainer&&a}),P=system.createStyle({...z()}),V=system.createStyle({...B,"pointer-events":"none",transform:"translateY(-50%)",height:"100%","object-fit":"cover",top:"50%"}),Y={desktop:b?.desktop?"var(--g-ct-p, 15px)":void 0,tablet:b?.tablet?"var(--g-ct-p, 15px)":void 0,mobile:b?.mobile?"var(--g-ct-p, 15px)":void 0},A=system.createStyle({...O,...core.makeStyleResponsive("w",D.wrapper),...core.makeStyleResponsive("pl",Y),...core.makeStyleResponsive("pr",Y)});return{embedVideoStyle:V,backgroundBoxStyle:P,rowStyle:H,sectionStyle:A}};exports.getRowStyle=getRowStyle;
2
+ "use strict";var core=require("@gem-sdk/core"),getInnerRadius=require("./getInnerRadius.js"),system=require("@gem-sdk/system"),helpers=require("./helpers.js"),helper=require("../../../post-purchase/utils/helper.js");const getRowStyle=e=>{let{children:t,setting:r,builderProps:o,styles:s,style:i,advanced:n,isNotFullWidth:l,parentStyle:p}=e,{isSection:a,layout:c,horizontalAlign:d,responsive:m,inlineAlignment:y}=r??{},{width:u,columnGap:g,rowGap:S,fullWidth:k,background:v,verticalGutter:h,verticalGutterMobile:R,enablePagePadding:b,height:f}=s??{},x=getInnerRadius.getInnerRadiusExcludeBorder(n?.border,n?.rounded),w=e=>{let t=e?.normal;if(!t||"square"===t.radiusType||"none"===t.radiusType)return!1;for(let e in t)if(Object.hasOwn(t,e)&&"0px"!==t[e])return!0;return!1},j=core.makeStyleResponsive("of",{desktop:w(x.desktop)?"hidden":void 0,tablet:w(x.tablet)?"hidden":void 0,mobile:w(x.mobile)?"hidden":void 0}),q=o?.builderData?.childrens?.length,B={...core.makeStyleResponsive("aspect",{desktop:"16/9"})},I=core.isEmptyChildren(t)||!q,D=helpers.createStyleObject(u,k),[O,C]=core.splitStyle(["pos","top","left","bottom","right","z"],i),E=()=>({...a?C:i,...core.makeStyleResponsive("cg",h),...core.makeStyleResponsive("rg",R),...c?core.composeGridLayout(c):core.makeStyleResponsive("gtc",m),...core.makeStyleResponsive("w",D.content),...core.makeStyleResponsive("h",f),...a?{}:j}),G=()=>({"--mb":"0px","--mt":"0px",...core.makeStyleResponsive("cg",g),...core.makeStyle({pc:y,rg:S?helper.postPurchaseViewSpacing[S]:"0px"})}),L=e=>({...core.getStyleBackgroundByDevice(v,e),...core.getGradientBgrStyleByDevice(v,{desktop:!0,tablet:!0,mobile:!0}),...core.makeStyleResponsive("pc",d)}),T=()=>{let e=l&&!I;return e?{marginLeft:"0px",marginRight:"0px"}:{}},z=()=>({...core.composeRadius(x)}),H=(e=!1)=>system.createStyle({...E(),...L(),...T(),...e?G():{},...r?.sameHeightSubgridContainer&&p}),P=system.createStyle({...z()}),V=system.createStyle({...B,"pointer-events":"none",transform:"translateY(-50%)",height:"100%","object-fit":"cover",top:"50%"}),Y=e=>{if(void 0!==e)return e?"var(--g-ct-p, 15px)":"none"},A={desktop:Y(b?.desktop),tablet:Y(b?.tablet),mobile:Y(b?.mobile)},F=system.createStyle({...O,...core.makeStyleResponsive("w",D.wrapper),...core.makeStyleResponsive("pl",A),...core.makeStyleResponsive("pr",A)});return{embedVideoStyle:V,backgroundBoxStyle:P,rowStyle:H,sectionStyle:F}};exports.getRowStyle=getRowStyle;
@@ -1 +1 @@
1
- "use strict";var core=require("@gem-sdk/core");const getInputClasses=({styles:e,borderBtn:s,inputBackgroundColor:t,textColor:l})=>{let o="gp-flex gp-w-full gp-px-1 gp-min-w-[45px] gp-shrink-[99999] gp-appearance-none gp-items-center gp-text-center gp-outline-none gp-transition-all gp-duration-150 hover:gp-text-black disabled:gp-cursor-not-allowed",r=core.composeTypographyClassName(e?.typo,e?.typography),p=core.handleConvertClassColor(s),a=core.getGlobalColorStateClass("bg",t),g=core.getGlobalColorStateClass("text",l);return p&&(o+=` ${p} `),r&&(o+=` ${r} `),a&&(o+=` ${a} `),g&&(o+=` ${g} `),{...core.composeClasses(o)}},getButtonClass=({borderBtn:e,buttonBackgroundColor:s,iconColor:t,buttonSide:l})=>{let o=`gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${"left"===l?"!gp-border-r-0 gp-minus":"!gp-border-l-0 gp-plus"} `,r=core.handleConvertClassColor(e),p=core.getGlobalColorStateClass("bg",s),a=core.getGlobalColorStateClass("text",t);return r&&(o+=` ${r} `),p&&(o+=` ${p} `),a&&(o+=` ${a} `),{...core.composeClasses(o)}},getContainerClasses=e=>({...core.composeClasses(`quantityClass gp-relative gp-inline-flex gp-h-12 gp-w-full gp-bg-transparent gp-transition-all gp-duration-150 data-[disabled=true]:gp-opacity-60 ${e??""}`)}),getWrapperClasses=()=>({...core.composeClasses("gp-inline-flex gp-w-full")}),getIconWrapperClasses=()=>({...core.composeClasses("gp-inline-flex gp-items-center gp-justify-center [&>*]:gp-h-full [&>*]:gp-w-full")});exports.getButtonClass=getButtonClass,exports.getContainerClasses=getContainerClasses,exports.getIconWrapperClasses=getIconWrapperClasses,exports.getInputClasses=getInputClasses,exports.getWrapperClasses=getWrapperClasses;
1
+ "use strict";var core=require("@gem-sdk/core");const getInputClasses=({styles:e,borderBtn:s,inputBackgroundColor:t,textColor:o,isDisabled:l})=>{let r="gp-flex gp-w-full gp-px-1 gp-min-w-[45px] gp-shrink-[99999] gp-appearance-none gp-items-center gp-text-center gp-outline-none gp-transition-all gp-duration-150 hover:gp-text-black disabled:gp-cursor-not-allowed",p=core.composeTypographyClassName(e?.typo,e?.typography),a=core.handleConvertClassColor(s),g=core.getGlobalColorStateClass("bg",t),n=core.getGlobalColorStateClass("text",o);return a&&(r+=` ${a} `),p&&(r+=` ${p} `),g&&(r+=` ${g} `),n&&(r+=` ${n} `),l&&(r+="gp-cursor-not-allowed"),{...core.composeClasses(r)}},getButtonClass=({borderBtn:e,buttonBackgroundColor:s,iconColor:t,buttonSide:o,isDisabled:l})=>{let r=`gp-flex gp-aspect-square gp-h-full disabled:gp-cursor-not-allowed ${l?"gp-cursor-not-allowed":"gp-cursor-pointer"} gp-items-center gp-justify-center gp-outline-none ${"left"===o?"!gp-border-r-0 gp-minus":"!gp-border-l-0 gp-plus"} `,p=core.handleConvertClassColor(e),a=core.getGlobalColorStateClass("bg",s),g=core.getGlobalColorStateClass("text",t);return p&&(r+=` ${p} `),a&&(r+=` ${a} `),g&&(r+=` ${g} `),{...core.composeClasses(r)}},getContainerClasses=e=>({...core.composeClasses(`quantityClass gp-relative gp-inline-flex gp-h-12 gp-w-full gp-bg-transparent gp-transition-all gp-duration-150 data-[disabled=true]:gp-opacity-60 ${e??""}`)}),getWrapperClasses=()=>({...core.composeClasses("gp-inline-flex gp-w-full")}),getIconWrapperClasses=()=>({...core.composeClasses("gp-inline-flex gp-items-center gp-justify-center [&>*]:gp-h-full [&>*]:gp-w-full")});exports.getButtonClass=getButtonClass,exports.getContainerClasses=getContainerClasses,exports.getIconWrapperClasses=getIconWrapperClasses,exports.getInputClasses=getInputClasses,exports.getWrapperClasses=getWrapperClasses;
@@ -1 +1 @@
1
- "use strict";var core=require("@gem-sdk/core"),React=require("react"),common=require("../../ProductVariants/common/common.js");const useProductQuantity=e=>{let{setting:t={},advanced:u}=e,{updatePrice:r}=t,{quantity:c,setQuantity:n,setUpdatePrice:a}=core.useQuantity(),o=core.useCurrentVariantInStock(),i=core.useProduct(),s=core.useIsSyncProduct(),{trigger:d}=core.useInteraction(),l=React.useRef(null),y=t.defaultQtyValue||1;React.useEffect(()=>{n(parseFloat(`${y}`))},[n,y]),React.useEffect(()=>{a(r||!1)},[r,a]);let m=e=>{let t=e.detail,u=i?.id;s&&t&&u==t.productId&&c!=t.quantity&&(q(t.quantity),n(t.quantity))};React.useEffect(()=>{window.removeEventListener("set-product-quantity",m),window.addEventListener("set-product-quantity",m)}),common.useTransition(e=>{e!==c&&q(c||0)},[c]);let q=e=>{d({event:"gp:rollback:quantity-change",selector:`[data-id="${u?.uid}"]`,element:l.current}),d({event:"gp:quantity-change",selector:`[data-id="${u?.uid}"]`,data:e,element:l.current})};return{isInStock:o,ref:l}};exports.useProductQuantity=useProductQuantity;
1
+ "use strict";var core=require("@gem-sdk/core"),React=require("react"),common=require("../../ProductVariants/common/common.js");const useProductQuantity=e=>{let{setting:t={},advanced:r}=e,{updatePrice:u}=t,{quantity:a,setQuantity:n,setUpdatePrice:c,increment:o,decrement:i}=core.useQuantity(),s=core.useCurrentVariantInStock(),d=core.useProduct(),l=core.useIsSyncProduct(),{trigger:y}=core.useInteraction(),m=React.useRef(null),q=t.defaultQtyValue||1;React.useEffect(()=>{n(parseFloat(`${q}`))},[n,q]),React.useEffect(()=>{c(u||!1)},[u,c]);let f=e=>{let t=e.detail,r=d?.id;l&&t&&r==t.productId&&a!=t.quantity&&(p(t.quantity),n(t.quantity))};React.useEffect(()=>{window.removeEventListener("set-product-quantity",f),window.addEventListener("set-product-quantity",f)}),common.useTransition(e=>{e!==a&&p(a||0)},[a]);let p=e=>{y({event:"gp:rollback:quantity-change",selector:`[data-id="${r?.uid}"]`,element:m.current}),y({event:"gp:quantity-change",selector:`[data-id="${r?.uid}"]`,data:e,element:m.current})},g=()=>{s&&o()},v=()=>{s&&i()},P=e=>{s&&n(parseInt(e.target.value,10))},R=e=>{s||e.target.blur()};return{isInStock:s,ref:m,onClickIncrement:g,onClickDecrement:v,onChangeInput:P,onFocusInput:R}};exports.useProductQuantity=useProductQuantity;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),index=require("./hooks/index.js"),common=require("./common/common.js"),getAttrs=require("./common/getAttrs.js"),getClasses=require("./common/getClasses.js"),getStyles=require("./common/getStyles.js");const ProductQuantity=e=>{let{setting:t={},styles:s={},builderProps:r,advanced:a}=e,l=core.useCurrentVariant(),{quantity:n,increment:u,decrement:m,setQuantity:o}=core.useQuantity(),{isInStock:i,ref:c}=index.useProductQuantity(e),{qtyStyle:y,plusIcon:g,minusIcon:d}=t,C=t.defaultQtyValue||1,{inputHeight:S,buttonBackgroundColor:j,backgroundColor:x,iconColor:p,inputBackgroundColor:A,textColor:b,align:h,borderBtn:I,buttonWidth:f,iconSizeCustom:q,corner:R,buttonBoxShadow:N}=s,B=system.createAttr({...getAttrs.getContainerAttrs({isDisabled:!i,uid:r?.uid||""})}),_=system.createClass({...getClasses.getContainerClasses(a?.cssClass)}),k=system.createStyle({...getStyles.getContainerStyles({align:h,inputHeight:S})}),v=system.createClass({...getClasses.getWrapperClasses()}),P=system.createStyle({...getStyles.getWrapperStyles({backgroundColor:x,styles:s})}),Q=system.createAttr({...getAttrs.getInputAttr({qtyStyle:y,quantity:n,currentVariant:l,defaultQty:C})}),M=system.createClass({...getClasses.getInputClasses({styles:s,borderBtn:I,inputBackgroundColor:A,textColor:b})}),W=system.createStyle({...getStyles.getInputStyle(e)}),H=system.createClass({...getClasses.getButtonClass({borderBtn:I,buttonBackgroundColor:j,iconColor:p,buttonSide:"left"})}),L=system.createStyle({...getStyles.getButtonStyle({borderBtn:I,buttonWidth:f,buttonBackgroundColor:j,iconColor:p,corner:R,buttonSide:"left",buttonBoxShadow:N})}),T=system.createAttr({...getAttrs.getButtonAttrs({buttonSide:"left"})}),V=system.createClass({...getClasses.getButtonClass({borderBtn:I,buttonBackgroundColor:j,iconColor:p,buttonSide:"right"})}),D=system.createStyle({...getStyles.getButtonStyle({borderBtn:I,buttonWidth:f,buttonBackgroundColor:j,iconColor:p,corner:R,buttonSide:"right",buttonBoxShadow:N})}),O=system.createAttr({...getAttrs.getButtonAttrs({buttonSide:"right"})}),w=system.createClass({...getClasses.getIconWrapperClasses()}),z=system.createStyle({...common.getIconWidth(q)});return jsxRuntime.jsx("div",{ref:c,...B,className:_,style:k,children:jsxRuntime.jsxs("div",{className:v,style:P,children:[system.If("standard"===y,jsxRuntime.jsx("button",{disabled:!i,...T,onClick:m,className:H,style:L,children:jsxRuntime.jsx("span",{className:w,style:z,dangerouslySetInnerHTML:{__html:common.getMinusIcon(d)}})})),jsxRuntime.jsx("input",{disabled:!i,...Q,className:M,style:W,onChange:e=>{o(parseInt(e.target.value,10))}}),system.If("standard"===y,jsxRuntime.jsx("button",{disabled:!i,...O,onClick:u,className:V,style:D,children:jsxRuntime.jsx("span",{className:w,style:z,dangerouslySetInnerHTML:{__html:common.getPlusIcon(g)}})}))]})})};exports.default=ProductQuantity;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),system=require("@gem-sdk/system"),index=require("./hooks/index.js"),common=require("./common/common.js"),getAttrs=require("./common/getAttrs.js"),getClasses=require("./common/getClasses.js"),getStyles=require("./common/getStyles.js");const ProductQuantity=e=>{let{setting:t={},styles:s={},builderProps:r,advanced:a}=e,n=core.useCurrentVariant(),{quantity:l}=core.useQuantity(),{isInStock:i,ref:o,onClickIncrement:u,onClickDecrement:m,onChangeInput:c,onFocusInput:y}=index.useProductQuantity(e),{qtyStyle:g,plusIcon:d,minusIcon:C}=t,S=t.defaultQtyValue||1,{inputHeight:j,buttonBackgroundColor:x,backgroundColor:p,iconColor:A,inputBackgroundColor:b,textColor:h,align:I,borderBtn:f,buttonWidth:q,iconSizeCustom:R,corner:N,buttonBoxShadow:B}=s,_=system.createAttr({...getAttrs.getContainerAttrs({isDisabled:!i,uid:r?.uid||""})}),k=system.createClass({...getClasses.getContainerClasses(a?.cssClass)}),P=system.createStyle({...getStyles.getContainerStyles({align:I,inputHeight:j})}),Q=system.createClass({...getClasses.getWrapperClasses()}),v=system.createStyle({...getStyles.getWrapperStyles({backgroundColor:p,styles:s})}),D=system.createAttr({...getAttrs.getInputAttr({qtyStyle:g,quantity:l,currentVariant:n,defaultQty:S})}),M=system.createClass({...getClasses.getInputClasses({styles:s,borderBtn:f,inputBackgroundColor:b,textColor:h,isDisabled:!i})}),W=system.createStyle({...getStyles.getInputStyle(e)}),H=system.createClass({...getClasses.getButtonClass({borderBtn:f,buttonBackgroundColor:x,iconColor:A,buttonSide:"left",isDisabled:!i})}),L=system.createStyle({...getStyles.getButtonStyle({borderBtn:f,buttonWidth:q,buttonBackgroundColor:x,iconColor:A,corner:N,buttonSide:"left",buttonBoxShadow:B})}),T=system.createAttr({...getAttrs.getButtonAttrs({buttonSide:"left"})}),V=system.createClass({...getClasses.getButtonClass({borderBtn:f,buttonBackgroundColor:x,iconColor:A,buttonSide:"right",isDisabled:!i})}),F=system.createStyle({...getStyles.getButtonStyle({borderBtn:f,buttonWidth:q,buttonBackgroundColor:x,iconColor:A,corner:N,buttonSide:"right",buttonBoxShadow:B})}),O=system.createAttr({...getAttrs.getButtonAttrs({buttonSide:"right"})}),w=system.createClass({...getClasses.getIconWrapperClasses()}),z=system.createStyle({...common.getIconWidth(R)});return jsxRuntime.jsx("div",{ref:o,..._,className:k,style:P,children:jsxRuntime.jsxs("div",{className:Q,style:v,children:[system.If("standard"===g,jsxRuntime.jsx("button",{...T,onClick:m,className:H,style:L,children:jsxRuntime.jsx("span",{className:w,style:z,dangerouslySetInnerHTML:{__html:common.getMinusIcon(C)}})})),jsxRuntime.jsx("input",{...D,className:M,style:W,onChange:e=>c(e),onFocus:e=>y(e)}),system.If("standard"===g,jsxRuntime.jsx("button",{...O,onClick:u,className:V,style:F,children:jsxRuntime.jsx("span",{className:w,style:z,dangerouslySetInnerHTML:{__html:common.getPlusIcon(d)}})}))]})})};exports.default=ProductQuantity;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{makeStyleResponsive as e,isEmptyChildren as t,splitStyle as r,composeRadius as o,composeGridLayout as p,makeStyle as i,getStyleBackgroundByDevice as n,getGradientBgrStyleByDevice as d}from"@gem-sdk/core";import{getInnerRadiusExcludeBorder as s}from"./getInnerRadius.js";import{createStyle as l}from"@gem-sdk/system";import{createStyleObject as a}from"./helpers.js";import{postPurchaseViewSpacing as m}from"../../../post-purchase/utils/helper.js";let getRowStyle=g=>{let{children:b,setting:c,builderProps:h,styles:u,style:f,advanced:v,isNotFullWidth:x,parentStyle:k}=g,{isSection:w,layout:j,horizontalAlign:y,responsive:R,inlineAlignment:S}=c??{},{width:O,columnGap:T,rowGap:q,fullWidth:z,background:C,verticalGutter:D,verticalGutterMobile:H,enablePagePadding:I,height:L}=u??{},Y=s(v?.border,v?.rounded),A=e=>{let t=e?.normal;if(!t||"square"===t.radiusType||"none"===t.radiusType)return!1;for(let e in t)if(Object.hasOwn(t,e)&&"0px"!==t[e])return!0;return!1},B=e("of",{desktop:A(Y.desktop)?"hidden":void 0,tablet:A(Y.tablet)?"hidden":void 0,mobile:A(Y.mobile)?"hidden":void 0}),E=h?.builderData?.childrens?.length,F={...e("aspect",{desktop:"16/9"})},G=t(b)||!E,J=a(O,z),[K,M]=r(["pos","top","left","bottom","right","z"],f),N=()=>({...w?M:f,...e("cg",D),...e("rg",H),...j?p(j):e("gtc",R),...e("w",J.content),...e("h",L),...w?{}:B}),P=()=>({"--mb":"0px","--mt":"0px",...e("cg",T),...i({pc:S,rg:q?m[q]:"0px"})}),Q=t=>({...n(C,t),...d(C,{desktop:!0,tablet:!0,mobile:!0}),...e("pc",y)}),U=()=>{let e=x&&!G;return e?{marginLeft:"0px",marginRight:"0px"}:{}},V=()=>({...o(Y)}),W=(e=!1)=>l({...N(),...Q(),...U(),...e?P():{},...c?.sameHeightSubgridContainer&&k}),X=l({...V()}),Z=l({...F,"pointer-events":"none",transform:"translateY(-50%)",height:"100%","object-fit":"cover",top:"50%"}),$={desktop:I?.desktop?"var(--g-ct-p, 15px)":void 0,tablet:I?.tablet?"var(--g-ct-p, 15px)":void 0,mobile:I?.mobile?"var(--g-ct-p, 15px)":void 0},_=l({...K,...e("w",J.wrapper),...e("pl",$),...e("pr",$)});return{embedVideoStyle:Z,backgroundBoxStyle:X,rowStyle:W,sectionStyle:_}};export{getRowStyle};
2
+ import{makeStyleResponsive as e,isEmptyChildren as t,splitStyle as r,composeRadius as o,composeGridLayout as i,makeStyle as p,getStyleBackgroundByDevice as n,getGradientBgrStyleByDevice as s}from"@gem-sdk/core";import{getInnerRadiusExcludeBorder as d}from"./getInnerRadius.js";import{createStyle as l}from"@gem-sdk/system";import{createStyleObject as m}from"./helpers.js";import{postPurchaseViewSpacing as a}from"../../../post-purchase/utils/helper.js";let getRowStyle=g=>{let{children:b,setting:h,builderProps:u,styles:c,style:f,advanced:k,isNotFullWidth:x,parentStyle:v}=g,{isSection:w,layout:j,horizontalAlign:y,responsive:R,inlineAlignment:S}=h??{},{width:O,columnGap:T,rowGap:q,fullWidth:z,background:C,verticalGutter:D,verticalGutterMobile:H,enablePagePadding:I,height:L}=c??{},Y=d(k?.border,k?.rounded),A=e=>{let t=e?.normal;if(!t||"square"===t.radiusType||"none"===t.radiusType)return!1;for(let e in t)if(Object.hasOwn(t,e)&&"0px"!==t[e])return!0;return!1},B=e("of",{desktop:A(Y.desktop)?"hidden":void 0,tablet:A(Y.tablet)?"hidden":void 0,mobile:A(Y.mobile)?"hidden":void 0}),E=u?.builderData?.childrens?.length,F={...e("aspect",{desktop:"16/9"})},G=t(b)||!E,J=m(O,z),[K,M]=r(["pos","top","left","bottom","right","z"],f),N=()=>({...w?M:f,...e("cg",D),...e("rg",H),...j?i(j):e("gtc",R),...e("w",J.content),...e("h",L),...w?{}:B}),P=()=>({"--mb":"0px","--mt":"0px",...e("cg",T),...p({pc:S,rg:q?a[q]:"0px"})}),Q=t=>({...n(C,t),...s(C,{desktop:!0,tablet:!0,mobile:!0}),...e("pc",y)}),U=()=>{let e=x&&!G;return e?{marginLeft:"0px",marginRight:"0px"}:{}},V=()=>({...o(Y)}),W=(e=!1)=>l({...N(),...Q(),...U(),...e?P():{},...h?.sameHeightSubgridContainer&&v}),X=l({...V()}),Z=l({...F,"pointer-events":"none",transform:"translateY(-50%)",height:"100%","object-fit":"cover",top:"50%"}),$=e=>{if(void 0!==e)return e?"var(--g-ct-p, 15px)":"none"},_={desktop:$(I?.desktop),tablet:$(I?.tablet),mobile:$(I?.mobile)},ee=l({...K,...e("w",J.wrapper),...e("pl",_),...e("pr",_)});return{embedVideoStyle:Z,backgroundBoxStyle:X,rowStyle:W,sectionStyle:ee}};export{getRowStyle};
@@ -1 +1 @@
1
- import{composeTypographyClassName as e,handleConvertClassColor as t,getGlobalColorStateClass as p,composeClasses as g}from"@gem-sdk/core";let getInputClasses=({styles:l,borderBtn:s,inputBackgroundColor:r,textColor:n})=>{let a="gp-flex gp-w-full gp-px-1 gp-min-w-[45px] gp-shrink-[99999] gp-appearance-none gp-items-center gp-text-center gp-outline-none gp-transition-all gp-duration-150 hover:gp-text-black disabled:gp-cursor-not-allowed",o=e(l?.typo,l?.typography),i=t(s),u=p("bg",r),c=p("text",n);return i&&(a+=` ${i} `),o&&(a+=` ${o} `),u&&(a+=` ${u} `),c&&(a+=` ${c} `),{...g(a)}},getButtonClass=({borderBtn:e,buttonBackgroundColor:l,iconColor:s,buttonSide:r})=>{let n=`gp-flex gp-aspect-square gp-h-full gp-cursor-pointer gp-items-center gp-justify-center gp-outline-none disabled:gp-cursor-not-allowed ${"left"===r?"!gp-border-r-0 gp-minus":"!gp-border-l-0 gp-plus"} `,a=t(e),o=p("bg",l),i=p("text",s);return a&&(n+=` ${a} `),o&&(n+=` ${o} `),i&&(n+=` ${i} `),{...g(n)}},getContainerClasses=e=>({...g(`quantityClass gp-relative gp-inline-flex gp-h-12 gp-w-full gp-bg-transparent gp-transition-all gp-duration-150 data-[disabled=true]:gp-opacity-60 ${e??""}`)}),getWrapperClasses=()=>({...g("gp-inline-flex gp-w-full")}),getIconWrapperClasses=()=>({...g("gp-inline-flex gp-items-center gp-justify-center [&>*]:gp-h-full [&>*]:gp-w-full")});export{getButtonClass,getContainerClasses,getIconWrapperClasses,getInputClasses,getWrapperClasses};
1
+ import{composeTypographyClassName as e,handleConvertClassColor as t,getGlobalColorStateClass as p,composeClasses as g}from"@gem-sdk/core";let getInputClasses=({styles:l,borderBtn:r,inputBackgroundColor:s,textColor:n,isDisabled:a})=>{let o="gp-flex gp-w-full gp-px-1 gp-min-w-[45px] gp-shrink-[99999] gp-appearance-none gp-items-center gp-text-center gp-outline-none gp-transition-all gp-duration-150 hover:gp-text-black disabled:gp-cursor-not-allowed",i=e(l?.typo,l?.typography),u=t(r),c=p("bg",s),d=p("text",n);return u&&(o+=` ${u} `),i&&(o+=` ${i} `),c&&(o+=` ${c} `),d&&(o+=` ${d} `),a&&(o+="gp-cursor-not-allowed"),{...g(o)}},getButtonClass=({borderBtn:e,buttonBackgroundColor:l,iconColor:r,buttonSide:s,isDisabled:n})=>{let a=`gp-flex gp-aspect-square gp-h-full disabled:gp-cursor-not-allowed ${n?"gp-cursor-not-allowed":"gp-cursor-pointer"} gp-items-center gp-justify-center gp-outline-none ${"left"===s?"!gp-border-r-0 gp-minus":"!gp-border-l-0 gp-plus"} `,o=t(e),i=p("bg",l),u=p("text",r);return o&&(a+=` ${o} `),i&&(a+=` ${i} `),u&&(a+=` ${u} `),{...g(a)}},getContainerClasses=e=>({...g(`quantityClass gp-relative gp-inline-flex gp-h-12 gp-w-full gp-bg-transparent gp-transition-all gp-duration-150 data-[disabled=true]:gp-opacity-60 ${e??""}`)}),getWrapperClasses=()=>({...g("gp-inline-flex gp-w-full")}),getIconWrapperClasses=()=>({...g("gp-inline-flex gp-items-center gp-justify-center [&>*]:gp-h-full [&>*]:gp-w-full")});export{getButtonClass,getContainerClasses,getIconWrapperClasses,getInputClasses,getWrapperClasses};
@@ -1 +1 @@
1
- import{useQuantity as t,useCurrentVariantInStock as e,useProduct as r,useIsSyncProduct as n,useInteraction as a}from"@gem-sdk/core";import{useRef as o,useEffect as u}from"react";import{useTransition as i}from"../../ProductVariants/common/common.js";let useProductQuantity=d=>{let{setting:c={},advanced:l}=d,{updatePrice:m}=c,{quantity:s,setQuantity:p,setUpdatePrice:y}=t(),q=e(),g=r(),v=n(),{trigger:f}=a(),w=o(null),P=c.defaultQtyValue||1;u(()=>{p(parseFloat(`${P}`))},[p,P]),u(()=>{y(m||!1)},[m,y]);let Q=t=>{let e=t.detail,r=g?.id;v&&e&&r==e.productId&&s!=e.quantity&&($(e.quantity),p(e.quantity))};u(()=>{window.removeEventListener("set-product-quantity",Q),window.addEventListener("set-product-quantity",Q)}),i(t=>{t!==s&&$(s||0)},[s]);let $=t=>{f({event:"gp:rollback:quantity-change",selector:`[data-id="${l?.uid}"]`,element:w.current}),f({event:"gp:quantity-change",selector:`[data-id="${l?.uid}"]`,data:t,element:w.current})};return{isInStock:q,ref:w}};export{useProductQuantity};
1
+ import{useQuantity as t,useCurrentVariantInStock as e,useProduct as r,useIsSyncProduct as a,useInteraction as n}from"@gem-sdk/core";import{useRef as u,useEffect as o}from"react";import{useTransition as i}from"../../ProductVariants/common/common.js";let useProductQuantity=d=>{let{setting:l={},advanced:c}=d,{updatePrice:m}=l,{quantity:s,setQuantity:p,setUpdatePrice:y,increment:g,decrement:q}=t(),v=e(),f=r(),w=a(),{trigger:P}=n(),Q=u(null),$=l.defaultQtyValue||1;o(()=>{p(parseFloat(`${$}`))},[p,$]),o(()=>{y(m||!1)},[m,y]);let b=t=>{let e=t.detail,r=f?.id;w&&e&&r==e.productId&&s!=e.quantity&&(h(e.quantity),p(e.quantity))};o(()=>{window.removeEventListener("set-product-quantity",b),window.addEventListener("set-product-quantity",b)}),i(t=>{t!==s&&h(s||0)},[s]);let h=t=>{P({event:"gp:rollback:quantity-change",selector:`[data-id="${c?.uid}"]`,element:Q.current}),P({event:"gp:quantity-change",selector:`[data-id="${c?.uid}"]`,data:t,element:Q.current})},k=()=>{v&&g()},E=()=>{v&&q()},I=t=>{v&&p(parseInt(t.target.value,10))},L=t=>{v||t.target.blur()};return{isInStock:v,ref:Q,onClickIncrement:k,onClickDecrement:E,onChangeInput:I,onFocusInput:L}};export{useProductQuantity};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useCurrentVariant as s,useQuantity as o}from"@gem-sdk/core";import{createAttr as r,createClass as l,createStyle as a,If as m}from"@gem-sdk/system";import{useProductQuantity as n}from"./hooks/index.js";import{getIconWidth as i,getMinusIcon as d,getPlusIcon as c}from"./common/common.js";import{getContainerAttrs as u,getInputAttr as f,getButtonAttrs as y}from"./common/getAttrs.js";import{getContainerClasses as p,getWrapperClasses as b,getInputClasses as g,getButtonClass as h,getIconWrapperClasses as S}from"./common/getClasses.js";import{getContainerStyles as N,getWrapperStyles as j,getInputStyle as k,getButtonStyle as C}from"./common/getStyles.js";let ProductQuantity=_=>{let{setting:v={},styles:x={},builderProps:I,advanced:Q}=_,H=s(),{quantity:L,increment:M,decrement:P,setQuantity:T}=o(),{isInStock:A,ref:D}=n(_),{qtyStyle:V,plusIcon:q,minusIcon:w}=v,z=v.defaultQtyValue||1,{inputHeight:B,buttonBackgroundColor:E,backgroundColor:F,iconColor:G,inputBackgroundColor:J,textColor:K,align:O,borderBtn:R,buttonWidth:U,iconSizeCustom:W,corner:X,buttonBoxShadow:Y}=x,Z=r({...u({isDisabled:!A,uid:I?.uid||""})}),$=l({...p(Q?.cssClass)}),tt=a({...N({align:O,inputHeight:B})}),te=l({...b()}),ts=a({...j({backgroundColor:F,styles:x})}),to=r({...f({qtyStyle:V,quantity:L,currentVariant:H,defaultQty:z})}),tr=l({...g({styles:x,borderBtn:R,inputBackgroundColor:J,textColor:K})}),tl=a({...k(_)}),ta=l({...h({borderBtn:R,buttonBackgroundColor:E,iconColor:G,buttonSide:"left"})}),tm=a({...C({borderBtn:R,buttonWidth:U,buttonBackgroundColor:E,iconColor:G,corner:X,buttonSide:"left",buttonBoxShadow:Y})}),tn=r({...y({buttonSide:"left"})}),ti=l({...h({borderBtn:R,buttonBackgroundColor:E,iconColor:G,buttonSide:"right"})}),td=a({...C({borderBtn:R,buttonWidth:U,buttonBackgroundColor:E,iconColor:G,corner:X,buttonSide:"right",buttonBoxShadow:Y})}),tc=r({...y({buttonSide:"right"})}),tu=l({...S()}),tf=a({...i(W)});return t("div",{ref:D,...Z,className:$,style:tt,children:e("div",{className:te,style:ts,children:[m("standard"===V,t("button",{disabled:!A,...tn,onClick:P,className:ta,style:tm,children:t("span",{className:tu,style:tf,dangerouslySetInnerHTML:{__html:d(w)}})})),t("input",{disabled:!A,...to,className:tr,style:tl,onChange:t=>{T(parseInt(t.target.value,10))}}),m("standard"===V,t("button",{disabled:!A,...tc,onClick:M,className:ti,style:td,children:t("span",{className:tu,style:tf,dangerouslySetInnerHTML:{__html:c(q)}})}))]})})};export{ProductQuantity as default};
2
+ import{jsx as t,jsxs as e}from"react/jsx-runtime";import{useCurrentVariant as s,useQuantity as o}from"@gem-sdk/core";import{createAttr as i,createClass as l,createStyle as m,If as r}from"@gem-sdk/system";import{useProductQuantity as n}from"./hooks/index.js";import{getIconWidth as a,getMinusIcon as d,getPlusIcon as c}from"./common/common.js";import{getContainerAttrs as u,getInputAttr as f,getButtonAttrs as y}from"./common/getAttrs.js";import{getContainerClasses as b,getWrapperClasses as p,getInputClasses as g,getButtonClass as h,getIconWrapperClasses as S}from"./common/getClasses.js";import{getContainerStyles as N,getWrapperStyles as j,getInputStyle as k,getButtonStyle as C}from"./common/getStyles.js";let ProductQuantity=D=>{let{setting:_={},styles:x={},builderProps:Q,advanced:v}=D,H=s(),{quantity:I}=o(),{isInStock:L,ref:M,onClickIncrement:P,onClickDecrement:T,onChangeInput:A,onFocusInput:F}=n(D),{qtyStyle:V,plusIcon:q,minusIcon:w}=_,z=_.defaultQtyValue||1,{inputHeight:B,buttonBackgroundColor:E,backgroundColor:G,iconColor:J,inputBackgroundColor:K,textColor:O,align:R,borderBtn:U,buttonWidth:W,iconSizeCustom:X,corner:Y,buttonBoxShadow:Z}=x,$=i({...u({isDisabled:!L,uid:Q?.uid||""})}),tt=l({...b(v?.cssClass)}),te=m({...N({align:R,inputHeight:B})}),ts=l({...p()}),to=m({...j({backgroundColor:G,styles:x})}),ti=i({...f({qtyStyle:V,quantity:I,currentVariant:H,defaultQty:z})}),tl=l({...g({styles:x,borderBtn:U,inputBackgroundColor:K,textColor:O,isDisabled:!L})}),tm=m({...k(D)}),tr=l({...h({borderBtn:U,buttonBackgroundColor:E,iconColor:J,buttonSide:"left",isDisabled:!L})}),tn=m({...C({borderBtn:U,buttonWidth:W,buttonBackgroundColor:E,iconColor:J,corner:Y,buttonSide:"left",buttonBoxShadow:Z})}),ta=i({...y({buttonSide:"left"})}),td=l({...h({borderBtn:U,buttonBackgroundColor:E,iconColor:J,buttonSide:"right",isDisabled:!L})}),tc=m({...C({borderBtn:U,buttonWidth:W,buttonBackgroundColor:E,iconColor:J,corner:Y,buttonSide:"right",buttonBoxShadow:Z})}),tu=i({...y({buttonSide:"right"})}),tf=l({...S()}),ty=m({...a(X)});return t("div",{ref:M,...$,className:tt,style:te,children:e("div",{className:ts,style:to,children:[r("standard"===V,t("button",{...ta,onClick:T,className:tr,style:tn,children:t("span",{className:tf,style:ty,dangerouslySetInnerHTML:{__html:d(w)}})})),t("input",{...ti,className:tl,style:tm,onChange:t=>A(t),onFocus:t=>F(t)}),r("standard"===V,t("button",{...tu,onClick:P,className:td,style:tc,children:t("span",{className:tf,style:ty,dangerouslySetInnerHTML:{__html:c(q)}})}))]})})};export{ProductQuantity as default};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-staging.754",
3
+ "version": "2.0.0-staging.756",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",