@gem-sdk/components 2.0.0-staging.1096 → 2.0.0-staging.1097
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:
|
|
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;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../helpers.js");const getTextIconNotFound=e=>"react"===e?"Icons not found":helpers.getStaticLocale("IconList","icons_not_found"),getTextIconTranslations=({setting:e,builderProps:
|
|
1
|
+
"use strict";var core=require("@gem-sdk/core"),helpers=require("../../helpers.js");const getTextIconNotFound=e=>"react"===e?"Icons not found":helpers.getStaticLocale("IconList","icons_not_found"),getTextIconTranslations=({setting:e,builderProps:t,pageContext:o,key:i,type:n})=>{let{childItem:s,translate:c}=e??{};return"react"===n?s?.[i]:helpers.getDynamicSourceLocales({val:s?.[i],uid:t?.uid,settingId:`childItem_${i}`,pageContext:o,translate:c,isReplaceLocationOrigin:!0})},getvalueMap=({setting:e})=>{let{childConfig:t,iconType:o,iconSvg:i}=e??{};return o&&"matching"!==o?"different"===o?t:void 0:Array(t?.length).fill(i)},composePostionIconList=(e,t,o)=>{let i={...o,desktop:o?.desktop??0,tablet:o?.tablet??o?.desktop??0,mobile:o?.mobile??o?.tablet??o?.desktop??0},n={};return core.composePositionLineHeight({compose:n,lineHeight:e,device:"desktop",position:t,iconWidth:i}),core.composePositionLineHeight({compose:n,lineHeight:e,device:"tablet",position:t,iconWidth:i}),core.composePositionLineHeight({compose:n,lineHeight:e,device:"mobile",position:t,iconWidth:i}),n};exports.composePostionIconList=composePostionIconList,exports.getTextIconNotFound=getTextIconNotFound,exports.getTextIconTranslations=getTextIconTranslations,exports.getvalueMap=getvalueMap;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{
|
|
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};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{composePositionLineHeight as
|
|
1
|
+
import{composePositionLineHeight as t}from"@gem-sdk/core";import{getDynamicSourceLocales as e,getStaticLocale as o}from"../../helpers.js";let getTextIconNotFound=t=>"react"===t?"Icons not found":o("IconList","icons_not_found"),getTextIconTranslations=({setting:t,builderProps:o,pageContext:i,key:n,type:c})=>{let{childItem:s,translate:d}=t??{};return"react"===c?s?.[n]:e({val:s?.[n],uid:o?.uid,settingId:`childItem_${n}`,pageContext:i,translate:d,isReplaceLocationOrigin:!0})},getvalueMap=({setting:t})=>{let{childConfig:e,iconType:o,iconSvg:i}=t??{};return o&&"matching"!==o?"different"===o?e:void 0:Array(e?.length).fill(i)},composePostionIconList=(e,o,i)=>{let n={...i,desktop:i?.desktop??0,tablet:i?.tablet??i?.desktop??0,mobile:i?.mobile??i?.tablet??i?.desktop??0},c={};return t({compose:c,lineHeight:e,device:"desktop",position:o,iconWidth:n}),t({compose:c,lineHeight:e,device:"tablet",position:o,iconWidth:n}),t({compose:c,lineHeight:e,device:"mobile",position:o,iconWidth:n}),c};export{composePostionIconList,getTextIconNotFound,getTextIconTranslations,getvalueMap};
|