efficient-storefront-blocks 0.99.0 → 0.100.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 +36 -0
- package/dist/chunks/EditorPreviewCheckout-OLTXWUGM.js +4 -0
- package/dist/chunks/{SiteEditorProvider-YAIB64UV.js → SiteEditorProvider-4XV2T5MD.js} +1 -1
- package/dist/chunks/chunk-4SYZK3TW.js +1 -0
- package/dist/chunks/chunk-G6OVBAOA.js +74 -0
- package/dist/chunks/chunk-OWUMH5VC.js +339 -0
- package/dist/chunks/chunk-SCTOV5CT.js +1 -0
- package/dist/chunks/{chunk-EIBYUCDE.js → chunk-WN7SFD3N.js} +1 -1
- package/dist/chunks/{fitment-data-OUHMES66.js → fitment-data-ZWKG2FFA.js} +1 -1
- package/dist/contract.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/AlloyWheelsListing/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/DetailRows/fields.js +1 -1
- package/dist/editor/lib/document/blocks/commerce/ProductGrid/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/DealerFinder/fields.d.ts +2 -0
- package/dist/editor/lib/document/blocks/service/DealerFinder/fields.js +1 -0
- package/dist/editor/lib/document/blocks/service/FooterLogo/fields.js +1 -1
- package/dist/editor/lib/document/blocks/service/index.d.ts +1 -1
- package/dist/editor/lib/document/blocks/service/index.js +1 -1
- package/dist/editor/lib/document/config.js +1 -1
- package/dist/editor/lib/storefront-editor-words.d.ts +4 -0
- package/dist/editor/lib/storefront-editor-words.js +1 -1
- package/dist/editor.css +1 -1
- package/dist/index.js +33 -31
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/CouponField.d.ts +2 -1
- package/dist/render/components/CouponField.js +1 -1
- package/dist/render/components/DealerFinderSection.d.ts +18 -0
- package/dist/render/components/DealerFinderSection.js +1 -0
- package/dist/render/components/DetailRows.d.ts +2 -3
- package/dist/render/components/DetailRows.js +1 -1
- package/dist/render/components/Events.d.ts +2 -3
- package/dist/render/components/Events.js +1 -1
- package/dist/render/components/GalleryGrid.d.ts +2 -3
- package/dist/render/components/GalleryGrid.js +3 -3
- package/dist/render/components/GridCardTemplate.js +1 -1
- package/dist/render/components/ProductGridSection.d.ts +3 -2
- package/dist/render/components/ProductGridSection.js +1 -1
- package/dist/render/components/card-pieces/CardPrice.js +1 -1
- package/dist/render/components/card-pieces/useTaxNote.d.ts +1 -0
- package/dist/render/components/card-pieces/useTaxNote.js +1 -0
- package/dist/render/components/catalog/ShopperFilters.d.ts +3 -1
- package/dist/render/components/catalog/ShopperFilters.js +1 -1
- package/dist/render/components/checkout/checkout-parts.js +1 -1
- package/dist/render/components/checkout/checkout-state.d.ts +2 -0
- package/dist/render/components/checkout/checkout-state.js +3 -3
- package/dist/render/components/pdp-dynamic/DynamicDetailRows.d.ts +1 -2
- package/dist/render/components/pdp-dynamic/DynamicDetailRows.js +1 -1
- package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.d.ts +1 -2
- package/dist/render/components/pdp-dynamic/DynamicGalleryGrid.js +1 -1
- package/dist/render/components/useProductSelection.d.ts +2 -1
- package/dist/render/components/useProductSelection.js +1 -1
- package/dist/render/components/wheels-plp/AlloyWheelsListing.d.ts +4 -2
- package/dist/render/components/wheels-plp/AlloyWheelsListing.js +1 -1
- package/dist/render/components/wheels-plp/PlpFacetRows.d.ts +5 -2
- package/dist/render/components/wheels-plp/PlpFacetRows.js +1 -1
- package/dist/render/components/wheels-plp/PlpSidebar.d.ts +17 -6
- package/dist/render/components/wheels-plp/PlpSidebar.js +1 -1
- package/dist/render/lib/api/index.d.ts +3 -0
- package/dist/render/lib/api/index.js +1 -1
- package/dist/render/lib/api/types.d.ts +3 -0
- package/dist/render/lib/catalog/default-variant.d.ts +2 -0
- package/dist/render/lib/catalog/default-variant.js +1 -0
- package/dist/render/lib/catalog/tax-note.d.ts +4 -0
- package/dist/render/lib/catalog/tax-note.js +1 -0
- package/dist/render/lib/content/facet-row-seed.d.ts +1 -0
- package/dist/render/lib/content/facet-row-seed.js +1 -1
- package/dist/render/lib/content/rail-row-seed.d.ts +16 -0
- package/dist/render/lib/content/rail-row-seed.js +1 -0
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.d.ts +8 -0
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/AlloyWheelsListing/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/DetailRows/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/DetailRows/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.d.ts +8 -0
- package/dist/render/lib/document/blocks/commerce/FilterBlock/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/FilterBlock/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/GalleryB/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/GalleryB/render.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductGrid/meta.js +1 -1
- package/dist/render/lib/document/blocks/commerce/ProductGrid/render.js +1 -1
- package/dist/render/lib/document/blocks/service/DealerFinder/meta.d.ts +2 -0
- package/dist/render/lib/document/blocks/service/DealerFinder/meta.js +1 -0
- package/dist/render/lib/document/blocks/service/DealerFinder/render.d.ts +4 -0
- package/dist/render/lib/document/blocks/service/DealerFinder/render.js +1 -0
- package/dist/render/lib/document/blocks/service/Events/meta.js +1 -1
- package/dist/render/lib/document/blocks/service/Events/render.js +1 -1
- package/dist/render/lib/document/blocks/service/metas.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/metas.js +1 -1
- package/dist/render/lib/document/blocks/service/renders.d.ts +1 -0
- package/dist/render/lib/document/blocks/service/renders.js +1 -1
- package/dist/render/lib/document/blocks/text-part-shapes.json +10 -0
- package/dist/render/lib/document/card-templates.js +1 -1
- package/dist/render/lib/document/current-product.d.ts +2 -1
- package/dist/render/lib/document/current-product.js +1 -1
- package/dist/render/lib/document/lazy-draws.js +1 -1
- package/dist/render/lib/document/section-to-box-rows-listing.js +1 -1
- package/dist/render/lib/sections/band-padding.d.ts +23 -0
- package/dist/render/lib/sections/band-padding.js +1 -0
- package/dist/render/lib/sections/dealer-finder.d.ts +41 -0
- package/dist/render/lib/sections/dealer-finder.js +1 -0
- package/dist/words.d.ts +13 -0
- package/dist/words.js +4 -4
- package/package.json +2 -2
- package/dist/chunks/EditorPreviewCheckout-J76THKIJ.js +0 -4
- package/dist/chunks/chunk-B2IYTOE3.js +0 -1
- package/dist/chunks/chunk-GOVYQQA4.js +0 -1
- package/dist/chunks/chunk-KRMWJLBM.js +0 -412
- package/dist/chunks/chunk-QP2F42DV.js +0 -1
- package/dist/render/lib/sections/own-padding.d.ts +0 -3
- package/dist/render/lib/sections/own-padding.js +0 -1
- /package/dist/chunks/{chunk-KRMWJLBM.js.LEGAL.txt → chunk-OWUMH5VC.js.LEGAL.txt} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import{useState as u}from"react";import{COUPON_DEFERRED_MESSAGE as m}from"../lib/cart/coupon-preview.js";import{useCart as x}from"./CartContext.js";function f({customerEmail:c,disabled:o=!1}){const{coupon:e,applyCoupon:l,removeCoupon:d,couponBusy:n}=x(),[r,s]=u("");async function p(){o||n||!r.trim()||(await l(r,c),s(""))}return i("div",{className:"flex flex-col gap-2",children:[e===null?i("div",{className:"flex border border-line",children:[t("input",{type:"text",value:r,onChange:a=>s(a.target.value),onKeyDown:a=>{a.key==="Enter"&&(a.preventDefault(),p())},placeholder:"Coupon code","aria-label":"Coupon code",disabled:o,className:"flex-1 bg-transparent px-4 py-4 font-mono text-[11px] uppercase tracking-[0.18em] text-fg outline-none placeholder:text-fg-dim"}),t("button",{type:"button",onClick:()=>{p()},disabled:n||o,className:"border-l border-line px-4 font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:bg-btn hover:text-btn-ink disabled:cursor-wait disabled:opacity-60",children:n?"…":"Apply"})]}):i("div",{className:["flex items-center justify-between gap-3 border px-4 py-3",e.valid?"border-accent":"border-line"].join(" "),style:e.valid?{background:"color-mix(in oklab, var(--accent) 8%, transparent)"}:void 0,children:[t("span",{className:["font-mono text-[11px] uppercase tracking-[0.22em]",e.valid?"text-accent":e.deferred||e.unchecked?"text-fg":"text-fg-dim line-through"].join(" "),children:e.code}),e.unchecked&&t("button",{type:"button",onClick:()=>{l(e.code,c)},disabled:n||o,className:"ml-auto font-mono text-[10px] uppercase tracking-[0.26em] text-btn transition-colors hover:text-fg disabled:cursor-wait disabled:opacity-60",children:n?"…":"Try again"}),!o&&t("button",{type:"button",onClick:d,"aria-label":`Remove coupon ${e.code}`,className:"font-mono text-[12px] text-fg-dim transition-colors hover:text-fg",children:"✕"})]}),e?.deferred?t("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-fg-dim",children:m}):e&&!e.valid&&e.message&&t("p",{className:"font-mono text-[10px] uppercase tracking-[0.18em] text-alert",children:e.message})]})}export{f as default};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type FormEvent } from "react";
|
|
2
|
+
import { type DealerList } from "../lib/sections/dealer-finder.js";
|
|
3
|
+
interface DealerFinderProps {
|
|
4
|
+
title?: string;
|
|
5
|
+
contained: boolean;
|
|
6
|
+
sample?: DealerList;
|
|
7
|
+
}
|
|
8
|
+
export default function DealerFinder({ title, contained, sample }: DealerFinderProps): import("react").JSX.Element;
|
|
9
|
+
interface DealerFinderViewProps {
|
|
10
|
+
title?: string;
|
|
11
|
+
query: string;
|
|
12
|
+
list: DealerList | null;
|
|
13
|
+
busy?: boolean;
|
|
14
|
+
onQuery?: (value: string) => void;
|
|
15
|
+
onSearch?: (event: FormEvent<HTMLFormElement>) => void;
|
|
16
|
+
}
|
|
17
|
+
export declare function DealerFinderView({ title, query, list, busy, onQuery, onSearch }: DealerFinderViewProps): import("react").JSX.Element;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{jsx as a,jsxs as s}from"react/jsx-runtime";import{useState as h}from"react";import b from"efficient-web-builder/render/components/BlockFrame";import{renderHeadline as g}from"efficient-web-builder/render/components/goldPhrases";import{phoneHref as y}from"efficient-web-builder/format/lib/links/phone-href";import{fetchDealers as N}from"../lib/api/index.js";import{DEALER_WORDS as r,dealerFinderNotice as v,dealerPins as w,dealerTownLine as k,distanceLabel as _}from"../lib/sections/dealer-finder.js";function j({title:c,contained:d,sample:n}){const[t,m]=h(""),[p,i]=h(n??null),[l,o]=h(!1);return a(b,{contained:d,className:"py-6",children:a(D,{title:c,query:t,list:p,busy:l,onQuery:m,onSearch:async f=>{if(f.preventDefault(),!(n||!t.trim())){o(!0);try{i(await N(t))}catch{i({near:"try_again",dealers:[]})}finally{o(!1)}}}})})}function D({title:c,query:d,list:n,busy:t=!1,onQuery:m,onSearch:p}){const i=n?v(n.near):null,l=n&&n.near!=="not_found"?n.dealers:[],o=w(l);return s("div",{className:"flex flex-col gap-5",children:[c&&a("h2",{className:"font-heading3 text-[length:min(var(--size-headingSmall,28px),var(--sf-heading-max,9999px))] font-medium leading-[1.1] tracking-[-0.02em]",children:g(c,!1)}),s("form",{role:"search",className:"flex max-w-[560px] gap-2",onSubmit:p,children:[a("input",{type:"search",name:"near",value:d,onChange:e=>m?.(e.target.value),placeholder:r.placeholder,"aria-label":r.placeholder,maxLength:120,className:"min-w-0 flex-1 rounded-sm border border-line bg-transparent px-3 py-2 text-[15px]"}),a("button",{type:"submit",disabled:t,className:"rounded-sm bg-btn px-4 py-2 text-[15px] font-medium text-btn-ink disabled:opacity-60",children:t?r.searching:r.search})]}),i&&a("p",{role:"status",className:"text-[15px] opacity-80",children:i}),n&&n.near!=="not_found"&&!l.length&&a("p",{role:"status",className:"text-[15px] opacity-80",children:r.none}),l.length>0&&s("div",{className:"grid gap-5 md:grid-cols-2",children:[a("ol",{className:"flex flex-col text-[15px]",children:l.map((e,f)=>{const u=_(e.distanceKm),x=k(e);return s("li",{className:"flex gap-3 border-b border-line py-3 last:border-b-0",children:[a("span",{"aria-hidden":!0,className:"w-6 shrink-0 font-medium tabular-nums",children:f+1}),s("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5",children:[s("div",{className:"flex flex-wrap items-baseline justify-between gap-x-4",children:[a("span",{className:"font-medium",children:e.name}),u&&a("span",{className:"tabular-nums opacity-70",children:u})]}),e.address&&a("span",{children:e.address}),x&&a("span",{children:x}),e.phone&&a("a",{href:y(e.phone),className:"underline-offset-2 hover:underline",children:e.phone}),e.website&&a("a",{href:e.website,target:"_blank",rel:"noopener noreferrer",className:"underline-offset-2 hover:underline",children:r.website})]})]},e.id)})}),o.length>0&&a("div",{role:"img","aria-label":r.map,className:"relative min-h-[280px] overflow-hidden rounded-sm border border-line",style:{background:"color-mix(in oklab, var(--accent) 6%, transparent)"},children:o.map(e=>a("span",{"data-dealer-pin":e.index+1,className:"absolute flex h-6 w-6 -translate-x-1/2 -translate-y-full items-center justify-center rounded-full bg-accent text-[12px] font-medium text-accent-ink",style:{left:`${e.left}%`,top:`${e.top}%`},children:e.index+1},e.id))})]})]})}export{D as DealerFinderView,j as default};
|
|
@@ -18,12 +18,11 @@ export interface DetailRowsProps {
|
|
|
18
18
|
rows?: DetailRow[];
|
|
19
19
|
startLeft?: boolean;
|
|
20
20
|
layout?: "even" | "narrow";
|
|
21
|
-
|
|
22
|
-
padBottom?: number;
|
|
21
|
+
pads?: Record<string, unknown>;
|
|
23
22
|
editing?: boolean;
|
|
24
23
|
template?: unknown;
|
|
25
24
|
nodeId?: string;
|
|
26
25
|
}
|
|
27
26
|
export declare function detailCardRow(row: DetailRow): SourceRow;
|
|
28
27
|
export declare function templateCanDraw(rows: readonly DetailRow[]): boolean;
|
|
29
|
-
export default function DetailRows({ rows, startLeft, layout,
|
|
28
|
+
export default function DetailRows({ rows, startLeft, layout, pads, editing, template, nodeId, }: DetailRowsProps): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as i,jsxs as o}from"react/jsx-runtime";import
|
|
1
|
+
import{jsx as i,jsxs as o}from"react/jsx-runtime";import k from"./SectionBand.js";import R from"efficient-web-builder/render/components/Placeholder";import{withRMark as c}from"efficient-web-builder/render/components/RMark";import{renderGold as b}from"efficient-web-builder/render/components/goldPhrases";import{say as g}from"efficient-web-builder/format/lib/editor-words";import{stripMarkup as j}from"efficient-web-builder/format/lib/markup";import{bandPadAttrs as _}from"efficient-web-builder/render/lib/content/section-padding";import{DETAIL_ROWS_ROOM as z,withBandClasses as C}from"../lib/sections/band-padding.js";import{CardTemplateRows as S}from"efficient-web-builder/render/components/CardRowContext";const p={body:"text-[length:var(--size-body,15px)]",labelSmall:"text-[length:var(--size-label,11px)]",label:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"};function T(t){return{eyebrow:t.eyebrow?.trim()?t.eyebrow:"",title:t.title?.trim()?t.title:"",copy:t.copy?.trim()?t.copy:"",image:t.image?.trim()?t.image:"",tag:t.tag?.trim()?t.tag:""}}function $(t){return t.every(r=>!r.media&&!(r.specs??[]).some(n=>(n?.label??"").trim()||(n?.value??"").trim()))}const O="[&:not(:first-child)]:border-t [&:not(:first-child)]:border-line";function D({rows:t,startLeft:r=!1,layout:n="even",pads:v,editing:u=!1,template:y,nodeId:w}){const a=n==="narrow",f=_(v??{},z),x=(t??[]).filter(e=>(e?.eyebrow??"").trim()||(e?.title??"").trim()||(e?.copy??"").trim()||(e?.tag??"").trim()||(e?.image??"").trim()),m=x.length>0?x:u?[{tag:g("Row {n}",{n:1})},{tag:g("Row {n}",{n:2})},{tag:g("Row {n}",{n:3})}]:[];return m.length===0?null:i(k,{className:C("relative z-[2] border-b border-line bg-bg",f),style:f.style,children:i(S,{ownerId:w??"",ownerType:"DetailRows",Template:$(m)?y:void 0,rows:m.map(T),fallback:m.map((e,s)=>{const d=s%2===1!==r;return o("div",{className:["grid items-center py-[60px]",a?"grid-cols-[1fr_460px] gap-[72px]":"grid-cols-2 gap-12","max-view-desktop:grid-cols-1",d?"[direction:rtl] max-view-desktop:[direction:ltr]":"",s>0?"border-t border-line":""].join(" "),children:[o("div",{className:["[direction:ltr] flex flex-col gap-4",a?"max-w-[560px]":"",a&&!d?"ml-auto max-view-desktop:ml-0":""].join(" "),children:[e.eyebrow?.trim()&&i("div",{className:`font-mono ${p.labelLarge} uppercase tracking-[0.2em] text-accent`,children:c(e.eyebrow)}),e.title?.trim()&&i("h2",{className:"font-heading2 text-[length:min(var(--size-headingMedium,clamp(28px,3vw,42px)),var(--sf-heading-max,9999px))] [font-weight:var(--sf-heading-weight,500)] [&_em]:[font-weight:var(--sf-heading-weight-strong,inherit)] leading-[1.1] tracking-[-0.02em]",children:b(e.title,!0)}),e.copy?.trim()&&i("p",{className:`${p.body} leading-[1.6] text-fg-dim`,children:b(e.copy,!1)}),(()=>{const h=(e.specs??[]).filter(l=>(l?.label??"").trim()||(l?.value??"").trim());return h.length===0?null:i("dl",{className:`mt-2 border-t border-line pt-3 font-mono ${p.label} uppercase tracking-[0.1em] leading-[2.1]`,children:h.map((l,N)=>o("div",{className:"flex items-baseline justify-between gap-6",children:[i("dt",{className:"text-fg-dim",children:c(l.label??"")}),i("dd",{className:"text-fg",children:c(l.value??"")})]},N))})})()]}),o("div",{className:["[direction:ltr] flex flex-col gap-3",a?d?"items-end":"items-start":"",a?"max-view-desktop:items-start":""].join(" "),children:[e.media?i("div",{className:"w-full",children:e.media}):i("div",{className:["relative overflow-hidden max-w-full",a?e.imageShape==="wide"?"w-[460px] aspect-[16/9]":"w-[360px] aspect-square":"aspect-square"].join(" "),children:i(R,{label:e.tag?.trim()||e.title?.trim()||`row-${s+1}`,src:e.image||void 0,alt:j(e.title?.trim()||e.tag?.trim()||""),showBackground:!e.image,objectFit:"contain",sizes:a?"(max-width: 1100px) 100vw, 460px":"(max-width: 1100px) 100vw, 50vw"})}),e.tag?.trim()&&i("span",{className:`font-mono ${p.labelSmall} uppercase tracking-[0.2em] text-fg-dim ${d?"text-left":"text-right"}`,children:c(e.tag)})]})]},s)}),wrapCopy:e=>i("div",{className:O,children:e}),children:e=>e})})}export{D as default,T as detailCardRow,$ as templateCanDraw};
|
|
@@ -69,10 +69,9 @@ export interface EventsProps {
|
|
|
69
69
|
cardImage?: number | null;
|
|
70
70
|
omitHead?: boolean;
|
|
71
71
|
nameFilter?: boolean;
|
|
72
|
-
|
|
73
|
-
padBottom?: number;
|
|
72
|
+
pads?: Record<string, unknown>;
|
|
74
73
|
template?: unknown;
|
|
75
74
|
ownerId?: string;
|
|
76
75
|
}
|
|
77
76
|
export declare function matchesName(title: string, typed: string): boolean;
|
|
78
|
-
export default function Events({ num, title, link, posts, columns, limit, showAll, editing, cardImage, gap: gapProp, gapPhone, layout, featuredWidth, listCover, featuredDarken, omitHead, sample, nameFilter,
|
|
77
|
+
export default function Events({ num, title, link, posts, columns, limit, showAll, editing, cardImage, gap: gapProp, gapPhone, layout, featuredWidth, listCover, featuredDarken, omitHead, sample, nameFilter, pads, template, ownerId, }: EventsProps): import("react").JSX.Element | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as s,jsxs as c}from"react/jsx-runtime";import{Children as _e,useState as Z}from"react";import{servedWords as Ae}from"../lib/content/served-lists.js";import{TAB_PILLS as P}from"../lib/content/tab-strip.js";import{useScopeClass as Ce}from"../lib/use-scope-class.js";import{containerGapProps as Le}from"efficient-web-builder/format/lib/content/container-gap";import Se from"efficient-web-builder/render/components/SectionHeader";import w from"efficient-web-builder/render/components/PostCard";import $e from"efficient-web-builder/render/components/Placeholder";import{SiteLink as U}from"efficient-web-builder/render/lib/site-runtime";import{renderGold as x,renderHeadline as _}from"efficient-web-builder/render/components/goldPhrases";import{say as A}from"efficient-web-builder/format/lib/editor-words";import{cardImageShapeTokens as Oe}from"efficient-web-builder/format/lib/content/card-image-shape";import{SITE_COLUMN as ee}from"efficient-web-builder/format/lib/content/page-width";import{fillRowCss as ke}from"../lib/sections/fill-row.js";import{headIsEmpty as Ie,ownPadding as Re}from"../lib/sections/own-padding.js";import{HideTaker as te}from"efficient-web-builder/render/components/ViewHideRoot";import{CardTemplateRows as Fe,useCardRow as De}from"efficient-web-builder/render/components/CardRowContext";import{SECTION_FILL_CLASS as ze}from"efficient-web-builder/format/lib/content/section-min-height";import{postPath as Me}from"efficient-web-builder/format/lib/links/page-link-rules";import{EVENTS_FEATURED_DARKEN as Pe,EVENTS_FEATURED_DARKEN_STYLE as Ue,EVENTS_FEATURED_PLACEMENT as Ve}from"../lib/content/events-featured-look.js";const Ye=4;function Mt(e){return Ae(e,Ye)}function Pt(e){if(!e||typeof e!="object"||Array.isArray(e))return;const a={};for(const[t,r]of Object.entries(e))if(t.trim()){if(typeof r=="string")r.trim()&&(a[t]=r.trim());else if(Array.isArray(r)){const l=r.filter(d=>typeof d=="string"&&!!d.trim()).map(d=>d.trim());l.length&&(a[t]=l)}}return Object.keys(a).length?a:void 0}function se(e,a){const t=e.facets?.[a];return t===void 0?[]:typeof t=="string"?[t]:t}const je=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function Be(e){const a=[],t=new Map;for(const r of e)for(const l of Object.keys(r.facets??{})){t.has(l)||(a.push(l),t.set(l,new Set));for(const d of se(r,l))t.get(l).add(d)}return a.map(r=>({label:r,values:[...t.get(r)].sort(je.compare)}))}function Ke(e,a){return Object.entries(a).every(([t,r])=>r===""||se(e,t).includes(r))}const ae=3,ne="featured",re="tabs",le="portrait",v="spread",oe="count",Ut=[{label:"Even grid",value:"even"},{label:"Featured first",value:ne},{label:"Tabs",value:re},{label:"Photo cards",value:le},{label:"Staggered spread",value:v},{label:"Count",value:oe}],We=[le,v],Vt="even",V={min:2,max:11,step:1,fallback:7,unit:"of 12"},He=Ve,Ge=Pe,Xe=Ue;function Je(e){const a=typeof e=="number"?e:Number.parseFloat(String(e??"")),t=Number.isFinite(a)?Math.min(V.max,Math.max(V.min,Math.round(a))):V.fallback;return`${t}fr ${12-t}fr`}const ie={1:"grid-cols-1",2:"grid-cols-2 max-view-wide:grid-cols-1",3:"grid-cols-3 max-view-wide:grid-cols-1",4:"grid-cols-4 max-view-desktop:grid-cols-2 max-view-wide:grid-cols-1"},qe={2:"grid-cols-2",3:"grid-cols-3 max-view-wide:grid-cols-2",4:"grid-cols-4 max-view-desktop:grid-cols-3 max-view-wide:grid-cols-2"},Qe={2:"grid-cols-2 max-view-wide:grid-cols-1",3:"grid-cols-3 max-view-wide:grid-cols-1",4:"grid-cols-4 max-view-desktop:grid-cols-3 max-view-wide:grid-cols-1"};function ce(e,a){return{key:e.slug,title:e.title??"",excerpt:e.excerpt??"",cover:e.cover??"",meta:e.meta??"",dateLabel:e.dateLabel??"",href:e.href||(a?"#":Me(e.slug))}}function Ze(e,a){return{...ce(e,a),tags:(e.tags??[]).map(t=>({label:t}))}}const de=new WeakMap,et={className:"hidden"},tt={className:ze};function fe(e,a){const t=e.blockIds[0],r=e;function l(d){const b=De(),N=a&&b?.index===0;return s(r,{...d,cell:C=>C===t===N?tt:et})}return Object.assign(l,{blockCount:1,blockIds:e.blockIds})}function st(e,a){const t=e;if(typeof t!="function"||(t.blockCount??0)<2||!Array.isArray(t.blockIds))return e;let r=de.get(t);return r||(r={lead:fe(t,!0),rest:fe(t,!1)},de.set(t,r)),a?r.lead:r.rest}const at="Find by name",nt="Nobody by that name.",rt="Nobody matches.",lt="Any";function ot(e,a){const t=l=>l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLocaleLowerCase().trim(),r=t(a);return r===""||t(e).includes(r)}function pe({typed:e,onType:a,wide:t=!1}){return c("label",{className:`flex max-w-[360px] flex-col gap-1.5${t?" w-full":""}`,children:[s("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:at}),s("input",{type:"search",value:e,onChange:r=>a(r.target.value),autoComplete:"off",className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent"})]})}function me({tags:e}){return s("ul",{"aria-label":"Details",className:"flex gap-1.5 overflow-hidden",children:e.map((a,t)=>s("li",{className:"shrink-0 rounded-[var(--sf-button-radius,4px)] border border-line px-2 py-0.5 text-[length:var(--size-label,12px)] text-fg-dim",children:a},`${a}-${t}`))})}function it({card:e,scaffold:a,lower:t=!1}){return c(U,{href:e.href||"#",className:`sf-card group relative isolate flex aspect-[3/4] overflow-hidden bg-surface${t?" min-[801px]:mt-16":""}`,"aria-disabled":a||void 0,tabIndex:a?-1:void 0,children:[s("div",{className:"absolute inset-0 transition-transform duration-700 group-hover:scale-[1.03] motion-reduce:transition-none motion-reduce:group-hover:scale-100",children:s($e,{label:`card-${e.slug}`,src:e.cover||void 0,sizes:"(max-width: 800px) 50vw, 25vw"})}),s("div",{"aria-hidden":!0,className:"absolute inset-0 z-0",style:{background:"linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--bg) 88%, transparent) 100%)"}}),e.meta&&s("span",{className:"absolute left-3 top-3 z-[1] rounded-[var(--sf-button-radius,999px)] bg-bg/85 px-2.5 py-1 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.16em] text-accent",children:x(e.meta)}),c("div",{className:"relative z-[1] mt-auto flex w-full flex-col gap-1 p-4 max-view-wide:p-3",children:[s("h3",{className:"font-heading3 text-[length:var(--size-headingSmall,24px)] leading-[1.1] tracking-[-0.01em] text-fg",children:_(e.title,!1)}),e.dateLabel&&s("p",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-accent",children:x(e.dateLabel)}),e.tags&&e.tags.length>0&&s(me,{tags:e.tags}),e.excerpt&&s("p",{className:"line-clamp-2 text-[length:var(--size-body,14px)] leading-[1.45] text-fg-dim",children:x(e.excerpt)})]})]})}function ct({cards:e,scaffold:a}){return s("nav",{"aria-label":"Days",className:P.nav,children:s("ul",{className:P.list,children:e.map((t,r)=>{const l=!!t.meta;return s("li",{children:c(U,{href:t.href||"#","aria-current":l?"page":void 0,"aria-disabled":a||void 0,tabIndex:a?-1:void 0,className:P.tab(l),children:[s("span",{className:"font-heading3 text-[length:var(--size-body,15px)] leading-[1.2]",children:_(t.title,!1)}),t.excerpt&&s("span",{className:`font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.14em] ${l?"opacity-80":"text-fg-dim"}`,children:x(t.excerpt)})]})},`${t.slug}-${r}`)})})})}function dt({count:e,words:a,href:t}){const r=c("span",{className:"inline-flex items-baseline gap-3",children:[s("span",{className:"font-heading text-[length:var(--size-headingLarge,64px)] leading-none text-accent",children:e}),a!==void 0&&s("span",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg",children:a})]});return t?s(U,{href:t,className:"inline-flex hover:opacity-85",children:r}):r}const Y="[&>[data-sf-repeat]>*]:h-full [&>[data-sf-repeat]>*>*]:h-full",ft="[&>[data-sf-repeat]]:h-full [&>[data-sf-repeat]>*]:h-full [&>[data-sf-repeat]>*>*]:h-full",pt="relative z-[2] bg-bg py-[120px] max-view-wide:py-[70px]",mt="relative z-[2] bg-bg pt-0 pb-[120px] max-view-wide:pt-0 max-view-wide:pb-[70px]",gt="relative z-[2] bg-bg py-[32px] max-view-wide:py-[24px]";function ut({num:e,title:a,link:t,posts:r,columns:l,limit:d,showAll:b=!1,editing:N=!1,cardImage:C,gap:ge,gapPhone:ue,layout:g,featuredWidth:he,listCover:xe=!0,featuredDarken:ve,omitHead:T=!1,sample:L,nameFilter:be=!1,padTop:Ne,padBottom:Ee,template:j,ownerId:Te=""}){const[S,B]=Z(""),[K,ye]=Z({}),E=Ce("ev"),W=r??[],H=b?W.length:typeof d=="number"&&d>0?d:ae,$=W.slice(0,H),m=N&&$.length===0;if($.length===0&&!N)return null;const G=b?ae:H,f=m?L?.length?L.slice(0,b?L.length:G):Array.from({length:G},(n,i)=>({slug:`placeholder-${i}`,title:A("Blog post title"),excerpt:A("A short summary of the post appears here."),cover:"",meta:A("Journal"),dateLabel:A("Date")})):$,o=Le("Events",ge,"both",ue),y=g===ne&&f.length>1,X=Je(he),O=g===re,J=g===oe,q=We.includes(g??""),k=be&&!O&&!J&&!y,I=k?Be(f):[],h=k?f.filter(n=>ot(n.title,S)&&Ke(n,K)):f,R=Re(Ne,Ee),we=!N&&Ie(e,a,t?.text),F=(j?.blockCount??0)>0?Qe:qe,D=g===v?F[3]:F[Math.min(4,Math.max(2,l??3))]??F[3],z=ie[Math.min(4,Math.max(1,l??3))]??ie[3],Q=O||y||g===v?"":ke(E,q?D:z,{cards:h.length}),M=(n,i,p)=>s(Fe,{ownerId:Te,ownerType:"Events",Template:st(j,y),rows:n.map(u=>ce(u,m)),items:n.map(u=>Ze(u,m)),fallback:i,children:u=>p(_e.toArray(u))});return J?s(te,{as:"section",className:gt,style:Object.keys(R).length?R:void 0,children:s("div",{className:ee,children:s(dt,{count:f.length,words:T||a===void 0?void 0:_(a,!1),href:T?void 0:t?.href})})}):s(te,{as:"section",className:T?mt:pt,style:{...Oe(C),...R},children:c("div",{className:ee,children:[T||we?null:s(Se,{num:e!==void 0?x(e):void 0,title:a!==void 0?_(a,!1):void 0,link:t?{text:x(t.text),href:t.href}:void 0}),k&&c("div",{className:"mb-6 flex flex-col gap-2",children:[I.length===0?s(pe,{typed:S,onType:B}):c("div",{className:"flex flex-wrap items-end gap-3",children:[s(pe,{typed:S,onType:B,wide:!0}),I.map(({label:n,values:i})=>c("label",{className:"flex min-w-[140px] flex-col gap-1.5 max-view-wide:flex-1",children:[s("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:n}),c("select",{value:K[n]??"",onChange:p=>ye(u=>({...u,[n]:p.target.value})),className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent",children:[s("option",{value:"",children:lt}),i.map(p=>s("option",{value:p,children:p},p))]})]},n))]}),h.length===0&&s("p",{role:"status",className:"text-[length:var(--size-body,14px)] text-fg-dim",children:I.length===0?nt:rt})]}),Q&&s("style",{children:Q}),O?s(ct,{cards:f,scaffold:m}):q?M(h,s("div",{className:`${E} sf-card-grid grid${o.className} ${D}`,style:o.style,children:h.map((n,i)=>s(it,{card:n,scaffold:m,lower:g===v&&i%3===1},`${n.slug}-${i}`))}),n=>s("div",{className:`${E} sf-card-grid grid${o.className} ${D} ${Y}`,style:o.style,children:g===v?n.map((i,p)=>s("div",{className:`${ft}${p%3===1?" view-wide:mt-16":""}`,children:i},p)):n})):y?M(f,c("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-view-wide:grid-cols-1${o.className}`,style:{...o.style,"--sf-events-split":X},children:[s(w,{post:f[0],href:f[0].href,scaffold:m,layout:"cover",darken:ve??Ge,darkenStyle:Xe,placement:He},`${f[0].slug}-0`),s("div",{className:`grid auto-rows-min${o.className}`,style:o.style,children:f.slice(1).map((n,i)=>s(w,{post:n,href:n.href,scaffold:m,showCover:xe},`${n.slug}-${i+1}`))})]}),n=>c("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-view-wide:grid-cols-1${o.className} ${Y}`,style:{...o.style,"--sf-events-split":X},children:[n[0],s("div",{className:`grid auto-rows-min${o.className}`,style:o.style,children:n.slice(1)})]})):M(h,s("div",{className:`${E} sf-card-grid grid${o.className} ${z}`,style:o.style,children:h.map((n,i)=>n.tags&&n.tags.length>0?c("div",{className:"flex flex-col gap-2",children:[s(w,{post:n,href:n.href,scaffold:m}),s(me,{tags:n.tags})]},`${n.slug}-${i}`):s(w,{post:n,href:n.href,scaffold:m},`${n.slug}-${i}`))}),n=>s("div",{className:`${E} sf-card-grid grid${o.className} ${z} ${Y}`,style:o.style,children:n}))]})})}export{V as EVENTS_FEATURED_WIDTH,Ut as EVENTS_LAYOUTS,oe as EVENTS_LAYOUT_COUNT,Vt as EVENTS_LAYOUT_FALLBACK,ne as EVENTS_LAYOUT_FEATURED,le as EVENTS_LAYOUT_PORTRAIT,v as EVENTS_LAYOUT_SPREAD,re as EVENTS_LAYOUT_TABS,We as EVENTS_PHOTO_LAYOUTS,Ye as MAX_CARD_TAGS,ut as default,Be as facetChoices,Ke as matchesFacets,ot as matchesName,Pt as readFacets,Mt as readTags};
|
|
1
|
+
import{jsx as s,jsxs as c}from"react/jsx-runtime";import{Children as Ce,useState as te}from"react";import{servedWords as Le}from"../lib/content/served-lists.js";import{TAB_PILLS as V}from"../lib/content/tab-strip.js";import{useScopeClass as Se}from"../lib/use-scope-class.js";import{containerGapProps as $e}from"efficient-web-builder/format/lib/content/container-gap";import Oe from"efficient-web-builder/render/components/SectionHeader";import w from"efficient-web-builder/render/components/PostCard";import ke from"efficient-web-builder/render/components/Placeholder";import{SiteLink as Y}from"efficient-web-builder/render/lib/site-runtime";import{renderGold as x,renderHeadline as _}from"efficient-web-builder/render/components/goldPhrases";import{say as A}from"efficient-web-builder/format/lib/editor-words";import{cardImageShapeTokens as Re}from"efficient-web-builder/format/lib/content/card-image-shape";import{SITE_COLUMN as se}from"efficient-web-builder/format/lib/content/page-width";import{fillRowCss as Ie}from"../lib/sections/fill-row.js";import{FRAME_120 as Fe,framedBandPad as ae,headIsEmpty as De,withBandClasses as ne}from"../lib/sections/band-padding.js";import{HideTaker as re}from"efficient-web-builder/render/components/ViewHideRoot";import{CardTemplateRows as Me,useCardRow as ze}from"efficient-web-builder/render/components/CardRowContext";import{SECTION_FILL_CLASS as Ue}from"efficient-web-builder/format/lib/content/section-min-height";import{postPath as Pe}from"efficient-web-builder/format/lib/links/page-link-rules";import{EVENTS_FEATURED_DARKEN as Ve,EVENTS_FEATURED_DARKEN_STYLE as Ye,EVENTS_FEATURED_PLACEMENT as je}from"../lib/content/events-featured-look.js";const Be=4;function Vt(e){return Le(e,Be)}function Yt(e){if(!e||typeof e!="object"||Array.isArray(e))return;const a={};for(const[t,r]of Object.entries(e))if(t.trim()){if(typeof r=="string")r.trim()&&(a[t]=r.trim());else if(Array.isArray(r)){const l=r.filter(d=>typeof d=="string"&&!!d.trim()).map(d=>d.trim());l.length&&(a[t]=l)}}return Object.keys(a).length?a:void 0}function le(e,a){const t=e.facets?.[a];return t===void 0?[]:typeof t=="string"?[t]:t}const Ke=new Intl.Collator("en",{numeric:!0,sensitivity:"base"});function We(e){const a=[],t=new Map;for(const r of e)for(const l of Object.keys(r.facets??{})){t.has(l)||(a.push(l),t.set(l,new Set));for(const d of le(r,l))t.get(l).add(d)}return a.map(r=>({label:r,values:[...t.get(r)].sort(Ke.compare)}))}function He(e,a){return Object.entries(a).every(([t,r])=>r===""||le(e,t).includes(r))}const oe=3,ie="featured",ce="tabs",de="portrait",v="spread",fe="count",jt=[{label:"Even grid",value:"even"},{label:"Featured first",value:ie},{label:"Tabs",value:ce},{label:"Photo cards",value:de},{label:"Staggered spread",value:v},{label:"Count",value:fe}],Ge=[de,v],Bt="even",j={min:2,max:11,step:1,fallback:7,unit:"of 12"},Xe=je,Je=Ve,qe=Ye;function Qe(e){const a=typeof e=="number"?e:Number.parseFloat(String(e??"")),t=Number.isFinite(a)?Math.min(j.max,Math.max(j.min,Math.round(a))):j.fallback;return`${t}fr ${12-t}fr`}const pe={1:"grid-cols-1",2:"grid-cols-2 max-view-wide:grid-cols-1",3:"grid-cols-3 max-view-wide:grid-cols-1",4:"grid-cols-4 max-view-desktop:grid-cols-2 max-view-wide:grid-cols-1"},Ze={2:"grid-cols-2",3:"grid-cols-3 max-view-wide:grid-cols-2",4:"grid-cols-4 max-view-desktop:grid-cols-3 max-view-wide:grid-cols-2"},et={2:"grid-cols-2 max-view-wide:grid-cols-1",3:"grid-cols-3 max-view-wide:grid-cols-1",4:"grid-cols-4 max-view-desktop:grid-cols-3 max-view-wide:grid-cols-1"};function me(e,a){return{key:e.slug,title:e.title??"",excerpt:e.excerpt??"",cover:e.cover??"",meta:e.meta??"",dateLabel:e.dateLabel??"",href:e.href||(a?"#":Pe(e.slug))}}function tt(e,a){return{...me(e,a),tags:(e.tags??[]).map(t=>({label:t}))}}const ge=new WeakMap,st={className:"hidden"},at={className:Ue};function ue(e,a){const t=e.blockIds[0],r=e;function l(d){const b=ze(),N=a&&b?.index===0;return s(r,{...d,cell:C=>C===t===N?at:st})}return Object.assign(l,{blockCount:1,blockIds:e.blockIds})}function nt(e,a){const t=e;if(typeof t!="function"||(t.blockCount??0)<2||!Array.isArray(t.blockIds))return e;let r=ge.get(t);return r||(r={lead:ue(t,!0),rest:ue(t,!1)},ge.set(t,r)),a?r.lead:r.rest}const rt="Find by name",lt="Nobody by that name.",ot="Nobody matches.",it="Any";function ct(e,a){const t=l=>l.normalize("NFD").replace(/[\u0300-\u036f]/g,"").toLocaleLowerCase().trim(),r=t(a);return r===""||t(e).includes(r)}function he({typed:e,onType:a,wide:t=!1}){return c("label",{className:`flex max-w-[360px] flex-col gap-1.5${t?" w-full":""}`,children:[s("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:rt}),s("input",{type:"search",value:e,onChange:r=>a(r.target.value),autoComplete:"off",className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent"})]})}function xe({tags:e}){return s("ul",{"aria-label":"Details",className:"flex gap-1.5 overflow-hidden",children:e.map((a,t)=>s("li",{className:"shrink-0 rounded-[var(--sf-button-radius,4px)] border border-line px-2 py-0.5 text-[length:var(--size-label,12px)] text-fg-dim",children:a},`${a}-${t}`))})}function dt({card:e,scaffold:a,lower:t=!1}){return c(Y,{href:e.href||"#",className:`sf-card group relative isolate flex aspect-[3/4] overflow-hidden bg-surface${t?" min-[801px]:mt-16":""}`,"aria-disabled":a||void 0,tabIndex:a?-1:void 0,children:[s("div",{className:"absolute inset-0 transition-transform duration-700 group-hover:scale-[1.03] motion-reduce:transition-none motion-reduce:group-hover:scale-100",children:s(ke,{label:`card-${e.slug}`,src:e.cover||void 0,sizes:"(max-width: 800px) 50vw, 25vw"})}),s("div",{"aria-hidden":!0,className:"absolute inset-0 z-0",style:{background:"linear-gradient(180deg, transparent 45%, color-mix(in srgb, var(--bg) 88%, transparent) 100%)"}}),e.meta&&s("span",{className:"absolute left-3 top-3 z-[1] rounded-[var(--sf-button-radius,999px)] bg-bg/85 px-2.5 py-1 font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.16em] text-accent",children:x(e.meta)}),c("div",{className:"relative z-[1] mt-auto flex w-full flex-col gap-1 p-4 max-view-wide:p-3",children:[s("h3",{className:"font-heading3 text-[length:var(--size-headingSmall,24px)] leading-[1.1] tracking-[-0.01em] text-fg",children:_(e.title,!1)}),e.dateLabel&&s("p",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.16em] text-accent",children:x(e.dateLabel)}),e.tags&&e.tags.length>0&&s(xe,{tags:e.tags}),e.excerpt&&s("p",{className:"line-clamp-2 text-[length:var(--size-body,14px)] leading-[1.45] text-fg-dim",children:x(e.excerpt)})]})]})}function ft({cards:e,scaffold:a}){return s("nav",{"aria-label":"Days",className:V.nav,children:s("ul",{className:V.list,children:e.map((t,r)=>{const l=!!t.meta;return s("li",{children:c(Y,{href:t.href||"#","aria-current":l?"page":void 0,"aria-disabled":a||void 0,tabIndex:a?-1:void 0,className:V.tab(l),children:[s("span",{className:"font-heading3 text-[length:var(--size-body,15px)] leading-[1.2]",children:_(t.title,!1)}),t.excerpt&&s("span",{className:`font-mono text-[length:var(--size-label,11px)] uppercase tracking-[0.14em] ${l?"opacity-80":"text-fg-dim"}`,children:x(t.excerpt)})]})},`${t.slug}-${r}`)})})})}function pt({count:e,words:a,href:t}){const r=c("span",{className:"inline-flex items-baseline gap-3",children:[s("span",{className:"font-heading text-[length:var(--size-headingLarge,64px)] leading-none text-accent",children:e}),a!==void 0&&s("span",{className:"font-mono text-[length:var(--size-label,13px)] uppercase tracking-[0.2em] text-fg",children:a})]});return t?s(Y,{href:t,className:"inline-flex hover:opacity-85",children:r}):r}const B="[&>[data-sf-repeat]>*]:h-full [&>[data-sf-repeat]>*>*]:h-full",mt="[&>[data-sf-repeat]]:h-full [&>[data-sf-repeat]>*]:h-full [&>[data-sf-repeat]>*>*]:h-full",gt="relative z-[2] bg-bg py-[120px] max-view-wide:py-[70px]",ut="relative z-[2] bg-bg pt-0 pb-[120px] max-view-wide:pt-0 max-view-wide:pb-[70px]",ht="relative z-[2] bg-bg py-[32px] max-view-wide:py-[24px]",xt={top:32,bottom:32};function vt({num:e,title:a,link:t,posts:r,columns:l,limit:d,showAll:b=!1,editing:N=!1,cardImage:C,gap:ve,gapPhone:be,layout:g,featuredWidth:Ne,listCover:Ee=!0,featuredDarken:Te,omitHead:E=!1,sample:L,nameFilter:ye=!1,pads:K,template:W,ownerId:we=""}){const[S,H]=te(""),[G,_e]=te({}),T=Se("ev"),X=r??[],J=b?X.length:typeof d=="number"&&d>0?d:oe,$=X.slice(0,J),m=N&&$.length===0;if($.length===0&&!N)return null;const q=b?oe:J,f=m?L?.length?L.slice(0,b?L.length:q):Array.from({length:q},(n,i)=>({slug:`placeholder-${i}`,title:A("Blog post title"),excerpt:A("A short summary of the post appears here."),cover:"",meta:A("Journal"),dateLabel:A("Date")})):$,o=$e("Events",ve,"both",be),y=g===ie&&f.length>1,Q=Qe(Ne),O=g===ce,k=g===fe,Z=Ge.includes(g??""),R=ye&&!O&&!k&&!y,I=R?We(f):[],h=R?f.filter(n=>ct(n.title,S)&&He(n,G)):f,F=k?ae(K,xt,{nonNegative:!0}):ae(K,Fe,{noTop:E,nonNegative:!0}),D=F.style,Ae=!N&&De(e,a,t?.text),M=(W?.blockCount??0)>0?et:Ze,z=g===v?M[3]:M[Math.min(4,Math.max(2,l??3))]??M[3],U=pe[Math.min(4,Math.max(1,l??3))]??pe[3],ee=O||y||g===v?"":Ie(T,Z?z:U,{cards:h.length}),P=(n,i,p)=>s(Me,{ownerId:we,ownerType:"Events",Template:nt(W,y),rows:n.map(u=>me(u,m)),items:n.map(u=>tt(u,m)),fallback:i,children:u=>p(Ce.toArray(u))});return k?s(re,{as:"section",className:ne(ht,F),style:Object.keys(D).length?D:void 0,children:s("div",{className:se,children:s(pt,{count:f.length,words:E||a===void 0?void 0:_(a,!1),href:E?void 0:t?.href})})}):s(re,{as:"section",className:ne(E?ut:gt,F),style:{...Re(C),...D},children:c("div",{className:se,children:[E||Ae?null:s(Oe,{num:e!==void 0?x(e):void 0,title:a!==void 0?_(a,!1):void 0,link:t?{text:x(t.text),href:t.href}:void 0}),R&&c("div",{className:"mb-6 flex flex-col gap-2",children:[I.length===0?s(he,{typed:S,onType:H}):c("div",{className:"flex flex-wrap items-end gap-3",children:[s(he,{typed:S,onType:H,wide:!0}),I.map(({label:n,values:i})=>c("label",{className:"flex min-w-[140px] flex-col gap-1.5 max-view-wide:flex-1",children:[s("span",{className:"font-mono text-[length:var(--size-label,12px)] uppercase tracking-[0.18em] text-fg-dim",children:n}),c("select",{value:G[n]??"",onChange:p=>_e(u=>({...u,[n]:p.target.value})),className:"rounded-[var(--sf-button-radius,6px)] border border-line bg-bg px-4 py-2.5 text-[length:var(--size-body,15px)] text-fg outline-none focus:border-accent",children:[s("option",{value:"",children:it}),i.map(p=>s("option",{value:p,children:p},p))]})]},n))]}),h.length===0&&s("p",{role:"status",className:"text-[length:var(--size-body,14px)] text-fg-dim",children:I.length===0?lt:ot})]}),ee&&s("style",{children:ee}),O?s(ft,{cards:f,scaffold:m}):Z?P(h,s("div",{className:`${T} sf-card-grid grid${o.className} ${z}`,style:o.style,children:h.map((n,i)=>s(dt,{card:n,scaffold:m,lower:g===v&&i%3===1},`${n.slug}-${i}`))}),n=>s("div",{className:`${T} sf-card-grid grid${o.className} ${z} ${B}`,style:o.style,children:g===v?n.map((i,p)=>s("div",{className:`${mt}${p%3===1?" view-wide:mt-16":""}`,children:i},p)):n})):y?P(f,c("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-view-wide:grid-cols-1${o.className}`,style:{...o.style,"--sf-events-split":Q},children:[s(w,{post:f[0],href:f[0].href,scaffold:m,layout:"cover",darken:Te??Je,darkenStyle:qe,placement:Xe},`${f[0].slug}-0`),s("div",{className:`grid auto-rows-min${o.className}`,style:o.style,children:f.slice(1).map((n,i)=>s(w,{post:n,href:n.href,scaffold:m,showCover:Ee},`${n.slug}-${i+1}`))})]}),n=>c("div",{className:`sf-card-grid grid grid-cols-[var(--sf-events-split)] max-view-wide:grid-cols-1${o.className} ${B}`,style:{...o.style,"--sf-events-split":Q},children:[n[0],s("div",{className:`grid auto-rows-min${o.className}`,style:o.style,children:n.slice(1)})]})):P(h,s("div",{className:`${T} sf-card-grid grid${o.className} ${U}`,style:o.style,children:h.map((n,i)=>n.tags&&n.tags.length>0?c("div",{className:"flex flex-col gap-2",children:[s(w,{post:n,href:n.href,scaffold:m}),s(xe,{tags:n.tags})]},`${n.slug}-${i}`):s(w,{post:n,href:n.href,scaffold:m},`${n.slug}-${i}`))}),n=>s("div",{className:`${T} sf-card-grid grid${o.className} ${U} ${B}`,style:o.style,children:n}))]})})}export{j as EVENTS_FEATURED_WIDTH,jt as EVENTS_LAYOUTS,fe as EVENTS_LAYOUT_COUNT,Bt as EVENTS_LAYOUT_FALLBACK,ie as EVENTS_LAYOUT_FEATURED,de as EVENTS_LAYOUT_PORTRAIT,v as EVENTS_LAYOUT_SPREAD,ce as EVENTS_LAYOUT_TABS,Ge as EVENTS_PHOTO_LAYOUTS,Be as MAX_CARD_TAGS,vt as default,We as facetChoices,He as matchesFacets,ct as matchesName,Yt as readFacets,Vt as readTags};
|
|
@@ -2,8 +2,7 @@ import type { SlotComponent } from "efficient-easel/blocks";
|
|
|
2
2
|
import type { ProductPictureTile } from "../lib/sections/product-pictures.js";
|
|
3
3
|
export interface GalleryGridProps {
|
|
4
4
|
omitHead?: boolean;
|
|
5
|
-
|
|
6
|
-
padBottom?: number;
|
|
5
|
+
pads?: Record<string, unknown>;
|
|
7
6
|
editing?: boolean;
|
|
8
7
|
items?: SlotComponent;
|
|
9
8
|
sourced?: readonly ProductPictureTile[];
|
|
@@ -23,4 +22,4 @@ export interface GalleryGridProps {
|
|
|
23
22
|
gap?: number | string;
|
|
24
23
|
gapPhone?: unknown;
|
|
25
24
|
}
|
|
26
|
-
export default function GalleryGrid({ items: Items, sourced, num, title, linkText, linkHref, galleryHref, submitHref, previewHover, display, displayPhone, styleOwner, layout, columns, columnsMobile, gap: gapProp, gapPhone, omitHead,
|
|
25
|
+
export default function GalleryGrid({ items: Items, sourced, num, title, linkText, linkHref, galleryHref, submitHref, previewHover, display, displayPhone, styleOwner, layout, columns, columnsMobile, gap: gapProp, gapPhone, omitHead, pads, editing, }: GalleryGridProps): import("react").JSX.Element;
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as
|
|
2
|
-
`),
|
|
3
|
-
`):[]:i?.blockIds,[f,i?.blockIds]),g=u(()=>(
|
|
1
|
+
"use client";import{jsx as r,jsxs as H}from"react/jsx-runtime";import{useCallback as J,useMemo as u,useState as Q}from"react";import{usePathname as Z}from"next/navigation";import{containerGapProps as ee}from"efficient-web-builder/format/lib/content/container-gap";import se from"efficient-web-builder/render/components/Btn";import re,{GALLERY_GRID_ATTR as te,GalleryLinksContext as le,GalleryTilesContext as ne}from"./GalleryItem.js";import{useShopperGallery as oe}from"./catalog/ShopperScope.js";import{galleryShownIds as ae,galleryToolbarIdle as ie,WALL_PLACED_CELL as de,WALL_PLACED_CSS as ce,wallSpanAt as me}from"../lib/sections/gallery-toolbar.js";import{useSiteSells as pe}from"./SiteRecordContext.js";import{SharedPartKinds as fe}from"efficient-web-builder/render/components/PublishedPartStylesContext";import{renderHeadline as ge}from"efficient-web-builder/render/components/goldPhrases";import ue from"efficient-web-builder/render/components/SectionHeader";import{FRAME_120 as ye,framedBandPad as he,headIsEmpty as xe,withBandClasses as we}from"../lib/sections/band-padding.js";import{resolveGridColumns as ve,resolveGridMobileColumns as Le}from"efficient-web-builder/format/lib/content/grid-span";import{galleryLayoutClass as Ne,galleryLayoutCss as be,resolveGalleryLayout as Se}from"efficient-web-builder/format/lib/content/gallery-layout";import{HideTaker as _e}from"efficient-web-builder/render/components/ViewHideRoot";const Ge="relative z-[2] bg-bg py-[120px] max-view-wide:py-[70px]",Ce="relative z-[2] bg-bg pt-0 pb-[120px] max-view-wide:pt-0 max-view-wide:pb-[70px]",Ae="mx-auto max-w-[var(--sf-site-width,1600px)] px-[var(--sf-site-gutter,40px)] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))]";function Ee({items:i,sourced:d,num:w,title:y,linkText:v,linkHref:I,galleryHref:m="/gallery",submitHref:R="/contact",previewHover:k,display:M,displayPhone:T,styleOwner:j,layout:L,columns:p,columnsMobile:B,gap:O,gapPhone:z,omitHead:h=!1,pads:$,editing:N=!1}){const D=Z(),F=pe(),W=m!==D&&(F||m!=="/gallery"),b=Se(L),o=b?L:null,K=!b&&p!=null&&p!=="",a=ee("GalleryB",O,"both",z),S=o?{className:`sf-card-grid sf-gallery-zone ${Ne(o)} grid${a.className}`,style:a.style}:K?{className:`sf-card-grid sf-grid-zone grid${a.className}`,style:{...a.style,"--sf-grid-cols":String(ve(p)),"--sf-grid-cols-phone":String(Le(B,p))}}:{className:`sf-card-grid grid grid-cols-4${a.className} max-[1500px]:grid-cols-3 max-view-wide:grid-cols-1`,style:a.style},_=v?{text:v,href:I||"#"}:void 0,U=y?ge(y,!1):void 0,[G,V]=Q({}),C=J((e,t)=>{V(s=>{const n=s[e.id];if(t){if(!n)return s;const{[e.id]:Pe,...q}=s;return q}return n&&n.tag===e.tag&&n.name===e.name?s:{...s,[e.id]:e}})},[]),f=d?.map(e=>e.tile.id).join(`
|
|
2
|
+
`),A=u(()=>f!==void 0?f?f.split(`
|
|
3
|
+
`):[]:i?.blockIds,[f,i?.blockIds]),g=u(()=>(A??[]).map(e=>G[e]).filter(e=>!!e),[A,G]),{ref:X,toolbar:c}=oe(g),E=c!==null&&!ie(c,g),l=u(()=>E&&c?ae(g,c):null,[E,c,g]),Y=u(()=>{const e=new Map((l??[]).map((t,s)=>[t,s]));return{report:C,positionOf:t=>{const s=l?e.get(t):void 0;return s===void 0?null:{index:s+1,total:l.length}}}},[C,l]),x=l?e=>{const t=l.indexOf(e);if(t<0)return{style:{display:"none"}};if(!o)return{style:{order:t}};const s=me(o,t,l.length);return{className:de,style:{order:t,"--sf-wall-c":s.col,"--sf-wall-r":s.row,"--sf-wall-cp":s.colPhone,"--sf-wall-rp":s.rowPhone}}}:void 0,P=he($,ye,{noTop:h,nonNegative:!0});return r(_e,{as:"section",ref:X,className:we(h?Ce:Ge,P),style:P.style,children:H("div",{className:Ae,children:[h||!N&&xe(w,y,_?.text)?null:r(ue,{num:w,title:U,link:_}),o&&r("style",{dangerouslySetInnerHTML:{__html:be(o)+(l?ce:"")}}),(i||d)&&r(le.Provider,{value:{galleryHref:m,submitHref:R,previewHover:k,display:M,displayPhone:T,styleOwner:j,wordsAtRest:!!d},children:r(ne.Provider,{value:Y,children:r(fe,{children:r("div",{[te]:"",style:{display:"contents"},children:d?r("div",{...S,children:d.map(({tile:e,...t})=>{const s=r(re,{...t,tile:e,editing:N},e.id),n=x?.(e.id);return n?r("div",{className:n.className,style:n.style,children:s},e.id):s})}):i?r(i,{...S,minEmptyHeight:320,...x?{cell:x}:{}}):null})})})}),W&&r("div",{className:"mt-12 flex flex-col items-center gap-3",children:r(se,{href:m,variant:"ghost",children:"See Gallery"})})]})})}export{Ee as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,Fragment as
|
|
1
|
+
"use client";import{jsx as t,Fragment as S,jsxs as E}from"react/jsx-runtime";import{createContext as A,useContext as O,useMemo as g}from"react";import{CardRowContext as G,CardTemplateRows as p,useCardRow as L}from"efficient-web-builder/render/components/CardRowContext";import{InsideSiteColumn as D}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 k}from"efficient-web-builder/format/lib/animation/hover";import{pickHoverMedia as F}from"efficient-web-builder/format/lib/content/hover-media";import U from"efficient-web-builder/render/components/HoverMediaLayer";import{NO_FIELD_ANSWERS as x}from"../lib/content/field-usage.js";import{CARD_IMAGE_SIZES as $}from"../lib/sections/card-image-sizes.js";import{productTone as j,productToneVaried as W,randomCardColour as b}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 H from"./card-pieces/CardSurfaceFrame.js";import{BundleCardStateProvider as M,TyreCardStateProvider as z,useProductCardState as v,useWheelCardState as R,WheelCardStateProvider as V,tyreCardProduct as q}from"./card-pieces/ProductCardState.js";import{tyrePagePath as Y}from"../lib/tyres/tyre-page-path.js";import{say as K}from"efficient-web-builder/format/lib/editor-words";import{CARD_INDEX_OPTIONS as X,cardIndexCss as J}from"efficient-web-builder/format/lib/sections/product-card-style";import{SHARED_ROWS_LIST_CLASS as Q}from"efficient-web-builder/render/lib/content/box-shared-columns";import{GAP_ZONE_CLASS as Z}from"efficient-web-builder/format/lib/content/container-gap";import{CARD_ROWS_GRID_CLASS as ee,cardRowsGap as re,cardRowsGridStyle as oe}from"./WheelCardFrame.js";function We(e){return X.map(({value:r})=>r==="off"?"":J(e,r).replace(".sf-card-index::before",`.sf-card-index[data-format="${r}"]::before`)).join("")}function Be(e){return e.className.includes(Z)?{className:`${e.className} ${ee} ${Q}`,style:{...e.style,...oe(re(e))}}:e}const te={sale:!1,axleSets:!0,setTotal:!1,wasFollowsSize:!1,quoteSets:!0,showSingle:!1,armOnContact:!1},He={sale:!0,axleSets:!1,setTotal:!0,wasFollowsSize:!0,quoteSets:!1,showSingle:!0,armOnContact:!0},ne={kindLabel:null,brand:!1,process:!0,tyreBrand:!0},ae=[],T={ownerId:"",ownerType:"ProductGrid",Template:void 0,hover:k({},"ProductGrid"),imageSizes:$,fieldUsage:x,tyreFieldUsage:x,reserveEyebrow:!1,editing:!1,eyebrow:ne,fit:null,colours:ae,rules:te},_=A(T);function u(){return O(_)}function Me({value:e,children:r}){const o=g(()=>({...T,...se(e)}),[e]);return t(_.Provider,{value:o,children:r})}const se=e=>Object.fromEntries(Object.entries(e).filter(([,r])=>r!==void 0));function w(e,r){const o=e.designCode??e.slug??"";return{name:e.name??"",eyebrow:e.process??"",note:"",href:e.slug?`/wheels/${e.slug}`:"",colour:j(r),colourVaried:W(r,o),colourRandom:b(o)}}function ie(e){const r=e.designCode||e.slug||"";return{name:e.name??"",eyebrow:e.brand??"",note:"",href:Y(e.slug)??"",colour:"",colourVaried:"",colourRandom:b(r)}}const I=e=>`/bundles/${e.slug}`;function de(e){return{name:e.name,eyebrow:"",note:e.subtitle??"",href:I(e),colour:"",colourVaried:"",colourRandom:""}}const le="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)]",ce="sf-card group relative flex flex-col border border-line bg-bg transition-colors hover:border-accent",ue="col-span-2 max-view-wide:col-span-1 @max-[720px]:col-span-1 [&:has([data-set-picture=one])]:col-span-1",me=`relative flex-1 ${N}`;function y({copy:e,href:r,label:o,wide:n=!1,kit:a=!1,probes:s,arm:m,layer:l}){const{editing:d}=u();return t(H,{surface:a?ce:le,span:n?ue:void 0,href:r,label:o,linked:!d,probes:s,arm:m,layer:l,children:t("div",{className:me,children:t(D,{children:e})})})}const fe="var(--card-bg)";function pe(e,r=fe){const{hover:o}=u(),n=v();if(o.kind!=="nextImage"||o.media?.cover!==e||n.kind!=="wheel")return null;const a=F(n.wheel,o.media,n.sel.finish?.name);return a?t(U,{media:a,name:n.wheel.name,cover:e,ground:r}):null}function Ce({children:e}){const r=L(),{wheel:o,sel:n}=R(),a=n.finish?.color,s=g(()=>r?{...r,row:w(o,a)}:null,[r,o,a]);return s?t(G.Provider,{value:s,children:e}):t(S,{children:e})}function we({copy:e}){const{wheel:r,sel:o,isSet:n}=R(),{rules:a}=u(),s=pe("card");return E(S,{children:[t(y,{copy:t(Ce,{children:e}),href:r.slug?`/wheels/${r.slug}`:"",label:r.name,wide:n,probes:o.probes,arm:a.armOnContact?o.arm:void 0,layer:s}),t(B,{})]})}function P(e,r,o,n){const a=r.item;return t(V,{wheel:a,colours:o.colours,defaultFinish:n?.[r.index],editing:o.editing,children:t(C.Provider,{value:"catalog",children:t(we,{copy:e})})})}function ze({wheels:e,finishes:r,children:o}){const n=u(),{ownerId:a,ownerType:s,Template:m,editing:l}=n;return t(p,{ownerId:a,ownerType:s,Template:m,rows:e.map(d=>w(d)),items:e,fallback:l?t(h,{}):null,wrapCopy:(d,i)=>P(d,i,n,r),children:o})}function Ve({items:e,tyreOf:r,tyreFit:o}){const n=u(),{ownerId:a,ownerType:s,Template:m,editing:l}=n,d=e.map(i=>r(i));return t(p,{ownerId:a,ownerType:s,Template:m,rows:e.map((i,f)=>{const c=d[f];return c?ie(c):w(i)}),items:e,fallback:l?t(h,{}):null,wrapCopy:(i,f)=>{const c=d[f.index];return c?he(i,q(c,o?.(c)??null),l):P(i,f,n)},children:i=>i})}function ye({copy:e}){const r=v();if(r.kind!=="tyre")throw new Error("A tyre card surface was drawn outside its tyre state.");return t(y,{copy:e,href:r.pagePath??"",label:r.tyre.name,arm:r.arm})}function he(e,r,o){return t(z,{tyre:r,editing:o,children:t(C.Provider,{value:"catalog",children:t(ye,{copy:e})})})}function Se(e,r){const o=r.item;return t(M,{bundle:o,children:t(C.Provider,{value:"catalog",children:t(y,{copy:e,href:I(o),label:o.name,kit:!0})})})}function qe({bundles:e,children:r}){const{ownerId:o,ownerType:n,Template:a,editing:s}=u();return t(p,{ownerId:o,ownerType:n,Template:a,rows:e.map(de),items:e,fallback:s?t(h,{}):null,wrapCopy:Se,children:r})}function h(){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:K("The card is empty. Add parts to its card template in Layers.")})}export{te as GRID_CARD_RULES,qe as GridBundleCards,Me as GridCardProvider,ze as GridCards,Ve as GridMixedCards,He as LISTING_CARD_RULES,de as bundleCardRow,I as bundlePagePath,Be as cardRowsGrid,We as gridIndexCss,w as productCardRow,ie as tyreCardRow,pe as useCardHoverLayer,u as useGridCard};
|
|
@@ -32,7 +32,8 @@ interface Props {
|
|
|
32
32
|
num?: string;
|
|
33
33
|
title?: string;
|
|
34
34
|
titleSize?: TitleSize;
|
|
35
|
-
|
|
35
|
+
pads?: Record<string, unknown>;
|
|
36
|
+
noTop?: boolean;
|
|
36
37
|
description?: string;
|
|
37
38
|
link?: {
|
|
38
39
|
text: string;
|
|
@@ -58,5 +59,5 @@ interface Props {
|
|
|
58
59
|
ownerId?: string;
|
|
59
60
|
template?: SlotComponent;
|
|
60
61
|
}
|
|
61
|
-
export default function ProductGridSection({ num, catalog, catalogTotal, firstCountInChips, kinds, title, titleSize,
|
|
62
|
+
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, gap: gapProp, gapPhone, }: Props): import("react").JSX.Element | null;
|
|
62
63
|
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as h,Fragment as it}from"react/jsx-runtime";import{useScopeClass as st}from"../lib/use-scope-class.js";import{useEffect as O,useMemo as p,useState as de}from"react";import{cardHoverOf as ot}from"efficient-web-builder/format/lib/animation/hover";import{containerGapProps as at}from"efficient-web-builder/format/lib/content/container-gap";import lt from"next/link";import{cardRowsGrid as mt,GridCardProvider as dt,GridMixedCards as ct,gridIndexCss as pt}from"./GridCardTemplate.js";import{gridClassImageSizes as ut}from"../lib/sections/card-image-sizes.js";import{fillRowCss as ce}from"../lib/sections/fill-row.js";import{hiddenCardsRule as pe,noHoleBands as ue,noHoleCss as ge,ONE_WHEEL_MARK as gt,oneWheelScope as fe,pairScope as ft,showsASetCard as he}from"../lib/sections/grid-no-hole.js";import{setIsWide as ht,summarySetBuild as xt}from"../lib/wheels/set-mode.js";import{answersForKind as xe,NO_FIELD_ANSWERS as we}from"../lib/content/field-usage.js";import{wheelCardEyebrowShows as wt}from"./ProductCardEyebrow.js";import vt from"./NoCurrencyNote.js";import{SITE_WIDTH_CAP as yt,centredCap as bt}from"efficient-web-builder/format/lib/content/page-width";import{ProductCatalogProvider as St,SectionWheelsProvider as Ct}from"./ProductRef.js";import{useCurrency as Mt}from"./CurrencyContext.js";import{COLLECTION_ATTR as Nt,useCatalogFilter as Et}from"./catalog/CatalogFilterContext.js";import{useIsoLayoutEffect as $t,useShopperMember as Tt}from"./catalog/ShopperScope.js";import Pt from"./wheels-plp/PlpPagination.js";import{CATALOG_TEXT_SIZE as zt}from"../lib/sections/catalog-text-size.js";import{applyShopperFilters as Lt,hasActivePlpFilters as It,plpPricedAmounts as _t}from"../lib/wheels/plp-filters.js";import Ot from"./catalog/ClearAllButton.js";import{gridPagingOf as At,gridShownOf as Ht}from"../lib/sections/product-grid-pages.js";import Bt from"./SectionBand.js";import{useInsideBox as Rt,useInsideSiteGutter as Ft}from"efficient-web-builder/render/components/SiteGutterFrame";import{productGridColumnsClass as Gt}from"../lib/sections/product-grid-columns.js";import{renderGold as Q,renderHeadline as kt}from"efficient-web-builder/render/components/goldPhrases";import{applyCatalogFilters as Wt}from"../lib/wheels/catalog-filters.js";import{normalizeCatalogRows as jt}from"../lib/wheels/wheel-summary-casing.js";import{itemKind as A,plpKindNoun as ve}from"../lib/catalog/plp-item.js";import{filterBarCategoryOf as Ut,gridKindsOf as ye,gridRowsOf as Kt}from"../lib/wheels/grid-source.js";import{useUnifiedProductCatalog as Xt}from"./useProductCatalog.js";import{STICKY_UNDERHEADER_CLASS as Dt}from"efficient-web-builder/render/lib/document/header-clearance";import{finishFamiliesOf as Zt}from"../lib/wheels/finish-defaults.js";import{lugCountsOf as qt}from"../lib/wheels/lug-count.js";import{diametersOf as Vt}from"../lib/wheels/size-range.js";import{say as Yt}from"efficient-web-builder/format/lib/editor-words";import{DEFAULT_TITLE_SIZE as Jt}from"../lib/sections/product-grid-title.js";const Qt=ot({},"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)]"},be=[{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 er(C){return(be.find(x=>x.value===C)??be.find(x=>x.value===Jt)).cls}function tr({num:C,catalog:x,catalogTotal:Se,firstCountInChips:Ce=!1,kinds:T,title:H,titleSize:Me,padTop:ee,description:P,link:M,products:Ne,wheels:Ee,source:c,columns:$e,columnsPhone:Te,columnsTablet:Pe,limit:ze,moreProducts:Le,perPage:Ie,editing:N,contentCapped:_e=!1,hover:Oe,fieldUsage:w,ownerId:Ae="",template:He,gap:Be,gapPhone:Re}){const B=p(()=>w?xe(w,"alloy-wheel"):void 0,[w]),Fe=p(()=>w?xe(w,"tyre"):void 0,[w]),e=st("pg"),{paged:v,per:y,limit:l,cap:E}=At({moreProducts:Le,perPage:Ie,limit:ze}),m=Gt($e,Te,Pe),te=_e,Ge=Ft(),ke=Rt(),We=Ge||ke,R=Xt(N===!0&&!!c),s=p(()=>c?jt(Kt(c,T,R??x??[])):null,[x,R,c,T]),F=Tt("grid",s),a=s?F.scope:null,u=Ut(c),b=u!==null&&!a,{filters:z,reportCount:G,reportLugs:k,reportSizes:W,reportFinishes:j,reportCategories:U,reportPrices:K,vehicle:re}=Et(),{currency:g}=Mt(),X=b&&!!z.process&&z.process!==u,D=a?.state,n=p(()=>s?D?Lt(s,D,g):b?Wt(s,z,g,re.fit):s:null,[s,D,b,z,g,re.fit]),[je,Ue]=de(1),Z=v&&n?Math.max(1,Math.ceil(n.length/y)):1,S=Math.min(Z,Math.max(1,a?a.state.page:je)),{reportShown:q}=F,ne=a!==null;$t(()=>{if(!ne||!n)return q(null);q(Ht(n.length,{paged:v,per:y,cap:E},S))},[ne,n,q,v,S,y,E]);const Ke=r=>a?a.update({page:r}):Ue(r),o=p(()=>v&&n?n.slice((S-1)*y,S*y):n,[v,n,S,y]);O(()=>(U(e,u===null?[]:[u]),()=>U(e,[])),[u,U,e]),O(()=>{if(b)return G(e,X?0:n?.length??0),()=>G(e,0)},[b,X,n,G,e]);const $=p(()=>({lugs:qt(s??[]),sizes:Vt(s??[]),finishes:Zt(s??[]),prices:_t((s??[]).filter(r=>A(r)!=="tyre"),g)}),[s,g]);O(()=>(k(e,$.lugs),W(e,$.sizes),j(e,$.finishes),K(e,$.prices),()=>{k(e,[]),W(e,[]),j(e,[]),K(e,[])}),[$,k,W,j,K,e]);const V=at("ProductGrid",Be,"both",Re),Xe=`${e} grid${V.className} bg-[var(--catalog-grid-bg)] ${m}`,ie=mt(V),De=`${e} grid${ie.className} bg-[var(--catalog-grid-bg)] ${m}`,Ze=ie.style,qe=p(()=>{const r=(n??[]).filter(d=>A(d)!=="tyre");if(r.length===0)return!1;const f=r.some(d=>!!d.process);return r.some(d=>!!d.setWords)||wt({kind:!1,brand:!1,process:f},B??[])},[n,B]),Ve=o?o.length>0?t("div",{className:De,style:Ze,children:t(ct,{items:o,tyreOf:r=>A(r)==="tyre"?r:null})}):a&&It(a.state)?h("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 bg-surface-2 p-4 text-center",children:[t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:`No ${ve(ye(c,T)).many} match those filters`}),t(Ot,{onClick:a.clear})]}):N?t("div",{className:"flex min-h-[320px] items-center justify-center rounded bg-surface-2 p-4 text-center",children:t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:Yt("No products in “{name}” yet",{name:c?.name??""})})}):null:t(Ne,{className:Xe,style:V.style,minEmptyHeight:320}),Ye=a?a.countInChips:Ce,L=n&&!Ye?n===s&&!R?Se??n.length:n.length:null,se=ve(ye(c,T)),Je=C||H||P||M?h("div",{className:`${Dt} 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||We?"":"-mx-[var(--sf-site-gutter,40px)] px-[var(--sf-site-gutter,40px)] max-view-wide:-mx-[min(20px,var(--sf-site-gutter,40px))] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))]"}`,children:[h("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:[C&&t("span",{className:`font-mono ${i.labelLarge} leading-none uppercase tracking-[0.22em] text-fg-dim`,children:Q(C)}),H&&t("h2",{className:`${er(Me)} leading-none text-fg max-view-wide:leading-[1] [&>span]:block`,children:kt(H,!1)})]}),(P||M||L!==null)&&h("div",{className:"flex items-center gap-5 max-view-wide:gap-3 view-wide:grow view-wide:justify-end",children:[P&&t("span",{className:`max-w-[340px] truncate font-display ${i.body} leading-[1.4] text-fg-dim max-view-wide:hidden view-wide:w-0 view-wide:grow view-wide:text-right`,children:Q(P)}),M&&h(lt,{href:M.href,className:`inline-flex items-center gap-2 whitespace-nowrap font-mono ${i.labelLarge} uppercase tracking-[0.2em] text-fg-dim transition-colors hover:text-fg`,children:[Q(M.text),t("span",{"aria-hidden":!0,children:"→"})]}),L!==null&&h("span",{className:`whitespace-nowrap font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:[L," ",L===1?se.one:se.many]})]})]}):null,Qe=typeof ee=="number"?{"--pg-pt":`${ee}px`}:{},I=p(()=>{if(!o)return null;const r=o.map(f=>A(f)!=="tyre"&&ht(xt(f))?2:1);return he(r,l)?ue(m,r,l):null},[o,m,l]),[et,tt]=de("");O(()=>{if(o)return;const r=document.querySelector(`.${e}`);if(!r)return;const f=()=>{const d=[...r.children].map(me=>me.classList.contains("col-span-2")&&!me.querySelector(gt)?2:1);tt(he(d,l)?ge(e,ue(m,d,l,!1),d.length):"")};f();const J=new MutationObserver(f);return J.observe(r,{childList:!0}),()=>J.disconnect()},[o,e,m,l]);const rt=I?I[0].tracks:o?E?Math.min(o.length,l):o.length:void 0,_=I?ge(ft(e),I,o.length)+(E?pe(fe(e),l+1):"")+ce(fe(e),m,{limit:l,cards:o.length}):et,oe=_?"":ce(e,m,{limit:l,cards:o?.length}),ae=pt(e),le=h(it,{children:[E&&!_&&t("style",{children:pe(e,l+1)}),_&&t("style",{children:_}),oe&&t("style",{children:oe}),ae&&t("style",{children:ae}),Je,Ve,v&&Z>1&&t(Pt,{textSize:zt.labelSmall,page:S,pageCount:Z,onPage:Ke}),t(vt,{editing:N})]});if(X)return null;const Y=t(Bt,{rootRef:F.ref,attrs:b&&u!==null?{[Nt]:u}:void 0,className:"relative z-[2] bg-bg px-[var(--sf-site-gutter,40px)] pt-[var(--pg-pt)] pb-[120px] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))] max-view-wide:pt-[70px] max-view-wide:pb-[70px]",column:null,inAnyBox:!0,style:Qe,defaults:{"--pg-pt":"120px"},children:te?t("div",{style:bt(yt),children:le}):le}),nt=s?Y:N?t(St,{currency:g,children:Y}):t(Ct,{wheels:Ee,currency:g,children:Y});return t(dt,{value:{ownerId:Ae,Template:He,hover:Oe??Qt,imageSizes:ut(m,rt),fieldUsage:B??we,tyreFieldUsage:Fe??we,reserveEyebrow:qe,editing:N===!0},children:nt})}export{be as TITLE_SIZES,tr as default};
|
|
1
|
+
"use client";import{jsx as t,jsxs as h,Fragment as dt}from"react/jsx-runtime";import{useScopeClass as mt}from"../lib/use-scope-class.js";import{useEffect as R,useMemo as p,useState as pe}from"react";import{cardHoverOf as ct}from"efficient-web-builder/format/lib/animation/hover";import{containerGapProps as pt}from"efficient-web-builder/format/lib/content/container-gap";import ut from"next/link";import{cardRowsGrid as gt,GridCardProvider as ft,GridMixedCards as ht,gridIndexCss as xt}from"./GridCardTemplate.js";import{gridClassImageSizes as wt}from"../lib/sections/card-image-sizes.js";import{fillRowCss as ue}from"../lib/sections/fill-row.js";import{hiddenCardsRule as ge,noHoleBands as fe,noHoleCss as he,ONE_WHEEL_MARK as vt,oneWheelScope as xe,pairScope as yt,showsASetCard as we}from"../lib/sections/grid-no-hole.js";import{setIsWide as bt,summarySetBuild as Ct}from"../lib/wheels/set-mode.js";import{answersForKind as ve,NO_FIELD_ANSWERS as ye}from"../lib/content/field-usage.js";import{wheelCardEyebrowShows as St}from"./ProductCardEyebrow.js";import Mt from"./NoCurrencyNote.js";import{SITE_WIDTH_CAP as Nt,centredCap as Tt}from"efficient-web-builder/format/lib/content/page-width";import{ProductCatalogProvider as Et,SectionWheelsProvider as $t}from"./ProductRef.js";import{useCurrency as Pt}from"./CurrencyContext.js";import{PRODUCT_GRID_ROOM as zt,framedBandPad as Lt,withBandClasses as Ot}from"../lib/sections/band-padding.js";import{COLLECTION_ATTR as _t,useCatalogFilter as It}from"./catalog/CatalogFilterContext.js";import{useIsoLayoutEffect as Rt,useShopperMember as At}from"./catalog/ShopperScope.js";import Bt from"./wheels-plp/PlpPagination.js";import{CATALOG_TEXT_SIZE as Ht}from"../lib/sections/catalog-text-size.js";import{applyShopperFilters as Gt,hasActivePlpFilters as Ft,plpPricedAmounts as kt}from"../lib/wheels/plp-filters.js";import Ut from"./catalog/ClearAllButton.js";import{gridPagingOf as Wt,gridShownOf as jt}from"../lib/sections/product-grid-pages.js";import Dt from"./SectionBand.js";import{useInsideBox as Kt,useInsideSiteGutter as Xt}from"efficient-web-builder/render/components/SiteGutterFrame";import{productGridColumnsClass as Zt}from"../lib/sections/product-grid-columns.js";import{renderGold as ee,renderHeadline as qt}from"efficient-web-builder/render/components/goldPhrases";import{applyCatalogFilters as Vt}from"../lib/wheels/catalog-filters.js";import{normalizeCatalogRows as Yt}from"../lib/wheels/wheel-summary-casing.js";import{itemKind as A,plpKindNoun as be}from"../lib/catalog/plp-item.js";import{filterBarCategoryOf as Jt,gridKindsOf as Ce,gridRowsOf as Qt}from"../lib/wheels/grid-source.js";import{useUnifiedProductCatalog as er}from"./useProductCatalog.js";import{STICKY_UNDERHEADER_CLASS as tr}from"efficient-web-builder/render/lib/document/header-clearance";import{finishFamiliesOf as rr}from"../lib/wheels/finish-defaults.js";import{lugCountsOf as nr}from"../lib/wheels/lug-count.js";import{diametersOf as ir}from"../lib/wheels/size-range.js";import{say as sr}from"efficient-web-builder/format/lib/editor-words";import{DEFAULT_TITLE_SIZE as ar}from"../lib/sections/product-grid-title.js";const or=ct({},"ProductGrid"),i={headingMediumUpTo800Xs:"max-view-wide:text-[length:var(--size-headingMedium,28px)]",headingMediumUpTo800Small:"max-view-wide:text-[length:var(--size-headingMedium,32px)]",headingMediumUpTo800Large:"max-view-wide:text-[length:var(--size-headingMedium,36px)]",headingMediumUpTo800Xl:"max-view-wide:text-[length:var(--size-headingMedium,40px)]",body:"text-[length:var(--size-body,13px)]",headingMedium1:"text-[length:var(--size-headingMedium,40px)]",headingMedium2:"text-[length:var(--size-headingMedium,48px)]",headingMedium3:"text-[length:var(--size-headingMedium,56px)]",headingMedium4:"text-[length:var(--size-headingMedium,64px)]",labelSmall:"text-[length:var(--size-label,12px)]",labelLarge:"text-[length:var(--size-label,13px)]"},Se=[{value:"para",label:"Paragraph size — 13px",cls:`font-mono font-normal uppercase tracking-[0.22em] ${i.labelLarge}`},{value:"sm",label:"Small — 40px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium1} ${i.headingMediumUpTo800Xs}`},{value:"md",label:"Medium — 48px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium2} ${i.headingMediumUpTo800Small}`},{value:"lg",label:"Large — 56px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium3} ${i.headingMediumUpTo800Large}`},{value:"xl",label:"Extra large — 64px",cls:`font-heading2 font-medium tracking-[-0.03em] ${i.headingMedium4} ${i.headingMediumUpTo800Xl}`}];function lr(S){return(Se.find(x=>x.value===S)??Se.find(x=>x.value===ar)).cls}function dr({num:S,catalog:x,catalogTotal:Me,firstCountInChips:Ne=!1,kinds:$,title:B,titleSize:Te,pads:Ee,noTop:te=!1,description:P,link:M,products:$e,wheels:Pe,source:c,columns:ze,columnsPhone:Le,columnsTablet:Oe,limit:_e,moreProducts:Ie,perPage:Re,editing:N,contentCapped:Ae=!1,hover:Be,fieldUsage:w,ownerId:He="",template:Ge,gap:Fe,gapPhone:ke}){const H=p(()=>w?ve(w,"alloy-wheel"):void 0,[w]),Ue=p(()=>w?ve(w,"tyre"):void 0,[w]),e=mt("pg"),{paged:v,per:y,limit:l,cap:T}=Wt({moreProducts:Ie,perPage:Re,limit:_e}),d=Zt(ze,Le,Oe),re=Ae,We=Xt(),je=Kt(),De=We||je,G=er(N===!0&&!!c),s=p(()=>c?Yt(Qt(c,$,G??x??[])):null,[x,G,c,$]),F=At("grid",s),o=s?F.scope:null,u=Jt(c),b=u!==null&&!o,{filters:z,reportCount:k,reportLugs:U,reportSizes:W,reportFinishes:j,reportCategories:D,reportPrices:K,vehicle:ne}=It(),{currency:g}=Pt(),X=b&&!!z.process&&z.process!==u,Z=o?.state,n=p(()=>s?Z?Gt(s,Z,g):b?Vt(s,z,g,ne.fit):s:null,[s,Z,b,z,g,ne.fit]),[Ke,Xe]=pe(1),q=v&&n?Math.max(1,Math.ceil(n.length/y)):1,C=Math.min(q,Math.max(1,o?o.state.page:Ke)),{reportShown:V}=F,ie=o!==null;Rt(()=>{if(!ie||!n)return V(null);V(jt(n.length,{paged:v,per:y,cap:T},C))},[ie,n,V,v,C,y,T]);const Ze=r=>o?o.update({page:r}):Xe(r),a=p(()=>v&&n?n.slice((C-1)*y,C*y):n,[v,n,C,y]);R(()=>(D(e,u===null?[]:[u]),()=>D(e,[])),[u,D,e]),R(()=>{if(b)return k(e,X?0:n?.length??0),()=>k(e,0)},[b,X,n,k,e]);const E=p(()=>({lugs:nr(s??[]),sizes:ir(s??[]),finishes:rr(s??[]),prices:kt((s??[]).filter(r=>A(r)!=="tyre"),g)}),[s,g]);R(()=>(U(e,E.lugs),W(e,E.sizes),j(e,E.finishes),K(e,E.prices),()=>{U(e,[]),W(e,[]),j(e,[]),K(e,[])}),[E,U,W,j,K,e]);const Y=pt("ProductGrid",Fe,"both",ke),qe=`${e} grid${Y.className} bg-[var(--catalog-grid-bg)] ${d}`,se=gt(Y),Ve=`${e} grid${se.className} bg-[var(--catalog-grid-bg)] ${d}`,Ye=se.style,Je=p(()=>{const r=(n??[]).filter(m=>A(m)!=="tyre");if(r.length===0)return!1;const f=r.some(m=>!!m.process);return r.some(m=>!!m.setWords)||St({kind:!1,brand:!1,process:f},H??[])},[n,H]),Qe=a?a.length>0?t("div",{className:Ve,style:Ye,children:t(ht,{items:a,tyreOf:r=>A(r)==="tyre"?r:null})}):o&&Ft(o.state)?h("div",{className:"flex min-h-[320px] flex-col items-center justify-center gap-4 bg-surface-2 p-4 text-center",children:[t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:`No ${be(Ce(c,$)).many} match those filters`}),t(Ut,{onClick:o.clear})]}):N?t("div",{className:"flex min-h-[320px] items-center justify-center rounded bg-surface-2 p-4 text-center",children:t("span",{className:`font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:sr("No products in “{name}” yet",{name:c?.name??""})})}):null:t($e,{className:qe,style:Y.style,minEmptyHeight:320}),et=o?o.countInChips:Ne,L=n&&!et?n===s&&!G?Me??n.length:n.length:null,ae=be(Ce(c,$)),tt=S||B||P||M?h("div",{className:`${tr} 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 ${re||De?"":"-mx-[var(--sf-site-gutter,40px)] px-[var(--sf-site-gutter,40px)] max-view-wide:-mx-[min(20px,var(--sf-site-gutter,40px))] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))]"}`,children:[h("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:[S&&t("span",{className:`font-mono ${i.labelLarge} leading-none uppercase tracking-[0.22em] text-fg-dim`,children:ee(S)}),B&&t("h2",{className:`${lr(Te)} leading-none text-fg max-view-wide:leading-[1] [&>span]:block`,children:qt(B,!1)})]}),(P||M||L!==null)&&h("div",{className:"flex items-center gap-5 max-view-wide:gap-3 view-wide:grow view-wide:justify-end",children:[P&&t("span",{className:`max-w-[340px] truncate font-display ${i.body} leading-[1.4] text-fg-dim max-view-wide:hidden view-wide:w-0 view-wide:grow view-wide:text-right`,children:ee(P)}),M&&h(ut,{href:M.href,className:`inline-flex items-center gap-2 whitespace-nowrap font-mono ${i.labelLarge} uppercase tracking-[0.2em] text-fg-dim transition-colors hover:text-fg`,children:[ee(M.text),t("span",{"aria-hidden":!0,children:"→"})]}),L!==null&&h("span",{className:`whitespace-nowrap font-mono ${i.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:[L," ",L===1?ae.one:ae.many]})]})]}):null,oe=Lt(Ee,zt,{noTop:te}),{paddingTop:rt,...nt}=oe.style,O=te?0:rt,it={...O===void 0?{}:{"--pg-pt":typeof O=="number"?`${O}px`:O},...nt},_=p(()=>{if(!a)return null;const r=a.map(f=>A(f)!=="tyre"&&bt(Ct(f))?2:1);return we(r,l)?fe(d,r,l):null},[a,d,l]),[st,at]=pe("");R(()=>{if(a)return;const r=document.querySelector(`.${e}`);if(!r)return;const f=()=>{const m=[...r.children].map(ce=>ce.classList.contains("col-span-2")&&!ce.querySelector(vt)?2:1);at(we(m,l)?he(e,fe(d,m,l,!1),m.length):"")};f();const Q=new MutationObserver(f);return Q.observe(r,{childList:!0}),()=>Q.disconnect()},[a,e,d,l]);const ot=_?_[0].tracks:a?T?Math.min(a.length,l):a.length:void 0,I=_?he(yt(e),_,a.length)+(T?ge(xe(e),l+1):"")+ue(xe(e),d,{limit:l,cards:a.length}):st,le=I?"":ue(e,d,{limit:l,cards:a?.length}),de=xt(e),me=h(dt,{children:[T&&!I&&t("style",{children:ge(e,l+1)}),I&&t("style",{children:I}),le&&t("style",{children:le}),de&&t("style",{children:de}),tt,Qe,v&&q>1&&t(Bt,{textSize:Ht.labelSmall,page:C,pageCount:q,onPage:Ze}),t(Mt,{editing:N})]});if(X)return null;const J=t(Dt,{rootRef:F.ref,attrs:b&&u!==null?{[_t]:u}:void 0,className:Ot("relative z-[2] bg-bg px-[var(--sf-site-gutter,40px)] pt-[var(--pg-pt)] pb-[120px] max-view-wide:px-[min(20px,var(--sf-site-gutter,40px))] max-view-wide:pt-[70px] max-view-wide:pb-[70px]",oe),column:null,inAnyBox:!0,style:it,defaults:{"--pg-pt":"120px"},children:re?t("div",{style:Tt(Nt),children:me}):me}),lt=s?J:N?t(Et,{currency:g,children:J}):t($t,{wheels:Pe,currency:g,children:J});return t(ft,{value:{ownerId:He,Template:Ge,hover:Be??or,imageSizes:wt(d,ot),fieldUsage:H??ye,tyreFieldUsage:Ue??ye,reserveEyebrow:Je,editing:N===!0},children:lt})}export{Se as TITLE_SIZES,dr as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,jsxs as
|
|
1
|
+
"use client";import{jsx as r,jsxs as c,Fragment as f}from"react/jsx-runtime";import{formatPrice as P}from"../../lib/commerce.js";import{say as k}from"efficient-web-builder/format/lib/editor-words";import{HideTaker as p}from"efficient-web-builder/render/components/ViewHideRoot";import{setLabel as L}from"../../lib/wheels/variants.js";import{wheelCardPriceLine as h}from"../../lib/wheels/set-mode.js";import{bundlePrice as S,EACH_UNIT as w,formatSelectionPrice as y,formatSelectionWasPrice as T,formatWheelPrice as x,formatWheelWasPrice as _,FROM_PREFIX as g,priceIn as C,resolveWheelPrice as b,SET_QUOTE_LABEL as E}from"../../lib/wheels/price-display.js";import{CARD_TEXT_SIZE as s,CardRow as v}from"./card-row.js";import{RegionBridge as R,RegionWords as W,regionAttr as z}from"./card-text-region.js";import{useHeroStateOrNull as B,useProductCardState as $}from"./ProductCardState.js";import{useTaxNote as N}from"./useTaxNote.js";function j(e,i){if(e.kind==="tyre"){const a=b(C(e.tyre.prices,e.currency),null);return{was:null,amount:x(a,e.currency,g),note:a.priced?w:null,priced:a.priced}}const{wheel:n,currency:t,price:o,sel:m,isSet:d}=e,l=b(n.prices[t],n.msrpPrices?.[t]),u=i.setTotal&&o.priced&&o.setTotal!=null&&m.selectedVariant?`${L(m.selectedVariant)} · ${P(o.setTotal,t)}`:null;return d&&i.quoteSets?{was:null,amount:l.priced?h(x(l,t,g),!0):E,note:u,priced:l.priced}:{was:i.wasFollowsSize?T(o,t):_(l,t),amount:h(y(o,t),o.priced),note:u,priced:o.priced}}function F({state:e,region:i}){const n=N(),t=c(p,{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",...z(i,"price"),children:r(W,{region:i,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&&n&&r("div",{className:"font-mono text-[length:var(--size-label,13px)] text-fg-dim","data-tax-note":"",children:n}),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(R,{region:i,sectionType:"ProductPrice",children:t})}function A({show:e=!0,region:i,...n}){const t=B();return t?r(F,{state:t,region:i}):r(I,{show:e,...n})}function H({state:e,show:i}){if(!i)return null;const n=S(e.bundle,e.currency);return c(f,{children:[n&&c(p,{className:`mt-1 font-mono ${s.labelLarge}`,children:[r("span",{className:"mr-2 text-fg-dim line-through",children:n.was}),n.amount]}),!e.bundle.inStock&&r(p,{className:`mt-1 font-mono ${s.labelSmall} uppercase tracking-[0.24em] text-fg-dim`,children:k("Currently unavailable")})]})}function I({show:e=!0,...i}){const n=$(),t=N();if(n.kind==="bundle")return r(H,{state:n,show:e});const{was:o,amount:m,note:d,priced:l}=j(n,i),a=[d,l?t:null].filter(Boolean).join(" · ")||null;return c(f,{children:[r(v,{children:e?c("div",{className:`mt-2 font-mono ${s.labelLarge}`,children:[o&&r("span",{className:"mr-2 text-fg-dim line-through",children:o}),m]}):null}),r(v,{children:e&&a?r("div",{className:`mt-[2px] font-mono ${s.labelSmall} tracking-[0.08em] text-fg-dim`,children:a}):null})]})}export{A as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useTaxNote(): string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useCurrency as t}from"../CurrencyContext.js";import{taxNote as e}from"../../lib/catalog/tax-note.js";function u(){return e(t({optional:!0})?.activeCountry)}export{u as useTaxNote};
|
|
@@ -7,7 +7,9 @@ export default function ShopperFilters({ owner, look, lookPhone, shown, showSort
|
|
|
7
7
|
owner: {
|
|
8
8
|
id: string;
|
|
9
9
|
template?: SlotComponent;
|
|
10
|
-
facetTemplate
|
|
10
|
+
facetTemplate: SlotComponent;
|
|
11
|
+
railTemplate: SlotComponent;
|
|
12
|
+
railHeadTemplate: SlotComponent;
|
|
11
13
|
};
|
|
12
14
|
look: FilterLook;
|
|
13
15
|
lookPhone: FilterLookPhone;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as l,Fragment as z,jsxs as S}from"react/jsx-runtime";import{useCallback as Y,useMemo as F,useState as U}from"react";import{CardTemplateRows as ne}from"efficient-web-builder/render/components/CardRowContext";import{cardRow as re}from"efficient-web-builder/format/lib/content/card-template";import{useCurrency as oe}from"../CurrencyContext.js";import{useEnglish as ie}from"../EnglishVariant.js";import X from"./PriceRange.js";import se from"./SortSelect.js";import{DEFAULT_CATALOG_FILTER_LABELS as I}from"../../lib/content/catalog-filter-labels.js";import{itemKind as D,plpKindNoun as ae}from"../../lib/catalog/plp-item.js";import{itemLugs as ce,lugFilterLabel as pe}from"../../lib/wheels/lug-count.js";import{CATALOG_TEXT_SIZE as O}from"../../lib/sections/catalog-text-size.js";import{buildPlpFacets as ue,itemMatchesPlp as me,plpInStockCount as de,plpPriceBounds as fe,plpSortKeysFor as ge,PLP_ONE_VALUE_MAX as he,PLP_SORT_LABELS as Se}from"../../lib/wheels/plp-filters.js";import{FILTER_IN_STOCK_KEY as be,FILTER_PRICE_KEY as A,filterGroupItems as xe}from"../../lib/sections/filter-option-rows.js";import ye from"../wheels-plp/PlpSidebar.js";import{FILTER_BLOCK_TYPE as V}from"../../lib/document/document-nodes.js";import{FilterPill as we,PillButton as Te}from"./FilterPill.js";import{useShopperFilter as Me}from"./ShopperScope.js";import{HideTaker as ke}from"efficient-web-builder/render/components/ViewHideRoot";const Z="lugs";function _e({owner:n,look:e,lookPhone:i,shown:r,showSort:c,openingSort:a,filtersBelow:t,fieldUsage:p,firstRows:L,editing:u}){const{currency:h}=oe(),y=ie(),{ref:E,scope:f}=Me({filtersBelow:t,openingSort:a}),{state:m}=f,g=f.live?f.rows:L??f.rows,b=F(()=>[...new Set(g.map(D))],[g]),N=F(()=>{const o=ue(g,m,h,b,p??[],"pass").filter(s=>s.key!=="collections"||r.includes("category"));if(r.includes("lugs")){const s=Le(g,m,h);s&&o.push(s)}return o.map(s=>({...s,label:y(s.label)}))},[g,m,h,b,p,r,y]),w=r.includes("price")?fe(g,h):null,P=r.includes("inStock")&&g.length>0?de(g,m,h):null,J=ge(b.length?b:["alloy-wheel"]),M=f.update,x=Y(o=>M({...o,page:1}),[M]),v=Y((o,s)=>M(d=>{if(o===Z){const T=Number(s),te=(d.lugs??[]).includes(T);return{...d,page:1,lugs:te?(d.lugs??[]).filter(le=>le!==T):[...d.lugs??[],T]}}const C=d[o].map(String),H=C.includes(s)?C.filter(T=>T!==s):[...C,s];return{...d,page:1,[o]:o==="diameters"?H.map(Number):H}}),[M]),B=c&&!f.sortInChips,Q=F(()=>{const o=xe(N,m,P).map(s=>({...s,options:s.options.map(d=>({...d,press:s.key===be?()=>x({inStockOnly:!m.inStockOnly}):()=>v(s.key,d.value)}))}));return w?[...o,{key:A,label:I.price,options:[]}]:o},[N,m,P,w,x,v]),k={owner:n,items:Q,state:m,sorts:J,showSort:B,set:x,bounds:w},W=o=>x({priceMin:o}),ee=o=>x({priceMax:o}),G=l(ye,{facets:N,filters:m,noun:ae(b.length?b:["alloy-wheel"]),inStockCount:P,onToggle:v,onInStockOnly:o=>x({inStockOnly:o}),onClearAll:f.clear,price:w?{label:I.price,control:l(X,{bounds:w,min:m.priceMin,max:m.priceMax,onMin:W,onMax:ee})}:void 0,foot:B?l(_,{...k}):void 0,owner:{id:n.id,facetTemplate:n.facetTemplate,railTemplate:n.railTemplate,railHeadTemplate:n.railHeadTemplate,type:V},editing:u}),K=e==="rail"?G:l(R,{...k,columns:e==="bar-columns"}),j=(i==="rail"?e==="rail":i==="bar"&&e!=="rail")?null:i==="button"?l(Ee,{...k}):i==="rail"?G:l(R,{...k,columns:!1});return S(ke,{as:"div",ref:E,"data-shopper-filters":"",className:"w-full",children:[j?S(z,{children:[l("div",{className:"max-view-wide:hidden",children:K}),l("div",{className:"view-wide:hidden",children:j})]}):K,u&&f.grids===0&&l("p",{className:`mt-2 font-mono ${O.labelSmall} uppercase tracking-[0.2em] text-fg-dim`,children:"Filters a Product Grid in this Box"})]})}function Le(n,e,i){const r=new Map,c=new Set;for(const t of n){const p=D(t)==="alloy-wheel"?ce(t):null;p!==null&&(c.add(p),me(t,e,i,"lugs","pass")&&r.set(p,(r.get(p)??0)+1))}if(c.size<=he)return null;const a=e.lugs??[];return{key:Z,label:I.lugs,options:[...c].sort((t,p)=>t-p).map(t=>({value:String(t),label:pe(t),count:r.get(t)??0,checked:a.includes(t),swatch:null}))}}function _({state:n,sorts:e,set:i}){return l(se,{value:n.sort,keys:e,labels:Se,onChange:r=>i({sort:r})})}function $(n,e){return n.key===A?(e.priceMin!=null?1:0)+(e.priceMax!=null?1:0):n.options.filter(i=>i.state.selected).length}function q({owner:n,items:e,state:i,set:r,bounds:c,wrap:a}){const t=u=>r({priceMin:u}),p=u=>r({priceMax:u}),L=(u,h)=>{const y=e[h.index],E=y.key===A?S(z,{children:[u,l(X,{bounds:c,min:i.priceMin,max:i.priceMax,onMin:t,onMax:p})]}):u;return a(E,y)};return l(ne,{ownerId:n.id,ownerType:V,Template:n.template,rows:e.map(re),items:e,fallback:null,wrapCopy:L,children:u=>u})}function R({columns:n,...e}){const[i,r]=U(null),c=a=>()=>r(t=>t===a?null:a);return n?S("div",{className:"flex flex-col gap-4",children:[l("div",{className:"grid grid-cols-[repeat(auto-fit,minmax(200px,1fr))] gap-6 border-y border-line py-4",children:l(q,{...e,wrap:(a,t)=>l("div",{children:a},t.key)})}),e.showSort&&l("div",{className:"flex flex-wrap items-center justify-end gap-4",children:l(_,{...e})})]}):S("div",{className:"relative flex flex-wrap items-center gap-2 @container",children:[l(q,{...e,wrap:(a,t)=>l(we,{labelSize:O.labelSmall,name:t.key,label:t.label,badge:$(t,e.state),open:i===t.key,onToggle:c(t.key),children:a},t.key)}),e.showSort&&l("div",{className:"ml-auto",children:l(_,{...e})})]})}function Ee(n){const[e,i]=U(!1),r=n.items.reduce((c,a)=>c+$(a,n.state),0);return S("div",{className:"flex flex-col gap-4",children:[S("div",{className:"flex items-center justify-between gap-4",children:[l(Te,{labelSize:O.labelSmall,label:"Filters",badge:r,open:e,onToggle:()=>i(c=>!c)}),n.showSort&&l(_,{...n})]}),e&&l(R,{...n,columns:!0,showSort:!1})]})}export{_e as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as e,Fragment as N,jsxs as a}from"react/jsx-runtime";import{useId as E}from"react";import W from"next/image";import T from"next/link";import{lineTotal as K,useCart as X}from"../CartContext.js";import{useCurrency as Z}from"../CurrencyContext.js";import{Notice as R}from"../Notice.js";import{FREE_PRICE as F}from"../../lib/wheels/price-display.js";import J from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as Q}from"../../lib/cart/coupon-preview.js";import{orderReference as V}from"../../lib/checkout/pay-first.js";import{shippingWords as ee,TAX_PENDING as te}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as ne}from"../../lib/wheels/finish-defaults.js";import $ from"../ThemedSelect.js";import f from"../WebFormField.js";import ae from"../WheelSvg.js";import{NO_PAYMENT_METHOD_NOTE as re,SHIPPING_RETRY_NOTE as ie,useCheckout as k}from"./checkout-state.js";import{FIELD_INPUT_CLASS as u}from"../../lib/field-input.js";function Ee(){const{email:t,setEmail:i,firstName:n,setFirstName:o,lastName:c,setLastName:m,company:s,setCompany:y,me:x,checkoutSignOut:g}=k(),h=E();return a(w,{num:"N° 01",title:"Contact",children:[e(f,{label:"Email",htmlFor:h,hint:x?a(N,{children:["Signed in ·"," ",e("button",{type:"button",onClick:g,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{id:h,type:"email",value:t,onChange:l=>i(l.target.value),placeholder:"you@example.com",readOnly:x!==null,className:u+(x?" opacity-70":"")})}),a(M,{children:[e(f,{label:"First name",children:e("input",{type:"text",value:n,onChange:l=>o(l.target.value),className:u})}),e(f,{label:"Last name",children:e("input",{type:"text",value:c,onChange:l=>m(l.target.value),className:u})})]}),e(f,{label:"Company (optional)",children:e("input",{type:"text",value:s,onChange:l=>y(l.target.value),autoComplete:"organization",className:u})})]})}function Fe(){const{pickupLocation:t,servedCountries:i,address1:n,setAddress1:o,address2:c,setAddress2:m,city:s,setCity:y,postcode:x,setPostcode:g,phone:h,setPhone:l,country:d,setCountry:p,subdivision:C,setSubdivision:b,subdivisions:A,destination:ce,postcodeLabel:z,subdivisionLabel:U,me:I,savedAddresses:L,selectedAddressId:_,setSelectedAddressId:P,saveAddress:O,setSaveAddress:D,saveLabel:H,setSaveLabel:q,fillFromAddress:G}=k(),B=E(),j=E();return a(w,{num:"N° 02",title:t?"Collection":"Shipping address",children:[t?a("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:t.name}),[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).join(", ")}),t.openingHours&&e("span",{className:"opacity-80",children:t.openingHours}),t.instructions&&e("span",{className:"opacity-80",children:t.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):a(N,{children:[I!==null&&L.length>0&&a("div",{className:"grid gap-3",children:[L.map(r=>e(S,{active:_===r.id,onClick:()=>{P(r.id),G(r)},title:r.label,body:r.formatted_address,price:null},r.id)),e(S,{active:_==="new",onClick:()=>P("new"),title:"New address",body:null,price:null})]}),e(f,{label:"Address line 1",children:e("input",{type:"text",value:n,onChange:r=>o(r.target.value),className:u})}),e(f,{label:"Address line 2",children:e("input",{type:"text",value:c,onChange:r=>m(r.target.value),placeholder:"Apartment, unit, garage bay…",className:u})}),a(M,{cols:"three",children:[e(f,{label:"City",children:e("input",{type:"text",value:s,onChange:r=>y(r.target.value),className:u})}),e(f,{label:z,children:e("input",{type:"text",value:x,onChange:r=>g(r.target.value),className:u})}),e(f,{label:"Country",separate:!0,htmlFor:B,children:e($,{id:B,value:d,onChange:r=>p(r.target.value),className:u+" pr-10",style:Y,children:i.map(r=>e("option",{value:r.code,children:r.name},r.code))})})]}),e(f,{label:U,separate:!0,htmlFor:j,children:A.length>0?a($,{id:j,value:C,onChange:r=>b(r.target.value),className:u+" pr-10",style:Y,children:[e("option",{value:"",children:"Select…"}),A.map(r=>e("option",{value:r.code||r.name,children:r.name},r.code||r.name))]}):e("input",{id:j,type:"text",value:C,onChange:r=>b(r.target.value),className:u})})]}),e(f,{label:"Phone",children:e("input",{type:"tel",value:h,onChange:r=>l(r.target.value),className:u})}),!t&&I!==null&&_==="new"&&a(N,{children:[e(le,{checked:O,onChange:D,label:"Save this address to my account"}),O&&e(f,{label:"Address label",children:e("input",{type:"text",value:H,onChange:r=>q(r.target.value),placeholder:"Home",className:u})})]})]})}function Ae(){const{totals:t,coupon:i,deliveryOptions:n,shippingMethodId:o,setShippingMethodId:c,pickupLocation:m,formatMoney:s,city:y,destination:x,courierUnavailable:g,retryCourier:h}=k();return e(w,{num:"N° 03",title:"Shipping",children:a("div",{className:"grid gap-3",children:[n.map(l=>{const d=l.pickupLocation,p=d?[d.address,d.city,d.state,d.zipCode].filter(Boolean).join(", "):null;return e(S,{active:o===l.id,onClick:()=>c(l.id),title:d?`${l.name} — ${d.name}`:l.name,body:d?[p,d.openingHours,d.instructions,l.description].filter(Boolean).join(" · "):l.description||null,price:t.freeShipping||l.amount===0?F:s(l.amount,t.currency),tag:l.tag||void 0},l.id)}),g?a("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[ie," ",e("button",{type:"button",onClick:h,className:"underline transition-colors hover:text-accent",children:"Try again"})]}):n.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function Ie(){const{payChoice:t,setPayChoice:i,placing:n,payment:o,payOptions:c,noPaymentMethod:m}=k();return a(w,{num:"N° 04",title:"Payment",children:[m&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:re}),e("div",{className:"grid gap-3",children:c.map(s=>e(S,{active:t===s.key,onClick:()=>i(s.key),title:s.title,body:s.body,price:s.price,tag:s.tag},s.key))}),t==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):t==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):t==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):t==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):t==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):t==="bank"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function Le(){const{site:t,items:i,totals:n,coupon:o,formatMoney:c,payChoice:m,placing:s,email:y,orderError:x,payment:g,noPaymentMethod:h,unpaidOrder:l,placeOrder:d}=k();return a("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-view-desktop:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[a("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(T,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?a("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(T,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(p=>e(oe,{slug:p.slug,name:p.name,qty:p.qty,config:p.config,configSummary:se(p.config),price:K(p,n.currency)??0,currency:n.currency},p.id))}),e("div",{className:"border-t border-line px-6 pt-5",children:e(J,{customerEmail:y})}),a("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(v,{label:"Subtotal",value:c(n.subtotal,n.currency)}),n.discount>0&&o?.valid&&e(v,{label:`Coupon · ${o.code}`,value:a("span",{className:"font-semibold text-green",children:["− ",c(n.discount,n.currency)]})}),o?.deferred&&e(v,{label:`Coupon · ${o.code}`,value:Q}),o?.valid&&o.effects?.gift&&e(v,{label:`Free gift · ${o.effects.gift.partNumber}${o.effects.gift.quantity>1?` ×${o.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:F})}),e(v,{label:"Shipping",value:n.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:F}):ee(n.shippingStatus)??c(n.shipping,n.currency)}),n.tax&&(n.tax.charged?e(v,{label:n.tax.inclusive?`${n.tax.name} included · ${n.tax.rate}%`:n.tax.name,value:c(n.tax.amount,n.currency)}):n.tax.name?e(v,{label:n.tax.name,value:te}):null)]}),a("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?"…":c(n.grand,n.currency)})]}),a("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[x&&e(R,{role:"alert",children:x}),n.hasUnpricedLine&&a(R,{role:"status",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:d,disabled:s||!l&&(h||i.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",s||!l&&(i.length===0||h||n.hasUnpricedLine||n.repricing)?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:s?a(N,{children:["Building order… ",e("span",{children:"·"})]}):h?a(N,{children:["No online payment ",e("span",{children:"·"})]}):l?a(N,{children:["Try payment again · ",V(l),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}):n.repricing?a(N,{children:["Updating total… ",e("span",{children:"·"})]}):a(N,{children:[m==="bank"?"Place order":"Continue to payment"," ·"," ",c(n.grand,n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})}const Y={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function w({num:t,title:i,children:n}){return a("section",{className:"mb-6 border border-line bg-bg",children:[a("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:i})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function M({cols:t="two",children:i}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:i})}function S({active:t,onClick:i,title:n,body:o,price:c,tag:m}){return a("button",{type:"button",onClick:i,"aria-pressed":t,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),a("span",{className:"flex min-w-0 flex-col gap-1",children:[a("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,m&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:m})]}),o&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:o})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:c})]})}function le({checked:t,onChange:i,label:n,sub:o}){return a("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>i(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),a("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,o&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:o})]})]})}function oe({slug:t,name:i,qty:n,config:o,configSummary:c,price:m,currency:s}){const{catalog:y}=X(),{formatMoney:x}=Z(),g=y.find(b=>b.slug===t),h=g?.spokes??5,l=g?.mesh??!1,d=o.find(b=>b.gold)?.label,p=g?.finishes.find(b=>b.name===d&&b.src)??g?.finishes.find(b=>b.src),C=g?.finishes[0]?.color??ne;return a("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[a("div",{className:"relative aspect-square",children:[e("div",{className:"flex h-full w-full items-center justify-center overflow-hidden border border-line bg-surface",children:p?.src?e(W,{src:p.src,alt:`${i.lead}${i.accent} — ${p.name}`,width:120,height:120,sizes:"60px",className:"block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:C},children:e(ae,{spokes:h,mesh:l,className:"block w-full"})})}),e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n})]}),a("div",{className:"flex min-w-0 flex-col gap-0.5",children:[a("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[i.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:i.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:c})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:x(m,s)})]})}function v({label:t,value:i}){return a("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:t}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:i})]})}function se(t){return t.map(i=>i.label).join(" · ")}export{Ee as CheckoutContact,Le as CheckoutOrderSummary,Ie as CheckoutPayment,Fe as CheckoutShippingAddress,Ae as CheckoutShippingMethod};
|
|
1
|
+
"use client";import{jsx as e,Fragment as k,jsxs as a}from"react/jsx-runtime";import{useId as E}from"react";import X from"next/image";import Y from"next/link";import{lineTotal as Z,useCart as J}from"../CartContext.js";import{useCurrency as Q}from"../CurrencyContext.js";import{Notice as F}from"../Notice.js";import{FREE_PRICE as O}from"../../lib/wheels/price-display.js";import ee from"../CouponField.js";import{COUPON_DEFERRED_TOTAL as te}from"../../lib/cart/coupon-preview.js";import{orderReference as ne}from"../../lib/checkout/pay-first.js";import{shippingWords as ae,TAX_PENDING as re}from"../../lib/cart/shipping-status.js";import{DEFAULT_FINISH_COLOR as ie}from"../../lib/wheels/finish-defaults.js";import D from"../ThemedSelect.js";import x from"../WebFormField.js";import le from"../WheelSvg.js";import{NO_PAYMENT_METHOD_NOTE as oe,placedOrderLockNote as se,SHIPPING_RETRY_NOTE as ce,useCheckout as w}from"./checkout-state.js";import{FIELD_INPUT_CLASS as I}from"../../lib/field-input.js";function Pe(){const{email:t,setEmail:i,firstName:n,setFirstName:o,lastName:m,setLastName:h,company:s,setCompany:v,me:b,checkoutSignOut:f,orderLocked:d,unpaidOrder:g}=w(),c=E();return a(S,{num:"N° 01",title:"Contact",children:[d&&g&&e(de,{orderNumber:g.orderNumber}),e(x,{label:"Email",htmlFor:c,hint:b?a(k,{children:["Signed in ·"," ",e("button",{type:"button",onClick:f,className:"underline transition-colors hover:text-accent",children:"Not you? Sign out"})]}):void 0,children:e("input",{id:c,type:"email",value:t,onChange:l=>i(l.target.value),placeholder:"you@example.com",readOnly:b!==null,disabled:d,className:I+(b||d?P:"")})}),a(U,{children:[e(x,{label:"First name",children:e("input",{type:"text",value:n,onChange:l=>o(l.target.value),disabled:d,className:N(d)})}),e(x,{label:"Last name",children:e("input",{type:"text",value:m,onChange:l=>h(l.target.value),disabled:d,className:N(d)})})]}),e(x,{label:"Company (optional)",children:e("input",{type:"text",value:s,onChange:l=>v(l.target.value),autoComplete:"organization",disabled:d,className:N(d)})})]})}function Ae(){const{pickupLocation:t,servedCountries:i,address1:n,setAddress1:o,address2:m,setAddress2:h,city:s,setCity:v,postcode:b,setPostcode:f,phone:d,setPhone:g,country:c,setCountry:l,subdivision:u,setSubdivision:y,subdivisions:A,destination:he,postcodeLabel:q,subdivisionLabel:H,me:B,savedAddresses:T,selectedAddressId:_,setSelectedAddressId:R,saveAddress:$,setSaveAddress:G,saveLabel:W,setSaveLabel:K,fillFromAddress:V,orderLocked:p}=w(),M=E(),j=E();return a(S,{num:"N° 02",title:t?"Collection":"Shipping address",children:[t?a("div",{className:"grid gap-2 text-[14px] leading-[1.6]",children:[e("span",{className:"font-medium",children:t.name}),[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).length>0&&e("span",{className:"opacity-80",children:[t.address,t.city,t.state,t.zipCode,t.country].filter(Boolean).join(", ")}),t.openingHours&&e("span",{className:"opacity-80",children:t.openingHours}),t.instructions&&e("span",{className:"opacity-80",children:t.instructions}),e("span",{className:"mt-1 font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"No delivery address needed"})]}):a(k,{children:[B!==null&&T.length>0&&a("div",{className:"grid gap-3",children:[T.map(r=>e(L,{active:_===r.id,disabled:p,onClick:()=>{R(r.id),V(r)},title:r.label,body:r.formatted_address,price:null},r.id)),e(L,{active:_==="new",disabled:p,onClick:()=>R("new"),title:"New address",body:null,price:null})]}),e(x,{label:"Address line 1",children:e("input",{type:"text",value:n,onChange:r=>o(r.target.value),disabled:p,className:N(p)})}),e(x,{label:"Address line 2",children:e("input",{type:"text",value:m,onChange:r=>h(r.target.value),placeholder:"Apartment, unit, garage bay…",disabled:p,className:N(p)})}),a(U,{cols:"three",children:[e(x,{label:"City",children:e("input",{type:"text",value:s,onChange:r=>v(r.target.value),disabled:p,className:N(p)})}),e(x,{label:q,children:e("input",{type:"text",value:b,onChange:r=>f(r.target.value),disabled:p,className:N(p)})}),e(x,{label:"Country",separate:!0,htmlFor:M,children:e(D,{id:M,value:c,onChange:r=>l(r.target.value),disabled:p,className:N(p)+" pr-10",style:z,children:i.map(r=>e("option",{value:r.code,children:r.name},r.code))})})]}),e(x,{label:H,separate:!0,htmlFor:j,children:A.length>0?a(D,{id:j,value:u,onChange:r=>y(r.target.value),disabled:p,className:N(p)+" pr-10",style:z,children:[e("option",{value:"",children:"Select…"}),A.map(r=>e("option",{value:r.code||r.name,children:r.name},r.code||r.name))]}):e("input",{id:j,type:"text",value:u,onChange:r=>y(r.target.value),disabled:p,className:N(p)})})]}),e(x,{label:"Phone",children:e("input",{type:"tel",value:d,onChange:r=>g(r.target.value),disabled:p,className:N(p)})}),!t&&B!==null&&_==="new"&&!p&&a(k,{children:[e(pe,{checked:$,onChange:G,label:"Save this address to my account"}),$&&e(x,{label:"Address label",children:e("input",{type:"text",value:W,onChange:r=>K(r.target.value),placeholder:"Home",className:I})})]})]})}function Be(){const{totals:t,coupon:i,deliveryOptions:n,shippingMethodId:o,setShippingMethodId:m,pickupLocation:h,formatMoney:s,city:v,destination:b,courierUnavailable:f,retryCourier:d,orderLocked:g}=w();return e(S,{num:"N° 03",title:"Shipping",children:a("div",{className:"grid gap-3",children:[n.map(c=>{const l=c.pickupLocation,u=l?[l.address,l.city,l.state,l.zipCode].filter(Boolean).join(", "):null;return e(L,{active:o===c.id,disabled:g,onClick:()=>m(c.id),title:l?`${c.name} — ${l.name}`:c.name,body:l?[u,l.openingHours,l.instructions,c.description].filter(Boolean).join(" · "):c.description||null,price:t.freeShipping||c.amount===0?O:s(c.amount,t.currency),tag:c.tag||void 0},c.id)}),f?a("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:[ce," ",e("button",{type:"button",onClick:d,className:"underline transition-colors hover:text-accent",children:"Try again"})]}):n.length===0&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Shipping is arranged after your order is reviewed."})]})})}function Te(){const{payChoice:t,setPayChoice:i,placing:n,payment:o,payOptions:m,noPaymentMethod:h}=w();return a(S,{num:"N° 04",title:"Payment",children:[h&&e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:oe}),e("div",{className:"grid gap-3",children:m.map(s=>e(L,{active:t===s.key,onClick:()=>i(s.key),title:s.title,body:s.body,price:s.price,tag:s.tag},s.key))}),t==="card"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="paypal"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll approve the payment with PayPal on the payment step after placing the order."}):t==="afterpay"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Afterpay to approve four interest-free payments, then brought straight back."}):t==="square"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll enter card details on the secure payment step after placing the order."}):t==="gocardless"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll set up a bank direct debit with GoCardless, then be brought straight back. Direct debits clear in a few days."}):t==="zip"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Zip to approve four instalments, then brought straight back."}):t==="klarna"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"You’ll be taken to Klarna to choose how to pay, then brought straight back."}):t==="bank"?e("p",{className:"font-mono text-[11px] uppercase tracking-[0.2em] text-fg-dim",children:"Our team emails you the invoice and bank details after review."}):null]})}function Re(){const{site:t,items:i,totals:n,coupon:o,formatMoney:m,payChoice:h,placing:s,email:v,orderError:b,payment:f,noPaymentMethod:d,unpaidOrder:g,orderLocked:c,placeOrder:l}=w();return a("aside",{className:"sticky top-[var(--sf-checkout-header-h,88px)] border border-line max-view-desktop:static",style:{background:"linear-gradient(180deg, color-mix(in oklab, var(--site-surface) 70%, var(--bg)) 0%, var(--bg) 100%)"},children:[a("header",{className:"flex items-center justify-between border-b border-accent bg-accent px-6 py-4 font-mono text-[13px] font-bold uppercase tracking-[0.28em] text-bg",children:[e("span",{children:"Your order"}),e(Y,{href:"/wheels",className:"text-bg/80 transition-colors hover:text-bg",children:"Edit ↗"})]}),e("div",{className:"flex flex-col px-6 py-2",children:i.length===0?a("div",{className:"py-8 text-center font-serif text-[16px] italic leading-[1.5] text-fg-dim",children:["Your cart is empty. ",e(Y,{href:"/wheels",className:"text-accent underline-offset-4 hover:underline",children:"Browse the catalog →"})]}):i.map(u=>e(me,{slug:u.slug,name:u.name,qty:u.qty,config:u.config,configSummary:ue(u.config),price:Z(u,n.currency)??0,currency:n.currency},u.id))}),e("div",{className:"border-t border-line px-6 pt-5",children:e(ee,{customerEmail:v,disabled:c})}),a("div",{className:"flex flex-col gap-2 border-t border-line mt-5 px-6 pt-5",children:[e(C,{label:"Subtotal",value:m(n.subtotal,n.currency)}),n.discount>0&&o?.valid&&e(C,{label:`Coupon · ${o.code}`,value:a("span",{className:"font-semibold text-green",children:["− ",m(n.discount,n.currency)]})}),o?.deferred&&e(C,{label:`Coupon · ${o.code}`,value:te}),o?.valid&&o.effects?.gift&&e(C,{label:`Free gift · ${o.effects.gift.partNumber}${o.effects.gift.quantity>1?` ×${o.effects.gift.quantity}`:""}`,value:e("span",{className:"font-semibold text-green",children:O})}),e(C,{label:"Shipping",value:n.shippingStatus==="free"?e("span",{className:"font-semibold text-green",children:O}):ae(n.shippingStatus)??m(n.shipping,n.currency)}),n.tax&&(n.tax.charged?e(C,{label:n.tax.inclusive?`${n.tax.name} included · ${n.tax.rate}%`:n.tax.name,value:m(n.tax.amount,n.currency)}):n.tax.name?e(C,{label:n.tax.name,value:re}):null)]}),a("div",{className:"mt-4 flex items-end justify-between border-y-2 border-accent px-6 py-4",style:{background:"color-mix(in oklab, var(--accent) 10%, var(--bg))"},children:[e("span",{className:"font-display text-[20px] font-bold uppercase tracking-[0.04em] text-fg",children:"Total"}),e("span",{className:"text-right font-display text-[34px] font-bold leading-none tracking-[-0.025em] text-fg",children:n.repricing?"…":m(n.grand,n.currency)})]}),a("div",{className:"flex flex-col gap-3 px-6 pt-5 pb-6",children:[b&&e(F,{role:"alert",children:b}),n.hasUnpricedLine&&a(F,{role:"status",children:["One or more items have no price in ",n.currency,". Remove them, or switch region, to continue."]}),e("button",{type:"button",onClick:l,disabled:s||!g&&(d||i.length===0||n.hasUnpricedLine||n.repricing),className:["group flex items-center justify-between border px-5 py-5 font-mono text-[14px] font-medium uppercase tracking-[0.3em] transition-all",s||!g&&(i.length===0||d||n.hasUnpricedLine||n.repricing)?"cursor-not-allowed border-line bg-surface text-fg-dim":"border-btn bg-btn text-btn-ink hover:border-fg hover:bg-fg"].join(" "),children:s?a(k,{children:["Building order… ",e("span",{children:"·"})]}):d?a(k,{children:["No online payment ",e("span",{children:"·"})]}):g?a(k,{children:["Try payment again · ",ne(g),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]}):n.repricing?a(k,{children:["Updating total… ",e("span",{children:"·"})]}):a(k,{children:[h==="bank"?"Place order":"Continue to payment"," ·"," ",m(n.grand,n.currency),e("span",{className:"transition-transform group-hover:translate-x-1",children:"→"})]})})]})]})}const P=" cursor-not-allowed opacity-70";function N(t){return I+(t?P:"")}function de({orderNumber:t}){return e(F,{tone:"quiet",role:"status",children:a("span",{className:"flex items-start gap-2",children:[a("svg",{"aria-hidden":!0,viewBox:"0 0 16 16",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.5",className:"mt-[3px] shrink-0",children:[e("rect",{x:"3",y:"7",width:"10",height:"7",rx:"1"}),e("path",{d:"M5 7V5a3 3 0 0 1 6 0v2"})]}),e("span",{children:se(t)})]})})}const z={backgroundImage:"linear-gradient(45deg, transparent 50%, var(--accent) 50%), linear-gradient(135deg, var(--accent) 50%, transparent 50%)",backgroundPosition:"calc(100% - 18px) 50%, calc(100% - 12px) 50%",backgroundSize:"6px 6px",backgroundRepeat:"no-repeat"};function S({num:t,title:i,children:n}){return a("section",{className:"mb-6 border border-line bg-bg",children:[a("header",{className:"flex items-center gap-4 border-b border-line bg-surface px-6 py-4",children:[e("span",{className:"inline-flex items-center justify-center bg-accent px-3 py-1 font-mono text-[11px] font-bold uppercase tracking-[0.24em] text-bg",children:t}),e("h2",{className:"font-display text-[26px] font-medium uppercase leading-none tracking-[-0.02em] text-fg",children:i})]}),e("div",{className:"flex flex-col gap-4 px-6 py-6",children:n})]})}function U({cols:t="two",children:i}){return e("div",{className:["grid gap-3 max-[640px]:grid-cols-1",t==="two"?"grid-cols-2":"grid-cols-[1.2fr_1fr_1fr]"].join(" "),children:i})}function L({active:t,onClick:i,title:n,body:o,price:m,tag:h,disabled:s=!1}){return a("button",{type:"button",onClick:i,"aria-pressed":t,disabled:s,className:["relative grid grid-cols-[auto_1fr_auto] items-center gap-5 border bg-bg px-6 py-5 text-left transition-colors",t?"border-accent outline outline-1 outline-accent -outline-offset-1":s?"border-line":"border-line hover:border-[color-mix(in_oklab,var(--accent)_50%,var(--site-line))]",s?P.trim():""].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 14%, var(--bg))"}:void 0,children:[t&&e("span",{"aria-hidden":!0,className:"absolute inset-y-0 left-0 w-[3px] bg-accent"}),e("span",{className:["flex h-[18px] w-[18px] items-center justify-center rounded-full border-2",t?"border-accent":"border-fg-dim"].join(" "),children:t&&e("span",{className:"block h-2.5 w-2.5 rounded-full bg-accent"})}),a("span",{className:"flex min-w-0 flex-col gap-1",children:[a("span",{className:"flex flex-wrap items-baseline gap-3 font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:[n,h&&e("span",{className:"border px-2 py-0.5 font-mono text-[11px] font-normal uppercase tracking-[0.24em] text-accent",style:{background:"color-mix(in oklab, var(--accent) 14%, transparent)",borderColor:"color-mix(in oklab, var(--accent) 45%, var(--site-line))"},children:h})]}),o&&e("span",{className:"font-mono text-[12px] uppercase tracking-[0.22em] text-fg-dim",children:o})]}),e("span",{className:"whitespace-nowrap font-display text-[18px] font-medium tracking-[-0.01em] text-fg",children:m})]})}function pe({checked:t,onChange:i,label:n,sub:o}){return a("div",{className:"flex items-start gap-3 border-t border-line py-4 first:border-t-0 first:pt-0",children:[e("button",{type:"button",onClick:()=>i(!t),"aria-pressed":t,"aria-label":n,className:["mt-px flex h-5 w-5 flex-shrink-0 items-center justify-center border transition-colors",t?"border-accent":"border-line"].join(" "),style:t?{background:"color-mix(in oklab, var(--accent) 18%, transparent)"}:void 0,children:t&&e("span",{className:"text-[13px] text-accent",children:"✓"})}),a("span",{className:"flex-1 font-display text-[16px] leading-[1.5] text-fg",children:[n,o&&e("small",{className:"mt-1 block font-mono text-[12px] uppercase tracking-[0.18em] text-fg-dim",children:o})]})]})}function me({slug:t,name:i,qty:n,config:o,configSummary:m,price:h,currency:s}){const{catalog:v}=J(),{formatMoney:b}=Q(),f=v.find(y=>y.slug===t),d=f?.spokes??5,g=f?.mesh??!1,c=o.find(y=>y.gold)?.label,l=f?.finishes.find(y=>y.name===c&&y.src)??f?.finishes.find(y=>y.src),u=f?.finishes[0]?.color??ie;return a("div",{className:"grid grid-cols-[60px_1fr_auto] items-center gap-4 border-b border-line py-4 last:border-b-0",children:[a("div",{className:"relative aspect-square",children:[e("div",{className:"flex h-full w-full items-center justify-center overflow-hidden border border-line bg-surface",children:l?.src?e(X,{src:l.src,alt:`${i.lead}${i.accent} — ${l.name}`,width:120,height:120,sizes:"60px",className:"block h-full w-full object-contain p-2"}):e("div",{className:"block w-[78%]",style:{color:u},children:e(le,{spokes:d,mesh:g,className:"block w-full"})})}),e("span",{className:"absolute -right-1.5 -top-1.5 z-[2] flex h-[18px] w-[18px] items-center justify-center rounded-full bg-accent font-mono text-[11px] font-bold text-bg",children:n})]}),a("div",{className:"flex min-w-0 flex-col gap-0.5",children:[a("span",{className:"font-display text-[17px] font-bold uppercase leading-none tracking-[-0.005em] text-fg",children:[i.lead,e("em",{className:"font-serif font-normal italic text-accent tracking-[-0.005em] normal-case",children:i.accent})]}),e("span",{className:"font-mono text-[12px] uppercase leading-[1.5] tracking-[0.18em] text-fg-dim",children:m})]}),e("span",{className:"text-right font-display text-[17px] font-bold tracking-[-0.005em] text-fg",children:b(h,s)})]})}function C({label:t,value:i}){return a("div",{className:"flex items-center justify-between font-mono text-[13px] font-medium uppercase tracking-[0.18em] text-fg",children:[e("span",{children:t}),e("strong",{className:"font-display text-[16px] font-medium tracking-[-0.005em] normal-case text-fg",children:i})]})}function ue(t){return t.map(i=>i.label).join(" · ")}export{Pe as CheckoutContact,Re as CheckoutOrderSummary,Te as CheckoutPayment,Ae as CheckoutShippingAddress,Be as CheckoutShippingMethod};
|
|
@@ -17,6 +17,7 @@ export declare function buildPayOptions(site: SiteIdentity, { canParkContext, }?
|
|
|
17
17
|
export declare const NO_PAYMENT_METHOD_NOTE = "This shop does not take payment online yet. Please contact the shop to order.";
|
|
18
18
|
export declare function paymentNotStartedMessage(conf: Pick<OrderConfirmation, "orderNumber" | "checkoutNumber">, err: unknown): string;
|
|
19
19
|
export declare const SHIPPING_RETRY_NOTE = "Shipping cannot be calculated right now. Please try again.";
|
|
20
|
+
export declare function placedOrderLockNote(orderNumber: string): string;
|
|
20
21
|
export interface CheckoutProps {
|
|
21
22
|
site: SiteIdentity;
|
|
22
23
|
logo?: {
|
|
@@ -176,6 +177,7 @@ declare function useCheckoutState({ site, logo, preview }: CheckoutProps): {
|
|
|
176
177
|
shippingMethod?: string | null;
|
|
177
178
|
couponCode?: string | null;
|
|
178
179
|
} | null;
|
|
180
|
+
orderLocked: boolean;
|
|
179
181
|
payNote: string | null;
|
|
180
182
|
afterpayConfirming: boolean;
|
|
181
183
|
gocardlessConfirming: boolean;
|