@dropins/storefront-pdp 1.0.1-beta1 → 1.0.1

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.
@@ -8,6 +8,7 @@ export interface ProductGalleryProps extends Omit<HTMLAttributes<HTMLDivElement>
8
8
  peak?: boolean;
9
9
  gap?: 'small' | 'medium' | 'large' | null;
10
10
  arrows?: boolean;
11
+ arrowsOnMainImage?: boolean;
11
12
  imageParams?: ResolveImageUrlOptions;
12
13
  thumbnailParams?: ResolveImageUrlOptions;
13
14
  zoom?: {
@@ -1,3 +1,3 @@
1
1
  /*! Copyright 2025 Adobe
2
2
  All Rights Reserved. */
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};
3
+ import{jsx as A,jsxs as Q}from"@dropins/tools/preact-jsx-runtime.js";import{useState as D,useEffect as F,useMemo as S}from"@dropins/tools/preact-compat.js";import{Image as C}from"@dropins/tools/components.js";import{events as M}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 E,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:O=null,controls:R="dots",loop:g=!0,peak:Z=!1,gap:j=null,arrows:v=!0,arrowsOnMainImage:G=!1,zoom:h=!1,imageParams:t,thumbnailParams:o,children:V,...T})=>{var u,w,B,y,_,I;const c=K("PDP.Product.Image.label").label,[e,k]=D(O),[d,f]=D(null);F(()=>{const l=M.on("pdp/data",k);return()=>{l==null||l.off()}},[]);const s=S(()=>{var l;return((l=e==null?void 0:e.images)==null?void 0:l.map(({label:r,url:p},i)=>{const n=({...N})=>{var x;return A(C,{title:r,src:p,alt:c==null?void 0:c.replace("{product}",r).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",...N})};return h?A(z,{closeButton:typeof h=="object"?h.closeButton:!1,children:A(n,{})},p):A(n,{onClick:()=>f(i)},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=S(()=>{var l;return((l=e==null?void 0:e.images)==null?void 0:l.map(({label:r,url:p},i)=>{var n;return A(C,{title:r,src:p,alt:c==null?void 0:c.replace("{product}",r).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"},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?Q("div",{...T,children:[A(E,{arrows:!!((u=e==null?void 0:e.images)!=null&&u.length)&&v,arrowsOnMainImage:G,controls:(w=e==null?void 0:e.images)!=null&&w.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:H,children:s}),d===null?null:A(J,{onClose:()=>f(null),centered:!0,children:A(E,{arrows:!!((_=e==null?void 0:e.images)!=null&&_.length),width:"100%",height:"100%",defaultIndex:d,loop:g&&!!((I=e.images)!=null&&I.length),controls:"dots",isZoomed:!0,children:s})})]}):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.1-beta1", "@dropins/tools": "~0.36.0", "license": "SEE LICENSE IN LICENSE.md"}
1
+ {"name": "@dropins/storefront-pdp", "version": "1.0.1", "@dropins/tools": "~0.36.0", "license": "SEE LICENSE IN LICENSE.md"}