efficient-storefront-blocks 0.130.6 → 0.130.8
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 +22 -0
- package/dist/chunks/{CustomHtmlCodeWindow-Q52YFW2U.js → CustomHtmlCodeWindow-WDJYQRZA.js} +1 -1
- package/dist/chunks/{EditorPreviewCheckout-E4WBOYOR.js → EditorPreviewCheckout-HMNAHJIE.js} +1 -1
- package/dist/chunks/SiteEditorProvider-JT4ASGS5.js +1 -0
- package/dist/chunks/{chunk-NVAI6WFJ.js → chunk-3YVTYYIP.js} +1 -1
- package/dist/chunks/{chunk-LNFDRN7J.js → chunk-7QM6BBAM.js} +2 -2
- package/dist/chunks/{chunk-2ESL6V6A.js → chunk-HEKC2QYZ.js} +1 -1
- package/dist/chunks/{chunk-UT3TWN4Y.js → chunk-KCZDH44S.js} +1 -1
- package/dist/chunks/{chunk-MWASWPCB.js → chunk-LWJKGQLZ.js} +1 -1
- package/dist/chunks/{chunk-RQM4VZZW.js → chunk-NOV6LTTJ.js} +1 -1
- package/dist/chunks/{chunk-RYJPQW5E.js → chunk-QAUFSKVD.js} +1 -1
- package/dist/chunks/{chunk-F36A4DQB.js → chunk-TQIJVK3T.js} +1 -1
- package/dist/chunks/{fitment-data-D7EDIBQ7.js → fitment-data-I4QRQRK6.js} +1 -1
- package/dist/chunks/{section-css-style-IGADRKZW.js → section-css-style-TB33NIO4.js} +1 -1
- package/dist/index.js +25 -25
- package/dist/render/app/globals.css +35 -1
- package/dist/render/built-with.json +1 -1
- package/dist/render/components/BoxHeaderBar.js +1 -1
- package/dist/render/components/Header.js +1 -1
- package/dist/render/components/usePageOwnsTop.d.ts +2 -0
- package/dist/render/components/usePageOwnsTop.js +1 -0
- package/dist/render/lib/content/header-bar.d.ts +3 -0
- package/dist/render/lib/content/header-bar.js +1 -1
- package/dist/routine-index.json +1 -1
- package/dist/value-index.json +1 -1
- package/package.json +1 -1
- package/dist/chunks/SiteEditorProvider-XWNSHTWJ.js +0 -1
- /package/dist/chunks/{chunk-Z7GIOCFP.js → chunk-3DKV2YJ6.js} +0 -0
- /package/dist/chunks/{chunk-PWMBT2HT.js → chunk-5OXXOEE7.js} +0 -0
- /package/dist/chunks/{chunk-LNFDRN7J.js.LEGAL.txt → chunk-7QM6BBAM.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-2ESL6V6A.js.LEGAL.txt → chunk-HEKC2QYZ.js.LEGAL.txt} +0 -0
- /package/dist/chunks/{chunk-ATQPMU57.js → chunk-RCXMXKPT.js} +0 -0
|
@@ -1402,7 +1402,9 @@ body .sf-site-header[data-header-ink="dark"] {
|
|
|
1402
1402
|
solid and sets background and colour inline, which beat this block. Solid is
|
|
1403
1403
|
solid either way, so the bar does not change appearance as the reader
|
|
1404
1404
|
scrolls — it was already painted. */
|
|
1405
|
-
body:has([data-top-space="own"]) .sf-site-header
|
|
1405
|
+
body:has([data-top-space="own"]) .sf-site-header,
|
|
1406
|
+
body:has(.sf-header-clearance) .sf-site-header,
|
|
1407
|
+
body:has(main[data-site-main]):not(:has([data-top-space="shared"])) .sf-site-header {
|
|
1406
1408
|
--sf-header-overlay-fg: var(--fg);
|
|
1407
1409
|
--sf-header-overlay-ground: var(--bg);
|
|
1408
1410
|
background: var(--bg);
|
|
@@ -1410,6 +1412,38 @@ body:has([data-top-space="own"]) .sf-site-header {
|
|
|
1410
1412
|
backdrop-filter: blur(12px);
|
|
1411
1413
|
}
|
|
1412
1414
|
|
|
1415
|
+
/* ─── A PAGE THAT OWNS ITS TOP ─────────────────────────────────────────
|
|
1416
|
+
The first paint of lib/content/header-bar `pageOwnsTop`, which both bars
|
|
1417
|
+
add to `solid` after hydration. A page owns its top when it leaves room for
|
|
1418
|
+
the bar (`sf-header-clearance`: the 404, the journal, the catalogue) or,
|
|
1419
|
+
inside the site's <main> (`data-site-main`), when it does not say its first
|
|
1420
|
+
section shares the top (`data-top-space="shared"`, which only a stored page
|
|
1421
|
+
says). Sign-in, account and order pages draw their own words, so they
|
|
1422
|
+
own their top with nothing to remember per route.
|
|
1423
|
+
|
|
1424
|
+
1. ROOM. The site <main> of such a page leaves the bar's height, unless the
|
|
1425
|
+
page already leaves it itself (a body with the clearance class).
|
|
1426
|
+
2. THE BAR. Solid: these two selectors join the "own" rule above (one paint),
|
|
1427
|
+
and the ink here is `!important`: a
|
|
1428
|
+
Custom "Text color at the top" is set INLINE on the bar (BoxHeaderBar)
|
|
1429
|
+
for the see-through state over a photo, and no stylesheet rule beats an
|
|
1430
|
+
inline value otherwise. After hydration the bar is solid inline and this
|
|
1431
|
+
no longer decides anything.
|
|
1432
|
+
|
|
1433
|
+
⚠️ ONE `:has()` LEVEL ONLY. `:has()` inside `:has()` is invalid, and a
|
|
1434
|
+
browser drops the WHOLE rule, so "a <main> with no shared page" is two
|
|
1435
|
+
sibling `:has()` on <body>, never one nested in the other.
|
|
1436
|
+
scripts/test-header-solid-without-hero.tsx §6 holds both. */
|
|
1437
|
+
main[data-site-main]:not(:has([data-top-space="shared"], .sf-header-clearance)) {
|
|
1438
|
+
/* The default lives on :root, so no fallback length is typed here. */
|
|
1439
|
+
padding-top: var(--sf-header-h);
|
|
1440
|
+
}
|
|
1441
|
+
body:has(.sf-header-clearance) .sf-site-header,
|
|
1442
|
+
body:has(main[data-site-main]):not(:has([data-top-space="shared"])) .sf-site-header {
|
|
1443
|
+
--sf-header-overlay-fg: var(--fg) !important;
|
|
1444
|
+
--sf-header-overlay-ground: var(--bg);
|
|
1445
|
+
}
|
|
1446
|
+
|
|
1413
1447
|
/* ─── The page's WIDTH reaching the chrome ────────────────────────────────
|
|
1414
1448
|
A page set to `Full width` publishes `data-page-width="full"` on its own
|
|
1415
1449
|
wrapper, and the bar above it plus the footer below it stop capping — so
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as d}from"react/jsx-runtime";import{parseOption as D}from"efficient-shell/format";import{useEffect as
|
|
1
|
+
"use client";import{jsx as d}from"react/jsx-runtime";import{parseOption as D}from"efficient-shell/format";import{useEffect as R,useState as S}from"react";import{useRootIsDark as O}from"efficient-shell/theme";import{usePathname as w}from"next/navigation";import{useHeaderBar as B}from"./useHeaderBar.js";import{HEADER_LINK_OPACITY_ATTR as C,HEADER_LINK_OPACITY_VAR as N,headerSolidBackground as j,isProductPage as K,readHeaderLinkOpacity as L,readHeaderTopInk as M,resolveHeaderHeightPx as Y}from"../lib/content/header-bar.js";import{headerThemeWrap as V}from"../lib/content/header-theme.js";import{HEADER_SET_HEIGHT_VAR as W}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_OVERRIDE_ATTR as $,resolveHeaderInkMode as z}from"efficient-web-builder/render/lib/document/header-ink";import{centredCap as G,SITE_WIDTH_CAP as U}from"efficient-web-builder/format/lib/content/page-width";import{HideTaker as q}from"efficient-web-builder/render/components/ViewHideRoot";import{HeaderTopInkContext as F}from"efficient-web-builder/render/components/HeaderTopInkContext";import{BoxSurfaceProvider as J}from"efficient-web-builder/render/components/BoxSurfaceContext";import{useHeaderAtTopIsDark as Q}from"./useHeaderAtTopIsDark.js";import{usePageOwnsTop as X}from"./usePageOwnsTop.js";import{blockParts as Z}from"../lib/block-parts.js";const ee=Z("SiteHeader"),re=["none","always","on_scroll_up"],oe=t=>D(re,"always",t);function te({sticky:t,topTextColor:i,topTextCustom:h,linkOpacity:H,heightPx:g,theme:k,bandCapped:T=!1,children:_}){const l=oe(t),c=Y(g),{headerRef:e,scrolled:u,navHidden:I}=B({stickyMode:l,heightPx:c}),n=z(i),v=n==="auto"?null:{[$]:n},a=M(i,h),s=L(H),E=s===void 0?null:{[C]:""},r=V(k),m=K(w()),[b,x]=S(null);R(()=>x(e.current?.ownerDocument??null),[e]);const A=!O({doc:b,whenUnset:!0}),y=X(e),o=u||m||y,P=Q(e,n),f=d(F.Provider,{value:o?null:a,children:_}),p=j(A,m);return d(q,{as:"header",ref:e,"data-scrolled":u||void 0,"data-box-header":"",...v,...E,className:["sf-site-header",...r?[r.className]:[],"flex flex-col justify-center",l==="none"?"absolute":"fixed","inset-x-0 top-0 z-50",o?"border-b border-line backdrop-blur-md":"border-b border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...r?r.style:null,minHeight:`var(${W}, ${c}px)`,...T?G(U):null,...I?{transform:"translateY(-100%)"}:null,...o?{background:p,color:"var(--fg)","--sf-header-ground":p}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"},...a?{"--sf-header-overlay-fg":a}:null,...s===void 0?null:{[N]:String(s/100)}},...ee("header"),children:!o&&P?d(J,{children:f}):f})}export{te as default,oe as resolveStickyMode};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{jsx as r,Fragment as E,jsxs as s}from"react/jsx-runtime";import oe from"next/link";import{usePathname as Qe}from"next/navigation";import{useCallback as Ze,useEffect as re,useRef as et,useState as v}from"react";import{rootIsDark as tt,watchRootTheme as nt}from"efficient-shell/format";import{useCart as ot}from"./CartContext.js";import{useSearch as rt}from"./SearchContext.js";import st,{useCountrySelectShows as lt}from"./CountrySelect.js";import{resolveCountryShowAs as at}from"../lib/content/country-show-as.js";import se from"./HeaderNavItem.js";import it from"efficient-web-builder/render/components/Logo";import{siteLengthCss as ct}from"efficient-web-builder/format/lib/content/css-length";import dt from"./MenuPlaceholderLabel.js";import{withRMark as le}from"efficient-web-builder/render/components/RMark";import{AccountButton as mt,CartButton as ut,SearchButton as ht}from"./HeaderTools.js";import ft from"./HeaderCallButton.js";import{useHeaderBar as pt}from"./useHeaderBar.js";import{useHeaderAtTopIsDark as gt}from"./useHeaderAtTopIsDark.js";import{useModalDismiss as bt}from"./useModalDismiss.js";import xt from"./ThemeToggle.js";import{products as vt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as yt}from"../lib/header-settings-fetch.js";import{menuDropdownAside as wt}from"../lib/menu-link.js";import{HEADER_MENU_PLACEHOLDER_COUNT as St}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as kt}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as Nt,resolveChromeWidth as Pt}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as Tt}from"../lib/content/header-theme.js";import{headerSolidBackground as Et,isProductPage as It,resolveMenuRow as $t,resolveNavTextCase as Ct,resolveUtilStyle as Lt}from"../lib/content/header-bar.js";import{surfaceIsLight as _t}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as Ht,HEADER_MENU_GAP_PX as Rt,HEADER_SET_HEIGHT_CSS as At}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_OVERRIDE_ATTR as Dt,resolveHeaderInkMode as Ut}from"efficient-web-builder/render/lib/document/header-ink";const ae={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},Mt=Array.from({length:St},()=>({href:"#",label:r(dt,{})}));function jt({previewSettings:f,initialSettings:I,editorPreview:$,showThemeToggle:ie,wordmark:ce,hideLogo:de,hideMenu:me,siteName:C,commerceEnabled:p=!0}={}){const ue=Qe(),B=It(ue),[c,y]=v(!1),{open:he,totals:fe}=ot(),{open:pe}=rt(),[L,ge]=v(!1),[be,xe]=v(null),[ve,ye]=v(null),[t,we]=v(I??null),n=f??(t?{logoUrl:t.logoUrl,reverseLogo:t.reverseLogo,logoReversed:t.logoReversed,logoInkIsDark:t.logoInkIsDark,logoPosition:t.logoPosition,logoSize:t.logoSize,logoSizePx:t.logoSizePx,logoSizeUnit:t.logoSizeUnit??null,menuItems:(t.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[],dropdown_aside:e.dropdownAside??null})),menuSplit:t.menuSplit??3,menuPosition:t.menuPosition,menuRow:t.menuRow,menuGapPx:t.menuGapPx??null,menuGapUnit:t.menuGapUnit??null,searchEnabled:t.searchEnabled,searchPosition:t.searchPosition,searchRow:t.searchRow,countrySelectorEnabled:t.countrySelectorEnabled,countrySelectorShowAs:t.countrySelectorShowAs,countryUrls:t.countryUrls,accountEnabled:t.accountEnabled,cartEnabled:t.cartEnabled,utilStyle:t.utilStyle,navTextCase:t.navTextCase,lightReverseText:t.lightReverseText,topTextColor:t.topTextColor,transparentTop:t.transparentTop,surface:t.surface,theme:t.theme,width:t.width,heightPx:t.heightPx,borderThickness:t.borderThickness??null,sticky:t.sticky,callButton:t.callButton,callPhone:t.callPhone,callHref:t.callHref}:null),Se=de?null:n?.logoUrl??null,ke=n?.reverseLogo??!1,Ne=n?.logoReversed??null,Pe=n?.logoInkIsDark??null,i=n?.logoPosition??"center",Te=n?.logoSize??"medium",Ee=n?.logoSizePx??null,Ie=n?.logoSizeUnit??null,G=Math.min(Math.max(n?.menuSplit??3,1),4),$e=(n?.menuPosition??"left")==="center",Ce=(n?.menuPosition??"left")==="beside",F=$t(n?.menuRow)==="inline",_=n?.menuGapPx??null,Le=_!=null?{gap:ct(_,n?.menuGapUnit,"gap",Rt)??`${_}px`}:void 0,w=F?ae.inline:ae.stacked,_e=n?.searchEnabled??!1,W=n?.searchPosition??"right",He=n?.countrySelectorEnabled??!0,Re=at(n?.countrySelectorShowAs),H=n?.accountEnabled??!0,Ae=n?.cartEnabled??!0,R=Lt(n?.utilStyle)==="text",l=`mono-eyebrow${Ct(n?.navTextCase)==="capitalised"?" mono-eyebrow-plain":""}`,V=n?.countryUrls??{},De=Pt(n?.width),Ue=Nt(De)??void 0,Me=n?.heightPx??Ht.default,K=Math.round(n?.borderThickness??1),je=Number.isFinite(K)?Math.min(Math.max(K,0),20):1,X=n?.sticky??"always",A=Ut(n?.topTextColor),m=Tt(n?.theme),S=Object.keys(V),Y=lt(S.length?S:void 0),g=He?r(st,{countries:S.length?S:void 0,urls:f?void 0:V,showAs:Re}):null,{headerRef:b,scrolled:J,navHidden:ze}=pt({stickyMode:X,heightPx:Me}),Oe=m?JSON.stringify(m.style):null;re(()=>{const e=b.current?.ownerDocument??document,o=e.defaultView??window,T=ne=>ne?_t(o.getComputedStyle(ne).getPropertyValue("--bg")):null,O=()=>{ge(!tt({doc:e,whenUnset:!0})),xe(T(e.body)),ye(T(b.current))};O();const qe=nt(O,{doc:e}),te=new MutationObserver(O);return e.body&&te.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>{qe(),te.disconnect()}},[b,Oe]);const x=ie??kt?r(xt,{}):null;re(()=>{if(!yt({editorPreview:!!$,hasPreviewSettings:!!f,hasInitialSettings:!!I}))return;let e=!1;return vt.getHeaderSettings().then(o=>!e&&we(o)).catch(o=>{console.warn("[header] settings fetch failed; using built-in defaults",o)}),()=>{e=!0}},[$,f,I]);const k=J||B,q=Et(L,B),Q=gt(b,A),Be=k||!Q,Ge=k?ve??L:(be??L)&&!Q,Fe=A==="auto"?null:{[Dt]:A},We=Ze(()=>y(!1),[]),D=et(null);bt({active:c,onDismiss:We,focusRef:D,trapRef:D});const d=(e,o,T="start")=>r(se,{item:e,dropdownAlign:T},o),Ve=!me&&(n?.menuItems?.length??0)>0,N=!!$||!!f,a=Ve?n.menuItems.map(e=>({href:e.url||"",label:le(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(o=>({href:o.url||"",label:le(o.label),plainLabel:o.label,description:o.description,image:o.image,badge:o.badge})),dropdownAside:wt(e.dropdown_aside)})):N?Mt.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Ke=a.length>0||p&&H||!!g&&Y||!!x,Xe=i==="center"?a.slice(0,G):i==="right"?a:[],Ye=i==="center"?a.slice(G):i==="left"?a:[],P=_e&&p?r(ht,{onClick:N?void 0:pe,asText:R}):null,U=p&&H?r(mt,{asText:R}):null,M=e=>p&&Ae?r(ut,{onClick:he,count:fe.sets,asText:R,className:e}):null,Je=n?.callPhone??"",Z=n?.callHref??"",j=e=>n?.callButton&&(Z||N)?r(ft,{href:N?"":Z,label:e?"Call":Je||"Call"}):null,u=s(E,{children:[W==="left"?P:null,g,x,U,M(),W==="right"?P:null,j(!1)]}),z=(e,o=!1)=>r(oe,{href:"/","aria-label":C?`${C} home`:"Home",className:e,children:r(it,{variant:"header",scrolled:Be,src:Se,reverse:ke,onLightSurface:Ge,reversedSrc:Ne,inkIsDark:Pe,size:Te,sizePx:Ee,sizeUnit:Ie,wordmark:ce,siteName:C,fitToContainer:o})}),h=z("inline-flex shrink-0 items-center justify-center"),ee="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return s(E,{children:[r("header",{ref:b,"data-scrolled":J||void 0,...Fe,className:["sf-site-header",...m?[m.className]:[],X==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",k?"border-solid border-line backdrop-blur-md":"border-solid border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:At,borderBottomWidth:`${je}px`,...ze?{transform:"translateY(-100%)"}:null,...k?{background:q,color:"var(--fg)","--sf-header-ground":q}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:s("div",{className:"w-full",style:Ue,children:[$e?s("div",{"data-header-band":"",className:`${w.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?r("nav",{className:`${l} flex items-center gap-8`,children:u}):r("div",{className:"flex items-center",children:h}),r("nav",{className:`${l} flex items-center justify-center gap-8`,children:a.map((e,o)=>d(e,`${e.href}-${o}`,"center"))}),i==="right"?r("div",{className:"flex items-center justify-end",children:h}):r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):i==="center"?s("div",{"data-header-band":"",className:`${w.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[r("nav",{className:`${l} flex items-center gap-8`,children:Xe.map((e,o)=>d(e,`${e.href}-${o}`))}),h,s("nav",{className:`${l} flex items-center justify-end gap-8`,children:[Ye.map((e,o)=>d(e,`${e.href}-${o}`,"end")),u]})]}):Ce?s("div",{"data-header-band":"",className:`${w.flex} items-center justify-between gap-8`,children:[s("div",{className:"flex items-center gap-8",style:Le,children:[h,r("nav",{className:`${l} flex items-center gap-8`,children:a.map((e,o)=>d(e,`${e.href}-${o}`))})]}),r("nav",{className:`${l} flex items-center justify-end gap-8`,children:u})]}):r("div",{"data-header-band":"",className:`${w.flex} items-center justify-between gap-8`,children:i==="right"?s(E,{children:[s("nav",{className:`${l} flex items-center gap-8`,children:[a.map((e,o)=>d(e,`${e.href}-${o}`)),u]}),h]}):s(E,{children:[h,s("nav",{className:`${l} flex items-center gap-8`,children:[a.map((e,o)=>d(e,`${e.href}-${o}`)),u]})]})}),!F&&s("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[s("div",{className:"flex items-center justify-between",children:[z(ee,!0),s("div",{className:`${l} flex shrink-0 items-center gap-5`,children:[P,g,x,U,M(),j(!1)]})]}),r("nav",{className:`${l} flex items-center gap-6 border-t border-line/60 pt-3`,children:a.map((e,o)=>d(e,`${e.href}-${o}`))})]}),s("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[z(ee,!0),s("div",{className:"flex shrink-0 items-center gap-4",children:[P,U,M(l),j(!0),Ke&&s("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>y(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&s("div",{ref:D,role:"dialog","aria-modal":"true","aria-label":"Menu",tabIndex:-1,"data-header-phone-menu":"",className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden flex-col gap-8 overflow-y-auto bg-bg px-6 pt-24 pb-10 max-view-tablet:flex",children:[a.map((e,o)=>r(se,{item:e,mobile:!0,onNavigate:()=>y(!1)},`${e.href}-${o}`)),s("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[p&&H&&s("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),r(oe,{href:"/account",onClick:()=>y(!1),className:"mono-eyebrow underline",children:"Your account"})]}),g&&Y&&s("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),g]}),x&&s("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),x]})]})]})]})}export{jt as default};
|
|
1
|
+
"use client";import{jsx as r,Fragment as E,jsxs as s}from"react/jsx-runtime";import oe from"next/link";import{usePathname as Ze}from"next/navigation";import{useCallback as et,useEffect as re,useRef as tt,useState as v}from"react";import{rootIsDark as nt,watchRootTheme as ot}from"efficient-shell/format";import{useCart as rt}from"./CartContext.js";import{useSearch as st}from"./SearchContext.js";import lt,{useCountrySelectShows as at}from"./CountrySelect.js";import{resolveCountryShowAs as it}from"../lib/content/country-show-as.js";import se from"./HeaderNavItem.js";import ct from"efficient-web-builder/render/components/Logo";import{siteLengthCss as dt}from"efficient-web-builder/format/lib/content/css-length";import mt from"./MenuPlaceholderLabel.js";import{withRMark as le}from"efficient-web-builder/render/components/RMark";import{AccountButton as ut,CartButton as ht,SearchButton as ft}from"./HeaderTools.js";import pt from"./HeaderCallButton.js";import{useHeaderBar as gt}from"./useHeaderBar.js";import{useHeaderAtTopIsDark as bt}from"./useHeaderAtTopIsDark.js";import{usePageOwnsTop as xt}from"./usePageOwnsTop.js";import{useModalDismiss as vt}from"./useModalDismiss.js";import yt from"./ThemeToggle.js";import{products as wt}from"../lib/api/index.js";import{shouldFetchPublicHeaderSettings as St}from"../lib/header-settings-fetch.js";import{menuDropdownAside as kt}from"../lib/menu-link.js";import{HEADER_MENU_PLACEHOLDER_COUNT as Nt}from"../lib/content/menu-placeholder.js";import{DEFAULT_SWITCH_SHOWN as Pt}from"efficient-web-builder/format/lib/theme";import{chromeWidthStyle as Tt,resolveChromeWidth as Et}from"efficient-web-builder/format/lib/content/page-width";import{headerThemeWrap as It}from"../lib/content/header-theme.js";import{headerSolidBackground as $t,isProductPage as Ct,resolveMenuRow as Lt,resolveNavTextCase as _t,resolveUtilStyle as Ht}from"../lib/content/header-bar.js";import{surfaceIsLight as Rt}from"../lib/logo/surface-is-light.js";import{HEADER_HEIGHT_PX as At,HEADER_MENU_GAP_PX as Dt,HEADER_SET_HEIGHT_CSS as Ut}from"efficient-web-builder/render/lib/document/header-clearance";import{HEADER_INK_OVERRIDE_ATTR as Mt,resolveHeaderInkMode as jt}from"efficient-web-builder/render/lib/document/header-ink";const ae={stacked:{grid:"hidden min-[1501px]:grid",flex:"hidden min-[1501px]:flex"},inline:{grid:"hidden view-tablet:grid",flex:"hidden view-tablet:flex"}},Ot=Array.from({length:Nt},()=>({href:"#",label:r(mt,{})}));function zt({previewSettings:p,initialSettings:I,editorPreview:$,showThemeToggle:ie,wordmark:ce,hideLogo:de,hideMenu:me,siteName:C,commerceEnabled:g=!0}={}){const ue=Ze(),B=Ct(ue),[c,y]=v(!1),{open:he,totals:fe}=rt(),{open:pe}=st(),[L,ge]=v(!1),[be,xe]=v(null),[ve,ye]=v(null),[t,we]=v(I??null),n=p??(t?{logoUrl:t.logoUrl,reverseLogo:t.reverseLogo,logoReversed:t.logoReversed,logoInkIsDark:t.logoInkIsDark,logoPosition:t.logoPosition,logoSize:t.logoSize,logoSizePx:t.logoSizePx,logoSizeUnit:t.logoSizeUnit??null,menuItems:(t.menuItems??[]).map(e=>({label:e.label,url:e.url,dropdown_menu:null,dropdown_items:e.dropdownItems??[],dropdown_aside:e.dropdownAside??null})),menuSplit:t.menuSplit??3,menuPosition:t.menuPosition,menuRow:t.menuRow,menuGapPx:t.menuGapPx??null,menuGapUnit:t.menuGapUnit??null,searchEnabled:t.searchEnabled,searchPosition:t.searchPosition,searchRow:t.searchRow,countrySelectorEnabled:t.countrySelectorEnabled,countrySelectorShowAs:t.countrySelectorShowAs,countryUrls:t.countryUrls,accountEnabled:t.accountEnabled,cartEnabled:t.cartEnabled,utilStyle:t.utilStyle,navTextCase:t.navTextCase,lightReverseText:t.lightReverseText,topTextColor:t.topTextColor,transparentTop:t.transparentTop,surface:t.surface,theme:t.theme,width:t.width,heightPx:t.heightPx,borderThickness:t.borderThickness??null,sticky:t.sticky,callButton:t.callButton,callPhone:t.callPhone,callHref:t.callHref}:null),Se=de?null:n?.logoUrl??null,ke=n?.reverseLogo??!1,Ne=n?.logoReversed??null,Pe=n?.logoInkIsDark??null,i=n?.logoPosition??"center",Te=n?.logoSize??"medium",Ee=n?.logoSizePx??null,Ie=n?.logoSizeUnit??null,G=Math.min(Math.max(n?.menuSplit??3,1),4),$e=(n?.menuPosition??"left")==="center",Ce=(n?.menuPosition??"left")==="beside",F=Lt(n?.menuRow)==="inline",_=n?.menuGapPx??null,Le=_!=null?{gap:dt(_,n?.menuGapUnit,"gap",Dt)??`${_}px`}:void 0,w=F?ae.inline:ae.stacked,_e=n?.searchEnabled??!1,W=n?.searchPosition??"right",He=n?.countrySelectorEnabled??!0,Re=it(n?.countrySelectorShowAs),H=n?.accountEnabled??!0,Ae=n?.cartEnabled??!0,R=Ht(n?.utilStyle)==="text",l=`mono-eyebrow${_t(n?.navTextCase)==="capitalised"?" mono-eyebrow-plain":""}`,V=n?.countryUrls??{},De=Et(n?.width),Ue=Tt(De)??void 0,Me=n?.heightPx??At.default,K=Math.round(n?.borderThickness??1),je=Number.isFinite(K)?Math.min(Math.max(K,0),20):1,X=n?.sticky??"always",A=jt(n?.topTextColor),m=It(n?.theme),S=Object.keys(V),Y=at(S.length?S:void 0),b=He?r(lt,{countries:S.length?S:void 0,urls:p?void 0:V,showAs:Re}):null,{headerRef:u,scrolled:J,navHidden:Oe}=gt({stickyMode:X,heightPx:Me}),ze=m?JSON.stringify(m.style):null;re(()=>{const e=u.current?.ownerDocument??document,o=e.defaultView??window,T=ne=>ne?Rt(o.getComputedStyle(ne).getPropertyValue("--bg")):null,z=()=>{ge(!nt({doc:e,whenUnset:!0})),xe(T(e.body)),ye(T(u.current))};z();const Qe=ot(z,{doc:e}),te=new MutationObserver(z);return e.body&&te.observe(e.body,{attributes:!0,attributeFilter:["style"]}),()=>{Qe(),te.disconnect()}},[u,ze]);const x=ie??Pt?r(yt,{}):null;re(()=>{if(!St({editorPreview:!!$,hasPreviewSettings:!!p,hasInitialSettings:!!I}))return;let e=!1;return wt.getHeaderSettings().then(o=>!e&&we(o)).catch(o=>{console.warn("[header] settings fetch failed; using built-in defaults",o)}),()=>{e=!0}},[$,p,I]);const Be=xt(u),k=J||B||Be,q=$t(L,B),Q=bt(u,A),Ge=k||!Q,Fe=k?ve??L:(be??L)&&!Q,We=A==="auto"?null:{[Mt]:A},Ve=et(()=>y(!1),[]),D=tt(null);vt({active:c,onDismiss:Ve,focusRef:D,trapRef:D});const d=(e,o,T="start")=>r(se,{item:e,dropdownAlign:T},o),Ke=!me&&(n?.menuItems?.length??0)>0,N=!!$||!!p,a=Ke?n.menuItems.map(e=>({href:e.url||"",label:le(e.label),plainLabel:e.label,dropdownItems:(e.dropdown_items??[]).map(o=>({href:o.url||"",label:le(o.label),plainLabel:o.label,description:o.description,image:o.image,badge:o.badge})),dropdownAside:kt(e.dropdown_aside)})):N?Ot.map(e=>({...e,plainLabel:"Menu item",dropdownItems:[]})):[],Xe=a.length>0||g&&H||!!b&&Y||!!x,Ye=i==="center"?a.slice(0,G):i==="right"?a:[],Je=i==="center"?a.slice(G):i==="left"?a:[],P=_e&&g?r(ft,{onClick:N?void 0:pe,asText:R}):null,U=g&&H?r(ut,{asText:R}):null,M=e=>g&&Ae?r(ht,{onClick:he,count:fe.sets,asText:R,className:e}):null,qe=n?.callPhone??"",Z=n?.callHref??"",j=e=>n?.callButton&&(Z||N)?r(pt,{href:N?"":Z,label:e?"Call":qe||"Call"}):null,h=s(E,{children:[W==="left"?P:null,b,x,U,M(),W==="right"?P:null,j(!1)]}),O=(e,o=!1)=>r(oe,{href:"/","aria-label":C?`${C} home`:"Home",className:e,children:r(ct,{variant:"header",scrolled:Ge,src:Se,reverse:ke,onLightSurface:Fe,reversedSrc:Ne,inkIsDark:Pe,size:Te,sizePx:Ee,sizeUnit:Ie,wordmark:ce,siteName:C,fitToContainer:o})}),f=O("inline-flex shrink-0 items-center justify-center"),ee="flex min-w-0 flex-1 items-center overflow-x-clip [container-type:inline-size]";return s(E,{children:[r("header",{ref:u,"data-scrolled":J||void 0,...We,className:["sf-site-header",...m?[m.className]:[],X==="none"?"absolute":"fixed","inset-x-0 top-0 z-50","flex items-center","px-[var(--sf-site-gutter,40px)] max-view-tablet:px-[min(20px,var(--sf-site-gutter,40px))]",k?"border-solid border-line backdrop-blur-md":"border-solid border-transparent","transition-[background,border-color,transform] duration-300 ease-out"].join(" "),style:{...m?m.style:null,minHeight:Ut,borderBottomWidth:`${je}px`,...Oe?{transform:"translateY(-100%)"}:null,...k?{background:q,color:"var(--fg)","--sf-header-ground":q}:{color:"var(--sf-header-overlay-fg)","--sf-header-ground":"var(--sf-header-overlay-ground)"}},children:s("div",{className:"w-full",style:Ue,children:[$e?s("div",{"data-header-band":"",className:`${w.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[i==="right"?r("nav",{className:`${l} flex items-center gap-8`,children:h}):r("div",{className:"flex items-center",children:f}),r("nav",{className:`${l} flex items-center justify-center gap-8`,children:a.map((e,o)=>d(e,`${e.href}-${o}`,"center"))}),i==="right"?r("div",{className:"flex items-center justify-end",children:f}):r("nav",{className:`${l} flex items-center justify-end gap-8`,children:h})]}):i==="center"?s("div",{"data-header-band":"",className:`${w.grid} grid-cols-[1fr_auto_1fr] items-center gap-8`,children:[r("nav",{className:`${l} flex items-center gap-8`,children:Ye.map((e,o)=>d(e,`${e.href}-${o}`))}),f,s("nav",{className:`${l} flex items-center justify-end gap-8`,children:[Je.map((e,o)=>d(e,`${e.href}-${o}`,"end")),h]})]}):Ce?s("div",{"data-header-band":"",className:`${w.flex} items-center justify-between gap-8`,children:[s("div",{className:"flex items-center gap-8",style:Le,children:[f,r("nav",{className:`${l} flex items-center gap-8`,children:a.map((e,o)=>d(e,`${e.href}-${o}`))})]}),r("nav",{className:`${l} flex items-center justify-end gap-8`,children:h})]}):r("div",{"data-header-band":"",className:`${w.flex} items-center justify-between gap-8`,children:i==="right"?s(E,{children:[s("nav",{className:`${l} flex items-center gap-8`,children:[a.map((e,o)=>d(e,`${e.href}-${o}`)),h]}),f]}):s(E,{children:[f,s("nav",{className:`${l} flex items-center gap-8`,children:[a.map((e,o)=>d(e,`${e.href}-${o}`)),h]})]})}),!F&&s("div",{"data-header-band":"",className:"hidden view-tablet:max-[1501px]:flex flex-col gap-3",children:[s("div",{className:"flex items-center justify-between",children:[O(ee,!0),s("div",{className:`${l} flex shrink-0 items-center gap-5`,children:[P,b,x,U,M(),j(!1)]})]}),r("nav",{className:`${l} flex items-center gap-6 border-t border-line/60 pt-3`,children:a.map((e,o)=>d(e,`${e.href}-${o}`))})]}),s("div",{"data-header-phone":"",className:"hidden max-view-tablet:flex items-center justify-between",children:[O(ee,!0),s("div",{className:"flex shrink-0 items-center gap-4",children:[P,U,M(l),j(!0),Xe&&s("button",{type:"button","aria-label":c?"Close menu":"Open menu","aria-expanded":c,onClick:()=>y(e=>!e),className:"flex h-11 w-11 flex-col items-center justify-center gap-2",children:[r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"translate-y-[3px] rotate-45":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"opacity-0":""}`}),r("span",{className:`block h-px w-5 bg-current transition-transform ${c?"-translate-y-[3px] -rotate-45":""}`})]})]})]})]})}),c&&s("div",{ref:D,role:"dialog","aria-modal":"true","aria-label":"Menu",tabIndex:-1,"data-header-phone-menu":"",className:"fixed inset-x-0 top-0 bottom-0 z-40 hidden flex-col gap-8 overflow-y-auto bg-bg px-6 pt-24 pb-10 max-view-tablet:flex",children:[a.map((e,o)=>r(se,{item:e,mobile:!0,onNavigate:()=>y(!1)},`${e.href}-${o}`)),s("div",{className:"mt-auto flex flex-col gap-4 border-t border-line pt-6",children:[g&&H&&s("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Account"}),r(oe,{href:"/account",onClick:()=>y(!1),className:"mono-eyebrow underline",children:"Your account"})]}),b&&Y&&s("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Region"}),b]}),x&&s("div",{className:"flex items-center justify-between",children:[r("span",{className:"mono-eyebrow text-fg-dim",children:"Theme"}),x]})]})]})]})}export{zt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use client";import{useEffect as a,useState as m}from"react";import{usePathname as c}from"next/navigation";import{pageOwnsTop as u}from"../lib/content/header-bar.js";function w(e){const t=c(),[o,r]=m(!1);return a(()=>{const n=()=>r(u(e.current?.ownerDocument??document));n();const s=requestAnimationFrame(n);return()=>cancelAnimationFrame(s)},[e,t]),o}export{w as usePageOwnsTop};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export declare function resolveHeaderHeightPx(v: unknown): number;
|
|
2
2
|
export declare const UNDER_HEADER_SHEET_CLASS = "fixed inset-x-0 bottom-0 top-[var(--sf-header-h,88px)]";
|
|
3
3
|
export declare const isProductPage: (pathname: string | null | undefined) => boolean;
|
|
4
|
+
export declare const SITE_MAIN_ATTR = "data-site-main";
|
|
5
|
+
export declare const TOP_SPACE_SHARED = "shared";
|
|
6
|
+
export declare function pageOwnsTop(doc: Document | null | undefined): boolean;
|
|
4
7
|
export declare const headerSolidBackground: (isLight: boolean, productPage: boolean) => string;
|
|
5
8
|
export declare const HEADER_NAV_TEXT_CASES: readonly [{
|
|
6
9
|
readonly label: "Uppercase";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{HEADER_HEIGHT_PX as r}from"efficient-web-builder/render/lib/document/header-clearance";import{parseOption as o}from"efficient-shell/format";function
|
|
1
|
+
import{HEADER_CLEARANCE_CLASS as a,HEADER_HEIGHT_PX as r,TOP_SPACE_ATTR as n}from"efficient-web-builder/render/lib/document/header-clearance";import{parseOption as o}from"efficient-shell/format";function I(e){return typeof e=="number"&&Number.isInteger(e)&&e>=r.min&&e<=r.max?e:r.default}const d="fixed inset-x-0 bottom-0 top-[var(--sf-header-h,88px)]",m=e=>!!e&&e.startsWith("/wheels/")&&e!=="/wheels",l="data-site-main",E="shared";function D(e){if(!e)return!1;if(e.querySelector(`.${a}, [${n}="own"]`))return!0;const t=e.querySelector(`main[${l}]`);return t!=null&&t.querySelector(`[${n}="${E}"]`)==null}const N=(e,t)=>!e&&t?"var(--section-bg)":"var(--bg)",s=[{label:"Uppercase",value:"uppercase"},{label:"Capitalised",value:"capitalised"}],_="uppercase",O=e=>o(s,_,e),i=[{label:"Icon",value:"icon"},{label:"Text",value:"text"}],A="icon",b=e=>o(i,A,e),f=[{label:"Own row",value:"top"},{label:"Same row",value:"inline"}],P="top",g=e=>e==="inline"?"inline":e==="top"||e==="bottom"?"top":null,p="custom";function h(e,t){return e!==p||typeof t!="string"?null:t.trim()||null}const v=80,c=0,u=100,y="data-header-link-opacity",K="--sf-header-link-opacity";function M(e){if(!(typeof e!="number"||!Number.isFinite(e)))return Math.min(u,Math.max(c,Math.round(e)))}const x=[{label:"Medium",value:"medium"},{label:"Large",value:"large"}],T="medium",R={medium:{size:18,stroke:1.6},large:{size:20,stroke:1.4}},H=[{label:"Cart",value:"cart"},{label:"Bag",value:"bag"}],S="cart",U=e=>({cart:o(H,S,e.cartIcon),glyph:R[o(x,T,e.iconSize)]});export{H as HEADER_CART_ICONS,S as HEADER_CART_ICON_FALLBACK,x as HEADER_ICON_SIZES,T as HEADER_ICON_SIZE_FALLBACK,y as HEADER_LINK_OPACITY_ATTR,v as HEADER_LINK_OPACITY_DEFAULT,u as HEADER_LINK_OPACITY_MAX,c as HEADER_LINK_OPACITY_MIN,K as HEADER_LINK_OPACITY_VAR,f as HEADER_MENU_ROWS,P as HEADER_MENU_ROW_FALLBACK,s as HEADER_NAV_TEXT_CASES,_ as HEADER_NAV_TEXT_CASE_FALLBACK,p as HEADER_TOP_INK_CUSTOM,i as HEADER_UTIL_STYLES,A as HEADER_UTIL_STYLE_FALLBACK,l as SITE_MAIN_ATTR,E as TOP_SPACE_SHARED,d as UNDER_HEADER_SHEET_CLASS,N as headerSolidBackground,m as isProductPage,D as pageOwnsTop,M as readHeaderLinkOpacity,h as readHeaderTopInk,I as resolveHeaderHeightPx,U as resolveHeaderToolLook,g as resolveMenuRow,O as resolveNavTextCase,b as resolveUtilStyle};
|