efficient-storefront-blocks 0.118.5 → 0.119.0
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.
- package/CHANGELOG.md +7 -0
- package/dist/chunks/{SiteEditorProvider-IUUOJHN2.js → SiteEditorProvider-IA4YGOTE.js} +1 -1
- package/dist/chunks/{chunk-YGMNMVG2.js → chunk-DJBGDTYI.js} +1 -1
- package/dist/index.js +28 -28
- package/dist/render/components/GalleryItem.js +1 -1
- package/dist/render/components/HeaderTools.js +1 -1
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/catalog/FilterPill.js +1 -1
- package/dist/render/components/catalog/ShopperScope.d.ts +1 -2
- package/dist/render/components/catalog/ShopperScope.js +2 -2
- package/package.json +1 -1
- /package/dist/chunks/{chunk-YGMNMVG2.js.LEGAL.txt → chunk-DJBGDTYI.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as n,Fragment as f}from"react/jsx-runtime";import{createContext as Y,useCallback as Q,useContext as D,useEffect as ee,useRef as te,useState as _}from"react";import C from"next/link";import{slugify as re}from"efficient-shell/format";import{CardTemplateRows as oe}from"efficient-web-builder/render/components/CardRowContext";import{BOX_HOLDS_NO_GUTTER_CLASS as ne}from"efficient-web-builder/format/lib/content/page-width";import le,{galleryTileNumber as ae}from"./GalleryCard.js";import se,{LightboxClose as ie,LIGHTBOX_CLOSE_TINT as ce}from"./Lightbox.js";import{useSiteSells as de}from"./SiteRecordContext.js";import{renderGold as p,renderHeadline as W}from"efficient-web-builder/render/components/goldPhrases";import{sizedImage as pe}from"efficient-web-builder/format/lib/sized-image";import{
|
|
1
|
+
"use client";import{jsx as r,jsxs as n,Fragment as f}from"react/jsx-runtime";import{createContext as Y,useCallback as Q,useContext as D,useEffect as ee,useRef as te,useState as _}from"react";import C from"next/link";import{slugify as re}from"efficient-shell/format";import{CardTemplateRows as oe}from"efficient-web-builder/render/components/CardRowContext";import{BOX_HOLDS_NO_GUTTER_CLASS as ne}from"efficient-web-builder/format/lib/content/page-width";import le,{galleryTileNumber as ae}from"./GalleryCard.js";import se,{LightboxClose as ie,LIGHTBOX_CLOSE_TINT as ce}from"./Lightbox.js";import{useSiteSells as de}from"./SiteRecordContext.js";import{renderGold as p,renderHeadline as W}from"efficient-web-builder/render/components/goldPhrases";import{sizedImage as pe}from"efficient-web-builder/format/lib/sized-image";import{useBrowserLayoutEffect as me}from"efficient-shell/hooks";import{HideTaker as F}from"efficient-web-builder/render/components/ViewHideRoot";const fe="(max-width: 1100px) 100vw, min(59vw, 1050px)",he=Y({}),Re=[{id:"tag",label:"Tag"},{id:"eyebrow",label:"Eyebrow"},{id:"title",label:"Title"},{id:"meta",label:"Meta"},{id:"number",label:"Card number"}],xe=Y(null),ue="data-gallery-grid",O="data-gallery-tile";function ge(t,o){const[a,i]=_(null);return ee(()=>{const c=t.current,s=c?.closest(`[${ue}]`);if(!c||!s)return;const v=()=>{const y=Array.from(s.querySelectorAll(`[${O}]`)),N=y.indexOf(c),h=N>=0?{index:N+1,total:y.length}:null;i(x=>x?.index===h?.index&&x?.total===h?.total?x:h)};if(v(),!o)return;const w=new MutationObserver(v);return w.observe(s,{childList:!0,subtree:!0}),()=>w.disconnect()},[t,o]),a}const Ae={process:"Category",eyebrow:"Subtitle",name:"Item name",meta:"Detail"},be=()=>({image:"",href:"#",process:"",eyebrow:"",name:"",meta:""}),$e=Array.from({length:6},be);function ve(t){const o=(t.photos??[]).map(s=>s?.src).filter(s=>!!s),a=t.image||o[0]||"",i=[a,...o].filter(s=>!!s),c=re(t.name)||"gallery-item";return{car:t.eyebrow??"",wheel:t.name??"",process:t.process??"",finish:t.meta??"",imageLabel:`${c}.jpg`,detailLabel:`${c}-detail.jpg`,imageSrc:a||void 0,detailSrc:o[0]||a||void 0,photos:i,href:t.href}}function we({editing:t=!1,previewHover:o,ratio:a,captionPlace:i,tile:c,...s}){const{galleryHref:v="/gallery",submitHref:w="/contact",previewHover:y,display:N,displayPhone:h,styleOwner:x,photosOnly:X=!1,wordsAtRest:q=!1,Template:E,ownerId:Z}=D(he),e=ve(s),u=de()&&!X,P=!u&&!ye(e),d=e.photos??(e.imageSrc?[e.imageSrc]:[]),z=te(null),I=Q(l=>{z.current=l},[]),J=ge(z,t),j=D(xe),k=j?.report,m=c?.id,G=c?.tag??"",H=c?.name??"";me(()=>{if(!k||!m)return;const l={id:m,tag:G,name:H};return k(l),()=>k(l,!0)},[k,m,G,H]);const g=(m?j?.positionOf(m):null)??J,R=t&&(!!o||!!y),[K,b]=_(!1),[S,L]=_(0),A=()=>L(l=>(l-1+d.length)%d.length),$=()=>L(l=>(l+1)%d.length),T=d[S]??e.imageSrc??"",B=d.slice(1),M=E?r("div",{className:`block w-full min-w-0 ${ne}`,children:r(oe,{ownerId:Z??"GalleryB",ownerType:"GalleryB",Template:E,rows:[{key:m??e.imageSrc??"tile",image:e.imageSrc??"",tag:e.process,number:g?ae(g.index,g.total):"",eyebrow:e.car,name:e.wheel,meta:e.finish,href:e.href??""}],items:[{hoverMedia:B.length?{photos:[{finish:"",items:B.map(l=>({url:l,kind:"image"}))}]}:null}],previewHover:R,fallback:null,children:l=>l})}):r(le,{build:e,forceHover:R,alwaysShowOverlay:q,index:g?.index,total:g?.total,ratio:a,captionPlace:i,display:N,displayPhone:h,styleOwner:x,editing:t});return n(f,{children:[t?r(F,{as:"div",ref:I,[O]:"",className:"block w-full text-left",children:M}):r(F,{as:"button",ref:I,[O]:"",type:"button","aria-label":u?`Open ${e.car||"build"} on ${e.wheel||"wheel"}`:V(e),onClick:()=>{L(0),b(!0)},className:"block w-full cursor-pointer text-left focus:outline-none focus-visible:outline focus-visible:outline-2 focus-visible:outline-accent focus-visible:outline-offset-2",children:M}),r(se,{open:K,onClose:()=>b(!1),label:u?`${e.car} on ${e.wheel}`:V(e),onPrev:d.length>1?A:void 0,onNext:d.length>1?$:void 0,className:"flex items-center justify-center p-6 max-[700px]:p-3",children:n("div",{onClick:l=>l.stopPropagation(),className:`relative grid w-[min(1800px,100%)] max-h-[calc(100vh-48px)] ${P?"grid-cols-1":"grid-cols-[1.4fr_1fr]"} overflow-hidden border border-line bg-bg max-view-desktop:grid-cols-1 max-view-desktop:overflow-auto`,style:{boxShadow:"0 60px 120px -20px color-mix(in srgb, var(--sf-shadow-color, #141416) 70%, transparent)"},children:[r(ie,{label:"Close popup",className:"absolute right-[24px] top-[24px] z-[5] flex h-[56px] w-[56px] items-center justify-center border border-line font-mono text-[length:var(--size-label,21px)] text-fg-dim transition-colors hover:border-accent hover:text-fg",style:{background:ce},children:"✕"}),n("div",{className:"relative flex min-h-[690px] items-center justify-center overflow-hidden bg-surface-2 max-view-desktop:min-h-[450px]",children:[T&&r("img",{...pe(T,{fallbackWidth:1280}),sizes:fe,alt:`${(u?e.car:e.wheel||e.car)||"Photo"} — ${S+1} of ${d.length}`,className:"block h-full max-h-[88vh] w-full object-cover"},T),d.length>1&&n(f,{children:[r("button",{type:"button","aria-label":"Previous photo",onClick:A,className:"absolute left-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"◁"}),r("button",{type:"button","aria-label":"Next photo",onClick:$,className:"absolute right-4 top-1/2 flex h-16 w-16 -translate-y-1/2 cursor-pointer items-center justify-center border border-fg-dim/40 bg-overlay-scrim/40 font-mono text-[length:var(--size-label,24px)] text-fg-dim transition-colors hover:border-accent hover:text-accent",children:"▷"}),n("span",{className:"absolute bottom-4 left-1/2 -translate-x-1/2 border border-fg-dim/30 bg-overlay-scrim/50 px-4 py-1.5 font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em] text-fg-dim backdrop-blur-[4px]",children:[S+1," / ",d.length]})]})]}),u?n("div",{className:"flex flex-col gap-[30px] px-[60px] py-[72px] max-view-desktop:px-9 max-view-desktop:py-[54px]",children:[e.process&&r("span",{className:"font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.3em] text-accent",children:p(e.process)}),e.wheel&&r("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(42px,4.5vw,60px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.95] tracking-[-0.025em]",children:W(e.wheel,!1)}),e.car&&n("div",{className:"font-heading3 text-[length:var(--size-headingSmall,27px)] leading-[1.4] text-fg",children:["on ",r("em",{className:"font-serif font-normal italic text-accent tracking-[-0.01em]",children:p(e.car,!0)})]}),n("dl",{className:"mt-3 grid grid-cols-[auto_1fr] gap-x-7 gap-y-[18px] border-y border-line py-[30px] font-mono text-[length:var(--size-label,15px)] uppercase tracking-[0.22em]",children:[e.wheel&&n(f,{children:[r("dt",{className:"text-fg-dim",children:"Wheel"}),r("dd",{className:"text-fg",children:p(e.wheel)})]}),e.process&&n(f,{children:[r("dt",{className:"text-fg-dim",children:"Process"}),r("dd",{className:"text-fg",children:p(e.process)})]}),e.finish&&n(f,{children:[r("dt",{className:"text-fg-dim",children:"Finish"}),r("dd",{className:"text-fg",children:p(e.finish)})]}),e.car&&n(f,{children:[r("dt",{className:"text-fg-dim",children:"Vehicle"}),r("dd",{className:"text-fg",children:p(e.car)})]})]}),n("div",{className:"mt-auto flex flex-col gap-3.5 pt-6",children:[n(C,{href:e.href||"/wheels",onClick:()=>b(!1),className:"group flex items-center justify-between gap-6 border border-btn bg-btn px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-btn-ink transition-colors hover:border-fg hover:bg-fg",children:[r("span",{children:"View product"}),r("span",{className:"transition-transform group-hover:translate-x-[6px]",children:"→"})]}),n(C,{href:v,onClick:()=>b(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[r("span",{children:"See more builds"}),r("span",{children:"→"})]}),n(C,{href:w,onClick:()=>b(!1),className:"flex items-center justify-between gap-6 border border-line px-9 py-6 font-mono text-[length:var(--size-label,16px)] uppercase tracking-[0.3em] text-fg transition-colors hover:border-accent hover:text-accent",children:[r("span",{children:"Submit your build"}),r("span",{children:"→"})]})]})]}):!P&&r(Ne,{build:e})]})})]})}function U(t){return[t.process,t.car,t.finish].filter((o,a,i)=>!!o&&o!==t.wheel&&i.indexOf(o)===a)}function ye(t){return!!t.wheel||U(t).length>0}function V(t){const o=t.wheel||t.car;return o?`Open photo of ${o}`:"Open photo"}function Ne({build:t}){const o=t.wheel,a=U(t);return n("div",{className:"flex flex-col gap-[24px] px-[60px] py-[72px] max-view-desktop:px-9 max-view-desktop:py-[54px]",children:[o&&r("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(42px,4.5vw,60px)),var(--sf-heading-max,9999px))] font-medium uppercase leading-[0.95] tracking-[-0.025em]",children:W(o,!1)}),a.map(i=>r("p",{className:"text-[length:var(--size-body,18px)] leading-[1.5] text-fg",children:p(i)},i))]})}export{ue as GALLERY_GRID_ATTR,Ae as GALLERY_ITEM_HINTS,$e as GALLERY_ITEM_SEEDS,O as GALLERY_TILE_ATTR,Re as GALLERY_TILE_PARTS,he as GalleryLinksContext,xe as GalleryTilesContext,we as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as o,Fragment as y}from"react/jsx-runtime";import N from"next/link";import{useEffect as k,useRef as w}from"react";import{CartAltIcon as v}from"efficient-shell/icons/efficient-looks";import h from"efficient-easel/screen/components/UiIcon";import{prefersReducedMotion as $}from"efficient-web-builder/render/components/useReducedMotion";import{HideTaker as _,NO_HIDE as S,useTakeViewHide as C,withViewHide as j}from"efficient-web-builder/render/components/ViewHideRoot";const l={search:"Search",account:"Account",cart:"Bag",menu:"Menu",close:"Close"},d="whitespace-nowrap";function B(n){return n>99?"99+":String(n)}function W({count:n,ref:e}){return t("span",{ref:e,"data-cart-badge":"","aria-hidden":"true",className:"pointer-events-none absolute -top-[7px] -right-[9px] inline-flex h-4 min-w-4 items-center justify-center rounded-full bg-current px-1 text-[10px] leading-none font-semibold tabular-nums",style:{letterSpacing:0},children:t("span",{style:{color:"var(--sf-header-ground, var(--bg))"},children:B(n)})})}function M({onClick:n,count:e,asText:s,className:r,takesViewHide:a=!1}){const c=w(null),i=w(e);return k(()=>{i.current!==e&&(i.current=e,!$()&&c.current?.animate([{transform:"scale(0.6)"},{transform:"scale(1)"}],{duration:180,easing:"ease-out"}))},[e]),t(_,{as:"button",takes:a,type:"button",onClick:n,"aria-label":`Open cart, ${e} item${e===1?"":"s"}`,className:`mono-eyebrow-ctl inline-flex items-center gap-2 opacity-80 transition-opacity hover:opacity-100 ${r??""}`,children:s?o("span",{className:d,children:[l.cart,e>0?` ${e}`:""]}):o("span",{className:"relative inline-flex",children:[t(v,{size:18,strokeWidth:"1.6","aria-hidden":"true"}),e>0?t(W,{count:e,ref:c}):null]})})}function T({asText:n,className:e,takesViewHide:s=!1}){const r=C(),a=s?r:S;return a.scope(t(N,{href:"/account","aria-label":"Account",className:j(`mono-eyebrow-ctl inline-flex items-center opacity-80 transition-opacity hover:opacity-100 ${e??""}`,a.className),...a.attrs,children:n?t("span",{className:d,children:l.account}):o("svg",{width:"18",height:"18",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:[t("circle",{cx:"12",cy:"8",r:"3.4"}),t("path",{d:"M5 20a7 7 0 0 1 14 0"})]})}))}function U({onClick:n,asText:e,withWord:s,phoneLook:r,className:a}){let c=!1,i;if(r){const u=e?"text":s?"icon_text":"icon",m=(b,g)=>b&&g?"":b?"max-view-tablet:hidden":g?"view-tablet:hidden":null,p=m(u!=="text",r!=="text"),f=m(u!=="icon",r!=="icon"),x=u==="icon_text"||r==="icon_text";c=!0,i=o(y,{children:[p===null?null:t("span",{className:`inline-flex ${p}`,children:t(h,{name:"search",size:x?20:18,strokeWidth:x?1.5:1.6,rounded:!0})}),f===null?null:t("span",{className:`${d} ${f}`,children:l.search})]})}else s?(c=!0,i=o(y,{children:[t(h,{name:"search",size:20,strokeWidth:1.5,rounded:!0}),t("span",{className:`${d} max-view-tablet:hidden`,children:l.search})]})):i=e?t("span",{className:d,children:l.search}):t(h,{name:"search",size:18,strokeWidth:1.6,rounded:!0});return t("button",{type:"button",onClick:n,"aria-label":"Search",title:"Search (⌘K)",className:`mono-eyebrow-ctl inline-flex items-center ${c?"gap-2 ":""}opacity-80 transition-opacity hover:opacity-100 ${a??""}`,children:i})}export{T as AccountButton,M as CartButton,U as SearchButton,l as UTIL_WORDS,d as UTIL_WORD_CLASS};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as x,Fragment as mt}from"react/jsx-runtime";import{useScopeClass as dt}from"../lib/use-scope-class.js";import{useEffect as A,useMemo as p,useState as pe}from"react";import{cardHoverOf as ct}from"efficient-web-builder/format/lib/animation/hover";import{containerGapProps as pt}from"efficient-web-builder/format/lib/content/container-gap";import ut from"next/link";import{cardRowsGrid as gt,GridCardProvider as ft,GridMixedCards as ht,gridIndexCss as xt}from"./GridCardTemplate.js";import{gridClassImageSizes as wt}from"../lib/sections/card-image-sizes.js";import{fillRowCss as ue}from"../lib/sections/fill-row.js";import{hiddenCardsRule as ge,noHoleBands as fe,noHoleCss as he,ONE_WHEEL_MARK as vt,oneWheelScope as xe,pairScope as yt,showsASetCard as we}from"../lib/sections/grid-no-hole.js";import{setIsWide as bt,summarySetBuild as Ct}from"../lib/wheels/set-mode.js";import{answersForKind as ve,NO_FIELD_ANSWERS as ye}from"../lib/content/field-usage.js";import{wheelCardEyebrowShows as St}from"./ProductCardEyebrow.js";import Mt from"./NoCurrencyNote.js";import{SITE_WIDTH_CAP as Pt,centredCap as Et}from"efficient-web-builder/format/lib/content/page-width";import{ProductCatalogProvider as Nt,SectionWheelsProvider as Tt}from"./ProductRef.js";import{useCurrency as _t}from"./CurrencyContext.js";import{FRAME_ROOM_PRODUCT_GRID as Ot,FRAME_ROOM_PRODUCT_GRID_PHONE as $t,framedBandPad as Rt,PRODUCT_GRID_ROOM as It,withBandClasses as zt}from"../lib/sections/band-padding.js";import{COLLECTION_ATTR as Lt,useCatalogFilter as At}from"./catalog/CatalogFilterContext.js";import{useIsoLayoutEffect as Bt,useShopperMember as Gt}from"./catalog/ShopperScope.js";import Ht from"./wheels-plp/PlpPagination.js";import{CATALOG_TEXT_SIZE as Ft}from"../lib/sections/catalog-text-size.js";import{applyShopperFilters as Dt,hasActivePlpFilters as Ut,plpPricedAmounts as kt}from"../lib/wheels/plp-filters.js";import Wt from"./catalog/ClearAllButton.js";import{GRID_TOP_UP_SPARE as jt,gridPagingOf as Kt,gridShownOf as Xt}from"../lib/sections/product-grid-pages.js";import Zt from"./SectionBand.js";import{useInsideBox as qt,useInsideSiteGutter as Vt}from"efficient-web-builder/render/components/SiteGutterFrame";import{productGridColumnsClass as Yt}from"../lib/sections/product-grid-columns.js";import{renderGold as te,renderHeadline as Jt}from"efficient-web-builder/render/components/goldPhrases";import{applyCatalogFilters as Qt}from"../lib/wheels/catalog-filters.js";import{normalizeCatalogRows as er}from"../lib/wheels/wheel-summary-casing.js";import{itemKind as B,plpKindNoun as be}from"../lib/catalog/plp-item.js";import{filterBarCategoryOf as tr,gridKindsOf as Ce,gridRowsOf as rr}from"../lib/wheels/grid-source.js";import{useUnifiedProductCatalog as nr}from"./useProductCatalog.js";import{STICKY_UNDERHEADER_CLASS as ir}from"efficient-web-builder/render/lib/document/header-clearance";import{finishFamiliesOf as sr}from"../lib/wheels/finish-defaults.js";import{lugCountsOf as ar}from"../lib/wheels/lug-count.js";import{diametersOf as or}from"../lib/wheels/size-range.js";import{say as lr}from"efficient-web-builder/format/lib/editor-words";import{DEFAULT_TITLE_SIZE as mr}from"../lib/sections/product-grid-title.js";const dr=ct({},"ProductGrid"),i={headingMediumUpTo800Xs:"max-view-wide:text-[length:var(--size-headingMedium,28px)]",headingMediumUpTo800Small:"max-view-wide:text-[length:var(--size-headingMedium,32px)]",headingMediumUpTo800Large:"max-view-wide:text-[length:var(--size-headingMedium,36px)]",headingMediumUpTo800Xl:"max-view-wide:text-[length:var(--size-headingMedium,40px)]",body:"text-[length:var(--size-body,13px)]",headingMedium1:"text-[length:var(--size-headingMedium,40px)]",headingMedium2:"text-[length:var(--size-headingMedium,48px)]",headingMedium3:"text-[length:var(--size-headingMedium,56px)]",headingMedium4:"text-[length:var(--size-headingMedium,64px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"},Se=[{value:"para",label:"Paragraph size — 13px",cls:`font-mono font-normal uppercase tracking-[0.22em] ${i.labelLarge}`},{value:"sm",label:"Small — 40px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium1} ${i.headingMediumUpTo800Xs}`},{value:"md",label:"Medium — 48px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium2} ${i.headingMediumUpTo800Small}`},{value:"lg",label:"Large — 56px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium3} ${i.headingMediumUpTo800Large}`},{value:"xl",label:"Extra large — 64px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium4} ${i.headingMediumUpTo800Xl}`}];function cr(M){return(Se.find(w=>w.value===M)??Se.find(w=>w.value===mr)).cls}function pr({num:M,catalog:w,catalogTotal:Me,firstCountInChips:Pe=!1,kinds:T,title:G,titleSize:Ee,pads:Ne,noTop:re=!1,description:_,link:P,products:Te,wheels:_e,source:c,columns:Oe,columnsPhone:$e,columnsTablet:Re,limit:Ie,moreProducts:ze,perPage:Le,editing:E,contentCapped:Ae=!1,hover:Be,fieldUsage:v,ownerId:Ge="",template:He,gap:Fe,gapPhone:De}){const H=p(()=>v?ve(v,"alloy-wheel"):void 0,[v]),Ue=p(()=>v?ve(v,"tyre"):void 0,[v]),e=dt("pg"),{paged:y,per:b,limit:o,cap:u}=Kt({moreProducts:ze,perPage:Le,limit:Ie}),m=Yt(Oe,$e,Re),ne=Ae,ke=Vt(),We=qt(),je=ke||We,F=nr(E===!0&&!!c),s=p(()=>c?er(rr(c,T,F??w??[])):null,[w,F,c,T]),D=Gt("grid",s),l=s?D.scope:null,g=tr(c),C=g!==null&&!l,{filters:O,reportCount:U,reportLugs:k,reportSizes:W,reportFinishes:j,reportCategories:K,reportPrices:X,vehicle:ie}=At(),{currency:f}=_t(),Z=C&&!!O.process&&O.process!==g,q=l?.state,r=p(()=>s?q?Dt(s,q,f):C?Qt(s,O,f,ie.fit):s:null,[s,q,C,O,f,ie.fit]),[Ke,Xe]=pe(1),V=y&&r?Math.max(1,Math.ceil(r.length/b)):1,S=Math.min(V,Math.max(1,l?l.state.page:Ke)),{reportShown:Y}=D,se=l!==null;Bt(()=>{if(!se||!r)return Y(null);Y(Xt(r.length,{paged:y,per:b,cap:u},S))},[se,r,Y,y,S,b,u]);const Ze=n=>l?l.update({page:n}):Xe(n),a=p(()=>r&&(y?r.slice((S-1)*b,S*b):u?r.slice(0,Math.ceil(o)+jt):r),[y,u,o,r,S,b]);A(()=>(K(e,g===null?[]:[g]),()=>K(e,[])),[g,K,e]),A(()=>{if(C)return U(e,Z?0:r?.length??0),()=>U(e,0)},[C,Z,r,U,e]);const N=p(()=>({lugs:ar(s??[]),sizes:or(s??[]),finishes:sr(s??[]),prices:kt((s??[]).filter(n=>B(n)!=="tyre"),f)}),[s,f]);A(()=>(k(e,N.lugs),W(e,N.sizes),j(e,N.finishes),X(e,N.prices),()=>{k(e,[]),W(e,[]),j(e,[]),X(e,[])}),[N,k,W,j,X,e]);const J=pt("ProductGrid",Fe,"both",De),qe=`${e} grid${J.className} bg-[var(--catalog-grid-bg)] ${m}`,ae=gt(J),Ve=`${e} grid${ae.className} bg-[var(--catalog-grid-bg)] ${m}`,Ye=ae.style,Je=p(()=>{const n=(r??[]).filter(d=>B(d)!=="tyre");if(n.length===0)return!1;const h=n.some(d=>!!d.process);return n.some(d=>!!d.setWords)||St({kind:!1,brand:!1,process:h},H??[])},[r,H]),Qe=a?a.length>0?t("div",{className:Ve,style:Ye,children:t(ht,{items:a,tyreOf:n=>B(n)==="tyre"?n:null})}):l&&Ut(l.state)?x("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 bg-surface-2 p-4 text-center",children:[t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:`No ${be(Ce(c,T)).many} match those filters`}),t(Wt,{onClick:l.clear})]}):E?t("div",{className:"flex min-h-[320px] items-center justify-center rounded bg-surface-2 p-4 text-center",children:t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:lr("No products in “{name}” yet",{name:c?.name??""})})}):null:t(Te,{className:qe,style:J.style,minEmptyHeight:320}),et=l?l.countInChips:Pe,$=r&&!et?r===s&&!F?Me??r.length:r.length:null,oe=be(Ce(c,T)),tt=M||G||_||P?x("div",{className:`${ir} sticky top-[var(--sf-header-h,88px)] z-30 mb-5 flex items-center justify-between gap-4 max-view-wide:flex-wrap max-view-wide:gap-y-2 border-b border-line bg-bg/95 py-3 backdrop-blur-md ${ne||je?"":"-mx-[var(--sf-site-gutter,40px)] px-[var(--sf-site-gutter,40px)] max-view-wide:-mx-[min(20px,var(--sf-site-gutter,40px))] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))]"}`,children:[x("div",{className:"flex min-w-0 items-end gap-6 max-view-wide:flex-col max-view-wide:items-stretch max-view-wide:gap-3",children:[M&&t("span",{className:`font-mono ${i.labelLarge} leading-none uppercase tracking-[0.22em] text-fg-dim`,children:te(M)}),G&&t("h2",{className:`${cr(Ee)} leading-none text-fg max-view-wide:leading-[1] [&>span]:block`,children:Jt(G,!1)})]}),(_||P||$!==null)&&x("div",{className:"flex items-center gap-5 max-view-wide:gap-3 view-wide:grow view-wide:justify-end",children:[_&&t("span",{className:`max-w-[340px] truncate font-display ${i.body} leading-[1.4] text-fg-dim max-view-wide:hidden view-wide:w-0 view-wide:grow view-wide:text-right`,children:te(_)}),P&&x(ut,{href:P.href,className:`inline-flex items-center gap-2 whitespace-nowrap font-mono ${i.labelLarge} uppercase tracking-[0.2em] text-fg-dim transition-colors hover:text-fg`,children:[te(P.text),t("span",{"aria-hidden":!0,children:"→"})]}),$!==null&&x("span",{className:`whitespace-nowrap font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:[$," ",$===1?oe.one:oe.many]})]})]}):null,R=Rt(Ne,It,{noTop:re}),{paddingTop:rt,...nt}=R.style,I=re?0:rt,it={...I===void 0?{}:{"--pg-pt":typeof I=="number"?`${I}px`:I},...nt},z=p(()=>{if(!a)return null;const n=a.map(h=>B(h)!=="tyre"&&bt(Ct(h))?2:1);return we(n,o)?fe(m,n,o):null},[a,m,o]),[st,at]=pe("");A(()=>{if(a)return;const n=document.querySelector(`.${e}`);if(!n)return;const h=()=>{const d=[...n.children].map(ce=>ce.classList.contains("col-span-2")&&!ce.querySelector(vt)?2:1);at(we(d,o)?he(e,fe(m,d,o,!1),d.length):"")};h();const ee=new MutationObserver(h);return ee.observe(n,{childList:!0}),()=>ee.disconnect()},[a,e,m,o]);const ot=z?z[0].tracks:a?u?Math.min(a.length,o):a.length:void 0,L=z?he(yt(e),z,a.length)+(u?ge(xe(e),o+1):"")+ue(xe(e),m,{limit:o,cards:a.length}):st,le=L?"":ue(e,m,{limit:o,cards:a?.length}),me=xt(e),de=x(mt,{children:[u&&!L&&t("style",{children:ge(e,o+1)}),L&&t("style",{children:L}),le&&t("style",{children:le}),me&&t("style",{children:me}),tt,Qe,y&&V>1&&t(Ht,{textSize:Ft.labelSmall,page:S,pageCount:V,onPage:Ze}),t(Mt,{editing:E})]});if(Z)return null;const Q=t(Zt,{rootRef:D.ref,attrs:C&&g!==null?{...R.attrs,[Lt]:g}:R.attrs,className:zt(`relative z-[2] bg-bg px-[var(--sf-site-gutter,40px)] ${Ot} max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))] ${$t}`,R),column:null,inAnyBox:!0,style:it,defaults:{"--pg-pt":"120px"},children:ne?t("div",{style:Et(Pt),children:de}):de}),lt=s?Q:E?t(Nt,{currency:f,children:Q}):t(Tt,{wheels:_e,currency:f,children:Q});return t(ft,{value:{ownerId:Ge,Template:He,hover:Be??dr,imageSizes:wt(m,ot),fieldUsage:H??ye,tyreFieldUsage:Ue??ye,reserveEyebrow:Je,editing:E===!0},children:lt})}export{Se as TITLE_SIZES,pr as default};
|
|
1
|
+
"use client";import{jsx as t,jsxs as x,Fragment as mt}from"react/jsx-runtime";import{useScopeClass as dt}from"../lib/use-scope-class.js";import{useEffect as A,useMemo as p,useState as pe}from"react";import{cardHoverOf as ct}from"efficient-web-builder/format/lib/animation/hover";import{containerGapProps as pt}from"efficient-web-builder/format/lib/content/container-gap";import ut from"next/link";import{cardRowsGrid as gt,GridCardProvider as ft,GridMixedCards as ht,gridIndexCss as xt}from"./GridCardTemplate.js";import{gridClassImageSizes as wt}from"../lib/sections/card-image-sizes.js";import{fillRowCss as ue}from"../lib/sections/fill-row.js";import{hiddenCardsRule as ge,noHoleBands as fe,noHoleCss as he,ONE_WHEEL_MARK as vt,oneWheelScope as xe,pairScope as yt,showsASetCard as we}from"../lib/sections/grid-no-hole.js";import{setIsWide as bt,summarySetBuild as Ct}from"../lib/wheels/set-mode.js";import{answersForKind as ve,NO_FIELD_ANSWERS as ye}from"../lib/content/field-usage.js";import{wheelCardEyebrowShows as St}from"./ProductCardEyebrow.js";import Mt from"./NoCurrencyNote.js";import{SITE_WIDTH_CAP as Pt,centredCap as Et}from"efficient-web-builder/format/lib/content/page-width";import{ProductCatalogProvider as Nt,SectionWheelsProvider as Tt}from"./ProductRef.js";import{useCurrency as _t}from"./CurrencyContext.js";import{FRAME_ROOM_PRODUCT_GRID as Ot,FRAME_ROOM_PRODUCT_GRID_PHONE as $t,framedBandPad as Rt,PRODUCT_GRID_ROOM as zt,withBandClasses as It}from"../lib/sections/band-padding.js";import{COLLECTION_ATTR as Lt,useCatalogFilter as At}from"./catalog/CatalogFilterContext.js";import{useShopperMember as Bt}from"./catalog/ShopperScope.js";import{useBrowserLayoutEffect as Gt}from"efficient-shell/hooks";import Ht from"./wheels-plp/PlpPagination.js";import{CATALOG_TEXT_SIZE as Ft}from"../lib/sections/catalog-text-size.js";import{applyShopperFilters as Dt,hasActivePlpFilters as Ut,plpPricedAmounts as kt}from"../lib/wheels/plp-filters.js";import Wt from"./catalog/ClearAllButton.js";import{GRID_TOP_UP_SPARE as jt,gridPagingOf as Kt,gridShownOf as Xt}from"../lib/sections/product-grid-pages.js";import Zt from"./SectionBand.js";import{useInsideBox as qt,useInsideSiteGutter as Vt}from"efficient-web-builder/render/components/SiteGutterFrame";import{productGridColumnsClass as Yt}from"../lib/sections/product-grid-columns.js";import{renderGold as te,renderHeadline as Jt}from"efficient-web-builder/render/components/goldPhrases";import{applyCatalogFilters as Qt}from"../lib/wheels/catalog-filters.js";import{normalizeCatalogRows as er}from"../lib/wheels/wheel-summary-casing.js";import{itemKind as B,plpKindNoun as be}from"../lib/catalog/plp-item.js";import{filterBarCategoryOf as tr,gridKindsOf as Ce,gridRowsOf as rr}from"../lib/wheels/grid-source.js";import{useUnifiedProductCatalog as nr}from"./useProductCatalog.js";import{STICKY_UNDERHEADER_CLASS as ir}from"efficient-web-builder/render/lib/document/header-clearance";import{finishFamiliesOf as sr}from"../lib/wheels/finish-defaults.js";import{lugCountsOf as or}from"../lib/wheels/lug-count.js";import{diametersOf as ar}from"../lib/wheels/size-range.js";import{say as lr}from"efficient-web-builder/format/lib/editor-words";import{DEFAULT_TITLE_SIZE as mr}from"../lib/sections/product-grid-title.js";const dr=ct({},"ProductGrid"),i={headingMediumUpTo800Xs:"max-view-wide:text-[length:var(--size-headingMedium,28px)]",headingMediumUpTo800Small:"max-view-wide:text-[length:var(--size-headingMedium,32px)]",headingMediumUpTo800Large:"max-view-wide:text-[length:var(--size-headingMedium,36px)]",headingMediumUpTo800Xl:"max-view-wide:text-[length:var(--size-headingMedium,40px)]",body:"text-[length:var(--size-body,13px)]",headingMedium1:"text-[length:var(--size-headingMedium,40px)]",headingMedium2:"text-[length:var(--size-headingMedium,48px)]",headingMedium3:"text-[length:var(--size-headingMedium,56px)]",headingMedium4:"text-[length:var(--size-headingMedium,64px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"},Se=[{value:"para",label:"Paragraph size — 13px",cls:`font-mono font-normal uppercase tracking-[0.22em] ${i.labelLarge}`},{value:"sm",label:"Small — 40px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium1} ${i.headingMediumUpTo800Xs}`},{value:"md",label:"Medium — 48px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium2} ${i.headingMediumUpTo800Small}`},{value:"lg",label:"Large — 56px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium3} ${i.headingMediumUpTo800Large}`},{value:"xl",label:"Extra large — 64px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium4} ${i.headingMediumUpTo800Xl}`}];function cr(M){return(Se.find(w=>w.value===M)??Se.find(w=>w.value===mr)).cls}function pr({num:M,catalog:w,catalogTotal:Me,firstCountInChips:Pe=!1,kinds:T,title:G,titleSize:Ee,pads:Ne,noTop:re=!1,description:_,link:P,products:Te,wheels:_e,source:c,columns:Oe,columnsPhone:$e,columnsTablet:Re,limit:ze,moreProducts:Ie,perPage:Le,editing:E,contentCapped:Ae=!1,hover:Be,fieldUsage:v,ownerId:Ge="",template:He,gap:Fe,gapPhone:De}){const H=p(()=>v?ve(v,"alloy-wheel"):void 0,[v]),Ue=p(()=>v?ve(v,"tyre"):void 0,[v]),e=dt("pg"),{paged:y,per:b,limit:a,cap:u}=Kt({moreProducts:Ie,perPage:Le,limit:ze}),m=Yt(Oe,$e,Re),ne=Ae,ke=Vt(),We=qt(),je=ke||We,F=nr(E===!0&&!!c),s=p(()=>c?er(rr(c,T,F??w??[])):null,[w,F,c,T]),D=Bt("grid",s),l=s?D.scope:null,g=tr(c),C=g!==null&&!l,{filters:O,reportCount:U,reportLugs:k,reportSizes:W,reportFinishes:j,reportCategories:K,reportPrices:X,vehicle:ie}=At(),{currency:f}=_t(),Z=C&&!!O.process&&O.process!==g,q=l?.state,r=p(()=>s?q?Dt(s,q,f):C?Qt(s,O,f,ie.fit):s:null,[s,q,C,O,f,ie.fit]),[Ke,Xe]=pe(1),V=y&&r?Math.max(1,Math.ceil(r.length/b)):1,S=Math.min(V,Math.max(1,l?l.state.page:Ke)),{reportShown:Y}=D,se=l!==null;Gt(()=>{if(!se||!r)return Y(null);Y(Xt(r.length,{paged:y,per:b,cap:u},S))},[se,r,Y,y,S,b,u]);const Ze=n=>l?l.update({page:n}):Xe(n),o=p(()=>r&&(y?r.slice((S-1)*b,S*b):u?r.slice(0,Math.ceil(a)+jt):r),[y,u,a,r,S,b]);A(()=>(K(e,g===null?[]:[g]),()=>K(e,[])),[g,K,e]),A(()=>{if(C)return U(e,Z?0:r?.length??0),()=>U(e,0)},[C,Z,r,U,e]);const N=p(()=>({lugs:or(s??[]),sizes:ar(s??[]),finishes:sr(s??[]),prices:kt((s??[]).filter(n=>B(n)!=="tyre"),f)}),[s,f]);A(()=>(k(e,N.lugs),W(e,N.sizes),j(e,N.finishes),X(e,N.prices),()=>{k(e,[]),W(e,[]),j(e,[]),X(e,[])}),[N,k,W,j,X,e]);const J=pt("ProductGrid",Fe,"both",De),qe=`${e} grid${J.className} bg-[var(--catalog-grid-bg)] ${m}`,oe=gt(J),Ve=`${e} grid${oe.className} bg-[var(--catalog-grid-bg)] ${m}`,Ye=oe.style,Je=p(()=>{const n=(r??[]).filter(d=>B(d)!=="tyre");if(n.length===0)return!1;const h=n.some(d=>!!d.process);return n.some(d=>!!d.setWords)||St({kind:!1,brand:!1,process:h},H??[])},[r,H]),Qe=o?o.length>0?t("div",{className:Ve,style:Ye,children:t(ht,{items:o,tyreOf:n=>B(n)==="tyre"?n:null})}):l&&Ut(l.state)?x("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 bg-surface-2 p-4 text-center",children:[t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:`No ${be(Ce(c,T)).many} match those filters`}),t(Wt,{onClick:l.clear})]}):E?t("div",{className:"flex min-h-[320px] items-center justify-center rounded bg-surface-2 p-4 text-center",children:t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:lr("No products in “{name}” yet",{name:c?.name??""})})}):null:t(Te,{className:qe,style:J.style,minEmptyHeight:320}),et=l?l.countInChips:Pe,$=r&&!et?r===s&&!F?Me??r.length:r.length:null,ae=be(Ce(c,T)),tt=M||G||_||P?x("div",{className:`${ir} sticky top-[var(--sf-header-h,88px)] z-30 mb-5 flex items-center justify-between gap-4 max-view-wide:flex-wrap max-view-wide:gap-y-2 border-b border-line bg-bg/95 py-3 backdrop-blur-md ${ne||je?"":"-mx-[var(--sf-site-gutter,40px)] px-[var(--sf-site-gutter,40px)] max-view-wide:-mx-[min(20px,var(--sf-site-gutter,40px))] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))]"}`,children:[x("div",{className:"flex min-w-0 items-end gap-6 max-view-wide:flex-col max-view-wide:items-stretch max-view-wide:gap-3",children:[M&&t("span",{className:`font-mono ${i.labelLarge} leading-none uppercase tracking-[0.22em] text-fg-dim`,children:te(M)}),G&&t("h2",{className:`${cr(Ee)} leading-none text-fg max-view-wide:leading-[1] [&>span]:block`,children:Jt(G,!1)})]}),(_||P||$!==null)&&x("div",{className:"flex items-center gap-5 max-view-wide:gap-3 view-wide:grow view-wide:justify-end",children:[_&&t("span",{className:`max-w-[340px] truncate font-display ${i.body} leading-[1.4] text-fg-dim max-view-wide:hidden view-wide:w-0 view-wide:grow view-wide:text-right`,children:te(_)}),P&&x(ut,{href:P.href,className:`inline-flex items-center gap-2 whitespace-nowrap font-mono ${i.labelLarge} uppercase tracking-[0.2em] text-fg-dim transition-colors hover:text-fg`,children:[te(P.text),t("span",{"aria-hidden":!0,children:"→"})]}),$!==null&&x("span",{className:`whitespace-nowrap font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:[$," ",$===1?ae.one:ae.many]})]})]}):null,R=Rt(Ne,zt,{noTop:re}),{paddingTop:rt,...nt}=R.style,z=re?0:rt,it={...z===void 0?{}:{"--pg-pt":typeof z=="number"?`${z}px`:z},...nt},I=p(()=>{if(!o)return null;const n=o.map(h=>B(h)!=="tyre"&&bt(Ct(h))?2:1);return we(n,a)?fe(m,n,a):null},[o,m,a]),[st,ot]=pe("");A(()=>{if(o)return;const n=document.querySelector(`.${e}`);if(!n)return;const h=()=>{const d=[...n.children].map(ce=>ce.classList.contains("col-span-2")&&!ce.querySelector(vt)?2:1);ot(we(d,a)?he(e,fe(m,d,a,!1),d.length):"")};h();const ee=new MutationObserver(h);return ee.observe(n,{childList:!0}),()=>ee.disconnect()},[o,e,m,a]);const at=I?I[0].tracks:o?u?Math.min(o.length,a):o.length:void 0,L=I?he(yt(e),I,o.length)+(u?ge(xe(e),a+1):"")+ue(xe(e),m,{limit:a,cards:o.length}):st,le=L?"":ue(e,m,{limit:a,cards:o?.length}),me=xt(e),de=x(mt,{children:[u&&!L&&t("style",{children:ge(e,a+1)}),L&&t("style",{children:L}),le&&t("style",{children:le}),me&&t("style",{children:me}),tt,Qe,y&&V>1&&t(Ht,{textSize:Ft.labelSmall,page:S,pageCount:V,onPage:Ze}),t(Mt,{editing:E})]});if(Z)return null;const Q=t(Zt,{rootRef:D.ref,attrs:C&&g!==null?{...R.attrs,[Lt]:g}:R.attrs,className:It(`relative z-[2] bg-bg px-[var(--sf-site-gutter,40px)] ${Ot} max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))] ${$t}`,R),column:null,inAnyBox:!0,style:it,defaults:{"--pg-pt":"120px"},children:ne?t("div",{style:Et(Pt),children:de}):de}),lt=s?Q:E?t(Nt,{currency:f,children:Q}):t(Tt,{wheels:_e,currency:f,children:Q});return t(ft,{value:{ownerId:Ge,Template:He,hover:Be??dr,imageSizes:wt(m,at),fieldUsage:H??ye,tyreFieldUsage:Ue??ye,reserveEyebrow:Je,editing:E===!0},children:lt})}export{Se as TITLE_SIZES,pr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as h}from"react/jsx-runtime";import{useEffect as v,useId as k,useRef as f,useState as y}from"react";import{CATALOG_TEXT_SIZE as d}from"../../lib/sections/catalog-text-size.js";import{
|
|
1
|
+
"use client";import{jsx as i,jsxs as h}from"react/jsx-runtime";import{useEffect as v,useId as k,useRef as f,useState as y}from"react";import{CATALOG_TEXT_SIZE as d}from"../../lib/sections/catalog-text-size.js";import{useBrowserLayoutEffect as _}from"efficient-shell/hooks";function C({labelSize:n=d.labelLarge,label:c,badge:o,open:e,onToggle:r,controls:m,buttonRef:p}){const a=o>0;return h("button",{ref:p,type:"button","aria-haspopup":"dialog","aria-expanded":e,"aria-controls":m,onClick:r,className:[`inline-flex items-center gap-2 whitespace-nowrap border px-4 py-3 font-mono ${n} uppercase tracking-[0.2em] transition-colors`,a?"border-accent text-accent":"border-line hover:border-fg-dim"].join(" "),style:a?void 0:{color:"color-mix(in oklab, currentColor 80%, transparent)"},children:[c,o>0&&i("span",{className:`px-2 ${d.badge} tracking-[0.1em] text-bg`,style:{background:"var(--accent)"},children:o}),i("span",{className:`${d.badge} opacity-65 transition-transform ${e?"rotate-180":""}`,children:"▾"})]})}function R({labelSize:n,label:c,badge:o,open:e,onToggle:r,children:m}){const p=k(),a=f(null),x=f(null),b=f(null),[E,g]=y(!1);return _(()=>{if(!e){g(!1);return}const t=b.current,s=a.current,l=t?.ownerDocument.defaultView;if(!t||!s||!l||l.getComputedStyle(s).position==="static")return;const u=t.ownerDocument.documentElement.clientWidth,w=t.getBoundingClientRect();w.width>0&&w.right>u-L&&g(!0)},[e]),v(()=>{if(!e)return;const t=a.current?.ownerDocument??document,s=u=>{u.key==="Escape"&&(r(),x.current?.focus())},l=u=>{a.current?.contains(u.target)||r()};return t.addEventListener("keydown",s),t.addEventListener("pointerdown",l),()=>{t.removeEventListener("keydown",s),t.removeEventListener("pointerdown",l)}},[e,r]),h("div",{ref:a,className:e?"relative @max-[720px]:static":"relative",children:[i(C,{labelSize:n,label:c,badge:o,open:e,onToggle:r,controls:e?p:void 0,buttonRef:x}),e&&i("div",{ref:b,id:p,className:`absolute ${E?"right-0":"left-0"} top-[calc(100%+6px)] z-[60] min-w-[280px] max-w-[calc(100vw-32px)] border border-line bg-surface p-5 shadow-[0_24px_60px_rgba(0,0,0,0.4)] @max-[720px]:inset-x-0 @max-[720px]:top-auto @max-[720px]:mt-2 @max-[720px]:min-w-0`,onClick:t=>t.stopPropagation(),children:m})]})}const L=16;function S({children:n}){return i("div",{className:`mb-3 font-mono ${d.labelSmall} uppercase tracking-[0.32em] text-fg-dim`,children:n})}function B({active:n,onClick:c,children:o,role:e,ariaChecked:r}){return i("button",{type:"button",role:e,"aria-checked":e==="radio"?r:void 0,onClick:c,className:[`border px-3 py-2 font-mono ${d.labelLarge} uppercase tracking-[0.18em] transition-colors`,n?"border-accent bg-accent text-bg":"border-line hover:border-fg-dim"].join(" "),style:n?void 0:{color:"color-mix(in oklab, currentColor 75%, transparent)"},children:o})}export{R as FilterPill,B as OptButton,S as PanelTitle,C as PillButton};
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { type ComponentType, type ReactNode } from "react";
|
|
2
2
|
import { type SelectedRanges } from "efficient-web-builder/render/lib/content/box-show-for";
|
|
3
3
|
import type { PlpItem } from "../../lib/catalog/plp-item.js";
|
|
4
4
|
import { type PlpFilterState, type PlpSortKey } from "../../lib/wheels/plp-filters.js";
|
|
5
5
|
import { type ShopperAddressMark as AddressMark } from "../../lib/wheels/selected-ranges.js";
|
|
6
6
|
import { type GallerySortKey, type GalleryTile, type GalleryToolbarState } from "../../lib/sections/gallery-toolbar.js";
|
|
7
|
-
export declare const useIsoLayoutEffect: typeof useEffect;
|
|
8
7
|
type Patch = Partial<PlpFilterState> | ((f: PlpFilterState) => PlpFilterState);
|
|
9
8
|
export interface GridShown {
|
|
10
9
|
total: number;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";import{jsx as M}from"react/jsx-runtime";import{createContext as U,useCallback as k,useContext as R,useEffect as
|
|
1
|
+
"use client";import{jsx as M}from"react/jsx-runtime";import{createContext as U,useCallback as k,useContext as R,useEffect as y,useId as ct,useMemo as b,useRef as V,useState as A}from"react";import{useBrowserLayoutEffect as E}from"efficient-shell/hooks";import{useBoxId as it}from"efficient-web-builder/render/components/InBoxContext";import{SelectedRangesProvider as ut}from"efficient-web-builder/render/lib/content/box-show-for";import{EMPTY_PLP_FILTERS as x,plpFiltersToParams as j}from"../../lib/wheels/plp-filters.js";import{VEHICLE_PARAM as ft}from"../../lib/wheels/plp-vehicle-params.js";import{readSelectedRanges as pt,shopperAddressMarkOf as wt}from"../../lib/wheels/selected-ranges.js";import{resolveGalleryFollows as dt,resolveShopperScopes as gt}from"../../lib/wheels/shopper-scope.js";import{clampGalleryTag as ht,EMPTY_GALLERY_TOOLBAR as Y,galleryShownIds as St,galleryTags as mt}from"../../lib/sections/gallery-toolbar.js";import{filtersFromQuery as Pt,watchLocation as _t}from"../wheels-plp/usePlpFiltersInUrl.js";const G=U(null),kt={assign:new Map,states:{},rows:{},shown:{},chipParts:{},galleryFollow:new Map,tiles:{},galleryStates:{}};function W(o,r){if(o.size!==r.size)return!1;for(const[u,s]of o)if(r.get(u)!==s)return!1;return!0}function X(o,r){return typeof r=="function"?r(o):{...o,...r}}function vt(o,r){return j(o).toString()===j(r).toString()}function $t({children:o,address:r=null,editing:u=!1}){const s=V(new Map),[l,f]=A(kt),[p,w]=A(0),d=!u&&r?JSON.stringify(r):"",c=b(()=>d?r:null,[d]),[g,P]=A(null),_=k((t,n,e)=>{if(s.current.set(t.key,t),t.role==="filter"){const a=n??x;f(i=>i.states[t.key]?i:{...i,states:{...i.states,[t.key]:a}}),e&&P(i=>i??{key:t.key,opening:a.sort})}w(a=>a+1)},[]),S=k(t=>{P(n=>n?.key===t?null:n),s.current.delete(t),f(n=>{if(!(t in n.states)&&!(t in n.rows)&&!(t in n.shown)&&!(t in n.chipParts)&&!(t in n.tiles)&&!(t in n.galleryStates))return n;const{[t]:e,...a}=n.states,{[t]:i,...m}=n.rows,{[t]:C,...ot}=n.shown,{[t]:Rt,...st}=n.chipParts,{[t]:At,...lt}=n.tiles,{[t]:Tt,...at}=n.galleryStates;return{...n,states:a,rows:m,shown:ot,chipParts:st,tiles:lt,galleryStates:at}}),w(n=>n+1)},[]);y(()=>{if(p===0)return;const t=[...s.current.values()],n=gt(t),e=dt(t);f(a=>{const i=W(a.assign,n),m=W(a.galleryFollow,e);return i&&m?a:{...a,assign:i?a.assign:n,galleryFollow:m?a.galleryFollow:e}})},[p]);const v=k((t,n)=>{f(e=>{const a=e.states[t];return a?{...e,states:{...e.states,[t]:X(a,n)}}:e})},[]),T=k((t,n)=>{f(e=>{if(n===null){if(!(t in e.rows))return e;const{[t]:a,...i}=e.rows;return{...e,rows:i}}return e.rows[t]===n?e:{...e,rows:{...e.rows,[t]:n}}})},[]),F=k((t,n)=>{f(e=>{if(n===null){if(!(t in e.shown))return e;const{[t]:m,...C}=e.shown;return{...e,shown:C}}const a=e.shown[t];return a&&a.total===n.total&&a.range?.from===n.range?.from&&a.range?.to===n.range?.to?e:{...e,shown:{...e.shown,[t]:n}}})},[]),B=k((t,n)=>{f(e=>{const a=e.chipParts[t],i=n.count||n.sort;if(!i&&!a||a&&a.count===n.count&&a.sort===n.sort)return e;const{[t]:m,...C}=e.chipParts;return{...e,chipParts:i?{...C,[t]:n}:C}})},[]),D=k((t,n)=>{f(e=>{if(n===null){if(!(t in e.tiles))return e;const{[t]:a,...i}=e.tiles;return{...e,tiles:i}}return e.tiles[t]===n?e:{...e,tiles:{...e.tiles,[t]:n}}})},[]),H=k((t,n)=>{f(e=>({...e,galleryStates:{...e.galleryStates,[t]:{...e.galleryStates[t]??Y,...n}}}))},[]),[L,nt]=A(null),h=g?.key??null,q=g?.opening??x.sort;y(()=>{if(!c||typeof window>"u")return;const t=()=>{const n=window.location.search,e=pt(n,c.known);if(nt(i=>i&&i.writer===h&&i.ranges.join(`
|
|
2
2
|
`)===e.join(`
|
|
3
|
-
`)?i:{ranges:e,writer:h}),!h)return;const a={...
|
|
3
|
+
`)?i:{ranges:e,writer:h}),!h)return;const a={...Pt(n,q),collections:[...e]};f(i=>{const m=i.states[h];return!m||vt(m,a)?i:{...i,states:{...i.states,[h]:{...m,...a}}}})};return t(),_t(t)},[c,h,q]);const I=h?l.states[h]:void 0;y(()=>{if(!c||!h||!I||L?.writer!==h||typeof window>"u")return;const t=j(I),n=new URLSearchParams(window.location.search);for(const i of Object.values(ft))for(const m of n.getAll(i))t.append(i,m);const e=t.toString(),a=e?`?${e}`:"";a!==window.location.search&&window.history.replaceState(null,"",`${window.location.pathname}${a}`)},[c,h,I,L]);const O=c?.known,J=I?.collections,Q=L?.ranges,et=b(()=>!c||!O?null:{selected:(J??Q??c.selected).filter(n=>O.includes(n)),known:O},[c,O,J,Q]),rt=b(()=>({snap:l,address:c,writer:h,register:_,unregister:S,update:v,reportRows:T,reportShown:F,reportChipParts:B,reportTiles:D,updateGallery:H}),[l,c,h,_,S,v,T,F,B,D,H]);return M(G.Provider,{value:rt,children:M(ut,{value:et,children:o})})}const N=U(null);function xt({mark:o,children:r}){return M(N.Provider,{value:o,children:r})}function zt(o){return function(u){return M(xt,{mark:wt(u),children:M(o,{...u})})}}function Z(o,r){return{...x,sort:r,collections:[...o.selected]}}function $(o,r){if(!r)return null;const u=o.snap.states[r];if(!u)return null;const s=[];let l=0,f=0,p=!1,w=!1,d=null;for(const[c,g]of o.snap.assign){if(g!==r||c===r)continue;const P=o.snap.chipParts[c];P?.count&&(p=!0),P?.sort&&(w=!0);const _=o.snap.rows[c];if(!_)continue;f+=1,s.push(..._);const S=o.snap.shown[c];l+=S?.total??0,d=S?.range??null}return f!==1&&(d=null),{key:r,live:!0,state:u,update:c=>o.update(r,c),clear:()=>o.update(r,c=>({...x,sort:c.sort})),rows:s,total:l,grids:f,countInChips:p,sortInChips:w,range:d}}const K={count:!1,sort:!1};function z(o,r,u,s,l){const f=ct(),p=it(),w=V(null),d=k(P=>{w.current=P},[]),c=o?.register,g=o?.unregister;return E(()=>{if(!(!c||!g))return c({key:f,role:r,boxId:p,node:w.current,filtersBelow:u},s,l),()=>g(f)},[c,g,f,r,p,u,l]),{key:f,ref:d}}function Bt({filtersBelow:o,openingSort:r}){const u=R(G),s=R(N),l=u?.address??null,f=!!s?.writes&&l!==null,p=f?Z(l,r):{...x,sort:r},{key:w,ref:d}=z(u,"filter",o,p,f),[c,g]=A(p),_=(u?$(u,w):null)??{key:w,live:!1,state:c,update:S=>g(v=>X(v,S)),clear:()=>g(S=>({...x,sort:S.sort})),rows:[],total:0,grids:0,countInChips:!1,sortInChips:!1,range:null};return{ref:d,scope:_}}function Dt(o,r=null,u=K){const s=R(G),{key:l,ref:f}=z(s,o,!1),p=s?.reportRows,w=s?.reportShown;E(()=>{if(!(!p||o!=="grid"))return p(l,r),()=>p(l,null)},[p,l,o,r]);const d=k(F=>w?.(l,F),[w,l]);y(()=>()=>w?.(l,null),[w,l]);const c=s?.reportChipParts,{count:g,sort:P}=u;E(()=>{if(!(!c||o!=="chips"))return c(l,{count:g,sort:P}),()=>c(l,K)},[c,l,o,g,P]);const _=s?.snap.assign.get(l),S=R(N);let v=s?$(s,_):null;!v&&_===void 0&&s?.address&&S&&(v=(s.writer?$(s,s.writer):null)??Mt(Z(s.address,S.sort)));const T=s&&o==="chips"&&!v?Ct(s,s.snap.galleryFollow.get(l)):null;return{ref:f,scope:v,reportShown:d,gallery:T}}function Ct(o,r){if(!r)return null;const u=o.snap.tiles[r]??[],s=o.snap.galleryStates[r]??Y;return{tags:mt(u),tag:ht(s.tag,u),sort:s.sort,shown:St(u,s).length,pick:l=>o.updateGallery(r,{tag:l}),setSort:l=>o.updateGallery(r,{sort:l}),clear:()=>o.updateGallery(r,{tag:null})}}function Ht(o){const r=R(G),{key:u,ref:s}=z(r,"gallery",!1),l=r?.reportTiles;E(()=>{if(l)return l(u,o),()=>l(u,null)},[l,u,o]);let f=!1;if(r)for(const[w,d]of r.snap.galleryFollow)d===u&&!r.snap.assign.get(w)&&(f=!0);const p=r&&f?r.snap.galleryStates[u]??Y:null;return{ref:s,toolbar:p}}const tt=()=>{};function Mt(o){return{key:"",live:!1,state:o,update:tt,clear:tt,rows:[],total:0,grids:0,countInChips:!1,sortInChips:!1,range:null}}export{xt as ShopperAddressMark,$t as ShopperScopeProvider,Bt as useShopperFilter,Ht as useShopperGallery,Dt as useShopperMember,zt as withShopperAddressMark};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "efficient-storefront-blocks",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.119.0",
|
|
4
4
|
"description": "The EFFICIENT storefront's website editor — the website builder assembled with the storefront's own sections — for an app that edits a storefront website inside its own page. Built from the efficient-storefront-blocks repository.",
|
|
5
5
|
"license": "UNLICENSED",
|
|
6
6
|
"author": "Efficient Pty Ltd",
|
|
File without changes
|