@gem-sdk/components 4.1.1 → 4.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),ChildrenDroppable=require("../../grid/components/ChildrenDroppable.js"),Loading=require("../../common/components/Loading.js"),React=require("react"),ArticleNotFound=require("./ArticleNotFound.js");const ArticleList=e=>{let t=core.useEditorMode(),{styles:i,setting:r,className:l,children:o,builderProps:a,advanced:n,builderAttrs:s}=e??{},{articleSetting:d,numberOfArticle:c}=r??{},{articleIds:u,articlePickType:m}=d??{},{border:g,rounded:p,hasBoxShadow:h,boxShadow:b}=n??{},x=core.composeAdvanceStyle({border:g,rounded:p,hasBoxShadow:h,boxShadow:b,"spacing-setting":n?.["spacing-setting"]}),y={first:u?.length||50,where:{baseIDIn:[...d?.articleIds??[]]},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},j={first:1,where:{baseID:d?.blogId},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"},articlesOrderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},[v,f]=React.useState(!0),R=core.useBlogsQuery("latest"===m?j:null,{revalidateOnMount:!0}),A=core.useArticlesQuery("manually"===m?y:null,{revalidateOnMount:!0}),S=R.data?.blogs?.edges?.[0]?.node,D="manually"===m?A.isLoading:R.isLoading,w="manually"===m?A.isValidating:R.isValidating,T="manually"===m?A.error:R.error,k=R?.data?.blogs?.edges?.[0]?.node,B="latest"===m?core.flattenConnection(k?.articles):core.flattenConnection(A?.data?.articles),P=(e,t)=>({...e??{},blog:{title:t?.title??"",handle:t?.handle??""}}),L="latest"===m?B?.filter((e,t)=>t<+(c||4)).map(e=>P(e,k)):"manually"===m&&d?.articleIds?.length?u?.map(e=>{let t=B?.find(t=>t?.baseID===e);return P(t,t?.blogs?.edges?.[0]?.node)}).filter(Boolean):B.filter((e,t)=>t<(d?.numOfSelectedArticles||4)).map(e=>P(e,e?.blogs?.edges?.[0]?.node));return L?.length||D||"edit"!=t?jsxRuntime.jsxs("div",{...s,className:a?.builderData?.uid,children:[w||D?jsxRuntime.jsx(Loading.default,{}):T?jsxRuntime.jsxs("div",{children:["Error: ",T?.message]}):L?.length?jsxRuntime.jsx(core.ArticleListProvider,{styles:{horizontalGutter:i?.horizontalGutter,verticalGutter:i?.verticalGutter,spacing:i?.spacing,width:i?.width,height:i?.height},settings:{slidesToShow:r?.slideToShow??{desktop:4,tablet:3,mobile:1}},articles:L,children:jsxRuntime.jsx("div",{"data-id":a?.uid,className:"gp-relative",children:jsxRuntime.jsx("div",{style:{...x,...core.makeStyleWithDefault("w",core.makeWidth(i?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...core.makeStyleResponsive("rg",i?.horizontalGutter),...core.makeStyleResponsive("cg",i?.verticalGutter),...core.getStyleBackgroundByDevice(r?.background),...core.getGradientBgrStyleByDevice(r?.background),...core.makeStyleResponsive("gtc",{desktop:`repeat(${core.getResponsiveValueByScreen(r?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:r?.slideToShow?.tablet&&`repeat(${core.getResponsiveValueByScreen(r?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:r?.slideToShow?.mobile&&`repeat(${core.getResponsiveValueByScreen(r?.slideToShow,"mobile")}, minmax(0, 1fr))`})},className:core.cls(l,"gp-m-auto gp-grid gp-w-full"),children:L.map(e=>jsxRuntime.jsx(core.ArticleProvider,{article:e,readOnly:!0,children:jsxRuntime.jsx("div",{"data-component-type":"component","data-component-tag":"Article","data-component-label":"Article","data-component-no-setting":!0,"data-article-id":e?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:core.isEmptyChildren(o)?jsxRuntime.jsx(ChildrenDroppable.default,{}):o})},e?.id))})})}):jsxRuntime.jsx("div",{children:"Articles not found"}),core.filterToolbarPreview(o,!0)]}):v?jsxRuntime.jsxs("div",{...s,className:a?.builderData?.uid,children:[jsxRuntime.jsx(ArticleNotFound.default,{blogHandle:S?.handle,onClose:()=>f(!1),articlePickType:m??"manually",children:o}),core.filterToolbarPreview(o,!0)]}):null};exports.default=ArticleList;
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var jsxRuntime=require("react/jsx-runtime"),core=require("@gem-sdk/core"),ChildrenDroppable=require("../../grid/components/ChildrenDroppable.js"),Loading=require("../../common/components/Loading.js"),React=require("react"),ArticleNotFound=require("./ArticleNotFound.js");const ArticleList=e=>{let t=core.useEditorMode(),{styles:i,setting:r,className:l,children:o,builderProps:a,advanced:s,builderAttrs:n,style:d}=e??{},{articleSetting:c,numberOfArticle:u}=r??{},{articleIds:m,articlePickType:g}=c??{},{border:p,rounded:h,hasBoxShadow:b,boxShadow:y}=s??{},[x]=core.splitStyle(["pos","top","left","bottom","right","z","d"],d),j=core.composeAdvanceStyle({border:p,rounded:h,hasBoxShadow:b,boxShadow:y,"spacing-setting":s?.["spacing-setting"]}),v={first:m?.length||50,where:{baseIDIn:[...c?.articleIds??[]]},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},f={first:1,where:{baseID:c?.blogId},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"},articlesOrderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},[R,S]=React.useState(!0),A=core.useBlogsQuery("latest"===g?f:null,{revalidateOnMount:!0}),D=core.useArticlesQuery("manually"===g?v:null,{revalidateOnMount:!0}),w=A.data?.blogs?.edges?.[0]?.node,T="manually"===g?D.isLoading:A.isLoading,k="manually"===g?D.isValidating:A.isValidating,B="manually"===g?D.error:A.error,P=A?.data?.blogs?.edges?.[0]?.node,L="latest"===g?core.flattenConnection(P?.articles):core.flattenConnection(D?.data?.articles),C=(e,t)=>({...e??{},blog:{title:t?.title??"",handle:t?.handle??""}}),O="latest"===g?L?.filter((e,t)=>t<+(u||4)).map(e=>C(e,P)):"manually"===g&&c?.articleIds?.length?m?.map(e=>{let t=L?.find(t=>t?.baseID===e);return C(t,t?.blogs?.edges?.[0]?.node)}).filter(Boolean):L.filter((e,t)=>t<(c?.numOfSelectedArticles||4)).map(e=>C(e,e?.blogs?.edges?.[0]?.node));return O?.length||T||"edit"!=t?jsxRuntime.jsxs("div",{...n,className:a?.builderData?.uid,style:x,children:[k||T?jsxRuntime.jsx(Loading.default,{}):B?jsxRuntime.jsxs("div",{children:["Error: ",B?.message]}):O?.length?jsxRuntime.jsx(core.ArticleListProvider,{styles:{horizontalGutter:i?.horizontalGutter,verticalGutter:i?.verticalGutter,spacing:i?.spacing,width:i?.width,height:i?.height},settings:{slidesToShow:r?.slideToShow??{desktop:4,tablet:3,mobile:1}},articles:O,children:jsxRuntime.jsx("div",{"data-id":a?.uid,className:"gp-relative",children:jsxRuntime.jsx("div",{style:{...j,...core.makeStyleWithDefault("w",core.makeWidth(i?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...core.makeStyleResponsive("rg",i?.horizontalGutter),...core.makeStyleResponsive("cg",i?.verticalGutter),...core.getStyleBackgroundByDevice(r?.background),...core.getGradientBgrStyleByDevice(r?.background),...core.makeStyleResponsive("gtc",{desktop:`repeat(${core.getResponsiveValueByScreen(r?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:r?.slideToShow?.tablet&&`repeat(${core.getResponsiveValueByScreen(r?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:r?.slideToShow?.mobile&&`repeat(${core.getResponsiveValueByScreen(r?.slideToShow,"mobile")}, minmax(0, 1fr))`})},className:core.cls(l,"gp-m-auto gp-grid gp-w-full"),children:O.map(e=>jsxRuntime.jsx(core.ArticleProvider,{article:e,readOnly:!0,children:jsxRuntime.jsx("div",{"data-component-type":"component","data-component-tag":"Article","data-component-label":"Article","data-component-no-setting":!0,"data-article-id":e?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:core.isEmptyChildren(o)?jsxRuntime.jsx(ChildrenDroppable.default,{}):o})},e?.id))})})}):jsxRuntime.jsx("div",{children:"Articles not found"}),core.filterToolbarPreview(o,!0)]}):R?jsxRuntime.jsxs("div",{...n,className:a?.builderData?.uid,children:[jsxRuntime.jsx(ArticleNotFound.default,{blogHandle:w?.handle,onClose:()=>S(!1),articlePickType:g??"manually",children:o}),core.filterToolbarPreview(o,!0)]}):null};exports.default=ArticleList;
@@ -1,17 +1,18 @@
1
1
  'use client';
2
- "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers$1=require("../common/helpers.js"),helpers=require("../../helpers.js");const ArticleList=e=>{let{styles:l,setting:t,className:i,children:a,builderProps:r,advanced:s}=e??{},{border:o,rounded:c,hasBoxShadow:n,boxShadow:g}=s??{},d=core.composeAdvanceStyle({border:o,rounded:c,hasBoxShadow:n,boxShadow:g,"spacing-setting":s?.["spacing-setting"]}),p=t?.articleSetting,m=t?.articleOrderBy??"UPDATED_AT_REVERSE",u=p?.articlePickType??"manually",y="manually"===u&&p?.articleHandles?.length?p?.articleHandles:[],b="manually"===u&&p?.articleBlogTitles?.length?p?.articleBlogTitles:[],h=p?.blogHandle??"",_=helpers.convertUnitToNumber(t?.numberOfArticle,4);return core.template`
2
+ "use strict";Object.defineProperty(exports,"__esModule",{value:!0});var core=require("@gem-sdk/core"),helpers$1=require("../common/helpers.js"),helpers=require("../../helpers.js");const ArticleList=e=>{let{styles:l,setting:t,className:i,children:r,builderProps:a,advanced:s,style:o}=e??{},{border:c,rounded:n,hasBoxShadow:g,boxShadow:d}=s??{},[p]=core.splitStyle(["pos","top","left","bottom","right","z","d"],o),m=core.composeAdvanceStyle({border:c,rounded:n,hasBoxShadow:g,boxShadow:d,"spacing-setting":s?.["spacing-setting"]}),u=t?.articleSetting,y=t?.articleOrderBy??"UPDATED_AT_REVERSE",b=u?.articlePickType??"manually",h="manually"===b&&u?.articleHandles?.length?u?.articleHandles:[],S="manually"===b&&u?.articleBlogTitles?.length?u?.articleBlogTitles:[],_=u?.blogHandle??"",v=helpers.convertUnitToNumber(t?.numberOfArticle,4);return core.template`
3
3
  <div
4
- data-id="${r?.uid}"
4
+ style="${p}"
5
+ data-id="${a?.uid}"
5
6
  items-repeat
6
7
  >
7
- <div style="${{...d,...core.makeStyleWithDefault("w",core.makeWidth(l?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...core.makeStyleResponsive("rg",l?.horizontalGutter),...core.makeStyleResponsive("cg",l?.verticalGutter),...core.getStyleBackgroundByDevice(t?.background),...core.getGradientBgrStyleByDevice(t?.background),...core.makeStyleResponsive("gtc",{desktop:`repeat(${core.getResponsiveValueByScreen(t?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:t?.slideToShow?.tablet&&`repeat(${core.getResponsiveValueByScreen(t?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:t?.slideToShow?.mobile&&`repeat(${core.getResponsiveValueByScreen(t?.slideToShow,"mobile")}, minmax(0, 1fr))`})}}"
8
+ <div style="${{...m,...core.makeStyleWithDefault("w",core.makeWidth(l?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...core.makeStyleResponsive("rg",l?.horizontalGutter),...core.makeStyleResponsive("cg",l?.verticalGutter),...core.getStyleBackgroundByDevice(t?.background),...core.getGradientBgrStyleByDevice(t?.background),...core.makeStyleResponsive("gtc",{desktop:`repeat(${core.getResponsiveValueByScreen(t?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:t?.slideToShow?.tablet&&`repeat(${core.getResponsiveValueByScreen(t?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:t?.slideToShow?.mobile&&`repeat(${core.getResponsiveValueByScreen(t?.slideToShow,"mobile")}, minmax(0, 1fr))`})}}"
8
9
  class="${core.cls(i,"gp-grid !gp-m-auto gp-w-full",s?.cssClass)}"
9
10
  >
10
11
  {% liquid
11
- assign articlePickType = '${u}'
12
- assign articleHandles = '${y.toString()}'| split: ","
13
- assign articleBlogTitle = "${helpers$1.convertSpecialCharacter(b.toString())}" | split: ","
14
- assign limit = "${"manually"===u?p?.articleIds?.length:_}"
12
+ assign articlePickType = '${b}'
13
+ assign articleHandles = '${h.toString()}'| split: ","
14
+ assign articleBlogTitle = "${helpers$1.convertSpecialCharacter(S.toString())}" | split: ","
15
+ assign limit = "${"manually"===b?u?.articleIds?.length:v}"
15
16
  assign blogTitle = ''
16
17
  assign all_articles = null | sort
17
18
 
@@ -21,11 +22,11 @@
21
22
  assign all_articles = all_articles | concat: articleByHandle
22
23
  endfor
23
24
  else
24
- assign current_blog_handle = blogs['${h}']
25
+ assign current_blog_handle = blogs['${_}']
25
26
  if gp_enable_custom_dynamic_blog == true
26
27
  assign current_blog_handle = blogs[blog.handle]
27
28
  endif
28
- assign all_articles = current_blog_handle.articles | limit: limit | sort: "${m.replace("_REVERSE","").toLowerCase()}" ${m.includes("_REVERSE")?"| reverse":""}
29
+ assign all_articles = current_blog_handle.articles | limit: limit | sort: "${y.replace("_REVERSE","").toLowerCase()}" ${y.includes("_REVERSE")?"| reverse":""}
29
30
  assign blogTitle = current_blog_handle.title
30
31
  endif
31
32
 
@@ -34,7 +35,7 @@
34
35
  {% if articlePickType == 'manually' %}
35
36
  {% assign blogTitle = articleBlogTitle[forloop.index0] %}
36
37
  {% endif %}
37
- <div>${a??""}</div>
38
+ <div>${r??""}</div>
38
39
  {% endfor %}
39
40
  </div>
40
41
  </div>
@@ -29,7 +29,7 @@
29
29
  {% assign otherImage = product.media[other_image_index] %}
30
30
  ${system.LiquidIf("otherImage.media_type != 'image'","{% assign src = otherImage.preview_image.src %}","{% assign src = otherImage.src %}")}
31
31
  `)}
32
- ${NextImage_liquid.default({srcIsLiquidCode:!0,src:system.LiquidIf("src != null",common.getSrcImage("src"),"{{ 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif' }}"),id:system.LiquidIf("featureMedia != null","{{featureMedia.id}}"),width:"{{featureMedia.width}}",height:"{{featureMedia.height}}",alt:"{{featureMedia.alt | escape}}",srcset:`${common.getSrcImage("src")}`,baseSrc:"{{src | image_url}}",sizes:"(max-width: 768px) 50vw, 100vw",setting:{layout:a?.ftLayout,aspectRatio:n,qualityType:a?.qualityType,qualityPercent:a?.qualityPercent},priority:a?.preload,className:`gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none ${e}`,enableLazyLoadImage:i})}`,_=()=>core.template`
32
+ ${NextImage_liquid.default({srcIsLiquidCode:!0,src:system.LiquidIf("src != null",common.getSrcImage("src"),"https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif"),id:system.LiquidIf("featureMedia != null","{{featureMedia.id}}"),width:"{{featureMedia.width}}",height:"{{featureMedia.height}}",alt:"{{featureMedia.alt | escape}}",srcset:`${common.getSrcImage("src")}`,baseSrc:"{{src | image_url}}",sizes:"(max-width: 768px) 50vw, 100vw",setting:{layout:a?.ftLayout,aspectRatio:n,qualityType:a?.qualityType,qualityPercent:a?.qualityPercent},priority:a?.preload,className:`gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none ${e}`,enableLazyLoadImage:i})}`,_=()=>core.template`
33
33
  ${NextImage_liquid.default({srcIsLiquidCode:!0,src:"https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif",alt:"No Image",sizes:"(max-width: 768px) 50vw, 100vw",setting:{layout:a?.ftLayout,aspectRatio:n,qualityType:a?.qualityType,qualityPercent:a?.qualityPercent},priority:a?.preload,className:"gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none",enableLazyLoadImage:i})}`,b=common.getPaddingBottomByShapeSetting(a.ftShape),M=t=>`
34
34
  ${system.Liquid(`{% assign productImageWidth = 0 %}
35
35
  {% case featureMedia.media_type %}
@@ -54,7 +54,7 @@
54
54
  `)}
55
55
  ${system.LiquidFor("featureMedia in product.media",`${system.LiquidIf("featureMedia.media_type == 'image'",`${system.LiquidFor("image in product.images",system.LiquidIf("image.src == featureMedia.src","{% assign imageID = image.id %}{% break %}"))}`,"{% assign imageID = '' %}")}
56
56
  ${M()}`)}
57
- `,NextImage_liquid.default({src:"{{ 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif' }}",id:"noImageError",width:"480",height:"480",alt:"no image",priority:a?.preload,setting:{layout:a?.ftLayout,aspectRatio:n,qualityType:a?.qualityType,qualityPercent:a?.qualityPercent},style:{height:"100%"},className:"gp-w-full featured-image-only !gp-rounded-none",customLazyload:!0,enableLazyLoadImage:i})),L=()=>`
57
+ `,NextImage_liquid.default({src:"https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif",id:"noImageError",width:"480",height:"480",alt:"no image",priority:a?.preload,setting:{layout:a?.ftLayout,aspectRatio:n,qualityType:a?.qualityType,qualityPercent:a?.qualityPercent},style:{height:"100%"},className:"gp-w-full featured-image-only !gp-rounded-none",customLazyload:!0,enableLazyLoadImage:i})),L=()=>`
58
58
  ${Carousel_liquid.default({builderProps:{uid:e},rootId:`ft-${e}-{{section.id}}-{{product.id}}`,conditionAppendJs:"product.media.size > 1",wrapperClass:v,rootClass:`${s}`,rootAttrs:{type:"gp-feature-image-carousel","product-id":"{{product.id}}","product-media":"{{product.media.size}}"},isHiddenArrowWhenDisabled:!0,setting:c,rootStyles:o,styles:u,style:{playSpeed:600},disableMarginAuto:!0,children:w})}
59
59
  `,x=()=>{switch(a?.preDisplay){case"1st-images":return`
60
60
  {% assign featureMedia = product.media.first %}
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useEditorMode as i,composeAdvanceStyle as l,useBlogsQuery as a,useArticlesQuery as r,flattenConnection as o,filterToolbarPreview as d,ArticleListProvider as n,makeStyleWithDefault as s,makeWidth as c,makeStyleResponsive as m,getStyleBackgroundByDevice as g,getGradientBgrStyleByDevice as p,getResponsiveValueByScreen as h,cls as u,ArticleProvider as b,isEmptyChildren as f}from"@gem-sdk/core";import w from"../../grid/components/ChildrenDroppable.js";import A from"../../common/components/Loading.js";import{useState as T}from"react";import D from"./ArticleNotFound.js";let ArticleList=y=>{let v=i(),{styles:S,setting:O,className:k,children:I,builderProps:L,advanced:E,builderAttrs:P}=y??{},{articleSetting:G,numberOfArticle:_}=O??{},{articleIds:x,articlePickType:C}=G??{},{border:M,rounded:N,hasBoxShadow:j,boxShadow:B}=E??{},F=l({border:M,rounded:N,hasBoxShadow:j,boxShadow:B,"spacing-setting":E?.["spacing-setting"]}),z={first:x?.length||50,where:{baseIDIn:[...G?.articleIds??[]]},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},R={first:1,where:{baseID:G?.blogId},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"},articlesOrderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},[U,$]=T(!0),V=a("latest"===C?R:null,{revalidateOnMount:!0}),H=r("manually"===C?z:null,{revalidateOnMount:!0}),q=V.data?.blogs?.edges?.[0]?.node,J="manually"===C?H.isLoading:V.isLoading,K="manually"===C?H.isValidating:V.isValidating,Q="manually"===C?H.error:V.error,W=V?.data?.blogs?.edges?.[0]?.node,X="latest"===C?o(W?.articles):o(H?.data?.articles),Y=(e,t)=>({...e??{},blog:{title:t?.title??"",handle:t?.handle??""}}),Z="latest"===C?X?.filter((e,t)=>t<+(_||4)).map(e=>Y(e,W)):"manually"===C&&G?.articleIds?.length?x?.map(e=>{let t=X?.find(t=>t?.baseID===e);return Y(t,t?.blogs?.edges?.[0]?.node)}).filter(Boolean):X.filter((e,t)=>t<(G?.numOfSelectedArticles||4)).map(e=>Y(e,e?.blogs?.edges?.[0]?.node));return Z?.length||J||"edit"!=v?e("div",{...P,className:L?.builderData?.uid,children:[K||J?t(A,{}):Q?e("div",{children:["Error: ",Q?.message]}):Z?.length?t(n,{styles:{horizontalGutter:S?.horizontalGutter,verticalGutter:S?.verticalGutter,spacing:S?.spacing,width:S?.width,height:S?.height},settings:{slidesToShow:O?.slideToShow??{desktop:4,tablet:3,mobile:1}},articles:Z,children:t("div",{"data-id":L?.uid,className:"gp-relative",children:t("div",{style:{...F,...s("w",c(S?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...m("rg",S?.horizontalGutter),...m("cg",S?.verticalGutter),...g(O?.background),...p(O?.background),...m("gtc",{desktop:`repeat(${h(O?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:O?.slideToShow?.tablet&&`repeat(${h(O?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:O?.slideToShow?.mobile&&`repeat(${h(O?.slideToShow,"mobile")}, minmax(0, 1fr))`})},className:u(k,"gp-m-auto gp-grid gp-w-full"),children:Z.map(e=>t(b,{article:e,readOnly:!0,children:t("div",{"data-component-type":"component","data-component-tag":"Article","data-component-label":"Article","data-component-no-setting":!0,"data-article-id":e?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:f(I)?t(w,{}):I})},e?.id))})})}):t("div",{children:"Articles not found"}),d(I,!0)]}):U?e("div",{...P,className:L?.builderData?.uid,children:[t(D,{blogHandle:q?.handle,onClose:()=>$(!1),articlePickType:C??"manually",children:I}),d(I,!0)]}):null};export{ArticleList as default};
2
+ import{jsxs as e,jsx as t}from"react/jsx-runtime";import{useEditorMode as i,splitStyle as l,composeAdvanceStyle as a,useBlogsQuery as r,useArticlesQuery as o,flattenConnection as d,filterToolbarPreview as n,ArticleListProvider as s,makeStyleWithDefault as c,makeWidth as m,makeStyleResponsive as g,getStyleBackgroundByDevice as p,getGradientBgrStyleByDevice as h,getResponsiveValueByScreen as u,cls as b,ArticleProvider as f,isEmptyChildren as w}from"@gem-sdk/core";import A from"../../grid/components/ChildrenDroppable.js";import T from"../../common/components/Loading.js";import{useState as y}from"react";import D from"./ArticleNotFound.js";let ArticleList=v=>{let S=i(),{styles:O,setting:k,className:I,children:L,builderProps:E,advanced:P,builderAttrs:G,style:_}=v??{},{articleSetting:x,numberOfArticle:C}=k??{},{articleIds:M,articlePickType:N}=x??{},{border:j,rounded:z,hasBoxShadow:B,boxShadow:F}=P??{},[R]=l(["pos","top","left","bottom","right","z","d"],_),U=a({border:j,rounded:z,hasBoxShadow:B,boxShadow:F,"spacing-setting":P?.["spacing-setting"]}),$={first:M?.length||50,where:{baseIDIn:[...x?.articleIds??[]]},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},V={first:1,where:{baseID:x?.blogId},orderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"},articlesOrderBy:{direction:"DESC",field:"PLATFORM_UPDATED_AT"}},[H,q]=y(!0),J=r("latest"===N?V:null,{revalidateOnMount:!0}),K=o("manually"===N?$:null,{revalidateOnMount:!0}),Q=J.data?.blogs?.edges?.[0]?.node,W="manually"===N?K.isLoading:J.isLoading,X="manually"===N?K.isValidating:J.isValidating,Y="manually"===N?K.error:J.error,Z=J?.data?.blogs?.edges?.[0]?.node,ee="latest"===N?d(Z?.articles):d(K?.data?.articles),et=(e,t)=>({...e??{},blog:{title:t?.title??"",handle:t?.handle??""}}),ei="latest"===N?ee?.filter((e,t)=>t<+(C||4)).map(e=>et(e,Z)):"manually"===N&&x?.articleIds?.length?M?.map(e=>{let t=ee?.find(t=>t?.baseID===e);return et(t,t?.blogs?.edges?.[0]?.node)}).filter(Boolean):ee.filter((e,t)=>t<(x?.numOfSelectedArticles||4)).map(e=>et(e,e?.blogs?.edges?.[0]?.node));return ei?.length||W||"edit"!=S?e("div",{...G,className:E?.builderData?.uid,style:R,children:[X||W?t(T,{}):Y?e("div",{children:["Error: ",Y?.message]}):ei?.length?t(s,{styles:{horizontalGutter:O?.horizontalGutter,verticalGutter:O?.verticalGutter,spacing:O?.spacing,width:O?.width,height:O?.height},settings:{slidesToShow:k?.slideToShow??{desktop:4,tablet:3,mobile:1}},articles:ei,children:t("div",{"data-id":E?.uid,className:"gp-relative",children:t("div",{style:{...U,...c("w",m(O?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...g("rg",O?.horizontalGutter),...g("cg",O?.verticalGutter),...p(k?.background),...h(k?.background),...g("gtc",{desktop:`repeat(${u(k?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:k?.slideToShow?.tablet&&`repeat(${u(k?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:k?.slideToShow?.mobile&&`repeat(${u(k?.slideToShow,"mobile")}, minmax(0, 1fr))`})},className:b(I,"gp-m-auto gp-grid gp-w-full"),children:ei.map(e=>t(f,{article:e,readOnly:!0,children:t("div",{"data-component-type":"component","data-component-tag":"Article","data-component-label":"Article","data-component-no-setting":!0,"data-article-id":e?.baseID?.replace("gid://shopify/OnlineStoreArticle/",""),children:w(L)?t(A,{}):L})},e?.id))})})}):t("div",{children:"Articles not found"}),n(L,!0)]}):H?e("div",{...G,className:E?.builderData?.uid,children:[t(D,{blogHandle:Q?.handle,onClose:()=>q(!1),articlePickType:N??"manually",children:L}),n(L,!0)]}):null};export{ArticleList as default};
@@ -1,17 +1,18 @@
1
1
  'use client';
2
- import{composeAdvanceStyle as l,template as e,makeStyleWithDefault as i,makeWidth as t,makeStyleResponsive as a,getStyleBackgroundByDevice as r,getGradientBgrStyleByDevice as s,getResponsiveValueByScreen as n,cls as o}from"@gem-sdk/core";import{convertSpecialCharacter as c}from"../common/helpers.js";import{convertUnitToNumber as g}from"../../helpers.js";let ArticleList=d=>{let{styles:m,setting:p,className:u,children:b,builderProps:_,advanced:f}=d??{},{border:h,rounded:T,hasBoxShadow:y,boxShadow:$}=f??{},w=l({border:h,rounded:T,hasBoxShadow:y,boxShadow:$,"spacing-setting":f?.["spacing-setting"]}),S=p?.articleSetting,k=p?.articleOrderBy??"UPDATED_AT_REVERSE",E=S?.articlePickType??"manually",v="manually"===E&&S?.articleHandles?.length?S?.articleHandles:[],B="manually"===E&&S?.articleBlogTitles?.length?S?.articleBlogTitles:[],H=S?.blogHandle??"",R=g(p?.numberOfArticle,4);return e`
2
+ import{splitStyle as l,composeAdvanceStyle as e,template as i,makeStyleWithDefault as t,makeWidth as a,makeStyleResponsive as r,getStyleBackgroundByDevice as s,getGradientBgrStyleByDevice as n,getResponsiveValueByScreen as o,cls as c}from"@gem-sdk/core";import{convertSpecialCharacter as g}from"../common/helpers.js";import{convertUnitToNumber as d}from"../../helpers.js";let ArticleList=m=>{let{styles:p,setting:b,className:u,children:f,builderProps:_,advanced:h,style:T}=m??{},{border:y,rounded:$,hasBoxShadow:w,boxShadow:S}=h??{},[k]=l(["pos","top","left","bottom","right","z","d"],T),E=e({border:y,rounded:$,hasBoxShadow:w,boxShadow:S,"spacing-setting":h?.["spacing-setting"]}),v=b?.articleSetting,B=b?.articleOrderBy??"UPDATED_AT_REVERSE",H=v?.articlePickType??"manually",R="manually"===H&&v?.articleHandles?.length?v?.articleHandles:[],x="manually"===H&&v?.articleBlogTitles?.length?v?.articleBlogTitles:[],A=v?.blogHandle??"",P=d(b?.numberOfArticle,4);return i`
3
3
  <div
4
+ style="${k}"
4
5
  data-id="${_?.uid}"
5
6
  items-repeat
6
7
  >
7
- <div style="${{...w,...i("w",t(m?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...a("rg",m?.horizontalGutter),...a("cg",m?.verticalGutter),...r(p?.background),...s(p?.background),...a("gtc",{desktop:`repeat(${n(p?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:p?.slideToShow?.tablet&&`repeat(${n(p?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:p?.slideToShow?.mobile&&`repeat(${n(p?.slideToShow,"mobile")}, minmax(0, 1fr))`})}}"
8
- class="${o(u,"gp-grid !gp-m-auto gp-w-full",f?.cssClass)}"
8
+ <div style="${{...E,...t("w",a(p?.width),{desktop:"--g-ct-w",tablet:"--g-ct-w",mobile:"--g-ct-w"}),...r("rg",p?.horizontalGutter),...r("cg",p?.verticalGutter),...s(b?.background),...n(b?.background),...r("gtc",{desktop:`repeat(${o(b?.slideToShow,"desktop")}, minmax(0, 1fr))`,tablet:b?.slideToShow?.tablet&&`repeat(${o(b?.slideToShow,"tablet")}, minmax(0, 1fr))`,mobile:b?.slideToShow?.mobile&&`repeat(${o(b?.slideToShow,"mobile")}, minmax(0, 1fr))`})}}"
9
+ class="${c(u,"gp-grid !gp-m-auto gp-w-full",h?.cssClass)}"
9
10
  >
10
11
  {% liquid
11
- assign articlePickType = '${E}'
12
- assign articleHandles = '${v.toString()}'| split: ","
13
- assign articleBlogTitle = "${c(B.toString())}" | split: ","
14
- assign limit = "${"manually"===E?S?.articleIds?.length:R}"
12
+ assign articlePickType = '${H}'
13
+ assign articleHandles = '${R.toString()}'| split: ","
14
+ assign articleBlogTitle = "${g(x.toString())}" | split: ","
15
+ assign limit = "${"manually"===H?v?.articleIds?.length:P}"
15
16
  assign blogTitle = ''
16
17
  assign all_articles = null | sort
17
18
 
@@ -21,11 +22,11 @@ import{composeAdvanceStyle as l,template as e,makeStyleWithDefault as i,makeWidt
21
22
  assign all_articles = all_articles | concat: articleByHandle
22
23
  endfor
23
24
  else
24
- assign current_blog_handle = blogs['${H}']
25
+ assign current_blog_handle = blogs['${A}']
25
26
  if gp_enable_custom_dynamic_blog == true
26
27
  assign current_blog_handle = blogs[blog.handle]
27
28
  endif
28
- assign all_articles = current_blog_handle.articles | limit: limit | sort: "${k.replace("_REVERSE","").toLowerCase()}" ${k.includes("_REVERSE")?"| reverse":""}
29
+ assign all_articles = current_blog_handle.articles | limit: limit | sort: "${B.replace("_REVERSE","").toLowerCase()}" ${B.includes("_REVERSE")?"| reverse":""}
29
30
  assign blogTitle = current_blog_handle.title
30
31
  endif
31
32
 
@@ -34,7 +35,7 @@ import{composeAdvanceStyle as l,template as e,makeStyleWithDefault as i,makeWidt
34
35
  {% if articlePickType == 'manually' %}
35
36
  {% assign blogTitle = articleBlogTitle[forloop.index0] %}
36
37
  {% endif %}
37
- <div>${b??""}</div>
38
+ <div>${f??""}</div>
38
39
  {% endfor %}
39
40
  </div>
40
41
  </div>
@@ -29,7 +29,7 @@ import{makeStyleResponsive as e,template as a,cls as i}from"@gem-sdk/core";impor
29
29
  {% assign otherImage = product.media[other_image_index] %}
30
30
  ${y("otherImage.media_type != 'image'","{% assign src = otherImage.preview_image.src %}","{% assign src = otherImage.src %}")}
31
31
  `)}
32
- ${g({srcIsLiquidCode:!0,src:y("src != null",s("src"),"{{ 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif' }}"),id:y("featureMedia != null","{{featureMedia.id}}"),width:"{{featureMedia.width}}",height:"{{featureMedia.height}}",alt:"{{featureMedia.alt | escape}}",srcset:`${s("src")}`,baseSrc:"{{src | image_url}}",sizes:"(max-width: 768px) 50vw, 100vw",setting:{layout:q?.ftLayout,aspectRatio:N,qualityType:q?.qualityType,qualityPercent:q?.qualityPercent},priority:q?.preload,className:`gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none ${e}`,enableLazyLoadImage:x})}`,F=()=>a`
32
+ ${g({srcIsLiquidCode:!0,src:y("src != null",s("src"),"https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif"),id:y("featureMedia != null","{{featureMedia.id}}"),width:"{{featureMedia.width}}",height:"{{featureMedia.height}}",alt:"{{featureMedia.alt | escape}}",srcset:`${s("src")}`,baseSrc:"{{src | image_url}}",sizes:"(max-width: 768px) 50vw, 100vw",setting:{layout:q?.ftLayout,aspectRatio:N,qualityType:q?.qualityType,qualityPercent:q?.qualityPercent},priority:q?.preload,className:`gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none ${e}`,enableLazyLoadImage:x})}`,F=()=>a`
33
33
  ${g({srcIsLiquidCode:!0,src:"https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif",alt:"No Image",sizes:"(max-width: 768px) 50vw, 100vw",setting:{layout:q?.ftLayout,aspectRatio:N,qualityType:q?.qualityType,qualityPercent:q?.qualityPercent},priority:q?.preload,className:"gp-w-full gp-h-full gp-absolute gp-top-0 gp-left-0 featured-image-only gp-cursor-pointer !gp-rounded-none",enableLazyLoadImage:x})}`,H=r(q.ftShape),G=a=>`
34
34
  ${$(`{% assign productImageWidth = 0 %}
35
35
  {% case featureMedia.media_type %}
@@ -54,7 +54,7 @@ import{makeStyleResponsive as e,template as a,cls as i}from"@gem-sdk/core";impor
54
54
  `)}
55
55
  ${M("featureMedia in product.media",`${y("featureMedia.media_type == 'image'",`${M("image in product.images",y("image.src == featureMedia.src","{% assign imageID = image.id %}{% break %}"))}`,"{% assign imageID = '' %}")}
56
56
  ${G()}`)}
57
- `,g({src:"{{ 'https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif' }}",id:"noImageError",width:"480",height:"480",alt:"no image",priority:q?.preload,setting:{layout:q?.ftLayout,aspectRatio:N,qualityType:q?.qualityType,qualityPercent:q?.qualityPercent},style:{height:"100%"},className:"gp-w-full featured-image-only !gp-rounded-none",customLazyload:!0,enableLazyLoadImage:x})),Q=()=>`
57
+ `,g({src:"https://cdn.shopify.com/s/assets/no-image-2048-5e88c1b20e087fb7bbe9a3771824e743c244f437e4f8ba93bbf7b11b53f7824c_large.gif",id:"noImageError",width:"480",height:"480",alt:"no image",priority:q?.preload,setting:{layout:q?.ftLayout,aspectRatio:N,qualityType:q?.qualityType,qualityPercent:q?.qualityPercent},style:{height:"100%"},className:"gp-w-full featured-image-only !gp-rounded-none",customLazyload:!0,enableLazyLoadImage:x})),Q=()=>`
58
58
  ${b({builderProps:{uid:v},rootId:`ft-${v}-{{section.id}}-{{product.id}}`,conditionAppendJs:"product.media.size > 1",wrapperClass:B,rootClass:`${z}`,rootAttrs:{type:"gp-feature-image-carousel","product-id":"{{product.id}}","product-media":"{{product.media.size}}"},isHiddenArrowWhenDisabled:!0,setting:L,rootStyles:W,styles:R,style:{playSpeed:600},disableMarginAuto:!0,children:K})}
59
59
  `,U=()=>{switch(q?.preDisplay){case"1st-images":return`
60
60
  {% assign featureMedia = product.media.first %}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "4.1.1",
3
+ "version": "4.1.3",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",