efficient-storefront-blocks 0.130.14 → 0.130.15

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.
@@ -10,6 +10,7 @@ export interface CardProductPictureSettings {
10
10
  shadow?: unknown;
11
11
  shadowColor?: unknown;
12
12
  shadowOn?: unknown;
13
+ hoverZoom?: unknown;
13
14
  }
14
15
  export declare const SHADOW_ON: readonly [{
15
16
  readonly label: "Auto";
@@ -23,4 +24,5 @@ export declare const shadowOnOf: (v: unknown) => ShadowOn;
23
24
  export declare const PICTURE_FRAMES: readonly ["well", "full"];
24
25
  export type PictureFrame = (typeof PICTURE_FRAMES)[number];
25
26
  export declare const DEFAULT_PICTURE_FRAME: PictureFrame;
27
+ export declare const WHEEL_ZOOM_CLASS = "transition-transform duration-(--page-motion-hover-duration) ease-(--page-ease-media) motion-safe:group-hover:scale-(--sf-photo-zoom)";
26
28
  export default function CardProductPicture(settings: CardProductPictureSettings): import("react").JSX.Element | null;
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as d,Fragment as x}from"react/jsx-runtime";import{parseOption as G}from"efficient-shell/format";import N from"next/image";import{useState as ee}from"react";import{HideTaker as P}from"efficient-web-builder/render/components/ViewHideRoot";import{CARD_INDEX_BADGE_CLASS as B,CARD_INDEX_CLASS as E,parseCardIndexFormat as M}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as ae,cardImageBackgroundPaints as U,resolveCardImageBackground as re}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as v}from"efficient-web-builder/format/lib/content/card-image-shape";import{BOX_SWATCH_PROP as te,boxSwatchFill as le}from"efficient-web-builder/format/lib/content/box-background";import{useCardRow as oe}from"efficient-web-builder/render/components/CardRowContext";import{pictureShadowFilter as ne}from"efficient-easel/screen/lib/document/shadow-values";import{sayCount as se}from"efficient-web-builder/format/lib/editor-words";import{coverSrcForWheel as ie,parseCoverIndex as ce,resolvePaintedSrc as me}from"../../lib/wheels/cover-rendering.js";import de from"../WheelPlaceholder.js";import ue from"../BrandPlate.js";import fe from"../TyreImage.js";import{cardSpinOf as ge}from"../card-spin.js";import{useCardHoverLayer as he,useGridCard as I}from"../GridCardTemplate.js";import z from"./CardPicture.js";import O from"./CardProductBadge.js";import{useHeldCardPicture as pe}from"./useHeldCardPicture.js";import{useProductCardState as be}from"./ProductCardState.js";import{blockParts as we}from"../../lib/block-parts.js";const n=we("ProductCard"),Se=[{label:"Auto",value:"auto"},{label:"Always",value:"always"}],ke=a=>G(Se.map(r=>r.value),"auto",a),ye=["well","full"],Ce="well",$=a=>G(ye,Ce,a);function Fe({children:a}){return e("div",{className:"h-full w-full transition-transform duration-500 motion-safe:group-hover:scale-[1.03]",children:a})}function j({fill:a,badge:r,children:s}){const c=U(a);return d("div",{className:`sf-card-image relative aspect-[4/3] overflow-hidden${c?"":" bg-surface"}`,style:c?{backgroundColor:a}:void 0,...n("image-frame"),children:[s,r]})}function R(a,r){const s=oe();return le({[te]:a},s?.row)??re(r,ae)}function xe(a){const r=be();return r.kind==="bundle"?e(Pe,{state:r,...a}):r.kind==="tyre"?e(ve,{state:r,...a}):r.kind!=="wheel"?null:e(_e,{state:r,...a})}function Pe({state:a,imageBackground:r,cardImage:s,showBadge:c,frame:b,swatch:f}){const{bundle:t}=a,{imageSizes:g}=I(),m=$(b)==="full",h=t.components.length,p=t.image?m?e(N,{alt:t.name,src:t.image,fill:!0,sizes:g,className:"object-cover",draggable:!1,...n("image")}):e(N,{alt:t.name,src:t.image,width:1e3,height:1e3,sizes:g,className:"block h-full w-full object-cover",draggable:!1,...n("image")}):e("div",{className:"flex h-full w-full items-center justify-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.3em] text-fg-dim",children:se("{n} piece","{n} pieces",h,{})}),u=e(Fe,{children:p}),l=R(f,r),o=c!==!1?e(O,{edge:m}):null;return e(P,{style:v(s),...n("image-block"),children:m?e(j,{fill:l,badge:o,children:u}):d(x,{children:[o,e(z,{image:u,imageBackgroundFill:l})]})})}function ve({state:a,imageBackground:r,cardImage:s,indexBadge:c,frame:b,swatch:f}){const{tyre:t}=a,{imageSizes:g}=I(),m=R(f,r),h=M(c),p=h!=="off"?e("span",{"aria-hidden":!0,"data-format":h,className:`${E} ${B}`,...n("card-number")}):null,u=e(fe,{image:t.image,className:"h-full w-full",sizes:g,showBackground:!1}),l=e(ue,{brand:t.brand,logo:t.brandLogo});return e(P,{style:v(s),...n("image-block"),children:$(b)==="full"?d(j,{fill:m,badge:p,children:[u,l]}):d(x,{children:[p,e(z,{image:u,imageBackgroundFill:m,plate:l})]})})}function _e({state:a,imageBackground:r,cardImage:s,coverIndex:c,indexBadge:b,showBadge:f,setFlags:t,frame:g,swatch:m,shadow:h,shadowColor:p,shadowOn:u}){const{wheel:l,sel:o}=a,{hover:X,imageSizes:D,fit:K,rules:S}=I(),k=ge(X),Z=ie(l,ce(c),o.finish?.name,o.shownSrc,K?.holes),[T,q]=ee(()=>new Set),H=i=>{o.pictureFailed(i),q(w=>w.has(i)?w:new Set(w).add(i))},J=me({overrideSrc:Z,hookSrc:o.shownSrc,failed:T}),_=l.rendersHaveAlpha===!0||ke(u)==="always"?ne(h,p):null,Q=_?{...k.style,filter:_}:k.style,V=(i,w)=>e(N,{alt:w,src:i,width:1e3,height:1e3,sizes:D,className:`block h-full w-full object-contain ${k.className}`,style:Q,draggable:!1,onError:()=>H(i),...n("image")},i),Y=o.finish?`${l.name} — ${o.finish.name}`:l.name,y=pe({src:J,alt:Y,sizes:D,failed:T,onFailed:H,near:o.nearScreen,holdEmpty:o.awaitingProbe}),L=d(x,{children:[y.src?V(y.src,y.alt):e(de,{imageLabel:l.name,spin:k}),y.trial]}),A=M(b),C=A!=="off",F=R(m,r),W=he("picture",U(F)?F:void 0);if($(g)==="full"){const i=d(x,{children:[C?e("span",{"aria-hidden":!0,"data-format":A,className:`${E} ${B}`,...n("card-number")}):null,e(O,{show:f!==!1,numbered:C,sale:S.sale,axleSets:S.axleSets,setFlags:t!==!1,edge:!0})]});return e(P,{style:v(s),...n("image-block"),children:d(j,{fill:F,badge:i,children:[e("div",{className:"flex h-full w-full items-center justify-center",children:L}),W]})})}return d(P,{style:v(s),...n("image-block"),children:[C?e("span",{"aria-hidden":!0,"data-format":A,className:`${E} ${B}`,...n("card-number")}):null,e(O,{show:f!==!1,numbered:C,sale:S.sale,axleSets:S.axleSets,setFlags:t!==!1}),e(z,{image:L,imageBackgroundFill:F,plate:W,shadowed:!!_})]})}export{Ce as DEFAULT_PICTURE_FRAME,ye as PICTURE_FRAMES,Se as SHADOW_ON,xe as default,ke as shadowOnOf};
1
+ "use client";import{jsx as e,jsxs as i,Fragment as C}from"react/jsx-runtime";import{parseOption as Z}from"efficient-shell/format";import I from"next/image";import{useState as te}from"react";import{HideTaker as A}from"efficient-web-builder/render/components/ViewHideRoot";import{CARD_INDEX_BADGE_CLASS as R,CARD_INDEX_CLASS as $,parseCardIndexFormat as G}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as oe,cardImageBackgroundPaints as X,resolveCardImageBackground as ne}from"efficient-web-builder/format/lib/content/card-image-background";import{cardImageShapeTokens as E}from"efficient-web-builder/format/lib/content/card-image-shape";import{BOX_SWATCH_PROP as se,boxSwatchFill as ie}from"efficient-web-builder/format/lib/content/box-background";import{useCardRow as ce}from"efficient-web-builder/render/components/CardRowContext";import{pictureShadowFilter as me}from"efficient-easel/screen/lib/document/shadow-values";import{PICTURE_HOVER_KEYS as de,pictureHoverZoomOf as ue}from"efficient-web-builder/format/lib/animation/hover";import{PICTURE_ZOOM_VAR as fe}from"efficient-web-builder/format/lib/content/image-treatment";import{sayCount as he}from"efficient-web-builder/format/lib/editor-words";import{coverSrcForWheel as ge,parseCoverIndex as pe,resolvePaintedSrc as be}from"../../lib/wheels/cover-rendering.js";import we from"../WheelPlaceholder.js";import Se from"../BrandPlate.js";import ve from"../TyreImage.js";import{cardSpinOf as Ce}from"../card-spin.js";import{useCardHoverLayer as ye,useGridCard as B}from"../GridCardTemplate.js";import j from"./CardPicture.js";import T from"./CardProductBadge.js";import{useHeldCardPicture as xe}from"./useHeldCardPicture.js";import{useProductCardState as _e}from"./ProductCardState.js";import{blockParts as ke}from"../../lib/block-parts.js";const o=ke("ProductCard"),Fe=[{label:"Auto",value:"auto"},{label:"Always",value:"always"}],Pe=a=>Z(Fe.map(r=>r.value),"auto",a),Ne=["well","full"],Ae="well",H=a=>Z(Ne,Ae,a);function Ee({children:a}){return e("div",{className:"h-full w-full transition-transform duration-500 motion-safe:group-hover:scale-[1.03]",children:a})}const K="transition-transform duration-(--page-motion-hover-duration) ease-(--page-ease-media) motion-safe:group-hover:scale-(--sf-photo-zoom)";function V({zoom:a,image:r,layer:l,imageClass:n}){return i("div",{className:"contents",style:{[fe]:a},children:[e("div",{className:`${n} ${K}`,children:r}),l?e("div",{className:`pointer-events-none absolute inset-0 z-20 ${K}`,children:l}):null]})}function D({fill:a,badge:r,children:l}){const n=X(a);return i("div",{className:`sf-card-image relative aspect-[4/3] overflow-hidden${n?"":" bg-surface"}`,style:n?{backgroundColor:a}:void 0,...o("image-frame"),children:[l,r]})}function L(a,r){const l=ce();return ie({[se]:a},l?.row)??ne(r,oe)}function ze(a){const r=_e();return r.kind==="bundle"?e(Oe,{state:r,...a}):r.kind==="tyre"?e(Ie,{state:r,...a}):r.kind!=="wheel"?null:e(Re,{state:r,...a})}function Oe({state:a,imageBackground:r,cardImage:l,showBadge:n,frame:w,swatch:h}){const{bundle:t}=a,{imageSizes:g}=B(),c=H(w)==="full",p=t.components.length,b=t.image?c?e(I,{alt:t.name,src:t.image,fill:!0,sizes:g,className:"object-cover",draggable:!1,...o("image")}):e(I,{alt:t.name,src:t.image,width:1e3,height:1e3,sizes:g,className:"block h-full w-full object-cover",draggable:!1,...o("image")}):e("div",{className:"flex h-full w-full items-center justify-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.3em] text-fg-dim",children:he("{n} piece","{n} pieces",p,{})}),u=e(Ee,{children:b}),f=L(h,r),m=n!==!1?e(T,{edge:c}):null;return e(A,{style:E(l),...o("image-block"),children:c?e(D,{fill:f,badge:m,children:u}):i(C,{children:[m,e(j,{image:u,imageBackgroundFill:f})]})})}function Ie({state:a,imageBackground:r,cardImage:l,indexBadge:n,frame:w,swatch:h}){const{tyre:t}=a,{imageSizes:g}=B(),c=L(h,r),p=G(n),b=p!=="off"?e("span",{"aria-hidden":!0,"data-format":p,className:`${$} ${R}`,...o("card-number")}):null,u=e(ve,{image:t.image,className:"h-full w-full",sizes:g,showBackground:!1}),f=e(Se,{brand:t.brand,logo:t.brandLogo});return e(A,{style:E(l),...o("image-block"),children:H(w)==="full"?i(D,{fill:c,badge:b,children:[u,f]}):i(C,{children:[b,e(j,{image:u,imageBackgroundFill:c,plate:f})]})})}function Re({state:a,imageBackground:r,cardImage:l,coverIndex:n,indexBadge:w,showBadge:h,setFlags:t,frame:g,swatch:c,shadow:p,shadowColor:b,shadowOn:u,hoverZoom:f}){const{wheel:m,sel:d}=a,{hover:Y,imageSizes:W,fit:q,rules:y}=B(),x=Ce(Y),J=ge(m,pe(n),d.finish?.name,d.shownSrc,q?.holes),[M,Q]=te(()=>new Set),U=s=>{d.pictureFailed(s),Q(v=>v.has(s)?v:new Set(v).add(s))},ee=be({overrideSrc:J,hookSrc:d.shownSrc,failed:M}),z=m.rendersHaveAlpha===!0||Pe(u)==="always"?me(p,b):null,ae=z?{...x.style,filter:z}:x.style,re=(s,v)=>e(I,{alt:v,src:s,width:1e3,height:1e3,sizes:W,className:`block h-full w-full object-contain ${x.className}`,style:ae,draggable:!1,onError:()=>U(s),...o("image")},s),le=d.finish?`${m.name} — ${d.finish.name}`:m.name,_=xe({src:ee,alt:le,sizes:W,failed:M,onFailed:U,near:d.nearScreen,holdEmpty:d.awaitingProbe}),k=i(C,{children:[_.src?re(_.src,_.alt):e(we,{imageLabel:m.name,spin:x}),_.trial]}),O=G(w),F=O!=="off",P=L(c,r),N=ye("picture",X(P)?P:void 0),S=ue({[de.zoom]:f});if(H(g)==="full"){const s=i(C,{children:[F?e("span",{"aria-hidden":!0,"data-format":O,className:`${$} ${R}`,...o("card-number")}):null,e(T,{show:h!==!1,numbered:F,sale:y.sale,axleSets:y.axleSets,setFlags:t!==!1,edge:!0})]});return e(A,{style:E(l),...o("image-block"),children:e(D,{fill:P,badge:s,children:S?e(V,{zoom:S,image:e("div",{className:"flex h-full w-full items-center justify-center",children:k}),layer:N,imageClass:"h-full w-full"}):i(C,{children:[e("div",{className:"flex h-full w-full items-center justify-center",children:k}),N]})})})}return i(A,{style:E(l),...o("image-block"),children:[F?e("span",{"aria-hidden":!0,"data-format":O,className:`${$} ${R}`,...o("card-number")}):null,e(T,{show:h!==!1,numbered:F,sale:y.sale,axleSets:y.axleSets,setFlags:t!==!1}),e(j,{image:S?e(V,{zoom:S,image:k,layer:N,imageClass:"h-full w-full"}):k,imageBackgroundFill:P,plate:S?null:N,shadowed:!!z})]})}export{Ae as DEFAULT_PICTURE_FRAME,Ne as PICTURE_FRAMES,Fe as SHADOW_ON,K as WHEEL_ZOOM_CLASS,ze as default,Pe as shadowOnOf};
@@ -1 +1 @@
1
- import{jsx as a}from"react/jsx-runtime";import o from"../../../../../components/card-pieces/CardProductPicture.js";import t from"../../../../../components/card-pieces/HostPart.js";import{ProductPictureMeta as d}from"./meta.js";const g={...d,render:e=>a(t,{label:d.label??"",editing:!!e.editor?.isEditing,children:a(o,{imageBackground:e.imageBackground,cardImage:e.cardImage,coverIndex:e.coverIndex,indexBadge:e.indexBadge,showBadge:e.showBadge,setFlags:e.setFlags,frame:e.frame,swatch:e.swatch,shadow:e.shadow,shadowColor:e.shadowColor,shadowOn:e.shadowOn})})};export{g as ProductPictureRender};
1
+ import{jsx as a}from"react/jsx-runtime";import o from"../../../../../components/card-pieces/CardProductPicture.js";import r from"../../../../../components/card-pieces/HostPart.js";import{ProductPictureMeta as d}from"./meta.js";const n={...d,render:e=>a(r,{label:d.label??"",editing:!!e.editor?.isEditing,children:a(o,{imageBackground:e.imageBackground,cardImage:e.cardImage,coverIndex:e.coverIndex,indexBadge:e.indexBadge,showBadge:e.showBadge,setFlags:e.setFlags,frame:e.frame,swatch:e.swatch,shadow:e.shadow,shadowColor:e.shadowColor,shadowOn:e.shadowOn,hoverZoom:e.hoverZoom})})};export{n as ProductPictureRender};