@gem-sdk/components 17.0.0-dev.27 → 17.0.0-dev.29

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 e=require("react"),t=require("@gem-sdk/core");exports.useGpDescription=r=>{let s=e.useRef(null),[u,i]=e.useState(!1),[l,n]=e.useState(!1),a=t.useProduct(),c=t.useCurrentDevice(),o=t.getResponsiveValueByScreen(r?.hasLineClamp,c),p=t.getResponsiveValueByScreen(r?.lineClamp,c),{redirectProductShopifyLink:d}=t.useProductShopifyEditLink(),g=t.useEditorMode(),h=e.useCallback(()=>`calc(${p} * 1lh)`,[p]),m=e.useCallback(e=>o&&p&&e||"auto",[o,p]),y=e.useCallback(()=>{s.current&&(s.current.style.maxHeight=u?h():"none",i(e=>!e))},[u,h]);return e.useEffect(()=>{m(h())},[r?.typo?.custom,m,h]),e.useEffect(()=>{let e=s.current;if(i(!1),!e)return;let r=o&&a?.descriptionHtml;r?setTimeout(()=>{let r=e?.scrollHeight??0,s=e?.clientHeight??0,u=window.getComputedStyle(e).getPropertyValue("line-height"),i=parseInt(u,10)||1,l=void 0!==p&&p<Math.round((r??0)/i),a=t.isSafari()?l:s<r;e.style.maxHeight=h(),p&&a?n(()=>!0):n(()=>!1)},100):e.style.maxHeight="none"},[o,p,a?.descriptionHtml,h]),{ref:s,open:u,isShowViewMore:l,handleToggleShowMore:y,mode:g,redirectProductShopifyLink:d}};
1
+ "use strict";var e=require("react"),t=require("@gem-sdk/core");exports.useGpDescription=r=>{let s=e.useRef(null),[u,i]=e.useState(!1),[l,n]=e.useState(!1),a=t.useProduct(),c=t.useCurrentDevice(),o=t.getResponsiveValueByScreen(r?.hasLineClamp,c),p=t.getResponsiveValueByScreen(r?.lineClamp,c),{redirectProductShopifyLink:g}=t.useProductShopifyEditLink(),m=t.useEditorMode(),d=e.useCallback(()=>`calc(${p} * 1lh)`,[p]),h=e.useCallback(e=>o&&p&&e||"auto",[o,p]),y=e.useCallback(()=>{s.current&&(s.current.style.maxHeight=u?d():"none",i(e=>!e))},[u,d]);return e.useEffect(()=>{h(d())},[r?.typo?.custom,h,d]),e.useEffect(()=>{let e=s.current;if(i(!1),!e)return;let r=o&&a?.descriptionHtml;r?setTimeout(()=>{let r=e?.scrollHeight??0,s=e?.clientHeight??0,u=window.getComputedStyle(e).getPropertyValue("line-height"),i=parseInt(u,10)||1,l=p&&r>p*i,a=t.isSafari()?l:s<r;e.style.maxHeight=d(),p&&a?n(()=>!0):n(()=>!1)},100):e.style.maxHeight="none"},[o,p,a?.descriptionHtml,d]),{ref:s,open:u,isShowViewMore:l,handleToggleShowMore:y,mode:m,redirectProductShopifyLink:g}};
@@ -1 +1 @@
1
- import{useRef as e,useState as t,useCallback as r,useEffect as l}from"react";import{useProduct as i,useCurrentDevice as o,getResponsiveValueByScreen as n,useProductShopifyEditLink as m,useEditorMode as c,isSafari as p}from"@gem-sdk/core";let s=s=>{let u=e(null),[a,h]=t(!1),[g,d]=t(!1),H=i(),y=o(),x=n(s?.hasLineClamp,y),f=n(s?.lineClamp,y),{redirectProductShopifyLink:C}=m(),w=c(),k=r(()=>`calc(${f} * 1lh)`,[f]),v=r(e=>x&&f&&e||"auto",[x,f]),D=r(()=>{u.current&&(u.current.style.maxHeight=a?k():"none",h(e=>!e))},[a,k]);return l(()=>{v(k())},[s?.typo?.custom,v,k]),l(()=>{let e=u.current;if(h(!1),!e)return;let t=x&&H?.descriptionHtml;t?setTimeout(()=>{let t=e?.scrollHeight??0,r=e?.clientHeight??0,l=window.getComputedStyle(e).getPropertyValue("line-height"),i=parseInt(l,10)||1,o=void 0!==f&&f<Math.round((t??0)/i),n=p()?o:r<t;e.style.maxHeight=k(),f&&n?d(()=>!0):d(()=>!1)},100):e.style.maxHeight="none"},[x,f,H?.descriptionHtml,k]),{ref:u,open:a,isShowViewMore:g,handleToggleShowMore:D,mode:w,redirectProductShopifyLink:C}};export{s as useGpDescription};
1
+ import{useRef as e,useState as t,useCallback as r,useEffect as l}from"react";import{useProduct as i,useCurrentDevice as n,getResponsiveValueByScreen as o,useProductShopifyEditLink as m,useEditorMode as c,isSafari as p}from"@gem-sdk/core";let s=s=>{let u=e(null),[a,g]=t(!1),[h,H]=t(!1),y=i(),d=n(),x=o(s?.hasLineClamp,d),f=o(s?.lineClamp,d),{redirectProductShopifyLink:C}=m(),w=c(),k=r(()=>`calc(${f} * 1lh)`,[f]),D=r(e=>x&&f&&e||"auto",[x,f]),G=r(()=>{u.current&&(u.current.style.maxHeight=a?k():"none",g(e=>!e))},[a,k]);return l(()=>{D(k())},[s?.typo?.custom,D,k]),l(()=>{let e=u.current;if(g(!1),!e)return;let t=x&&y?.descriptionHtml;t?setTimeout(()=>{let t=e?.scrollHeight??0,r=e?.clientHeight??0,l=window.getComputedStyle(e).getPropertyValue("line-height"),i=parseInt(l,10)||1,n=f&&t>f*i,o=p()?n:r<t;e.style.maxHeight=k(),f&&o?H(()=>!0):H(()=>!1)},100):e.style.maxHeight="none"},[x,f,y?.descriptionHtml,k]),{ref:u,open:a,isShowViewMore:h,handleToggleShowMore:G,mode:w,redirectProductShopifyLink:C}};export{s as useGpDescription};
@@ -149,6 +149,7 @@ type TextProps = BasePropsWrap<TextSettingProps, TextStyleProps> & Omit<React.Co
149
149
  };
150
150
 
151
151
  type ObjectFit$2 = 'contain' | 'cover' | 'fill' | 'none' | 'scale-down';
152
+ type IImageStorageType = 'THEME' | 'FILE_CONTENT' | 'SHOPIFY_CDN';
152
153
  type BaseImageData = {
153
154
  alt?: string;
154
155
  src?: string;
@@ -157,7 +158,7 @@ type BaseImageData = {
157
158
  base64?: string;
158
159
  backupFileKey?: string;
159
160
  backupFilePath?: string;
160
- storage?: 'THEME' | 'FILE_CONTENT';
161
+ storage?: IImageStorageType;
161
162
  metafieldDefinitionKey?: string;
162
163
  };
163
164
  type SharedProps = {
@@ -2135,7 +2136,7 @@ type ImageComparisonItem = {
2135
2136
  height?: number;
2136
2137
  backupFileKey?: string;
2137
2138
  backupFilePath?: string;
2138
- storage?: 'THEME' | 'FILE_CONTENT';
2139
+ storage?: IImageStorageType;
2139
2140
  metafieldDefinitionKey?: string;
2140
2141
  };
2141
2142
  type ImageTab = 'left' | 'right';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "17.0.0-dev.27",
3
+ "version": "17.0.0-dev.29",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",