@gem-sdk/components 17.0.0-dev.46 → 17.0.0-dev.47

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/jsx-runtime"),r=require("react"),t=require("./common/styles.js");require("@gem-sdk/swiper/element/bundle").register(),exports.Swiper=function(s){let i=r.useRef(null),{children:n,totalSlides:u,onSwiperReset:c,onSwiperReady:p,sliderClass:l,sliderOrder:w,thumbsSwiper:a,...f}=s,o=JSON.stringify(f),d=r.useMemo(()=>a?{"thumbs-swiper":a}:{},[a]),m=t.getStyleSwiperContainer(),y=r.useCallback(()=>{i.current?.swiper&&i.current.swiper.wrapperEl.style.setProperty("width",`${i.current.swiper.width}px`)},[]);return r.useEffect(()=>{let e=i.current;if(e)return Object.assign(e,f),e.initialize?.(),p?.(e.swiper),y(),e.swiper.on("resize",y),()=>{e.swiper.off("resize",y),c()}},[]),r.useEffect(()=>{let e=i.current,r=e?.swiper;e&&r&&!r.destroyed&&(Object.assign(e,f),r.update(),y())},[o]),r.useEffect(()=>{c()},[w,c]),e.jsx("swiper-container",{init:!1,ref:i,class:l,style:{...m},...d,children:n})};
1
+ "use strict";var e=require("react/jsx-runtime"),r=require("react"),t=require("./common/styles.js"),s=require("@gem-sdk/swiper/element/bundle"),i=require("@gem-sdk/core");s.register(),exports.Swiper=function(s){let n=r.useRef(null),{children:u,totalSlides:c,onSwiperReset:l,onSwiperReady:p,sliderClass:w,sliderOrder:o,thumbsSwiper:a,...f}=s,{isEditMode:d}=i.useRenderMode(),g=JSON.stringify(f),m=r.useMemo(()=>a?{"thumbs-swiper":a}:{},[a]),b=t.getStyleSwiperContainer(),h=r.useCallback(({width:e}={})=>{n.current?.swiper&&n.current.swiper.wrapperEl.style.setProperty("width",`${e??n.current.swiper.width}px`)},[]);return r.useEffect(()=>{let e=n.current;if(e){if(Object.assign(e,f),e.initialize?.(),p?.(e.swiper),h(),d){let r=new ResizeObserver(r=>{r.forEach(r=>{r.target===e&&h({width:r.contentRect.width})})});return r.observe(e),()=>{r.disconnect()}}return e.swiper.on("resize",h),()=>{e.swiper.off("resize",h),l()}}},[]),r.useEffect(()=>{let e=n.current,r=e?.swiper;e&&r&&!r.destroyed&&(Object.assign(e,f),r.update(),h())},[g]),r.useEffect(()=>{l()},[o,l]),e.jsx("swiper-container",{init:!1,ref:n,class:w,style:{...b},...m,children:u})};
@@ -1 +1 @@
1
- "use strict";var e=require("react"),t=require("@gem-sdk/core");exports.useGpDescription=r=>{let u=e.useRef(null),s=e.useRef(!1),[n,i]=e.useState(!1),[l,c]=e.useState(!1),[o,a]=e.useState(!1),m=t.useProduct(),d=t.useCurrentDevice(),f=t.getResponsiveValueByScreen(r?.hasLineClamp,d),p=t.getResponsiveValueByScreen(r?.lineClamp,d),{redirectProductShopifyLink:g}=t.useProductShopifyEditLink(),h=t.useEditorMode(),y=e.useCallback(()=>`calc(${p} * 1lh)`,[p]),H=e.useCallback(e=>f&&p&&e||"auto",[f,p]),v=e.useCallback(()=>{if(!u.current)return;let e=!n;s.current=e,u.current.style.maxHeight=e?"none":y(),i(e)},[n,y]);return e.useEffect(()=>{H(y())},[r?.typo?.custom,H,y]),e.useEffect(()=>{let e=u.current;if(s.current=!1,i(!1),a(!1),!e)return;if(!f||!m?.descriptionHtml||!p){e.style.maxHeight="none",c(!1),a(!0);return}let t=()=>{if(s.current){e.style.maxHeight="none";return}e.style.maxHeight=y();let t=e.scrollHeight>e.clientHeight;t||(e.style.maxHeight="none"),c(t),a(!0)},r=window.setTimeout(t,100),n=new ResizeObserver(()=>{t()});return n.observe(e),()=>{window.clearTimeout(r),n.disconnect()}},[f,p,m?.descriptionHtml,y]),{ref:u,open:n,isShowViewMore:l,isOverflowChecked:o,handleToggleShowMore:v,mode:h,redirectProductShopifyLink:g}};
1
+ "use strict";var e=require("react"),t=require("@gem-sdk/core");exports.useGpDescription=r=>{let u=e.useRef(null),s=e.useRef(!1),[n,i]=e.useState(!1),[l,c]=e.useState(!1),[o,a]=e.useState(!1),m=t.useProduct(),d=t.useCurrentDevice(),f=t.getResponsiveValueByScreen(r?.hasLineClamp,d),p=t.getResponsiveValueByScreen(r?.lineClamp,d),{redirectProductShopifyLink:g}=t.useProductShopifyEditLink(),h=t.useEditorMode(),y=e.useCallback(()=>`calc(${p} * 1lh)`,[p]),H=e.useCallback(e=>f&&p&&e||"auto",[f,p]),v=e.useCallback(()=>{if(!u.current)return;let e=!n;s.current=e,u.current.style.maxHeight=e?"none":y(),i(e)},[n,y]);return e.useEffect(()=>{H(y())},[r?.typo?.custom,H,y]),e.useEffect(()=>{let e=u.current;if(s.current=!1,i(!1),a(!1),!e)return;if(!f||!m?.descriptionHtml||!p){e.style.maxHeight="none",c(!1),a(!0);return}let t=()=>{if(s.current){e.style.maxHeight="none";return}e.style.maxHeight=y();let t=e.scrollHeight-e.clientHeight>1;t||(e.style.maxHeight="none"),c(t),a(!0)},r=window.setTimeout(t,100),n=new ResizeObserver(()=>{t()});return n.observe(e),()=>{window.clearTimeout(r),n.disconnect()}},[f,p,m?.descriptionHtml,y]),{ref:u,open:n,isShowViewMore:l,isOverflowChecked:o,handleToggleShowMore:v,mode:h,redirectProductShopifyLink:g}};
@@ -1 +1 @@
1
- import{jsx as e}from"react/jsx-runtime";import{useRef as r,useMemo as t,useCallback as i,useEffect as s}from"react";import{getStyleSwiperContainer as n}from"./common/styles.js";import{register as p}from"@gem-sdk/swiper/element/bundle";function o(p){let o=r(null),{children:c,totalSlides:l,onSwiperReset:m,onSwiperReady:w,sliderClass:u,sliderOrder:f,thumbsSwiper:a,...d}=p,y=JSON.stringify(d),b=t(()=>a?{"thumbs-swiper":a}:{},[a]),g=n(),h=i(()=>{o.current?.swiper&&o.current.swiper.wrapperEl.style.setProperty("width",`${o.current.swiper.width}px`)},[]);return s(()=>{let e=o.current;if(e)return Object.assign(e,d),e.initialize?.(),w?.(e.swiper),h(),e.swiper.on("resize",h),()=>{e.swiper.off("resize",h),m()}},[]),s(()=>{let e=o.current,r=e?.swiper;e&&r&&!r.destroyed&&(Object.assign(e,d),r.update(),h())},[y]),s(()=>{m()},[f,m]),e("swiper-container",{init:!1,ref:o,class:u,style:{...g},...b,children:c})}p();export{o as Swiper};
1
+ import{jsx as e}from"react/jsx-runtime";import{useRef as r,useMemo as t,useCallback as i,useEffect as s}from"react";import{getStyleSwiperContainer as n}from"./common/styles.js";import{register as o}from"@gem-sdk/swiper/element/bundle";import{useRenderMode as p}from"@gem-sdk/core";function c(o){let c=r(null),{children:m,totalSlides:w,onSwiperReset:l,onSwiperReady:u,sliderClass:f,sliderOrder:d,thumbsSwiper:a,...h}=o,{isEditMode:b}=p(),g=JSON.stringify(h),y=t(()=>a?{"thumbs-swiper":a}:{},[a]),j=n(),z=i(({width:e}={})=>{c.current?.swiper&&c.current.swiper.wrapperEl.style.setProperty("width",`${e??c.current.swiper.width}px`)},[]);return s(()=>{let e=c.current;if(e){if(Object.assign(e,h),e.initialize?.(),u?.(e.swiper),z(),b){let r=new ResizeObserver(r=>{r.forEach(r=>{r.target===e&&z({width:r.contentRect.width})})});return r.observe(e),()=>{r.disconnect()}}return e.swiper.on("resize",z),()=>{e.swiper.off("resize",z),l()}}},[]),s(()=>{let e=c.current,r=e?.swiper;e&&r&&!r.destroyed&&(Object.assign(e,h),r.update(),z())},[g]),s(()=>{l()},[d,l]),e("swiper-container",{init:!1,ref:c,class:f,style:{...j},...y,children:m})}o();export{c as Swiper};
@@ -1 +1 @@
1
- import{useRef as e,useState as t,useCallback as r,useEffect as n}from"react";import{useProduct as i,useCurrentDevice as l,getResponsiveValueByScreen as o,useProductShopifyEditLink as c,useEditorMode as s}from"@gem-sdk/core";let u=u=>{let m=e(null),a=e(!1),[p,h]=t(!1),[H,g]=t(!1),[d,f]=t(!1),x=i(),y=l(),w=o(u?.hasLineClamp,y),b=o(u?.lineClamp,y),{redirectProductShopifyLink:v}=c(),C=s(),T=r(()=>`calc(${b} * 1lh)`,[b]),k=r(e=>w&&b&&e||"auto",[w,b]),z=r(()=>{if(!m.current)return;let e=!p;a.current=e,m.current.style.maxHeight=e?"none":T(),h(e)},[p,T]);return n(()=>{k(T())},[u?.typo?.custom,k,T]),n(()=>{let e=m.current;if(a.current=!1,h(!1),f(!1),!e)return;if(!w||!x?.descriptionHtml||!b){e.style.maxHeight="none",g(!1),f(!0);return}let t=()=>{if(a.current){e.style.maxHeight="none";return}e.style.maxHeight=T();let t=e.scrollHeight>e.clientHeight;t||(e.style.maxHeight="none"),g(t),f(!0)},r=window.setTimeout(t,100),n=new ResizeObserver(()=>{t()});return n.observe(e),()=>{window.clearTimeout(r),n.disconnect()}},[w,b,x?.descriptionHtml,T]),{ref:m,open:p,isShowViewMore:H,isOverflowChecked:d,handleToggleShowMore:z,mode:C,redirectProductShopifyLink:v}};export{u as useGpDescription};
1
+ import{useRef as e,useState as t,useCallback as r,useEffect as n}from"react";import{useProduct as i,useCurrentDevice as l,getResponsiveValueByScreen as o,useProductShopifyEditLink as c,useEditorMode as s}from"@gem-sdk/core";let u=u=>{let m=e(null),a=e(!1),[p,h]=t(!1),[H,g]=t(!1),[d,f]=t(!1),x=i(),y=l(),w=o(u?.hasLineClamp,y),b=o(u?.lineClamp,y),{redirectProductShopifyLink:v}=c(),C=s(),T=r(()=>`calc(${b} * 1lh)`,[b]),k=r(e=>w&&b&&e||"auto",[w,b]),z=r(()=>{if(!m.current)return;let e=!p;a.current=e,m.current.style.maxHeight=e?"none":T(),h(e)},[p,T]);return n(()=>{k(T())},[u?.typo?.custom,k,T]),n(()=>{let e=m.current;if(a.current=!1,h(!1),f(!1),!e)return;if(!w||!x?.descriptionHtml||!b){e.style.maxHeight="none",g(!1),f(!0);return}let t=()=>{if(a.current){e.style.maxHeight="none";return}e.style.maxHeight=T();let t=e.scrollHeight-e.clientHeight>1;t||(e.style.maxHeight="none"),g(t),f(!0)},r=window.setTimeout(t,100),n=new ResizeObserver(()=>{t()});return n.observe(e),()=>{window.clearTimeout(r),n.disconnect()}},[w,b,x?.descriptionHtml,T]),{ref:m,open:p,isShowViewMore:H,isOverflowChecked:d,handleToggleShowMore:z,mode:C,redirectProductShopifyLink:v}};export{u as useGpDescription};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gem-sdk/components",
3
- "version": "17.0.0-dev.46",
3
+ "version": "17.0.0-dev.47",
4
4
  "license": "MIT",
5
5
  "sideEffects": false,
6
6
  "main": "dist/cjs/index.js",