@dropins/storefront-pdp 1.0.0-beta2 → 1.0.0-beta3

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,3 +1,3 @@
1
1
  /*! Copyright 2024 Adobe
2
2
  All Rights Reserved. */
3
- import{jsx as A,jsxs as M}from"@dropins/tools/preact-jsx-runtime.js";import{useState as D,useEffect as N,useMemo as O}from"@dropins/tools/preact-compat.js";import{Image as S}from"@dropins/tools/components.js";import{events as Q}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{g as F}from"../chunks/getFetchedProductData.js";import{Z as q,C,O as z}from"../chunks/Zoom.js";/* empty css */import{useText as J}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";const K=({initialData:E=null,controls:R="dots",loop:g=!0,peak:Z=!1,gap:j=null,arrows:v=!0,zoom:h=!1,imageParams:t,thumbnailParams:o,children:U,...G})=>{var w,u,B,y,I,_;const c=J("PDP.Product.Image.label").label,[e,T]=D(E),[d,f]=D(null);N(()=>{const l=Q.on("pdp/data",T);return()=>{l==null||l.off()}},[]);const s=O(()=>{var l;return((l=e==null?void 0:e.images)==null?void 0:l.map(({label:p,url:r},i)=>{const n=({...H})=>{var x;return A(S,{title:p,src:r,alt:c==null?void 0:c.replace("{product}",p).replace("{key}",String(i+1)).replace("{total}",String((x=e==null?void 0:e.images)==null?void 0:x.length)),width:(t==null?void 0:t.width)??960,height:(t==null?void 0:t.height)??1191,params:t??{width:960},loading:i===0?"eager":"lazy",...H})};return h?A(q,{closeButton:typeof h=="object"?h.closeButton:!1,children:A(n,{})},r):A(n,{onClick:()=>f(i)},r)}))??A("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product-gallery__images__placeholder",width:(t==null?void 0:t.width)??960,height:(t==null?void 0:t.height)??1191,"aria-hidden":!0},"pleaceholder")},[c,e==null?void 0:e.images,t,h]),k=O(()=>{var l;return((l=e==null?void 0:e.images)==null?void 0:l.map(({label:p,url:r},i)=>{var n;return A(S,{title:p,src:r,alt:c==null?void 0:c.replace("{product}",p).replace("{key}",String(i+1)).replace("{total}",String((n=e==null?void 0:e.images)==null?void 0:n.length)),width:(o==null?void 0:o.width)??200,height:(o==null?void 0:o.height)??248,params:o??{width:200},loading:"lazy"},r)}))??A("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product-gallery__thumbnail__placeholder",width:(o==null?void 0:o.width)??200,height:(o==null?void 0:o.height)??248,"aria-hidden":!0},"pleaceholder")},[c,e==null?void 0:e.images,o]);return e?M("div",{...G,children:[A(C,{arrows:!!((w=e==null?void 0:e.images)!=null&&w.length),arrowsOnMainImage:v,controls:(u=e==null?void 0:e.images)!=null&&u.length?R:void 0,loop:g&&!!((B=e.images)!=null&&B.length),peak:!!((y=e==null?void 0:e.images)!=null&&y.length)&&Z,gap:j,defaultIndex:d||0,thumbnails:k,children:s}),d===null?null:A(z,{onClose:()=>f(null),centered:!0,children:A(C,{arrows:!!((I=e==null?void 0:e.images)!=null&&I.length),width:"100%",height:"100%",defaultIndex:d,loop:g&&!!((_=e.images)!=null&&_.length),controls:"dots",isZoomed:!0,children:s})})]}):null};K.getInitialData=F;export{K as ProductGallery,K as default};
3
+ import{jsx as A,jsxs as N}from"@dropins/tools/preact-jsx-runtime.js";import{useState as S,useEffect as Q,useMemo as C}from"@dropins/tools/preact-compat.js";import{Image as E}from"@dropins/tools/components.js";import{events as F}from"@dropins/tools/event-bus.js";import"@dropins/tools/lib.js";import{g as q}from"../chunks/getFetchedProductData.js";import{Z as z,C as R,O as J}from"../chunks/Zoom.js";/* empty css */import{useText as K}from"@dropins/tools/i18n.js";import"@dropins/tools/preact.js";const U=({initialData:Z=null,controls:j="dots",loop:g=!0,peak:v=!1,gap:G=null,arrows:f=!0,zoom:h=!1,imageParams:t,thumbnailParams:o,children:V,...T})=>{var w,B,y,I,_,x,D;const c=K("PDP.Product.Image.label").label,[e,k]=S(Z),[d,s]=S(null);Q(()=>{const l=F.on("pdp/data",k);return()=>{l==null||l.off()}},[]);const u=C(()=>{var l;return((l=e==null?void 0:e.images)==null?void 0:l.map(({label:i,url:p},n)=>{const r=({...M})=>{var O;return A(E,{title:i,src:p,alt:c==null?void 0:c.replace("{product}",i).replace("{key}",String(n+1)).replace("{total}",String((O=e==null?void 0:e.images)==null?void 0:O.length)),width:(t==null?void 0:t.width)??960,height:(t==null?void 0:t.height)??1191,params:t??{width:960},loading:n===0?"eager":"lazy",...M})};return h?A(z,{closeButton:typeof h=="object"?h.closeButton:!1,children:A(r,{})},p):A(r,{onClick:()=>s(n)},p)}))??A("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product-gallery__images__placeholder",width:(t==null?void 0:t.width)??960,height:(t==null?void 0:t.height)??1191,"aria-hidden":!0},"pleaceholder")},[c,e==null?void 0:e.images,t,h]),H=C(()=>{var l;return((l=e==null?void 0:e.images)==null?void 0:l.map(({label:i,url:p},n)=>{var r;return A(E,{title:i,src:p,alt:c==null?void 0:c.replace("{product}",i).replace("{key}",String(n+1)).replace("{total}",String((r=e==null?void 0:e.images)==null?void 0:r.length)),width:(o==null?void 0:o.width)??200,height:(o==null?void 0:o.height)??248,params:o??{width:200},loading:"lazy"},p)}))??A("img",{src:"data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7",className:"pdp-product-gallery__thumbnail__placeholder",width:(o==null?void 0:o.width)??200,height:(o==null?void 0:o.height)??248,"aria-hidden":!0},"pleaceholder")},[c,e==null?void 0:e.images,o]);return e?N("div",{...T,children:[A(R,{arrows:!!((w=e==null?void 0:e.images)!=null&&w.length)&&f,arrowsOnMainImage:!!((B=e==null?void 0:e.images)!=null&&B.length)&&f,controls:(y=e==null?void 0:e.images)!=null&&y.length?j:void 0,loop:g&&!!((I=e.images)!=null&&I.length),peak:!!((_=e==null?void 0:e.images)!=null&&_.length)&&v,gap:G,defaultIndex:d||0,thumbnails:H,children:u}),d===null?null:A(J,{onClose:()=>s(null),centered:!0,children:A(R,{arrows:!!((x=e==null?void 0:e.images)!=null&&x.length),width:"100%",height:"100%",defaultIndex:d,loop:g&&!!((D=e.images)!=null&&D.length),controls:"dots",isZoomed:!0,children:u})})]}):null};U.getInitialData=q;export{U as ProductGallery,U as default};
package/package.json CHANGED
@@ -1 +1 @@
1
- {"name": "@dropins/storefront-pdp", "version": "1.0.0-beta2", "@dropins/tools": "~0.35.0"}
1
+ {"name": "@dropins/storefront-pdp", "version": "1.0.0-beta3", "@dropins/tools": "~0.36.0"}