@gem-sdk/components 2.0.0-staging.813 → 2.0.0-staging.815

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 +1 @@
1
- "use strict";var helpers=require("../../common/helpers.js");const EstimateDateSettings=[{id:"setting",controls:[{id:"enableCustomText",label:"",type:"toggle",default:!0},{id:"customTextContainer",type:"group",controls:[{id:"customText",type:"input",default:"Estimate delivery between"}]},{id:"estimateDays",type:"group",controls:[{id:"typeEstimate",type:"group",controls:[{id:"typeEstimate",label:"Type",type:"option:value",default:helpers.ESTIMATE_DAYS.RANGE,options:[{label:"Specific",value:helpers.ESTIMATE_DAYS.SPECIFIC},{label:"Range",value:helpers.ESTIMATE_DAYS.RANGE}]},{id:"minEstimate",label:"Min estimate",type:"input:number",default:2,emptyOnClear:!1,min:1,max:99969999},{id:"maxEstimate",label:"Max estimate",type:"input:number",default:5,emptyOnClear:!1,min:1,max:99969999},{id:"estimateTime",label:"Estimate",type:"input:number",default:5,emptyOnClear:!1,min:0,max:99969999}]}]},{id:"dateFormat",type:"group",controls:[{id:"typeFormat",label:"Type",type:"select",default:helpers.listFormatDate().FORMAT_1.value,options:[{label:helpers.listFormatDate().FORMAT_1.Label,value:helpers.listFormatDate().FORMAT_1.value},{label:helpers.listFormatDate().FORMAT_2.Label,value:helpers.listFormatDate().FORMAT_2.value},{label:helpers.listFormatDate().FORMAT_3.Label,value:helpers.listFormatDate().FORMAT_3.value},{label:helpers.listFormatDate().FORMAT_4.Label,value:helpers.listFormatDate().FORMAT_4.value},{label:helpers.listFormatDate().FORMAT_5.Label,value:helpers.listFormatDate().FORMAT_5.value},{label:helpers.listFormatDate().FORMAT_6.Label,value:helpers.listFormatDate().FORMAT_6.Label}]},{id:"customFormat",label:"Custom format",type:"input",default:"",placeholder:"Eg: %d, %b, %y"},{id:"moreFormat",type:"group"}]},{id:"visibilityContainer",type:"group",controls:[{id:"visibility",type:"childrens"},{id:"ifOutOfStock",label:"If out of stock",type:"option:value",default:helpers.OUT_OF_STOCK.HIDE,options:[{label:"Show",value:helpers.OUT_OF_STOCK.SHOW},{label:"Hide",value:helpers.OUT_OF_STOCK.HIDE}]}]},{id:"translate",type:"input",default:"customText"},{id:"globalSize",type:"size-setting",devices:{desktop:{default:{width:"100%"}}},settingConfig:{width:{displayOptions:["full","auto"],sizeConfig:{small:"100px",medium:"116px",large:"132px"}}},hiddenSettings:["shape","gap","height"]},{id:"background",type:"background-media",ignoreReRender:!0,devices:{desktop:{default:{type:"color",color:"transparent",image:{src:"",width:0,height:0},size:"cover",position:{x:50,y:50},repeat:"no-repeat",attachment:"scroll"}}},compoDefaultValue:{desktop:{default:{type:"color",color:"#FFFFFF",image:{src:"https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/",width:1200,height:480},size:"cover",position:{x:50,y:50},repeat:"no-repeat",attachment:"scroll",preload:!1}}}}]},{id:"style",controls:[{id:"typoCustom",type:"typography-v2",default:{type:"paragraph-2",attrs:{color:"text-1"}},ignoreReRender:!0,hiddenSetting:{textAlign:!0,textShadow:!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:"typoDate",type:"typography-v2",default:{type:"paragraph-2",attrs:{color:"text-1",bold:!0}},ignoreReRender:!0,hiddenSetting:{textAlign:!0,textShadow:!0}},{id:"shapeBorder",type:"border-v2",devices:{desktop:{default:void 0}},compoDefaultValue:{desktop:{default:{border:"solid",color:"#121212",width:"1px",borderWidth:"1px"}}}},{id:"shapeRounded",type:"corner-v2",devices:{desktop:{default:void 0}},compoDefaultValue:{desktop:{default:{btrr:"8px",bblr:"8px",bbrr:"8px",btlr:"8px",radiusType:"rounded"}}}},{id:"padding",type:"padding-v2",devices:{desktop:{default:{padding:{type:"small",top:"4px",left:"4px",bottom:"4px",right:"4px"}}}},compoDefaultValue:{desktop:{default:{padding:{type:"small",top:"4px",left:"4px",bottom:"4px",right:"4px"}}}}},{id:"shapeBoxShadow",type:"shadow-v2",devices:{desktop:{default:{enable:!1}}},compoDefaultValue:{desktop:{default:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"rgba(18, 18, 18, 0.2)",angle:45,enable:!0}}}}]}];exports.EstimateDateSettings=EstimateDateSettings;
1
+ "use strict";var helpers=require("../../common/helpers.js");const EstimateDateSettings=[{id:"setting",controls:[{id:"enableCustomText",label:"",type:"toggle",default:!0},{id:"customTextContainer",type:"group",controls:[{id:"customText",type:"input",default:"Estimate delivery between"}]},{id:"estimateDays",type:"group",controls:[{id:"typeEstimate",type:"group",controls:[{id:"typeEstimate",label:"Type",type:"option:value",default:helpers.ESTIMATE_DAYS.RANGE,options:[{label:"Specific",value:helpers.ESTIMATE_DAYS.SPECIFIC},{label:"Range",value:helpers.ESTIMATE_DAYS.RANGE}]},{id:"minEstimate",label:"Min estimate",type:"input:number",default:2,emptyOnClear:!1,min:1,max:99969999,fallbackValue:2},{id:"maxEstimate",label:"Max estimate",type:"input:number",default:5,emptyOnClear:!1,min:1,max:99969999,fallbackValue:5},{id:"estimateTime",label:"Estimate",type:"input:number",default:5,emptyOnClear:!1,min:0,max:99969999,fallbackValue:5}]}]},{id:"dateFormat",type:"group",controls:[{id:"typeFormat",label:"Type",type:"select",default:helpers.listFormatDate().FORMAT_1.value,options:[{label:helpers.listFormatDate().FORMAT_1.Label,value:helpers.listFormatDate().FORMAT_1.value},{label:helpers.listFormatDate().FORMAT_2.Label,value:helpers.listFormatDate().FORMAT_2.value},{label:helpers.listFormatDate().FORMAT_3.Label,value:helpers.listFormatDate().FORMAT_3.value},{label:helpers.listFormatDate().FORMAT_4.Label,value:helpers.listFormatDate().FORMAT_4.value},{label:helpers.listFormatDate().FORMAT_5.Label,value:helpers.listFormatDate().FORMAT_5.value},{label:helpers.listFormatDate().FORMAT_6.Label,value:helpers.listFormatDate().FORMAT_6.Label}]},{id:"customFormat",label:"Custom format",type:"input",default:"",placeholder:"Eg: %d, %b, %y"},{id:"moreFormat",type:"group"}]},{id:"visibilityContainer",type:"group",controls:[{id:"visibility",type:"childrens"},{id:"ifOutOfStock",label:"If out of stock",type:"option:value",default:helpers.OUT_OF_STOCK.HIDE,options:[{label:"Show",value:helpers.OUT_OF_STOCK.SHOW},{label:"Hide",value:helpers.OUT_OF_STOCK.HIDE}]}]},{id:"translate",type:"input",default:"customText"},{id:"globalSize",type:"size-setting",devices:{desktop:{default:{width:"100%"}}},settingConfig:{width:{displayOptions:["full","auto"],sizeConfig:{small:"100px",medium:"116px",large:"132px"}}},hiddenSettings:["shape","gap","height"]},{id:"background",type:"background-media",ignoreReRender:!0,devices:{desktop:{default:{type:"color",color:"transparent",image:{src:"",width:0,height:0},size:"cover",position:{x:50,y:50},repeat:"no-repeat",attachment:"scroll"}}},compoDefaultValue:{desktop:{default:{type:"color",color:"#FFFFFF",image:{src:"https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/",width:1200,height:480},size:"cover",position:{x:50,y:50},repeat:"no-repeat",attachment:"scroll",preload:!1}}}}]},{id:"style",controls:[{id:"typoCustom",type:"typography-v2",default:{type:"paragraph-2",attrs:{color:"text-1"}},ignoreReRender:!0,hiddenSetting:{textAlign:!0,textShadow:!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:"typoDate",type:"typography-v2",default:{type:"paragraph-2",attrs:{color:"text-1",bold:!0}},ignoreReRender:!0,hiddenSetting:{textAlign:!0,textShadow:!0}},{id:"shapeBorder",type:"border-v2",devices:{desktop:{default:void 0}},compoDefaultValue:{desktop:{default:{border:"solid",color:"#121212",width:"1px",borderWidth:"1px"}}}},{id:"shapeRounded",type:"corner-v2",devices:{desktop:{default:void 0}},compoDefaultValue:{desktop:{default:{btrr:"8px",bblr:"8px",bbrr:"8px",btlr:"8px",radiusType:"rounded"}}}},{id:"padding",type:"padding-v2",devices:{desktop:{default:{padding:{type:"small",top:"4px",left:"4px",bottom:"4px",right:"4px"}}}},compoDefaultValue:{desktop:{default:{padding:{type:"small",top:"4px",left:"4px",bottom:"4px",right:"4px"}}}}},{id:"shapeBoxShadow",type:"shadow-v2",devices:{desktop:{default:{enable:!1}}},compoDefaultValue:{desktop:{default:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"rgba(18, 18, 18, 0.2)",angle:45,enable:!0}}}}]}];exports.EstimateDateSettings=EstimateDateSettings;
@@ -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"),Text=require("../../../text/components/Text.js"),index=require("./components/variants/index.js"),Dropdown=require("./components/dropdown-swatches/Dropdown.js"),DropdownGroup=require("./components/dropdown-group/DropdownGroup.js"),NoDataState=require("../../../common/components/NoDataState.js"),system=require("@gem-sdk/system"),styles=require("./common/main/styles.js"),getAttr=require("./common/main/getAttr.js"),classes=require("./common/main/classes.js"),getData=require("./common/main/getData.js"),useGpVariants=require("./hooks/useGpVariants.js"),classes$1=require("./common/variants/classes.js");const ProductVariants=e=>{let{builderProps:t,styles:s,setting:a}=e,{align:r,optionTypo:o,swatchItemWidth:n,dropdownItemWidth:i,swatchSpacing:l}=s??{},{label:p,showAsSwatches:c,layout:u,hasPreSelected:m}=a??{},{uid:d}=t??{},y=core.useVariants(),{mode:j,options:x,variantId:g,elementRef:f,variantGroup:h,isChangeVariant:w,selectedOptions:D,isDefaultVariant:v,getVariantConfiguration:S,redirectProductShopifyLink:V}=useGpVariants.useGpVariants(e,y),q=()=>{let e={};return core.DEVICES.forEach(t=>{let s=core.getResponsiveValueByScreen(n,t);e[t]="auto"===s}),e},R=()=>{let e={};return core.DEVICES.forEach(t=>{e[t]=i?.[t]==="fill"}),e},C=()=>x?.map((t,n)=>{let i=S(t.name),j=i?i.optionType:t.optionType,f=i?i.presets[i.optionType||"rectangle_list"]?.spacing:l,h=(m||g)&&t.name?D?.[t.name]:void 0,v=i?.hide;if(v)return null;let V=system.createClass(classes.getVariantOptionGroupClass(r)),C=system.createStyle(styles.getVariantOptionGroupStyle(l,f)),N=getData.getTextVariantTitleData(e,"React",{optionName:t.name,hasPreSelected:m,selectedOptions:D,styleOptionSelected:j}),T=system.createClass(classes$1.getWrapVariantOptionClass(u,r));return jsxRuntime.jsxs("div",{className:T,children:[system.If(p,jsxRuntime.jsx(Text.default,{...N})),jsxRuntime.jsxs("div",{className:V,style:C,children:[c&&core.OptionSpecialStyle.includes(`${j}`)&&t.values.map(e=>{let r=(!!m||!!w&&!!g)&&!!t.name&&D?.[t.name]===e.label;return jsxRuntime.jsx(index.default,{variantKey:`${t.id}-${e.id}`,showAsSwatches:c,uid:d,optionName:t.name??"",optionValue:e.label??"",name:t.name,value:e,optionNumber:x.length,optionPosition:n,...s,...a,presetConfiguration:S(t.name),checked:r,typeOfOption:j||"dropdown",swatchAutoWidth:q(),optionTypo:o},e.id)}),system.If(("dropdown"===j||c&&!core.OptionSpecialStyle.includes(`${j}`))&&"radio_buttons"!==j,jsxRuntime.jsx(Dropdown.default,{...s,...a,variants:y,option:t,initValue:h,presetConfiguration:S(t.name),swatchAutoWidth:R(),optionTypo:o,optionPosition:n,optionNumber:x.length}))]})]},t.id)}),N=system.createClass(classes.getWrapDropdownClass(r)),T=getData.getDropdownGroupData(e),A=()=>jsxRuntime.jsx("div",{className:N,children:jsxRuntime.jsx(DropdownGroup.default,{...T})});if(v&&"edit"===j)return jsxRuntime.jsx(NoDataState.default,{elementType:"secondary",description:"Setup options like colors, sizes with product variant.",descriptionActions:[{text:"Add new variant",callback:V},{text:"sync data",callback:"syncProduct"}]});let G=system.createAttr(getAttr.getAttrs({uid:d,hasPreSelected:m})),b=system.createStyle(styles.getWrapperStyle(e)),O=system.createClass({"gp-grid !gp-ml-0":!0});return jsxRuntime.jsx("div",{ref:f,...G,className:O,style:b,children:system.If(h,A(),C())})};exports.default=ProductVariants;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),Text=require("../../../text/components/Text.js"),index=require("./components/variants/index.js"),Dropdown=require("./components/dropdown-swatches/Dropdown.js"),DropdownGroup=require("./components/dropdown-group/DropdownGroup.js"),NoDataState=require("../../../common/components/NoDataState.js"),system=require("@gem-sdk/system"),styles=require("./common/main/styles.js"),getAttr=require("./common/main/getAttr.js"),classes=require("./common/main/classes.js"),getData=require("./common/main/getData.js"),useGpVariants=require("./hooks/useGpVariants.js"),classes$1=require("./common/variants/classes.js"),styles$1=require("./common/variants/styles.js");const ProductVariants=e=>{let{builderProps:t,styles:s,setting:a}=e,{align:o,optionTypo:r,swatchItemWidth:n,dropdownItemWidth:i,swatchSpacing:l,marginBottom:c}=s??{},{label:p,showAsSwatches:u,layout:m,hasPreSelected:d}=a??{},{uid:y}=t??{},x=core.useVariants(),{mode:j,options:g,variantId:f,elementRef:h,variantGroup:w,isChangeVariant:D,selectedOptions:S,isDefaultVariant:v,getVariantConfiguration:V,redirectProductShopifyLink:q}=useGpVariants.useGpVariants(e,x),R=()=>{let e={};return core.DEVICES.forEach(t=>{let s=core.getResponsiveValueByScreen(n,t);e[t]="auto"===s}),e},C=()=>{let e={};return core.DEVICES.forEach(t=>{e[t]=i?.[t]==="fill"}),e},N=()=>g?.map((t,n)=>{let i=V(t.name),j=i?i.optionType:t.optionType,h=i?i.presets[i.optionType||"rectangle_list"]?.spacing:l,w=(d||f)&&t.name?S?.[t.name]:void 0,v=i?.hide;if(v)return null;let q=system.createClass(classes.getVariantOptionGroupClass(o)),N=system.createStyle(styles.getVariantOptionGroupStyle(l,h)),T=getData.getTextVariantTitleData(e,"React",{optionName:t.name,hasPreSelected:d,selectedOptions:S,styleOptionSelected:j}),A=system.createClass(classes$1.getWrapVariantOptionClass(m,o)),G=n===g.length-1;return jsxRuntime.jsxs("div",{className:A,style:system.createStyle(styles$1.getMarginBottomStyle(c,G)),children:[system.If(p,jsxRuntime.jsx(Text.default,{...T})),jsxRuntime.jsxs("div",{className:q,style:N,children:[u&&core.OptionSpecialStyle.includes(`${j}`)&&t.values.map(e=>{let o=(!!d||!!D&&!!f)&&!!t.name&&S?.[t.name]===e.label;return jsxRuntime.jsx(index.default,{variantKey:`${t.id}-${e.id}`,showAsSwatches:u,uid:y,optionName:t.name??"",optionValue:e.label??"",name:t.name,value:e,optionNumber:g.length,optionPosition:n,...s,...a,presetConfiguration:V(t.name),checked:o,typeOfOption:j||"dropdown",swatchAutoWidth:R(),optionTypo:r},e.id)}),system.If(("dropdown"===j||u&&!core.OptionSpecialStyle.includes(`${j}`))&&"radio_buttons"!==j,jsxRuntime.jsx(Dropdown.default,{...s,...a,variants:x,option:t,initValue:w,presetConfiguration:V(t.name),swatchAutoWidth:C(),optionTypo:r,optionPosition:n,optionNumber:g.length}))]})]},t.id)}),T=system.createClass(classes.getWrapDropdownClass(o)),A=getData.getDropdownGroupData(e),G=()=>jsxRuntime.jsx("div",{className:T,children:jsxRuntime.jsx(DropdownGroup.default,{...A})});if(v&&"edit"===j)return jsxRuntime.jsx(NoDataState.default,{elementType:"secondary",description:"Setup options like colors, sizes with product variant.",descriptionActions:[{text:"Add new variant",callback:q},{text:"sync data",callback:"syncProduct"}]});let b=system.createAttr(getAttr.getAttrs({uid:y,hasPreSelected:d})),O=system.createStyle(styles.getWrapperStyle(e)),$=system.createClass({"gp-flex gp-flex-col !gp-ml-0":!0});return jsxRuntime.jsx("div",{ref:h,...b,className:$,style:O,children:system.If(w,G(),N())})};exports.default=ProductVariants;
@@ -1,10 +1,11 @@
1
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Text_liquid=require("../../../text/components/Text.liquid.js"),index_liquid=require("./components/variants/index.liquid.js"),Dropdown_liquid=require("./components/dropdown-swatches/Dropdown.liquid.js"),DropdownGroup_liquid=require("./components/dropdown-group/DropdownGroup.liquid.js"),helpers=require("../../../helpers.js"),mappingVariantStyles=require("./utils/mappingVariantStyles.js"),system=require("@gem-sdk/system"),getAttr=require("./common/main/getAttr.js"),styles=require("./common/main/styles.js"),classes=require("./common/main/classes.js"),getData=require("./common/main/getData.js"),classes$1=require("./common/variants/classes.js"),_function=require("../../helpers/function.js");const DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=e=>{let{builderProps:s,styles:t,setting:i,advanced:a}=e,{align:o,swatchItemWidth:n,dropdownItemWidth:r,swatchSpacing:p,optionTypo:l}=t??{},{label:u,optionType:d,showAsSwatches:m,layout:c,hasPreSelected:y}=i??{},g=a?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:$}=s??{},v="groupOption"===d,q=()=>{let e={};return core.DEVICES.forEach(s=>{let t=core.getResponsiveValueByScreen(n,s);e[s]="auto"===t}),e},L=()=>{let e={};return core.DEVICES.forEach(s=>{e[s]=r?.[s]==="fill"}),e},f=core.composeMemo(()=>{let e=mappingVariantStyles.mappingVariantStyles(i?.variantPresets,t);return{...i,variantPresets:e}},[i?.variantPresets,t]),S=e=>{let s={"'":"'",'"':"""},t=e;for(let i in s)e.indexOf(i)>=0&&(t=t.replaceAll(i,s[i]));return t},I=()=>i?.variantPresets?.map(e=>`${S(e.optionName)}($2)${e.optionType}`).join("($1)"),V=()=>i?.variantPresets?.filter(e=>!!e?.hide)?.map(e=>e.optionName).join(","),_=system.createClass(classes.getVariantOptionGroupClass(o)),h=system.createStyle(styles.getVariantOptionGroupStyle(p,p)),j=getData.getTextVariantTitleData(e,"Liquid"),A=system.createClass(classes$1.getWrapVariantOptionClass(c,o)),w=()=>core.template`
2
- ${system.Liquid(`{%- assign presets = "${I()}" | split: '($1)' -%}`)}
3
- ${system.Liquid(`{% assign hiddenPresetOptions = "${V()}" | split: ',' %}`)}
1
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Text_liquid=require("../../../text/components/Text.liquid.js"),index_liquid=require("./components/variants/index.liquid.js"),Dropdown_liquid=require("./components/dropdown-swatches/Dropdown.liquid.js"),DropdownGroup_liquid=require("./components/dropdown-group/DropdownGroup.liquid.js"),helpers=require("../../../helpers.js"),mappingVariantStyles=require("./utils/mappingVariantStyles.js"),system=require("@gem-sdk/system"),getAttr=require("./common/main/getAttr.js"),styles=require("./common/main/styles.js"),classes=require("./common/main/classes.js"),getData=require("./common/main/getData.js"),classes$1=require("./common/variants/classes.js"),_function=require("../../helpers/function.js"),styles$1=require("./common/variants/styles.js");const DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=e=>{let{builderProps:s,styles:t,setting:i,advanced:a}=e,{align:o,swatchItemWidth:n,dropdownItemWidth:r,swatchSpacing:p,optionTypo:l,marginBottom:u}=t??{},{label:d,optionType:m,showAsSwatches:c,layout:y,hasPreSelected:g}=i??{},$=a?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:q}=s??{},v="groupOption"===m,f=()=>{let e={};return core.DEVICES.forEach(s=>{let t=core.getResponsiveValueByScreen(n,s);e[s]="auto"===t}),e},L=()=>{let e={};return core.DEVICES.forEach(s=>{e[s]=r?.[s]==="fill"}),e},S=core.composeMemo(()=>{let e=mappingVariantStyles.mappingVariantStyles(i?.variantPresets,t);return{...i,variantPresets:e}},[i?.variantPresets,t]),I=e=>{let s={"'":"'",'"':"""},t=e;for(let i in s)e.indexOf(i)>=0&&(t=t.replaceAll(i,s[i]));return t},V=()=>i?.variantPresets?.map(e=>`${I(e.optionName)}($2)${e.optionType}`).join("($1)"),_=()=>i?.variantPresets?.filter(e=>!!e?.hide)?.map(e=>e.optionName).join(","),h=system.createClass(classes.getVariantOptionGroupClass(o)),j=system.createStyle(styles.getVariantOptionGroupStyle(p,p)),A=getData.getTextVariantTitleData(e,"Liquid"),w=system.createClass(classes$1.getWrapVariantOptionClass(y,o)),D=()=>core.template`
2
+ ${system.Liquid(`{%- assign presets = "${V()}" | split: '($1)' -%}`)}
3
+ ${system.Liquid(`{% assign hiddenPresetOptions = "${_()}" | split: ',' %}`)}
4
4
  ${system.LiquidFor("option in options",`
5
5
  <div
6
6
  option-name="{{option.name | escape}}"
7
- class="${A} ${system.LiquidIf("hiddenPresetOptions contains option.name","gp-hidden")}"
7
+ class="${w} ${system.LiquidIf("hiddenPresetOptions contains option.name","gp-hidden")}"
8
+ style="${_function.getStyleOfObject(styles$1.getMarginBottomStyle(u))}${system.Liquid("{% if forloop.last %}--mb:0;{% endif %}")}"
8
9
  >
9
10
  ${system.Liquid("{%- assign showVariantClass = 'variant-display' -%}")}
10
11
  ${system.Liquid("{%- assign optionName = option.name -%}")}
@@ -12,11 +13,11 @@
12
13
  ${system.Liquid("{%- assign presetDetail = preset | split: '($2)' -%}")}
13
14
  ${system.LiquidIf("presetDetail[1] == 'dropdown' and presetDetail[0] == optionName",`${system.Liquid("{%- assign showVariantClass = '' -%}")} ${system.Liquid("{%- break -%}")}`)}
14
15
  `)}
15
- ${system.If(u,Text_liquid.default(j)," ")}
16
+ ${system.If(d,Text_liquid.default(A)," ")}
16
17
  <div
17
18
  variant-option-name="{{option.name | escape}}"
18
- class="${_}"
19
- style="${_function.getStyleOfObject(h)}"
19
+ class="${h}"
20
+ style="${_function.getStyleOfObject(j)}"
20
21
  >
21
22
  ${system.Liquid("{%- assign values = option.values -%}")}
22
23
  ${system.Liquid("{%- assign rootForloop = forloop.index0 -%}")}
@@ -29,11 +30,11 @@
29
30
  {%- assign selectedValue = variant.option3 -%}
30
31
  {%- endif -%}
31
32
  `)}
32
- ${system.If(!y,system.Liquid("{%- assign selectedValue = null -%}"),"")}
33
- ${system.If(m,b(),T())}
33
+ ${system.If(!g,system.Liquid("{%- assign selectedValue = null -%}"),"")}
34
+ ${system.If(c,T(),P())}
34
35
  </div>
35
36
  </div>`)}
36
- `,D=i?.variantPresets?.map(e=>({name:S(e.optionName),type:e.optionType})).map(e=>`${e.name}($1)${e.type}`).join("($2)").toString(),b=()=>core.template`
37
+ `,b=i?.variantPresets?.map(e=>({name:I(e.optionName),type:e.optionType})).map(e=>`${e.name}($1)${e.type}`).join("($2)").toString(),T=()=>core.template`
37
38
  ${system.Liquid("{%- assign optionRendered = false -%}")}
38
39
  ${system.Liquid("{%- assign swatches = shop.metafields.GEMPAGES.swatches -%}")}
39
40
  ${system.Liquid("{%- assign swatchesItems = swatches | split: '($1)' -%}")}
@@ -73,7 +74,7 @@
73
74
  ${system.Liquid("{%- assign imageUrls = imageUrlsString | split: '($8)' -%}")}
74
75
 
75
76
  ${system.LiquidIf("optionTitle == option.name",`
76
- ${system.Liquid(`{%- assign variantPresetString = "${D}" -%}`)}
77
+ ${system.Liquid(`{%- assign variantPresetString = "${b}" -%}`)}
77
78
  ${system.Liquid('{%- assign optionName = option.name | replace: "\'", "&apos;" | replace: \'"\', "&quot;" -%}')}
78
79
  ${system.Liquid("{%- assign items = variantPresetString | split:'($2)' -%}")}
79
80
  ${system.Liquid("{%- assign type = 'dropdown' -%}")}
@@ -83,23 +84,23 @@
83
84
  ${system.LiquidIf('itemPreset[0] == "base"',system.Liquid("{%- assign type = itemPreset[1] -%}"))}
84
85
  `)}
85
86
  ${system.Liquid("{%- assign optionRendered = true -%}")}
86
- ${system.LiquidFor("value in values",index_liquid.default({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:m,uid:$,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:y?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",optionType:"optionType",activeClass:y?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...t,...f,swatchAutoWidth:q(),optionTypo:l}))}
87
- ${system.LiquidIf("type == 'dropdown'",Dropdown_liquid.default({...t,...f,swatchAutoWidth:L(),optionTypo:l}))}
87
+ ${system.LiquidFor("value in values",index_liquid.default({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:c,uid:q,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:g?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",optionType:"optionType",activeClass:g?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...t,...S,swatchAutoWidth:f(),optionTypo:l}))}
88
+ ${system.LiquidIf("type == 'dropdown'",Dropdown_liquid.default({...t,...S,swatchAutoWidth:L(),optionTypo:l}))}
88
89
  `)}
89
90
  `)}
90
91
 
91
- ${system.LiquidIf("optionRendered == false",T())}
92
- `,T=()=>system.LiquidFor("value in values",index_liquid.default({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:m,uid:$,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:y?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:"optionType",activeClass:y?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...t,...f,swatchAutoWidth:q(),optionTypo:l,isRenderDefault:!0})),P=system.createClass(classes.getWrapDropdownClass(o)),E=getData.getDropdownGroupData(e),O=()=>`
93
- <div className="${P}">
92
+ ${system.LiquidIf("optionRendered == false",P())}
93
+ `,P=()=>system.LiquidFor("value in values",index_liquid.default({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:c,uid:q,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:g?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:"optionType",activeClass:g?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...t,...S,swatchAutoWidth:f(),optionTypo:l,isRenderDefault:!0})),O=system.createClass(classes.getWrapDropdownClass(o)),E=getData.getDropdownGroupData(e),x=()=>`
94
+ <div className="${O}">
94
95
  ${DropdownGroup_liquid.default(E)}
95
96
  </div>
96
- `;system.createStateOrContext({setting:f,styles:JSON.stringify(t),variants:"{{ product.variants | json | escape }}",optionsWithValues:"{{ product.options_with_values | json | escape }}",variantSelected:"{{ variant | json | escape }}",variantInventoryQuantity:"{{ product.variants | map: 'inventory_quantity' | json | escape }}",variantInventoryPolicy:"{{ product.variants | map: 'inventory_policy' | json | escape }}",moneyFormat:"{{ shop.money_format | json | escape }}",productId:"{{ product.id | json | escape }}",productUrl:"{{ product.url | json | escape }}",productHandle:"{{ product.handle | json | escape }}",displayState:`${JSON.stringify(g)}`,totalVariantCombinations:"{{ total_combinations }}",firstAvailableVariant:"{{ product.selected_or_first_available_variant | json | escape }}"});let C=system.createAttr(getAttr.getAttrs({uid:$,hasPreSelected:y})),N=system.createStyle(styles.getWrapperStyle(e)),F=system.createClass({"gp-grid !gp-ml-0":!0}),x=()=>{let e=core.isLocalEnv?"{{ 'gp-product-variant-v3.js' | asset_url }}":`${core.baseAssetURL}/assets-v2/gp-product-variant-v3.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`};return core.template`
97
+ `;system.createStateOrContext({setting:S,styles:JSON.stringify(t),variants:"{{ product.variants | json | escape }}",optionsWithValues:"{{ product.options_with_values | json | escape }}",variantSelected:"{{ variant | json | escape }}",variantInventoryQuantity:"{{ product.variants | map: 'inventory_quantity' | json | escape }}",variantInventoryPolicy:"{{ product.variants | map: 'inventory_policy' | json | escape }}",moneyFormat:"{{ shop.money_format | json | escape }}",productId:"{{ product.id | json | escape }}",productUrl:"{{ product.url | json | escape }}",productHandle:"{{ product.handle | json | escape }}",displayState:`${JSON.stringify($)}`,totalVariantCombinations:"{{ total_combinations }}",firstAvailableVariant:"{{ product.selected_or_first_available_variant | json | escape }}"});let C=system.createAttr(getAttr.getAttrs({uid:q,hasPreSelected:g})),N=system.createStyle(styles.getWrapperStyle(e)),F=system.createClass({"gp-flex gp-flex-col !gp-ml-0":!0}),U=()=>{let e=core.isLocalEnv?"{{ 'gp-product-variant-v3.js' | asset_url }}":`${core.baseAssetURL}/assets-v2/gp-product-variant-v3.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${helpers.getSettingPreloadData('class="gps-link" delay',"src")}="${e}" defer="defer"></script>`};return core.template`
97
98
  ${system.Liquid("{%- assign total_combinations = 1 -%}")}
98
99
  ${system.LiquidFor("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
99
100
  <gp-product-variants
100
101
  ${C}
101
102
  gp-data='{
102
- "setting":${JSON.stringify(f)?.replaceAll("'","&#039;")},
103
+ "setting":${JSON.stringify(S)?.replaceAll("'","&#039;")},
103
104
  "styles":${JSON.stringify(t)},
104
105
  "variants":{{product.variants | json | escape}},
105
106
  "optionsWithValues": {{product.options_with_values | json | escape}},
@@ -110,7 +111,7 @@
110
111
  "productId": {{product.id | json | escape}},
111
112
  "productUrl": {{product.url | json | escape}},
112
113
  "productHandle": {{product.handle | json | escape}},
113
- "displayState": ${JSON.stringify(g)},
114
+ "displayState": ${JSON.stringify($)},
114
115
  "totalVariantCombinations": {{total_combinations}},
115
116
  "firstAvailableVariant": {{product.selected_or_first_available_variant | json | escape}}
116
117
  }
@@ -121,9 +122,9 @@
121
122
  class="${F}"
122
123
  style="${N}"
123
124
  >
124
- ${system.If(v,O(),w())}
125
+ ${system.If(v,x(),D())}
125
126
  </div>`)}
126
127
  </gp-product-variants>
127
128
 
128
- ${x()}
129
+ ${U()}
129
130
  `};exports.default=ProductVariants;
@@ -1 +1 @@
1
- "use strict";var core=require("@gem-sdk/core"),helpers=require("../../../../../helpers.js");const getWrapperStyle=e=>{let{style:r,styles:t,setting:o}=e,{width:p,align:l,marginBottom:a}=t??{},{column:s}=o??{},i=core.makeStyleResponsive("w",core.makeWidth(p));return helpers.filterTruthyObject({...core.optionLayoutStyle(s),...core.makeStyleResponsive("ta",l),...i,...r,...core.makeStyleResponsive("rg",a)})},getVariantOptionGroupStyle=(e,r)=>helpers.filterTruthyObject({...core.makeStyle({rg:e,cg:r})});exports.getVariantOptionGroupStyle=getVariantOptionGroupStyle,exports.getWrapperStyle=getWrapperStyle;
1
+ "use strict";var core=require("@gem-sdk/core"),helpers=require("../../../../../helpers.js");const getWrapperStyle=e=>{let{style:t,styles:r,setting:o}=e,{width:p,align:l}=r??{},{column:a}=o??{},i=core.makeStyleResponsive("w",core.makeWidth(p));return helpers.filterTruthyObject({...core.optionLayoutStyle(a),...core.makeStyleResponsive("ta",l),...i,...t})},getVariantOptionGroupStyle=(e,t)=>helpers.filterTruthyObject({...core.makeStyle({rg:e,cg:t})});exports.getVariantOptionGroupStyle=getVariantOptionGroupStyle,exports.getWrapperStyle=getWrapperStyle;
@@ -1 +1 @@
1
- "use strict";var core=require("@gem-sdk/core"),helpers=require("../../../../../helpers.js");const getLabelVariantStyle=e=>e?helpers.filterTruthyObject(core.makeStyleResponsive("w",core.makeWidth(e))):{};exports.getLabelVariantStyle=getLabelVariantStyle;
1
+ "use strict";var core=require("@gem-sdk/core"),helpers=require("../../../../../helpers.js");const getLabelVariantStyle=e=>e?helpers.filterTruthyObject(core.makeStyleResponsive("w",core.makeWidth(e))):{},getMarginBottomStyle=(e,t)=>!e||t?{}:helpers.filterTruthyObject(core.makeStyleResponsive("mb",e));exports.getLabelVariantStyle=getLabelVariantStyle,exports.getMarginBottomStyle=getMarginBottomStyle;
@@ -1 +1 @@
1
- "use strict";var core=require("@gem-sdk/core");const getProgressBarClasses=e=>{let{effect:s}=e??{},o=s?core.composeClasses("before:gp-absolute before:gp-left-0 before:gp-h-full before:gp-w-full before:gp-animate-shift before:gp-content-[''] before:gp-bg-stock-counter-animate before:gp-bg-[length:60px_100%] before:gp-shadow-stock-counter"):{};return{...core.composeClasses("gp-sc-progress-bar gp-relative gp-w-full -gp-scale-100 !gp-bg-[length:200%]"),...o}},getContainerClasses=e=>{let{progressBarPosition:s="bottom"}=e??{},o="bottom"===s;return{...core.composeClasses("gp-inline-block gp-flex gp-gap-y-1.5"),"gp-flex-col":o,"gp-flex-col-reverse":!o}},getLiquidTagClasses=e=>({...core.composeClasses("gp-product-stock-counter data-[visible=true]:gp-block data-[visible=false]:gp-hidden"),...core.composeClasses(e?.cssClass)}),getWrapperIconClasses=e=>{let{iconPosition:s="left"}=e??{};return{...core.composeClasses("gp-flex gp-items-baseline gp-gap-x-1"),"gp-flex-row":"left"===s,"gp-flex-row-reverse gp-justify-end":"right"===s}},getIconClasses=()=>({...core.composeClasses("gp-shrink-0 gp-bg-[length:60px_100%]")}),getTextClasses=e=>{let{typo:s}=e??{},o=core.composeTypographyClassName(s,e?.typography);return{...core.composeClasses(o)}},getWrapperClasses=(e,s)=>{let{hiddenCounterWhenOutOfStock:o}=e??{};return{...core.composeClasses("gp-flex"),"gp-opacity-50":s&&o}};exports.getContainerClasses=getContainerClasses,exports.getIconClasses=getIconClasses,exports.getLiquidTagClasses=getLiquidTagClasses,exports.getProgressBarClasses=getProgressBarClasses,exports.getTextClasses=getTextClasses,exports.getWrapperClasses=getWrapperClasses,exports.getWrapperIconClasses=getWrapperIconClasses;
1
+ "use strict";var core=require("@gem-sdk/core");const getProgressBarClasses=e=>{let{effect:s}=e??{},o=s?core.composeClasses("before:gp-absolute before:gp-left-0 before:gp-h-full before:gp-w-full before:gp-animate-shift before:gp-content-[''] before:gp-bg-stock-counter-animate before:gp-bg-[length:60px_100%] before:gp-shadow-stock-counter"):{};return{...core.composeClasses("gp-sc-progress-bar gp-relative gp-w-full -gp-scale-100 !gp-bg-[length:200%]"),...o}},getContainerClasses=e=>{let{progressBarPosition:s="bottom"}=e??{},o="bottom"===s;return{...core.composeClasses("gp-inline-block gp-flex gp-gap-y-1.5"),"gp-flex-col":o,"gp-flex-col-reverse":!o}},getLiquidTagClasses=e=>({...core.composeClasses("gp-product-stock-counter data-[visible=true]:gp-block data-[visible=false]:gp-hidden"),...core.composeClasses(e?.cssClass)}),getWrapperIconClasses=e=>{let{iconPosition:s="left"}=e??{};return{...core.composeClasses("gp-flex gp-items-baseline gp-gap-x-1"),"gp-flex-row":"left"===s,"gp-flex-row-reverse gp-justify-end":"right"===s}},getIconClasses=()=>({...core.composeClasses("[&>svg]:!gp-h-[var(--w)] [&>svg]:!gp-w-auto tablet:[&>svg]:!gp-h-[var(--w-tablet)] mobile:[&>svg]:!gp-h-[var(--w-mobile)]")}),getTextClasses=e=>{let{typo:s}=e??{},o=core.composeTypographyClassName(s,e?.typography);return{...core.composeClasses(o)}},getWrapperClasses=(e,s)=>{let{hiddenCounterWhenOutOfStock:o}=e??{};return{...core.composeClasses("gp-flex"),"gp-opacity-50":s&&o}};exports.getContainerClasses=getContainerClasses,exports.getIconClasses=getIconClasses,exports.getLiquidTagClasses=getLiquidTagClasses,exports.getProgressBarClasses=getProgressBarClasses,exports.getTextClasses=getTextClasses,exports.getWrapperClasses=getWrapperClasses,exports.getWrapperIconClasses=getWrapperIconClasses;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),useStockCounterInteraction=require("../hooks/useStockCounterInteraction.js"),system=require("@gem-sdk/system"),useStockCounter=require("../hooks/useStockCounter.js"),helpers=require("../common/helpers.js"),classes=require("../common/classes.js"),styles=require("../common/styles.js"),attrs=require("../common/attrs.js");const StockCounter=({setting:e,styles:s,builderProps:t})=>{let{displayProgressBar:r,borderRadius:l}=s??{},{showIcon:a,icon:c,layout:n="full",oosIcon:o}=e??{},{outputMessage:u,isOutOfStock:i,inventoryQuantity:m}=useStockCounter.useStockCounter(e,s),y=React.useRef(null),{dispatchStockCounterInteraction:j}=useStockCounterInteraction.useStockCounterInteraction({element:y,uid:t?.uid}),S=helpers.getInlineCss(t?.uid,l),C=!1!==r&&!i,x="progress-bar"!==n,g=system.createClass({...classes.getProgressBarClasses(s)}),d=system.createStyle({...styles.getProgressBarStyles(s,e)}),p=system.createStyle({...styles.getContainerStyles(s)}),k=system.createClass({...classes.getContainerClasses(e)}),I=system.createStyle({...styles.getWrapperStyles(s)}),R=system.createClass({...classes.getWrapperIconClasses(e)}),h=system.createClass({...classes.getIconClasses()}),_=t=>system.createStyle({...styles.getIconStyles(s,e,t)}),f=({isOutOfStockIcon:e,isVisible:s})=>system.createAttr({...attrs.getIconAttrs(e,s)}),q=system.createClass({...classes.getTextClasses(s)}),v=e=>system.createStyle({...styles.getTextStyles(s,e)}),N=system.createClass({...classes.getWrapperClasses(e,i)}),T=system.createAttr({...attrs.getWrapperAttrs(t)});return React.useEffect(()=>{j(m)},[m]),jsxRuntime.jsxs("div",{...T,style:I,ref:y,className:N,children:[jsxRuntime.jsx("style",{children:S}),jsxRuntime.jsxs("div",{className:k,style:p,children:[jsxRuntime.jsxs("div",{className:R,children:[a&&(i?jsxRuntime.jsx("div",{...f({isOutOfStockIcon:i,isVisible:i}),dangerouslySetInnerHTML:{__html:o||""},className:h,style:_(!0)}):jsxRuntime.jsx("div",{...f({isOutOfStockIcon:!i,isVisible:!i}),dangerouslySetInnerHTML:{__html:c||""},className:h,style:_(!1)})),x&&(i?jsxRuntime.jsx("p",{dangerouslySetInnerHTML:{__html:u()},className:q,style:v(!0)}):jsxRuntime.jsx("p",{dangerouslySetInnerHTML:{__html:u()},className:q,style:v(!1)}))]}),C&&jsxRuntime.jsx("div",{style:d,className:g})]})]})};exports.default=StockCounter;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),React=require("react"),useStockCounterInteraction=require("../hooks/useStockCounterInteraction.js"),system=require("@gem-sdk/system"),useStockCounter=require("../hooks/useStockCounter.js"),helpers=require("../common/helpers.js"),classes=require("../common/classes.js"),styles=require("../common/styles.js"),attrs=require("../common/attrs.js");const StockCounter=({setting:e,styles:s,builderProps:t})=>{let{displayProgressBar:r,borderRadius:l}=s??{},{showIcon:a,icon:n,layout:c="full",oosIcon:o}=e??{},{outputMessage:u,isOutOfStock:i,inventoryQuantity:m}=useStockCounter.useStockCounter(e,s),y=React.useRef(null),{dispatchStockCounterInteraction:j}=useStockCounterInteraction.useStockCounterInteraction({element:y,uid:t?.uid}),x=helpers.getInlineCss(t?.uid,l),S=!1!==r&&!i,C="progress-bar"!==c,d=system.createClass({...classes.getProgressBarClasses(s)}),g=system.createStyle({...styles.getProgressBarStyles(s,e)}),p=system.createStyle({...styles.getContainerStyles(s)}),R=system.createClass({...classes.getContainerClasses(e)}),h=system.createStyle({...styles.getWrapperStyles(s)}),k=system.createClass({...classes.getWrapperIconClasses(e)}),I=system.createClass({...classes.getIconClasses()}),_=t=>system.createStyle({...styles.getIconStyles(s,e,t)}),f=({isOutOfStockIcon:e,isVisible:s})=>system.createAttr({...attrs.getIconAttrs(e,s)}),q=system.createClass({...classes.getTextClasses(s)}),v=e=>system.createStyle({...styles.getTextStyles(s,e)}),N=system.createClass({...classes.getWrapperClasses(e,i)}),T=system.createAttr({...attrs.getWrapperAttrs(t)});return React.useEffect(()=>{j(m)},[m]),jsxRuntime.jsxs("div",{...T,style:h,ref:y,className:N,children:[jsxRuntime.jsx("style",{children:x}),jsxRuntime.jsxs("div",{className:R,style:p,children:[jsxRuntime.jsxs("div",{className:k,children:[a&&(i?jsxRuntime.jsx("div",{...f({isOutOfStockIcon:i,isVisible:i}),style:_(!0),children:jsxRuntime.jsx("span",{className:I,dangerouslySetInnerHTML:{__html:o||""}})}):jsxRuntime.jsx("div",{...f({isOutOfStockIcon:!i,isVisible:!i}),style:_(!1),children:jsxRuntime.jsx("span",{className:I,dangerouslySetInnerHTML:{__html:n||""}})})),C&&(i?jsxRuntime.jsx("p",{dangerouslySetInnerHTML:{__html:u()},className:q,style:v(!0)}):jsxRuntime.jsx("p",{dangerouslySetInnerHTML:{__html:u()},className:q,style:v(!1)}))]}),S&&jsxRuntime.jsx("div",{style:g,className:d})]})]})};exports.default=StockCounter;
@@ -1 +1 @@
1
- "use strict";const SettingUIV2=[{label:{en:"Layout"},controls:[{layout:"vertical",setting:{id:"position"}}]},{label:{en:"Tabs"},controls:[{label:{en:"Order"},setting:{id:"childItem"},controlConfig:{id:"childItem",type:"child-item",labelItem:"tab",labelPopover:{en:"Tab management"}}},{label:{en:"Text"},type:"combo",iconName:"polaris-text-title",getValueFromSettingID:"labelTypoV2.type",isTypoValue:!0,isHideClear:!0,controls:[{layout:"vertical",setting:{id:"labelTypoV2"},options:{updateFields:[{field:"attrs.textAlign",settingId:"labelAlign"},{field:"attrs.color",settingId:"labelColor",state:"normal"}]},controlChangeTrigger:{settings:[{action:{controlId:"labelAlign",valueFromField:"attrs.textAlign",groupType:"setting",controlType:"setting"}},{action:{controlId:"labelColor",valueFromField:"attrs.color",groupType:"setting",controlType:"setting",removeDevice:!0,state:"normal"}}],options:{noRecordHistory:!0}}}]},{conditionDisplay:'position == "top"',label:{en:"Width"},setting:{id:"panelWidth"}}],moreSettings:{type:"collapse",controls:[{id:"Width",label:{en:"Width"},conditionDisplay:'position != "top"',controlConfig:{id:"width",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,fallbackValue:"Auto",linkWithSetting:{name:"labelWidth"},displayOptions:[{label:"Fit content",value:"Auto",showValue:!0},{label:"Full",value:"100%",showValue:!0}]},layout:"horizontal"},{label:{en:"Background"},setting:{id:"labelBgColor",state:"normal"}},{label:{en:"Border"},setting:{id:"borderTab",state:"normal"}},{conditionDisplay:'position == "top" && labelWidth != "100%"',label:{en:"Tabs align"},setting:{id:"panelAlign"}},{conditionDisplay:'position != "top" && labelWidth != "100%"',label:{en:"Tabs align"},setting:{id:"panelAlignVertical"}},{label:{en:"Hover effect"},type:"combo",iconName:"polaris-check-hover",fixedValue:"Enabled",setting:{id:"enableHoverEffect"},popoverLabel:{en:"Tabs hover effect"},controls:[{label:{en:"Text color"},setting:{id:"labelColor",state:"hover"}},{label:{en:"Background"},setting:{id:"labelBgColor",state:"hover"}},{label:{en:"Border"},setting:{id:"borderTab",state:"hover"}}]},{label:{en:"Active state"},type:"combo",setting:{id:"enableActiveEffect"},iconName:"polaris-status-active",fixedValue:"Enabled",popoverLabel:{en:"Tabs active state"},controls:[{label:{en:"Text color"},setting:{id:"labelColor",state:"active"}},{label:{en:"Background"},setting:{id:"labelBgColor",state:"active"}},{label:{en:"Border"},setting:{id:"borderTab",state:"active"}}]}]}},{label:{en:"Size"},controls:[{id:"containWidth",label:{en:"Width"},controlConfig:{id:"containWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,linkWithSetting:{name:"containWidth"}},layout:"horizontal"},{label:{en:"Padding"},controlConfig:{id:"padding",type:"padding-v2",linkWithSetting:{name:"spacing-setting",field:"padding"}}}]},{label:{en:"Background"},controls:[{setting:{id:"background"},layout:"vertical"}]},{label:{en:"Shape"},controls:[{label:{en:"Border"},controlConfig:{id:"border-advanced",type:"border-v2",linkWithSetting:{name:"border",field:"normal"},compoDefaultValue:{color:"line-3",border:"solid",width:"1px",borderWidth:"1px"}}},{label:{en:"Corner"},setting:{id:"rounded",state:"normal"}},{label:{en:"Shadow"},setting:{id:"boxShadow",state:"normal"},options:{updateFields:[{field:"normal.enable",settingId:"hasBoxShadow",state:"normal"}]},controlChangeTrigger:{settings:[{condition:"boxShadow.normal.enable === true",source:["boxShadow","hasBoxShadow"],action:{controlId:"hasBoxShadow",groupType:"advanced",controlType:"advanced",state:"normal",newValue:!0}},{condition:"boxShadow.normal.enable === false",source:["boxShadow","hasBoxShadow"],action:{controlId:"hasBoxShadow",groupType:"advanced",controlType:"advanced",state:"normal",newValue:!1}}],options:{noRecordHistory:!0}}}]},{label:{en:"Display option"},controls:[{label:{en:"Default active"},setting:{id:"activeKey"}}]},{controls:[{label:{en:"Align"},setting:{id:"align"},options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"},conditionEnable:'!(parseInt(containWidth) >= 100 && containWidth?.includes("%"))'}]}];exports.SettingUIV2=SettingUIV2;
1
+ "use strict";const SettingUIV2=[{label:{en:"Layout"},controls:[{layout:"vertical",setting:{id:"position"}}]},{label:{en:"Tabs"},controls:[{label:{en:"Order"},setting:{id:"childItem"},controlConfig:{id:"childItem",type:"child-item",labelItem:"tab",labelPopover:{en:"Tab management"}}},{label:{en:"Text"},type:"combo",iconName:"polaris-text-title",getValueFromSettingID:"labelTypoV2.type",isTypoValue:!0,isHideClear:!0,controls:[{layout:"vertical",setting:{id:"labelTypoV2"},options:{updateFields:[{field:"attrs.textAlign",settingId:"labelAlign"},{field:"attrs.color",settingId:"labelColor",state:"normal"}]},controlChangeTrigger:{settings:[{action:{controlId:"labelAlign",valueFromField:"attrs.textAlign",groupType:"setting",controlType:"setting"}},{action:{controlId:"labelColor",valueFromField:"attrs.color",groupType:"setting",controlType:"setting",removeDevice:!0,state:"normal"}}],options:{noRecordHistory:!0}}}]},{conditionDisplay:'position == "top"',label:{en:"Width"},setting:{id:"panelWidth"}}],moreSettings:{type:"collapse",controls:[{id:"Width",label:{en:"Width"},conditionDisplay:'position != "top"',controlConfig:{id:"width",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,fallbackValue:"Auto",linkWithSetting:{name:"labelWidth"},displayOptions:[{label:"Fit content",value:"Auto",showValue:!0},{label:"Full",value:"100%",showValue:!0}]},layout:"horizontal"},{label:{en:"Background"},setting:{id:"labelBgColor",state:"normal"}},{label:{en:"Border"},setting:{id:"borderTab",state:"normal"}},{conditionDisplay:'position == "top" && labelWidth != "100%"',label:{en:"Tabs align"},setting:{id:"panelAlign"}},{conditionDisplay:'position != "top" && labelWidth != "100%"',label:{en:"Tabs align"},setting:{id:"panelAlignVertical"}},{label:{en:"Hover effect"},type:"combo",iconName:"polaris-check-hover",fixedValue:"Enabled",setting:{id:"enableHoverEffect"},popoverLabel:{en:"Tabs hover effect"},controls:[{label:{en:"Text color"},setting:{id:"labelColor",state:"hover"}},{label:{en:"Background"},setting:{id:"labelBgColor",state:"hover"}},{label:{en:"Border"},setting:{id:"borderTab",state:"hover"}}]},{label:{en:"Active state"},type:"combo",setting:{id:"enableActiveEffect"},iconName:"polaris-status-active",fixedValue:"Enabled",popoverLabel:{en:"Tabs active state"},controls:[{label:{en:"Text color"},setting:{id:"labelColor",state:"active"}},{label:{en:"Background"},setting:{id:"labelBgColor",state:"active"}},{label:{en:"Border"},setting:{id:"borderTab",state:"active"}}]}]}},{label:{en:"Size"},controls:[{id:"containWidth",label:{en:"Width"},controlConfig:{id:"containWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,linkWithSetting:{name:"containWidth"},displayOptions:[{label:"Full",value:"100%",showValue:!0},{label:"Default",value:"1200px",showValue:!0}]},layout:"horizontal"},{label:{en:"Padding"},controlConfig:{id:"padding",type:"padding-v2",linkWithSetting:{name:"spacing-setting",field:"padding"}}}]},{label:{en:"Background"},controls:[{setting:{id:"background"},layout:"vertical"}]},{label:{en:"Shape"},controls:[{label:{en:"Border"},controlConfig:{id:"border-advanced",type:"border-v2",linkWithSetting:{name:"border",field:"normal"},compoDefaultValue:{color:"line-3",border:"solid",width:"1px",borderWidth:"1px"}}},{label:{en:"Corner"},setting:{id:"rounded",state:"normal"}},{label:{en:"Shadow"},setting:{id:"boxShadow",state:"normal"},options:{updateFields:[{field:"normal.enable",settingId:"hasBoxShadow",state:"normal"}]},controlChangeTrigger:{settings:[{condition:"boxShadow.normal.enable === true",source:["boxShadow","hasBoxShadow"],action:{controlId:"hasBoxShadow",groupType:"advanced",controlType:"advanced",state:"normal",newValue:!0}},{condition:"boxShadow.normal.enable === false",source:["boxShadow","hasBoxShadow"],action:{controlId:"hasBoxShadow",groupType:"advanced",controlType:"advanced",state:"normal",newValue:!1}}],options:{noRecordHistory:!0}}}]},{label:{en:"Display option"},controls:[{label:{en:"Default active"},setting:{id:"activeKey"}}]},{controls:[{label:{en:"Align"},setting:{id:"align"},options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"},conditionDisplay:'!(parseInt(containWidth) >= 100 && containWidth?.includes("%"))'}]}];exports.SettingUIV2=SettingUIV2;
@@ -1 +1 @@
1
- import{ESTIMATE_DAYS as e,listFormatDate as t,OUT_OF_STOCK as a}from"../../common/helpers.js";let EstimateDateSettings=[{id:"setting",controls:[{id:"enableCustomText",label:"",type:"toggle",default:!0},{id:"customTextContainer",type:"group",controls:[{id:"customText",type:"input",default:"Estimate delivery between"}]},{id:"estimateDays",type:"group",controls:[{id:"typeEstimate",type:"group",controls:[{id:"typeEstimate",label:"Type",type:"option:value",default:e.RANGE,options:[{label:"Specific",value:e.SPECIFIC},{label:"Range",value:e.RANGE}]},{id:"minEstimate",label:"Min estimate",type:"input:number",default:2,emptyOnClear:!1,min:1,max:99969999},{id:"maxEstimate",label:"Max estimate",type:"input:number",default:5,emptyOnClear:!1,min:1,max:99969999},{id:"estimateTime",label:"Estimate",type:"input:number",default:5,emptyOnClear:!1,min:0,max:99969999}]}]},{id:"dateFormat",type:"group",controls:[{id:"typeFormat",label:"Type",type:"select",default:t().FORMAT_1.value,options:[{label:t().FORMAT_1.Label,value:t().FORMAT_1.value},{label:t().FORMAT_2.Label,value:t().FORMAT_2.value},{label:t().FORMAT_3.Label,value:t().FORMAT_3.value},{label:t().FORMAT_4.Label,value:t().FORMAT_4.value},{label:t().FORMAT_5.Label,value:t().FORMAT_5.value},{label:t().FORMAT_6.Label,value:t().FORMAT_6.Label}]},{id:"customFormat",label:"Custom format",type:"input",default:"",placeholder:"Eg: %d, %b, %y"},{id:"moreFormat",type:"group"}]},{id:"visibilityContainer",type:"group",controls:[{id:"visibility",type:"childrens"},{id:"ifOutOfStock",label:"If out of stock",type:"option:value",default:a.HIDE,options:[{label:"Show",value:a.SHOW},{label:"Hide",value:a.HIDE}]}]},{id:"translate",type:"input",default:"customText"},{id:"globalSize",type:"size-setting",devices:{desktop:{default:{width:"100%"}}},settingConfig:{width:{displayOptions:["full","auto"],sizeConfig:{small:"100px",medium:"116px",large:"132px"}}},hiddenSettings:["shape","gap","height"]},{id:"background",type:"background-media",ignoreReRender:!0,devices:{desktop:{default:{type:"color",color:"transparent",image:{src:"",width:0,height:0},size:"cover",position:{x:50,y:50},repeat:"no-repeat",attachment:"scroll"}}},compoDefaultValue:{desktop:{default:{type:"color",color:"#FFFFFF",image:{src:"https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/",width:1200,height:480},size:"cover",position:{x:50,y:50},repeat:"no-repeat",attachment:"scroll",preload:!1}}}}]},{id:"style",controls:[{id:"typoCustom",type:"typography-v2",default:{type:"paragraph-2",attrs:{color:"text-1"}},ignoreReRender:!0,hiddenSetting:{textAlign:!0,textShadow:!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:"typoDate",type:"typography-v2",default:{type:"paragraph-2",attrs:{color:"text-1",bold:!0}},ignoreReRender:!0,hiddenSetting:{textAlign:!0,textShadow:!0}},{id:"shapeBorder",type:"border-v2",devices:{desktop:{default:void 0}},compoDefaultValue:{desktop:{default:{border:"solid",color:"#121212",width:"1px",borderWidth:"1px"}}}},{id:"shapeRounded",type:"corner-v2",devices:{desktop:{default:void 0}},compoDefaultValue:{desktop:{default:{btrr:"8px",bblr:"8px",bbrr:"8px",btlr:"8px",radiusType:"rounded"}}}},{id:"padding",type:"padding-v2",devices:{desktop:{default:{padding:{type:"small",top:"4px",left:"4px",bottom:"4px",right:"4px"}}}},compoDefaultValue:{desktop:{default:{padding:{type:"small",top:"4px",left:"4px",bottom:"4px",right:"4px"}}}}},{id:"shapeBoxShadow",type:"shadow-v2",devices:{desktop:{default:{enable:!1}}},compoDefaultValue:{desktop:{default:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"rgba(18, 18, 18, 0.2)",angle:45,enable:!0}}}}]}];export{EstimateDateSettings};
1
+ import{ESTIMATE_DAYS as e,listFormatDate as t,OUT_OF_STOCK as a}from"../../common/helpers.js";let EstimateDateSettings=[{id:"setting",controls:[{id:"enableCustomText",label:"",type:"toggle",default:!0},{id:"customTextContainer",type:"group",controls:[{id:"customText",type:"input",default:"Estimate delivery between"}]},{id:"estimateDays",type:"group",controls:[{id:"typeEstimate",type:"group",controls:[{id:"typeEstimate",label:"Type",type:"option:value",default:e.RANGE,options:[{label:"Specific",value:e.SPECIFIC},{label:"Range",value:e.RANGE}]},{id:"minEstimate",label:"Min estimate",type:"input:number",default:2,emptyOnClear:!1,min:1,max:99969999,fallbackValue:2},{id:"maxEstimate",label:"Max estimate",type:"input:number",default:5,emptyOnClear:!1,min:1,max:99969999,fallbackValue:5},{id:"estimateTime",label:"Estimate",type:"input:number",default:5,emptyOnClear:!1,min:0,max:99969999,fallbackValue:5}]}]},{id:"dateFormat",type:"group",controls:[{id:"typeFormat",label:"Type",type:"select",default:t().FORMAT_1.value,options:[{label:t().FORMAT_1.Label,value:t().FORMAT_1.value},{label:t().FORMAT_2.Label,value:t().FORMAT_2.value},{label:t().FORMAT_3.Label,value:t().FORMAT_3.value},{label:t().FORMAT_4.Label,value:t().FORMAT_4.value},{label:t().FORMAT_5.Label,value:t().FORMAT_5.value},{label:t().FORMAT_6.Label,value:t().FORMAT_6.Label}]},{id:"customFormat",label:"Custom format",type:"input",default:"",placeholder:"Eg: %d, %b, %y"},{id:"moreFormat",type:"group"}]},{id:"visibilityContainer",type:"group",controls:[{id:"visibility",type:"childrens"},{id:"ifOutOfStock",label:"If out of stock",type:"option:value",default:a.HIDE,options:[{label:"Show",value:a.SHOW},{label:"Hide",value:a.HIDE}]}]},{id:"translate",type:"input",default:"customText"},{id:"globalSize",type:"size-setting",devices:{desktop:{default:{width:"100%"}}},settingConfig:{width:{displayOptions:["full","auto"],sizeConfig:{small:"100px",medium:"116px",large:"132px"}}},hiddenSettings:["shape","gap","height"]},{id:"background",type:"background-media",ignoreReRender:!0,devices:{desktop:{default:{type:"color",color:"transparent",image:{src:"",width:0,height:0},size:"cover",position:{x:50,y:50},repeat:"no-repeat",attachment:"scroll"}}},compoDefaultValue:{desktop:{default:{type:"color",color:"#FFFFFF",image:{src:"https://ucarecdn.com/06075225-af9e-460c-8e3c-6be63c0b773a/-/format/auto/",width:1200,height:480},size:"cover",position:{x:50,y:50},repeat:"no-repeat",attachment:"scroll",preload:!1}}}}]},{id:"style",controls:[{id:"typoCustom",type:"typography-v2",default:{type:"paragraph-2",attrs:{color:"text-1"}},ignoreReRender:!0,hiddenSetting:{textAlign:!0,textShadow:!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:"typoDate",type:"typography-v2",default:{type:"paragraph-2",attrs:{color:"text-1",bold:!0}},ignoreReRender:!0,hiddenSetting:{textAlign:!0,textShadow:!0}},{id:"shapeBorder",type:"border-v2",devices:{desktop:{default:void 0}},compoDefaultValue:{desktop:{default:{border:"solid",color:"#121212",width:"1px",borderWidth:"1px"}}}},{id:"shapeRounded",type:"corner-v2",devices:{desktop:{default:void 0}},compoDefaultValue:{desktop:{default:{btrr:"8px",bblr:"8px",bbrr:"8px",btlr:"8px",radiusType:"rounded"}}}},{id:"padding",type:"padding-v2",devices:{desktop:{default:{padding:{type:"small",top:"4px",left:"4px",bottom:"4px",right:"4px"}}}},compoDefaultValue:{desktop:{default:{padding:{type:"small",top:"4px",left:"4px",bottom:"4px",right:"4px"}}}}},{id:"shapeBoxShadow",type:"shadow-v2",devices:{desktop:{default:{enable:!1}}},compoDefaultValue:{desktop:{default:{type:"shadow-1",distance:"4px",blur:"4px",spread:"0px",color:"rgba(18, 18, 18, 0.2)",angle:45,enable:!0}}}}]}];export{EstimateDateSettings};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsx as o,jsxs as t}from"react/jsx-runtime";import{useVariants as e,OptionSpecialStyle as n,DEVICES as i,getResponsiveValueByScreen as r}from"@gem-sdk/core";import a from"../../../text/components/Text.js";import s from"./components/variants/index.js";import m from"./components/dropdown-swatches/Dropdown.js";import p from"./components/dropdown-group/DropdownGroup.js";import c from"../../../common/components/NoDataState.js";import{createClass as l,createAttr as d,createStyle as u,If as f}from"@gem-sdk/system";import{getWrapperStyle as h,getVariantOptionGroupStyle as y}from"./common/main/styles.js";import{getAttrs as g}from"./common/main/getAttr.js";import{getWrapDropdownClass as v,getVariantOptionGroupClass as w}from"./common/main/classes.js";import{getDropdownGroupData as j,getTextVariantTitleData as N}from"./common/main/getData.js";import{useGpVariants as b}from"./hooks/useGpVariants.js";import{getWrapVariantOptionClass as k}from"./common/variants/classes.js";let ProductVariants=x=>{let{builderProps:T,styles:A,setting:P}=x,{align:V,optionTypo:D,swatchItemWidth:$,dropdownItemWidth:S,swatchSpacing:C}=A??{},{label:E,showAsSwatches:G,layout:O,hasPreSelected:W}=P??{},{uid:_}=T??{},z=e(),{mode:K,options:R,variantId:q,elementRef:B,variantGroup:F,isChangeVariant:H,selectedOptions:I,isDefaultVariant:J,getVariantConfiguration:L,redirectProductShopifyLink:M}=b(x,z),Q=()=>{let o={};return i.forEach(t=>{let e=r($,t);o[t]="auto"===e}),o},U=()=>{let o={};return i.forEach(t=>{o[t]=S?.[t]==="fill"}),o},X=()=>R?.map((e,i)=>{let r=L(e.name),p=r?r.optionType:e.optionType,c=r?r.presets[r.optionType||"rectangle_list"]?.spacing:C,d=(W||q)&&e.name?I?.[e.name]:void 0,h=r?.hide;if(h)return null;let g=l(w(V)),v=u(y(C,c)),j=N(x,"React",{optionName:e.name,hasPreSelected:W,selectedOptions:I,styleOptionSelected:p}),b=l(k(O,V));return t("div",{className:b,children:[f(E,o(a,{...j})),t("div",{className:g,style:v,children:[G&&n.includes(`${p}`)&&e.values.map(t=>{let n=(!!W||!!H&&!!q)&&!!e.name&&I?.[e.name]===t.label;return o(s,{variantKey:`${e.id}-${t.id}`,showAsSwatches:G,uid:_,optionName:e.name??"",optionValue:t.label??"",name:e.name,value:t,optionNumber:R.length,optionPosition:i,...A,...P,presetConfiguration:L(e.name),checked:n,typeOfOption:p||"dropdown",swatchAutoWidth:Q(),optionTypo:D},t.id)}),f(("dropdown"===p||G&&!n.includes(`${p}`))&&"radio_buttons"!==p,o(m,{...A,...P,variants:z,option:e,initValue:d,presetConfiguration:L(e.name),swatchAutoWidth:U(),optionTypo:D,optionPosition:i,optionNumber:R.length}))]})]},e.id)}),Y=l(v(V)),Z=j(x),oo=()=>o("div",{className:Y,children:o(p,{...Z})});if(J&&"edit"===K)return o(c,{elementType:"secondary",description:"Setup options like colors, sizes with product variant.",descriptionActions:[{text:"Add new variant",callback:M},{text:"sync data",callback:"syncProduct"}]});let ot=d(g({uid:_,hasPreSelected:W})),oe=u(h(x)),on=l({"gp-grid !gp-ml-0":!0});return o("div",{ref:B,...ot,className:on,style:oe,children:f(F,oo(),X())})};export{ProductVariants as default};
2
+ import{jsx as o,jsxs as t}from"react/jsx-runtime";import{useVariants as e,OptionSpecialStyle as n,DEVICES as r,getResponsiveValueByScreen as i}from"@gem-sdk/core";import a from"../../../text/components/Text.js";import s from"./components/variants/index.js";import m from"./components/dropdown-swatches/Dropdown.js";import p from"./components/dropdown-group/DropdownGroup.js";import l from"../../../common/components/NoDataState.js";import{createClass as c,createAttr as d,createStyle as u,If as f}from"@gem-sdk/system";import{getWrapperStyle as h,getVariantOptionGroupStyle as y}from"./common/main/styles.js";import{getAttrs as g}from"./common/main/getAttr.js";import{getWrapDropdownClass as v,getVariantOptionGroupClass as j}from"./common/main/classes.js";import{getDropdownGroupData as w,getTextVariantTitleData as x}from"./common/main/getData.js";import{useGpVariants as N}from"./hooks/useGpVariants.js";import{getWrapVariantOptionClass as b}from"./common/variants/classes.js";import{getMarginBottomStyle as k}from"./common/variants/styles.js";let ProductVariants=T=>{let{builderProps:A,styles:P,setting:V}=T,{align:D,optionTypo:$,swatchItemWidth:S,dropdownItemWidth:C,swatchSpacing:E,marginBottom:G}=P??{},{label:O,showAsSwatches:W,layout:_,hasPreSelected:z}=V??{},{uid:K}=A??{},R=e(),{mode:q,options:B,variantId:F,elementRef:H,variantGroup:I,isChangeVariant:J,selectedOptions:L,isDefaultVariant:M,getVariantConfiguration:Q,redirectProductShopifyLink:U}=N(T,R),X=()=>{let o={};return r.forEach(t=>{let e=i(S,t);o[t]="auto"===e}),o},Y=()=>{let o={};return r.forEach(t=>{o[t]=C?.[t]==="fill"}),o},Z=()=>B?.map((e,r)=>{let i=Q(e.name),p=i?i.optionType:e.optionType,l=i?i.presets[i.optionType||"rectangle_list"]?.spacing:E,d=(z||F)&&e.name?L?.[e.name]:void 0,h=i?.hide;if(h)return null;let g=c(j(D)),v=u(y(E,l)),w=x(T,"React",{optionName:e.name,hasPreSelected:z,selectedOptions:L,styleOptionSelected:p}),N=c(b(_,D)),A=r===B.length-1;return t("div",{className:N,style:u(k(G,A)),children:[f(O,o(a,{...w})),t("div",{className:g,style:v,children:[W&&n.includes(`${p}`)&&e.values.map(t=>{let n=(!!z||!!J&&!!F)&&!!e.name&&L?.[e.name]===t.label;return o(s,{variantKey:`${e.id}-${t.id}`,showAsSwatches:W,uid:K,optionName:e.name??"",optionValue:t.label??"",name:e.name,value:t,optionNumber:B.length,optionPosition:r,...P,...V,presetConfiguration:Q(e.name),checked:n,typeOfOption:p||"dropdown",swatchAutoWidth:X(),optionTypo:$},t.id)}),f(("dropdown"===p||W&&!n.includes(`${p}`))&&"radio_buttons"!==p,o(m,{...P,...V,variants:R,option:e,initValue:d,presetConfiguration:Q(e.name),swatchAutoWidth:Y(),optionTypo:$,optionPosition:r,optionNumber:B.length}))]})]},e.id)}),oo=c(v(D)),ot=w(T),oe=()=>o("div",{className:oo,children:o(p,{...ot})});if(M&&"edit"===q)return o(l,{elementType:"secondary",description:"Setup options like colors, sizes with product variant.",descriptionActions:[{text:"Add new variant",callback:U},{text:"sync data",callback:"syncProduct"}]});let on=d(g({uid:K,hasPreSelected:z})),or=u(h(T)),oi=c({"gp-flex gp-flex-col !gp-ml-0":!0});return o("div",{ref:H,...on,className:oi,style:or,children:f(I,oe(),Z())})};export{ProductVariants as default};
@@ -1,10 +1,11 @@
1
- import{composeMemo as t,template as e,DEVICES as s,getResponsiveValueByScreen as a,isLocalEnv as i,baseAssetURL as o}from"@gem-sdk/core";import n from"../../../text/components/Text.liquid.js";import p from"./components/variants/index.liquid.js";import r from"./components/dropdown-swatches/Dropdown.liquid.js";import l from"./components/dropdown-group/DropdownGroup.liquid.js";import{getSettingPreloadData as m}from"../../../helpers.js";import{mappingVariantStyles as c}from"./utils/mappingVariantStyles.js";import{createClass as d,createStyle as u,createStateOrContext as $,createAttr as g,Liquid as v,LiquidFor as y,LiquidIf as f,If as S}from"@gem-sdk/system";import{getAttrs as V}from"./common/main/getAttr.js";import{getVariantOptionGroupStyle as h,getWrapperStyle as _}from"./common/main/styles.js";import{getVariantOptionGroupClass as j,getWrapDropdownClass as I}from"./common/main/classes.js";import{getTextVariantTitleData as A,getDropdownGroupData as w}from"./common/main/getData.js";import{getWrapVariantOptionClass as b}from"./common/variants/classes.js";import{getStyleOfObject as P}from"../../helpers/function.js";let DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=T=>{let{builderProps:N,styles:D,setting:E,advanced:O}=T,{align:U,swatchItemWidth:K,dropdownItemWidth:q,swatchSpacing:x,optionTypo:C}=D??{},{label:k,optionType:F,showAsSwatches:G,layout:J,hasPreSelected:L}=E??{},R=O?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:W}=N??{},z="groupOption"===F,H=()=>{let t={};return s.forEach(e=>{let s=a(K,e);t[e]="auto"===s}),t},M=()=>{let t={};return s.forEach(e=>{t[e]=q?.[e]==="fill"}),t},Q=t(()=>{let t=c(E?.variantPresets,D);return{...E,variantPresets:t}},[E?.variantPresets,D]),Y=t=>{let e={"'":"&apos;",'"':"&quot;"},s=t;for(let a in e)t.indexOf(a)>=0&&(s=s.replaceAll(a,e[a]));return s},B=()=>E?.variantPresets?.map(t=>`${Y(t.optionName)}($2)${t.optionType}`).join("($1)"),X=()=>E?.variantPresets?.filter(t=>!!t?.hide)?.map(t=>t.optionName).join(","),Z=d(j(U)),tt=u(h(x,x)),te=A(T,"Liquid"),ts=d(b(J,U)),ta=()=>e`
2
- ${v(`{%- assign presets = "${B()}" | split: '($1)' -%}`)}
3
- ${v(`{% assign hiddenPresetOptions = "${X()}" | split: ',' %}`)}
1
+ import{composeMemo as t,template as e,DEVICES as s,getResponsiveValueByScreen as a,isLocalEnv as i,baseAssetURL as o}from"@gem-sdk/core";import n from"../../../text/components/Text.liquid.js";import p from"./components/variants/index.liquid.js";import r from"./components/dropdown-swatches/Dropdown.liquid.js";import l from"./components/dropdown-group/DropdownGroup.liquid.js";import{getSettingPreloadData as m}from"../../../helpers.js";import{mappingVariantStyles as c}from"./utils/mappingVariantStyles.js";import{createClass as d,createStyle as u,createStateOrContext as $,createAttr as g,Liquid as v,LiquidFor as y,LiquidIf as f,If as S}from"@gem-sdk/system";import{getAttrs as V}from"./common/main/getAttr.js";import{getVariantOptionGroupStyle as h,getWrapperStyle as _}from"./common/main/styles.js";import{getVariantOptionGroupClass as j,getWrapDropdownClass as I}from"./common/main/classes.js";import{getTextVariantTitleData as A,getDropdownGroupData as w}from"./common/main/getData.js";import{getWrapVariantOptionClass as b}from"./common/variants/classes.js";import{getStyleOfObject as P}from"../../helpers/function.js";import{getMarginBottomStyle as T}from"./common/variants/styles.js";let DEFAULT_ADVANCED_DISPLAY_SETTING={desktop:!0,tablet:!0,mobile:!0},ProductVariants=N=>{let{builderProps:D,styles:E,setting:O,advanced:U}=N,{align:x,swatchItemWidth:K,dropdownItemWidth:q,swatchSpacing:C,optionTypo:k,marginBottom:F}=E??{},{label:G,optionType:J,showAsSwatches:L,layout:R,hasPreSelected:W}=O??{},z=U?.d??DEFAULT_ADVANCED_DISPLAY_SETTING,{uid:H}=D??{},M="groupOption"===J,Q=()=>{let t={};return s.forEach(e=>{let s=a(K,e);t[e]="auto"===s}),t},Y=()=>{let t={};return s.forEach(e=>{t[e]=q?.[e]==="fill"}),t},B=t(()=>{let t=c(O?.variantPresets,E);return{...O,variantPresets:t}},[O?.variantPresets,E]),X=t=>{let e={"'":"&apos;",'"':"&quot;"},s=t;for(let a in e)t.indexOf(a)>=0&&(s=s.replaceAll(a,e[a]));return s},Z=()=>O?.variantPresets?.map(t=>`${X(t.optionName)}($2)${t.optionType}`).join("($1)"),tt=()=>O?.variantPresets?.filter(t=>!!t?.hide)?.map(t=>t.optionName).join(","),te=d(j(x)),ts=u(h(C,C)),ta=A(N,"Liquid"),ti=d(b(R,x)),to=()=>e`
2
+ ${v(`{%- assign presets = "${Z()}" | split: '($1)' -%}`)}
3
+ ${v(`{% assign hiddenPresetOptions = "${tt()}" | split: ',' %}`)}
4
4
  ${y("option in options",`
5
5
  <div
6
6
  option-name="{{option.name | escape}}"
7
- class="${ts} ${f("hiddenPresetOptions contains option.name","gp-hidden")}"
7
+ class="${ti} ${f("hiddenPresetOptions contains option.name","gp-hidden")}"
8
+ style="${P(T(F))}${v("{% if forloop.last %}--mb:0;{% endif %}")}"
8
9
  >
9
10
  ${v("{%- assign showVariantClass = 'variant-display' -%}")}
10
11
  ${v("{%- assign optionName = option.name -%}")}
@@ -12,11 +13,11 @@ import{composeMemo as t,template as e,DEVICES as s,getResponsiveValueByScreen as
12
13
  ${v("{%- assign presetDetail = preset | split: '($2)' -%}")}
13
14
  ${f("presetDetail[1] == 'dropdown' and presetDetail[0] == optionName",`${v("{%- assign showVariantClass = '' -%}")} ${v("{%- break -%}")}`)}
14
15
  `)}
15
- ${S(k,n(te)," ")}
16
+ ${S(G,n(ta)," ")}
16
17
  <div
17
18
  variant-option-name="{{option.name | escape}}"
18
- class="${Z}"
19
- style="${P(tt)}"
19
+ class="${te}"
20
+ style="${P(ts)}"
20
21
  >
21
22
  ${v("{%- assign values = option.values -%}")}
22
23
  ${v("{%- assign rootForloop = forloop.index0 -%}")}
@@ -29,11 +30,11 @@ import{composeMemo as t,template as e,DEVICES as s,getResponsiveValueByScreen as
29
30
  {%- assign selectedValue = variant.option3 -%}
30
31
  {%- endif -%}
31
32
  `)}
32
- ${S(!L,v("{%- assign selectedValue = null -%}"),"")}
33
- ${S(G,to(),tn())}
33
+ ${S(!W,v("{%- assign selectedValue = null -%}"),"")}
34
+ ${S(L,tp(),tr())}
34
35
  </div>
35
36
  </div>`)}
36
- `,ti=E?.variantPresets?.map(t=>({name:Y(t.optionName),type:t.optionType})).map(t=>`${t.name}($1)${t.type}`).join("($2)").toString(),to=()=>e`
37
+ `,tn=O?.variantPresets?.map(t=>({name:X(t.optionName),type:t.optionType})).map(t=>`${t.name}($1)${t.type}`).join("($2)").toString(),tp=()=>e`
37
38
  ${v("{%- assign optionRendered = false -%}")}
38
39
  ${v("{%- assign swatches = shop.metafields.GEMPAGES.swatches -%}")}
39
40
  ${v("{%- assign swatchesItems = swatches | split: '($1)' -%}")}
@@ -73,7 +74,7 @@ import{composeMemo as t,template as e,DEVICES as s,getResponsiveValueByScreen as
73
74
  ${v("{%- assign imageUrls = imageUrlsString | split: '($8)' -%}")}
74
75
 
75
76
  ${f("optionTitle == option.name",`
76
- ${v(`{%- assign variantPresetString = "${ti}" -%}`)}
77
+ ${v(`{%- assign variantPresetString = "${tn}" -%}`)}
77
78
  ${v('{%- assign optionName = option.name | replace: "\'", "&apos;" | replace: \'"\', "&quot;" -%}')}
78
79
  ${v("{%- assign items = variantPresetString | split:'($2)' -%}")}
79
80
  ${v("{%- assign type = 'dropdown' -%}")}
@@ -83,24 +84,24 @@ import{composeMemo as t,template as e,DEVICES as s,getResponsiveValueByScreen as
83
84
  ${f('itemPreset[0] == "base"',v("{%- assign type = itemPreset[1] -%}"))}
84
85
  `)}
85
86
  ${v("{%- assign optionRendered = true -%}")}
86
- ${y("value in values",p({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:G,uid:W,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:L?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",optionType:"optionType",activeClass:L?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...D,...Q,swatchAutoWidth:H(),optionTypo:C}))}
87
- ${f("type == 'dropdown'",r({...D,...Q,swatchAutoWidth:M(),optionTypo:C}))}
87
+ ${y("value in values",p({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:L,uid:H,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:W?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",optionType:"optionType",activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...E,...B,swatchAutoWidth:Q(),optionTypo:k}))}
88
+ ${f("type == 'dropdown'",r({...E,...B,swatchAutoWidth:Y(),optionTypo:k}))}
88
89
  `)}
89
90
  `)}
90
91
 
91
- ${f("optionRendered == false",tn())}
92
- `,tn=()=>y("value in values",p({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:G,uid:W,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:L?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:"optionType",activeClass:L?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...D,...Q,swatchAutoWidth:H(),optionTypo:C,isRenderDefault:!0})),tp=d(I(U)),tr=w(T),tl=()=>`
93
- <div className="${tp}">
94
- ${l(tr)}
92
+ ${f("optionRendered == false",tr())}
93
+ `,tr=()=>y("value in values",p({id:"{{option.name | escape}}-{{value | escape}}",variantKey:"{{option.name | escape}}-{{option.position}}-{{ forloop.index }}",showAsSwatches:L,uid:H,name:"{{option.name | escape}}",value:{label:"{{value | escape}}"},checked:W?"{%- if option.selected_value == value -%}true{% else %}false{%- endif -%}":"false",optionPosition:"rootForloop",typeOfOption:"optionType",activeClass:W?"{%- if option.selected_value == value -%}option-item-active{%- endif -%}":"",...E,...B,swatchAutoWidth:Q(),optionTypo:k,isRenderDefault:!0})),tl=d(I(x)),tm=w(N),tc=()=>`
94
+ <div className="${tl}">
95
+ ${l(tm)}
95
96
  </div>
96
- `;$({setting:Q,styles:JSON.stringify(D),variants:"{{ product.variants | json | escape }}",optionsWithValues:"{{ product.options_with_values | json | escape }}",variantSelected:"{{ variant | json | escape }}",variantInventoryQuantity:"{{ product.variants | map: 'inventory_quantity' | json | escape }}",variantInventoryPolicy:"{{ product.variants | map: 'inventory_policy' | json | escape }}",moneyFormat:"{{ shop.money_format | json | escape }}",productId:"{{ product.id | json | escape }}",productUrl:"{{ product.url | json | escape }}",productHandle:"{{ product.handle | json | escape }}",displayState:`${JSON.stringify(R)}`,totalVariantCombinations:"{{ total_combinations }}",firstAvailableVariant:"{{ product.selected_or_first_available_variant | json | escape }}"});let tm=g(V({uid:W,hasPreSelected:L})),tc=u(_(T)),td=d({"gp-grid !gp-ml-0":!0}),tu=()=>{let t=i?"{{ 'gp-product-variant-v3.js' | asset_url }}":`${o}/assets-v2/gp-product-variant-v3.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${m('class="gps-link" delay',"src")}="${t}" defer="defer"></script>`};return e`
97
+ `;$({setting:B,styles:JSON.stringify(E),variants:"{{ product.variants | json | escape }}",optionsWithValues:"{{ product.options_with_values | json | escape }}",variantSelected:"{{ variant | json | escape }}",variantInventoryQuantity:"{{ product.variants | map: 'inventory_quantity' | json | escape }}",variantInventoryPolicy:"{{ product.variants | map: 'inventory_policy' | json | escape }}",moneyFormat:"{{ shop.money_format | json | escape }}",productId:"{{ product.id | json | escape }}",productUrl:"{{ product.url | json | escape }}",productHandle:"{{ product.handle | json | escape }}",displayState:`${JSON.stringify(z)}`,totalVariantCombinations:"{{ total_combinations }}",firstAvailableVariant:"{{ product.selected_or_first_available_variant | json | escape }}"});let td=g(V({uid:H,hasPreSelected:W})),tu=u(_(N)),t$=d({"gp-flex gp-flex-col !gp-ml-0":!0}),tg=()=>{let t=i?"{{ 'gp-product-variant-v3.js' | asset_url }}":`${o}/assets-v2/gp-product-variant-v3.js?v={{ shop.metafields.GEMPAGES.ASSETS_VERSION }}`;return`<script ${m('class="gps-link" delay',"src")}="${t}" defer="defer"></script>`};return e`
97
98
  ${v("{%- assign total_combinations = 1 -%}")}
98
99
  ${y("option in product.options_with_values","{%- assign total_combinations = total_combinations | times: option.values.size -%}")}
99
100
  <gp-product-variants
100
- ${tm}
101
+ ${td}
101
102
  gp-data='{
102
- "setting":${JSON.stringify(Q)?.replaceAll("'","&#039;")},
103
- "styles":${JSON.stringify(D)},
103
+ "setting":${JSON.stringify(B)?.replaceAll("'","&#039;")},
104
+ "styles":${JSON.stringify(E)},
104
105
  "variants":{{product.variants | json | escape}},
105
106
  "optionsWithValues": {{product.options_with_values | json | escape}},
106
107
  "variantSelected": {{ variant | json | escape }},
@@ -110,7 +111,7 @@ import{composeMemo as t,template as e,DEVICES as s,getResponsiveValueByScreen as
110
111
  "productId": {{product.id | json | escape}},
111
112
  "productUrl": {{product.url | json | escape}},
112
113
  "productHandle": {{product.handle | json | escape}},
113
- "displayState": ${JSON.stringify(R)},
114
+ "displayState": ${JSON.stringify(z)},
114
115
  "totalVariantCombinations": {{total_combinations}},
115
116
  "firstAvailableVariant": {{product.selected_or_first_available_variant | json | escape}}
116
117
  }
@@ -118,12 +119,12 @@ import{composeMemo as t,template as e,DEVICES as s,getResponsiveValueByScreen as
118
119
  ${v("{%- assign options = product.options_with_values -%}")}
119
120
  ${v("{%- assign variants = product.variants -%}")}
120
121
  ${f("options.size == 0 or options.size == 1 and variants.size == 1 and variants[0].title == 'Default Title' and variants[0].option1 == 'Default Title'","<div></div>",e`<div
121
- class="${td}"
122
- style="${tc}"
122
+ class="${t$}"
123
+ style="${tu}"
123
124
  >
124
- ${S(z,tl(),ta())}
125
+ ${S(M,tc(),to())}
125
126
  </div>`)}
126
127
  </gp-product-variants>
127
128
 
128
- ${tu()}
129
+ ${tg()}
129
130
  `};export{ProductVariants as default};
@@ -1 +1 @@
1
- import{makeStyleResponsive as r,makeWidth as t,optionLayoutStyle as e,makeStyle as p}from"@gem-sdk/core";import{filterTruthyObject as o}from"../../../../../helpers.js";let getWrapperStyle=p=>{let{style:g,styles:a,setting:l}=p,{width:i,align:m,marginBottom:n}=a??{},{column:y}=l??{},S=r("w",t(i));return o({...e(y),...r("ta",m),...S,...g,...r("rg",n)})},getVariantOptionGroupStyle=(r,t)=>o({...p({rg:r,cg:t})});export{getVariantOptionGroupStyle,getWrapperStyle};
1
+ import{makeStyleResponsive as t,makeWidth as e,optionLayoutStyle as r,makeStyle as p}from"@gem-sdk/core";import{filterTruthyObject as o}from"../../../../../helpers.js";let getWrapperStyle=p=>{let{style:a,styles:g,setting:l}=p,{width:i,align:m}=g??{},{column:n}=l??{},y=t("w",e(i));return o({...r(n),...t("ta",m),...y,...a})},getVariantOptionGroupStyle=(t,e)=>o({...p({rg:t,cg:e})});export{getVariantOptionGroupStyle,getWrapperStyle};
@@ -1 +1 @@
1
- import{makeStyleResponsive as e,makeWidth as t}from"@gem-sdk/core";import{filterTruthyObject as r}from"../../../../../helpers.js";let getLabelVariantStyle=a=>a?r(e("w",t(a))):{};export{getLabelVariantStyle};
1
+ import{makeStyleResponsive as t,makeWidth as e}from"@gem-sdk/core";import{filterTruthyObject as r}from"../../../../../helpers.js";let getLabelVariantStyle=o=>o?r(t("w",e(o))):{},getMarginBottomStyle=(e,o)=>!e||o?{}:r(t("mb",e));export{getLabelVariantStyle,getMarginBottomStyle};
@@ -1 +1 @@
1
- import{composeClasses as e,composeTypographyClassName as s}from"@gem-sdk/core";let getProgressBarClasses=s=>{let{effect:g}=s??{},t=g?e("before:gp-absolute before:gp-left-0 before:gp-h-full before:gp-w-full before:gp-animate-shift before:gp-content-[''] before:gp-bg-stock-counter-animate before:gp-bg-[length:60px_100%] before:gp-shadow-stock-counter"):{};return{...e("gp-sc-progress-bar gp-relative gp-w-full -gp-scale-100 !gp-bg-[length:200%]"),...t}},getContainerClasses=s=>{let{progressBarPosition:g="bottom"}=s??{},t="bottom"===g;return{...e("gp-inline-block gp-flex gp-gap-y-1.5"),"gp-flex-col":t,"gp-flex-col-reverse":!t}},getLiquidTagClasses=s=>({...e("gp-product-stock-counter data-[visible=true]:gp-block data-[visible=false]:gp-hidden"),...e(s?.cssClass)}),getWrapperIconClasses=s=>{let{iconPosition:g="left"}=s??{};return{...e("gp-flex gp-items-baseline gp-gap-x-1"),"gp-flex-row":"left"===g,"gp-flex-row-reverse gp-justify-end":"right"===g}},getIconClasses=()=>({...e("gp-shrink-0 gp-bg-[length:60px_100%]")}),getTextClasses=g=>{let{typo:t}=g??{},r=s(t,g?.typography);return{...e(r)}},getWrapperClasses=(s,g)=>{let{hiddenCounterWhenOutOfStock:t}=s??{};return{...e("gp-flex"),"gp-opacity-50":g&&t}};export{getContainerClasses,getIconClasses,getLiquidTagClasses,getProgressBarClasses,getTextClasses,getWrapperClasses,getWrapperIconClasses};
1
+ import{composeClasses as e,composeTypographyClassName as s}from"@gem-sdk/core";let getProgressBarClasses=s=>{let{effect:g}=s??{},t=g?e("before:gp-absolute before:gp-left-0 before:gp-h-full before:gp-w-full before:gp-animate-shift before:gp-content-[''] before:gp-bg-stock-counter-animate before:gp-bg-[length:60px_100%] before:gp-shadow-stock-counter"):{};return{...e("gp-sc-progress-bar gp-relative gp-w-full -gp-scale-100 !gp-bg-[length:200%]"),...t}},getContainerClasses=s=>{let{progressBarPosition:g="bottom"}=s??{},t="bottom"===g;return{...e("gp-inline-block gp-flex gp-gap-y-1.5"),"gp-flex-col":t,"gp-flex-col-reverse":!t}},getLiquidTagClasses=s=>({...e("gp-product-stock-counter data-[visible=true]:gp-block data-[visible=false]:gp-hidden"),...e(s?.cssClass)}),getWrapperIconClasses=s=>{let{iconPosition:g="left"}=s??{};return{...e("gp-flex gp-items-baseline gp-gap-x-1"),"gp-flex-row":"left"===g,"gp-flex-row-reverse gp-justify-end":"right"===g}},getIconClasses=()=>({...e("[&>svg]:!gp-h-[var(--w)] [&>svg]:!gp-w-auto tablet:[&>svg]:!gp-h-[var(--w-tablet)] mobile:[&>svg]:!gp-h-[var(--w-mobile)]")}),getTextClasses=g=>{let{typo:t}=g??{},r=s(t,g?.typography);return{...e(r)}},getWrapperClasses=(s,g)=>{let{hiddenCounterWhenOutOfStock:t}=s??{};return{...e("gp-flex"),"gp-opacity-50":g&&t}};export{getContainerClasses,getIconClasses,getLiquidTagClasses,getProgressBarClasses,getTextClasses,getWrapperClasses,getWrapperIconClasses};
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useRef as t,useEffect as o}from"react";import{useStockCounterInteraction as r}from"../hooks/useStockCounterInteraction.js";import{createClass as m,createStyle as l,createAttr as i}from"@gem-sdk/system";import{useStockCounter as n}from"../hooks/useStockCounter.js";import{getInlineCss as a}from"../common/helpers.js";import{getProgressBarClasses as c,getContainerClasses as u,getWrapperIconClasses as d,getIconClasses as f,getTextClasses as p,getWrapperClasses as y}from"../common/classes.js";import{getProgressBarStyles as h,getContainerStyles as S,getWrapperStyles as k,getIconStyles as N,getTextStyles as _}from"../common/styles.js";import{getWrapperAttrs as j,getIconAttrs as I}from"../common/attrs.js";let StockCounter=({setting:g,styles:v,builderProps:C})=>{let{displayProgressBar:H,borderRadius:L}=v??{},{showIcon:M,icon:O,layout:T="full",oosIcon:b}=g??{},{outputMessage:x,isOutOfStock:V,inventoryQuantity:q}=n(g,v),w=t(null),{dispatchStockCounterInteraction:z}=r({element:w,uid:C?.uid}),A=a(C?.uid,L),B=!1!==H&&!V,D="progress-bar"!==T,E=m({...c(v)}),F=l({...h(v,g)}),G=l({...S(v)}),J=m({...u(g)}),K=l({...k(v)}),P=m({...d(g)}),Q=m({...f()}),R=e=>l({...N(v,g,e)}),U=({isOutOfStockIcon:e,isVisible:s})=>i({...I(e,s)}),W=m({...p(v)}),X=e=>l({..._(v,e)}),Y=m({...y(g,V)}),Z=i({...j(C)});return o(()=>{z(q)},[q]),e("div",{...Z,style:K,ref:w,className:Y,children:[s("style",{children:A}),e("div",{className:J,style:G,children:[e("div",{className:P,children:[M&&(V?s("div",{...U({isOutOfStockIcon:V,isVisible:V}),dangerouslySetInnerHTML:{__html:b||""},className:Q,style:R(!0)}):s("div",{...U({isOutOfStockIcon:!V,isVisible:!V}),dangerouslySetInnerHTML:{__html:O||""},className:Q,style:R(!1)})),D&&(V?s("p",{dangerouslySetInnerHTML:{__html:x()},className:W,style:X(!0)}):s("p",{dangerouslySetInnerHTML:{__html:x()},className:W,style:X(!1)}))]}),B&&s("div",{style:F,className:E})]})]})};export{StockCounter as default};
2
+ import{jsxs as e,jsx as s}from"react/jsx-runtime";import{useRef as t,useEffect as o}from"react";import{useStockCounterInteraction as r}from"../hooks/useStockCounterInteraction.js";import{createClass as l,createStyle as m,createAttr as n}from"@gem-sdk/system";import{useStockCounter as i}from"../hooks/useStockCounter.js";import{getInlineCss as a}from"../common/helpers.js";import{getProgressBarClasses as c,getContainerClasses as d,getWrapperIconClasses as u,getIconClasses as p,getTextClasses as f,getWrapperClasses as y}from"../common/classes.js";import{getProgressBarStyles as h,getContainerStyles as S,getWrapperStyles as k,getIconStyles as N,getTextStyles as _}from"../common/styles.js";import{getWrapperAttrs as j,getIconAttrs as I}from"../common/attrs.js";let StockCounter=({setting:g,styles:v,builderProps:C})=>{let{displayProgressBar:H,borderRadius:L}=v??{},{showIcon:M,icon:O,layout:T="full",oosIcon:b}=g??{},{outputMessage:x,isOutOfStock:V,inventoryQuantity:q}=i(g,v),w=t(null),{dispatchStockCounterInteraction:z}=r({element:w,uid:C?.uid}),A=a(C?.uid,L),B=!1!==H&&!V,D="progress-bar"!==T,E=l({...c(v)}),F=m({...h(v,g)}),G=m({...S(v)}),J=l({...d(g)}),K=m({...k(v)}),P=l({...u(g)}),Q=l({...p()}),R=e=>m({...N(v,g,e)}),U=({isOutOfStockIcon:e,isVisible:s})=>n({...I(e,s)}),W=l({...f(v)}),X=e=>m({..._(v,e)}),Y=l({...y(g,V)}),Z=n({...j(C)});return o(()=>{z(q)},[q]),e("div",{...Z,style:K,ref:w,className:Y,children:[s("style",{children:A}),e("div",{className:J,style:G,children:[e("div",{className:P,children:[M&&(V?s("div",{...U({isOutOfStockIcon:V,isVisible:V}),style:R(!0),children:s("span",{className:Q,dangerouslySetInnerHTML:{__html:b||""}})}):s("div",{...U({isOutOfStockIcon:!V,isVisible:!V}),style:R(!1),children:s("span",{className:Q,dangerouslySetInnerHTML:{__html:O||""}})})),D&&(V?s("p",{dangerouslySetInnerHTML:{__html:x()},className:W,style:X(!0)}):s("p",{dangerouslySetInnerHTML:{__html:x()},className:W,style:X(!1)}))]}),B&&s("div",{style:F,className:E})]})]})};export{StockCounter as default};
@@ -1 +1 @@
1
- let SettingUIV2=[{label:{en:"Layout"},controls:[{layout:"vertical",setting:{id:"position"}}]},{label:{en:"Tabs"},controls:[{label:{en:"Order"},setting:{id:"childItem"},controlConfig:{id:"childItem",type:"child-item",labelItem:"tab",labelPopover:{en:"Tab management"}}},{label:{en:"Text"},type:"combo",iconName:"polaris-text-title",getValueFromSettingID:"labelTypoV2.type",isTypoValue:!0,isHideClear:!0,controls:[{layout:"vertical",setting:{id:"labelTypoV2"},options:{updateFields:[{field:"attrs.textAlign",settingId:"labelAlign"},{field:"attrs.color",settingId:"labelColor",state:"normal"}]},controlChangeTrigger:{settings:[{action:{controlId:"labelAlign",valueFromField:"attrs.textAlign",groupType:"setting",controlType:"setting"}},{action:{controlId:"labelColor",valueFromField:"attrs.color",groupType:"setting",controlType:"setting",removeDevice:!0,state:"normal"}}],options:{noRecordHistory:!0}}}]},{conditionDisplay:'position == "top"',label:{en:"Width"},setting:{id:"panelWidth"}}],moreSettings:{type:"collapse",controls:[{id:"Width",label:{en:"Width"},conditionDisplay:'position != "top"',controlConfig:{id:"width",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,fallbackValue:"Auto",linkWithSetting:{name:"labelWidth"},displayOptions:[{label:"Fit content",value:"Auto",showValue:!0},{label:"Full",value:"100%",showValue:!0}]},layout:"horizontal"},{label:{en:"Background"},setting:{id:"labelBgColor",state:"normal"}},{label:{en:"Border"},setting:{id:"borderTab",state:"normal"}},{conditionDisplay:'position == "top" && labelWidth != "100%"',label:{en:"Tabs align"},setting:{id:"panelAlign"}},{conditionDisplay:'position != "top" && labelWidth != "100%"',label:{en:"Tabs align"},setting:{id:"panelAlignVertical"}},{label:{en:"Hover effect"},type:"combo",iconName:"polaris-check-hover",fixedValue:"Enabled",setting:{id:"enableHoverEffect"},popoverLabel:{en:"Tabs hover effect"},controls:[{label:{en:"Text color"},setting:{id:"labelColor",state:"hover"}},{label:{en:"Background"},setting:{id:"labelBgColor",state:"hover"}},{label:{en:"Border"},setting:{id:"borderTab",state:"hover"}}]},{label:{en:"Active state"},type:"combo",setting:{id:"enableActiveEffect"},iconName:"polaris-status-active",fixedValue:"Enabled",popoverLabel:{en:"Tabs active state"},controls:[{label:{en:"Text color"},setting:{id:"labelColor",state:"active"}},{label:{en:"Background"},setting:{id:"labelBgColor",state:"active"}},{label:{en:"Border"},setting:{id:"borderTab",state:"active"}}]}]}},{label:{en:"Size"},controls:[{id:"containWidth",label:{en:"Width"},controlConfig:{id:"containWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,linkWithSetting:{name:"containWidth"}},layout:"horizontal"},{label:{en:"Padding"},controlConfig:{id:"padding",type:"padding-v2",linkWithSetting:{name:"spacing-setting",field:"padding"}}}]},{label:{en:"Background"},controls:[{setting:{id:"background"},layout:"vertical"}]},{label:{en:"Shape"},controls:[{label:{en:"Border"},controlConfig:{id:"border-advanced",type:"border-v2",linkWithSetting:{name:"border",field:"normal"},compoDefaultValue:{color:"line-3",border:"solid",width:"1px",borderWidth:"1px"}}},{label:{en:"Corner"},setting:{id:"rounded",state:"normal"}},{label:{en:"Shadow"},setting:{id:"boxShadow",state:"normal"},options:{updateFields:[{field:"normal.enable",settingId:"hasBoxShadow",state:"normal"}]},controlChangeTrigger:{settings:[{condition:"boxShadow.normal.enable === true",source:["boxShadow","hasBoxShadow"],action:{controlId:"hasBoxShadow",groupType:"advanced",controlType:"advanced",state:"normal",newValue:!0}},{condition:"boxShadow.normal.enable === false",source:["boxShadow","hasBoxShadow"],action:{controlId:"hasBoxShadow",groupType:"advanced",controlType:"advanced",state:"normal",newValue:!1}}],options:{noRecordHistory:!0}}}]},{label:{en:"Display option"},controls:[{label:{en:"Default active"},setting:{id:"activeKey"}}]},{controls:[{label:{en:"Align"},setting:{id:"align"},options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"},conditionEnable:'!(parseInt(containWidth) >= 100 && containWidth?.includes("%"))'}]}];export{SettingUIV2};
1
+ let SettingUIV2=[{label:{en:"Layout"},controls:[{layout:"vertical",setting:{id:"position"}}]},{label:{en:"Tabs"},controls:[{label:{en:"Order"},setting:{id:"childItem"},controlConfig:{id:"childItem",type:"child-item",labelItem:"tab",labelPopover:{en:"Tab management"}}},{label:{en:"Text"},type:"combo",iconName:"polaris-text-title",getValueFromSettingID:"labelTypoV2.type",isTypoValue:!0,isHideClear:!0,controls:[{layout:"vertical",setting:{id:"labelTypoV2"},options:{updateFields:[{field:"attrs.textAlign",settingId:"labelAlign"},{field:"attrs.color",settingId:"labelColor",state:"normal"}]},controlChangeTrigger:{settings:[{action:{controlId:"labelAlign",valueFromField:"attrs.textAlign",groupType:"setting",controlType:"setting"}},{action:{controlId:"labelColor",valueFromField:"attrs.color",groupType:"setting",controlType:"setting",removeDevice:!0,state:"normal"}}],options:{noRecordHistory:!0}}}]},{conditionDisplay:'position == "top"',label:{en:"Width"},setting:{id:"panelWidth"}}],moreSettings:{type:"collapse",controls:[{id:"Width",label:{en:"Width"},conditionDisplay:'position != "top"',controlConfig:{id:"width",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,fallbackValue:"Auto",linkWithSetting:{name:"labelWidth"},displayOptions:[{label:"Fit content",value:"Auto",showValue:!0},{label:"Full",value:"100%",showValue:!0}]},layout:"horizontal"},{label:{en:"Background"},setting:{id:"labelBgColor",state:"normal"}},{label:{en:"Border"},setting:{id:"borderTab",state:"normal"}},{conditionDisplay:'position == "top" && labelWidth != "100%"',label:{en:"Tabs align"},setting:{id:"panelAlign"}},{conditionDisplay:'position != "top" && labelWidth != "100%"',label:{en:"Tabs align"},setting:{id:"panelAlignVertical"}},{label:{en:"Hover effect"},type:"combo",iconName:"polaris-check-hover",fixedValue:"Enabled",setting:{id:"enableHoverEffect"},popoverLabel:{en:"Tabs hover effect"},controls:[{label:{en:"Text color"},setting:{id:"labelColor",state:"hover"}},{label:{en:"Background"},setting:{id:"labelBgColor",state:"hover"}},{label:{en:"Border"},setting:{id:"borderTab",state:"hover"}}]},{label:{en:"Active state"},type:"combo",setting:{id:"enableActiveEffect"},iconName:"polaris-status-active",fixedValue:"Enabled",popoverLabel:{en:"Tabs active state"},controls:[{label:{en:"Text color"},setting:{id:"labelColor",state:"active"}},{label:{en:"Background"},setting:{id:"labelBgColor",state:"active"}},{label:{en:"Border"},setting:{id:"borderTab",state:"active"}}]}]}},{label:{en:"Size"},controls:[{id:"containWidth",label:{en:"Width"},controlConfig:{id:"containWidth",type:"dropdown:input",label:"Width",inputType:"number",units:["px","%"],hideUnit:!1,linkWithSetting:{name:"containWidth"},displayOptions:[{label:"Full",value:"100%",showValue:!0},{label:"Default",value:"1200px",showValue:!0}]},layout:"horizontal"},{label:{en:"Padding"},controlConfig:{id:"padding",type:"padding-v2",linkWithSetting:{name:"spacing-setting",field:"padding"}}}]},{label:{en:"Background"},controls:[{setting:{id:"background"},layout:"vertical"}]},{label:{en:"Shape"},controls:[{label:{en:"Border"},controlConfig:{id:"border-advanced",type:"border-v2",linkWithSetting:{name:"border",field:"normal"},compoDefaultValue:{color:"line-3",border:"solid",width:"1px",borderWidth:"1px"}}},{label:{en:"Corner"},setting:{id:"rounded",state:"normal"}},{label:{en:"Shadow"},setting:{id:"boxShadow",state:"normal"},options:{updateFields:[{field:"normal.enable",settingId:"hasBoxShadow",state:"normal"}]},controlChangeTrigger:{settings:[{condition:"boxShadow.normal.enable === true",source:["boxShadow","hasBoxShadow"],action:{controlId:"hasBoxShadow",groupType:"advanced",controlType:"advanced",state:"normal",newValue:!0}},{condition:"boxShadow.normal.enable === false",source:["boxShadow","hasBoxShadow"],action:{controlId:"hasBoxShadow",groupType:"advanced",controlType:"advanced",state:"normal",newValue:!1}}],options:{noRecordHistory:!0}}}]},{label:{en:"Display option"},controls:[{label:{en:"Default active"},setting:{id:"activeKey"}}]},{controls:[{label:{en:"Align"},setting:{id:"align"},options:{labelVariant:"primary",fullWidth:!0,disableMessage:"Horizontal alignment is disabled when the width is set to 100% or greater"},conditionDisplay:'!(parseInt(containWidth) >= 100 && containWidth?.includes("%"))'}]}];export{SettingUIV2};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "2.0.0-staging.813",
3
+ "version": "2.0.0-staging.815",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",