efficient-storefront-blocks 0.127.0 → 0.128.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 +32 -0
- package/dist/editor/lib/document/blocks/commerce/ProductPicture/fields.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +1 -4
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/index.js +27 -27
- package/dist/render/app/globals.css +1 -1
- package/dist/render/components/GridCardTemplate.d.ts +1 -3
- package/dist/render/components/GridCardTemplate.js +1 -1
- package/dist/render/components/ProductCard.js +1 -1
- package/dist/render/components/ProductCardEyebrow.d.ts +0 -1
- package/dist/render/components/ProductCardEyebrow.js +1 -1
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/WheelCardFrame.d.ts +2 -4
- package/dist/render/components/WheelCardFrame.js +1 -1
- package/dist/render/components/card-pieces/CardPicture.d.ts +1 -12
- package/dist/render/components/card-pieces/CardPicture.js +1 -1
- package/dist/render/components/card-pieces/CardPrice.d.ts +0 -1
- package/dist/render/components/card-pieces/CardPrice.js +1 -1
- package/dist/render/components/card-pieces/CardProductBadge.js +1 -1
- package/dist/render/components/card-pieces/CardProductPicture.d.ts +0 -1
- package/dist/render/components/card-pieces/CardProductPicture.js +1 -1
- package/dist/render/components/card-pieces/CardSurfaceFrame.d.ts +1 -2
- package/dist/render/components/card-pieces/CardSurfaceFrame.js +1 -1
- package/dist/render/components/card-pieces/ProductCardState.d.ts +0 -1
- package/dist/render/components/card-pieces/ProductCardState.js +1 -1
- package/dist/render/components/card-pieces/useHeldCardPicture.d.ts +1 -3
- package/dist/render/components/card-pieces/useHeldCardPicture.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductPicture/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductPrice/render.js +1 -1
- package/dist/render/lib/sections/fill-row.d.ts +1 -9
- package/dist/render/lib/sections/fill-row.js +1 -1
- package/dist/render/lib/wheels/set-mode.d.ts +0 -15
- package/dist/render/lib/wheels/set-mode.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/dist/words.d.ts +1 -4
- package/dist/words.js +1 -1
- package/package.json +1 -1
- package/dist/render/lib/sections/grid-no-hole.d.ts +0 -17
- package/dist/render/lib/sections/grid-no-hole.js +0 -1
|
@@ -4488,7 +4488,7 @@ em.text-accent {
|
|
|
4488
4488
|
the cards wrap to the next row.
|
|
4489
4489
|
The grid's set column count stays its MAXIMUM. `--sf-cols` is that count at
|
|
4490
4490
|
this width, read from the grid's own `grid-cols-N` classes (and set lower
|
|
4491
|
-
by the fill-the-row
|
|
4491
|
+
by the fill-the-row rule, lib/sections/fill-row). The tracks
|
|
4492
4492
|
are `auto-fill`, and each track is at least the larger of:
|
|
4493
4493
|
- the view's card minimum (`--sf-card-min-*`, the numbers of
|
|
4494
4494
|
lib/sections/product-grid-columns `CARD_MIN_WIDTH_PX`), and
|
|
@@ -19,7 +19,6 @@ export interface GridCardRules {
|
|
|
19
19
|
axleSets: boolean;
|
|
20
20
|
setTotal: boolean;
|
|
21
21
|
wasFollowsSize: boolean;
|
|
22
|
-
quoteSets: boolean;
|
|
23
22
|
showSingle: boolean;
|
|
24
23
|
armOnContact: boolean;
|
|
25
24
|
}
|
|
@@ -44,7 +43,6 @@ export interface GridCardValues {
|
|
|
44
43
|
eyebrow?: GridCardEyebrow;
|
|
45
44
|
fit?: VehicleFitment | null;
|
|
46
45
|
colours?: readonly string[];
|
|
47
|
-
setGridGap?: string;
|
|
48
46
|
rules?: GridCardRules;
|
|
49
47
|
ground?: CardGround;
|
|
50
48
|
words?: CardWords;
|
|
@@ -71,7 +69,7 @@ export declare const CARD_WORDS: readonly [{
|
|
|
71
69
|
export type CardWords = (typeof CARD_WORDS)[number]["value"];
|
|
72
70
|
export declare const cardWordsOf: (v: unknown) => CardWords;
|
|
73
71
|
export declare const CARD_WORDS_OVER_CLASS = "sf-card-words-over";
|
|
74
|
-
export type GridCardRead = Required<
|
|
72
|
+
export type GridCardRead = Required<GridCardValues>;
|
|
75
73
|
export declare function useGridCard(): GridCardRead;
|
|
76
74
|
export declare function GridCardProvider({ value, children }: {
|
|
77
75
|
value: GridCardValues;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as
|
|
1
|
+
"use client";import{jsx as t,Fragment as y,jsxs as P}from"react/jsx-runtime";import{createContext as D,useContext as G,useMemo as v}from"react";import{parseOption as h}from"efficient-shell/format";import{CardRowContext as E,CardTemplateRows as p,useCardRow as L}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as k}from"efficient-web-builder/render/components/SiteGutterFrame";import{SECTION_FILL_PASS_CLASS as N}from"efficient-web-builder/format/lib/content/section-min-height";import{cardHoverOf as F}from"efficient-web-builder/format/lib/animation/hover";import{pickHoverMedia as U}from"efficient-web-builder/format/lib/content/hover-media";import W from"efficient-web-builder/render/components/HoverMediaLayer";import{NO_FIELD_ANSWERS as x}from"../lib/content/field-usage.js";import{CARD_IMAGE_SIZES as j}from"../lib/sections/card-image-sizes.js";import{productTone as $,productToneVaried as H,randomCardColour as R}from"../lib/sections/card-tone.js";import{CardLookContext as C}from"./card-pieces/card-row.js";import{CardBuyDialog as B}from"./card-pieces/CardBuyButton.js";import M from"./card-pieces/CardSurfaceFrame.js";import{BundleCardStateProvider as V,TyreCardStateProvider as z,useProductCardState as b,useWheelCardState as _,WheelCardStateProvider as Y,tyreCardProduct as K}from"./card-pieces/ProductCardState.js";import{tyrePagePath as X}from"../lib/tyres/tyre-page-path.js";import{say as q}from"efficient-web-builder/format/lib/editor-words";import{CARD_INDEX_OPTIONS as J,cardIndexCss as Q}from"efficient-web-builder/format/lib/sections/product-card-style";import{SHARED_ROWS_LIST_CLASS as Z}from"efficient-web-builder/render/lib/content/box-shared-columns";import{GAP_ZONE_CLASS as ee}from"efficient-web-builder/format/lib/content/container-gap";import{CARD_ROWS_GRID_CLASS as re,cardRowsGap as oe,cardRowsGridStyle as te}from"./WheelCardFrame.js";import{blockParts as ne}from"../lib/block-parts.js";const ae=ne("ProductCard");function Je(e){return J.map(({value:r})=>r==="off"?"":Q(e,r).replace(".sf-card-index::before",`.sf-card-index[data-format="${r}"]::before`)).join("")}function Qe(e){return e.className.includes(ee)?{className:`${e.className} ${re} ${Z}`,style:{...e.style,...te(oe(e))}}:e}const se={sale:!1,axleSets:!0,setTotal:!1,wasFollowsSize:!1,showSingle:!1,armOnContact:!1},Ze={sale:!0,axleSets:!1,setTotal:!0,wasFollowsSize:!0,showSingle:!0,armOnContact:!0},de={kindLabel:null,brand:!1,process:!0,tyreBrand:!0},ie=[],le=[{label:"Flat",value:"flat"},{label:"Soft grey",value:"soft"},{label:"Studio",value:"studio"}],ce={flat:"",soft:"sf-card-ground-soft",studio:"sf-card-ground-studio"},er=e=>h(le.map(r=>r.value),"flat",e),ue=[{label:"Under the picture",value:"under"},{label:"Over the picture",value:"over"}],rr=e=>h(ue.map(r=>r.value),"under",e),fe="sf-card-words-over",T={ownerId:"",ownerType:"ProductGrid",Template:void 0,hover:F({},"ProductGrid"),imageSizes:j,fieldUsage:x,tyreFieldUsage:x,reserveEyebrow:!1,editing:!1,eyebrow:de,fit:null,colours:ie,rules:se,ground:"flat",words:"under"},O=D(T);function f(){return G(O)}function or({value:e,children:r}){const o=v(()=>({...T,...me(e)}),[e]);return t(O.Provider,{value:o,children:r})}const me=e=>Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0));function g(e,r){const o=e.designCode??e.slug??"";return{name:e.name??"",eyebrow:e.process??"",note:"",href:e.slug?`/wheels/${e.slug}`:"",colour:$(r),colourVaried:H(r,o),colourRandom:R(o)}}function pe(e){const r=e.designCode||e.slug||"";return{name:e.name??"",eyebrow:e.brand??"",note:"",href:X(e.slug)??"",colour:"",colourVaried:"",colourRandom:R(r)}}const A=e=>`/bundles/${e.slug}`;function Ce(e){return{name:e.name,eyebrow:"",note:e.subtitle??"",href:A(e),colour:"",colourVaried:"",colourRandom:""}}const ge="sf-card sf-card-fill group relative flex flex-col bg-[var(--card-bg)] transition-colors duration-200 hover:bg-[var(--card-bg-hover)] [.sf-card-rows>&]:mb-[var(--sf-card-row-gap)]",we="sf-card group relative flex flex-col border border-line bg-bg transition-colors hover:border-accent",Se=`relative flex-1 ${N}`;function w({copy:e,href:r,label:o,kit:n=!1,probes:a,arm:d,layer:m}){const{editing:l,ground:i,words:s}=f(),c=[ce[i],s==="over"?fe:""].filter(Boolean);return t(M,{surface:n?we:[ge,...c].join(" "),href:r,label:o,linked:!l,probes:a,arm:d,layer:m,children:t("div",{className:Se,...ae("card-content"),children:t(k,{children:e})})})}const ye="var(--card-bg)";function ve(e,r=ye){const o=he();return!o||o.cover!==e||!o.media?null:t(W,{media:o.media,cover:e,ground:r})}function he(){const{hover:e}=f(),r=b();if(e.kind!=="nextImage"||!e.media||r.kind!=="wheel")return null;const o=r.sel.finish?.name,n=xe(r.wheel,o);return{cover:e.media.cover,media:U(n,e.media,o)}}function xe(e,r){const o=e.finishes?.find(a=>a.name===r),n=o?.angles?.length?o.angles:r&&r===e.defaultFinish?e.defaultFinishRenderings??[]:[];return{...e,finishes:r?[{name:r,angles:n.slice(1)}]:[]}}function Re({children:e}){const r=L(),{wheel:o,sel:n}=_(),a=n.finish?.color,d=v(()=>r?{...r,row:g(o,a)}:null,[r,o,a]);return d?t(E.Provider,{value:d,children:e}):t(y,{children:e})}function be({copy:e}){const{wheel:r,sel:o}=_(),{rules:n}=f(),a=ve("card");return P(y,{children:[t(w,{copy:t(Re,{children:e}),href:r.slug?`/wheels/${r.slug}`:"",label:r.name,probes:o.probes,arm:n.armOnContact?o.arm:void 0,layer:a}),t(B,{})]})}function I(e,r,o,n){const a=r.item;return t(Y,{wheel:a,colours:o.colours,defaultFinish:n?.[r.index],editing:o.editing,children:t(C.Provider,{value:"catalog",children:t(be,{copy:e})})})}function tr({wheels:e,finishes:r,children:o}){const n=f(),{ownerId:a,ownerType:d,Template:m,editing:l}=n;return t(p,{ownerId:a,ownerType:d,Template:m,rows:e.map(i=>g(i)),items:e,fallback:l?t(S,{}):null,wrapCopy:(i,s)=>I(i,s,n,r),children:o})}function nr({items:e,tyreOf:r,tyreFit:o}){const n=f(),{ownerId:a,ownerType:d,Template:m,editing:l}=n,i=e.map(s=>r(s));return t(p,{ownerId:a,ownerType:d,Template:m,rows:e.map((s,c)=>{const u=i[c];return u?pe(u):g(s)}),items:e,fallback:l?t(S,{}):null,wrapCopy:(s,c)=>{const u=i[c.index];return u?Te(s,K(u,o?.(u)??null),l):I(s,c,n)},children:s=>s})}function _e({copy:e}){const r=b();if(r.kind!=="tyre")throw new Error("A tyre card surface was drawn outside its tyre state.");return t(w,{copy:e,href:r.pagePath??"",label:r.tyre.name,arm:r.arm})}function Te(e,r,o){return t(z,{tyre:r,editing:o,children:t(C.Provider,{value:"catalog",children:t(_e,{copy:e})})})}function Oe(e,r){const o=r.item;return t(V,{bundle:o,children:t(C.Provider,{value:"catalog",children:t(w,{copy:e,href:A(o),label:o.name,kit:!0})})})}function ar({bundles:e,children:r}){const{ownerId:o,ownerType:n,Template:a,editing:d}=f();return t(p,{ownerId:o,ownerType:n,Template:a,rows:e.map(Ce),items:e,fallback:d?t(S,{}):null,wrapCopy:Oe,children:r})}function S(){return t("div",{"data-grid-card-empty":"",className:"p-4 text-center font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.2em] text-fg-dim",children:q("The card is empty. Add parts to its card template in Layers.")})}export{le as CARD_GROUNDS,ue as CARD_WORDS,fe as CARD_WORDS_OVER_CLASS,se as GRID_CARD_RULES,ar as GridBundleCards,or as GridCardProvider,tr as GridCards,nr as GridMixedCards,Ze as LISTING_CARD_RULES,Ce as bundleCardRow,A as bundlePagePath,er as cardGroundOf,xe as cardHoverRow,Qe as cardRowsGrid,rr as cardWordsOf,Je as gridIndexCss,g as productCardRow,pe as tyreCardRow,ve as useCardHoverLayer,f as useGridCard};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as r,Fragment as B,jsxs as N}from"react/jsx-runtime";import y from"next/image";import{useState as z}from"react";import{CARD_INDEX_BADGE_CLASS as L,CARD_INDEX_CLASS as O,DEFAULT_CARD_INDEX_FORMAT as k,DEFAULT_CARD_OUTLINE as T}from"efficient-web-builder/format/lib/sections/product-card-style";import{THEME_CARD_IMAGE_BG as U}from"efficient-web-builder/format/lib/content/card-image-background";import{cardHoverOf as G}from"efficient-web-builder/format/lib/animation/hover";import{NO_FIELD_ANSWERS as W}from"../lib/content/field-usage.js";import{GRID_CARD_SHOW as $}from"../lib/sections/card-show-defaults.js";import{CARD_IMAGE_SIZES as M}from"../lib/sections/card-image-sizes.js";import{coverSrcForWheel as j,DEFAULT_COVER_INDEX as H,resolvePaintedSrc as X}from"../lib/wheels/cover-rendering.js";import{wheelCardEyebrow as V}from"./ProductCardEyebrow.js";import{withRMark as Z}from"efficient-web-builder/render/components/RMark";import q from"./WheelPlaceholder.js";import J from"./card-pieces/CardFinishSwatches.js";import K from"./card-pieces/CardPrice.js";import Q from"./card-pieces/CardProductBadge.js";import{useHeldCardPicture as Y}from"./card-pieces/useHeldCardPicture.js";import{useWheelCardState as ee,WheelCardStateProvider as re}from"./card-pieces/ProductCardState.js";import{CardSpecFacts as oe}from"./card-pieces/CardSpecs.js";import se from"./WheelCardFrame.js";import{cardSpinOf as ae}from"./card-spin.js";const ie=G({},"ProductGrid"),te={imageBackgroundFill:U,hover:ie,coverIndex:H,indexBadge:k,outline:T,showBadge:!0,fieldUsage:W,reserveEyebrow:!1,showCardPrice:!0,showCardFinishes:!0,showCardSizes:$.showCardSizes,imageSizes:M};function ne({wheel:t,variant:o="compact",defaultFinish:e}){return r(re,{wheel:t,defaultFinish:e,children:r(de,{variant:o})})}function de({variant:t}){const{wheel:o,sel:e}=ee(),{imageBackgroundFill:f,hover:p,coverIndex:u,indexBadge:d,outline:w,showBadge:S,fieldUsage:l,reserveEyebrow:C,showCardPrice:g,showCardFinishes:E,showCardSizes:_,imageSizes:c}=te,F=j(o,u,e.finish?.name,e.shownSrc),D="h-full w-full",n=ae(p),[m,A]=z(()=>new Set),h=s=>{e.pictureFailed(s),A(a=>a.has(s)?a:new Set(a).add(s))},R=X({overrideSrc:F,hookSrc:e.shownSrc,failed:m}),b=(s,a)=>r(y,{alt:a,src:s,width:1e3,height:1e3,sizes:c,className:`block object-contain ${n.className} ${D}`,style:n.style,draggable:!1,onError:()=>h(s)},s),I=e.finish?`${o.name} — ${e.finish.name}`:o.name,i=Y({src:R,alt:I,sizes:c,failed:m,onFailed:h,near:e.nearScreen,holdEmpty:e.awaitingProbe}),P=N(B,{children:[i.src?b(i.src,i.alt):r(q,{imageLabel:o.name,spin:n}),i.trial]}),v=V({kindLabel:null,brand:null,process:o.process?Z(o.process):null},l),x=d!=="off"?r("span",{"aria-hidden":!0,className:`${O} ${L}`}):null;return r(se,{variant:t,href:`/wheels/${o.slug}`,outline:w,imageBackgroundFill:f,probes:e.probes,reserveEyebrow:C,indexBadge:x,badges:r(Q,{show:S,numbered:d!=="off",axleSets:!0}),image:P,eyebrow:v,spec:r(oe,{sizes:_,fieldUsage:l}),price:r(K,{show:g}),swatches:r(J,{show:E})})}export{ne as default};
|
|
@@ -11,4 +11,3 @@ export declare function wheelCardEyebrow({ kindLabel, brand, process, }: {
|
|
|
11
11
|
brand: ReactNode | null;
|
|
12
12
|
process: ReactNode | null;
|
|
13
13
|
}, answers: readonly FieldUsageAnswer[]): ReactNode | null;
|
|
14
|
-
export declare function withSetChip(eyebrow: ReactNode | null): ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as u,Fragment as c,jsxs as p}from"react/jsx-runtime";import{COLLECTION_FIELD_KEY as s,keepForCard as l}from"../lib/content/field-usage.js";function a(r,e){return!r&&!e?null:p(c,{children:[r&&u("span",{className:"text-fg",children:r}),r&&e?u("span",{className:"mx-2 text-fg-dim",children:"·"}):null,e]})}function f(r,e){const n=l(e);return r.kind||r.brand&&n("brand")?!0:r.process&&n(s)}function i({kindLabel:r,brand:e,process:n},t){if(!f({kind:!!r,brand:!!e,process:!!n},t))return null;const o=l(t);return a(r,o("brand")?e:null)??(o(s)?n:null)}export{a as productCardEyebrow,i as wheelCardEyebrow,f as wheelCardEyebrowShows};
|
|
@@ -1 +1 @@
|
|
|
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
|
+
"use client";import{jsx as e,jsxs as u,Fragment as rt}from"react/jsx-runtime";import{useScopeClass as it}from"../lib/use-scope-class.js";import{useEffect as V,useMemo as f,useState as nt}from"react";import{cardHoverOf as at}from"efficient-web-builder/format/lib/animation/hover";import{containerGapProps as st}from"efficient-web-builder/format/lib/content/container-gap";import ot from"next/link";import{cardRowsGrid as lt,GridCardProvider as dt,GridMixedCards as mt,gridIndexCss as ct}from"./GridCardTemplate.js";import{gridClassImageSizes as pt}from"../lib/sections/card-image-sizes.js";import{centerRowCss as gt,fillRowCss as ut,hiddenCardsRule as ft}from"../lib/sections/fill-row.js";import{answersForKind as de,NO_FIELD_ANSWERS as me}from"../lib/content/field-usage.js";import{wheelCardEyebrowShows as ht}from"./ProductCardEyebrow.js";import xt from"./NoCurrencyNote.js";import{SITE_WIDTH_CAP as wt,centredCap as vt,withSideOnce as ce}from"efficient-web-builder/format/lib/content/page-width";import{ProductCatalogProvider as yt,SectionWheelsProvider as bt}from"./ProductRef.js";import{useCurrency as Ct}from"./CurrencyContext.js";import{FRAME_ROOM_PRODUCT_GRID as St,FRAME_ROOM_PRODUCT_GRID_PHONE as Mt,framedBandPad as Pt,PRODUCT_GRID_ROOM as Tt,withBandClasses as _t}from"../lib/sections/band-padding.js";import{COLLECTION_ATTR as Ot,useCatalogFilter as Rt}from"./catalog/CatalogFilterContext.js";import{useShopperMember as Et}from"./catalog/ShopperScope.js";import{useBrowserLayoutEffect as Nt}from"efficient-shell/hooks";import $t from"./wheels-plp/PlpPagination.js";import{CATALOG_TEXT_SIZE as zt}from"../lib/sections/catalog-text-size.js";import{applyShopperFilters as It,hasActivePlpFilters as At,plpPricedAmounts as Lt}from"../lib/wheels/plp-filters.js";import Gt from"./catalog/ClearAllButton.js";import{GRID_TOP_UP_SPARE as Ft,gridPagingOf as Bt,gridShownOf as Dt}from"../lib/sections/product-grid-pages.js";import kt from"./SectionBand.js";import{useInsideBox as Ut,useInsideSiteGutter as Ht}from"efficient-web-builder/render/components/SiteGutterFrame";import{productGridColumnsClass as jt}from"../lib/sections/product-grid-columns.js";import{renderGold as q,renderHeadline as Wt}from"efficient-web-builder/render/components/goldPhrases";import{applyCatalogFilters as Kt}from"../lib/wheels/catalog-filters.js";import{normalizeCatalogRows as Xt}from"../lib/wheels/wheel-summary-casing.js";import{itemKind as J,plpKindNoun as pe}from"../lib/catalog/plp-item.js";import{filterBarCategoryOf as Zt,gridKindsOf as ge,gridRowsOf as Yt}from"../lib/wheels/grid-source.js";import{useUnifiedProductCatalog as Vt}from"./useProductCatalog.js";import{STICKY_UNDERHEADER_CLASS as qt}from"efficient-web-builder/render/lib/document/header-clearance";import{finishFamiliesOf as Jt}from"../lib/wheels/finish-defaults.js";import{lugCountsOf as Qt}from"../lib/wheels/lug-count.js";import{diametersOf as er}from"../lib/wheels/size-range.js";import{say as tr}from"efficient-web-builder/format/lib/editor-words";import{DEFAULT_TITLE_SIZE as rr}from"../lib/sections/product-grid-title.js";import{blockParts as ir}from"../lib/block-parts.js";import{PRODUCT_GRID_TYPE as nr}from"../lib/document/document-nodes.js";import{useSideSpaceOnce as ar}from"efficient-web-builder/render/components/SideSpaceOnce";const o=ir(nr),sr=at({},"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)]"},ue=[{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 or(d){return(ue.find(l=>l.value===d)??ue.find(l=>l.value===rr)).cls}const ei=[{label:"Fill the row",value:"fill"},{label:"Keep card width",value:"keep"},{label:"Center the row",value:"center"}],lr=(d,...l)=>d==="keep"?"":d==="center"?gt(...l):ut(...l);function dr({num:d,catalog:l,catalogTotal:fe,firstCountInChips:he=!1,kinds:_,title:I,titleSize:xe,pads:we,noTop:Q=!1,description:O,link:C,products:ve,wheels:ye,source:m,columns:be,columnsPhone:Ce,columnsTablet:Se,limit:Me,moreProducts:Pe,perPage:Te,editing:S,contentCapped:_e=!1,hover:Oe,fieldUsage:h,ownerId:Re="",template:Ee,fewCards:Ne="fill",cardGround:$e="flat",cardWords:ze="under",gap:Ie,gapPhone:Ae}){const ee=ar(),A=f(()=>h?de(h,"alloy-wheel"):void 0,[h]),Le=f(()=>h?de(h,"tyre"):void 0,[h]),t=it("pg"),{paged:x,per:w,limit:M,cap:v}=Bt({moreProducts:Pe,perPage:Te,limit:Me}),R=jt(be,Ce,Se),te=_e,Ge=Ht(),Fe=Ut(),Be=Ge||Fe,L=Vt(S===!0&&!!m),n=f(()=>m?Xt(Yt(m,_,L??l??[])):null,[l,L,m,_]),G=Et("grid",n),a=n?G.scope:null,c=Zt(m),y=c!==null&&!a,{filters:E,reportCount:F,reportLugs:B,reportSizes:D,reportFinishes:k,reportCategories:U,reportPrices:H,vehicle:re}=Rt(),{currency:p}=Ct(),j=y&&!!E.process&&E.process!==c,W=a?.state,r=f(()=>n?W?It(n,W,p):y?Kt(n,E,p,re.fit):n:null,[n,W,y,E,p,re.fit]),[De,ke]=nt(1),K=x&&r?Math.max(1,Math.ceil(r.length/w)):1,b=Math.min(K,Math.max(1,a?a.state.page:De)),{reportShown:X}=G,ie=a!==null;Nt(()=>{if(!ie||!r)return X(null);X(Dt(r.length,{paged:x,per:w,cap:v},b))},[ie,r,X,x,b,w,v]);const Ue=s=>a?a.update({page:s}):ke(s),g=f(()=>r&&(x?r.slice((b-1)*w,b*w):v?r.slice(0,Math.ceil(M)+Ft):r),[x,v,M,r,b,w]);V(()=>(U(t,c===null?[]:[c]),()=>U(t,[])),[c,U,t]),V(()=>{if(y)return F(t,j?0:r?.length??0),()=>F(t,0)},[y,j,r,F,t]);const P=f(()=>({lugs:Qt(n??[]),sizes:er(n??[]),finishes:Jt(n??[]),prices:Lt((n??[]).filter(s=>J(s)!=="tyre"),p)}),[n,p]);V(()=>(B(t,P.lugs),D(t,P.sizes),k(t,P.finishes),H(t,P.prices),()=>{B(t,[]),D(t,[]),k(t,[]),H(t,[])}),[P,B,D,k,H,t]);const Z=st("ProductGrid",Ie,"both",Ae),He=`${t} grid${Z.className} bg-[var(--catalog-grid-bg)] ${R}`,ne=lt(Z),je=`${t} grid${ne.className} bg-[var(--catalog-grid-bg)] ${R}`,We=ne.style,Ke=f(()=>{const s=(r??[]).filter(T=>J(T)!=="tyre");if(s.length===0)return!1;const tt=s.some(T=>!!T.process);return s.some(T=>!!T.setWords)||ht({kind:!1,brand:!1,process:tt},A??[])},[r,A]),Xe=g?g.length>0?e("div",{className:je,style:We,...o("grid"),children:e(mt,{items:g,tyreOf:s=>J(s)==="tyre"?s:null})}):a&&At(a.state)?u("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 bg-surface-2 p-4 text-center",...o("grid-empty"),children:[e("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:`No ${pe(ge(m,_)).many} match those filters`}),e(Gt,{onClick:a.clear})]}):S?e("div",{className:"flex min-h-[320px] items-center justify-center rounded bg-surface-2 p-4 text-center",...o("grid-empty"),children:e("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:tr("No products in “{name}” yet",{name:m?.name??""})})}):null:e(ve,{className:He,style:Z.style,minEmptyHeight:320}),Ze=a?a.countInChips:he,N=r&&!Ze?r===n&&!L?fe??r.length:r.length:null,ae=pe(ge(m,_)),Ye=d||I||O||C?u("div",{className:ce(`${qt} 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 ${te||Be?"":"-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))]"}`,ee),...o("grid-head"),children:[u("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:[d&&e("span",{className:`font-mono ${i.labelLarge} leading-none uppercase tracking-[0.22em] text-fg-dim`,...o("grid-number"),children:q(d)}),I&&e("h2",{className:`${or(xe)} leading-none text-fg max-view-wide:leading-[1] [&>span]:block`,...o("heading"),children:Wt(I,!1)})]}),(O||C||N!==null)&&u("div",{className:"flex items-center gap-5 max-view-wide:gap-3 view-wide:grow view-wide:justify-end",children:[O&&e("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`,...o("description"),children:q(O)}),C&&u(ot,{href:C.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`,...o("view-all"),children:[q(C.text),e("span",{"aria-hidden":!0,children:"→"})]}),N!==null&&u("span",{className:`whitespace-nowrap font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,...o("count"),children:[N," ",N===1?ae.one:ae.many]})]})]}):null,$=Pt(we,Tt,{noTop:Q}),{paddingTop:Ve,...qe}=$.style,z=Q?0:Ve,Je={...z===void 0?{}:{"--pg-pt":typeof z=="number"?`${z}px`:z},...qe},Qe=g?v?Math.min(g.length,M):g.length:void 0,se=lr(Ne,t,R,{limit:M,cards:g?.length}),oe=ct(t),le=u(rt,{children:[v&&e("style",{children:ft(t,M+1)}),se&&e("style",{children:se}),oe&&e("style",{children:oe}),Ye,Xe,x&&K>1&&e($t,{textSize:zt.labelSmall,page:b,pageCount:K,onPage:Ue}),e(xt,{editing:S})]});if(j)return null;const Y=e(kt,{rootRef:G.ref,attrs:{...y&&c!==null?{...$.attrs,[Ot]:c}:$.attrs,...o("product-grid-block")},className:_t(ce(`relative z-[2] bg-bg px-[var(--sf-site-gutter,40px)] ${St} max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))] ${Mt}`,ee),$),column:null,inAnyBox:!0,style:Je,defaults:{"--pg-pt":"120px"},children:te?e("div",{style:vt(wt),children:le}):le}),et=n?Y:S?e(yt,{currency:p,children:Y}):e(bt,{wheels:ye,currency:p,children:Y});return e(dt,{value:{ownerId:Re,Template:Ee,hover:Oe??sr,imageSizes:pt(R,Qe),fieldUsage:A??me,tyreFieldUsage:Le??me,reserveEyebrow:Ke,editing:S===!0,ground:$e,words:ze},children:et})}export{ei as FEW_CARDS,ue as TITLE_SIZES,dr as default};
|
|
@@ -5,11 +5,10 @@ export declare const cardRowsGridStyle: (rowGap: string) => CSSProperties;
|
|
|
5
5
|
export declare const cardRowsGap: (zone: {
|
|
6
6
|
style: CSSProperties;
|
|
7
7
|
}) => string;
|
|
8
|
-
export
|
|
8
|
+
export declare const CARD_PAD_X_PX = 32;
|
|
9
9
|
export { CARD_SPEC_FIELD_CLASS, cardSpecFields, type CardSpecField } from "./card-pieces/CardSpecs.js";
|
|
10
|
-
export default function WheelCardFrame({ variant,
|
|
10
|
+
export default function WheelCardFrame({ variant, href, outline, imageBackgroundFill, probes, indexBadge, badges, image, eyebrow, reserveEyebrow, spec, price, swatches, }: {
|
|
11
11
|
variant?: "compact" | "catalog";
|
|
12
|
-
wide?: boolean;
|
|
13
12
|
href: string;
|
|
14
13
|
outline?: CardOutline;
|
|
15
14
|
imageBackgroundFill?: string;
|
|
@@ -17,7 +16,6 @@ export default function WheelCardFrame({ variant, wide, href, outline, imageBack
|
|
|
17
16
|
indexBadge?: ReactNode;
|
|
18
17
|
badges?: ReactNode;
|
|
19
18
|
image: ReactNode;
|
|
20
|
-
imageSecond?: ReactNode;
|
|
21
19
|
eyebrow?: ReactNode;
|
|
22
20
|
reserveEyebrow?: boolean;
|
|
23
21
|
spec?: ReactNode;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,Fragment as t,jsxs as s}from"react/jsx-runtime";import{GAP_LENGTH_VAR as
|
|
1
|
+
"use client";import{jsx as r,Fragment as t,jsxs as s}from"react/jsx-runtime";import{GAP_LENGTH_VAR as S,GAP_PHONE_LENGTH_VAR as G}from"efficient-web-builder/format/lib/content/container-gap";import{CardLookContext as F,CardRow as e}from"./card-pieces/card-row.js";import P from"./card-pieces/CardSurfaceFrame.js";import y from"./card-pieces/CardEyebrow.js";import D from"./card-pieces/CardName.js";import E from"./card-pieces/CardPicture.js";import{CardSpecLine as L}from"./card-pieces/CardSpecs.js";import{useProductCardState as j}from"./card-pieces/ProductCardState.js";import{cardOutlineClass as k}from"efficient-web-builder/format/lib/sections/product-card-style";import{CARD_IMAGE_BG_OFF as N}from"efficient-web-builder/format/lib/content/card-image-background";const K="sf-card-rows",Q=o=>({rowGap:0,"--sf-card-row-gap":o}),U=o=>G in o.style?"var(--sf-card-row-gap-auto)":`var(${S})`,Y=32;import{CARD_SPEC_FIELD_CLASS as or,cardSpecFields as ar}from"./card-pieces/CardSpecs.js";function O({variant:o="catalog",href:c,outline:d="none",imageBackgroundFill:i=N,probes:n,indexBadge:l,badges:f,image:m,eyebrow:p,reserveEyebrow:g=!1,spec:u,price:w,swatches:C}){const _=o==="catalog",a=j(),b=a.kind==="wheel"?a.wheel.name:a.kind==="tyre"?a.tyre.name:a.bundle.name,h=r(E,{image:m,imageBackgroundFill:i}),v=[_?"sf-card sf-card-fill group relative flex min-h-[460px] flex-col bg-[var(--card-bg)] px-8 pt-8 pb-8 transition-colors duration-200 hover:bg-[var(--card-bg-hover)] [.sf-card-rows>&]:row-span-9 [.sf-card-rows>&]:mb-[var(--sf-card-row-gap)] [.sf-card-rows>&]:grid [.sf-card-rows>&]:grid-rows-subgrid [.sf-card-rows>&]:gap-y-0":"sf-card sf-card-fill group relative block bg-[var(--card-bg)] p-5 transition-colors duration-300 hover:bg-[var(--card-bg-hover)]",k(d)].filter(Boolean).join(" "),x=s(t,{children:[h,r(y,{reserve:g,children:p}),r(D,{})]}),A=s(t,{children:[r(L,{children:u}),w??s(t,{children:[r(e,{}),r(e,{})]}),C??r(e,{}),r(e,{}),r(e,{})]});return(R=>r(F.Provider,{value:o,children:R}))(s(P,{surface:v,href:c,label:b,probes:n,children:[l,f,x,A]}))}export{Y as CARD_PAD_X_PX,K as CARD_ROWS_GRID_CLASS,or as CARD_SPEC_FIELD_CLASS,U as cardRowsGap,Q as cardRowsGridStyle,ar as cardSpecFields,O as default};
|
|
@@ -1,19 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
export declare const setPlateWidthCss: (gap: number | string) => string;
|
|
3
|
-
export declare const GRID_GAP_PX = 2;
|
|
4
|
-
export declare const CARD_PAD_X_PX = 32;
|
|
5
|
-
export declare const setBandGapPx: (showImageBackground: boolean) => number;
|
|
6
|
-
export declare const setBandGapCss: (showImageBackground: boolean, gridGap?: string) => string;
|
|
7
|
-
export declare const SET_PLATE_PX = 252;
|
|
8
|
-
export declare const SET_STACK_GAP_PX = 16;
|
|
9
|
-
export declare const SET_STACK_MAX_PX: 800;
|
|
10
2
|
export interface CardPictureSettings {
|
|
11
3
|
image: ReactNode;
|
|
12
|
-
imageSecond?: ReactNode;
|
|
13
4
|
plate?: ReactNode;
|
|
14
|
-
wide?: boolean;
|
|
15
5
|
imageBackgroundFill?: string;
|
|
16
|
-
setGridGap?: string;
|
|
17
6
|
shadowed?: boolean;
|
|
18
7
|
}
|
|
19
|
-
export default function CardPicture({ image,
|
|
8
|
+
export default function CardPicture({ image, plate, imageBackgroundFill, shadowed, }: CardPictureSettings): import("react").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{
|
|
1
|
+
"use client";import{jsxs as i}from"react/jsx-runtime";import{CARD_IMAGE_BG_OFF as n,cardImageBackgroundPaints as f,THEME_CARD_IMAGE_BG as g}from"efficient-web-builder/format/lib/content/card-image-background";import{useCatalogCard as p}from"./card-row.js";import{blockParts as u}from"../../lib/block-parts.js";const l=u("ProductCard");function b({image:a,plate:s,imageBackgroundFill:e=n,shadowed:t=!1}){const c=p(),r=f(e),o=r&&e===g,m=o?"bg-[var(--wheel-stage)] p-2":r?"p-2":"",d=r&&!o?{backgroundColor:e}:{};return c?i("div",{className:`relative mt-2 mb-5 flex aspect-square items-center justify-center ${t?"overflow-visible":"overflow-hidden"} [&_img]:object-top ${m}`,style:{...d,borderRadius:"var(--sf-card-image-radius, 10px)"},...l("image-frame"),children:[a,s]}):i("div",{className:`relative mb-5 aspect-square ${t?"overflow-visible":"overflow-hidden"} bg-bg p-8 [&_img]:object-top`,style:{borderRadius:"var(--sf-card-image-radius, 10px)"},...l("image-frame"),children:[a,s]})}export{b as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as r,jsxs as a,Fragment as x}from"react/jsx-runtime";import{formatPrice as v}from"../../lib/commerce.js";import{say as N}from"efficient-web-builder/format/lib/editor-words";import{HideTaker as u}from"efficient-web-builder/render/components/ViewHideRoot";import{setLabel as k}from"../../lib/wheels/variants.js";import{wheelCardPriceLine as w}from"../../lib/wheels/set-mode.js";import{bundlePrice as R,EACH_UNIT as S,formatSelectionPrice as y,formatSelectionWasPrice as L,formatWheelPrice as T,formatWheelWasPrice as W,FROM_PREFIX as p,FROM_PREFIX_START as C,priceIn as _,resolveWheelPrice as g}from"../../lib/wheels/price-display.js";import{CARD_TEXT_SIZE as s,CardRow as b}from"./card-row.js";import{RegionBridge as F,RegionWords as z,regionAttr as E}from"./card-text-region.js";import{useHeroStateOrNull as I,useProductCardState as $}from"./ProductCardState.js";import{useTaxNote as P}from"./useTaxNote.js";import{blockParts as j}from"../../lib/block-parts.js";const f=j("ProductCard"),te=["from","From"];function B(e,n){return n==="From"&&e.startsWith(p)?C+e.slice(p.length):e}function O(e,n){if(e.kind==="tyre"){const c=g(_(e.tyre.prices,e.currency),null);return{was:null,amount:T(c,e.currency,p),note:c.priced?S:null,priced:c.priced}}const{wheel:t,currency:o,price:i,sel:l}=e,m=g(t.prices[o],t.msrpPrices?.[o]),d=n.setTotal&&i.priced&&i.setTotal!=null&&l.selectedVariant?`${k(l.selectedVariant)} · ${v(i.setTotal,o)}`:null;return{was:n.wasFollowsSize?L(i,o):W(m,o),amount:w(y(i,o),i.priced),note:d,priced:i.priced}}function A({state:e,region:n}){const t=P(),o=a(u,{className:"flex items-baseline gap-5 border-t border-line pt-[18px]",children:[e.msrpLabel&&r("div",{className:"font-mono text-[length:var(--size-label,15px)] text-fg-dim line-through",children:e.msrpLabel}),r("div",{className:"font-heading2 text-[length:min(var(--size-headingMedium,36px),var(--sf-heading-max,9999px))] font-bold leading-none tracking-[-0.01em] text-fg",...E(n,"price"),children:r(z,{region:n,at:"price",children:e.amount})}),e.unitLabel&&r("div",{className:"font-mono text-[length:var(--size-label,13px)] font-semibold uppercase tracking-[0.22em] text-fg",children:e.unitLabel}),e.unitLabel&&t&&r("div",{className:"font-mono text-[length:var(--size-label,13px)] text-fg-dim","data-tax-note":"",children:t}),e.packBadge&&r("div",{className:"ml-auto border border-accent px-3 py-2 font-mono text-[length:var(--size-label,13px)] font-bold uppercase tracking-[0.18em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)"},children:e.packBadge})]});return r(F,{region:n,sectionType:"ProductPrice",children:o})}function H({show:e=!0,region:n,...t}){const o=I();return o?r(A,{state:o,region:n}):r(X,{show:e,...t})}function M({state:e,show:n}){if(!n)return null;const t=R(e.bundle,e.currency);return a(x,{children:[t&&a(u,{className:`mt-1 font-mono ${s.labelLarge}`,...f("price"),children:[r("span",{className:"mr-2 text-fg-dim line-through",children:t.was}),t.amount]}),!e.bundle.inStock&&r(u,{className:`mt-1 font-mono ${s.labelSmall} uppercase tracking-[0.24em] text-fg-dim`,children:N("Currently unavailable")})]})}function X({show:e=!0,...n}){const t=$(),o=P();if(t.kind==="bundle")return r(M,{state:t,show:e});const i=O(t,n),{was:l,note:m,priced:d}=i,c=B(i.amount,n.priceWord),h=[m,d?o:null].filter(Boolean).join(" · ")||null;return a(x,{children:[r(b,{children:e?a("div",{className:`mt-2 font-mono ${s.labelLarge}`,...f("price"),children:[l&&r("span",{className:"mr-2 text-fg-dim line-through",children:l}),c]}):null}),r(b,{children:e&&h?r("div",{className:`mt-[2px] font-mono ${s.labelSmall} tracking-[0.08em] text-fg-dim`,...f("price-note"),children:h}):null})]})}export{te as PRICE_WORDS,H as default,B as withPriceWord};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import{Fragment as h}from"react";import{CARD_TEXT_SIZE as m,useCatalogCard as _}from"./card-row.js";import{bundleSaving as A}from"../../lib/commerce.js";import{useProductCardState as B}from"./ProductCardState.js";import{blockParts as C}from"../../lib/block-parts.js";const a=C("ProductCard"),D=`border px-2 py-1 font-mono ${m.labelSmall} uppercase tracking-[0.3em]`,g="absolute right-[18px] top-[18px] z-10",v="absolute left-0 top-4 z-10 pointer-events-none flex flex-col items-start gap-1",N="absolute left-0 top-[52px] z-10 pointer-events-none flex flex-col items-start gap-1",w=`bg-accent px-3 py-2 font-mono ${m.labelSmall} uppercase tracking-[0.24em] text-bg`;function c({tone:o,children:t}){return e("span",{className:[D,o==="solid"?"border-accent bg-accent text-bg":"border-accent text-accent"].join(" "),...a("badge"),children:t})}function G({show:o=!0,sale:t=!1,numbered:s=!1,axleSets:x=!1,edge:u=!1,setFlags:E=!0}){const l=B();if(!_()||l.kind==="tyre")return null;if(l.kind==="bundle"){const n=A(l.bundle,l.currency);return n&&u?e(b,{flags:[n]}):n?e("div",{className:`${g} pointer-events-none flex flex-col items-end gap-1`,...a("badges"),children:e(c,{tone:"solid",children:n})}):null}const{wheel:S,price:p}=l,i=E&&x?l.setWords:null,r=o?S.badge:null,f=[t&&p.onSale?e(c,{tone:"solid",children:"Sale"}):null,i?e(c,{tone:"outline",children:i}):r?e(c,{tone:r==="new"?"solid":"outline",children:r==="new"?"New":"Bestseller"}):null].filter(Boolean);if(u){const n=[t&&p.onSale?"Sale":null,i??(r?r==="new"?"New":"Bestseller":null)].filter(d=>!!d);return n.length?e(b,{flags:n,numbered:s}):null}return f.length>0?e("div",{className:`${g} pointer-events-none flex flex-col items-end gap-1`,...a("badges"),children:f.map((n,d)=>e(h,{children:n},d))}):null}function b({flags:o,numbered:t=!1}){return e("div",{className:t?N:v,...a("badges"),children:o.map(s=>e("span",{className:w,...a("badge"),children:s},s))})}export{G as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as d,Fragment as
|
|
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,7 +1,6 @@
|
|
|
1
1
|
import type { ReactNode } from "react";
|
|
2
|
-
export default function CardSurfaceFrame({ surface,
|
|
2
|
+
export default function CardSurfaceFrame({ surface, href, label, linked, probes, arm, layer, children, }: {
|
|
3
3
|
surface: string;
|
|
4
|
-
span?: string;
|
|
5
4
|
href: string;
|
|
6
5
|
label: string;
|
|
7
6
|
linked?: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as _,jsxs as p}from"react/jsx-runtime";import d from"next/link";import{HideTaker as T}from"efficient-web-builder/render/components/ViewHideRoot";import{PHOTO_HOST_ATTR as S}from"efficient-web-builder/format/lib/content/image-treatment";import{BOX_LINK_ATTR as L,BOX_LINK_CLASS as N,BOX_LINKED_CLASS as O}from"efficient-web-builder/format/lib/content/box-link";import{blockParts as j}from"../../lib/block-parts.js";const s=j("ProductCard");function x({surface:e,href:r,label:n,linked:c=!0,probes:i,arm:o,layer:t,children:l}){const a=c&&!!r,m=[e,a?O:""].filter(Boolean).join(" "),u=o?{onPointerEnter:o,onTouchStart:o,onFocusCapture:o}:{},f=t?{[S]:""}:{};return p(T,{as:"article",className:m,...f,...u,...s("card"),children:[i,a?_(d,{href:r,"aria-label":n,className:N,[L]:"",...s("card-link")}):null,l,t]})}export{x as default};
|
|
@@ -13,7 +13,6 @@ export interface WheelCardState {
|
|
|
13
13
|
readonly sel: PlpCardSelection;
|
|
14
14
|
readonly currency: string;
|
|
15
15
|
readonly price: SelectionPriceDisplay;
|
|
16
|
-
readonly isSet: boolean;
|
|
17
16
|
readonly setWords: string | null;
|
|
18
17
|
readonly editing: boolean;
|
|
19
18
|
readonly notifyOpen: boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as d}from"react/jsx-runtime";import{createContext as L,useCallback as O,useContext as h,useMemo as z,useState as v}from"react";import{useCurrency as x}from"../CurrencyContext.js";import{useTyreDetail as N}from"../useTyreDetail.js";import{usePlpCardSelection as A}from"../wheels-plp/usePlpCardSelection.js";import{tyrePagePath as B}from"../../lib/tyres/tyre-page-path.js";import{canOrderTyreVariant as D}from"../../lib/tyres/tyre-purchase.js";import{resolveSelectionPrice as T}from"../../lib/wheels/price-display.js";import{setBuildLabel as W,summarySetBuild as j}from"../../lib/wheels/set-mode.js";import{useCurrentProduct as E}from"../../lib/document/current-product.js";function Q(e,r=null){return{brand:e.brand,brandLogo:e.brandLogo,name:e.name,treadPattern:e.treadPattern,slug:e.slug,sizes:e.sizes,fitSize:r,rimDiameters:e.rimDiameters,prices:e.prices,image:e.coverImage}}const n=L(null);function H(){const e=h(n);return e?.kind==="hero"?e:null}function X(){const e=H(),r=E();return e?{product:e.product,selection:e.selection,openLightbox:e.openLightbox}:r?{product:r.product,selection:r.selection,openLightbox:r.openLightbox}:null}function Y({value:e,children:r}){return d(n.Provider,{value:e,children:r})}function R(){const e=h(n);if(!e||e.kind==="hero")throw new Error("A product card piece was drawn outside a product card (no ProductCardState).");return e}function Z(){const e=h(n);return e?.kind==="hero"?null:e}function ee(){const e=R();if(e.kind!=="wheel")throw new Error(`A wheel card piece was drawn on a ${e.kind} card.`);return e}const V=[];function re({wheel:e,colours:r=V,defaultFinish:o,editing:a=!1,children:c}){const{currency:t}=x(),s=A(e,r,o),[l,p]=v(!1),f=j(e),u={kind:"wheel",wheel:e,sel:s,currency:t,price:T(e,s.selectedVariant,t,1),setWords:W(f),editing:a,notifyOpen:l,setNotifyOpen:p};return d(n.Provider,{value:u,children:c})}function te({bundle:e,children:r}){const{currency:o}=x(),a={kind:"bundle",bundle:e,currency:o};return d(n.Provider,{value:a,children:r})}function ne({tyre:e,currency:r,editing:o=!1,children:a}){const{currency:c}=x(),{slug:t}=e,s=B(t),[l,p]=v(!1),f=O(()=>{t&&p(!0)},[t]),{state:u,tyre:m}=N(t??null,l),i=z(()=>m?.variants??[],[m]),[S,g]=v(null),b=i.length===1?i[0].size:null,y=S??b,P=i.find(w=>w.size===y),C=u==="ready",k={kind:"tyre",tyre:e,currency:r??c,activeCurrency:c,pagePath:s,arm:f,detailState:u,detail:m,variants:i,chosen:y,setSize:g,variant:P,canAdd:P!=null&&D(P,c),detailReady:C,unsellable:!s||u==="error"||C&&i.length===0,editing:o};return d(n.Provider,{value:k,children:a})}export{te as BundleCardStateProvider,Y as HeroStateProvider,ne as TyreCardStateProvider,re as WheelCardStateProvider,Q as tyreCardProduct,H as useHeroStateOrNull,X as useNearestProduct,R as useProductCardState,Z as useProductCardStateOrNull,ee as useWheelCardState};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { type ReactNode } from "react";
|
|
2
|
-
export declare function useHeldCardPicture({ src,
|
|
2
|
+
export declare function useHeldCardPicture({ src, alt, sizes, failed, onFailed, near, holdEmpty, }: {
|
|
3
3
|
src: string | null;
|
|
4
|
-
second?: string | null;
|
|
5
4
|
alt: string;
|
|
6
5
|
sizes: string;
|
|
7
6
|
failed: ReadonlySet<string>;
|
|
@@ -11,6 +10,5 @@ export declare function useHeldCardPicture({ src, second, alt, sizes, failed, on
|
|
|
11
10
|
}): {
|
|
12
11
|
src: string | null;
|
|
13
12
|
alt: string;
|
|
14
|
-
second: string | null;
|
|
15
13
|
trial: ReactNode;
|
|
16
14
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as O}from"react/jsx-runtime";import{useEffect as k,useRef as d,useState as a}from"react";import{ClippedPictures as D}from"./ClippedPictures.js";import{decodePhotoAt as F,STAGE_HOLD_LIMIT_MS as G,useStagePhotoHold as R}from"../product-hero/stage-photo.js";import{holdSignedUrl as U}from"../../lib/wheels/signed-url.js";function N({src:e,alt:l,sizes:w,failed:g,onFailed:E,near:n,holdEmpty:H=!1}){U(e);const[j]=a(e),[f,v]=a(!1);!f&&e!==j&&v(!0);const o=d(e),P=d(new Map);e&&P.current.set(e,l);const[S,L]=a([]),s=d(new Map),M=t=>{for(const r of s.current.get(t)??[])r();s.current.delete(t),L(r=>r.filter(p=>p!==t))},T=d(null);T.current=n?e:null;const A=t=>F(t,w).catch(r=>{if(t!==T.current)throw r;return new Promise(p=>{s.current.set(t,[...s.current.get(t)??[],p]),L(h=>h.includes(t)?h:[...h,t])})}),m=!e&&H&&!!o.current&&!g.has(o.current),[C,_]=a(!1);k(()=>{if(!m){_(!1);return}const t=setTimeout(()=>_(!0),G);return()=>clearTimeout(t)},[m]);const c=e??(m&&!C?o.current:null),b=R(f&&n&&c?[c]:[],n?c??void 0:void 0,A),i=n?b.drawn:c??void 0,I=!o.current&&f&&n&&!!i&&!b.settled,u=i&&!g.has(i)&&!I?i:null;o.current=u;const x=S.length>0?O(D,{pictures:S.map(t=>({src:t,sizes:w,onLoad:()=>M(t),onError:()=>{E(t),M(t)}}))}):null;return u?{src:u,alt:P.current.get(u)??l,trial:x}:{src:null,alt:l,trial:x}}export{N as useHeldCardPicture};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as o,jsxs as l,Fragment as fe}from"react/jsx-runtime";import{useScopeClass as ct}from"../../lib/use-scope-class.js";import{useCallback as m,useEffect as at,useMemo as s,useRef as pt,useState as mt}from"react";import{cardHoverOf as dt}from"efficient-web-builder/format/lib/animation/hover";import{pageTitleTag as ut}from"efficient-web-builder/format/lib/document/one-h1";import{SHARED_ROWS_LIST_CLASS as ft}from"efficient-web-builder/render/lib/content/box-shared-columns";import{NO_FIELD_ANSWERS as ht,answersForKind as he}from"../../lib/content/field-usage.js";import{useCurrency as gt}from"../CurrencyContext.js";import yt from"../NoCurrencyNote.js";import{usePreviewDevice as St}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as xt,renderHeadline as bt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as wt}from"../useProductCatalog.js";import{scrollBehavior as Pt}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as kt,PLP_GRID_GAP_VAR as ge,plpGridVars as vt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as Nt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as Ct,cardRowsGridStyle as Tt}from"../WheelCardFrame.js";import{applyPlpFilters as _t,buildPlpFacets as At,buildPlpTypeOptions as Lt,buildTyreSizeBoxes as Ft,EMPTY_PLP_FILTERS as ye,hasActivePlpFilters as zt,paginatePlp as It,pickTyreSize as Ot,plpTyreSizeBoxesShown as Gt,plpInStockCount as Mt,plpOpeningSort as Rt,plpPriceBounds as Vt,plpShownKinds as Et,plpSortKeysFor as Kt,PLP_SORT_LABELS as jt}from"../../lib/wheels/plp-filters.js";import{itemKind as I,itemSlug as Bt,itemTyreSizes as Dt,plpBrandVaries as Wt,plpProcessVaries as $t,plpItemsOfKinds as Yt,plpKindNoun as Se,resolvePlpKinds as Ht}from"../../lib/catalog/plp-item.js";import{plpGateWords as qt,plpVehicleCopy as Jt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Qt,oemTyreSizes as Ut}from"../../lib/tyres/tyre-vehicle-fitment.js";import{wheelsFittingVehicle as Xt}from"../../lib/wheels/plp-fitment-match.js";import Zt from"./PlpActiveChips.js";import{GridCardProvider as eo,GridMixedCards as to,gridIndexCss as oo,LISTING_CARD_RULES as ro}from"../GridCardTemplate.js";import{wheelCardEyebrowShows as no}from"../ProductCardEyebrow.js";import io from"./PlpPagination.js";import so from"./PlpSidebar.js";import lo from"./PlpFilterButton.js";import{plpFilterViews as co}from"../../lib/sections/shopper-filters.js";import{PlpResultRange as ao,PlpToolbar as po}from"./PlpToolbar.js";import mo from"../catalog/SortSelect.js";import uo from"./PlpVehicleBar.js";import fo from"./PlpVehicleGate.js";import{useVehicleCatalog as ho}from"./useVehicleCatalog.js";import{useVehicleFit as go}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as yo}from"./usePlpFiltersInUrl.js";import{productContentOf as So,rowsForGridSource as xo}from"../../lib/wheels/grid-source.js";import{say as D}from"efficient-web-builder/format/lib/editor-words";import{ALLOY_WHEELS_LISTING_TYPE as xe}from"../../lib/document/document-nodes.js";import{withRootPad as bo}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSectionPad as wo}from"../SectionPadScope.js";const mr={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function Po({level:k,className:v,children:N}){const O=ut(k);return o(O,{className:v,children:N})}const ko=dt({},xe),be="px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]";function vo({heading:k="",intro:v="",askForCar:N=!0,gateHeading:O="",gateIntro:we="",perPage:W=24,columns:Pe,defaultSort:ke="recommended",hiddenFacets:$=[],fieldUsage:h=ht,showPrice:Y=!0,showInStock:ve=!0,kinds:Ne,source:H,products:Ce,wheels:Te,addressQuery:_e,editing:d=!1,ownerId:q="",template:Ae,facetTemplate:Le,railTemplate:Fe,railHeadTemplate:ze,hover:Ie=ko,titleLevel:Oe,omitHead:G=!1,cellLook:J,filterLook:Ge,filterLookPhone:Me}){const{currency:a}=gt(),Q=wo(),u=Ht(Ne),U=St(),X=kt(Pe),Re=vt(X,d?U:null),Ve=Nt(X,d?U:null),Z=ct("plp"),Ee=oo(Z),Ke=wt(),ee=Ce??Te??Ke??[],x=So(H)==="category"?H?.name??"":null,te=s(()=>{const t=Yt(ee,u);return x===null?t:xo({name:x},t)},[ee,u.join(","),x]),r=go({editing:d,enabled:N,autoApply:!0}),[je,M]=mt(!1),Be=Rt(ke,u),g=r.applied?.vehicle??null,[_,b]=yo({editing:d,openingSort:Be,appliedVehicle:g,vehicleRestored:r.restored,addressQuery:_e}),e=s(()=>x===null||_.collections.length===0?_:{..._,collections:[]},[_,x]),p=Et(u,e.kind),n=m(t=>b(t),[b]),oe=m((t,f)=>{const c=e[t],st=c.map(String).includes(f)?c.filter(lt=>String(lt)!==f):[...c,t==="diameters"?Number(f):f];n({...e,[t]:st,page:1})},[e,n]),re=m(t=>n({...e,priceMin:t,page:1}),[e,n]),ne=m(t=>n({...e,priceMax:t,page:1}),[e,n]),ie=m(t=>n({...e,inStockOnly:t,page:1}),[e,n]),se=m(t=>n({...ye,kind:t,inStockOnly:e.inStockOnly,priceMin:e.priceMin,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMin,e.priceMax,e.sort,n]),De=m(t=>n({...e,sort:t,page:1}),[e,n]),We=m(t=>{n({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:Pt()})},[e,n]),le=m(()=>n({...ye,sort:e.sort}),[e.sort,n]),{clear:A}=r,ce=m(()=>{A(),M(!0),b(t=>({...t,page:1}))},[A]),$e=m(()=>{A(),M(!1),b(t=>({...t,page:1}))},[A]),L=g?[g.make,g.model,g.year,g.modification].join("|"):"",F=pt(null);at(()=>{if(r.restored){if(F.current===null){F.current=L;return}F.current!==L&&(F.current=L,b(t=>t.page===1?t:{...t,page:1}))}},[r.restored,L,b]);const{items:z,failed:ae,retry:Ye}=ho({catalog:te,shownKinds:u,vehicle:g,editing:d}),i=s(()=>{if(!r.fit)return z;const t=z.filter(c=>I(c)==="alloy-wheel"),f=new Set(Xt(t,r.fit).map(c=>c.slug));return z.filter(c=>I(c)!=="alloy-wheel"||f.has(Bt(c)))},[z,r.fit]),w=(x===null?$:[...$,"collections"]).join(","),He=s(()=>{const t=new Set(w?w.split(","):[]);return At(i,e,a,p,h).filter(f=>!t.has(f.key))},[i,e,a,w,p.join(","),h]),y=s(()=>_t(i,e,a),[i,e,a]),qe=p.length>1,pe=s(()=>he(h,"alloy-wheel"),[h]),Je=s(()=>he(h,"tyre"),[h]),R=s(()=>Wt(y),[y]),V=s(()=>$t(y),[y]),E=qe?Se(["alloy-wheel"]).one:null,Qe=s(()=>({kindLabel:E,brand:R,process:V}),[E,R,V]),Ue=no({kind:!!E,brand:R,process:V},pe),Xe=s(()=>Y?Vt(i,a):null,[i,a,Y]),Ze=s(()=>Mt(i,e,a),[i,e,a]),et=s(()=>Lt(i,u,e,a),[i,u.join(","),e,a]),tt=m((t,f)=>{const c=Ot(i.flatMap(Dt),e.tyreSizes[0]??"",t,f);n({...e,tyreSizes:c?[c]:[],page:1})},[i,e,n]),ot=s(()=>{const t=new Set(w?w.split(","):[]);return!Gt(i,p)||t.has("tyreSizes")?null:Ft(i,e,a)},[i,e,a,w,p.join(","),h]),S=s(()=>It(y,e.page,W),[y,e.page,W]),P=Se(p),K=Jt(p),me=qt(O,we,p,u),de=p.length===1&&p[0]==="tyre",ue=r.applied?.stock??null,C=s(()=>Ut(ue),[ue]),rt=s(()=>i.filter(t=>p.includes(I(t))).length,[i,p.join(",")]),j=te.length===0,nt=!j&&i.length===0,it=N&&!d&&!r.applied&&!je;if(u.length===0)return null;const B=o(so,{facets:He,filters:e,typeOptions:et,sizeBoxes:ot,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:P,priceBounds:Xe,inStockCount:ve?Ze:null,onToggle:oe,onPickType:se,onPickSize:tt,onPriceMin:re,onPriceMax:ne,onInStockOnly:ie,onClearAll:le,owner:{id:q,facetTemplate:Le,railTemplate:Fe,railHeadTemplate:ze},editing:d}),T=co(Ge,Me);return l("section",{children:[N&&o(uo,{cascade:r.cascade,appliedName:r.appliedName,fit:r.fit,fitSummary:de&&C.length>0?`Takes ${C.join(" · ")}`:null,resolving:r.resolving,unresolved:de?!!r.applied&&!r.resolving&&C.length===0:r.unresolved,matchCount:rt,copy:K,onAmend:$e,onClear:ce,cellLook:J}),it&&o(fo,{cascade:r.cascade,heading:me.heading,intro:me.intro,ready:r.restored,copy:K,onSkip:()=>M(!0),cellLook:J}),l("div",{...Q?bo(G?"":be,Q):{className:G?void 0:be},children:[!G&&(k||v)&&l("header",{className:"mb-6",children:[k&&o(Po,{level:Oe,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:bt(k,!1)}),v&&o("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:xt(v)})]}),l("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[T.rail===""?B:T.rail!==null&&o("div",{className:T.rail,children:B}),l("div",{className:"min-w-0 flex-1",children:[o(po,{className:"mb-4",start:l(fe,{children:[o(ao,{total:S.total,range:{from:S.from,to:S.to},noun:P}),o(Zt,{filters:e,onToggle:oe,onPriceMin:re,onPriceMax:ne,onInStockOnly:ie,onPickType:se})]}),end:l(fe,{children:[T.button!==null&&o("div",{className:T.button||void 0,children:o(lo,{filters:e,editing:d,children:B})}),o(mo,{value:e.sort,keys:Kt(u),labels:jt,onChange:De})]})}),ae&&!j&&l("div",{role:"status",className:"mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 border border-line px-4 py-3",children:[o("p",{className:"text-[14px] text-fg-dim",children:"We couldn't check your car just now — try again."}),o("button",{type:"button",onClick:Ye,className:"cursor-pointer bg-btn px-4 py-2 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Try again"})]}),j?o("div",{className:"border border-dashed border-line p-10",children:o("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:d?P.many==="wheels"?D("No wheels in this website's catalog yet — curate products to see them here."):P.many==="tyres"?D("No tyres in this website's catalog yet — curate products to see them here."):D("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):nt?ae?null:l("div",{className:"border border-line p-10",children:[l("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",r.appliedName]}),o("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:K.nothingFits}),l("button",{type:"button",onClick:ce,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",P.many]})]}):S.total===0?l("div",{className:"border border-line p-10",children:[l("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",P.many," match those filters"]}),o("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),zt(e)&&o("button",{type:"button",onClick:le,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):l(eo,{value:{ownerId:q,ownerType:xe,Template:Ae,hover:Ie,imageSizes:Ve,fieldUsage:pe,tyreFieldUsage:Je,reserveEyebrow:Ue,editing:d,eyebrow:Qe,fit:r.fit,colours:e.finishes,setGridGap:`var(${ge})`,rules:ro},children:[o("style",{children:Ee}),o("div",{className:`plp-card-grid ${Z} ${Ct} ${ft}`,style:{...Re,...Tt(`var(${ge})`)},children:o(to,{items:S.items,tyreOf:t=>I(t)==="tyre"?t:null,tyreFit:t=>C.length>0?Qt(t.sizes,C):null})})]}),o(io,{page:S.page,pageCount:S.pageCount,onPage:We}),o(yt,{editing:d})]})]})]})]})}export{mr as PLP_GATE_DEFAULTS,vo as default};
|
|
1
|
+
"use client";import{jsx as o,jsxs as l,Fragment as fe}from"react/jsx-runtime";import{useScopeClass as lt}from"../../lib/use-scope-class.js";import{useCallback as m,useEffect as ct,useMemo as s,useRef as at,useState as pt}from"react";import{cardHoverOf as mt}from"efficient-web-builder/format/lib/animation/hover";import{pageTitleTag as dt}from"efficient-web-builder/format/lib/document/one-h1";import{SHARED_ROWS_LIST_CLASS as ut}from"efficient-web-builder/render/lib/content/box-shared-columns";import{NO_FIELD_ANSWERS as ft,answersForKind as he}from"../../lib/content/field-usage.js";import{useCurrency as ht}from"../CurrencyContext.js";import gt from"../NoCurrencyNote.js";import{usePreviewDevice as yt}from"efficient-easel/screen/components/PreviewDeviceContext";import{renderGold as St,renderHeadline as xt}from"efficient-web-builder/render/components/goldPhrases";import{useUnifiedProductCatalog as bt}from"../useProductCatalog.js";import{scrollBehavior as wt}from"efficient-web-builder/render/components/useReducedMotion";import{normalizePlpColumns as Pt,PLP_GRID_GAP_VAR as kt,plpGridVars as vt}from"../../lib/wheels/plp-grid.js";import{plpCardImageSizes as Nt}from"../../lib/sections/card-image-sizes.js";import{CARD_ROWS_GRID_CLASS as Ct,cardRowsGridStyle as Tt}from"../WheelCardFrame.js";import{applyPlpFilters as _t,buildPlpFacets as At,buildPlpTypeOptions as Lt,buildTyreSizeBoxes as Ft,EMPTY_PLP_FILTERS as ge,hasActivePlpFilters as zt,paginatePlp as It,pickTyreSize as Ot,plpTyreSizeBoxesShown as Mt,plpInStockCount as Rt,plpOpeningSort as Vt,plpPriceBounds as Et,plpShownKinds as Gt,plpSortKeysFor as Kt,PLP_SORT_LABELS as jt}from"../../lib/wheels/plp-filters.js";import{itemKind as I,itemSlug as Bt,itemTyreSizes as Dt,plpBrandVaries as Wt,plpProcessVaries as $t,plpItemsOfKinds as Yt,plpKindNoun as ye,resolvePlpKinds as Ht}from"../../lib/catalog/plp-item.js";import{plpGateWords as qt,plpVehicleCopy as Jt}from"../../lib/catalog/plp-vehicle-copy.js";import{oemBadgeSize as Qt,oemTyreSizes as Ut}from"../../lib/tyres/tyre-vehicle-fitment.js";import{wheelsFittingVehicle as Xt}from"../../lib/wheels/plp-fitment-match.js";import Zt from"./PlpActiveChips.js";import{GridCardProvider as eo,GridMixedCards as to,gridIndexCss as oo,LISTING_CARD_RULES as ro}from"../GridCardTemplate.js";import{wheelCardEyebrowShows as no}from"../ProductCardEyebrow.js";import io from"./PlpPagination.js";import so from"./PlpSidebar.js";import lo from"./PlpFilterButton.js";import{plpFilterViews as co}from"../../lib/sections/shopper-filters.js";import{PlpResultRange as ao,PlpToolbar as po}from"./PlpToolbar.js";import mo from"../catalog/SortSelect.js";import uo from"./PlpVehicleBar.js";import fo from"./PlpVehicleGate.js";import{useVehicleCatalog as ho}from"./useVehicleCatalog.js";import{useVehicleFit as go}from"../fitment/useVehicleFit.js";import{usePlpFiltersInUrl as yo}from"./usePlpFiltersInUrl.js";import{productContentOf as So,rowsForGridSource as xo}from"../../lib/wheels/grid-source.js";import{say as D}from"efficient-web-builder/format/lib/editor-words";import{ALLOY_WHEELS_LISTING_TYPE as Se}from"../../lib/document/document-nodes.js";import{withRootPad as bo}from"efficient-web-builder/render/lib/content/section-own-pads";import{useSectionPad as wo}from"../SectionPadScope.js";const mr={heading:"Let's find wheels that fit your car.",intro:"Tell us what you drive and we'll show you every set that bolts straight on — bolt pattern, offset and hub bore checked for you."};function Po({level:k,className:v,children:N}){const O=dt(k);return o(O,{className:v,children:N})}const ko=mt({},Se),xe="px-5 py-10 md:px-[max(2.5rem,calc((100%_-_var(--sf-content-cap,100%))/2_+_2.5rem))]";function vo({heading:k="",intro:v="",askForCar:N=!0,gateHeading:O="",gateIntro:be="",perPage:W=24,columns:we,defaultSort:Pe="recommended",hiddenFacets:$=[],fieldUsage:h=ft,showPrice:Y=!0,showInStock:ke=!0,kinds:ve,source:H,products:Ne,wheels:Ce,addressQuery:Te,editing:d=!1,ownerId:q="",template:_e,facetTemplate:Ae,railTemplate:Le,railHeadTemplate:Fe,hover:ze=ko,titleLevel:Ie,omitHead:M=!1,cellLook:J,filterLook:Oe,filterLookPhone:Me}){const{currency:a}=ht(),Q=wo(),u=Ht(ve),U=yt(),X=Pt(we),Re=vt(X,d?U:null),Ve=Nt(X,d?U:null),Z=lt("plp"),Ee=oo(Z),Ge=bt(),ee=Ne??Ce??Ge??[],x=So(H)==="category"?H?.name??"":null,te=s(()=>{const t=Yt(ee,u);return x===null?t:xo({name:x},t)},[ee,u.join(","),x]),r=go({editing:d,enabled:N,autoApply:!0}),[Ke,R]=pt(!1),je=Vt(Pe,u),g=r.applied?.vehicle??null,[_,b]=yo({editing:d,openingSort:je,appliedVehicle:g,vehicleRestored:r.restored,addressQuery:Te}),e=s(()=>x===null||_.collections.length===0?_:{..._,collections:[]},[_,x]),p=Gt(u,e.kind),n=m(t=>b(t),[b]),oe=m((t,f)=>{const c=e[t],it=c.map(String).includes(f)?c.filter(st=>String(st)!==f):[...c,t==="diameters"?Number(f):f];n({...e,[t]:it,page:1})},[e,n]),re=m(t=>n({...e,priceMin:t,page:1}),[e,n]),ne=m(t=>n({...e,priceMax:t,page:1}),[e,n]),ie=m(t=>n({...e,inStockOnly:t,page:1}),[e,n]),se=m(t=>n({...ge,kind:t,inStockOnly:e.inStockOnly,priceMin:e.priceMin,priceMax:e.priceMax,sort:e.sort}),[e.inStockOnly,e.priceMin,e.priceMax,e.sort,n]),Be=m(t=>n({...e,sort:t,page:1}),[e,n]),De=m(t=>{n({...e,page:t}),typeof window<"u"&&window.scrollTo({top:0,behavior:wt()})},[e,n]),le=m(()=>n({...ge,sort:e.sort}),[e.sort,n]),{clear:A}=r,ce=m(()=>{A(),R(!0),b(t=>({...t,page:1}))},[A]),We=m(()=>{A(),R(!1),b(t=>({...t,page:1}))},[A]),L=g?[g.make,g.model,g.year,g.modification].join("|"):"",F=at(null);ct(()=>{if(r.restored){if(F.current===null){F.current=L;return}F.current!==L&&(F.current=L,b(t=>t.page===1?t:{...t,page:1}))}},[r.restored,L,b]);const{items:z,failed:ae,retry:$e}=ho({catalog:te,shownKinds:u,vehicle:g,editing:d}),i=s(()=>{if(!r.fit)return z;const t=z.filter(c=>I(c)==="alloy-wheel"),f=new Set(Xt(t,r.fit).map(c=>c.slug));return z.filter(c=>I(c)!=="alloy-wheel"||f.has(Bt(c)))},[z,r.fit]),w=(x===null?$:[...$,"collections"]).join(","),Ye=s(()=>{const t=new Set(w?w.split(","):[]);return At(i,e,a,p,h).filter(f=>!t.has(f.key))},[i,e,a,w,p.join(","),h]),y=s(()=>_t(i,e,a),[i,e,a]),He=p.length>1,pe=s(()=>he(h,"alloy-wheel"),[h]),qe=s(()=>he(h,"tyre"),[h]),V=s(()=>Wt(y),[y]),E=s(()=>$t(y),[y]),G=He?ye(["alloy-wheel"]).one:null,Je=s(()=>({kindLabel:G,brand:V,process:E}),[G,V,E]),Qe=no({kind:!!G,brand:V,process:E},pe),Ue=s(()=>Y?Et(i,a):null,[i,a,Y]),Xe=s(()=>Rt(i,e,a),[i,e,a]),Ze=s(()=>Lt(i,u,e,a),[i,u.join(","),e,a]),et=m((t,f)=>{const c=Ot(i.flatMap(Dt),e.tyreSizes[0]??"",t,f);n({...e,tyreSizes:c?[c]:[],page:1})},[i,e,n]),tt=s(()=>{const t=new Set(w?w.split(","):[]);return!Mt(i,p)||t.has("tyreSizes")?null:Ft(i,e,a)},[i,e,a,w,p.join(","),h]),S=s(()=>It(y,e.page,W),[y,e.page,W]),P=ye(p),K=Jt(p),me=qt(O,be,p,u),de=p.length===1&&p[0]==="tyre",ue=r.applied?.stock??null,C=s(()=>Ut(ue),[ue]),ot=s(()=>i.filter(t=>p.includes(I(t))).length,[i,p.join(",")]),j=te.length===0,rt=!j&&i.length===0,nt=N&&!d&&!r.applied&&!Ke;if(u.length===0)return null;const B=o(so,{facets:Ye,filters:e,typeOptions:Ze,sizeBoxes:tt,sizeMatches:e.tyreSizes.length>0?y.length:null,noun:P,priceBounds:Ue,inStockCount:ke?Xe:null,onToggle:oe,onPickType:se,onPickSize:et,onPriceMin:re,onPriceMax:ne,onInStockOnly:ie,onClearAll:le,owner:{id:q,facetTemplate:Ae,railTemplate:Le,railHeadTemplate:Fe},editing:d}),T=co(Oe,Me);return l("section",{children:[N&&o(uo,{cascade:r.cascade,appliedName:r.appliedName,fit:r.fit,fitSummary:de&&C.length>0?`Takes ${C.join(" · ")}`:null,resolving:r.resolving,unresolved:de?!!r.applied&&!r.resolving&&C.length===0:r.unresolved,matchCount:ot,copy:K,onAmend:We,onClear:ce,cellLook:J}),nt&&o(fo,{cascade:r.cascade,heading:me.heading,intro:me.intro,ready:r.restored,copy:K,onSkip:()=>R(!0),cellLook:J}),l("div",{...Q?bo(M?"":xe,Q):{className:M?void 0:xe},children:[!M&&(k||v)&&l("header",{className:"mb-6",children:[k&&o(Po,{level:Ie,className:"font-display text-[clamp(28px,4vw,40px)] [font-weight:var(--sf-heading-weight,500)] [text-transform:var(--sf-heading-case,uppercase)] leading-[1.05] tracking-[-0.02em]",children:xt(k,!1)}),v&&o("p",{className:"mt-2 max-w-[60ch] text-[15px] text-fg-dim",children:St(v)})]}),l("div",{className:"flex flex-col gap-8 lg:flex-row lg:items-start",children:[T.rail===""?B:T.rail!==null&&o("div",{className:T.rail,children:B}),l("div",{className:"min-w-0 flex-1",children:[o(po,{className:"mb-4",start:l(fe,{children:[o(ao,{total:S.total,range:{from:S.from,to:S.to},noun:P}),o(Zt,{filters:e,onToggle:oe,onPriceMin:re,onPriceMax:ne,onInStockOnly:ie,onPickType:se})]}),end:l(fe,{children:[T.button!==null&&o("div",{className:T.button||void 0,children:o(lo,{filters:e,editing:d,children:B})}),o(mo,{value:e.sort,keys:Kt(u),labels:jt,onChange:Be})]})}),ae&&!j&&l("div",{role:"status",className:"mb-4 flex flex-wrap items-center gap-x-4 gap-y-2 border border-line px-4 py-3",children:[o("p",{className:"text-[14px] text-fg-dim",children:"We couldn't check your car just now — try again."}),o("button",{type:"button",onClick:$e,className:"cursor-pointer bg-btn px-4 py-2 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Try again"})]}),j?o("div",{className:"border border-dashed border-line p-10",children:o("p",{className:"font-mono text-[12px] uppercase tracking-[0.16em] text-fg-dim",children:d?P.many==="wheels"?D("No wheels in this website's catalog yet — curate products to see them here."):P.many==="tyres"?D("No tyres in this website's catalog yet — curate products to see them here."):D("No products in this website's catalog yet — curate products to see them here."):"Our catalog is being updated. Please check back shortly."})}):rt?ae?null:l("div",{className:"border border-line p-10",children:[l("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No confirmed fit for your ",r.appliedName]}),o("p",{className:"mt-2 max-w-[52ch] text-[14px] text-fg-dim",children:K.nothingFits}),l("button",{type:"button",onClick:ce,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:["Show all ",P.many]})]}):S.total===0?l("div",{className:"border border-line p-10",children:[l("h3",{className:"font-display text-[22px] font-medium uppercase tracking-[-0.01em]",children:["No ",P.many," match those filters"]}),o("p",{className:"mt-2 max-w-[46ch] text-[14px] text-fg-dim",children:"Try widening the price range or clearing a filter."}),zt(e)&&o("button",{type:"button",onClick:le,className:"mt-4 cursor-pointer bg-btn px-4 py-3 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-btn-ink hover:bg-fg",children:"Clear all filters"})]}):l(eo,{value:{ownerId:q,ownerType:Se,Template:_e,hover:ze,imageSizes:Ve,fieldUsage:pe,tyreFieldUsage:qe,reserveEyebrow:Qe,editing:d,eyebrow:Je,fit:r.fit,colours:e.finishes,rules:ro},children:[o("style",{children:Ee}),o("div",{className:`plp-card-grid ${Z} ${Ct} ${ut}`,style:{...Re,...Tt(`var(${kt})`)},children:o(to,{items:S.items,tyreOf:t=>I(t)==="tyre"?t:null,tyreFit:t=>C.length>0?Qt(t.sizes,C):null})})]}),o(io,{page:S.page,pageCount:S.pageCount,onPage:De}),o(gt,{editing:d})]})]})]})]})}export{mr as PLP_GATE_DEFAULTS,vo as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as a}from"react/jsx-runtime";import
|
|
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 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as e,Fragment as d}from"react/jsx-runtime";import a,{PRICE_WORDS as l}from"../../../../../components/card-pieces/CardPrice.js";import{useGridCard as t}from"../../../../../components/GridCardTemplate.js";import c from"../../../../../components/card-pieces/HostPart.js";import{readPartStyles as m}from"efficient-web-builder/render/lib/document/part-styles";import{HideTaker as s}from"efficient-web-builder/render/components/ViewHideRoot";import{ProductPriceMeta as n}from"./meta.js";function f({children:r}){return t().ownerId?e(s,{children:r}):e(d,{children:r})}function u({region:r,priceWord:o}){const{rules:i}=t();return e(a,{setTotal:i.setTotal,wasFollowsSize:i.wasFollowsSize,priceWord:o,region:r})}const W={...n,render:r=>{const o=!!r.editor?.isEditing;return e(c,{label:n.label??"",editing:o,onHero:!0,children:e(f,{children:e(u,{priceWord:l.find(i=>i===r.priceWord),region:{nodeId:typeof r.id=="string"?r.id:void 0,partStyles:m(r),editing:o}})})})}};export{W as ProductPriceRender};
|
|
@@ -10,18 +10,10 @@ export declare function gridColumnsOf(gridClass: string): GridColumns;
|
|
|
10
10
|
export declare function fillRowColumns(columns: number, cards: number): number;
|
|
11
11
|
export declare function fillRow(grid: GridColumns, cards: number): GridColumns;
|
|
12
12
|
export declare const CARD_TRACKS_CLASS = "sf-card-tracks";
|
|
13
|
-
export declare const hasCardTracks: (gridClass: string) => boolean;
|
|
14
|
-
export declare const gridTracks: (n: number, cardTracks?: boolean) => string;
|
|
15
13
|
export interface FillRowCards {
|
|
16
14
|
limit?: number;
|
|
17
15
|
cards?: number;
|
|
18
16
|
}
|
|
19
17
|
export declare function fillRowCss(cls: string, gridClass: string, cards?: FillRowCards): string;
|
|
20
18
|
export declare function centerRowCss(cls: string, gridClass: string, cards?: FillRowCards): string;
|
|
21
|
-
export
|
|
22
|
-
min?: number;
|
|
23
|
-
max?: number;
|
|
24
|
-
columns: number;
|
|
25
|
-
}
|
|
26
|
-
export declare function gridBands({ base, steps }: GridColumns): GridBand[];
|
|
27
|
-
export declare function inBand(band: GridBand, rules: readonly string[]): string;
|
|
19
|
+
export declare function hiddenCardsRule(cls: string, from: number): string;
|