@gem-sdk/components 2.0.0-staging.1016 → 2.0.0-staging.1018
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/common/styles.js +4 -4
- package/dist/cjs/product/components/product-quantity/ProductQuantity.js +1 -1
- package/dist/cjs/product/components/product-quantity/ProductQuantity.liquid.js +1 -1
- package/dist/cjs/product/components/product-quantity/common/classes.js +1 -1
- package/dist/cjs/product/components/product-quantity/common/styles.js +1 -1
- package/dist/cjs/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/cjs/product/settings/product-quantity/configs/ui-v2.js +1 -1
- package/dist/esm/button/common/styles.js +5 -5
- package/dist/esm/product/components/product-quantity/ProductQuantity.js +1 -1
- package/dist/esm/product/components/product-quantity/ProductQuantity.liquid.js +1 -1
- package/dist/esm/product/components/product-quantity/common/classes.js +1 -1
- package/dist/esm/product/components/product-quantity/common/styles.js +1 -1
- package/dist/esm/product/settings/product-quantity/configs/settings.js +1 -1
- package/dist/esm/product/settings/product-quantity/configs/ui-v2.js +1 -1
- package/package.json +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core");const getButtonWrapperStyles=(e,t)=>({...e,...core.makeStyleResponsive("ta",t?.align)}),getButtonStyles=(e,t)=>{let o={...getSizeStyles(e),...getRadiusStyles(e),...getShadowStyles(e),...getBackgroundStyles(e),...getTypographyStyles(e).textColorStyle};return t?o:core.filterHoverVariables(o)},getButtonIconStyles=(e,t)=>({...getIconSpacingStyle(e,t),"--height-desktop":`${e?.size?.desktop}`,"--height-tablet":`${e?.size?.desktop||e?.size?.tablet}`,"--height-mobile":`${e?.size?.mobile||e?.size?.tablet||e?.size?.desktop}`}),ignoreStateNoneValue=(obj,condition)=>Object.entries(obj).reduce((acc,[key,value])=>((!["hover","focus","normal","active"].includes(key)||eval(condition))&&(acc[key]=value),acc),{}),getShadowStyles=e=>{let{boxShadowBtn:t,hasBoxShadowBtn:o}=e||{},r=ignoreStateNoneValue(t||{},"value?.type !== undefined ");return{...core.getStyleShadowState(r,"box-shadow",o)}},getRadiusStyles=e=>{let t=ignoreStateNoneValue(e?.roundedBtnV2||{},"value?.radiusType !== undefined");return core.composeRadius(t)},getIconSpacingStyle=(e,t)=>{let o=e?.iconSpacing||{desktop:"8px"};return t?.iconAlign==="left"?core.makeStyleResponsive("mr",o):core.makeStyleResponsive("ml",o)},getSizeStyles=e=>{let t=core.makeGlobalSize(e?.globalSize);return{...t.width,...t.height,...t.padding}},getTypographyStyles=e=>{let t=core.composeTypographyStyle(e?.typo,e?.typography),o={"--c":t?.["--c"]},r={...t};return delete r["--c"],{textColorStyle:{"--hvr-c":core.getColor(e?.textColor?.hover),...o},withoutTextColorStyles:r}},getTypoStyles=e=>({...getTypographyStyles(e).withoutTextColorStyles,...core.getStyleShadow({styleAppliedFor:"text-shadow",value:e?.typo?.custom?.textShadow,isEnableShadow:e?.typo?.custom?.hasShadowText}),"word-break":"break-word"}),getBgImageUrl=(e,t)=>{let{backgroundImage:o,backgroundColorV2:r}=e||{},s=o?.[t],a=r?.[t];if(!s&&!a)return"";let l=`url(${s?.image?.src})`,n=a?`, ${a}`:"";return a?.includes?.(core.GRADIENT_BGR_KEY)&&s?.image?.src?`${l}${n}`:a?.includes?.(core.GRADIENT_BGR_KEY)&&!s?.image?.src?a:s?.image?.src?l:""},getBackgroundImageSource=e=>{let t={normal:getBgImageUrl(e,"normal"),hover:getBgImageUrl(e,"hover")};return core.makeStyleState("bgi",t)},getBackgroundStyles=e=>{let{backgroundColorV2:t,backgroundImage:o}=e||{},r={...o,hover:o?.hover?.image?o?.hover:o?.normal},s={...t,hover:t?.hover||t?.normal};return{...core.getStyleBackgroundImage(r,{ignoreBackgroundImage:!0}),...getBackgroundImageSource({backgroundImage:r,backgroundColorV2:s}),...core.getGlobalColorStateStyle("bg",s)}},getCustomCssStyles=({styles:e,uid:t,builderAttrs:o,enableHoverEffect:r})=>{if(!t)return"";let{borderBtnV2:s,roundedBtnV2:a}=e??{},l=ignoreStateNoneValue(s||{},'value?.border !== "none"'),n=ignoreStateNoneValue(a||{},"value?.radiusType !== undefined"),g=generateBorderCornerStyles({uid:t,borderBtn:l,roundedBtn:n,builderAttrs:o,enableHoverEffect:r});return`
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core");const getButtonWrapperStyles=(e,t)=>({...e,...core.makeStyleResponsive("ta",t?.align)}),getButtonStyles=(e,t)=>{let o={...getSizeStyles(e),...getRadiusStyles(e),...getShadowStyles(e),...getBackgroundStyles(e),...getTypographyStyles(e).textColorStyle,...getTypographyStyles(e).withoutTextColorStyles};return t?o:core.filterHoverVariables(o)},getButtonIconStyles=(e,t)=>({...getIconSpacingStyle(e,t),"--height-desktop":`${e?.size?.desktop}`,"--height-tablet":`${e?.size?.desktop||e?.size?.tablet}`,"--height-mobile":`${e?.size?.mobile||e?.size?.tablet||e?.size?.desktop}`}),ignoreStateNoneValue=(obj,condition)=>Object.entries(obj).reduce((acc,[key,value])=>((!["hover","focus","normal","active"].includes(key)||eval(condition))&&(acc[key]=value),acc),{}),getShadowStyles=e=>{let{boxShadowBtn:t,hasBoxShadowBtn:o}=e||{},r=ignoreStateNoneValue(t||{},"value?.type !== undefined ");return{...core.getStyleShadowState(r,"box-shadow",o)}},getRadiusStyles=e=>{let t=ignoreStateNoneValue(e?.roundedBtnV2||{},"value?.radiusType !== undefined");return core.composeRadius(t)},getIconSpacingStyle=(e,t)=>{let o=e?.iconSpacing||{desktop:"8px"};return t?.iconAlign==="left"?core.makeStyleResponsive("mr",o):core.makeStyleResponsive("ml",o)},getSizeStyles=e=>{let t=core.makeGlobalSize(e?.globalSize);return{...t.width,...t.height,...t.padding}},getTypographyStyles=e=>{let t=core.composeTypographyStyle(e?.typo,e?.typography),o={"--c":t?.["--c"]},r={...t};return delete r["--c"],{textColorStyle:{"--hvr-c":core.getColor(e?.textColor?.hover),...o},withoutTextColorStyles:r}},getTypoStyles=e=>({...getTypographyStyles(e).withoutTextColorStyles,...core.getStyleShadow({styleAppliedFor:"text-shadow",value:e?.typo?.custom?.textShadow,isEnableShadow:e?.typo?.custom?.hasShadowText}),"word-break":"break-word"}),getBgImageUrl=(e,t)=>{let{backgroundImage:o,backgroundColorV2:r}=e||{},s=o?.[t],a=r?.[t];if(!s&&!a)return"";let l=`url(${s?.image?.src})`,n=a?`, ${a}`:"";return a?.includes?.(core.GRADIENT_BGR_KEY)&&s?.image?.src?`${l}${n}`:a?.includes?.(core.GRADIENT_BGR_KEY)&&!s?.image?.src?a:s?.image?.src?l:""},getBackgroundImageSource=e=>{let t={normal:getBgImageUrl(e,"normal"),hover:getBgImageUrl(e,"hover")};return core.makeStyleState("bgi",t)},getBackgroundStyles=e=>{let{backgroundColorV2:t,backgroundImage:o}=e||{},r={...o,hover:o?.hover?.image?o?.hover:o?.normal},s={...t,hover:t?.hover||t?.normal};return{...core.getStyleBackgroundImage(r,{ignoreBackgroundImage:!0}),...getBackgroundImageSource({backgroundImage:r,backgroundColorV2:s}),...core.getGlobalColorStateStyle("bg",s)}},getCustomCssStyles=({styles:e,uid:t,builderAttrs:o,enableHoverEffect:r})=>{if(!t)return"";let{borderBtnV2:s,roundedBtnV2:a}=e??{},l=ignoreStateNoneValue(s||{},'value?.border !== "none"'),n=ignoreStateNoneValue(a||{},"value?.radiusType !== undefined"),g=generateBorderCornerStyles({uid:t,borderBtn:l,roundedBtn:n,builderAttrs:o,enableHoverEffect:r});return`
|
|
2
2
|
${g.normalStyles}
|
|
3
3
|
${g.hoverStyles}
|
|
4
4
|
`.trim()},generateBorderCornerStyles=({uid:e,borderBtn:t,roundedBtn:o,builderAttrs:r,enableHoverEffect:s})=>{let a=r?.["data-component-tag"],l=({styleObj:e,state:t})=>{if(e)return e?.[t]},n=l({styleObj:t,state:"normal"}),g=l({styleObj:s?t:void 0,state:"hover"}),d=l({styleObj:o,state:"normal"}),i=l({styleObj:o,state:"hover"}),u=`
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
[data-id="${e}"].gp-button-base::before, [data-id="${e}-interaction"].gp-button-base::before {
|
|
16
16
|
${u}
|
|
17
17
|
}
|
|
18
|
-
`,
|
|
18
|
+
`,y=`
|
|
19
19
|
[data-id="${e}"]:hover::before, [data-id="${e}-interaction"]:hover::before {
|
|
20
20
|
${core.composeBorderCss(g)}
|
|
21
21
|
${core.composeCornerCss(i)}
|
|
@@ -24,9 +24,9 @@
|
|
|
24
24
|
[data-is-in-stock="${t}"]>.${e}.gp-button-base::before {
|
|
25
25
|
${u}
|
|
26
26
|
}
|
|
27
|
-
`,
|
|
27
|
+
`,y=`
|
|
28
28
|
[data-is-in-stock="${t}"]>.${e}.gp-button-base:hover::before {
|
|
29
29
|
${core.composeBorderCss(g)}
|
|
30
30
|
${core.composeCornerCss(i)}
|
|
31
31
|
}
|
|
32
|
-
`}return{normalStyles:c,hoverStyles:
|
|
32
|
+
`}return{normalStyles:c,hoverStyles:y}};exports.generateBorderCornerStyles=generateBorderCornerStyles,exports.getButtonIconStyles=getButtonIconStyles,exports.getButtonStyles=getButtonStyles,exports.getButtonWrapperStyles=getButtonWrapperStyles,exports.getCustomCssStyles=getCustomCssStyles,exports.getRadiusStyles=getRadiusStyles,exports.getShadowStyles=getShadowStyles,exports.getTypoStyles=getTypoStyles;
|
|
@@ -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"),useProductQuantity=require("./hooks/useProductQuantity.js"),attrs=require("./common/attrs.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),helpers=require("./common/helpers.js");const ProductQuantity=e=>{let{setting:s={},styles:t={},builderProps:r,advanced:a}=e,l=core.useCurrentVariant(),{quantity:n}=core.useQuantity(),{isInStock:u,ref:c,onClickIncrement:o,onClickDecrement:y,onChangeInput:i,onFocusInput:m}=useProductQuantity.useProductQuantity(e),{plusIcon:d,minusIcon:g}=s,j=s.defaultQtyValue||1,{inputHeight:p,buttonBackgroundColor:C,backgroundColor:h,iconColor:x,inputBackgroundColor:S,textColor:b,align:B,borderBtn:I,buttonWidth:f,iconSizeCustom:q,corner:v}=t,A=s?.hasButton,P=system.createAttr({...attrs.getContainerAttrs({isDisabled:!u,uid:r?.uid||""})}),Q=system.createClass({...classes.getContainerClasses(a?.cssClass)}),R=system.createStyle({...styles.getContainerStyles({align:B,inputHeight:p})}),N=system.createClass({...classes.getWrapperClasses()}),H=system.createStyle({...styles.getWrapperStyles({backgroundColor:h,styles:t
|
|
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"),useProductQuantity=require("./hooks/useProductQuantity.js"),attrs=require("./common/attrs.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),helpers=require("./common/helpers.js");const ProductQuantity=e=>{let{setting:s={},styles:t={},builderProps:r,advanced:a}=e,l=core.useCurrentVariant(),{quantity:n}=core.useQuantity(),{isInStock:u,ref:c,onClickIncrement:o,onClickDecrement:y,onChangeInput:i,onFocusInput:m}=useProductQuantity.useProductQuantity(e),{plusIcon:d,minusIcon:g}=s,j=s.defaultQtyValue||1,{inputHeight:p,buttonBackgroundColor:C,backgroundColor:h,iconColor:x,inputBackgroundColor:S,textColor:b,align:B,borderBtn:I,buttonWidth:f,iconSizeCustom:q,corner:v}=t,A=s?.hasButton,P=system.createAttr({...attrs.getContainerAttrs({isDisabled:!u,uid:r?.uid||""})}),Q=system.createClass({...classes.getContainerClasses(a?.cssClass)}),R=system.createStyle({...styles.getContainerStyles({align:B,inputHeight:p})}),N=system.createClass({...classes.getWrapperClasses()}),H=system.createStyle({...styles.getWrapperStyles({backgroundColor:h,styles:t})}),_=system.createAttr({...attrs.getInputAttr({hasButton:A,quantity:n,currentVariant:l,defaultQty:j})}),k=system.createClass({...classes.getInputClasses({styles:t,borderBtn:I,inputBackgroundColor:S,textColor:b,isDisabled:!u})}),D=system.createStyle({...styles.getInputStyle(e)}),M=system.createClass({...classes.getButtonClass({borderBtn:I,buttonBackgroundColor:C,iconColor:x,buttonSide:"left",isDisabled:!u})}),W=system.createStyle({...styles.getButtonStyle({borderBtn:I,buttonWidth:f,buttonBackgroundColor:C,iconColor:x,corner:v,enableHoverButton:s?.enableHoverButton})}),L=system.createAttr({...attrs.getButtonAttrs({buttonSide:"left"})}),T=system.createClass({...classes.getButtonClass({borderBtn:I,buttonBackgroundColor:C,iconColor:x,buttonSide:"right",isDisabled:!u})}),V=system.createStyle({...styles.getButtonStyle({borderBtn:I,buttonWidth:f,buttonBackgroundColor:C,iconColor:x,corner:v,enableHoverButton:s?.enableHoverButton})}),F=system.createAttr({...attrs.getButtonAttrs({buttonSide:"right"})}),O=system.createClass({...classes.getIconWrapperClasses()}),w=system.createStyle({...helpers.getIconWidth(q)});return jsxRuntime.jsx("div",{ref:c,...P,className:Q,style:R,children:jsxRuntime.jsxs("div",{className:N,style:H,children:[system.If(A,jsxRuntime.jsx("button",{...L,onClick:y,className:M,style:W,children:jsxRuntime.jsx("span",{className:O,style:w,dangerouslySetInnerHTML:{__html:helpers.getMinusIcon(g)}})})),jsxRuntime.jsx("input",{..._,className:k,style:D,onChange:e=>i(e),onFocus:e=>m(e)}),system.If(A,jsxRuntime.jsx("button",{...F,onClick:o,className:T,style:V,children:jsxRuntime.jsx("span",{className:O,style:w,dangerouslySetInnerHTML:{__html:helpers.getPlusIcon(d)}})}))]})})};exports.default=ProductQuantity;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers$1=require("../../../helpers.js"),system=require("@gem-sdk/system"),attrs=require("./common/attrs.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),helpers=require("./common/helpers.js");const ProductQuantity=({setting:e={},styles:t={},advanced:s,builderProps:a})=>{let{plusIcon:r,minusIcon:l,updatePrice:n}=e,i=e.defaultQtyValue??1,{inputHeight:c,buttonBackgroundColor:o,iconColor:u,inputBackgroundColor:y,textColor:d,align:p,borderBtn:g,buttonWidth:m,iconSizeCustom:$,corner:f,backgroundColor:b,dividerColor:S,dividerStroke:v}=t,C=e?.hasButton,h=system.createAttr({...attrs.getContainerAttrs({uid:a?.uid||"",isDisableByLiquid:!0})}),q=system.createClass({...classes.getContainerClasses(s?.cssClass)}),B=system.createStyle({...styles.getContainerStyles({align:p,inputHeight:c})}),A=system.createClass({...classes.getWrapperClasses()}),I=system.createStyle({...styles.getWrapperStyles({backgroundColor:b,styles:t
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers$1=require("../../../helpers.js"),system=require("@gem-sdk/system"),attrs=require("./common/attrs.js"),classes=require("./common/classes.js"),styles=require("./common/styles.js"),helpers=require("./common/helpers.js");const ProductQuantity=({setting:e={},styles:t={},advanced:s,builderProps:a})=>{let{plusIcon:r,minusIcon:l,updatePrice:n}=e,i=e.defaultQtyValue??1,{inputHeight:c,buttonBackgroundColor:o,iconColor:u,inputBackgroundColor:y,textColor:d,align:p,borderBtn:g,buttonWidth:m,iconSizeCustom:$,corner:f,backgroundColor:b,dividerColor:S,dividerStroke:v}=t,C=e?.hasButton,h=system.createAttr({...attrs.getContainerAttrs({uid:a?.uid||"",isDisableByLiquid:!0})}),q=system.createClass({...classes.getContainerClasses(s?.cssClass)}),B=system.createStyle({...styles.getContainerStyles({align:p,inputHeight:c})}),A=system.createClass({...classes.getWrapperClasses()}),I=system.createStyle({...styles.getWrapperStyles({backgroundColor:b,styles:t})}),_=system.createAttr({...attrs.getInputAttr({isLiquid:!0,hasButton:C,defaultQty:i})}),j=system.createClass({...classes.getInputClasses({styles:t,borderBtn:g,inputBackgroundColor:y,textColor:d})}),P=system.createStyle({...styles.getInputStyle({setting:e,styles:{...t,borderBtn:g,inputBackgroundColor:y,textColor:d,dividerColor:S,dividerStroke:v}})}),E=system.createClass({...classes.getButtonClass({borderBtn:g,buttonBackgroundColor:o,iconColor:u,buttonSide:"left"})}),R=system.createStyle({...styles.getButtonStyle({borderBtn:g,buttonWidth:m,buttonBackgroundColor:o,iconColor:u,corner:f,enableHoverButton:e?.enableHoverButton})}),k=system.createAttr({...attrs.getButtonAttrs({buttonSide:"left"})}),H=system.createClass({...classes.getButtonClass({borderBtn:g,buttonBackgroundColor:o,iconColor:u,buttonSide:"right"})}),L=system.createStyle({...styles.getButtonStyle({borderBtn:g,buttonWidth:m,buttonBackgroundColor:o,iconColor:u,corner:f,enableHoverButton:e?.enableHoverButton})}),M=system.createAttr({...attrs.getButtonAttrs({buttonSide:"right"})}),W=system.createClass({...classes.getIconWrapperClasses()}),D=helpers.getIconWidth($);return core.template`
|
|
2
2
|
{%- liquid
|
|
3
3
|
assign current_variant = product.selected_or_first_available_variant
|
|
4
4
|
assign available = current_variant.available | default: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core");const getInputClasses=({styles:e,borderBtn:s,inputBackgroundColor:t,textColor:o,isDisabled:l})=>{let
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core");const getInputClasses=({styles:e,borderBtn:s,inputBackgroundColor:t,textColor:o,isDisabled:l})=>{let p="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 focus-visible:gp-shadow-none focus-visible: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),a=core.handleConvertClassColor(s),g=core.getGlobalColorStateClass("bg",t),n=core.getGlobalColorStateClass("text",o);return a&&(p+=` ${a} `),r&&(p+=` ${r} `),g&&(p+=` ${g} `),n&&(p+=` ${n} `),l&&(p+="gp-cursor-not-allowed"),{...core.composeClasses(p)}},getButtonClass=({borderBtn:e,buttonBackgroundColor:s,iconColor:t,buttonSide:o,isDisabled:l})=>{let p=`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-minus":"gp-plus"} `,r=core.handleConvertClassColor(e),a=core.getGlobalColorStateClass("bg",s),g=core.getGlobalColorStateClass("text",t);return r&&(p+=` ${r} `),a&&(p+=` ${a} `),g&&(p+=` ${g} `),{...core.composeClasses(p)}},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 gp-overflow-hidden")}),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");const addPxToValues=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,`${t}px`])),getDividerWidth=(e,t)=>{if(!e||!t)return{};let o=addPxToValues(e),r={...core.makeStyleState("brw",o),...core.makeStyleState("blw",o)};return r},getDividerColorStyle=e=>{if(!e)return{};let t={...e,normal:e?.normal??"transparent"},o={...core.getGlobalColorStateStyle("brc",t),...core.getGlobalColorStateStyle("blc",t)},r=Object.fromEntries(Object.entries(o).filter(([e,t])=>void 0!==t));return r},getInputStyle=e=>{let{styles:t,setting:o}=e,{inputBackgroundColor:r,textColor:l,dividerColor:a,dividerStroke:s,inputBoxShadow:n}=t??{},{enableHoverInput:
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core");const addPxToValues=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,`${t}px`])),getDividerWidth=(e,t)=>{if(!e||!t)return{};let o=addPxToValues(e),r={...core.makeStyleState("brw",o),...core.makeStyleState("blw",o)};return r},getDividerColorStyle=e=>{if(!e)return{};let t={...e,normal:e?.normal??"transparent"},o={...core.getGlobalColorStateStyle("brc",t),...core.getGlobalColorStateStyle("blc",t)},r=Object.fromEntries(Object.entries(o).filter(([e,t])=>void 0!==t));return r},getInputStyle=e=>{let{styles:t,setting:o}=e,{inputBackgroundColor:r,textColor:l,dividerColor:a,dividerStroke:s,inputBoxShadow:n}=t??{},{enableHoverInput:d,hasButton:S}=o??{},c=core.composeTypographyStyle(t?.typo,t?.typography),i=core.getStyleShadowState(n,"box-shadow",{normal:!!n?.normal,hover:!!n?.hover}),p={...getDividerWidth(s,a),...getDividerColorStyle(a)},y={...core.getGlobalColorStateStyle("bg",{...r,normal:r?.normal??"transparent"}),...i,...core.getGlobalColorStateStyle("c",{...l,hover:l?.hover??l?.normal}),...S?p:{}},h=t?.inputBorder,g={...core.handleConvertBorderStyle(h),...core.handleConvertBorderWidth(h),...core.handleConvertBorderColor(h)},b={...S?{}:g,...S?{}:core.composeRadiusResponsive(t?.shapeRounded),...core.makeStyle({}),...c,...y,...core.getStyleShadow({value:t?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:t?.typo?.custom?.hasShadowText})};return d?b:core.filterHoverVariables(b)},getButtonStyle=({borderBtn:e,buttonWidth:t,buttonBackgroundColor:o,iconColor:r,corner:l,enableHoverButton:a})=>{let s={...core.makeStyleResponsive("w",t),...core.handleConvertBorderStyle(e),...core.handleConvertBorderWidth(e),...core.handleConvertBorderColor(e),...core.getGlobalColorStateStyle("bg",o),...core.getGlobalColorStateStyle("c",r),...core.composeRadius(l)};return a?s:core.filterHoverVariables(s)},getContainerStyles=({inputHeight:e,align:t})=>({...core.makeStyleResponsive("h",e),...core.makeStyleResponsive("jc",t)}),getWrapperStyles=({backgroundColor:e,styles:t})=>{let o=t?.shapeShadow,r=core.getResponsiveStyleShadowWithoutState(o,"box-shadow",{desktop:o?.desktop??{},tablet:o?.tablet??o?.desktop??{},mobile:o?.mobile??o?.tablet??o?.desktop??{}});return{...core.getGlobalColorResponsiveStyle("bg",e),...core.makeStyleResponsive("maxw",t?.quantityWidth),...core.composeBorderResponsive(t?.shapeBorder),...core.composeRadiusResponsive(t?.shapeRounded),...r}};exports.getButtonStyle=getButtonStyle,exports.getContainerStyles=getContainerStyles,exports.getInputStyle=getInputStyle,exports.getWrapperStyles=getWrapperStyles;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
"use strict";const ProductQuantitySettings=[{id:"setting",controls:[{id:"updatePrice",label:"Update price",type:"toggle",default:!0},{id:"hasButton",label:"Button",type:"toggle",default:!0},{id:"defaultQtyValue",label:"Text",type:"input:stepper",min:1,default:1},{id:"plusIcon",type:"icon",isHideClear:!0,customLabel:"Plus",info:"Choose from list or paste any SVG icon",default:`<svg height="20px" width="20px" data-name="plus-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817698760687976">
|
|
2
2
|
<path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"></path></svg>`},{id:"minusIcon",type:"icon",isHideClear:!0,customLabel:"Minus",info:"Choose from list or paste any SVG icon",default:`<svg height="20px" width="20px" data-name="minus-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817690725712232">
|
|
3
|
-
<path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"></path></svg>`},{id:"enableHoverInput",label:"Enable hover input",type:"toggle",default:!1},{id:"enableHoverButton",label:"Enable hover input",type:"toggle",default:!1}]},{id:"style",controls:[{id:"quantityLayout",label:"Style",type:"layout-selector",popoverLabel:{en:"Style"},iconViewBox:"0 0 80 48",enableItemBackground:!0,itemPerRow:2,itemSpacing:"large",options:[{label:"Square",value:"product-quantity-square",type:"p-quantity-layout",iconName:"gp-product-quantity-square"},{label:"Square with divider",value:"product-quantity-square-divider",type:"p-quantity-layout",iconName:"gp-product-quantity-square-divider"},{label:"Rounded",value:"product-quantity-rounded",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded"},{label:"Rounded with divider",value:"product-quantity-rounded-divider",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded-divider"},{label:"Square input only",value:"product-quantity-square-input-only",type:"p-quantity-layout",iconName:"gp-product-quantity-square-input-only"},{label:"Rounded input only",value:"product-quantity-rounded-input-only",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded-input-only"}],default:"product-quantity-square"},{id:"dimensions",type:"group",label:"Dimensions",controls:[{id:"fullWidth",label:"Full Width",type:"toggle",devices:{desktop:{default:!1}}},{id:"quantityWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"160px"}}},{id:"inputHeight",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"45px"}}},{id:"buttonWidth",type:"dropdown:input",label:"Button Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"45px"}}},{id:"iconSizeCustom",type:"input:stepper",includeUnit:"px",min:1,devices:{desktop:{default:"16px"}}}]},{id:"inputStyle",type:"group",label:"Input Style",controls:[{id:"typo",type:"typography-combo",default:{type:"paragraph-1",attrs:{color:"#121212"},custom:{fontSize:{desktop:"16px",tablet:"16px",mobile:"14px"},lineHeight:{desktop:"120%",tablet:"180%",mobile:"180%"},fontWeight:"400",fontFamily:{value:"Assistant",type:"google"},hasShadowText:!1,textShadow:{enable:!1}}},ignoreReRender:!0,hiddenSetting:{transform:!0,textAlign:!0}},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"right",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],devices:{desktop:{default:"left"}}}]},{id:"button-behavior-state",type:"behavior-state",label:"Button Style",hide:!0,controls:[{id:"textColor",type:"color-picker-v2",label:"Text Color",default:{normal:"text-2"},compoDefaultValue:{hover:"text-2"},state:{hover:!0,normal:!0},enableGradient:!0},{id:"inputBackgroundColor",type:"color-picker-v2",label:"Background Color",state:{hover:!0,normal:!0},compoDefaultValue:{normal:"highlight",hover:"highlight"},enableGradient:!0},{id:"buttonBackgroundColor",type:"color-picker-v2",label:"Button Background Color",state:{hover:!0,normal:!0},enableGradient:!0,compoDefaultValue:{normal:"brand",hover:"highlight"}},{id:"iconColor",type:"color-picker-v2",label:"Icon Color",default:{normal:"#121212"},compoDefaultValue:{hover:"text-2"},state:{hover:!0,normal:!0},enableGradient:!0}]},{id:"borderBtn",label:"Border",type:"border-v2",default:{normal:{}},compoDefaultValue:{normal:{border:"solid",color:"#212121",width:"1px",borderWidth:"1px"},hover:{border:"solid",color:"#212121",width:"1px",borderWidth:"1px"}},state:{hover:!0,normal:!0}},{id:"corner",label:"Corner",type:"corner-v2",default:{normal:{btrr:"0px",bblr:"0px",bbrr:"0px",btlr:"0px",radiusType:"none"}}},{id:"inputBoxShadow",type:"shadow-v2",default:{normal:{}},compoDefaultValue:{normal:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"#121212",angle:90}}},{id:"backgroundColor",type:"color-picker-v2",label:"Background Color",devices:{desktop:{default:"#FFFFFF"}},enableGradient:!0},{id:"dividerColor",type:"color-picker-v2",label:"Divider Color",default:{normal:"line-3"},compoDefaultValue:{normal:"line-3"},state:{hover:!0,normal:!0},enableGradient:!0},{id:"dividerStroke",label:"Thickness",type:"input:stepper",min:1,default:{normal:1
|
|
3
|
+
<path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"></path></svg>`},{id:"enableHoverInput",label:"Enable hover input",type:"toggle",default:!1},{id:"enableHoverButton",label:"Enable hover input",type:"toggle",default:!1}]},{id:"style",controls:[{id:"quantityLayout",label:"Style",type:"layout-selector",popoverLabel:{en:"Style"},iconViewBox:"0 0 80 48",enableItemBackground:!0,itemPerRow:2,itemSpacing:"large",options:[{label:"Square",value:"product-quantity-square",type:"p-quantity-layout",iconName:"gp-product-quantity-square"},{label:"Square with divider",value:"product-quantity-square-divider",type:"p-quantity-layout",iconName:"gp-product-quantity-square-divider"},{label:"Rounded",value:"product-quantity-rounded",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded"},{label:"Rounded with divider",value:"product-quantity-rounded-divider",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded-divider"},{label:"Square input only",value:"product-quantity-square-input-only",type:"p-quantity-layout",iconName:"gp-product-quantity-square-input-only"},{label:"Rounded input only",value:"product-quantity-rounded-input-only",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded-input-only"}],default:"product-quantity-square"},{id:"dimensions",type:"group",label:"Dimensions",controls:[{id:"fullWidth",label:"Full Width",type:"toggle",devices:{desktop:{default:!1}}},{id:"quantityWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"160px"}}},{id:"inputHeight",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"45px"}}},{id:"buttonWidth",type:"dropdown:input",label:"Button Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"45px"}}},{id:"iconSizeCustom",type:"input:stepper",includeUnit:"px",min:1,devices:{desktop:{default:"16px"}}}]},{id:"inputStyle",type:"group",label:"Input Style",controls:[{id:"typo",type:"typography-combo",default:{type:"paragraph-1",attrs:{color:"#121212"},custom:{fontSize:{desktop:"16px",tablet:"16px",mobile:"14px"},lineHeight:{desktop:"120%",tablet:"180%",mobile:"180%"},fontWeight:"400",fontFamily:{value:"Assistant",type:"google"},hasShadowText:!1,textShadow:{enable:!1}}},ignoreReRender:!0,hiddenSetting:{transform:!0,textAlign:!0}},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"right",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],devices:{desktop:{default:"left"}}}]},{id:"button-behavior-state",type:"behavior-state",label:"Button Style",hide:!0,controls:[{id:"textColor",type:"color-picker-v2",label:"Text Color",default:{normal:"text-2"},compoDefaultValue:{hover:"text-2"},state:{hover:!0,normal:!0},enableGradient:!0},{id:"inputBackgroundColor",type:"color-picker-v2",label:"Background Color",state:{hover:!0,normal:!0},compoDefaultValue:{normal:"highlight",hover:"highlight"},enableGradient:!0},{id:"buttonBackgroundColor",type:"color-picker-v2",label:"Button Background Color",state:{hover:!0,normal:!0},enableGradient:!0,compoDefaultValue:{normal:"brand",hover:"highlight"}},{id:"iconColor",type:"color-picker-v2",label:"Icon Color",default:{normal:"#121212"},compoDefaultValue:{hover:"text-2"},state:{hover:!0,normal:!0},enableGradient:!0}]},{id:"borderBtn",label:"Border",type:"border-v2",default:{normal:{}},compoDefaultValue:{normal:{border:"solid",color:"#212121",width:"1px",borderWidth:"1px"},hover:{border:"solid",color:"#212121",width:"1px",borderWidth:"1px"}},state:{hover:!0,normal:!0}},{id:"corner",label:"Corner",type:"corner-v2",default:{normal:{btrr:"0px",bblr:"0px",bbrr:"0px",btlr:"0px",radiusType:"none"}}},{id:"inputBoxShadow",type:"shadow-v2",default:{normal:{}},compoDefaultValue:{normal:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"#121212",angle:90}}},{id:"backgroundColor",type:"color-picker-v2",label:"Background Color",devices:{desktop:{default:"#FFFFFF"}},enableGradient:!0},{id:"dividerColor",type:"color-picker-v2",label:"Divider Color",default:{normal:"line-3"},compoDefaultValue:{normal:"line-3"},state:{hover:!0,normal:!0},enableGradient:!0},{id:"dividerStroke",label:"Thickness",type:"input:stepper",min:1,default:{normal:1},state:{hover:!0,normal:!0}},{id:"inputBorder",label:"Input Border",type:"border-v2",default:{hover:{}},state:{hover:!0,normal:!0}},{id:"shapeBorder",type:"border-v2",devices:{desktop:{default:{border:"solid",color:"line-3",width:"1px",borderWidth:"1px"}}}},{id:"shapeRounded",type:"corner-v2",devices:{desktop:{default:{radiusType:"none"}}}},{id:"shapeShadow",type:"shadow-v2",devices:{desktop:{default:{}}},compoDefaultValue:{desktop:{default:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"rgba(18, 18, 18, 0.20)",angle:45,enable:!0}}}}]}];exports.ProductQuantitySettings=ProductQuantitySettings;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const SettingUIV2=[{controls:[{label:{en:"Button"},setting:{id:"hasButton"},options:{labelVariant:"primary",toggleStyle:"switch"}},{label:{en:"Width"},setting:{id:"buttonWidth"},conditionDisplay:"hasButton === true"},{label:{en:"Background"},setting:{id:"buttonBackgroundColor",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Plus icon"},setting:{id:"plusIcon"},conditionDisplay:"hasButton === true"},{label:{en:"Minus icon"},setting:{id:"minusIcon"},conditionDisplay:"hasButton === true"},{label:{en:"Icon color"},setting:{id:"iconColor",state:"normal"},conditionDisplay:"hasButton === true"}],moreSettings:{type:"collapse",controls:[{label:{en:"Icon size"},setting:{id:"iconSizeCustom"},conditionDisplay:"hasButton === true"},{label:{en:"Border"},setting:{id:"borderBtn",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Corner"},setting:{id:"corner",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Hover"},type:"combo",iconName:"polaris-check-clicked",fixedValue:"Styled",setting:{id:"enableHoverButton"},popoverLabel:{en:"Hover effect"},state:"hover",conditionDisplay:"hasButton === true",controls:[{label:{en:"Background"},setting:{id:"buttonBackgroundColor",state:"hover"},compoDefaultValue:{default:"highlight"}},{label:{en:"Icon color"},setting:{id:"iconColor",state:"hover"}},{label:{en:"Border"},setting:{id:"borderBtn",state:"hover"}},{label:{en:"Corner"},setting:{id:"corner",state:"hover"}}]}]}},{label:{en:"Input"},controls:[{label:{en:"Background"},setting:{id:"inputBackgroundColor",state:"normal"}},{label:{en:"Text style"},setting:{id:"typo"},options:{updateFields:[{field:"attrs.color",settingId:"textColor",state:"normal"}]},controlChangeTrigger:{settings:[{action:{controlId:"textColor",valueFromField:"attrs.color",groupType:"style",controlType:"style",removeDevice:!0,state:"normal"}}],options:{noRecordHistory:!0}}},{label:{en:"Divider"},type:"combo",conditionDisplay:"hasButton === true",comboType:"color",getValueFromSettingID:"dividerColor.normal",compoDefaultValue:"line-3",controls:[{label:{en:"Color"},setting:{id:"dividerColor",state:"normal"}},{label:{en:"Thickness"},setting:{id:"dividerStroke",state:"normal"}}]},{label:{en:"Shadow"},setting:{id:"inputBoxShadow",state:"normal"}},{label:{en:"Hover"},type:"combo",iconName:"polaris-check-clicked",fixedValue:"Styled",popoverLabel:{en:"Hover effect"},setting:{id:"enableHoverInput"},state:"hover",controls:[{label:{en:"Background"},setting:{id:"inputBackgroundColor",state:"hover"}},{label:{en:"Text color"},setting:{id:"textColor",state:"hover"}},{label:{en:"Divider
|
|
1
|
+
"use strict";const SettingUIV2=[{controls:[{label:{en:"Button"},setting:{id:"hasButton"},options:{labelVariant:"primary",toggleStyle:"switch"}},{label:{en:"Width"},setting:{id:"buttonWidth"},conditionDisplay:"hasButton === true"},{label:{en:"Background"},setting:{id:"buttonBackgroundColor",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Plus icon"},setting:{id:"plusIcon"},conditionDisplay:"hasButton === true"},{label:{en:"Minus icon"},setting:{id:"minusIcon"},conditionDisplay:"hasButton === true"},{label:{en:"Icon color"},setting:{id:"iconColor",state:"normal"},conditionDisplay:"hasButton === true"}],moreSettings:{type:"collapse",controls:[{label:{en:"Icon size"},setting:{id:"iconSizeCustom"},conditionDisplay:"hasButton === true"},{label:{en:"Border"},setting:{id:"borderBtn",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Corner"},setting:{id:"corner",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Hover"},type:"combo",iconName:"polaris-check-clicked",fixedValue:"Styled",setting:{id:"enableHoverButton"},popoverLabel:{en:"Hover effect"},state:"hover",conditionDisplay:"hasButton === true",controls:[{label:{en:"Background"},setting:{id:"buttonBackgroundColor",state:"hover"},compoDefaultValue:{default:"highlight"}},{label:{en:"Icon color"},setting:{id:"iconColor",state:"hover"}},{label:{en:"Border"},setting:{id:"borderBtn",state:"hover"}},{label:{en:"Corner"},setting:{id:"corner",state:"hover"}}]}]}},{label:{en:"Input"},controls:[{label:{en:"Background"},setting:{id:"inputBackgroundColor",state:"normal"}},{label:{en:"Text style"},setting:{id:"typo"},options:{updateFields:[{field:"attrs.color",settingId:"textColor",state:"normal"}]},controlChangeTrigger:{settings:[{action:{controlId:"textColor",valueFromField:"attrs.color",groupType:"style",controlType:"style",removeDevice:!0,state:"normal"}}],options:{noRecordHistory:!0}}},{label:{en:"Divider"},type:"combo",conditionDisplay:"hasButton === true",comboType:"color",getValueFromSettingID:"dividerColor.normal",compoDefaultValue:"line-3",controls:[{label:{en:"Color"},setting:{id:"dividerColor",state:"normal"}},{label:{en:"Thickness"},setting:{id:"dividerStroke",state:"normal"}}]},{label:{en:"Border"},setting:{id:"inputBorder",state:"normal"},conditionDisplay:"hasButton === false"},{label:{en:"Shadow"},setting:{id:"inputBoxShadow",state:"normal"}},{label:{en:"Hover"},type:"combo",iconName:"polaris-check-clicked",fixedValue:"Styled",popoverLabel:{en:"Hover effect"},setting:{id:"enableHoverInput"},state:"hover",controls:[{label:{en:"Background"},setting:{id:"inputBackgroundColor",state:"hover"}},{label:{en:"Text color"},setting:{id:"textColor",state:"hover"}},{label:{en:"Divider"},setting:{id:"dividerColor",state:"hover"},conditionDisplay:"hasButton === true"},{label:{en:"Divider thickness"},setting:{id:"dividerStroke",state:"hover"},conditionDisplay:"hasButton === true"},{label:{en:"Border"},setting:{id:"inputBorder",state:"hover"},conditionDisplay:"hasButton === false"},{label:{en:"Shadow"},setting:{id:"inputBoxShadow",state:"hover"}}]}]},{label:{en:"Size"},controls:[{label:{en:"Width"},setting:{id:"quantityWidth"}},{label:{en:"Height"},setting:{id:"inputHeight"}}]},{label:{en:"Background"},controls:[{label:{en:"Color"},setting:{id:"backgroundColor"}}]},{label:{en:"Shape"},controls:[{label:{en:"Border"},setting:{id:"shapeBorder"}},{label:{en:"Corner"},setting:{id:"shapeRounded"}},{label:{en:"Shadow"},setting:{id:"shapeShadow"}}]},{label:{en:"Display condition"},controls:[{label:{en:"Default quantity"},setting:{id:"defaultQtyValue"}},{label:{en:"Update price"},setting:{id:"updatePrice"}}]},{controls:[{label:{en:"Align"},conditionEnable:'!(parseInt(quantityWidth) >= 100 && quantityWidth?.includes("%"))',setting:{id:"align"},options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Align is not supported when width is 100%"}}]}];exports.SettingUIV2=SettingUIV2;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import{makeStyleResponsive,filterHoverVariables,getStyleShadowState,composeRadius,makeGlobalSize,composeTypographyStyle,getColor,getStyleShadow,getStyleBackgroundImage,getGlobalColorStateStyle,makeStyleState,composeBorderCss,composeCornerCss,GRADIENT_BGR_KEY}from"@gem-sdk/core";let getButtonWrapperStyles=(e,t)=>({...e,...makeStyleResponsive("ta",t?.align)}),getButtonStyles=(e,t)=>{let o={...getSizeStyles(e),...getRadiusStyles(e),...getShadowStyles(e),...getBackgroundStyles(e),...getTypographyStyles(e).textColorStyle};return t?o:filterHoverVariables(o)},getButtonIconStyles=(e,t)=>({...getIconSpacingStyle(e,t),"--height-desktop":`${e?.size?.desktop}`,"--height-tablet":`${e?.size?.desktop||e?.size?.tablet}`,"--height-mobile":`${e?.size?.mobile||e?.size?.tablet||e?.size?.desktop}`}),ignoreStateNoneValue=(obj,condition)=>Object.entries(obj).reduce((acc,[key,value])=>((!["hover","focus","normal","active"].includes(key)||eval(condition))&&(acc[key]=value),acc),{}),getShadowStyles=e=>{let{boxShadowBtn:t,hasBoxShadowBtn:o}=e||{},r=ignoreStateNoneValue(t||{},"value?.type !== undefined ");return{...getStyleShadowState(r,"box-shadow",o)}},getRadiusStyles=e=>{let t=ignoreStateNoneValue(e?.roundedBtnV2||{},"value?.radiusType !== undefined");return composeRadius(t)},getIconSpacingStyle=(e,t)=>{let o=e?.iconSpacing||{desktop:"8px"};return t?.iconAlign==="left"?makeStyleResponsive("mr",o):makeStyleResponsive("ml",o)},getSizeStyles=e=>{let t=makeGlobalSize(e?.globalSize);return{...t.width,...t.height,...t.padding}},getTypographyStyles=e=>{let t=composeTypographyStyle(e?.typo,e?.typography),o={"--c":t?.["--c"]},r={...t};return delete r["--c"],{textColorStyle:{"--hvr-c":getColor(e?.textColor?.hover),...o},withoutTextColorStyles:r}},getTypoStyles=e=>({...getTypographyStyles(e).withoutTextColorStyles,...getStyleShadow({styleAppliedFor:"text-shadow",value:e?.typo?.custom?.textShadow,isEnableShadow:e?.typo?.custom?.hasShadowText}),"word-break":"break-word"}),getBgImageUrl=(e,t)=>{let{backgroundImage:o,backgroundColorV2:r}=e||{},a=o?.[t],n=r?.[t];if(!a&&!n)return"";let l=`url(${a?.image?.src})`,s=n?`, ${n}`:"";return n?.includes?.(GRADIENT_BGR_KEY)&&a?.image?.src?`${l}${s}`:n?.includes?.(GRADIENT_BGR_KEY)&&!a?.image?.src?n:a?.image?.src?l:""},getBackgroundImageSource=e=>{let t={normal:getBgImageUrl(e,"normal"),hover:getBgImageUrl(e,"hover")};return makeStyleState("bgi",t)},getBackgroundStyles=e=>{let{backgroundColorV2:t,backgroundImage:o}=e||{},r={...o,hover:o?.hover?.image?o?.hover:o?.normal},a={...t,hover:t?.hover||t?.normal};return{...getStyleBackgroundImage(r,{ignoreBackgroundImage:!0}),...getBackgroundImageSource({backgroundImage:r,backgroundColorV2:a}),...getGlobalColorStateStyle("bg",a)}},getCustomCssStyles=({styles:e,uid:t,builderAttrs:o,enableHoverEffect:r})=>{if(!t)return"";let{borderBtnV2:a,roundedBtnV2:n}=e??{},l=ignoreStateNoneValue(a||{},'value?.border !== "none"'),s=ignoreStateNoneValue(n||{},"value?.radiusType !== undefined"),g=generateBorderCornerStyles({uid:t,borderBtn:l,roundedBtn:s,builderAttrs:o,enableHoverEffect:r});return`
|
|
1
|
+
import{makeStyleResponsive,filterHoverVariables,getStyleShadowState,composeRadius,makeGlobalSize,composeTypographyStyle,getColor,getStyleShadow,getStyleBackgroundImage,getGlobalColorStateStyle,makeStyleState,composeBorderCss,composeCornerCss,GRADIENT_BGR_KEY}from"@gem-sdk/core";let getButtonWrapperStyles=(e,t)=>({...e,...makeStyleResponsive("ta",t?.align)}),getButtonStyles=(e,t)=>{let o={...getSizeStyles(e),...getRadiusStyles(e),...getShadowStyles(e),...getBackgroundStyles(e),...getTypographyStyles(e).textColorStyle,...getTypographyStyles(e).withoutTextColorStyles};return t?o:filterHoverVariables(o)},getButtonIconStyles=(e,t)=>({...getIconSpacingStyle(e,t),"--height-desktop":`${e?.size?.desktop}`,"--height-tablet":`${e?.size?.desktop||e?.size?.tablet}`,"--height-mobile":`${e?.size?.mobile||e?.size?.tablet||e?.size?.desktop}`}),ignoreStateNoneValue=(obj,condition)=>Object.entries(obj).reduce((acc,[key,value])=>((!["hover","focus","normal","active"].includes(key)||eval(condition))&&(acc[key]=value),acc),{}),getShadowStyles=e=>{let{boxShadowBtn:t,hasBoxShadowBtn:o}=e||{},r=ignoreStateNoneValue(t||{},"value?.type !== undefined ");return{...getStyleShadowState(r,"box-shadow",o)}},getRadiusStyles=e=>{let t=ignoreStateNoneValue(e?.roundedBtnV2||{},"value?.radiusType !== undefined");return composeRadius(t)},getIconSpacingStyle=(e,t)=>{let o=e?.iconSpacing||{desktop:"8px"};return t?.iconAlign==="left"?makeStyleResponsive("mr",o):makeStyleResponsive("ml",o)},getSizeStyles=e=>{let t=makeGlobalSize(e?.globalSize);return{...t.width,...t.height,...t.padding}},getTypographyStyles=e=>{let t=composeTypographyStyle(e?.typo,e?.typography),o={"--c":t?.["--c"]},r={...t};return delete r["--c"],{textColorStyle:{"--hvr-c":getColor(e?.textColor?.hover),...o},withoutTextColorStyles:r}},getTypoStyles=e=>({...getTypographyStyles(e).withoutTextColorStyles,...getStyleShadow({styleAppliedFor:"text-shadow",value:e?.typo?.custom?.textShadow,isEnableShadow:e?.typo?.custom?.hasShadowText}),"word-break":"break-word"}),getBgImageUrl=(e,t)=>{let{backgroundImage:o,backgroundColorV2:r}=e||{},a=o?.[t],n=r?.[t];if(!a&&!n)return"";let l=`url(${a?.image?.src})`,s=n?`, ${n}`:"";return n?.includes?.(GRADIENT_BGR_KEY)&&a?.image?.src?`${l}${s}`:n?.includes?.(GRADIENT_BGR_KEY)&&!a?.image?.src?n:a?.image?.src?l:""},getBackgroundImageSource=e=>{let t={normal:getBgImageUrl(e,"normal"),hover:getBgImageUrl(e,"hover")};return makeStyleState("bgi",t)},getBackgroundStyles=e=>{let{backgroundColorV2:t,backgroundImage:o}=e||{},r={...o,hover:o?.hover?.image?o?.hover:o?.normal},a={...t,hover:t?.hover||t?.normal};return{...getStyleBackgroundImage(r,{ignoreBackgroundImage:!0}),...getBackgroundImageSource({backgroundImage:r,backgroundColorV2:a}),...getGlobalColorStateStyle("bg",a)}},getCustomCssStyles=({styles:e,uid:t,builderAttrs:o,enableHoverEffect:r})=>{if(!t)return"";let{borderBtnV2:a,roundedBtnV2:n}=e??{},l=ignoreStateNoneValue(a||{},'value?.border !== "none"'),s=ignoreStateNoneValue(n||{},"value?.radiusType !== undefined"),g=generateBorderCornerStyles({uid:t,borderBtn:l,roundedBtn:s,builderAttrs:o,enableHoverEffect:r});return`
|
|
2
2
|
${g.normalStyles}
|
|
3
3
|
${g.hoverStyles}
|
|
4
|
-
`.trim()},generateBorderCornerStyles=({uid:e,borderBtn:t,roundedBtn:o,builderAttrs:r,enableHoverEffect:a})=>{let n=r?.["data-component-tag"],l=({styleObj:e,state:t})=>{if(e)return e?.[t]},s=l({styleObj:t,state:"normal"}),g=l({styleObj:a?t:void 0,state:"hover"}),
|
|
4
|
+
`.trim()},generateBorderCornerStyles=({uid:e,borderBtn:t,roundedBtn:o,builderAttrs:r,enableHoverEffect:a})=>{let n=r?.["data-component-tag"],l=({styleObj:e,state:t})=>{if(e)return e?.[t]},s=l({styleObj:t,state:"normal"}),g=l({styleObj:a?t:void 0,state:"hover"}),i=l({styleObj:o,state:"normal"}),d=l({styleObj:o,state:"hover"}),u=`
|
|
5
5
|
content: "";
|
|
6
6
|
height: 100%;
|
|
7
7
|
width: 100%;
|
|
@@ -10,7 +10,7 @@ import{makeStyleResponsive,filterHoverVariables,getStyleShadowState,composeRadiu
|
|
|
10
10
|
top: 0;
|
|
11
11
|
left: 0;
|
|
12
12
|
${composeBorderCss(s)}
|
|
13
|
-
${composeCornerCss(
|
|
13
|
+
${composeCornerCss(i)}
|
|
14
14
|
`,y=`
|
|
15
15
|
[data-id="${e}"].gp-button-base::before, [data-id="${e}-interaction"].gp-button-base::before {
|
|
16
16
|
${u}
|
|
@@ -18,7 +18,7 @@ import{makeStyleResponsive,filterHoverVariables,getStyleShadowState,composeRadiu
|
|
|
18
18
|
`,S=`
|
|
19
19
|
[data-id="${e}"]:hover::before, [data-id="${e}-interaction"]:hover::before {
|
|
20
20
|
${composeBorderCss(g)}
|
|
21
|
-
${composeCornerCss(
|
|
21
|
+
${composeCornerCss(d)}
|
|
22
22
|
}
|
|
23
23
|
`;if("ProductButton"===n){let t=r?.["data-is-in-stock"]??!1;y=`
|
|
24
24
|
[data-is-in-stock="${t}"]>.${e}.gp-button-base::before {
|
|
@@ -27,6 +27,6 @@ import{makeStyleResponsive,filterHoverVariables,getStyleShadowState,composeRadiu
|
|
|
27
27
|
`,S=`
|
|
28
28
|
[data-is-in-stock="${t}"]>.${e}.gp-button-base:hover::before {
|
|
29
29
|
${composeBorderCss(g)}
|
|
30
|
-
${composeCornerCss(
|
|
30
|
+
${composeCornerCss(d)}
|
|
31
31
|
}
|
|
32
32
|
`}return{normalStyles:y,hoverStyles:S}};export{generateBorderCornerStyles,getButtonIconStyles,getButtonStyles,getButtonWrapperStyles,getCustomCssStyles,getRadiusStyles,getShadowStyles,getTypoStyles};
|
|
@@ -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 l,createClass as n,createStyle as r,If as a}from"@gem-sdk/system";import{useProductQuantity as i}from"./hooks/useProductQuantity.js";import{getContainerAttrs as m,getInputAttr as u,getButtonAttrs as c}from"./common/attrs.js";import{getContainerClasses as d,getWrapperClasses as y,getInputClasses as b,getButtonClass as f,getIconWrapperClasses as h}from"./common/classes.js";import{getContainerStyles as p,getWrapperStyles as g,getInputStyle as N,getButtonStyle as j}from"./common/styles.js";import{getIconWidth as v,getMinusIcon as B,getPlusIcon as H}from"./common/helpers.js";let ProductQuantity=S=>{let{setting:k={},styles:C={},builderProps:D,advanced:Q}=S,_=s(),{quantity:P}=o(),{isInStock:x,ref:I,onClickIncrement:L,onClickDecrement:M,onChangeInput:T,onFocusInput:F}=i(S),{plusIcon:V,minusIcon:q}=k,w=k.defaultQtyValue||1,{inputHeight:z,buttonBackgroundColor:A,backgroundColor:E,iconColor:G,inputBackgroundColor:J,textColor:K,align:O,borderBtn:R,buttonWidth:U,iconSizeCustom:W,corner:X}=C,Y=k?.hasButton,Z=l({...m({isDisabled:!x,uid:D?.uid||""})}),$=n({...d(Q?.cssClass)}),tt=r({...p({align:O,inputHeight:z})}),te=n({...y()}),ts=r({...g({backgroundColor:E,styles:C
|
|
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 l,createClass as n,createStyle as r,If as a}from"@gem-sdk/system";import{useProductQuantity as i}from"./hooks/useProductQuantity.js";import{getContainerAttrs as m,getInputAttr as u,getButtonAttrs as c}from"./common/attrs.js";import{getContainerClasses as d,getWrapperClasses as y,getInputClasses as b,getButtonClass as f,getIconWrapperClasses as h}from"./common/classes.js";import{getContainerStyles as p,getWrapperStyles as g,getInputStyle as N,getButtonStyle as j}from"./common/styles.js";import{getIconWidth as v,getMinusIcon as B,getPlusIcon as H}from"./common/helpers.js";let ProductQuantity=S=>{let{setting:k={},styles:C={},builderProps:D,advanced:Q}=S,_=s(),{quantity:P}=o(),{isInStock:x,ref:I,onClickIncrement:L,onClickDecrement:M,onChangeInput:T,onFocusInput:F}=i(S),{plusIcon:V,minusIcon:q}=k,w=k.defaultQtyValue||1,{inputHeight:z,buttonBackgroundColor:A,backgroundColor:E,iconColor:G,inputBackgroundColor:J,textColor:K,align:O,borderBtn:R,buttonWidth:U,iconSizeCustom:W,corner:X}=C,Y=k?.hasButton,Z=l({...m({isDisabled:!x,uid:D?.uid||""})}),$=n({...d(Q?.cssClass)}),tt=r({...p({align:O,inputHeight:z})}),te=n({...y()}),ts=r({...g({backgroundColor:E,styles:C})}),to=l({...u({hasButton:Y,quantity:P,currentVariant:_,defaultQty:w})}),tl=n({...b({styles:C,borderBtn:R,inputBackgroundColor:J,textColor:K,isDisabled:!x})}),tn=r({...N(S)}),tr=n({...f({borderBtn:R,buttonBackgroundColor:A,iconColor:G,buttonSide:"left",isDisabled:!x})}),ta=r({...j({borderBtn:R,buttonWidth:U,buttonBackgroundColor:A,iconColor:G,corner:X,enableHoverButton:k?.enableHoverButton})}),ti=l({...c({buttonSide:"left"})}),tm=n({...f({borderBtn:R,buttonBackgroundColor:A,iconColor:G,buttonSide:"right",isDisabled:!x})}),tu=r({...j({borderBtn:R,buttonWidth:U,buttonBackgroundColor:A,iconColor:G,corner:X,enableHoverButton:k?.enableHoverButton})}),tc=l({...c({buttonSide:"right"})}),td=n({...h()}),ty=r({...v(W)});return t("div",{ref:I,...Z,className:$,style:tt,children:e("div",{className:te,style:ts,children:[a(Y,t("button",{...ti,onClick:M,className:tr,style:ta,children:t("span",{className:td,style:ty,dangerouslySetInnerHTML:{__html:B(q)}})})),t("input",{...to,className:tl,style:tn,onChange:t=>T(t),onFocus:t=>F(t)}),a(Y,t("button",{...tc,onClick:L,className:tm,style:tu,children:t("span",{className:td,style:ty,dangerouslySetInnerHTML:{__html:H(V)}})}))]})})};export{ProductQuantity as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{template as t,RenderIf as s,isLocalEnv as e,baseAssetURL as a}from"@gem-sdk/core";import{getSettingPreloadData as i}from"../../../helpers.js";import{createAttr as l,createClass as r,createStyle as o}from"@gem-sdk/system";import{getContainerAttrs as n,getInputAttr as u,getButtonAttrs as d}from"./common/attrs.js";import{getContainerClasses as c,getWrapperClasses as p,getInputClasses as f,getButtonClass as m,getIconWrapperClasses as $}from"./common/classes.js";import{getContainerStyles as b,getWrapperStyles as y,getInputStyle as v,getButtonStyle as g}from"./common/styles.js";import{getIconWidth as S,getMinusIcon as _,getPlusIcon as h}from"./common/helpers.js";let ProductQuantity=({setting:j={},styles:q={},advanced:B,builderProps:k})=>{let{plusIcon:E,minusIcon:H,updatePrice:P}=j,Q=j.defaultQtyValue??1,{inputHeight:A,buttonBackgroundColor:G,iconColor:L,inputBackgroundColor:M,textColor:V,align:x,borderBtn:C,buttonWidth:D,iconSizeCustom:I,corner:N,backgroundColor:O,dividerColor:R,dividerStroke:T}=q,w=j?.hasButton,z=l({...n({uid:k?.uid||"",isDisableByLiquid:!0})}),F=r({...c(B?.cssClass)}),J=o({...b({align:x,inputHeight:A})}),K=r({...p()}),U=o({...y({backgroundColor:O,styles:q
|
|
1
|
+
import{template as t,RenderIf as s,isLocalEnv as e,baseAssetURL as a}from"@gem-sdk/core";import{getSettingPreloadData as i}from"../../../helpers.js";import{createAttr as l,createClass as r,createStyle as o}from"@gem-sdk/system";import{getContainerAttrs as n,getInputAttr as u,getButtonAttrs as d}from"./common/attrs.js";import{getContainerClasses as c,getWrapperClasses as p,getInputClasses as f,getButtonClass as m,getIconWrapperClasses as $}from"./common/classes.js";import{getContainerStyles as b,getWrapperStyles as y,getInputStyle as v,getButtonStyle as g}from"./common/styles.js";import{getIconWidth as S,getMinusIcon as _,getPlusIcon as h}from"./common/helpers.js";let ProductQuantity=({setting:j={},styles:q={},advanced:B,builderProps:k})=>{let{plusIcon:E,minusIcon:H,updatePrice:P}=j,Q=j.defaultQtyValue??1,{inputHeight:A,buttonBackgroundColor:G,iconColor:L,inputBackgroundColor:M,textColor:V,align:x,borderBtn:C,buttonWidth:D,iconSizeCustom:I,corner:N,backgroundColor:O,dividerColor:R,dividerStroke:T}=q,w=j?.hasButton,z=l({...n({uid:k?.uid||"",isDisableByLiquid:!0})}),F=r({...c(B?.cssClass)}),J=o({...b({align:x,inputHeight:A})}),K=r({...p()}),U=o({...y({backgroundColor:O,styles:q})}),W=l({...u({isLiquid:!0,hasButton:w,defaultQty:Q})}),X=r({...f({styles:q,borderBtn:C,inputBackgroundColor:M,textColor:V})}),Y=o({...v({setting:j,styles:{...q,borderBtn:C,inputBackgroundColor:M,textColor:V,dividerColor:R,dividerStroke:T}})}),Z=r({...m({borderBtn:C,buttonBackgroundColor:G,iconColor:L,buttonSide:"left"})}),tt=o({...g({borderBtn:C,buttonWidth:D,buttonBackgroundColor:G,iconColor:L,corner:N,enableHoverButton:j?.enableHoverButton})}),ts=l({...d({buttonSide:"left"})}),te=r({...m({borderBtn:C,buttonBackgroundColor:G,iconColor:L,buttonSide:"right"})}),ta=o({...g({borderBtn:C,buttonWidth:D,buttonBackgroundColor:G,iconColor:L,corner:N,enableHoverButton:j?.enableHoverButton})}),ti=l({...d({buttonSide:"right"})}),tl=r({...$()}),tr=S(I);return t`
|
|
2
2
|
{%- liquid
|
|
3
3
|
assign current_variant = product.selected_or_first_available_variant
|
|
4
4
|
assign available = current_variant.available | default: false
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{composeTypographyClassName as e,handleConvertClassColor as t,getGlobalColorStateClass as p,composeClasses as
|
|
1
|
+
import{composeTypographyClassName as e,handleConvertClassColor as t,getGlobalColorStateClass as p,composeClasses as l}from"@gem-sdk/core";let getInputClasses=({styles:g,borderBtn:s,inputBackgroundColor:n,textColor:r,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 focus-visible:gp-shadow-none focus-visible:gp-outline-none gp-transition-all gp-duration-150 hover:gp-text-black disabled:gp-cursor-not-allowed",i=e(g?.typo,g?.typography),u=t(s),c=p("bg",n),f=p("text",r);return u&&(o+=` ${u} `),i&&(o+=` ${i} `),c&&(o+=` ${c} `),f&&(o+=` ${f} `),a&&(o+="gp-cursor-not-allowed"),{...l(o)}},getButtonClass=({borderBtn:e,buttonBackgroundColor:g,iconColor:s,buttonSide:n,isDisabled:r})=>{let a=`gp-flex gp-aspect-square gp-h-full disabled:gp-cursor-not-allowed ${r?"gp-cursor-not-allowed":"gp-cursor-pointer"} gp-items-center gp-justify-center gp-outline-none ${"left"===n?"gp-minus":"gp-plus"} `,o=t(e),i=p("bg",g),u=p("text",s);return o&&(a+=` ${o} `),i&&(a+=` ${i} `),u&&(a+=` ${u} `),{...l(a)}},getContainerClasses=e=>({...l(`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=()=>({...l("gp-inline-flex gp-w-full gp-overflow-hidden")}),getIconWrapperClasses=()=>({...l("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{composeTypographyStyle as e,getStyleShadowState as t,getGlobalColorStateStyle as r,
|
|
1
|
+
import{composeTypographyStyle as e,getStyleShadowState as t,getGlobalColorStateStyle as r,handleConvertBorderStyle as o,handleConvertBorderWidth as a,handleConvertBorderColor as l,composeRadiusResponsive as n,makeStyle as d,getStyleShadow as s,filterHoverVariables as i,makeStyleResponsive as p,composeRadius as h,getResponsiveStyleShadowWithoutState as u,getGlobalColorResponsiveStyle as b,composeBorderResponsive as m,makeStyleState as g}from"@gem-sdk/core";let addPxToValues=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,`${t}px`])),getDividerWidth=(e,t)=>{if(!e||!t)return{};let r=addPxToValues(e),o={...g("brw",r),...g("blw",r)};return o},getDividerColorStyle=e=>{if(!e)return{};let t={...e,normal:e?.normal??"transparent"},o={...r("brc",t),...r("blc",t)},a=Object.fromEntries(Object.entries(o).filter(([e,t])=>void 0!==t));return a},getInputStyle=p=>{let{styles:h,setting:u}=p,{inputBackgroundColor:b,textColor:m,dividerColor:g,dividerStroke:y,inputBoxShadow:S}=h??{},{enableHoverInput:c,hasButton:w}=u??{},v=e(h?.typo,h?.typography),x=t(S,"box-shadow",{normal:!!S?.normal,hover:!!S?.hover}),f={...getDividerWidth(y,g),...getDividerColorStyle(g)},j={...r("bg",{...b,normal:b?.normal??"transparent"}),...x,...r("c",{...m,hover:m?.hover??m?.normal}),...w?f:{}},k=h?.inputBorder,W={...o(k),...a(k),...l(k)},B={...w?{}:W,...w?{}:n(h?.shapeRounded),...d({}),...v,...j,...s({value:h?.typo?.custom?.textShadow,styleAppliedFor:"text-shadow",isEnableShadow:h?.typo?.custom?.hasShadowText})};return c?B:i(B)},getButtonStyle=({borderBtn:e,buttonWidth:t,buttonBackgroundColor:n,iconColor:d,corner:s,enableHoverButton:u})=>{let b={...p("w",t),...o(e),...a(e),...l(e),...r("bg",n),...r("c",d),...h(s)};return u?b:i(b)},getContainerStyles=({inputHeight:e,align:t})=>({...p("h",e),...p("jc",t)}),getWrapperStyles=({backgroundColor:e,styles:t})=>{let r=t?.shapeShadow,o=u(r,"box-shadow",{desktop:r?.desktop??{},tablet:r?.tablet??r?.desktop??{},mobile:r?.mobile??r?.tablet??r?.desktop??{}});return{...b("bg",e),...p("maxw",t?.quantityWidth),...m(t?.shapeBorder),...n(t?.shapeRounded),...o}};export{getButtonStyle,getContainerStyles,getInputStyle,getWrapperStyles};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
let ProductQuantitySettings=[{id:"setting",controls:[{id:"updatePrice",label:"Update price",type:"toggle",default:!0},{id:"hasButton",label:"Button",type:"toggle",default:!0},{id:"defaultQtyValue",label:"Text",type:"input:stepper",min:1,default:1},{id:"plusIcon",type:"icon",isHideClear:!0,customLabel:"Plus",info:"Choose from list or paste any SVG icon",default:`<svg height="20px" width="20px" data-name="plus-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817698760687976">
|
|
2
2
|
<path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M224,128a8,8,0,0,1-8,8H136v80a8,8,0,0,1-16,0V136H40a8,8,0,0,1,0-16h80V40a8,8,0,0,1,16,0v80h80A8,8,0,0,1,224,128Z"></path></svg>`},{id:"minusIcon",type:"icon",isHideClear:!0,customLabel:"Minus",info:"Choose from list or paste any SVG icon",default:`<svg height="20px" width="20px" data-name="minus-regular" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 256 256" fill="currentColor" data-id="508817690725712232">
|
|
3
|
-
<path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"></path></svg>`},{id:"enableHoverInput",label:"Enable hover input",type:"toggle",default:!1},{id:"enableHoverButton",label:"Enable hover input",type:"toggle",default:!1}]},{id:"style",controls:[{id:"quantityLayout",label:"Style",type:"layout-selector",popoverLabel:{en:"Style"},iconViewBox:"0 0 80 48",enableItemBackground:!0,itemPerRow:2,itemSpacing:"large",options:[{label:"Square",value:"product-quantity-square",type:"p-quantity-layout",iconName:"gp-product-quantity-square"},{label:"Square with divider",value:"product-quantity-square-divider",type:"p-quantity-layout",iconName:"gp-product-quantity-square-divider"},{label:"Rounded",value:"product-quantity-rounded",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded"},{label:"Rounded with divider",value:"product-quantity-rounded-divider",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded-divider"},{label:"Square input only",value:"product-quantity-square-input-only",type:"p-quantity-layout",iconName:"gp-product-quantity-square-input-only"},{label:"Rounded input only",value:"product-quantity-rounded-input-only",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded-input-only"}],default:"product-quantity-square"},{id:"dimensions",type:"group",label:"Dimensions",controls:[{id:"fullWidth",label:"Full Width",type:"toggle",devices:{desktop:{default:!1}}},{id:"quantityWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"160px"}}},{id:"inputHeight",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"45px"}}},{id:"buttonWidth",type:"dropdown:input",label:"Button Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"45px"}}},{id:"iconSizeCustom",type:"input:stepper",includeUnit:"px",min:1,devices:{desktop:{default:"16px"}}}]},{id:"inputStyle",type:"group",label:"Input Style",controls:[{id:"typo",type:"typography-combo",default:{type:"paragraph-1",attrs:{color:"#121212"},custom:{fontSize:{desktop:"16px",tablet:"16px",mobile:"14px"},lineHeight:{desktop:"120%",tablet:"180%",mobile:"180%"},fontWeight:"400",fontFamily:{value:"Assistant",type:"google"},hasShadowText:!1,textShadow:{enable:!1}}},ignoreReRender:!0,hiddenSetting:{transform:!0,textAlign:!0}},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"right",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],devices:{desktop:{default:"left"}}}]},{id:"button-behavior-state",type:"behavior-state",label:"Button Style",hide:!0,controls:[{id:"textColor",type:"color-picker-v2",label:"Text Color",default:{normal:"text-2"},compoDefaultValue:{hover:"text-2"},state:{hover:!0,normal:!0},enableGradient:!0},{id:"inputBackgroundColor",type:"color-picker-v2",label:"Background Color",state:{hover:!0,normal:!0},compoDefaultValue:{normal:"highlight",hover:"highlight"},enableGradient:!0},{id:"buttonBackgroundColor",type:"color-picker-v2",label:"Button Background Color",state:{hover:!0,normal:!0},enableGradient:!0,compoDefaultValue:{normal:"brand",hover:"highlight"}},{id:"iconColor",type:"color-picker-v2",label:"Icon Color",default:{normal:"#121212"},compoDefaultValue:{hover:"text-2"},state:{hover:!0,normal:!0},enableGradient:!0}]},{id:"borderBtn",label:"Border",type:"border-v2",default:{normal:{}},compoDefaultValue:{normal:{border:"solid",color:"#212121",width:"1px",borderWidth:"1px"},hover:{border:"solid",color:"#212121",width:"1px",borderWidth:"1px"}},state:{hover:!0,normal:!0}},{id:"corner",label:"Corner",type:"corner-v2",default:{normal:{btrr:"0px",bblr:"0px",bbrr:"0px",btlr:"0px",radiusType:"none"}}},{id:"inputBoxShadow",type:"shadow-v2",default:{normal:{}},compoDefaultValue:{normal:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"#121212",angle:90}}},{id:"backgroundColor",type:"color-picker-v2",label:"Background Color",devices:{desktop:{default:"#FFFFFF"}},enableGradient:!0},{id:"dividerColor",type:"color-picker-v2",label:"Divider Color",default:{normal:"line-3"},compoDefaultValue:{normal:"line-3"},state:{hover:!0,normal:!0},enableGradient:!0},{id:"dividerStroke",label:"Thickness",type:"input:stepper",min:1,default:{normal:1
|
|
3
|
+
<path fill="currentColor" strokelinecap="round" strokelinejoin="round" d="M224,128a8,8,0,0,1-8,8H40a8,8,0,0,1,0-16H216A8,8,0,0,1,224,128Z"></path></svg>`},{id:"enableHoverInput",label:"Enable hover input",type:"toggle",default:!1},{id:"enableHoverButton",label:"Enable hover input",type:"toggle",default:!1}]},{id:"style",controls:[{id:"quantityLayout",label:"Style",type:"layout-selector",popoverLabel:{en:"Style"},iconViewBox:"0 0 80 48",enableItemBackground:!0,itemPerRow:2,itemSpacing:"large",options:[{label:"Square",value:"product-quantity-square",type:"p-quantity-layout",iconName:"gp-product-quantity-square"},{label:"Square with divider",value:"product-quantity-square-divider",type:"p-quantity-layout",iconName:"gp-product-quantity-square-divider"},{label:"Rounded",value:"product-quantity-rounded",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded"},{label:"Rounded with divider",value:"product-quantity-rounded-divider",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded-divider"},{label:"Square input only",value:"product-quantity-square-input-only",type:"p-quantity-layout",iconName:"gp-product-quantity-square-input-only"},{label:"Rounded input only",value:"product-quantity-rounded-input-only",type:"p-quantity-layout",iconName:"gp-product-quantity-rounded-input-only"}],default:"product-quantity-square"},{id:"dimensions",type:"group",label:"Dimensions",controls:[{id:"fullWidth",label:"Full Width",type:"toggle",devices:{desktop:{default:!1}}},{id:"quantityWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"160px"}}},{id:"inputHeight",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"45px"}}},{id:"buttonWidth",type:"dropdown:input",label:"Button Width",inputType:"number",units:["px","%"],hideUnit:!1,displayOptions:[{label:"Full",value:"100%",showValue:!0}],devices:{desktop:{default:"45px"}}},{id:"iconSizeCustom",type:"input:stepper",includeUnit:"px",min:1,devices:{desktop:{default:"16px"}}}]},{id:"inputStyle",type:"group",label:"Input Style",controls:[{id:"typo",type:"typography-combo",default:{type:"paragraph-1",attrs:{color:"#121212"},custom:{fontSize:{desktop:"16px",tablet:"16px",mobile:"14px"},lineHeight:{desktop:"120%",tablet:"180%",mobile:"180%"},fontWeight:"400",fontFamily:{value:"Assistant",type:"google"},hasShadowText:!1,textShadow:{enable:!1}}},ignoreReRender:!0,hiddenSetting:{transform:!0,textAlign:!0}},{id:"align",label:"Alignment",type:"option:value",options:[{label:"Left",value:"left",type:"align",tooltip:"Align left",iconName:"gp-align-left"},{label:"Center",value:"center",type:"align",tooltip:"Align center",iconName:"gp-align-center"},{label:"Right",value:"right",type:"align",tooltip:"Align right",iconName:"gp-align-right"}],devices:{desktop:{default:"left"}}}]},{id:"button-behavior-state",type:"behavior-state",label:"Button Style",hide:!0,controls:[{id:"textColor",type:"color-picker-v2",label:"Text Color",default:{normal:"text-2"},compoDefaultValue:{hover:"text-2"},state:{hover:!0,normal:!0},enableGradient:!0},{id:"inputBackgroundColor",type:"color-picker-v2",label:"Background Color",state:{hover:!0,normal:!0},compoDefaultValue:{normal:"highlight",hover:"highlight"},enableGradient:!0},{id:"buttonBackgroundColor",type:"color-picker-v2",label:"Button Background Color",state:{hover:!0,normal:!0},enableGradient:!0,compoDefaultValue:{normal:"brand",hover:"highlight"}},{id:"iconColor",type:"color-picker-v2",label:"Icon Color",default:{normal:"#121212"},compoDefaultValue:{hover:"text-2"},state:{hover:!0,normal:!0},enableGradient:!0}]},{id:"borderBtn",label:"Border",type:"border-v2",default:{normal:{}},compoDefaultValue:{normal:{border:"solid",color:"#212121",width:"1px",borderWidth:"1px"},hover:{border:"solid",color:"#212121",width:"1px",borderWidth:"1px"}},state:{hover:!0,normal:!0}},{id:"corner",label:"Corner",type:"corner-v2",default:{normal:{btrr:"0px",bblr:"0px",bbrr:"0px",btlr:"0px",radiusType:"none"}}},{id:"inputBoxShadow",type:"shadow-v2",default:{normal:{}},compoDefaultValue:{normal:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"#121212",angle:90}}},{id:"backgroundColor",type:"color-picker-v2",label:"Background Color",devices:{desktop:{default:"#FFFFFF"}},enableGradient:!0},{id:"dividerColor",type:"color-picker-v2",label:"Divider Color",default:{normal:"line-3"},compoDefaultValue:{normal:"line-3"},state:{hover:!0,normal:!0},enableGradient:!0},{id:"dividerStroke",label:"Thickness",type:"input:stepper",min:1,default:{normal:1},state:{hover:!0,normal:!0}},{id:"inputBorder",label:"Input Border",type:"border-v2",default:{hover:{}},state:{hover:!0,normal:!0}},{id:"shapeBorder",type:"border-v2",devices:{desktop:{default:{border:"solid",color:"line-3",width:"1px",borderWidth:"1px"}}}},{id:"shapeRounded",type:"corner-v2",devices:{desktop:{default:{radiusType:"none"}}}},{id:"shapeShadow",type:"shadow-v2",devices:{desktop:{default:{}}},compoDefaultValue:{desktop:{default:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"rgba(18, 18, 18, 0.20)",angle:45,enable:!0}}}}]}];export{ProductQuantitySettings};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let SettingUIV2=[{controls:[{label:{en:"Button"},setting:{id:"hasButton"},options:{labelVariant:"primary",toggleStyle:"switch"}},{label:{en:"Width"},setting:{id:"buttonWidth"},conditionDisplay:"hasButton === true"},{label:{en:"Background"},setting:{id:"buttonBackgroundColor",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Plus icon"},setting:{id:"plusIcon"},conditionDisplay:"hasButton === true"},{label:{en:"Minus icon"},setting:{id:"minusIcon"},conditionDisplay:"hasButton === true"},{label:{en:"Icon color"},setting:{id:"iconColor",state:"normal"},conditionDisplay:"hasButton === true"}],moreSettings:{type:"collapse",controls:[{label:{en:"Icon size"},setting:{id:"iconSizeCustom"},conditionDisplay:"hasButton === true"},{label:{en:"Border"},setting:{id:"borderBtn",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Corner"},setting:{id:"corner",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Hover"},type:"combo",iconName:"polaris-check-clicked",fixedValue:"Styled",setting:{id:"enableHoverButton"},popoverLabel:{en:"Hover effect"},state:"hover",conditionDisplay:"hasButton === true",controls:[{label:{en:"Background"},setting:{id:"buttonBackgroundColor",state:"hover"},compoDefaultValue:{default:"highlight"}},{label:{en:"Icon color"},setting:{id:"iconColor",state:"hover"}},{label:{en:"Border"},setting:{id:"borderBtn",state:"hover"}},{label:{en:"Corner"},setting:{id:"corner",state:"hover"}}]}]}},{label:{en:"Input"},controls:[{label:{en:"Background"},setting:{id:"inputBackgroundColor",state:"normal"}},{label:{en:"Text style"},setting:{id:"typo"},options:{updateFields:[{field:"attrs.color",settingId:"textColor",state:"normal"}]},controlChangeTrigger:{settings:[{action:{controlId:"textColor",valueFromField:"attrs.color",groupType:"style",controlType:"style",removeDevice:!0,state:"normal"}}],options:{noRecordHistory:!0}}},{label:{en:"Divider"},type:"combo",conditionDisplay:"hasButton === true",comboType:"color",getValueFromSettingID:"dividerColor.normal",compoDefaultValue:"line-3",controls:[{label:{en:"Color"},setting:{id:"dividerColor",state:"normal"}},{label:{en:"Thickness"},setting:{id:"dividerStroke",state:"normal"}}]},{label:{en:"Shadow"},setting:{id:"inputBoxShadow",state:"normal"}},{label:{en:"Hover"},type:"combo",iconName:"polaris-check-clicked",fixedValue:"Styled",popoverLabel:{en:"Hover effect"},setting:{id:"enableHoverInput"},state:"hover",controls:[{label:{en:"Background"},setting:{id:"inputBackgroundColor",state:"hover"}},{label:{en:"Text color"},setting:{id:"textColor",state:"hover"}},{label:{en:"Divider
|
|
1
|
+
let SettingUIV2=[{controls:[{label:{en:"Button"},setting:{id:"hasButton"},options:{labelVariant:"primary",toggleStyle:"switch"}},{label:{en:"Width"},setting:{id:"buttonWidth"},conditionDisplay:"hasButton === true"},{label:{en:"Background"},setting:{id:"buttonBackgroundColor",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Plus icon"},setting:{id:"plusIcon"},conditionDisplay:"hasButton === true"},{label:{en:"Minus icon"},setting:{id:"minusIcon"},conditionDisplay:"hasButton === true"},{label:{en:"Icon color"},setting:{id:"iconColor",state:"normal"},conditionDisplay:"hasButton === true"}],moreSettings:{type:"collapse",controls:[{label:{en:"Icon size"},setting:{id:"iconSizeCustom"},conditionDisplay:"hasButton === true"},{label:{en:"Border"},setting:{id:"borderBtn",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Corner"},setting:{id:"corner",state:"normal"},conditionDisplay:"hasButton === true"},{label:{en:"Hover"},type:"combo",iconName:"polaris-check-clicked",fixedValue:"Styled",setting:{id:"enableHoverButton"},popoverLabel:{en:"Hover effect"},state:"hover",conditionDisplay:"hasButton === true",controls:[{label:{en:"Background"},setting:{id:"buttonBackgroundColor",state:"hover"},compoDefaultValue:{default:"highlight"}},{label:{en:"Icon color"},setting:{id:"iconColor",state:"hover"}},{label:{en:"Border"},setting:{id:"borderBtn",state:"hover"}},{label:{en:"Corner"},setting:{id:"corner",state:"hover"}}]}]}},{label:{en:"Input"},controls:[{label:{en:"Background"},setting:{id:"inputBackgroundColor",state:"normal"}},{label:{en:"Text style"},setting:{id:"typo"},options:{updateFields:[{field:"attrs.color",settingId:"textColor",state:"normal"}]},controlChangeTrigger:{settings:[{action:{controlId:"textColor",valueFromField:"attrs.color",groupType:"style",controlType:"style",removeDevice:!0,state:"normal"}}],options:{noRecordHistory:!0}}},{label:{en:"Divider"},type:"combo",conditionDisplay:"hasButton === true",comboType:"color",getValueFromSettingID:"dividerColor.normal",compoDefaultValue:"line-3",controls:[{label:{en:"Color"},setting:{id:"dividerColor",state:"normal"}},{label:{en:"Thickness"},setting:{id:"dividerStroke",state:"normal"}}]},{label:{en:"Border"},setting:{id:"inputBorder",state:"normal"},conditionDisplay:"hasButton === false"},{label:{en:"Shadow"},setting:{id:"inputBoxShadow",state:"normal"}},{label:{en:"Hover"},type:"combo",iconName:"polaris-check-clicked",fixedValue:"Styled",popoverLabel:{en:"Hover effect"},setting:{id:"enableHoverInput"},state:"hover",controls:[{label:{en:"Background"},setting:{id:"inputBackgroundColor",state:"hover"}},{label:{en:"Text color"},setting:{id:"textColor",state:"hover"}},{label:{en:"Divider"},setting:{id:"dividerColor",state:"hover"},conditionDisplay:"hasButton === true"},{label:{en:"Divider thickness"},setting:{id:"dividerStroke",state:"hover"},conditionDisplay:"hasButton === true"},{label:{en:"Border"},setting:{id:"inputBorder",state:"hover"},conditionDisplay:"hasButton === false"},{label:{en:"Shadow"},setting:{id:"inputBoxShadow",state:"hover"}}]}]},{label:{en:"Size"},controls:[{label:{en:"Width"},setting:{id:"quantityWidth"}},{label:{en:"Height"},setting:{id:"inputHeight"}}]},{label:{en:"Background"},controls:[{label:{en:"Color"},setting:{id:"backgroundColor"}}]},{label:{en:"Shape"},controls:[{label:{en:"Border"},setting:{id:"shapeBorder"}},{label:{en:"Corner"},setting:{id:"shapeRounded"}},{label:{en:"Shadow"},setting:{id:"shapeShadow"}}]},{label:{en:"Display condition"},controls:[{label:{en:"Default quantity"},setting:{id:"defaultQtyValue"}},{label:{en:"Update price"},setting:{id:"updatePrice"}}]},{controls:[{label:{en:"Align"},conditionEnable:'!(parseInt(quantityWidth) >= 100 && quantityWidth?.includes("%"))',setting:{id:"align"},options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Align is not supported when width is 100%"}}]}];export{SettingUIV2};
|