@gem-sdk/components 2.0.0-staging.768 → 2.0.0-staging.769
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/collection/components/collection-description/common/classes.js +1 -1
- package/dist/cjs/collection/components/collection-title/CollectionTitle.liquid.js +3 -3
- package/dist/cjs/collection/settings/collection-description/configs/ui-v2.js +1 -1
- package/dist/cjs/product/components/product-badge/utils/common.js +1 -1
- package/dist/cjs/stock-counter/components/StockCounter.liquid.js +2 -2
- package/dist/esm/collection/components/collection-description/common/classes.js +1 -1
- package/dist/esm/collection/components/collection-title/CollectionTitle.liquid.js +3 -3
- package/dist/esm/collection/settings/collection-description/configs/ui-v2.js +1 -1
- package/dist/esm/product/components/product-badge/utils/common.js +1 -1
- package/dist/esm/stock-counter/components/StockCounter.liquid.js +2 -2
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core");const getClassContainerCollectionDes=({setting:e})=>{let s=core.composeTypographyClassName(e?.typo,e?.typography);return composeClasses(core.cls("gp-relative p-description-wrapper gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre",s,core.getGlobalColorClass("text",e?.color),"data-[browser=safari]:after:gp-content-[' '] data-[browser=safari]:after:gp-absolute data-[browser=safari]:after:gp-left-0 data-[browser=safari]:after:gp-right-0 data-[browser=safari]:after:gp-bottom-0 data-[browser=safari]:after:gp-w-full data-[browser=safari]:after:gp-h-1/2 data-[browser=safari]:after:gp-bg-gradient-to-t data-[browser=safari]:after:gp-from-white"))},getClassButtonViewMore=({setting:e})=>{let s=core.composeTypographyClassName(e?.typo,e?.typography);return composeClasses(core.cls("p-description-show-more","gp-mt-4 hover:gp-opacity-80 gp-transition-all gp-w-full",s,core.getGlobalColorClass("text",e?.showMoreColor)))},getDescriptionClasses=({advanced:e})=>composeClasses(core.cls("gp-collection-description",e?.cssClass)),getShowMoreIconClasses=()=>composeClasses(core.cls("gp-show-more-icon gp-ml-1 gp-flex gp-items-center")),getShowMoreTextClasses=()=>composeClasses(core.cls("gp-show-more-text")),getClassPreBuilt=()=>composeClasses(core.cls("gp-rotate-180 gp-hidden")),composeClasses=e=>e.trim().split(/\s+/).reduce((e,s)=>(e[s]=!0,e),{});exports.getClassButtonViewMore=getClassButtonViewMore,exports.getClassContainerCollectionDes=getClassContainerCollectionDes,exports.getClassPreBuilt=getClassPreBuilt,exports.getDescriptionClasses=getDescriptionClasses,exports.getShowMoreIconClasses=getShowMoreIconClasses,exports.getShowMoreTextClasses=getShowMoreTextClasses;
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core");const getClassContainerCollectionDes=({setting:e})=>{let s=core.composeTypographyClassName(e?.typo,e?.typography);return composeClasses(core.cls("gp-relative p-description-wrapper gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre",s,core.getGlobalColorClass("text",e?.color),"data-[browser=safari]:after:gp-content-[' '] data-[browser=safari]:after:gp-absolute data-[browser=safari]:after:gp-left-0 data-[browser=safari]:after:gp-right-0 data-[browser=safari]:after:gp-bottom-0 data-[browser=safari]:after:gp-w-full data-[browser=safari]:after:gp-h-1/2 data-[browser=safari]:after:gp-bg-gradient-to-t data-[browser=safari]:after:gp-from-white"))},getClassButtonViewMore=({setting:e})=>{let s=core.composeTypographyClassName(e?.typo,e?.typography);return composeClasses(core.cls("p-description-show-more","gp-mt-4 hover:gp-opacity-80 gp-transition-all gp-w-full","showing-description",s,core.getGlobalColorClass("text",e?.showMoreColor)))},getDescriptionClasses=({advanced:e})=>composeClasses(core.cls("gp-collection-description",e?.cssClass)),getShowMoreIconClasses=()=>composeClasses(core.cls("gp-show-more-icon gp-ml-1 gp-flex gp-items-center")),getShowMoreTextClasses=()=>composeClasses(core.cls("gp-show-more-text")),getClassPreBuilt=()=>composeClasses(core.cls("gp-rotate-180 gp-hidden")),composeClasses=e=>e.trim().split(/\s+/).reduce((e,s)=>(e[s]=!0,e),{});exports.getClassButtonViewMore=getClassButtonViewMore,exports.getClassContainerCollectionDes=getClassContainerCollectionDes,exports.getClassPreBuilt=getClassPreBuilt,exports.getDescriptionClasses=getDescriptionClasses,exports.getShowMoreIconClasses=getShowMoreIconClasses,exports.getShowMoreTextClasses=getShowMoreTextClasses;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Text_liquid=require("../../../text/components/Text.liquid.js");const CollectionTitle=({setting:e})=>core.template`
|
|
2
|
-
${Text_liquid.default({styles:e,setting:{...e,text
|
|
3
|
-
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),Text_liquid=require("../../../text/components/Text.liquid.js"),system=require("@gem-sdk/system");const CollectionTitle=({setting:e})=>{let t=e?.typo?.attrs?.transform==="capitalize";return core.template`
|
|
2
|
+
${Text_liquid.default({styles:e,setting:{...e,text:`${system.If(t,"{{ collection.title | downcase }}","{{ collection.title }}")}`,excludeFlex:!0}})}
|
|
3
|
+
`};exports.default=CollectionTitle;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";const SettingUIV2=[{label:{en:"Text style"},controls:[{id:"typo",label:{en:"Basic"},setting:{id:"typo"},options:{hideLabel:!0,fullWidth:!0,updateFields:[{field:"attrs.textAlign",settingId:"textAlign"}]},layout:"vertical",controlChangeTrigger:{settings:[{action:{controlId:"textAlign",valueFromField:"attrs.textAlign",groupType:"setting",controlType:"setting"}}],options:{noRecordHistory:!0}}}]},{controls:[{label:{en:"View more button"},setting:{id:"hasLineClamp"},options:{labelVariant:"primary",toggleStyle:"switch"}},{label:{en:"Text color"},setting:{id:"showMoreColor"},conditionDisplay:"hasLineClamp == true"},{label:{en:"Max lines"},setting:{id:"lineClamp"},conditionDisplay:"hasLineClamp == true"},{type:"combo",label:{en:"Show more label"},iconName:"polaris-text-block",getValueFromSettingID:"viewMoreText",isHideClear:!0,disableScrollbar:!0,compoDefaultValue:"Show more",popoverLabel:{en:"Show more label"},controls:[{layout:"vertical",label:{en:"Content"},setting:{id:"viewMoreText"}}],conditionDisplay:"hasLineClamp == true"},{type:"combo",label:{en:"Show less label"},iconName:"polaris-text-block",getValueFromSettingID:"viewLessText",isHideClear:!0,disableScrollbar:!0,compoDefaultValue:"Show
|
|
1
|
+
"use strict";const SettingUIV2=[{label:{en:"Text style"},controls:[{id:"typo",label:{en:"Basic"},setting:{id:"typo"},options:{hideLabel:!0,fullWidth:!0,updateFields:[{field:"attrs.textAlign",settingId:"textAlign"}]},layout:"vertical",controlChangeTrigger:{settings:[{action:{controlId:"textAlign",valueFromField:"attrs.textAlign",groupType:"setting",controlType:"setting"}}],options:{noRecordHistory:!0}}}]},{controls:[{label:{en:"View more button"},setting:{id:"hasLineClamp"},options:{labelVariant:"primary",toggleStyle:"switch"}},{label:{en:"Text color"},setting:{id:"showMoreColor"},conditionDisplay:"hasLineClamp == true"},{label:{en:"Max lines"},setting:{id:"lineClamp"},conditionDisplay:"hasLineClamp == true"},{type:"combo",label:{en:"Show more label"},iconName:"polaris-text-block",getValueFromSettingID:"viewMoreText",isHideClear:!0,disableScrollbar:!0,compoDefaultValue:"Show more",popoverLabel:{en:"Show more label"},controls:[{layout:"vertical",label:{en:"Content"},setting:{id:"viewMoreText"}}],conditionDisplay:"hasLineClamp == true"},{type:"combo",label:{en:"Show less label"},iconName:"polaris-text-block",getValueFromSettingID:"viewLessText",isHideClear:!0,disableScrollbar:!0,compoDefaultValue:"Show less",popoverLabel:{en:"Show less label"},controls:[{layout:"vertical",label:{en:"Content"},setting:{id:"viewLessText"}}],conditionDisplay:"hasLineClamp == true"},{label:{en:"Icon"},setting:{id:"enableViewMoreIcon"},conditionDisplay:"hasLineClamp == true"}]}];exports.SettingUIV2=SettingUIV2;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),productBundle=require("../../../helpers/product-bundle.js"),productBundle$1=require("../../constants/product-bundle.js");const removeTrailingZeros=e=>e.replace(/\.00$/,""),getPriceDiffByPercent=(e,t)=>{if(!t)return"0";let r=1e3*t-1e3*e;return Math.round(100*r/(1e3*t))},getPriceDiffByValue=(e,t,r)=>removeTrailingZeros(core.formatMoney(t?(t-e).toFixed(2):"0",r)),getMinPrice=(e,t)=>{let r=e?.edges?.length&&e.edges.length>0?1/0:0;return e?.edges.forEach(({node:e})=>{if(!e)return;let t=e?.price;void 0!==t&&t<r&&(r=t)}),removeTrailingZeros(core.formatMoney(r.toString(),t))},checkNoDiscountState=(e,t)=>{let{discountPercentAmount:r}=productBundle.applyBundleDiscountAmount({currentVariant:e?.currentVariant,bundleItem:e?.bundleItem,options:{moneyFormat:t,useProductCompareAtPrice:e?.useProductCompareAtPrice}});return!(e?.bundleItem?.discountType===productBundle$1.DiscountType.NoDiscount&&e?.useProductCompareAtPrice||Number(e?.bundleItem?.discountValue)&&r)&&!e?.currentVariant?.salePrice},getBadgeContent=(e,t,r)=>{if(!e.detail||!t?.trim()?.length)return t;let{detail:i,currentVariant:o}=e,{discountPercentAmount:n,discountAmount:c}=productBundle.applyBundleDiscountAmount({currentVariant:o,bundleItem:e?.bundleItem,options:{moneyFormat:r,useProductCompareAtPrice:e?.useProductCompareAtPrice}}),u=()=>e?.bundleItem?.discountType!==productBundle$1.DiscountType.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?`${n}%`:`${getPriceDiffByPercent(o?.price||0,o?.salePrice||0)||0}%`:"0%",l=()=>e?.bundleItem?.discountType!==productBundle$1.DiscountType.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?c:getPriceDiffByValue(o?.price||0,o?.salePrice||0,r):core.formatMoney("0",r),a=new Map([["{percent_discount}",u],["{amount_discount}",l],["{min_price}",()=>getMinPrice(i.variants,r)||0],["{inventory_quantity}",()=>o?.inventoryQuantity||0]]);return[...a.entries()].reduce((e,[t,r])=>e.replaceAll(t,r()),t)},checkDiscountContentProductBadge=e=>{if(!e)return!1;let t=/\{percent_discount\}|\{amount_discount\}/;return t.test(e)},getShapePlacementClass=(e,t,r="desktop")=>e?t?.[`--pos${deviceWithSurfix(r)}`]?"w-full h-full":"!gp-absolute":t?.[`--d${deviceWithSurfix(r)}`]?"":"!gp-inline-block gp-w-fit",getAlignShape=(e,t)=>t?"":core.cls("gp-flex",{"gp-justify-start":e?.desktop==="left","gp-justify-center":e?.desktop==="center","gp-justify-end":e?.desktop==="right","tablet:gp-justify-start":e?.tablet==="left","tablet:gp-justify-center":e?.tablet==="center","tablet:gp-justify-end":e?.tablet==="right","mobile:gp-justify-start":e?.mobile==="left","mobile:gp-justify-center":e?.mobile==="center","mobile:gp-justify-end":e?.mobile==="right"}),convertToStyle=e=>Object.entries(e||{}).reduce((e,[t,r])=>{let i=new Map([["clipPath","clip-path"],["writingMode","writing-mode"],["borderRadius","border-radius"],["transform","transform"],["alignItems","align-items"],["maxWidth","max-width"]]),o=i.get(t)||t;return{...e,[o]:r}},{}),getWrapperStyle=e=>e?
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),productBundle=require("../../../helpers/product-bundle.js"),productBundle$1=require("../../constants/product-bundle.js");const removeTrailingZeros=e=>e.replace(/\.00$/,""),getPriceDiffByPercent=(e,t)=>{if(!t)return"0";let r=1e3*t-1e3*e;return Math.round(100*r/(1e3*t))},getPriceDiffByValue=(e,t,r)=>removeTrailingZeros(core.formatMoney(t?(t-e).toFixed(2):"0",r)),getMinPrice=(e,t)=>{let r=e?.edges?.length&&e.edges.length>0?1/0:0;return e?.edges.forEach(({node:e})=>{if(!e)return;let t=e?.price;void 0!==t&&t<r&&(r=t)}),removeTrailingZeros(core.formatMoney(r.toString(),t))},checkNoDiscountState=(e,t)=>{let{discountPercentAmount:r}=productBundle.applyBundleDiscountAmount({currentVariant:e?.currentVariant,bundleItem:e?.bundleItem,options:{moneyFormat:t,useProductCompareAtPrice:e?.useProductCompareAtPrice}});return!(e?.bundleItem?.discountType===productBundle$1.DiscountType.NoDiscount&&e?.useProductCompareAtPrice||Number(e?.bundleItem?.discountValue)&&r)&&!e?.currentVariant?.salePrice},getBadgeContent=(e,t,r)=>{if(!e.detail||!t?.trim()?.length)return t;let{detail:i,currentVariant:o}=e,{discountPercentAmount:n,discountAmount:c}=productBundle.applyBundleDiscountAmount({currentVariant:o,bundleItem:e?.bundleItem,options:{moneyFormat:r,useProductCompareAtPrice:e?.useProductCompareAtPrice}}),u=()=>e?.bundleItem?.discountType!==productBundle$1.DiscountType.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?`${n}%`:`${getPriceDiffByPercent(o?.price||0,o?.salePrice||0)||0}%`:"0%",l=()=>e?.bundleItem?.discountType!==productBundle$1.DiscountType.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?c:getPriceDiffByValue(o?.price||0,o?.salePrice||0,r):core.formatMoney("0",r),a=new Map([["{percent_discount}",u],["{amount_discount}",l],["{min_price}",()=>getMinPrice(i.variants,r)||0],["{inventory_quantity}",()=>o?.inventoryQuantity||0]]);return[...a.entries()].reduce((e,[t,r])=>e.replaceAll(t,r()),t)},checkDiscountContentProductBadge=e=>{if(!e)return!1;let t=/\{percent_discount\}|\{amount_discount\}/;return t.test(e)},getShapePlacementClass=(e,t,r="desktop")=>e?t?.[`--pos${deviceWithSurfix(r)}`]?"w-full h-full":"!gp-absolute":t?.[`--d${deviceWithSurfix(r)}`]?"":"!gp-inline-block gp-w-fit",getAlignShape=(e,t)=>t?"":core.cls("gp-flex",{"gp-justify-start":e?.desktop==="left","gp-justify-center":e?.desktop==="center","gp-justify-end":e?.desktop==="right","tablet:gp-justify-start":e?.tablet==="left","tablet:gp-justify-center":e?.tablet==="center","tablet:gp-justify-end":e?.tablet==="right","mobile:gp-justify-start":e?.mobile==="left","mobile:gp-justify-center":e?.mobile==="center","mobile:gp-justify-end":e?.mobile==="right"}),convertToStyle=e=>Object.entries(e||{}).reduce((e,[t,r])=>{let i=new Map([["clipPath","clip-path"],["writingMode","writing-mode"],["borderRadius","border-radius"],["transform","transform"],["alignItems","align-items"],["maxWidth","max-width"]]),o=i.get(t)||t;return{...e,[o]:r}},{}),getWrapperStyle=e=>({[e?"z-index":"zIndex"]:1}),getWidthByShapeSize=(e,t)=>{let r={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let o=core.getResponsiveValueByScreen(e,i,null),n=o?.width||t?.wrapperWidth;n&&(r={...r,[i]:n})}),r},getHeightByShapeSize=(e,t)=>{let r={},i=["desktop","mobile","tablet"];return i.forEach(i=>{let o=core.getResponsiveValueByScreen(e,i,null);r={...r,[i]:o?.height||t?.wrapperHeight}}),r},getSize=(e,t)=>{let r=core.makeStyleResponsive("w",getWidthByShapeSize(t,e)),i=core.makeStyleResponsive("h",getHeightByShapeSize(t,e));return{...r,...i}},getShapeWrapperPadding=e=>{let t={};if(1!==e)return t;let r=["desktop","mobile","tablet"];return r.forEach(e=>{t={...t,height:0,[`--p${"desktop"!==e?`-${e}`:""}`]:"50% 0"}}),t},deviceWithSurfix=e=>"desktop"===e?"":`-${e}`,getDeviceSpecificStyle=(e,t)=>{for(let r of({desktop:["desktop"],tablet:["tablet","desktop"],mobile:["mobile","tablet","desktop"]})[t])if(e?.[r])return e[r]},getIsNoDiscountState=({props:e,product:t,currentVariant:r,moneyFormat:i,useProductCompareAtPrice:o})=>{let{setting:n,"bundle-item":c}=e,u=checkDiscountContentProductBadge(n?.displayContent);return u&&checkNoDiscountState({detail:t,currentVariant:r,bundleItem:c,useProductCompareAtPrice:o},i)};exports.checkDiscountContentProductBadge=checkDiscountContentProductBadge,exports.checkNoDiscountState=checkNoDiscountState,exports.convertToStyle=convertToStyle,exports.deviceWithSurfix=deviceWithSurfix,exports.getAlignShape=getAlignShape,exports.getBadgeContent=getBadgeContent,exports.getDeviceSpecificStyle=getDeviceSpecificStyle,exports.getIsNoDiscountState=getIsNoDiscountState,exports.getShapePlacementClass=getShapePlacementClass,exports.getShapeWrapperPadding=getShapeWrapperPadding,exports.getSize=getSize,exports.getWidthByShapeSize=getWidthByShapeSize,exports.getWrapperStyle=getWrapperStyle;
|
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
>
|
|
10
10
|
<div class="${D}">
|
|
11
11
|
${core.RenderIf(i,core.template`
|
|
12
|
-
${
|
|
12
|
+
${system.LiquidIf("is_out_of_stock",core.template`<div
|
|
13
13
|
${{...x({isOutOfStockIcon:!0,isVisible:!0})}}
|
|
14
14
|
class="${j}"
|
|
15
15
|
style="${T(!0)}"
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
style="${T(!1)}"
|
|
24
24
|
>
|
|
25
25
|
${o}
|
|
26
|
-
</div
|
|
26
|
+
</div>`,core.template` <div
|
|
27
27
|
${{...x({isOutOfStockIcon:!0,isVisible:!1})}}
|
|
28
28
|
class="${j}"
|
|
29
29
|
style="${T(!0)}"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{composeTypographyClassName as e,cls as s,getGlobalColorClass as t}from"@gem-sdk/core";let getClassContainerCollectionDes=({setting:r})=>{let
|
|
1
|
+
import{composeTypographyClassName as e,cls as s,getGlobalColorClass as t}from"@gem-sdk/core";let getClassContainerCollectionDes=({setting:r})=>{let o=e(r?.typo,r?.typography);return composeClasses(s("gp-relative p-description-wrapper gp-p-description-text gp-break-words safari:[&_p]:gp-inline safari:[&_p]:after:gp-whitespace-pre",o,t("text",r?.color),"data-[browser=safari]:after:gp-content-[' '] data-[browser=safari]:after:gp-absolute data-[browser=safari]:after:gp-left-0 data-[browser=safari]:after:gp-right-0 data-[browser=safari]:after:gp-bottom-0 data-[browser=safari]:after:gp-w-full data-[browser=safari]:after:gp-h-1/2 data-[browser=safari]:after:gp-bg-gradient-to-t data-[browser=safari]:after:gp-from-white"))},getClassButtonViewMore=({setting:r})=>{let o=e(r?.typo,r?.typography);return composeClasses(s("p-description-show-more","gp-mt-4 hover:gp-opacity-80 gp-transition-all gp-w-full","showing-description",o,t("text",r?.showMoreColor)))},getDescriptionClasses=({advanced:e})=>composeClasses(s("gp-collection-description",e?.cssClass)),getShowMoreIconClasses=()=>composeClasses(s("gp-show-more-icon gp-ml-1 gp-flex gp-items-center")),getShowMoreTextClasses=()=>composeClasses(s("gp-show-more-text")),getClassPreBuilt=()=>composeClasses(s("gp-rotate-180 gp-hidden")),composeClasses=e=>e.trim().split(/\s+/).reduce((e,s)=>(e[s]=!0,e),{});export{getClassButtonViewMore,getClassContainerCollectionDes,getClassPreBuilt,getDescriptionClasses,getShowMoreIconClasses,getShowMoreTextClasses};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{template as t}from"@gem-sdk/core";import e from"../../../text/components/Text.liquid.js";let CollectionTitle=({setting:l})=>t`
|
|
2
|
-
${e({styles:l,setting:{...l,text
|
|
3
|
-
|
|
1
|
+
import{template as t}from"@gem-sdk/core";import e from"../../../text/components/Text.liquid.js";import{If as o}from"@gem-sdk/system";let CollectionTitle=({setting:l})=>{let i=l?.typo?.attrs?.transform==="capitalize";return t`
|
|
2
|
+
${e({styles:l,setting:{...l,text:`${o(i,"{{ collection.title | downcase }}","{{ collection.title }}")}`,excludeFlex:!0}})}
|
|
3
|
+
`};export{CollectionTitle as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
let SettingUIV2=[{label:{en:"Text style"},controls:[{id:"typo",label:{en:"Basic"},setting:{id:"typo"},options:{hideLabel:!0,fullWidth:!0,updateFields:[{field:"attrs.textAlign",settingId:"textAlign"}]},layout:"vertical",controlChangeTrigger:{settings:[{action:{controlId:"textAlign",valueFromField:"attrs.textAlign",groupType:"setting",controlType:"setting"}}],options:{noRecordHistory:!0}}}]},{controls:[{label:{en:"View more button"},setting:{id:"hasLineClamp"},options:{labelVariant:"primary",toggleStyle:"switch"}},{label:{en:"Text color"},setting:{id:"showMoreColor"},conditionDisplay:"hasLineClamp == true"},{label:{en:"Max lines"},setting:{id:"lineClamp"},conditionDisplay:"hasLineClamp == true"},{type:"combo",label:{en:"Show more label"},iconName:"polaris-text-block",getValueFromSettingID:"viewMoreText",isHideClear:!0,disableScrollbar:!0,compoDefaultValue:"Show more",popoverLabel:{en:"Show more label"},controls:[{layout:"vertical",label:{en:"Content"},setting:{id:"viewMoreText"}}],conditionDisplay:"hasLineClamp == true"},{type:"combo",label:{en:"Show less label"},iconName:"polaris-text-block",getValueFromSettingID:"viewLessText",isHideClear:!0,disableScrollbar:!0,compoDefaultValue:"Show
|
|
1
|
+
let SettingUIV2=[{label:{en:"Text style"},controls:[{id:"typo",label:{en:"Basic"},setting:{id:"typo"},options:{hideLabel:!0,fullWidth:!0,updateFields:[{field:"attrs.textAlign",settingId:"textAlign"}]},layout:"vertical",controlChangeTrigger:{settings:[{action:{controlId:"textAlign",valueFromField:"attrs.textAlign",groupType:"setting",controlType:"setting"}}],options:{noRecordHistory:!0}}}]},{controls:[{label:{en:"View more button"},setting:{id:"hasLineClamp"},options:{labelVariant:"primary",toggleStyle:"switch"}},{label:{en:"Text color"},setting:{id:"showMoreColor"},conditionDisplay:"hasLineClamp == true"},{label:{en:"Max lines"},setting:{id:"lineClamp"},conditionDisplay:"hasLineClamp == true"},{type:"combo",label:{en:"Show more label"},iconName:"polaris-text-block",getValueFromSettingID:"viewMoreText",isHideClear:!0,disableScrollbar:!0,compoDefaultValue:"Show more",popoverLabel:{en:"Show more label"},controls:[{layout:"vertical",label:{en:"Content"},setting:{id:"viewMoreText"}}],conditionDisplay:"hasLineClamp == true"},{type:"combo",label:{en:"Show less label"},iconName:"polaris-text-block",getValueFromSettingID:"viewLessText",isHideClear:!0,disableScrollbar:!0,compoDefaultValue:"Show less",popoverLabel:{en:"Show less label"},controls:[{layout:"vertical",label:{en:"Content"},setting:{id:"viewLessText"}}],conditionDisplay:"hasLineClamp == true"},{label:{en:"Icon"},setting:{id:"enableViewMoreIcon"},conditionDisplay:"hasLineClamp == true"}]}];export{SettingUIV2};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{cls as e,formatMoney as t,makeStyleResponsive as r,getResponsiveValueByScreen as i}from"@gem-sdk/core";import{applyBundleDiscountAmount as n}from"../../../helpers/product-bundle.js";import{DiscountType as o}from"../../constants/product-bundle.js";let removeTrailingZeros=e=>e.replace(/\.00$/,""),getPriceDiffByPercent=(e,t)=>{if(!t)return"0";let r=1e3*t-1e3*e;return Math.round(100*r/(1e3*t))},getPriceDiffByValue=(e,r,i)=>removeTrailingZeros(t(r?(r-e).toFixed(2):"0",i)),getMinPrice=(e,r)=>{let i=e?.edges?.length&&e.edges.length>0?1/0:0;return e?.edges.forEach(({node:e})=>{if(!e)return;let t=e?.price;void 0!==t&&t<i&&(i=t)}),removeTrailingZeros(t(i.toString(),r))},checkNoDiscountState=(e,t)=>{let{discountPercentAmount:r}=n({currentVariant:e?.currentVariant,bundleItem:e?.bundleItem,options:{moneyFormat:t,useProductCompareAtPrice:e?.useProductCompareAtPrice}});return!(e?.bundleItem?.discountType===o.NoDiscount&&e?.useProductCompareAtPrice||Number(e?.bundleItem?.discountValue)&&r)&&!e?.currentVariant?.salePrice},getBadgeContent=(e,r,i)=>{if(!e.detail||!r?.trim()?.length)return r;let{detail:u,currentVariant:c}=e,{discountPercentAmount:l,discountAmount:a}=n({currentVariant:c,bundleItem:e?.bundleItem,options:{moneyFormat:i,useProductCompareAtPrice:e?.useProductCompareAtPrice}}),d=()=>e?.bundleItem?.discountType!==o.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?`${l}%`:`${getPriceDiffByPercent(c?.price||0,c?.salePrice||0)||0}%`:"0%",s=()=>e?.bundleItem?.discountType!==o.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?a:getPriceDiffByValue(c?.price||0,c?.salePrice||0,i):t("0",i),p=new Map([["{percent_discount}",d],["{amount_discount}",s],["{min_price}",()=>getMinPrice(u.variants,i)||0],["{inventory_quantity}",()=>c?.inventoryQuantity||0]]);return[...p.entries()].reduce((e,[t,r])=>e.replaceAll(t,r()),r)},checkDiscountContentProductBadge=e=>{if(!e)return!1;let t=/\{percent_discount\}|\{amount_discount\}/;return t.test(e)},getShapePlacementClass=(e,t,r="desktop")=>e?t?.[`--pos${deviceWithSurfix(r)}`]?"w-full h-full":"!gp-absolute":t?.[`--d${deviceWithSurfix(r)}`]?"":"!gp-inline-block gp-w-fit",getAlignShape=(t,r)=>r?"":e("gp-flex",{"gp-justify-start":t?.desktop==="left","gp-justify-center":t?.desktop==="center","gp-justify-end":t?.desktop==="right","tablet:gp-justify-start":t?.tablet==="left","tablet:gp-justify-center":t?.tablet==="center","tablet:gp-justify-end":t?.tablet==="right","mobile:gp-justify-start":t?.mobile==="left","mobile:gp-justify-center":t?.mobile==="center","mobile:gp-justify-end":t?.mobile==="right"}),convertToStyle=e=>Object.entries(e||{}).reduce((e,[t,r])=>{let i=new Map([["clipPath","clip-path"],["writingMode","writing-mode"],["borderRadius","border-radius"],["transform","transform"],["alignItems","align-items"],["maxWidth","max-width"]]),n=i.get(t)||t;return{...e,[n]:r}},{}),getWrapperStyle=e=>e?
|
|
1
|
+
import{cls as e,formatMoney as t,makeStyleResponsive as r,getResponsiveValueByScreen as i}from"@gem-sdk/core";import{applyBundleDiscountAmount as n}from"../../../helpers/product-bundle.js";import{DiscountType as o}from"../../constants/product-bundle.js";let removeTrailingZeros=e=>e.replace(/\.00$/,""),getPriceDiffByPercent=(e,t)=>{if(!t)return"0";let r=1e3*t-1e3*e;return Math.round(100*r/(1e3*t))},getPriceDiffByValue=(e,r,i)=>removeTrailingZeros(t(r?(r-e).toFixed(2):"0",i)),getMinPrice=(e,r)=>{let i=e?.edges?.length&&e.edges.length>0?1/0:0;return e?.edges.forEach(({node:e})=>{if(!e)return;let t=e?.price;void 0!==t&&t<i&&(i=t)}),removeTrailingZeros(t(i.toString(),r))},checkNoDiscountState=(e,t)=>{let{discountPercentAmount:r}=n({currentVariant:e?.currentVariant,bundleItem:e?.bundleItem,options:{moneyFormat:t,useProductCompareAtPrice:e?.useProductCompareAtPrice}});return!(e?.bundleItem?.discountType===o.NoDiscount&&e?.useProductCompareAtPrice||Number(e?.bundleItem?.discountValue)&&r)&&!e?.currentVariant?.salePrice},getBadgeContent=(e,r,i)=>{if(!e.detail||!r?.trim()?.length)return r;let{detail:u,currentVariant:c}=e,{discountPercentAmount:l,discountAmount:a}=n({currentVariant:c,bundleItem:e?.bundleItem,options:{moneyFormat:i,useProductCompareAtPrice:e?.useProductCompareAtPrice}}),d=()=>e?.bundleItem?.discountType!==o.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?`${l}%`:`${getPriceDiffByPercent(c?.price||0,c?.salePrice||0)||0}%`:"0%",s=()=>e?.bundleItem?.discountType!==o.NoDiscount||e?.useProductCompareAtPrice?Number(e?.bundleItem?.discountValue)>0?a:getPriceDiffByValue(c?.price||0,c?.salePrice||0,i):t("0",i),p=new Map([["{percent_discount}",d],["{amount_discount}",s],["{min_price}",()=>getMinPrice(u.variants,i)||0],["{inventory_quantity}",()=>c?.inventoryQuantity||0]]);return[...p.entries()].reduce((e,[t,r])=>e.replaceAll(t,r()),r)},checkDiscountContentProductBadge=e=>{if(!e)return!1;let t=/\{percent_discount\}|\{amount_discount\}/;return t.test(e)},getShapePlacementClass=(e,t,r="desktop")=>e?t?.[`--pos${deviceWithSurfix(r)}`]?"w-full h-full":"!gp-absolute":t?.[`--d${deviceWithSurfix(r)}`]?"":"!gp-inline-block gp-w-fit",getAlignShape=(t,r)=>r?"":e("gp-flex",{"gp-justify-start":t?.desktop==="left","gp-justify-center":t?.desktop==="center","gp-justify-end":t?.desktop==="right","tablet:gp-justify-start":t?.tablet==="left","tablet:gp-justify-center":t?.tablet==="center","tablet:gp-justify-end":t?.tablet==="right","mobile:gp-justify-start":t?.mobile==="left","mobile:gp-justify-center":t?.mobile==="center","mobile:gp-justify-end":t?.mobile==="right"}),convertToStyle=e=>Object.entries(e||{}).reduce((e,[t,r])=>{let i=new Map([["clipPath","clip-path"],["writingMode","writing-mode"],["borderRadius","border-radius"],["transform","transform"],["alignItems","align-items"],["maxWidth","max-width"]]),n=i.get(t)||t;return{...e,[n]:r}},{}),getWrapperStyle=e=>({[e?"z-index":"zIndex"]:1}),getWidthByShapeSize=(e,t)=>{let r={},n=["desktop","mobile","tablet"];return n.forEach(n=>{let o=i(e,n,null),u=o?.width||t?.wrapperWidth;u&&(r={...r,[n]:u})}),r},getHeightByShapeSize=(e,t)=>{let r={},n=["desktop","mobile","tablet"];return n.forEach(n=>{let o=i(e,n,null);r={...r,[n]:o?.height||t?.wrapperHeight}}),r},getSize=(e,t)=>{let i=r("w",getWidthByShapeSize(t,e)),n=r("h",getHeightByShapeSize(t,e));return{...i,...n}},getShapeWrapperPadding=e=>{let t={};if(1!==e)return t;let r=["desktop","mobile","tablet"];return r.forEach(e=>{t={...t,height:0,[`--p${"desktop"!==e?`-${e}`:""}`]:"50% 0"}}),t},deviceWithSurfix=e=>"desktop"===e?"":`-${e}`,getDeviceSpecificStyle=(e,t)=>{for(let r of({desktop:["desktop"],tablet:["tablet","desktop"],mobile:["mobile","tablet","desktop"]})[t])if(e?.[r])return e[r]},getIsNoDiscountState=({props:e,product:t,currentVariant:r,moneyFormat:i,useProductCompareAtPrice:n})=>{let{setting:o,"bundle-item":u}=e,c=checkDiscountContentProductBadge(o?.displayContent);return c&&checkNoDiscountState({detail:t,currentVariant:r,bundleItem:u,useProductCompareAtPrice:n},i)};export{checkDiscountContentProductBadge,checkNoDiscountState,convertToStyle,deviceWithSurfix,getAlignShape,getBadgeContent,getDeviceSpecificStyle,getIsNoDiscountState,getShapePlacementClass,getShapeWrapperPadding,getSize,getWidthByShapeSize,getWrapperStyle};
|
|
@@ -9,7 +9,7 @@ import{composeClasses as s,template as t,RenderIf as e,isLocalEnv as i,baseAsset
|
|
|
9
9
|
>
|
|
10
10
|
<div class="${sa}">
|
|
11
11
|
${e(P,t`
|
|
12
|
-
${
|
|
12
|
+
${M("is_out_of_stock",t`<div
|
|
13
13
|
${{...sd({isOutOfStockIcon:!0,isVisible:!0})}}
|
|
14
14
|
class="${sr}"
|
|
15
15
|
style="${sc(!0)}"
|
|
@@ -23,7 +23,7 @@ import{composeClasses as s,template as t,RenderIf as e,isLocalEnv as i,baseAsset
|
|
|
23
23
|
style="${sc(!1)}"
|
|
24
24
|
>
|
|
25
25
|
${T}
|
|
26
|
-
</div
|
|
26
|
+
</div>`,t` <div
|
|
27
27
|
${{...sd({isOutOfStockIcon:!0,isVisible:!1})}}
|
|
28
28
|
class="${sr}"
|
|
29
29
|
style="${sc(!0)}"
|