@gem-sdk/components 4.0.7 → 4.0.10

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";var jsxRuntime=require("react/jsx-runtime"),React=require("react"),helper=require("../../../../common/helper.js"),system=require("@gem-sdk/system"),Arrow=require("./Arrow.js"),CarouselPostPurchase=require("./CarouselPostPurchase.js"),useCarousel=require("../../../hooks/useCarousel.js"),classes=require("../../../common/classes.js"),styles=require("../../../common/styles.js");const CarouselWrapperPostPurchase=({styles:e,setting:s,productImages:r,objectFit:t="cover",aspectRatio:a,itemPerSlide:o=1,spacing:u,navigation:c="none",vertical:l=!1,border:i="none",idxActive:n})=>{let m={...e,...s},{layoutType:P}=m||{},{setMoveToIdx:h,setMaxIdx:p}=useCarousel.useCarousel(),j=helper.postPurchaseSpacing[u||"none"]??"0px",x="one-col"===P,y=system.createClass(classes.getImageListClass()),C=system.createStyle(styles.getImageListStyle({gap:j,vertical:l}));return React.useEffect(()=>{let e=r.length-Number(o||0);p(e)},[r.length,o,p]),React.useEffect(()=>{n&&1===o&&h(n)},[n,o,h]),jsxRuntime.jsxs("div",{className:y,style:C,children:[jsxRuntime.jsx(Arrow.ArrowPostPurchase,{type:"prev",navigation:c,vertical:l,hidden:x}),jsxRuntime.jsx(CarouselPostPurchase.CarouselPostPurchase,{productImages:r,itemPerRow:o,border:i,aspectRatio:a,objectFit:t,vertical:l}),jsxRuntime.jsx(Arrow.ArrowPostPurchase,{type:"next",navigation:c,vertical:l,hidden:x})]})};exports.CarouselWrapperPostPurchase=CarouselWrapperPostPurchase;
2
+ "use strict";var jsxRuntime=require("react/jsx-runtime"),React=require("react"),helper=require("../../../../common/helper.js"),system=require("@gem-sdk/system"),Arrow=require("./Arrow.js"),CarouselPostPurchase=require("./CarouselPostPurchase.js"),useCarousel=require("../../../hooks/useCarousel.js"),classes=require("../../../common/classes.js"),styles=require("../../../common/styles.js");const CarouselWrapperPostPurchase=({styles:e,setting:s,productImages:r,objectFit:t="cover",aspectRatio:a,itemPerSlide:o=1,spacing:u,navigation:c="none",vertical:l=!1,border:i="none",idxActive:n})=>{let m={...e,...s},{layoutType:P}=m||{},{setMoveToIdx:h,setMaxIdx:p}=useCarousel.useCarousel(),j=helper.postPurchaseSpacing[u||"none"]??"0px",x="one-col"===P,y=system.createClass(classes.getImageListClass()),C=system.createStyle(styles.getImageListStyle({gap:j,vertical:l}));return React.useEffect(()=>{let e=r.length-Number(o||0);p(e)},[r.length,o,p]),React.useEffect(()=>{(n||0===n)&&1===o&&h(n)},[n,o,h]),jsxRuntime.jsxs("div",{className:y,style:C,children:[jsxRuntime.jsx(Arrow.ArrowPostPurchase,{type:"prev",navigation:c,vertical:l,hidden:x}),jsxRuntime.jsx(CarouselPostPurchase.CarouselPostPurchase,{productImages:r,itemPerRow:o,border:i,aspectRatio:a,objectFit:t,vertical:l}),jsxRuntime.jsx(Arrow.ArrowPostPurchase,{type:"next",navigation:c,vertical:l,hidden:x})]})};exports.CarouselWrapperPostPurchase=CarouselWrapperPostPurchase;
@@ -1 +1 @@
1
- "use strict";var React=require("react"),helpers=require("../common/helpers.js"),core=require("@gem-sdk/core");const useGpDescription=e=>{let t=React.useRef(null),[r,c]=React.useState(!1),[s,u]=React.useState(!1),i=core.useProduct(),o=core.useCurrentDevice(),l=core.getResponsiveValueByScreen(e?.hasLineClamp,o),n=core.getResponsiveValueByScreen(e?.lineClamp,o),{redirectProductShopifyLink:a}=core.useProductShopifyEditLink(),p=core.useEditorMode(),h=React.useCallback(()=>{if(!t.current)return helpers.DESCRIPTION_LINE_HEIGHT_DEFAULT;let e=window.getComputedStyle(t.current).getPropertyValue("line-height");return Math.ceil(parseFloat(e))},[]),m=React.useCallback(e=>l&&n&&e?`${n*e}px`:"auto",[l,n]),d=()=>{if(!t.current)return;let e=h();r?t.current.style.maxHeight=m(e):t.current.style.maxHeight="none",c(e=>!e)};return React.useEffect(()=>{let e=h();m(e)},[e?.typo?.custom,m,h]),React.useEffect(()=>{let e=t.current;if(c(!1),!e)return;let r=l&&i?.descriptionHtml;r?setTimeout(()=>{let t=e?.scrollHeight??0,r=e?.clientHeight??0,c=h(),s=Math.round((t??0)/c);e.style.maxHeight=m(c);let i=n&&n<s||r<t;n&&i?u(()=>!0):u(()=>!1)},100):e.style.maxHeight="none"},[l,n,i?.description,i?.descriptionHtml,h,m,c,u]),{ref:t,open:r,isShowViewMore:s,handleToggleShowMore:d,mode:p,redirectProductShopifyLink:a}};exports.useGpDescription=useGpDescription;
1
+ "use strict";var React=require("react"),helpers=require("../common/helpers.js"),core=require("@gem-sdk/core");const useGpDescription=e=>{let t=React.useRef(null),[r,c]=React.useState(!1),[i,s]=React.useState(!1),u=core.useProduct(),o=core.useCurrentDevice(),n=core.getResponsiveValueByScreen(e?.hasLineClamp,o),l=core.getResponsiveValueByScreen(e?.lineClamp,o),{redirectProductShopifyLink:a}=core.useProductShopifyEditLink(),p=core.useEditorMode(),h=React.useCallback(()=>{if(!t.current)return helpers.DESCRIPTION_LINE_HEIGHT_DEFAULT;let e=window.getComputedStyle(t.current).getPropertyValue("line-height");return Math.ceil(parseFloat(e))},[]),d=React.useCallback(e=>n&&l&&e?`${l*e}px`:"auto",[n,l]),g=()=>{if(!t.current)return;let e=h();r?t.current.style.maxHeight=d(e):t.current.style.maxHeight="none",c(e=>!e)};return React.useEffect(()=>{let e=h();d(e)},[e?.typo?.custom,d,h]),React.useEffect(()=>{let e=t.current;if(c(!1),!e)return;let r=n&&u?.descriptionHtml;r?setTimeout(()=>{let t=e?.scrollHeight??0,r=e?.clientHeight??0,c=r<t,i=window.getComputedStyle(e).getPropertyValue("line-height"),u=parseInt(i,10)||1,o=Math.round((t??0)/u),n=void 0!==l&&l<o,a=core.isSafari()?n:c;e.style.maxHeight=d(u),l&&a?s(()=>!0):s(()=>!1)},100):e.style.maxHeight="none"},[n,l,u?.description,u?.descriptionHtml,h,d,c,s]),{ref:t,open:r,isShowViewMore:i,handleToggleShowMore:g,mode:p,redirectProductShopifyLink:a}};exports.useGpDescription=useGpDescription;
@@ -1,2 +1,2 @@
1
1
  'use client';
2
- import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useEffect as o}from"react";import{postPurchaseSpacing as t}from"../../../../common/helper.js";import{createClass as s,createStyle as m}from"@gem-sdk/system";import{ArrowPostPurchase as a}from"./Arrow.js";import{CarouselPostPurchase as i}from"./CarouselPostPurchase.js";import{useCarousel as n}from"../../../hooks/useCarousel.js";import{getImageListClass as p}from"../../../common/classes.js";import{getImageListStyle as c}from"../../../common/styles.js";let CarouselWrapperPostPurchase=({styles:l,setting:u,productImages:h,objectFit:d="cover",aspectRatio:f,itemPerSlide:j=1,spacing:v,navigation:g="none",vertical:P=!1,border:y="none",idxActive:x})=>{let C={...l,...u},{layoutType:b}=C||{},{setMoveToIdx:k,setMaxIdx:w}=n(),N=t[v||"none"]??"0px",R="one-col"===b,W=s(p()),A=m(c({gap:N,vertical:P}));return o(()=>{let e=h.length-Number(j||0);w(e)},[h.length,j,w]),o(()=>{x&&1===j&&k(x)},[x,j,k]),e("div",{className:W,style:A,children:[r(a,{type:"prev",navigation:g,vertical:P,hidden:R}),r(i,{productImages:h,itemPerRow:j,border:y,aspectRatio:f,objectFit:d,vertical:P}),r(a,{type:"next",navigation:g,vertical:P,hidden:R})]})};export{CarouselWrapperPostPurchase};
2
+ import{jsxs as e,jsx as r}from"react/jsx-runtime";import{useEffect as o}from"react";import{postPurchaseSpacing as t}from"../../../../common/helper.js";import{createClass as s,createStyle as m}from"@gem-sdk/system";import{ArrowPostPurchase as a}from"./Arrow.js";import{CarouselPostPurchase as i}from"./CarouselPostPurchase.js";import{useCarousel as n}from"../../../hooks/useCarousel.js";import{getImageListClass as p}from"../../../common/classes.js";import{getImageListStyle as c}from"../../../common/styles.js";let CarouselWrapperPostPurchase=({styles:l,setting:u,productImages:h,objectFit:d="cover",aspectRatio:f,itemPerSlide:j=1,spacing:v,navigation:g="none",vertical:P=!1,border:y="none",idxActive:x})=>{let C={...l,...u},{layoutType:b}=C||{},{setMoveToIdx:k,setMaxIdx:w}=n(),N=t[v||"none"]??"0px",R="one-col"===b,W=s(p()),A=m(c({gap:N,vertical:P}));return o(()=>{let e=h.length-Number(j||0);w(e)},[h.length,j,w]),o(()=>{(x||0===x)&&1===j&&k(x)},[x,j,k]),e("div",{className:W,style:A,children:[r(a,{type:"prev",navigation:g,vertical:P,hidden:R}),r(i,{productImages:h,itemPerRow:j,border:y,aspectRatio:f,objectFit:d,vertical:P}),r(a,{type:"next",navigation:g,vertical:P,hidden:R})]})};export{CarouselWrapperPostPurchase};
@@ -1 +1 @@
1
- import{useRef as e,useState as t,useCallback as r,useEffect as i}from"react";import{DESCRIPTION_LINE_HEIGHT_DEFAULT as l}from"../common/helpers.js";import{useProduct as n,useCurrentDevice as o,getResponsiveValueByScreen as m,useProductShopifyEditLink as u,useEditorMode as p}from"@gem-sdk/core";let useGpDescription=s=>{let c=e(null),[a,h]=t(!1),[g,H]=t(!1),d=n(),y=o(),f=m(s?.hasLineClamp,y),x=m(s?.lineClamp,y),{redirectProductShopifyLink:C}=u(),w=p(),D=r(()=>{if(!c.current)return l;let e=window.getComputedStyle(c.current).getPropertyValue("line-height");return Math.ceil(parseFloat(e))},[]),G=r(e=>f&&x&&e?`${x*e}px`:"auto",[f,x]),M=()=>{if(!c.current)return;let e=D();a?c.current.style.maxHeight=G(e):c.current.style.maxHeight="none",h(e=>!e)};return i(()=>{let e=D();G(e)},[s?.typo?.custom,G,D]),i(()=>{let e=c.current;if(h(!1),!e)return;let t=f&&d?.descriptionHtml;t?setTimeout(()=>{let t=e?.scrollHeight??0,r=e?.clientHeight??0,i=D(),l=Math.round((t??0)/i);e.style.maxHeight=G(i);let n=x&&x<l||r<t;x&&n?H(()=>!0):H(()=>!1)},100):e.style.maxHeight="none"},[f,x,d?.description,d?.descriptionHtml,D,G,h,H]),{ref:c,open:a,isShowViewMore:g,handleToggleShowMore:M,mode:w,redirectProductShopifyLink:C}};export{useGpDescription};
1
+ import{useRef as e,useState as t,useCallback as r,useEffect as i}from"react";import{DESCRIPTION_LINE_HEIGHT_DEFAULT as l}from"../common/helpers.js";import{useProduct as n,useCurrentDevice as o,getResponsiveValueByScreen as p,useProductShopifyEditLink as u,useEditorMode as m,isSafari as s}from"@gem-sdk/core";let useGpDescription=c=>{let a=e(null),[h,g]=t(!1),[d,y]=t(!1),H=n(),f=o(),x=p(c?.hasLineClamp,f),w=p(c?.lineClamp,f),{redirectProductShopifyLink:C}=u(),D=m(),G=r(()=>{if(!a.current)return l;let e=window.getComputedStyle(a.current).getPropertyValue("line-height");return Math.ceil(parseFloat(e))},[]),M=r(e=>x&&w&&e?`${w*e}px`:"auto",[x,w]),P=()=>{if(!a.current)return;let e=G();h?a.current.style.maxHeight=M(e):a.current.style.maxHeight="none",g(e=>!e)};return i(()=>{let e=G();M(e)},[c?.typo?.custom,M,G]),i(()=>{let e=a.current;if(g(!1),!e)return;let t=x&&H?.descriptionHtml;t?setTimeout(()=>{let t=e?.scrollHeight??0,r=e?.clientHeight??0,i=r<t,l=window.getComputedStyle(e).getPropertyValue("line-height"),n=parseInt(l,10)||1,o=Math.round((t??0)/n),p=void 0!==w&&w<o,u=s()?p:i;e.style.maxHeight=M(n),w&&u?y(()=>!0):y(()=>!1)},100):e.style.maxHeight="none"},[x,w,H?.description,H?.descriptionHtml,G,M,g,y]),{ref:a,open:h,isShowViewMore:d,handleToggleShowMore:P,mode:D,redirectProductShopifyLink:C}};export{useGpDescription};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "4.0.7",
3
+ "version": "4.0.10",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",
@@ -25,7 +25,7 @@
25
25
  "scan-all-text": "rollup -c ./scripts/rollup.config.settings.mjs && node ./scripts/scan-all-text && node ./scripts/scan-all-text"
26
26
  },
27
27
  "devDependencies": {
28
- "@gem-sdk/core": "3.1.17",
28
+ "@gem-sdk/core": "4.0.10",
29
29
  "@gem-sdk/styles": "3.1.0",
30
30
  "@gem-sdk/system": "3.1.0",
31
31
  "tsup": "^8.5.0",