efficient-storefront-blocks 0.125.15 → 0.125.17
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 +8 -0
- package/dist/editor/components/CountryShowAsTiles.d.ts +3 -2
- package/dist/editor/components/CountryShowAsTiles.js +1 -1
- package/dist/editor/components/HeaderSettingsPanel.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +2 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +24 -24
- package/dist/render/components/CountrySelect.js +1 -1
- package/dist/render/components/HeaderTools.d.ts +1 -0
- package/dist/render/components/HeaderTools.js +1 -1
- package/dist/render/components/ProductGridSection.d.ts +3 -0
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/lib/content/country-show-as.d.ts +6 -3
- package/dist/render/lib/content/country-show-as.js +1 -1
- package/dist/render/lib/sections/fill-row.d.ts +2 -1
- package/dist/render/lib/sections/fill-row.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/dist/words.d.ts +2 -0
- package/dist/words.js +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as n,Fragment as
|
|
1
|
+
"use client";import{jsx as n,Fragment as p,jsxs as d}from"react/jsx-runtime";import{ThemedSelectList as N,useThemedSelect as _}from"./ThemedSelect.js";import{useCurrency as x}from"./CurrencyContext.js";import{countryName as O}from"../lib/countries.js";import{regionSwitchHref as k}from"../lib/menu-link.js";import{FlagAuIcon as v,FlagCaIcon as T,FlagEuIcon as R,FlagGbIcon as A,FlagNzIcon as E,FlagUsIcon as U,GlobeIcon as j}from"efficient-shell/icons/efficient";import{GlobeAltIcon as G}from"efficient-shell/icons/efficient-looks";import{TOOL_ICON_BUTTON_CLASS as L}from"./HeaderTools.js";import{COUNTRY_SHOW_AS_DEFAULT as z,countryShowAsHasFlag as B}from"../lib/content/country-show-as.js";const g={US:U,CA:T,AU:v,NZ:E,GB:A,EU:R};function w({code:r,width:e}){const c=Object.hasOwn(g,r)?g[r]:void 0;return c?n("span",{"aria-hidden":!0,className:"inline-flex shrink-0 border border-line",children:n(c,{size:e})}):null}function H(r,e){const c=n(w,{code:e.code,width:18});switch(r){case"code_currency":return e.currency?d(p,{children:[n("span",{children:e.code}),n("span",{"aria-hidden":!0,className:"opacity-50",children:"·"}),n("span",{children:e.currency})]}):n("span",{children:e.code});case"globe_code":return d(p,{children:[n(j,{size:14,className:"shrink-0"}),n("span",{children:e.code})]});case"currency":return n("span",{children:e.currency??e.code});case"flag_code":return d(p,{children:[c,n("span",{children:e.code})]});case"flag":return Object.hasOwn(g,e.code)?c:n("span",{children:e.code});default:return n("span",{children:e.name})}}function F(r,e,c){const s=new Map(r.map(a=>[a.code,a]));return(e?.length?e:r.map(a=>a.code)).map(a=>{const i=s.get(a);return{code:a,name:i?.name||O(a),currency:i?.currency,url:i?.url||c?.[a]||""}})}const I=2;function Q(r){const{countries:e}=x();return F(e,r).length>=I}function W({urls:r,countries:e,showAs:c=z}={}){const{country:s,setCountry:a,countries:i}=x(),l=F(i,e,r),m=l.find(t=>t.code===s)??l[0];function C(t){const b=r?k(l.find(f=>f.code===t)?.url,window.location.href):null;if(b){window.location.href=b;return}i.some(f=>f.code===t)&&a(t)}const S=B(c),h=l.map(t=>({value:t.code,label:t.name,meta:t.currency,...S?{lead:n(w,{code:t.code,width:21})}:{}})),o=_({items:h,value:s,onPick:C});if(!m||l.length<I)return null;const u=o.open,y=c==="globe";return d("div",{ref:o.wrapRef,className:"relative",children:[n("button",{ref:t=>{o.triggerRef.current=t},type:"button","aria-haspopup":"listbox","aria-expanded":u,"aria-controls":u?o.listId:void 0,"aria-activedescendant":o.activeId,"aria-label":`Region: ${m.name}. Click to change.`,onClick:o.toggle,onKeyDown:o.onTriggerKeyDown,suppressHydrationWarning:!0,...y?{className:L}:{className:"inline-flex items-center gap-2 whitespace-nowrap border border-fg-dim px-3 py-2 font-mono text-[13px] uppercase tracking-[0.18em] transition-colors hover:border-fg",style:{color:"color-mix(in oklab, currentColor 80%, transparent)"}},children:y?n(G,{size:18,strokeWidth:"1.6","aria-hidden":"true"}):d(p,{children:[H(c,m),n("span",{"aria-hidden":!0,className:`text-[11px] opacity-70 transition-transform ${u?"rotate-180":""}`,children:"▾"})]})}),u&&n(N,{id:o.listId,tone:"region",ariaLabel:"Choose region",items:h,value:s,focusIdx:o.focusIdx,onFocus:o.setFocusIdx,onPick:o.pick,listRef:o.listRef})]})}export{W as default,Q as useCountrySelectShows};
|
|
@@ -8,6 +8,7 @@ export declare const UTIL_WORDS: {
|
|
|
8
8
|
readonly close: "Close";
|
|
9
9
|
};
|
|
10
10
|
export declare const UTIL_WORD_CLASS = "whitespace-nowrap";
|
|
11
|
+
export declare const TOOL_ICON_BUTTON_CLASS = "mono-eyebrow-ctl inline-flex items-center opacity-80 transition-opacity hover:opacity-100";
|
|
11
12
|
export declare function cartLabel(count: number): string;
|
|
12
13
|
export declare function CartButton({ onClick, count, asText, className, takesViewHide, }: {
|
|
13
14
|
onClick: () => void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as o,Fragment as y}from"react/jsx-runtime";import N from"next/link";import{useEffect as
|
|
1
|
+
"use client";import{jsx as e,jsxs as o,Fragment as y}from"react/jsx-runtime";import N from"next/link";import{useEffect as _,useRef as w}from"react";import{CartAltIcon as k}from"efficient-shell/icons/efficient-looks";import h from"efficient-easel/screen/components/UiIcon";import{prefersReducedMotion as v}from"efficient-web-builder/render/components/useReducedMotion";import{HideTaker as $,NO_HIDE as S,useTakeViewHide as C,withViewHide as O}from"efficient-web-builder/render/components/ViewHideRoot";const l={search:"Search",account:"Account",cart:"Bag",menu:"Menu",close:"Close"},d="whitespace-nowrap",B="mono-eyebrow-ctl inline-flex items-center opacity-80 transition-opacity hover:opacity-100";function L(n){return n>99?"99+":String(n)}function j({count:n,ref:t}){return e("span",{ref:t,"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:e("span",{style:{color:"var(--sf-header-ground, var(--bg))"},children:L(n)})})}function A(n){return`Open cart, ${n} item${n===1?"":"s"}`}function M({onClick:n,count:t,asText:s,className:r,takesViewHide:a=!1}){const c=w(null),i=w(t);return _(()=>{i.current!==t&&(i.current=t,!v()&&c.current?.animate([{transform:"scale(0.6)"},{transform:"scale(1)"}],{duration:180,easing:"ease-out"}))},[t]),e($,{as:"button",takes:a,type:"button",onClick:n,"aria-label":A(t),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,t>0?` ${t}`:""]}):o("span",{className:"relative inline-flex",children:[e(k,{size:18,strokeWidth:"1.6","aria-hidden":"true"}),t>0?e(j,{count:t,ref:c}):null]})})}function D({asText:n,className:t,takesViewHide:s=!1}){const r=C(),a=s?r:S;return a.scope(e(N,{href:"/account","aria-label":"Account",className:O(`${B} ${t??""}`,a.className),...a.attrs,children:n?e("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:[e("circle",{cx:"12",cy:"8",r:"3.4"}),e("path",{d:"M5 20a7 7 0 0 1 14 0"})]})}))}function E({onClick:n,asText:t,withWord:s,phoneLook:r,className:a}){let c=!1,i;if(r){const u=t?"text":s?"icon_text":"icon",p=(b,g)=>b&&g?"":b?"max-view-tablet:hidden":g?"view-tablet:hidden":null,m=p(u!=="text",r!=="text"),f=p(u!=="icon",r!=="icon"),x=u==="icon_text"||r==="icon_text";c=!0,i=o(y,{children:[m===null?null:e("span",{className:`inline-flex ${m}`,children:e(h,{name:"search",size:x?20:18,strokeWidth:x?1.5:1.6,rounded:!0})}),f===null?null:e("span",{className:`${d} ${f}`,children:l.search})]})}else s?(c=!0,i=o(y,{children:[e(h,{name:"search",size:20,strokeWidth:1.5,rounded:!0}),e("span",{className:`${d} max-view-tablet:hidden`,children:l.search})]})):i=t?e("span",{className:d,children:l.search}):e(h,{name:"search",size:18,strokeWidth:1.6,rounded:!0});return e("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{D as AccountButton,M as CartButton,E as SearchButton,B as TOOL_ICON_BUTTON_CLASS,l as UTIL_WORDS,d as UTIL_WORD_CLASS,A as cartLabel};
|
|
@@ -69,6 +69,9 @@ export declare const FEW_CARDS: readonly [{
|
|
|
69
69
|
}, {
|
|
70
70
|
readonly label: "Keep card width";
|
|
71
71
|
readonly value: "keep";
|
|
72
|
+
}, {
|
|
73
|
+
readonly label: "Center the row";
|
|
74
|
+
readonly value: "center";
|
|
72
75
|
}];
|
|
73
76
|
export type FewCards = (typeof FEW_CARDS)[number]["value"];
|
|
74
77
|
export default function ProductGridSection({ num, catalog, catalogTotal, firstCountInChips, kinds, title, titleSize, pads, noTop, description, link, products: Products, wheels, source, columns, columnsPhone, columnsTablet, limit: limitProp, moreProducts, perPage, editing, contentCapped, hover, fieldUsage, ownerId, template, fewCards, cardGround, cardWords, gap: gapProp, gapPhone, }: Props): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as w,Fragment as ft}from"react/jsx-runtime";import{useScopeClass as ht}from"../lib/use-scope-class.js";import{useEffect as B,useMemo as u,useState as fe}from"react";import{cardHoverOf as xt}from"efficient-web-builder/format/lib/animation/hover";import{containerGapProps as wt}from"efficient-web-builder/format/lib/content/container-gap";import vt from"next/link";import{cardRowsGrid as yt,GridCardProvider as bt,GridMixedCards as St,gridIndexCss as Ct}from"./GridCardTemplate.js";import{gridClassImageSizes as Mt}from"../lib/sections/card-image-sizes.js";import{fillRowCss as he}from"../lib/sections/fill-row.js";import{hiddenCardsRule as xe,noHoleBands as we,noHoleCss as ve,ONE_WHEEL_MARK as Pt,oneWheelScope as ye,pairScope as _t,showsASetCard as be}from"../lib/sections/grid-no-hole.js";import{setIsWide as Et,summarySetBuild as Ot}from"../lib/wheels/set-mode.js";import{answersForKind as Se,NO_FIELD_ANSWERS as Ce}from"../lib/content/field-usage.js";import{wheelCardEyebrowShows as Tt}from"./ProductCardEyebrow.js";import Nt from"./NoCurrencyNote.js";import{SITE_WIDTH_CAP as Rt,centredCap as $t,withSideOnce as Me}from"efficient-web-builder/format/lib/content/page-width";import{ProductCatalogProvider as It,SectionWheelsProvider as zt}from"./ProductRef.js";import{useCurrency as At}from"./CurrencyContext.js";import{FRAME_ROOM_PRODUCT_GRID as Lt,FRAME_ROOM_PRODUCT_GRID_PHONE as Bt,framedBandPad as Gt,PRODUCT_GRID_ROOM as kt,withBandClasses as Ft}from"../lib/sections/band-padding.js";import{COLLECTION_ATTR as Ht,useCatalogFilter as Dt}from"./catalog/CatalogFilterContext.js";import{useShopperMember as Ut}from"./catalog/ShopperScope.js";import{useBrowserLayoutEffect as Wt}from"efficient-shell/hooks";import jt from"./wheels-plp/PlpPagination.js";import{CATALOG_TEXT_SIZE as Kt}from"../lib/sections/catalog-text-size.js";import{applyShopperFilters as Xt,hasActivePlpFilters as Zt,plpPricedAmounts as qt}from"../lib/wheels/plp-filters.js";import Yt from"./catalog/ClearAllButton.js";import{GRID_TOP_UP_SPARE as Vt,gridPagingOf as Jt,gridShownOf as Qt}from"../lib/sections/product-grid-pages.js";import er from"./SectionBand.js";import{useInsideBox as tr,useInsideSiteGutter as rr}from"efficient-web-builder/render/components/SiteGutterFrame";import{productGridColumnsClass as nr}from"../lib/sections/product-grid-columns.js";import{renderGold as re,renderHeadline as ir}from"efficient-web-builder/render/components/goldPhrases";import{applyCatalogFilters as or}from"../lib/wheels/catalog-filters.js";import{normalizeCatalogRows as sr}from"../lib/wheels/wheel-summary-casing.js";import{itemKind as G,plpKindNoun as Pe}from"../lib/catalog/plp-item.js";import{filterBarCategoryOf as ar,gridKindsOf as _e,gridRowsOf as lr}from"../lib/wheels/grid-source.js";import{useUnifiedProductCatalog as dr}from"./useProductCatalog.js";import{STICKY_UNDERHEADER_CLASS as mr}from"efficient-web-builder/render/lib/document/header-clearance";import{finishFamiliesOf as cr}from"../lib/wheels/finish-defaults.js";import{lugCountsOf as pr}from"../lib/wheels/lug-count.js";import{diametersOf as ur}from"../lib/wheels/size-range.js";import{say as gr}from"efficient-web-builder/format/lib/editor-words";import{DEFAULT_TITLE_SIZE as fr}from"../lib/sections/product-grid-title.js";import{blockParts as hr}from"../lib/block-parts.js";import{PRODUCT_GRID_TYPE as xr}from"../lib/document/document-nodes.js";import{useSideSpaceOnce as wr}from"efficient-web-builder/render/components/SideSpaceOnce";const d=hr(xr),vr=xt({},"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)]"},Ee=[{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 yr(P){return(Ee.find(v=>v.value===P)??Ee.find(v=>v.value===fr)).cls}const gn=[{label:"Fill the row",value:"fill"},{label:"Keep card width",value:"keep"}];function br({num:P,catalog:v,catalogTotal:Oe,firstCountInChips:Te=!1,kinds:T,title:k,titleSize:Ne,pads:Re,noTop:ne=!1,description:N,link:_,products:$e,wheels:Ie,source:p,columns:ze,columnsPhone:Ae,columnsTablet:Le,limit:Be,moreProducts:Ge,perPage:ke,editing:E,contentCapped:Fe=!1,hover:He,fieldUsage:y,ownerId:De="",template:Ue,fewCards:ie="fill",cardGround:We="flat",cardWords:je="under",gap:Ke,gapPhone:Xe}){const oe=wr(),F=u(()=>y?Se(y,"alloy-wheel"):void 0,[y]),Ze=u(()=>y?Se(y,"tyre"):void 0,[y]),e=ht("pg"),{paged:b,per:S,limit:a,cap:g}=Jt({moreProducts:Ge,perPage:ke,limit:Be}),m=nr(ze,Ae,Le),se=Fe,qe=rr(),Ye=tr(),Ve=qe||Ye,H=dr(E===!0&&!!p),o=u(()=>p?sr(lr(p,T,H??v??[])):null,[v,H,p,T]),D=Ut("grid",o),l=o?D.scope:null,f=ar(p),C=f!==null&&!l,{filters:R,reportCount:U,reportLugs:W,reportSizes:j,reportFinishes:K,reportCategories:X,reportPrices:Z,vehicle:ae}=Dt(),{currency:h}=At(),q=C&&!!R.process&&R.process!==f,Y=l?.state,r=u(()=>o?Y?Xt(o,Y,h):C?or(o,R,h,ae.fit):o:null,[o,Y,C,R,h,ae.fit]),[Je,Qe]=fe(1),V=b&&r?Math.max(1,Math.ceil(r.length/S)):1,M=Math.min(V,Math.max(1,l?l.state.page:Je)),{reportShown:J}=D,le=l!==null;Wt(()=>{if(!le||!r)return J(null);J(Qt(r.length,{paged:b,per:S,cap:g},M))},[le,r,J,b,M,S,g]);const et=n=>l?l.update({page:n}):Qe(n),s=u(()=>r&&(b?r.slice((M-1)*S,M*S):g?r.slice(0,Math.ceil(a)+Vt):r),[b,g,a,r,M,S]);B(()=>(X(e,f===null?[]:[f]),()=>X(e,[])),[f,X,e]),B(()=>{if(C)return U(e,q?0:r?.length??0),()=>U(e,0)},[C,q,r,U,e]);const O=u(()=>({lugs:pr(o??[]),sizes:ur(o??[]),finishes:cr(o??[]),prices:qt((o??[]).filter(n=>G(n)!=="tyre"),h)}),[o,h]);B(()=>(W(e,O.lugs),j(e,O.sizes),K(e,O.finishes),Z(e,O.prices),()=>{W(e,[]),j(e,[]),K(e,[]),Z(e,[])}),[O,W,j,K,Z,e]);const Q=wt("ProductGrid",Ke,"both",Xe),tt=`${e} grid${Q.className} bg-[var(--catalog-grid-bg)] ${m}`,de=yt(Q),rt=`${e} grid${de.className} bg-[var(--catalog-grid-bg)] ${m}`,nt=de.style,it=u(()=>{const n=(r??[]).filter(c=>G(c)!=="tyre");if(n.length===0)return!1;const x=n.some(c=>!!c.process);return n.some(c=>!!c.setWords)||Tt({kind:!1,brand:!1,process:x},F??[])},[r,F]),ot=s?s.length>0?t("div",{className:rt,style:nt,...d("grid"),children:t(St,{items:s,tyreOf:n=>G(n)==="tyre"?n:null})}):l&&Zt(l.state)?w("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 bg-surface-2 p-4 text-center",...d("grid-empty"),children:[t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:`No ${Pe(_e(p,T)).many} match those filters`}),t(Yt,{onClick:l.clear})]}):E?t("div",{className:"flex min-h-[320px] items-center justify-center rounded bg-surface-2 p-4 text-center",...d("grid-empty"),children:t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:gr("No products in “{name}” yet",{name:p?.name??""})})}):null:t($e,{className:tt,style:Q.style,minEmptyHeight:320}),st=l?l.countInChips:Te,$=r&&!st?r===o&&!H?Oe??r.length:r.length:null,me=Pe(_e(p,T)),at=P||k||N||_?w("div",{className:Me(`${mr} 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 ${se||Ve?"":"-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))]"}`,oe),...d("grid-head"),children:[w("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:[P&&t("span",{className:`font-mono ${i.labelLarge} leading-none uppercase tracking-[0.22em] text-fg-dim`,...d("grid-number"),children:re(P)}),k&&t("h2",{className:`${yr(Ne)} leading-none text-fg max-view-wide:leading-[1] [&>span]:block`,...d("heading"),children:ir(k,!1)})]}),(N||_||$!==null)&&w("div",{className:"flex items-center gap-5 max-view-wide:gap-3 view-wide:grow view-wide:justify-end",children:[N&&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`,...d("description"),children:re(N)}),_&&w(vt,{href:_.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`,...d("view-all"),children:[re(_.text),t("span",{"aria-hidden":!0,children:"→"})]}),$!==null&&w("span",{className:`whitespace-nowrap font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,...d("count"),children:[$," ",$===1?me.one:me.many]})]})]}):null,I=Gt(Re,kt,{noTop:ne}),{paddingTop:lt,...dt}=I.style,z=ne?0:lt,mt={...z===void 0?{}:{"--pg-pt":typeof z=="number"?`${z}px`:z},...dt},A=u(()=>{if(!s)return null;const n=s.map(x=>G(x)!=="tyre"&&Et(Ot(x))?2:1);return be(n,a)?we(m,n,a):null},[s,m,a]),[ct,pt]=fe("");B(()=>{if(s)return;const n=document.querySelector(`.${e}`);if(!n)return;const x=()=>{const c=[...n.children].map(ge=>ge.classList.contains("col-span-2")&&!ge.querySelector(Pt)?2:1);pt(be(c,a)?ve(e,we(m,c,a,!1),c.length):"")};x();const te=new MutationObserver(x);return te.observe(n,{childList:!0}),()=>te.disconnect()},[s,e,m,a]);const ut=A?A[0].tracks:s?g?Math.min(s.length,a):s.length:void 0,L=A?ve(_t(e),A,s.length)+(g?xe(ye(e),a+1):"")+(ie==="keep"?"":he(ye(e),m,{limit:a,cards:s.length})):ct,ce=L||ie==="keep"?"":he(e,m,{limit:a,cards:s?.length}),pe=Ct(e),ue=w(ft,{children:[g&&!L&&t("style",{children:xe(e,a+1)}),L&&t("style",{children:L}),ce&&t("style",{children:ce}),pe&&t("style",{children:pe}),at,ot,b&&V>1&&t(jt,{textSize:Kt.labelSmall,page:M,pageCount:V,onPage:et}),t(Nt,{editing:E})]});if(q)return null;const ee=t(er,{rootRef:D.ref,attrs:{...C&&f!==null?{...I.attrs,[Ht]:f}:I.attrs,...d("product-grid-block")},className:Ft(Me(`relative z-[2] bg-bg px-[var(--sf-site-gutter,40px)] ${Lt} max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))] ${Bt}`,oe),I),column:null,inAnyBox:!0,style:mt,defaults:{"--pg-pt":"120px"},children:se?t("div",{style:$t(Rt),children:ue}):ue}),gt=o?ee:E?t(It,{currency:h,children:ee}):t(zt,{wheels:Ie,currency:h,children:ee});return t(bt,{value:{ownerId:De,Template:Ue,hover:He??vr,imageSizes:Mt(m,ut),fieldUsage:F??Ce,tyreFieldUsage:Ze??Ce,reserveEyebrow:it,editing:E===!0,ground:We,words:je},children:gt})}export{gn as FEW_CARDS,Ee as TITLE_SIZES,br as default};
|
|
1
|
+
"use client";import{jsx as t,jsxs as y,Fragment as ft}from"react/jsx-runtime";import{useScopeClass as ht}from"../lib/use-scope-class.js";import{useEffect as B,useMemo as f,useState as fe}from"react";import{cardHoverOf as xt}from"efficient-web-builder/format/lib/animation/hover";import{containerGapProps as wt}from"efficient-web-builder/format/lib/content/container-gap";import vt from"next/link";import{cardRowsGrid as yt,GridCardProvider as bt,GridMixedCards as Ct,gridIndexCss as St}from"./GridCardTemplate.js";import{gridClassImageSizes as Mt}from"../lib/sections/card-image-sizes.js";import{centerRowCss as Pt,fillRowCss as _t}from"../lib/sections/fill-row.js";import{hiddenCardsRule as he,noHoleBands as xe,noHoleCss as we,ONE_WHEEL_MARK as Et,oneWheelScope as ve,pairScope as Ot,showsASetCard as ye}from"../lib/sections/grid-no-hole.js";import{setIsWide as Rt,summarySetBuild as Tt}from"../lib/wheels/set-mode.js";import{answersForKind as be,NO_FIELD_ANSWERS as Ce}from"../lib/content/field-usage.js";import{wheelCardEyebrowShows as Nt}from"./ProductCardEyebrow.js";import $t from"./NoCurrencyNote.js";import{SITE_WIDTH_CAP as It,centredCap as zt,withSideOnce as Se}from"efficient-web-builder/format/lib/content/page-width";import{ProductCatalogProvider as At,SectionWheelsProvider as Lt}from"./ProductRef.js";import{useCurrency as Bt}from"./CurrencyContext.js";import{FRAME_ROOM_PRODUCT_GRID as Gt,FRAME_ROOM_PRODUCT_GRID_PHONE as Ft,framedBandPad as Ht,PRODUCT_GRID_ROOM as kt,withBandClasses as Dt}from"../lib/sections/band-padding.js";import{COLLECTION_ATTR as Ut,useCatalogFilter as Wt}from"./catalog/CatalogFilterContext.js";import{useShopperMember as jt}from"./catalog/ShopperScope.js";import{useBrowserLayoutEffect as Kt}from"efficient-shell/hooks";import Xt from"./wheels-plp/PlpPagination.js";import{CATALOG_TEXT_SIZE as Zt}from"../lib/sections/catalog-text-size.js";import{applyShopperFilters as qt,hasActivePlpFilters as Yt,plpPricedAmounts as Vt}from"../lib/wheels/plp-filters.js";import Jt from"./catalog/ClearAllButton.js";import{GRID_TOP_UP_SPARE as Qt,gridPagingOf as er,gridShownOf as tr}from"../lib/sections/product-grid-pages.js";import rr from"./SectionBand.js";import{useInsideBox as nr,useInsideSiteGutter as ir}from"efficient-web-builder/render/components/SiteGutterFrame";import{productGridColumnsClass as or}from"../lib/sections/product-grid-columns.js";import{renderGold as re,renderHeadline as sr}from"efficient-web-builder/render/components/goldPhrases";import{applyCatalogFilters as ar}from"../lib/wheels/catalog-filters.js";import{normalizeCatalogRows as lr}from"../lib/wheels/wheel-summary-casing.js";import{itemKind as G,plpKindNoun as Me}from"../lib/catalog/plp-item.js";import{filterBarCategoryOf as dr,gridKindsOf as Pe,gridRowsOf as mr}from"../lib/wheels/grid-source.js";import{useUnifiedProductCatalog as cr}from"./useProductCatalog.js";import{STICKY_UNDERHEADER_CLASS as pr}from"efficient-web-builder/render/lib/document/header-clearance";import{finishFamiliesOf as ur}from"../lib/wheels/finish-defaults.js";import{lugCountsOf as gr}from"../lib/wheels/lug-count.js";import{diametersOf as fr}from"../lib/wheels/size-range.js";import{say as hr}from"efficient-web-builder/format/lib/editor-words";import{DEFAULT_TITLE_SIZE as xr}from"../lib/sections/product-grid-title.js";import{blockParts as wr}from"../lib/block-parts.js";import{PRODUCT_GRID_TYPE as vr}from"../lib/document/document-nodes.js";import{useSideSpaceOnce as yr}from"efficient-web-builder/render/components/SideSpaceOnce";const d=wr(vr),br=xt({},"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)]"},_e=[{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(u){return(_e.find(m=>m.value===u)??_e.find(m=>m.value===xr)).cls}const hn=[{label:"Fill the row",value:"fill"},{label:"Keep card width",value:"keep"},{label:"Center the row",value:"center"}],Ee=(u,...m)=>u==="keep"?"":u==="center"?Pt(...m):_t(...m);function Sr({num:u,catalog:m,catalogTotal:Oe,firstCountInChips:Re=!1,kinds:R,title:F,titleSize:Te,pads:Ne,noTop:ne=!1,description:T,link:_,products:$e,wheels:Ie,source:g,columns:ze,columnsPhone:Ae,columnsTablet:Le,limit:Be,moreProducts:Ge,perPage:Fe,editing:E,contentCapped:He=!1,hover:ke,fieldUsage:b,ownerId:De="",template:Ue,fewCards:ie="fill",cardGround:We="flat",cardWords:je="under",gap:Ke,gapPhone:Xe}){const oe=yr(),H=f(()=>b?be(b,"alloy-wheel"):void 0,[b]),Ze=f(()=>b?be(b,"tyre"):void 0,[b]),e=ht("pg"),{paged:C,per:S,limit:a,cap:h}=er({moreProducts:Ge,perPage:Fe,limit:Be}),c=or(ze,Ae,Le),se=He,qe=ir(),Ye=nr(),Ve=qe||Ye,k=cr(E===!0&&!!g),o=f(()=>g?lr(mr(g,R,k??m??[])):null,[m,k,g,R]),D=jt("grid",o),l=o?D.scope:null,x=dr(g),M=x!==null&&!l,{filters:N,reportCount:U,reportLugs:W,reportSizes:j,reportFinishes:K,reportCategories:X,reportPrices:Z,vehicle:ae}=Wt(),{currency:w}=Bt(),q=M&&!!N.process&&N.process!==x,Y=l?.state,r=f(()=>o?Y?qt(o,Y,w):M?ar(o,N,w,ae.fit):o:null,[o,Y,M,N,w,ae.fit]),[Je,Qe]=fe(1),V=C&&r?Math.max(1,Math.ceil(r.length/S)):1,P=Math.min(V,Math.max(1,l?l.state.page:Je)),{reportShown:J}=D,le=l!==null;Kt(()=>{if(!le||!r)return J(null);J(tr(r.length,{paged:C,per:S,cap:h},P))},[le,r,J,C,P,S,h]);const et=n=>l?l.update({page:n}):Qe(n),s=f(()=>r&&(C?r.slice((P-1)*S,P*S):h?r.slice(0,Math.ceil(a)+Qt):r),[C,h,a,r,P,S]);B(()=>(X(e,x===null?[]:[x]),()=>X(e,[])),[x,X,e]),B(()=>{if(M)return U(e,q?0:r?.length??0),()=>U(e,0)},[M,q,r,U,e]);const O=f(()=>({lugs:gr(o??[]),sizes:fr(o??[]),finishes:ur(o??[]),prices:Vt((o??[]).filter(n=>G(n)!=="tyre"),w)}),[o,w]);B(()=>(W(e,O.lugs),j(e,O.sizes),K(e,O.finishes),Z(e,O.prices),()=>{W(e,[]),j(e,[]),K(e,[]),Z(e,[])}),[O,W,j,K,Z,e]);const Q=wt("ProductGrid",Ke,"both",Xe),tt=`${e} grid${Q.className} bg-[var(--catalog-grid-bg)] ${c}`,de=yt(Q),rt=`${e} grid${de.className} bg-[var(--catalog-grid-bg)] ${c}`,nt=de.style,it=f(()=>{const n=(r??[]).filter(p=>G(p)!=="tyre");if(n.length===0)return!1;const v=n.some(p=>!!p.process);return n.some(p=>!!p.setWords)||Nt({kind:!1,brand:!1,process:v},H??[])},[r,H]),ot=s?s.length>0?t("div",{className:rt,style:nt,...d("grid"),children:t(Ct,{items:s,tyreOf:n=>G(n)==="tyre"?n:null})}):l&&Yt(l.state)?y("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 bg-surface-2 p-4 text-center",...d("grid-empty"),children:[t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:`No ${Me(Pe(g,R)).many} match those filters`}),t(Jt,{onClick:l.clear})]}):E?t("div",{className:"flex min-h-[320px] items-center justify-center rounded bg-surface-2 p-4 text-center",...d("grid-empty"),children:t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:hr("No products in “{name}” yet",{name:g?.name??""})})}):null:t($e,{className:tt,style:Q.style,minEmptyHeight:320}),st=l?l.countInChips:Re,$=r&&!st?r===o&&!k?Oe??r.length:r.length:null,me=Me(Pe(g,R)),at=u||F||T||_?y("div",{className:Se(`${pr} 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 ${se||Ve?"":"-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))]"}`,oe),...d("grid-head"),children:[y("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:[u&&t("span",{className:`font-mono ${i.labelLarge} leading-none uppercase tracking-[0.22em] text-fg-dim`,...d("grid-number"),children:re(u)}),F&&t("h2",{className:`${Cr(Te)} leading-none text-fg max-view-wide:leading-[1] [&>span]:block`,...d("heading"),children:sr(F,!1)})]}),(T||_||$!==null)&&y("div",{className:"flex items-center gap-5 max-view-wide:gap-3 view-wide:grow view-wide:justify-end",children:[T&&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`,...d("description"),children:re(T)}),_&&y(vt,{href:_.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`,...d("view-all"),children:[re(_.text),t("span",{"aria-hidden":!0,children:"→"})]}),$!==null&&y("span",{className:`whitespace-nowrap font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,...d("count"),children:[$," ",$===1?me.one:me.many]})]})]}):null,I=Ht(Ne,kt,{noTop:ne}),{paddingTop:lt,...dt}=I.style,z=ne?0:lt,mt={...z===void 0?{}:{"--pg-pt":typeof z=="number"?`${z}px`:z},...dt},A=f(()=>{if(!s)return null;const n=s.map(v=>G(v)!=="tyre"&&Rt(Tt(v))?2:1);return ye(n,a)?xe(c,n,a):null},[s,c,a]),[ct,pt]=fe("");B(()=>{if(s)return;const n=document.querySelector(`.${e}`);if(!n)return;const v=()=>{const p=[...n.children].map(ge=>ge.classList.contains("col-span-2")&&!ge.querySelector(Et)?2:1);pt(ye(p,a)?we(e,xe(c,p,a,!1),p.length):"")};v();const te=new MutationObserver(v);return te.observe(n,{childList:!0}),()=>te.disconnect()},[s,e,c,a]);const ut=A?A[0].tracks:s?h?Math.min(s.length,a):s.length:void 0,L=A?we(Ot(e),A,s.length)+(h?he(ve(e),a+1):"")+Ee(ie,ve(e),c,{limit:a,cards:s.length}):ct,ce=L?"":Ee(ie,e,c,{limit:a,cards:s?.length}),pe=St(e),ue=y(ft,{children:[h&&!L&&t("style",{children:he(e,a+1)}),L&&t("style",{children:L}),ce&&t("style",{children:ce}),pe&&t("style",{children:pe}),at,ot,C&&V>1&&t(Xt,{textSize:Zt.labelSmall,page:P,pageCount:V,onPage:et}),t($t,{editing:E})]});if(q)return null;const ee=t(rr,{rootRef:D.ref,attrs:{...M&&x!==null?{...I.attrs,[Ut]:x}:I.attrs,...d("product-grid-block")},className:Dt(Se(`relative z-[2] bg-bg px-[var(--sf-site-gutter,40px)] ${Gt} max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))] ${Ft}`,oe),I),column:null,inAnyBox:!0,style:mt,defaults:{"--pg-pt":"120px"},children:se?t("div",{style:zt(It),children:ue}):ue}),gt=o?ee:E?t(At,{currency:w,children:ee}):t(Lt,{wheels:Ie,currency:w,children:ee});return t(bt,{value:{ownerId:De,Template:Ue,hover:ke??br,imageSizes:Mt(c,ut),fieldUsage:H??Ce,tyreFieldUsage:Ze??Ce,reserveEyebrow:it,editing:E===!0,ground:We,words:je},children:gt})}export{hn as FEW_CARDS,_e as TITLE_SIZES,Sr as default};
|
|
@@ -1,9 +1,12 @@
|
|
|
1
|
-
export type CountryShowAs = "name" | "code_currency" | "globe_code" | "currency" | "flag_code" | "flag";
|
|
2
|
-
|
|
1
|
+
export type CountryShowAs = "name" | "code_currency" | "globe_code" | "currency" | "flag_code" | "flag" | "globe";
|
|
2
|
+
type ShowAsChoice = {
|
|
3
3
|
value: CountryShowAs;
|
|
4
4
|
label: string;
|
|
5
|
-
}
|
|
5
|
+
};
|
|
6
|
+
export declare const COUNTRY_SHOW_AS: readonly ShowAsChoice[];
|
|
7
|
+
export declare const HEADER_ROW_SHOW_AS: readonly ShowAsChoice[];
|
|
6
8
|
export declare const COUNTRY_SHOW_AS_LABEL = "Show as";
|
|
7
9
|
export declare const COUNTRY_SHOW_AS_DEFAULT: CountryShowAs;
|
|
8
10
|
export declare function resolveCountryShowAs(v: unknown): CountryShowAs;
|
|
9
11
|
export declare const countryShowAsHasFlag: (v: CountryShowAs) => boolean;
|
|
12
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const
|
|
1
|
+
const l=[{value:"name",label:"Country name"},{value:"code_currency",label:"Code and currency"},{value:"globe_code",label:"Globe and code"},{value:"currency",label:"Currency"},{value:"flag_code",label:"Flag and code"},{value:"flag",label:"Flag"},{value:"globe",label:"Globe"}],n=l.filter(e=>e.value!=="globe"),r="Show as",a="name";function c(e){return l.some(o=>o.value===e)?e:a}const u=e=>e==="flag_code"||e==="flag";export{l as COUNTRY_SHOW_AS,a as COUNTRY_SHOW_AS_DEFAULT,r as COUNTRY_SHOW_AS_LABEL,n as HEADER_ROW_SHOW_AS,u as countryShowAsHasFlag,c as resolveCountryShowAs};
|
|
@@ -16,7 +16,8 @@ export interface FillRowCards {
|
|
|
16
16
|
limit?: number;
|
|
17
17
|
cards?: number;
|
|
18
18
|
}
|
|
19
|
-
export declare function fillRowCss(cls: string, gridClass: string,
|
|
19
|
+
export declare function fillRowCss(cls: string, gridClass: string, cards?: FillRowCards): string;
|
|
20
|
+
export declare function centerRowCss(cls: string, gridClass: string, cards?: FillRowCards): string;
|
|
20
21
|
export interface GridBand {
|
|
21
22
|
min?: number;
|
|
22
23
|
max?: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{breakpointOf as x}from"efficient-web-builder/format/lib/content/view-lines";function
|
|
1
|
+
import{breakpointOf as x}from"efficient-web-builder/format/lib/content/view-lines";function $(n){const o=/(?:^|\s)grid-cols-(\d+)(?=\s|$)/.exec(n);if(!o)throw new Error(`gridColumnsOf: no base grid-cols-N in "${n}"`);const e=[...n.matchAll(/(?:^|\s)(max-[\w[\]-]+):grid-cols-(\d+)(?=\s|$)/g)].flatMap(t=>{const r=x(t[1]);return r?.max?[{below:r.px,columns:Number(t[2])}]:[]}).sort((t,r)=>r.below-t.below);return{base:Number(o[1]),steps:e}}function f(n,o){return Math.max(1,Math.min(n,Math.floor(o)))}function M(n,o){return{base:f(n.base,o),steps:n.steps.map(e=>({below:e.below,columns:f(e.columns,o)}))}}const h="sf-card-tracks",w=n=>n.split(/\s+/).includes(h),b=(n,o=!1)=>o?`--sf-cols:${n}`:`grid-template-columns:repeat(${n},minmax(0,1fr))`;function T(n,o,e={}){const t=w(o);return p(n,o,e,(r,i,u)=>[`${r}{${b(u,t)}}`])}function p(n,o,{limit:e,cards:t},r){const i=$(o),u=typeof e=="number"&&e>0?e:void 0,d=Math.max(i.base,...i.steps.map(s=>s.columns));if(t!==void 0&&Math.min(t,u??1/0)>=d)return"";const a=[];for(const s of R(i)){const m=u===void 0?s.columns:f(s.columns,u),l=[];m<s.columns&&l.push(...r(`.${n}.${n}`,s.columns,m));for(let c=m-1;c>=1;c--)l.push(...r(`.${n}:not(:has(> :nth-child(${c+1})))`,s.columns,c));a.push(k(s,l))}return a.join("")}function g(n,o,e){return[`${n}{grid-template-columns:repeat(${2*o},minmax(0,1fr))}`,`${n}>*{grid-column:span 2}`,`${n}>:first-child{grid-column:${o-e+1}/span 2}`]}function A(n,o,e={}){return p(n,o,e,g)}function R({base:n,steps:o}){return[{min:o[0]?.below,max:void 0,columns:n},...o.map((e,t)=>({min:o[t+1]?.below,max:e.below,columns:e.columns}))]}function k(n,o){if(o.length===0)return"";const e=n.min!==void 0&&n.max!==void 0?`(${n.min}px <= width < ${n.max}px)`:n.max!==void 0?`(width < ${n.max}px)`:n.min!==void 0?`(width >= ${n.min}px)`:void 0;return e?`@media ${e}{${o.join("")}}`:o.join("")}export{h as CARD_TRACKS_CLASS,A as centerRowCss,M as fillRow,f as fillRowColumns,T as fillRowCss,R as gridBands,$ as gridColumnsOf,b as gridTracks,w as hasCardTracks,k as inBand};
|