@anker-in/headless-ui 1.3.72 → 1.3.74
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/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/styles.js +1 -1
- package/dist/cjs/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/cjs/biz-components/AiuiProvider/index.d.ts +9 -0
- package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
- package/dist/cjs/biz-components/CreativeModule/index.js +1 -1
- package/dist/cjs/biz-components/FooterNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +2 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.d.ts +2 -1
- package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/types.d.ts +1 -0
- package/dist/cjs/biz-components/HeaderNavigation/types.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.d.ts +30 -0
- package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.js +1 -0
- package/dist/cjs/biz-components/HeaderNavigation/useScrollLock.d.ts +2 -1
- package/dist/cjs/biz-components/HeaderNavigation/useScrollLock.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/withCategory.js +1 -1
- package/dist/cjs/biz-components/Listing/utils/index.js +1 -1
- package/dist/cjs/biz-components/SearchPage/index.js +1 -1
- package/dist/cjs/components/badge.d.ts +1 -1
- package/dist/cjs/components/badge.js +1 -1
- package/dist/cjs/components/board.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/styles.js +1 -1
- package/dist/esm/biz-components/ActivityMechanism/index.js +1 -1
- package/dist/esm/biz-components/AiuiProvider/index.d.ts +9 -0
- package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
- package/dist/esm/biz-components/CreativeModule/index.js +1 -1
- package/dist/esm/biz-components/FooterNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +2 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/ResourceItem.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.d.ts +2 -1
- package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/types.d.ts +1 -0
- package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.d.ts +30 -0
- package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.js +1 -0
- package/dist/esm/biz-components/HeaderNavigation/useScrollLock.d.ts +2 -1
- package/dist/esm/biz-components/HeaderNavigation/useScrollLock.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/withCategory.js +1 -1
- package/dist/esm/biz-components/Listing/utils/index.js +1 -1
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/components/badge.d.ts +1 -1
- package/dist/esm/components/badge.js +1 -1
- package/dist/esm/components/board.js +1 -1
- package/dist/tokens/oneAnker.css +22 -0
- package/package.json +1 -1
- package/style.css +55 -4
- package/tailwind.config.js +5 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";"use client";var Me=Object.create;var Z=Object.defineProperty;var Se=Object.getOwnPropertyDescriptor;var Pe=Object.getOwnPropertyNames;var De=Object.getPrototypeOf,Ee=Object.prototype.hasOwnProperty;var Te=(n,r)=>{for(var i in r)Z(n,i,{get:r[i],enumerable:!0})},le=(n,r,i,c)=>{if(r&&typeof r=="object"||typeof r=="function")for(let u of Pe(r))!Ee.call(n,u)&&u!==i&&Z(n,u,{get:()=>r[u],enumerable:!(c=Se(r,u))||c.enumerable});return n};var ee=(n,r,i)=>(i=n!=null?Me(De(n)):{},le(r||!n||!n.__esModule?Z(i,"default",{value:n,enumerable:!0}):i,n)),He=n=>le(Z({},"__esModule",{value:!0}),n);var Ie={};Te(Ie,{default:()=>Re});module.exports=He(Ie);var e=require("react/jsx-runtime"),t=require("react"),l=require("../../components/index.js"),pe=require("../../shared/Styles.js"),w=require("../../helpers/utils.js"),F=ee(require("./NavProvider.js")),o=require("./types.js"),fe=ee(require("jump.js")),te=require("@gsap/react"),X=require("gsap"),x=require("./withCategory.js"),S=require("./icons/index.js"),be=ee(require("../NavigationSearch/index.js")),ve=require("./ResourceSidebarDropdown.js"),ge=require("./MobileResourceSidebarMenu.js"),he=require("./SidebarDropdown.js"),ae=require("./useScrollLock.js"),ye=require("./MulticolDropdown.js"),Ne=require("./SupportsDropdown.js"),ke=require("./MobileSidebarMenu.js"),we=require("./MobileSupportMenu.js"),Ce=require("./MobileMulticolMenu.js"),ne=require("./MobileMenuComponents.js"),oe=require("../AiuiProvider/index.js"),ie=ee(require("../../shared/throttle.js"));const se=(0,t.forwardRef)((n,r)=>{const{data:{header:i}={},buildProps:c,event:u,profile:T,theme:s="light",isTop:d=!1,searchResult:h,onSearch:v,isSearching:p,keywords:L,onPrimaryNavClick:C,onSeriesProductClick:y,onSidebarNavClick:P,onMobileMenuToggle:U,headerId:D,cartCount:z,menuData:B,render:R,componentOverrides:G,...J}=n,[I,f]=(0,t.useState)(!1),[W,A]=(0,t.useState)(!1),[O,H]=(0,t.useState)(!1),[Y,g]=(0,t.useState)(!1),j=(0,t.useRef)(null),M=(0,t.useRef)(null),q=()=>{const N=document?.querySelector("body")?.offsetWidth||0;g(N<=1440)};(0,t.useEffect)(()=>(q(),window.addEventListener("resize",q),()=>{window.removeEventListener("resize",q)}),[]),(0,t.useImperativeHandle)(r,()=>M.current),(0,t.useEffect)(()=>{M.current&&d&&(0,fe.default)(M.current,{duration:0,offset:M.current?.getBoundingClientRect()?.bottom||0})},[d]),(0,t.useEffect)(()=>{if(d){A(!1),H(!1);return}let N=0,a=0,m=0;const b=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,k=b();N=k,A(k>300),H(k>30);const $=(0,ie.default)(()=>{const E=b(),K=E-N;H(E>30),K>0?(a=0,m+=K,m>=300&&E>300&&A(!0)):K<0&&(m=0,a+=Math.abs(K),a>=300&&(A(!1),a=0)),N=E},100);return window.addEventListener("scroll",$,{passive:!0}),()=>window.removeEventListener("scroll",$)},[d]),(0,t.useEffect)(()=>{u&&(u.search=()=>f(!0))},[u]),(0,te.useGSAP)(()=>{j?.current&&I&&X.gsap.fromTo(j.current,{height:0},{height:"auto",duration:.3})},[I]),(0,ae.useScrollLock)(I);const Q=(0,t.useMemo)(()=>i?.bar?.actions?.find(N=>N?.blockType===o.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[i]),_=R?.mobileHeaderNavigation;return(0,e.jsx)(F.default,{buildProps:c,profile:T,isMobile:Y,event:u,payloadData:i,onSidebarNavClick:P,onSeriesProductClick:y,cartCount:z,componentOverrides:G,children:(0,e.jsx)("header",{...J,id:D||"header","data-ui-component-id":"HeaderNavigation",className:d?"relative z-[100] bg-white":(0,w.cn)("sticky top-0 z-[100] transition-transform duration-500 ease-in-out",{"translate-y-[-100%]":W}),ref:M,children:(0,e.jsxs)("div",{className:(0,w.cn)("hover:bg-white hover:text-black",s==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":!d&&O},{"hover:!text-black":s==="dark","!text-black":!d&&O}),onClick:()=>!d&&H(!0),children:[(0,e.jsx)(ce,{data:i,className:"desktop:block hidden !bg-white",theme:s,onNavItemClick:()=>!d&&H(!0),onPrimaryNavClick:C}),_?(0,e.jsx)(_,{className:"desktop:hidden block !bg-white",menuData:B,data:i,onPrimaryNavClick:C}):(0,e.jsx)(ue,{menuData:B,data:i,className:"desktop:hidden block !bg-white",onPrimaryNavClick:C,onMobileMenuToggle:U}),I&&(0,e.jsxs)("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${M?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[(0,e.jsx)("div",{ref:j,className:(0,w.cn)("overflow-y-auto",{}),children:(0,e.jsx)(be.default,{data:Q,keywords:L,isSearching:p,searchResult:h,onSearch:N=>{v?.(N)},onClose:()=>{v?.(),f(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>f(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:N=>{(N.key==="Enter"||N.key===" "||N.key==="Escape")&&(N.preventDefault(),f(!1))}})]})]})})})}),ce=(0,t.forwardRef)((n,r)=>{const{data:i,onNavItemClick:c,className:u,theme:T,onPrimaryNavClick:s}=n,{event:d,profile:h}=(0,F.useNavContext)(),[v,p]=(0,t.useState)(!1),{locale:L="us"}=(0,oe.useAiuiContext)(),C=(0,t.useMemo)(()=>(0,x.WithGroupCategory)(i?.categories?.filter(a=>a?.pcShow)),[i]),[y,P]=(0,t.useState)(null),[U,D]=(0,t.useState)([]),z=(0,t.useRef)(null),[B,R]=(0,t.useState)(!1),G=(0,t.useRef)(null),J=(0,t.useRef)(null),I=(0,t.useRef)(C.map(a=>Array(a?.length||0).fill(null)));(0,t.useEffect)(()=>{C?.length&&D(C?.map((a,m)=>a?.map((b,k)=>({groupIndex:m,index:k,open:!1}))))},[C]);const f=(0,t.useMemo)(()=>{let a=null;for(const m of U){for(const b of m)if(b.open){a=b;break}if(a)break}return a},[U]);(0,ae.useScrollLock)(!!f?.open||B);const W=(a,m,b)=>{R(!1);const k=C[m][b];if(k?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links)k?.components?.[0]?.url&&window.open(k?.components?.[0]?.url,k?.components?.[0]?.target??"_blank");else{const $=C?.flat()||[],E=$?.findIndex(K=>K?.id===C[m][b]?.id);a.stopPropagation(),c?.(),s?.($[E],E),P(k),D(K=>K.map(xe=>xe.map(V=>V.groupIndex===m&&V.index===b?{...V,open:!V.open}:{...V,open:!1})))}},A=(a,m,b)=>{a.key==="Enter"||a.key===" "?(a.preventDefault(),W(a,m,b)):a.key==="Escape"&&f?.groupIndex===m&&f?.index===b&&(a.preventDefault(),O())},O=()=>{D(a=>a.map(m=>m.map(b=>({...b,open:!1}))))},H=(0,t.useMemo)(()=>{if(y)return y?.components?.[0]?.blockType},[y]),Y=(0,x.WithSidebar)(he.SidebarDropdown,y),g=(0,x.WithResource)(ve.ResourceSidebarDropdown,y),j=(0,x.WithMulticol)(ye.MulticolDropdown,y),M=(0,x.WithSupports)(Ne.SupportsDropdown,{categoriesItem:y,currentNavItemRef:I.current?.[f?.groupIndex||0]?.[f?.index||0]}),q=(0,t.useMemo)(()=>{switch(H){case o.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(Y,{});case o.HeaderNavigationBlockType.Resource:return(0,e.jsx)(g,{});case o.HeaderNavigationBlockType.Supports:return(0,e.jsx)(M,{});case o.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(j,{});default:return null}},[H,y]),Q=(0,t.useMemo)(()=>i?.bar?.actions?.filter(a=>a?.pcShow),[i]),_=(0,t.useMemo)(()=>Q?.find(a=>a?.blockType===o.HeaderNavigationActionBlockType.Profile),[Q]),N=(0,t.useCallback)(()=>{R(a=>!a)},[]);return(0,t.useEffect)(()=>{if(z?.current){const a=z.current;return a.addEventListener("click",N),()=>{a.removeEventListener("click",N)}}},[N]),(0,te.useGSAP)(()=>{f?.open&&X.gsap.fromTo(J?.current,{height:0},{height:"auto"})},[f?.open]),(0,e.jsxs)(l.Container,{className:(0,w.cn)("relative h-[92px]",u),children:[(0,e.jsxs)("div",{ref:G,onClick:O,className:"flex h-full flex-col justify-end gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(de,{}),(0,e.jsx)(re,{ref:z,actions:Q,activeStatus:B})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:C?.map((a,m)=>(0,e.jsx)("div",{className:"flex gap-3",children:a?.map((b,k)=>{const $=f?.groupIndex===m&&f?.index===k;return(0,e.jsx)("div",{ref:E=>{I.current[m][k]=E},className:"group",children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("button",{className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4",onClick:E=>W(E,m,k),onKeyDown:E=>A(E,m,k),"aria-expanded":$,"aria-haspopup":"true","aria-label":b.text,children:[(0,e.jsx)(l.Text,{html:b.text,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)(S.DownArrow,{className:(0,w.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":f?.groupIndex===m&&f?.index===k,"opacity-100":v&&f?.groupIndex===m&&f?.index===k,invisible:!b?.components?.length||b?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links})})]}),(0,e.jsx)("div",{className:(0,w.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":$},T==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},b.id)})},`groupCategory-${m}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(f?.open&&y),className:(0,w.cn)("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(f?.open&&y)}),onMouseEnter:()=>p(!0),onMouseLeave:()=>p(!1),style:{height:`calc(100dvh - ${G?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:J,className:(0,w.cn)("relative z-50",{"overflow-hidden":H!==o.HeaderNavigationBlockType.Supports}),children:q}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:O,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),O())}})]}),B&&(0,e.jsxs)("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",role:"dialog","aria-modal":"true","aria-label":"User profile menu",children:[(0,e.jsx)("div",{className:"rounded-box absolute w-[272px] overflow-hidden bg-white p-4",style:{right:`calc(100% - ${z?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:h?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(l.Text,{html:h?.nick_name||_?.welcome,className:"text-sm font-bold"}),(0,e.jsx)("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),(0,e.jsx)("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:_?.profiles?.map(a=>(0,e.jsx)(ne.MenuItem,{className:"py-2",label:a?.title,href:(0,w.getLocalizedPath)(a?.url,L)},a.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(S.Polygon,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),(0,e.jsx)(l.Text,{html:_?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:_?.benefits?.map(a=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:a.benefitIcon?.url,className:"size-4 shrink-0",alt:a.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:a.benefit,className:"text-sm font-bold leading-[1.4]"})]},a.id))}),(0,e.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,e.jsx)(l.Button,{className:"grow",variant:"secondary",size:"lg",onClick:()=>d?.join?.(),children:(0,e.jsx)(l.Text,{html:_?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(l.Button,{className:"grow",variant:"primary",size:"lg",onClick:()=>d?.login?.(),children:(0,e.jsx)(l.Text,{html:_?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>R(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:a=>{(a.key==="Enter"||a.key===" "||a.key==="Escape")&&(a.preventDefault(),R(!1))}})]})]})}),ue=(0,t.forwardRef)(({data:n,menuData:r,className:i,onPrimaryNavClick:c,onMobileMenuToggle:u},T)=>{const s=(0,t.useMemo)(()=>(0,x.WithGroupCategory)(n?.categories?.filter(g=>g?.mobileShow)),[n]),{currentMenu:d,setCurrentMenu:h,subSubCategory:v}=(0,F.useNavContext)(),[p,L]=(0,t.useState)(!1),[C,y]=(0,t.useState)(0),[P,U]=(0,t.useState)(null),D=(0,t.useRef)(null),z=(0,t.useRef)(!1);(0,t.useEffect)(()=>{if(D?.current&&p){const g=D?.current?.getBoundingClientRect();y(window?.innerHeight-(g?.top||0))}u?.({open:p})},[p,u]),(0,t.useEffect)(()=>{if(!p)return;const g=(0,ie.default)(()=>{if(D?.current){const j=D.current.getBoundingClientRect();z.current=!0,y(window?.innerHeight-(j?.top||0))}},100);return window.addEventListener("resize",g),()=>window.removeEventListener("resize",g)},[p]),(0,te.useGSAP)(()=>{if(z.current){X.gsap.set(D.current,{height:C}),z.current=!1;return}X.gsap.fromTo(D.current,{height:0},{height:C,duration:.3})},[C]),(0,ae.useScrollLock)(p);const B=(0,t.useMemo)(()=>P?.components?.[0]?.blockType,[P]),R=(0,x.WithSupports)(we.MobileSupportMenu,{categoriesItem:P}),G=(0,x.WithSidebar)(ke.MobileSidebarMenu,P),J=(0,x.WithResource)(ge.MobileResourceSidebarMenu,P),I=(0,x.WithMulticol)(Ce.MobileMulticolMenu,P),f=(0,t.useMemo)(()=>{switch(B){case o.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(G,{});case o.HeaderNavigationBlockType.Resource:return(0,e.jsx)(J,{});case o.HeaderNavigationBlockType.Supports:return(0,e.jsx)(R,{});case o.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(I,{});default:return null}},[B,P,R]),W=(0,t.useCallback)(()=>{L(!1),y(0),h&&h(o.HeaderNavigationMenu.Primary)},[L,y,h]),A=(0,t.useMemo)(()=>n?.bar?.actions?.filter(g=>g?.mobileShow&&g?.blockType!==o.HeaderNavigationActionBlockType.Profile),[n]),O=(0,t.useMemo)(()=>n?.bar?.actions?.find(g=>g?.mobileShow&&g?.blockType===o.HeaderNavigationActionBlockType.Profile)||{},[n]),H=(0,t.useMemo)(()=>{switch(d){case o.HeaderNavigationMenu.Primary:return(0,e.jsx)(Be,{actions:A,menuOpen:p,onMenuOpenClose:()=>{L(!1),y(0)},onMenuOpenClick:()=>L(!0)});case o.HeaderNavigationMenu.Secondary:return(0,e.jsx)(me,{title:P?.text,onMenuOpenClose:W,onMenuBackClick:()=>h?.(o.HeaderNavigationMenu.Primary)});case o.HeaderNavigationMenu.Third:return(0,e.jsx)(me,{title:v?.label,onMenuOpenClose:W,onMenuBackClick:()=>h?.(o.HeaderNavigationMenu.Secondary)});default:return null}},[p,d,h,P,A,v,W]),Y=(0,t.useCallback)((g,j)=>{const M=Array.isArray(s)?Array.isArray(s[g])?s[g][j]:{}:{};U(M),M?.components?.[0]?.blockType===o.HeaderNavigationBlockType.Links?M?.components?.[0]?.url&&window.open(M?.components?.[0]?.url,M?.components?.[0]?.target??"_blank"):h?.(o.HeaderNavigationMenu.Secondary)},[s,h]);return(0,e.jsxs)(l.Container,{className:(0,w.cn)("relative h-[56px]",i),children:[H,p&&(0,e.jsxs)("nav",{ref:D,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:C},role:"navigation","aria-label":"Mobile navigation menu",children:[d===o.HeaderNavigationMenu.Primary&&r?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(l.BrandStrip,{data:r})}):null,d===o.HeaderNavigationMenu.Primary?(0,e.jsx)(Le,{categories:s,onPrimaryMenuClick:Y,onPrimaryNavClick:c,profileAction:O,menuData:r}):f]})]})}),Le=({categories:n,onPrimaryMenuClick:r,profileAction:i,onPrimaryNavClick:c,menuData:u})=>(0,e.jsxs)("div",{className:"flex h-full flex-col justify-between",children:[(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:n?.map((T,s)=>(0,e.jsxs)("div",{className:"",children:[s>0||u?(0,e.jsx)("div",{className:(0,w.cn)("my-2 h-px w-full bg-[#E5E5E7]")}):null,T?.map((d,h)=>(0,e.jsx)(ne.MenuItem,{label:d.text,onClick:()=>{const p=(n?.flat()||[])?.findIndex(L=>L?.id===n[s][h]?.id);r(s,h),c?.(d,p)},icon:d.components?.[0]?.icon},d.id))]},`groupCategory-${s}`))}),(0,e.jsx)(ze,{profileAction:i})]}),ze=({profileAction:n})=>{const[r,i]=(0,t.useState)(!1),{profile:c,event:u}=(0,F.useNavContext)(),{locale:T="us"}=(0,oe.useAiuiContext)();return(0,e.jsxs)("div",{className:(0,w.cn)("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":r}),children:[(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>i(!r),"aria-expanded":r,"aria-label":c?.nick_name||n?.welcome,children:[(0,e.jsxs)("div",{className:"flex items-center gap-[14px]",children:[(0,e.jsx)("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:(0,e.jsx)(S.User,{"aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:c?.nick_name||n?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&(0,e.jsx)(S.DownArrow,{"aria-hidden":"true",className:(0,w.cn)("laptop:size-4 size-5",{"rotate-180":r})})]}),c?.email&&(0,e.jsx)("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:n?.profiles?.map(s=>(0,e.jsx)(ne.MenuItem,{label:s?.title,href:(0,w.getLocalizedPath)(s?.url,T)},s.id))}),r&&!c?.email&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(l.Text,{html:n?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:n?.benefits?.map(s=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(l.Picture,{source:s.benefitIcon?.url,className:"size-4",alt:s.benefit,width:16,height:16}),(0,e.jsx)(l.Text,{html:s.benefit,className:"text-sm font-bold leading-[1.4]"})]},s.id))})]}),!c?.email&&(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>u?.join?.(),children:(0,e.jsx)(l.Text,{html:n?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),(0,e.jsx)(l.Button,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>u?.login?.(),children:(0,e.jsx)(l.Text,{html:n?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},Be=({menuOpen:n,onMenuOpenClose:r,onMenuOpenClick:i,actions:c})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(de,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(re,{actions:c}),n?(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>r(),"aria-label":"Close menu","aria-expanded":"true",children:(0,e.jsx)(S.Close,{className:"size-5","aria-hidden":"true"})}):(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:(0,e.jsx)(S.Menu,{className:"size-5","aria-hidden":"true"})})]})]}),de=()=>{const{payloadData:n,isMobile:r}=(0,F.useNavContext)(),{locale:i="us"}=(0,oe.useAiuiContext)();return(0,e.jsx)("a",{href:(0,w.getLocalizedPath)("/",i),className:"hover:text-[#00CBEB] [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:r?n?.bar?.mobileLogo:n?.bar?.desktopLogo}})},re=(0,t.forwardRef)(({actions:n,activeStatus:r=!1},i)=>{const{event:c,cartCount:u}=(0,F.useNavContext)(),[T,s]=(0,t.useState)(null),d=v=>{switch(v){case o.HeaderNavigationActionBlockType.Search:return"Search";case o.HeaderNavigationActionBlockType.Cart:return`Shopping cart${u>0?` (${u} items)`:""}`;case o.HeaderNavigationActionBlockType.Profile:return"User profile";case o.HeaderNavigationActionBlockType.Livestream:return"Livestream";default:return"Action"}},h=(0,t.useCallback)((v,p)=>{switch(s(p),v?.blockType){case o.HeaderNavigationActionBlockType.Search:c?.search?.();break;case o.HeaderNavigationActionBlockType.Cart:c?.cart?.();break;case o.HeaderNavigationActionBlockType.Profile:c?.profile?.();break;case o.HeaderNavigationActionBlockType.Livestream:c?.livestream?.();break;default:return()=>{}}},[c]);return(0,e.jsx)("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(n)&&n?.map((v,p)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0","data-tag":v?.tag||"",ref:v.blockType===o.HeaderNavigationActionBlockType.Profile?i:null,onClick:()=>h(v,p),"aria-label":d(v.blockType),"aria-pressed":r&&T===p,children:[(0,e.jsx)(l.Text,{html:v.icon,className:(0,w.cn)("size-5",{"text-brand-0":r&&T===p}),"aria-hidden":"true"}),v.blockType===o.HeaderNavigationActionBlockType.Cart&&u>0&&(0,e.jsx)("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]","aria-hidden":"true",children:(0,e.jsx)(l.Text,{html:u?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},v.id))})}),me=({title:n,onMenuOpenClose:r,onMenuBackClick:i})=>(0,e.jsxs)("div",{className:"flex h-full items-center gap-3",children:[(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Back to previous menu",children:(0,e.jsx)(S.LeftArrow,{className:"size-5","aria-hidden":"true"})}),(0,e.jsx)(l.Text,{html:n,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>r(),"aria-label":"Close menu",children:(0,e.jsx)(S.Close,{className:"size-5","aria-hidden":"true"})})]});ue.displayName="MobileNavigation",re.displayName="Actions",se.displayName="HeaderNavigation",ce.displayName="DesktopNavigation";var Re=(0,pe.withLayout)(se);
|
|
1
|
+
"use strict";"use client";var Be=Object.create;var ie=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Ie=Object.getOwnPropertyNames;var Ae=Object.getPrototypeOf,Oe=Object.prototype.hasOwnProperty;var je=(t,o)=>{for(var i in o)ie(t,i,{get:o[i],enumerable:!0})},pe=(t,o,i,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let u of Ie(o))!Oe.call(t,u)&&u!==i&&ie(t,u,{get:()=>o[u],enumerable:!(c=ze(o,u))||c.enumerable});return t};var le=(t,o,i)=>(i=t!=null?Be(Ae(t)):{},pe(o||!t||!t.__esModule?ie(i,"default",{value:t,enumerable:!0}):i,t)),_e=t=>pe(ie({},"__esModule",{value:!0}),t);var Ge={};je(Ge,{default:()=>Fe});module.exports=_e(Ge);var e=require("react/jsx-runtime"),a=require("react"),s=require("../../components/index.js"),xe=require("../../shared/Styles.js"),v=require("../../helpers/utils.js"),K=le(require("./NavProvider.js")),r=require("./types.js"),Ce=le(require("jump.js")),se=require("@gsap/react"),te=require("gsap"),M=require("./withCategory.js"),w=require("./icons/index.js"),we=le(require("../NavigationSearch/index.js")),Me=require("./ResourceSidebarDropdown.js"),Se=require("./MobileResourceSidebarMenu.js"),Te=require("./SidebarDropdown.js"),ce=require("./useScrollLock.js"),De=require("./MulticolDropdown.js"),Le=require("./SupportsDropdown.js"),Pe=require("./MobileSidebarMenu.js"),Ee=require("./MobileSupportMenu.js"),He=require("./MobileMulticolMenu.js"),ue=require("./MobileMenuComponents.js"),q=require("../AiuiProvider/index.js"),me=le(require("../../shared/throttle.js")),Re=require("./useNavCollapse.js");const fe=t=>!!t?.components?.length&&t?.components?.[0]?.blockType!==r.HeaderNavigationBlockType.Links,be=t=>t?.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links&&t?.components?.[0]?.url||t?.url||void 0,ve=t=>t?.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links&&t?.components?.[0]?.target||t?.target,$e=({groupCategories:t})=>(0,e.jsx)("div",{className:"pointer-events-none invisible absolute inset-x-0 top-0 overflow-hidden","aria-hidden":"true",children:(0,e.jsx)(s.Container,{className:"h-[92px]",children:(0,e.jsx)("nav",{className:"flex h-full items-end justify-between",children:t?.map((o,i)=>(0,e.jsx)("div",{className:"flex gap-3","data-nav-item":!0,children:o?.map(c=>(0,e.jsxs)("div",{className:"flex items-center gap-1",children:[(0,e.jsx)(s.Text,{html:c.text,"data-nav-item-label":!0,className:"desktop:text-pretty text-nowrap text-sm font-bold leading-[1.4]"}),fe(c)&&(0,e.jsx)(w.DownArrow,{className:"size-4 opacity-0","aria-hidden":"true"})]},c.id))},`measure-group-${i}`))})})}),ge=(0,a.forwardRef)((t,o)=>{const{data:{header:i}={},buildProps:c,event:u,profile:P,theme:m="light",isTop:l=!1,searchResult:p,onSearch:f,isSearching:b,keywords:E,onPrimaryNavClick:T,onSeriesProductClick:y,onSidebarNavClick:D,onMobileMenuToggle:F,headerId:S,cartCount:H,menuData:B,render:z,componentOverrides:G,...U}=t,[k,I]=(0,a.useState)(!1),[g,A]=(0,a.useState)(!1),[J,O]=(0,a.useState)(!1),L=(0,a.useRef)(null),d=(0,a.useRef)(null),_=(0,a.useMemo)(()=>(0,M.WithGroupCategory)(i?.categories?.filter(x=>x?.pcShow)),[i]),R=(0,Re.useNavCollapse)(d),{setNavCollapsed:ae}=(0,q.useAiuiContext)();(0,a.useEffect)(()=>{ae?.(R)},[R,ae]),(0,a.useImperativeHandle)(o,()=>d.current),(0,a.useEffect)(()=>{d.current&&l&&(0,Ce.default)(d.current,{duration:0,offset:d.current?.getBoundingClientRect()?.bottom||0})},[l]),(0,a.useEffect)(()=>{if(l){A(!1),O(!1);return}let x=0,Y=0,V=0;const re=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,W=re();x=W,A(W>300),O(W>30);const j=(0,me.default)(()=>{const $=re(),n=$-x;O($>30),n>0?(Y=0,V+=n,V>=300&&$>300&&A(!0)):n<0&&(V=0,Y+=Math.abs(n),Y>=300&&(A(!1),Y=0)),x=$},100);return window.addEventListener("scroll",j,{passive:!0}),()=>window.removeEventListener("scroll",j)},[l]),(0,a.useEffect)(()=>{u&&(u.search=()=>I(!0))},[u]),(0,se.useGSAP)(()=>{L?.current&&k&&te.gsap.fromTo(L.current,{height:0},{height:"auto",duration:.3})},[k]),(0,ce.useScrollLock)(k);const Q=(0,a.useMemo)(()=>i?.bar?.actions?.find(x=>x?.blockType===r.HeaderNavigationActionBlockType.Search)?.searchBar?.[0]||{},[i]),ne=z?.mobileHeaderNavigation;return(0,e.jsx)(K.default,{buildProps:c,profile:P,isMobile:R,event:u,payloadData:i,onSidebarNavClick:D,onSeriesProductClick:y,cartCount:H,componentOverrides:G,children:(0,e.jsx)("header",{...U,id:S||"header","data-ui-component-id":"HeaderNavigation",className:l?"relative z-[100] bg-white":(0,v.cn)("sticky top-0 z-[100] transition-transform duration-500 ease-in-out",{"translate-y-[-100%]":g}),ref:d,children:(0,e.jsxs)("div",{className:(0,v.cn)("hover:bg-white hover:text-black",m==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":!l&&J},{"hover:!text-black":m==="dark","!text-black":!l&&J}),onClick:()=>!l&&O(!0),children:[(0,e.jsx)($e,{groupCategories:_}),(0,e.jsx)("div",{className:(0,v.cn)("hidden",R?"laptop:hidden":"laptop:block","desktop:block"),children:(0,e.jsx)(he,{data:i,groupCategories:_,theme:m,onNavItemClick:()=>!l&&O(!0),onPrimaryNavClick:T,className:"!bg-white"})}),(0,e.jsx)("div",{className:(0,v.cn)("block",R?"laptop:block":"laptop:hidden","desktop:hidden"),children:ne?(0,e.jsx)(ne,{menuData:B,data:i,onPrimaryNavClick:T}):(0,e.jsx)(ye,{menuData:B,data:i,onPrimaryNavClick:T,onMobileMenuToggle:F,className:"!bg-white"})}),k&&(0,e.jsxs)("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${d?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[(0,e.jsx)("div",{ref:L,className:(0,v.cn)("overflow-y-auto",{}),children:(0,e.jsx)(we.default,{data:Q,keywords:E,isSearching:b,searchResult:p,onSearch:x=>{f?.(x)},onClose:()=>{f?.(),I(!1)}})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>I(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:x=>{(x.key==="Enter"||x.key===" "||x.key==="Escape")&&(x.preventDefault(),I(!1))}})]})]})})})}),he=(0,a.forwardRef)((t,o)=>{const{data:i,onNavItemClick:c,className:u,theme:P,onPrimaryNavClick:m,groupCategories:l}=t,{event:p,profile:f}=(0,K.useNavContext)(),[b,E]=(0,a.useState)(!1),{locale:T="us"}=(0,q.useAiuiContext)(),[y,D]=(0,a.useState)(null),[F,S]=(0,a.useState)([]),H=(0,a.useRef)(null),[B,z]=(0,a.useState)(!1),G=(0,a.useRef)(null),U=(0,a.useRef)(null),k=(0,a.useRef)(null),I=(0,a.useRef)(l.map(n=>Array(n?.length||0).fill(null)));(0,a.useEffect)(()=>{l?.length&&S(l?.map((n,h)=>n?.map((N,C)=>({groupIndex:h,index:C,open:!1}))))},[l]);const g=(0,a.useMemo)(()=>{let n=null;for(const h of F){for(const N of h)if(N.open){n=N;break}if(n)break}return n},[F]);(0,ce.useScrollLock)(!!g?.open||B);const A=(n,h)=>{z(!1),c?.();const N=l?.flat()||[],C=N?.findIndex(X=>X?.id===l[n][h]?.id);m?.(N[C],C)},J=(n,h)=>{const N=l[n][h],C=N?.components?.[0];C&&C?.blockType!==r.HeaderNavigationBlockType.Links&&(D(N),S(Z=>Z.map(ee=>ee.map(oe=>oe.groupIndex===n&&oe.index===h?{...oe,open:!0}:{...oe,open:!1}))))},O=(n,h,N)=>{n.key==="Escape"&&g?.groupIndex===h&&g?.index===N&&(n.preventDefault(),L())},L=()=>{S(n=>n.map(h=>h.map(N=>({...N,open:!1}))))},d=()=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{L()},200)},_=()=>{k.current&&clearTimeout(k.current)},R=()=>{k.current&&clearTimeout(k.current)},ae=()=>{k.current&&clearTimeout(k.current),k.current=setTimeout(()=>{L()},200)},Q=(0,a.useMemo)(()=>{if(y)return y?.components?.[0]?.blockType},[y]),ne=(0,M.WithSidebar)(Te.SidebarDropdown,y),x=(0,M.WithResource)(Me.ResourceSidebarDropdown,y),Y=(0,M.WithMulticol)(De.MulticolDropdown,y),V=(0,M.WithSupports)(Le.SupportsDropdown,{categoriesItem:y,currentNavItemRef:I.current?.[g?.groupIndex||0]?.[g?.index||0]}),re=(0,a.useMemo)(()=>{switch(Q){case r.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(ne,{});case r.HeaderNavigationBlockType.Resource:return(0,e.jsx)(x,{});case r.HeaderNavigationBlockType.Supports:return(0,e.jsx)(V,{});case r.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(Y,{});default:return null}},[Q,y]),W=(0,a.useMemo)(()=>i?.bar?.actions?.filter(n=>n?.pcShow),[i]),j=(0,a.useMemo)(()=>W?.find(n=>n?.blockType===r.HeaderNavigationActionBlockType.Profile),[W]),$=(0,a.useCallback)(()=>{z(n=>!n)},[]);return(0,a.useEffect)(()=>{if(H?.current){const n=H.current;return n.addEventListener("click",$),()=>{n.removeEventListener("click",$)}}},[$]),(0,se.useGSAP)(()=>{g?.open&&U?.current&&te.gsap.fromTo(U?.current,{height:0},{height:"auto"})},[g?.open]),(0,e.jsxs)(s.Container,{className:(0,v.cn)("relative h-[92px]",u),children:[(0,e.jsxs)("div",{ref:G,onClick:L,className:"flex h-full flex-col justify-end gap-4",children:[(0,e.jsxs)("div",{className:"flex items-center justify-between",children:[(0,e.jsx)(Ne,{}),(0,e.jsx)(de,{ref:H,actions:W,activeStatus:B})]}),(0,e.jsx)("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",onMouseEnter:_,onMouseLeave:d,children:l?.map((n,h)=>(0,e.jsx)("div",{className:"flex gap-3",children:n?.map((N,C)=>{const X=g?.groupIndex===h&&g?.index===C,Z=ve(N);return(0,e.jsx)("div",{ref:ee=>{I.current[h][C]=ee},className:"group",onMouseEnter:()=>J(h,C),children:(0,e.jsxs)("div",{className:"relative",children:[(0,e.jsxs)("a",{href:(0,v.getLocalizedPath)(be(N),T,"ref=navMenu"),...Z?{target:Z}:{},rel:Z==="_blank"?"noopener noreferrer":void 0,className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4 no-underline",onClick:()=>A(h,C),onKeyDown:ee=>O(ee,h,C),"aria-expanded":X,"aria-haspopup":"true","aria-label":N.text,children:[(0,e.jsx)(s.Text,{html:N.text,className:"desktop:text-pretty text-nowrap text-sm font-bold leading-[1.4]"}),(0,e.jsx)(w.DownArrow,{className:(0,v.cn)("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":g?.groupIndex===h&&g?.index===C,"opacity-100":b&&g?.groupIndex===h&&g?.index===C,hidden:!fe(N)})})]}),(0,e.jsx)("div",{className:(0,v.cn)("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":X},P==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},N.id)})},`groupCategory-${h}`))})]}),(0,e.jsxs)("div",{role:"menu","aria-hidden":!(g?.open&&y),className:(0,v.cn)("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(g?.open&&y)}),style:{height:`calc(100dvh - ${G?.current?.getBoundingClientRect()?.bottom}px)`},children:[(0,e.jsx)("div",{ref:U,className:(0,v.cn)("relative z-50",{"overflow-hidden":Q!==r.HeaderNavigationBlockType.Supports}),onMouseEnter:()=>{R(),E(!0)},onMouseLeave:()=>{ae(),E(!1)},children:re}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:L,onMouseEnter:L,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:n=>{(n.key==="Enter"||n.key===" "||n.key==="Escape")&&(n.preventDefault(),L())}})]}),B&&(0,e.jsxs)("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",role:"dialog","aria-modal":"true","aria-label":"User profile menu",children:[(0,e.jsx)("div",{className:"rounded-box absolute w-[272px] overflow-hidden bg-white p-4",style:{right:`calc(100% - ${H?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:f?.email?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(s.Text,{html:f?.nick_name||j?.welcome,className:"text-sm font-bold"}),(0,e.jsx)("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),(0,e.jsx)("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:j?.profiles?.map(n=>(0,e.jsx)(ue.MenuItem,{className:"py-2",label:n?.title,href:(0,v.getLocalizedPath)(n?.url,T,"ref=navMenu")},n.id))})]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(w.Polygon,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),(0,e.jsx)(s.Text,{html:j?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:j?.benefits?.map(n=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(s.Picture,{source:n.benefitIcon?.url,className:"size-4 shrink-0",alt:n.benefit,width:16,height:16}),(0,e.jsx)(s.Text,{html:n.benefit,className:"text-sm font-bold leading-[1.4]"})]},n.id))}),(0,e.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(0,e.jsx)(s.Button,{className:"grow",variant:"secondary",size:"lg",onClick:()=>p?.join?.(),children:(0,e.jsx)(s.Text,{html:j?.primaryButton||"Join Now",className:"font-bold"})}),(0,e.jsx)(s.Button,{className:"grow",variant:"primary",size:"lg",onClick:()=>p?.login?.(),children:(0,e.jsx)(s.Text,{html:j?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),(0,e.jsx)("div",{className:"flex-1 bg-transparent",onClick:()=>z(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:n=>{(n.key==="Enter"||n.key===" "||n.key==="Escape")&&(n.preventDefault(),z(!1))}})]})]})}),ye=(0,a.forwardRef)(({data:t,menuData:o,className:i,onPrimaryNavClick:c,onMobileMenuToggle:u},P)=>{const m=(0,a.useMemo)(()=>(0,M.WithGroupCategory)(t?.categories?.filter(d=>d?.mobileShow)),[t]),{currentMenu:l,setCurrentMenu:p,subSubCategory:f}=(0,K.useNavContext)(),[b,E]=(0,a.useState)(!1),[T,y]=(0,a.useState)(0),[D,F]=(0,a.useState)(null),S=(0,a.useRef)(null),H=(0,a.useRef)(!1);(0,a.useEffect)(()=>{if(S?.current&&b){const d=S?.current?.getBoundingClientRect();y(window?.innerHeight-(d?.top||0))}u?.({open:b})},[b,u]),(0,a.useEffect)(()=>{if(!b)return;const d=(0,me.default)(()=>{if(S?.current){const _=S.current.getBoundingClientRect();H.current=!0,y(window?.innerHeight-(_?.top||0))}},100);return window.addEventListener("resize",d),()=>window.removeEventListener("resize",d)},[b]),(0,se.useGSAP)(()=>{if(S.current){if(H.current){te.gsap.set(S.current,{height:T}),H.current=!1;return}te.gsap.fromTo(S.current,{height:0},{height:T,duration:.3})}},[T]),(0,ce.useScrollLock)(b);const B=(0,a.useMemo)(()=>D?.components?.[0]?.blockType,[D]),z=(0,M.WithSupports)(Ee.MobileSupportMenu,{categoriesItem:D}),G=(0,M.WithSidebar)(Pe.MobileSidebarMenu,D),U=(0,M.WithResource)(Se.MobileResourceSidebarMenu,D),k=(0,M.WithMulticol)(He.MobileMulticolMenu,D),I=(0,a.useMemo)(()=>{switch(B){case r.HeaderNavigationBlockType.Sidebar:return(0,e.jsx)(G,{});case r.HeaderNavigationBlockType.Resource:return(0,e.jsx)(U,{});case r.HeaderNavigationBlockType.Supports:return(0,e.jsx)(z,{});case r.HeaderNavigationBlockType.Multicol:return(0,e.jsx)(k,{});default:return null}},[B,D,z]),g=(0,a.useCallback)(()=>{E(!1),y(0),p&&p(r.HeaderNavigationMenu.Primary)},[E,y,p]),A=(0,a.useMemo)(()=>t?.bar?.actions?.filter(d=>d?.mobileShow&&d?.blockType!==r.HeaderNavigationActionBlockType.Profile),[t]),J=(0,a.useMemo)(()=>t?.bar?.actions?.find(d=>d?.mobileShow&&d?.blockType===r.HeaderNavigationActionBlockType.Profile)||{},[t]),O=(0,a.useMemo)(()=>{switch(l){case r.HeaderNavigationMenu.Primary:return(0,e.jsx)(We,{actions:A,menuOpen:b,onMenuOpenClose:()=>{E(!1),y(0)},onMenuOpenClick:()=>E(!0)});case r.HeaderNavigationMenu.Secondary:return(0,e.jsx)(ke,{title:D?.text,onMenuOpenClose:g,onMenuBackClick:()=>p?.(r.HeaderNavigationMenu.Primary)});case r.HeaderNavigationMenu.Third:return(0,e.jsx)(ke,{title:f?.label,onMenuOpenClose:g,onMenuBackClick:()=>p?.(r.HeaderNavigationMenu.Secondary)});default:return null}},[b,l,p,D,A,f,g]),L=(0,a.useCallback)((d,_)=>{const R=Array.isArray(m)?Array.isArray(m[d])?m[d][_]:{}:{};R?.components?.[0]?.blockType!==r.HeaderNavigationBlockType.Links&&(F(R),p?.(r.HeaderNavigationMenu.Secondary))},[m,p]);return(0,e.jsxs)(s.Container,{className:(0,v.cn)("relative h-[56px]",i),children:[O,b&&(0,e.jsxs)("nav",{ref:S,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:T},role:"navigation","aria-label":"Mobile navigation menu",children:[l===r.HeaderNavigationMenu.Primary&&o?(0,e.jsx)("div",{className:"pt-4",children:(0,e.jsx)(s.BrandStrip,{data:o})}):null,l===r.HeaderNavigationMenu.Primary?(0,e.jsx)(Ke,{categories:m,onPrimaryMenuClick:L,onPrimaryNavClick:c,profileAction:J,menuData:o}):I]})]})}),Ke=({categories:t,onPrimaryMenuClick:o,profileAction:i,onPrimaryNavClick:c,menuData:u})=>{const{locale:P="us"}=(0,q.useAiuiContext)();return(0,e.jsxs)("div",{className:"flex h-full flex-col justify-between",children:[(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:t?.map((m,l)=>(0,e.jsxs)("div",{className:"",children:[l>0||u?(0,e.jsx)("div",{className:(0,v.cn)("my-2 h-px w-full bg-[#E5E5E7]")}):null,m?.map((p,f)=>{const b=p.components?.[0]?.blockType===r.HeaderNavigationBlockType.Links;return(0,e.jsx)(ue.MenuItem,{label:p.text,href:b?(0,v.getLocalizedPath)(be(p),P,"ref=navMenu"):void 0,target:b?ve(p):void 0,onClick:()=>{const T=(t?.flat()||[])?.findIndex(y=>y?.id===t[l][f]?.id);o(l,f),c?.(p,T)},icon:p.components?.[0]?.icon},p.id)})]},`groupCategory-${l}`))}),(0,e.jsx)(Ue,{profileAction:i})]})},Ue=({profileAction:t})=>{const[o,i]=(0,a.useState)(!1),{profile:c,event:u}=(0,K.useNavContext)(),{locale:P="us"}=(0,q.useAiuiContext)();return(0,e.jsxs)("div",{className:(0,v.cn)("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":o}),children:[(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>i(!o),"aria-expanded":o,"aria-label":c?.nick_name||t?.welcome,children:[(0,e.jsxs)("div",{className:"flex items-center gap-[14px]",children:[(0,e.jsx)("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:(0,e.jsx)(w.User,{"aria-hidden":"true"})}),(0,e.jsx)(s.Text,{html:c?.nick_name||t?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!c?.email&&(0,e.jsx)(w.DownArrow,{"aria-hidden":"true",className:(0,v.cn)("laptop:size-4 size-5",{"rotate-180":o})})]}),c?.email&&(0,e.jsx)("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:t?.profiles?.map(m=>(0,e.jsx)(ue.MenuItem,{label:m?.title,href:(0,v.getLocalizedPath)(m?.url,P,"ref=navMenu")},m.id))}),o&&!c?.email&&(0,e.jsxs)("div",{className:"mt-4",children:[(0,e.jsx)(s.Text,{html:t?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"mt-2 flex flex-col gap-1",children:t?.benefits?.map(m=>(0,e.jsxs)("div",{className:"flex items-center gap-[6px]",children:[(0,e.jsx)(s.Picture,{source:m.benefitIcon?.url,className:"size-4",alt:m.benefit,width:16,height:16}),(0,e.jsx)(s.Text,{html:m.benefit,className:"text-sm font-bold leading-[1.4]"})]},m.id))})]}),!c?.email&&(0,e.jsxs)("div",{className:"mt-4 flex items-center gap-3",children:[(0,e.jsx)(s.Button,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>u?.join?.(),children:(0,e.jsx)(s.Text,{html:t?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),(0,e.jsx)(s.Button,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>u?.login?.(),children:(0,e.jsx)(s.Text,{html:t?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},We=({menuOpen:t,onMenuOpenClose:o,onMenuOpenClick:i,actions:c})=>(0,e.jsxs)("div",{className:"flex h-full items-center justify-between gap-4",children:[(0,e.jsx)(Ne,{}),(0,e.jsxs)("div",{className:"desktop:gap-6 flex items-center gap-4",children:[(0,e.jsx)(de,{actions:c}),t?(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>o(),"aria-label":"Close menu","aria-expanded":"true",children:(0,e.jsx)(w.Close,{className:"size-5","aria-hidden":"true"})}):(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:(0,e.jsx)(w.Menu,{className:"size-5","aria-hidden":"true"})})]})]}),Ne=()=>{const{payloadData:t,isMobile:o}=(0,K.useNavContext)(),{locale:i="us"}=(0,q.useAiuiContext)();return(0,e.jsx)("a",{href:(0,v.getLocalizedPath)("/",i,"ref=logo"),className:"hover:text-[#00CBEB] [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:o?t?.bar?.mobileLogo:t?.bar?.desktopLogo}})},de=(0,a.forwardRef)(({actions:t,activeStatus:o=!1},i)=>{const{event:c,cartCount:u}=(0,K.useNavContext)(),[P,m]=(0,a.useState)(null),l=f=>{switch(f){case r.HeaderNavigationActionBlockType.Search:return"Search";case r.HeaderNavigationActionBlockType.Cart:return`Shopping cart${u>0?` (${u} items)`:""}`;case r.HeaderNavigationActionBlockType.Profile:return"User profile";case r.HeaderNavigationActionBlockType.Livestream:return"Livestream";default:return"Action"}},p=(0,a.useCallback)((f,b)=>{switch(m(b),f?.blockType){case r.HeaderNavigationActionBlockType.Search:c?.search?.();break;case r.HeaderNavigationActionBlockType.Cart:c?.cart?.();break;case r.HeaderNavigationActionBlockType.Profile:c?.profile?.();break;case r.HeaderNavigationActionBlockType.Livestream:c?.livestream?.();break;default:return()=>{}}},[c]);return(0,e.jsx)("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(t)&&t?.map((f,b)=>(0,e.jsxs)("button",{className:"relative cursor-pointer border-0 bg-transparent p-0","data-tag":f?.tag||"",ref:f.blockType===r.HeaderNavigationActionBlockType.Profile?i:null,onClick:()=>p(f,b),"aria-label":l(f.blockType),"aria-pressed":o&&P===b,children:[(0,e.jsx)(s.Text,{html:f.icon,className:(0,v.cn)("size-5",{"text-brand-0":o&&P===b}),"aria-hidden":"true"}),f.blockType===r.HeaderNavigationActionBlockType.Cart&&u>0&&(0,e.jsx)("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]","aria-hidden":"true",children:(0,e.jsx)(s.Text,{html:u?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},f.id))})}),ke=({title:t,onMenuOpenClose:o,onMenuBackClick:i})=>(0,e.jsxs)("div",{className:"flex h-full items-center gap-3",children:[(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Back to previous menu",children:(0,e.jsx)(w.LeftArrow,{className:"size-5","aria-hidden":"true"})}),(0,e.jsx)(s.Text,{html:t,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),(0,e.jsx)("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>o(),"aria-label":"Close menu",children:(0,e.jsx)(w.Close,{className:"size-5","aria-hidden":"true"})})]});ye.displayName="MobileNavigation",de.displayName="Actions",ge.displayName="HeaderNavigation",he.displayName="DesktopNavigation";var Fe=(0,xe.withLayout)(ge);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var u=(e,i)=>{for(var t in i)a(e,t,{get:i[t],enumerable:!0})},l=(e,i,t,o)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of m(i))!g.call(e,n)&&n!==t&&a(e,n,{get:()=>i[n],enumerable:!(o=p(i,n))||o.enumerable});return e};var v=e=>l(a({},"__esModule",{value:!0}),e);var b={};u(b,{HeaderNavigationActionBlockType:()=>d,HeaderNavigationBlockType:()=>c,HeaderNavigationMenu:()=>s});module.exports=v(b);var s=(o=>(o.Primary="primary",o.Secondary="secondary",o.Third="third",o))(s||{}),c=(r=>(r.Sidebar="ipc-navigation-sidebar",r.Supports="ipc-navigation-supports",r.Multicol="ipc-navigation-multicol",r.Links="ipc-navigation-links",r.Resource="ipc-navigation-resource",r))(c||{}),d=(n=>(n.Search="ipc-navigation-action-search",n.Cart="ipc-navigation-action-cart",n.Profile="ipc-navigation-action-profile",n.Livestream="ipc-navigation-action-livestream",n))(d||{});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 导航内容驱动双向折叠判断 Hook
|
|
3
|
+
*
|
|
4
|
+
* 断点模型(三区间):
|
|
5
|
+
* - viewport < 1025px :固定移动端形态(汉堡菜单 + 抽屉)
|
|
6
|
+
* - viewport >= 1440px :固定桌面形态(完整展开)
|
|
7
|
+
* - 1025–1440px :内容驱动双向切换
|
|
8
|
+
*
|
|
9
|
+
* 通过测量隐藏测量层(始终渲染、visibility:hidden),判断三条件:
|
|
10
|
+
* 1. 导航组之间最小间距 < minGap (默认 16px)
|
|
11
|
+
* 2. 任一导航项文字被截断
|
|
12
|
+
* 3. 导航区总宽度溢出容器
|
|
13
|
+
*
|
|
14
|
+
* 双向对称滞回(避免临界宽度反复横跳/闪烁):
|
|
15
|
+
* - pc → 移动:三条件任一命中即折叠(间距阈值 = minGap)
|
|
16
|
+
* - 移动 → pc:三条件全部以宽松阈值解除(间距 >= minGap + buffer、无截断、无溢出)
|
|
17
|
+
* 折叠点(16) 与恢复点(16+buffer) 之间形成 buffer 宽度的滞回死区。
|
|
18
|
+
*
|
|
19
|
+
* SSR:首帧统一 false(桌面),测量逻辑全部放在 useLayoutEffect 中执行,
|
|
20
|
+
* 服务端与客户端首次渲染一致,避免 hydration mismatch;useLayoutEffect 在绘制前同步执行,
|
|
21
|
+
* 保证小屏首帧直接折叠、不闪现桌面导航。
|
|
22
|
+
*
|
|
23
|
+
* @param containerRef 测量层容器 ref(包含 [data-nav-item] / [data-nav-item-label])
|
|
24
|
+
* @param options { minGap: 最小间距阈值, buffer: 滞回缓冲带像素 }
|
|
25
|
+
* @returns shouldCollapse 是否应折叠为移动端形态
|
|
26
|
+
*/
|
|
27
|
+
export declare function useNavCollapse(containerRef: React.RefObject<HTMLElement | null>, { minGap, buffer }?: {
|
|
28
|
+
minGap?: number;
|
|
29
|
+
buffer?: number;
|
|
30
|
+
}): boolean;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";var m=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var r in e)m(t,r,{get:e[r],enumerable:!0})},E=(t,e,r,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of C(e))!W.call(t,n)&&n!==r&&m(t,n,{get:()=>e[n],enumerable:!(c=R(e,n))||c.enumerable});return t};var L=t=>E(m({},"__esModule",{value:!0}),t);var x={};A(x,{useNavCollapse:()=>S});module.exports=L(x);var s=require("react");function S(t,{minGap:e=16,buffer:r=20}={}){const[c,n]=(0,s.useState)(!1),a=(0,s.useRef)(!1);return(0,s.useLayoutEffect)(()=>{const o=t.current;if(!o)return;const b=()=>{const p=window.innerWidth;if(p<1025){a.current=!0,n(!0);return}if(p>=1440){a.current=!1,n(!1);return}const g=o.scrollWidth>o.clientWidth+1;let f=!1;const w=Array.from(o.querySelectorAll("[data-nav-item-label]"));for(const l of w)if(l.scrollWidth>l.clientWidth+1){f=!0;break}let i=1/0;const d=Array.from(o.querySelectorAll("[data-nav-item]"));for(let l=0;l<d.length-1;l++){const y=d[l].getBoundingClientRect(),v=d[l+1].getBoundingClientRect().left-y.right;v<i&&(i=v)}let u;a.current?u=!(i>=e+r&&!f&&!g):u=i<e||f||g,a.current=u,n(u)};b();const h=new ResizeObserver(()=>b());return h.observe(o),()=>{h.disconnect()}},[t,e,r]),c}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var r=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var s=(t,e)=>{for(var i in e)r(t,i,{get:e[i],enumerable:!0})},g=(t,e,i,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let d of u(e))!c.call(t,d)&&d!==i&&r(t,d,{get:()=>e[d],enumerable:!(n=f(e,d))||n.enumerable});return t};var h=t=>g(r({},"__esModule",{value:!0}),t);var a={};s(a,{default:()=>p,useScrollLock:()=>l});module.exports=h(a);var o=require("react");function l(t){const e=(0,o.useRef)(void 0),i=(0,o.useRef)(void 0);(0,o.useEffect)(()=>{const n=document.documentElement;if(typeof e.current>"u"&&(e.current=n.style.overflow,i.current=n.style.paddingRight),t){const d=Math.max(0,window.innerWidth-n.clientWidth);n.style.paddingRight=`${d}px`,n.style.overflow="hidden"}else n.style.overflow=e.current??"",n.style.paddingRight=i.current??""},[t])}var p=l;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var p=Object.create;var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var h=(a,e)=>{for(var
|
|
1
|
+
"use strict";var p=Object.create;var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,w=Object.prototype.hasOwnProperty;var h=(a,e)=>{for(var t in e)d(a,t,{get:e[t],enumerable:!0})},l=(a,e,t,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of M(e))!w.call(a,n)&&n!==t&&d(a,n,{get:()=>e[n],enumerable:!(u=y(e,n))||u.enumerable});return a};var P=(a,e,t)=>(t=a!=null?p(f(a)):{},l(e||!a||!a.__esModule?d(t,"default",{value:a,enumerable:!0}):t,a)),N=a=>l(d({},"__esModule",{value:!0}),a);var g={};h(g,{WithGroupCategory:()=>D,WithMulticol:()=>S,WithResource:()=>b,WithSidebar:()=>R,WithSupports:()=>m});module.exports=N(g);var c=require("react/jsx-runtime"),s=P(require("react"));function R(a,e){const t=(0,s.useMemo)(()=>{let r=null;try{r=JSON.parse(e?.components?.[0]?.sidebar?.categoriesMetadata||"{}")}catch(o){console.log("categoriesMetadata Parse error",o)}return r},[e]),u=(0,s.useMemo)(()=>{let r=null;try{r=JSON.parse(e?.components?.[0]?.sidebar?.seriesMetadata||"[]")}catch(o){console.log("seriesMetadata Parse error",o)}return r},[e]),n=s.default.forwardRef((r,o)=>(0,c.jsx)(a,{...r,ref:o,seriesMetadata:u,sidebarCategoriesMetadata:t,navigationTitle:e?.text}));return n.displayName=a.displayName||a.name||"WithSidebarDropdown",n}function m(a,{categoriesItem:e,currentNavItemRef:t}){const u=(0,s.useMemo)(()=>e?.components?.[0]?.supports,[e]),n=s.default.forwardRef((r,o)=>(0,c.jsx)(a,{...r,supportsMetadata:u,currentNavItemRef:t,ref:o}));return n.displayName=a.displayName||a.name||"WithSupportsDropdown",n}function S(a,e){const t=e?.components?.[0]?.showStatsBanner,u=e?.components?.[0]?.statsBanner?.[0],n=(0,s.useMemo)(()=>{try{return JSON.parse(e?.components?.[0]?.multicol?.multicolMetadata||"{}")}catch(o){console.log("multicolMetadata Parse error",o)}return null},[e]),r=s.default.forwardRef((o,i)=>(0,c.jsx)(a,{...o,ref:i,multicolMetadata:n,showStatsBanner:t,statsBannerData:u}));return r.displayName=a.displayName||a.name||"WithMulticolDropdown",r}function b(a,e){const t=(0,s.useMemo)(()=>{let r=null;try{r=JSON.parse(e?.components?.[0]?.resource?.categoriesMetadata||"{}")}catch(o){console.log("resourceCategoriesMetadata Parse error",o)}return r},[e]),u=(0,s.useMemo)(()=>{let r=null;try{r=JSON.parse(e?.components?.[0]?.resource?.resourceMetadata||"[]")}catch(o){console.log("resourcesMetadata Parse error",o)}return r},[e]),n=s.default.forwardRef((r,o)=>(0,c.jsx)(a,{...r,ref:o,resourcesMetadata:u,resourceCategoriesMetadata:t}));return n.displayName=a.displayName||a.name||"WithResourceDropdown",n}function D(a){return a?Object.values(a?.reduce((e,t)=>(e[t.group]||(e[t.group]=[]),e[t.group].push(t),e),{})):[[]]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var d=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var L=(e,n)=>{for(var r in n)d(e,r,{get:n[r],enumerable:!0})},I=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of b(n))!E.call(e,i)&&i!==r&&d(e,i,{get:()=>n[i],enumerable:!(t=S(n,i))||t.enumerable});return e};var P=e=>I(d({},"__esModule",{value:!0}),e);var A={};L(A,{formatPrice:()=>p,formatVariantPrice:()=>M,getFirstAvailableVariant:()=>C,getVariantBySku:()=>O,getVariantFromSelectedOptions:()=>F,languageMap:()=>f,languageTerritory:()=>m,optionsConstructor:()=>v});module.exports=P(A);var l=require("../const.js");function v(e){return e.reduce((n,r)=>(n[r.name]=r.values[0].label,n),{})}const C=e=>e.variants.find(n=>n.availableForSale)||e.variants[0],O=(e,n)=>e.variants.find(r=>r.sku===n),f={us:"en-US",uk:"en-GB",ca:"en-CA",au:"AU","eu-en":"en","eu-fr":"fr-FR",fr:"FR","ca-fr":"FR","nl-fr":"FR",my:"MY",it:"IT",vn:"VN",es:"es-ES","eu-it":"it-IT","eu-de":"de-DE",de:"de-DE","eu-es":"es-ES","cz-en":"en-CZ",nl:"nl-NL","dk-en":"en-DK","gr-en":"en-GR","mk-en":"en-MK","hu-en":"en-HU","se-en":"en-SE","hr-en":"en-HR","bg-en":"en-BG","ee-en":"en-EE","fi-en":"en-FI","lt-en":"en-LT",pl:"pl-PL","ro-en":"en-RO","si-en":"en-SI","sk-en":"en-SK","no-en":"en-NO","ad-en":"en-AD","al-en":"en-AL","ba-en":"en-BA","me-en":"en-ME","rs-en":"en-RS","gl-en":"en-GL","is-en":"en-IS","ua-en":"en-UA","by-en":"en-BY","md-en":"en-MD","lv-en":"en-LV","at-de":"de-AT","lu-de":"de-LU","li-de":"de-LI","va-it":"it-VA","sm-it":"it-SM","be-nl":"nl-BE","ae-en":"en-AE",nz:"en-NZ","sg-en":"en-SG","sa-en":"en-SA","vn-vi":"vi-VN",ie:"en-IE",tw:"zh-TW"},m=e=>(f[e]||console.warn(`[formatPrice] Unknown locale "${e}", falling back to en-US`),f[e]||"en-US");function p({amount:e,currencyCode:n,locale:r,maximumFractionDigits:t,minimumFractionDigits:i,removeTrailingZeros:o=!1}){const s=n?.trim()||"USD",c=m(r);let u;try{u=new Intl.NumberFormat(c,{style:"currency",currency:s,minimumFractionDigits:t===0?0:i,maximumFractionDigits:t})}catch{u=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:t===0?0:i,maximumFractionDigits:t})}let a=u.format(e);return["de-DE","fr-FR","it-IT","es-ES","de-AT","de-LU","de-LI","
|
|
1
|
+
"use strict";var d=Object.defineProperty;var S=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var E=Object.prototype.hasOwnProperty;var L=(e,n)=>{for(var r in n)d(e,r,{get:n[r],enumerable:!0})},I=(e,n,r,t)=>{if(n&&typeof n=="object"||typeof n=="function")for(let i of b(n))!E.call(e,i)&&i!==r&&d(e,i,{get:()=>n[i],enumerable:!(t=S(n,i))||t.enumerable});return e};var P=e=>I(d({},"__esModule",{value:!0}),e);var A={};L(A,{formatPrice:()=>p,formatVariantPrice:()=>M,getFirstAvailableVariant:()=>C,getVariantBySku:()=>O,getVariantFromSelectedOptions:()=>F,languageMap:()=>f,languageTerritory:()=>m,optionsConstructor:()=>v});module.exports=P(A);var l=require("../const.js");function v(e){return e.reduce((n,r)=>(n[r.name]=r.values[0].label,n),{})}const C=e=>e.variants.find(n=>n.availableForSale)||e.variants[0],O=(e,n)=>e.variants.find(r=>r.sku===n),f={us:"en-US",uk:"en-GB",ca:"en-CA",au:"AU","eu-en":"en","eu-fr":"fr-FR",fr:"FR","ca-fr":"FR","nl-fr":"FR",my:"MY",it:"IT",vn:"VN",es:"es-ES","eu-it":"it-IT","eu-de":"de-DE",de:"de-DE","eu-es":"es-ES","cz-en":"en-CZ",nl:"nl-NL","dk-en":"en-DK","gr-en":"en-GR","mk-en":"en-MK","hu-en":"en-HU","se-en":"en-SE","hr-en":"en-HR","bg-en":"en-BG","ee-en":"en-EE","fi-en":"en-FI","lt-en":"en-LT",pl:"pl-PL","ro-en":"en-RO","si-en":"en-SI","sk-en":"en-SK","no-en":"en-NO","ad-en":"en-AD","al-en":"en-AL","ba-en":"en-BA","me-en":"en-ME","rs-en":"en-RS","gl-en":"en-GL","is-en":"en-IS","ua-en":"en-UA","by-en":"en-BY","md-en":"en-MD","lv-en":"en-LV","at-de":"de-AT","lu-de":"de-LU","li-de":"de-LI","va-it":"it-VA","sm-it":"it-SM","be-nl":"nl-BE","ae-en":"en-AE",nz:"en-NZ","sg-en":"en-SG","sa-en":"en-SA","vn-vi":"vi-VN",ie:"en-IE",tw:"zh-TW",be:"nl-BE"},m=e=>(f[e]||console.warn(`[formatPrice] Unknown locale "${e}", falling back to en-US`),f[e]||"en-US");function p({amount:e,currencyCode:n,locale:r,maximumFractionDigits:t,minimumFractionDigits:i,removeTrailingZeros:o=!1}){const s=n?.trim()||"USD",c=m(r);let u;try{u=new Intl.NumberFormat(c,{style:"currency",currency:s,minimumFractionDigits:t===0?0:i,maximumFractionDigits:t})}catch{u=new Intl.NumberFormat("en-US",{style:"currency",currency:"USD",minimumFractionDigits:t===0?0:i,maximumFractionDigits:t})}let a=u.format(e);return["de-DE","fr-FR","it-IT","es-ES","de-AT","de-LU","de-LI","pl-PL","vi-VN"].includes(c)&&(a=a?.toString()?.replace(/[\s\u00A0\u202F]/g,"")),o&&(a=a.replace(/(\.\d*?[1-9])0+\b/,"$1").replace(/\.0+\b/,"").replace(/(\,\d*?[1-9])0+\b/,"$1").replace(/\,0+\b/,"")),a}function M({amount:e,baseAmount:n,currencyCode:r,locale:t,maximumFractionDigits:i,minimumFractionDigits:o,removeTrailingZeros:s}){if(typeof Intl>"u")return{price:`${l.PRICE_SYMBOL[t]}${e}`,basePrice:`${l.PRICE_SYMBOL[t]}${n}`,discount:`${l.PRICE_SYMBOL[t]}${n-e||0}`};const c=n>e,u=new Intl.NumberFormat(m(t),{style:"percent"}),a=c?u.format((n-e)/n):null,y=p({amount:e,currencyCode:r,locale:t,removeTrailingZeros:s}),g=c?p({amount:n,currencyCode:r,locale:t,maximumFractionDigits:i,minimumFractionDigits:o,removeTrailingZeros:s}):void 0;return{price:y,basePrice:g,discount:a}}function F({product:e,selectedOptions:n}){return e.variants.find(r=>Object.entries(n).every(([t,i])=>r.options.find(o=>{if(o.__typename==="MultipleChoiceOption"&&o.name===t)return o.values.find(s=>s.label===i)})))}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var B=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var F=(t,l)=>{for(var i in l)B(t,i,{get:l[i],enumerable:!0})},U=(t,l,i,d)=>{if(l&&typeof l=="object"||typeof l=="function")for(let p of K(l))!W.call(t,p)&&p!==i&&B(t,p,{get:()=>l[p],enumerable:!(d=G(l,p))||d.enumerable});return t};var H=t=>U(B({},"__esModule",{value:!0}),t);var Y={};F(Y,{default:()=>X});module.exports=H(Y);var e=require("react/jsx-runtime"),a=require("../../components/index.js"),j=require("../HeaderNavigation/icons/index.js"),c=require("react"),n=require("../../helpers/utils.js"),S=require("../AiuiProvider/index.js"),R=require("../ShelfDisplay/shelfDisplay.js"),b=require("./types.js"),T=require("../../helpers/utils.js");const O=({product:t,onSecondaryButton:l,onPrimaryButton:i,searchValue:d,variantData:p,shopNowLoadingProductId:k,badgeVariant:x})=>{const o=(0,c.useMemo)(()=>p||t?.variants?.[0],[t,p]),{locale:v="us",copyWriting:u,currencyCode:f}=(0,S.useAiuiContext)(),h=k===t?.id,w=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/products/${t?.handle}?variant=${(0,n.atobID)(o?.id)}?ref=search_result_${d?.toLowerCase()}`,v),[t?.handle,o?.id,d,v]),_=o?.coupons?.[0],{price:N,basePrice:r}=(0,R.formatVariantPrice)({locale:f==="CAD"?"us":v||"us",amount:_?_.variant_price4wscode:o?.price?.amount??o?.price,baseAmount:_?o?.price?.amount??o?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),C=(0,c.useMemo)(()=>t?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return(0,e.jsx)("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?(0,e.jsxs)(a.Link,{href:(0,T.getLocalizedPath)(t?.advertisingLink,v),className:"h-full",children:[(0,e.jsx)(a.Picture,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),(0,e.jsxs)("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(a.Text,{html:t?.advertisingTitle,className:(0,n.cn)("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&(0,e.jsx)(a.Heading,{size:3,html:t?.advertisingSubtitle,className:(0,n.cn)("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):(0,e.jsxs)("a",{href:w,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[(0,e.jsx)("div",{className:"ipc_search_product_item_image",children:(0,e.jsx)(a.Picture,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:o?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),(0,e.jsxs)("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:C?.map((m,L)=>(0,e.jsx)(a.Badge,{size:"lg",variant:x,children:m},L))}),(0,e.jsx)(a.Text,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:(0,n.highlightSearchWord)(t?.title||"",d||"")}),(0,e.jsx)(a.Text,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:(0,n.highlightSearchWord)(t?.description,d||"")})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"mb-2 flex items-center",children:o?.availableForSale?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:o?.availableForSale&&N||""}),(0,e.jsx)("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:o?.availableForSale&&r||""})]}):(0,e.jsx)("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:u?.soldOutText||"Sold Out"})}),(0,e.jsxs)("div",{className:(0,n.cn)("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[u?.learnMoreText&&(0,e.jsx)(a.Button,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:m=>{m.preventDefault(),m.stopPropagation(),l?.()},children:u?.learnMoreText}),u?.shopNowText&&(0,e.jsx)(a.Button,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,loading:h,onClick:m=>{m.preventDefault(),m.stopPropagation(),i?.()},children:u?.shopNowText})]})]})]})]})})},q=({blog:t,searchValue:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),p=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,d),[t,d]);return(0,e.jsx)("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:(0,e.jsxs)("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[(0,e.jsx)("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),(0,e.jsxs)("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(t?.title,l)}),(0,e.jsx)(a.Text,{html:(0,n.highlightSearchWord)(t?.content,l),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"desktop:mt-6 mt-4",children:(0,e.jsx)(a.Button,{as:"a",href:p,variant:"secondary",size:"lg",children:i?.learnMoreText||"Learn More"})})]})]})})},J=({searchValue:t,page:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),p=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/${l?.handle}`,d),[l,d]);return(0,e.jsxs)("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(l?.name,t)}),(0,e.jsx)(a.Text,{as:"p",html:(0,n.highlightSearchWord)(l?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),(0,e.jsx)(a.Button,{as:"a",href:p,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:i?.learnMoreText||"Learn More"})]})},I=({url:t,label:l})=>(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),(0,e.jsx)(a.Text,{html:l,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),D=({products:t,title:l,buildProps:i,onSecondaryButton:d,onPrimaryButton:p,badgeVariant:k})=>{const{products:x}=i||{};return console.log(x,"buildProducts"),(0,e.jsxs)("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:l}),(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((o,v)=>{const u=x?.find(h=>h.handle===o.handle);if(!u)return null;const f=u?.variants?.find(h=>h.sku===o.sku);return(0,e.jsx)(O,{product:u,variantData:f,badgeVariant:k,onSecondaryButton:()=>d?.(),onPrimaryButton:()=>p?.()},o.sku+v)})})]})},Q=({searchResult:t,searchValue:l,data:i,onSecondaryButton:d,onPrimaryButton:p,onChangeSort:k,loading:x,shopNowLoadingProductId:o,searchResultCount:v,onChangeTab:u,buildProps:f,componentOverrides:h,className:w,..._})=>{const N=h?.badge?.variant,[r,C]=(0,c.useState)(i?.tabs?.[0]),[m,L]=(0,c.useState)(!1),[z,E]=(0,c.useState)({[b.SearchPageTabType.PRODUCTS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PRODUCTS)?.sortKeys?.[0],[b.SearchPageTabType.BLOGS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.BLOGS)?.sortKeys?.[0],[b.SearchPageTabType.PAGES]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PAGES)?.sortKeys?.[0]}),P=(0,c.useMemo)(()=>t?.products||[],[t]),A=(0,c.useMemo)(()=>t?.blogs||[],[t]),M=(0,c.useMemo)(()=>t?.pages||[],[t]),$=(0,c.useMemo)(()=>Object.values(v||{}).reduce((s,g)=>s+g,0),[v]),V=(0,c.useMemo)(()=>{const s={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const y=[...P||[]];return y.length>=8?y.splice(7,0,s):y.length>0&&y.push(s),y}else return P},[r,P]);return(0,e.jsxs)("div",{..._,className:(0,n.cn)("ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",w),children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:(0,n.replaceTemplate)(i?.title,{totalCount:$?.toString(),inputValue:`"${l}"`})}),(0,e.jsx)("div",{className:"mt-6",children:(0,e.jsxs)(a.Tabs,{className:"ipc_search_page_tabs",defaultValue:"products",children:[(0,e.jsxs)("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[(0,e.jsx)(a.TabsList,{children:i?.tabs?.map(s=>(0,e.jsxs)(a.TabsTrigger,{onClick:()=>{C(s);const g=s?.sortKeys?.[0];g&&(E(y=>({...y,[s?.tabType]:g})),k?.(s?.tabType,g)),u?.(s?.tabType)},defaultValue:"products",value:s.tabType,children:[s.label," (",v?.[s.tabType],")"]},s.id))}),(0,e.jsxs)(a.DropdownMenu,{onOpenChange:L,children:[(0,e.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,e.jsxs)("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",z?.[r?.tabType]?.label," ",(0,e.jsx)(j.DownArrow,{className:(0,n.cn)("inline-block size-4",{"rotate-180":m})})]})}),(0,e.jsx)(a.DropdownMenuContent,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(s=>(0,e.jsx)(a.DropdownMenuItem,{className:(0,n.cn)("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":z?.[r?.tabType]?.value===s.value}),onClick:()=>{k?.(r?.tabType,s),E(g=>({...g,[r?.tabType]:s}))},children:s.label},s.id))})]})]}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:V?.map((s,g)=>(0,e.jsx)(O,{searchValue:l,product:s,shopNowLoadingProductId:o,badgeVariant:N,onSecondaryButton:()=>d?.(s),onPrimaryButton:()=>p?.(s)},(s.id||"")+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex w-full justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!P?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]}),(0,e.jsx)(a.TabsContent,{value:b.SearchPageTabType.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:(0,e.jsxs)("div",{children:[A?.map(s=>(0,e.jsx)(q,{blog:s,searchValue:l},s.id)),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!A?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,badgeVariant:N})]})]})}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PAGES,className:"ipc_search_page_tabs_pages_content",children:[(0,e.jsx)("div",{children:M?.map((s,g)=>(0,e.jsx)(J,{page:s,searchValue:l},(s.global_id||s.id)+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!M?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]})]})})]})};var X=Q;
|
|
1
|
+
"use strict";var B=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var F=(t,l)=>{for(var i in l)B(t,i,{get:l[i],enumerable:!0})},U=(t,l,i,d)=>{if(l&&typeof l=="object"||typeof l=="function")for(let p of K(l))!W.call(t,p)&&p!==i&&B(t,p,{get:()=>l[p],enumerable:!(d=G(l,p))||d.enumerable});return t};var H=t=>U(B({},"__esModule",{value:!0}),t);var Y={};F(Y,{default:()=>X});module.exports=H(Y);var e=require("react/jsx-runtime"),a=require("../../components/index.js"),j=require("../HeaderNavigation/icons/index.js"),c=require("react"),n=require("../../helpers/utils.js"),S=require("../AiuiProvider/index.js"),R=require("../ShelfDisplay/shelfDisplay.js"),b=require("./types.js"),T=require("../../helpers/utils.js");const O=({product:t,onSecondaryButton:l,onPrimaryButton:i,searchValue:d,variantData:p,shopNowLoadingProductId:k,badgeVariant:x})=>{const o=(0,c.useMemo)(()=>p||t?.variants?.[0],[t,p]),{locale:v="us",copyWriting:u,currencyCode:f}=(0,S.useAiuiContext)(),h=k===t?.id,w=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/products/${t?.handle}`,v,`variant=${(0,n.atobID)(o?.id)}&ref=search_result_${d?.toLowerCase()}`),[t?.handle,o?.id,d,v]),_=o?.coupons?.[0],{price:N,basePrice:r}=(0,R.formatVariantPrice)({locale:f==="CAD"?"us":v||"us",amount:_?_.variant_price4wscode:o?.price?.amount??o?.price,baseAmount:_?o?.price?.amount??o?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),C=(0,c.useMemo)(()=>t?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return(0,e.jsx)("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?(0,e.jsxs)(a.Link,{href:(0,T.getLocalizedPath)(t?.advertisingLink,v),className:"h-full",children:[(0,e.jsx)(a.Picture,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),(0,e.jsxs)("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(a.Text,{html:t?.advertisingTitle,className:(0,n.cn)("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&(0,e.jsx)(a.Heading,{size:3,html:t?.advertisingSubtitle,className:(0,n.cn)("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):(0,e.jsxs)("a",{href:w,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[(0,e.jsx)("div",{className:"ipc_search_product_item_image",children:(0,e.jsx)(a.Picture,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:o?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),(0,e.jsxs)("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:C?.map((m,L)=>(0,e.jsx)(a.Badge,{size:"lg",variant:x,children:m},L))}),(0,e.jsx)(a.Text,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:(0,n.highlightSearchWord)(t?.title||"",d||"")}),(0,e.jsx)(a.Text,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:(0,n.highlightSearchWord)(t?.description,d||"")})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"mb-2 flex items-center",children:o?.availableForSale?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:o?.availableForSale&&N||""}),(0,e.jsx)("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:o?.availableForSale&&r||""})]}):(0,e.jsx)("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:u?.soldOutText||"Sold Out"})}),(0,e.jsxs)("div",{className:(0,n.cn)("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[u?.learnMoreText&&(0,e.jsx)(a.Button,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:m=>{m.preventDefault(),m.stopPropagation(),l?.()},children:u?.learnMoreText}),u?.shopNowText&&(0,e.jsx)(a.Button,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,loading:h,onClick:m=>{m.preventDefault(),m.stopPropagation(),i?.()},children:u?.shopNowText})]})]})]})]})})},q=({blog:t,searchValue:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),p=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,d),[t,d]);return(0,e.jsx)("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:(0,e.jsxs)("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[(0,e.jsx)("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),(0,e.jsxs)("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(t?.title,l)}),(0,e.jsx)(a.Text,{html:(0,n.highlightSearchWord)(t?.content,l),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"desktop:mt-6 mt-4",children:(0,e.jsx)(a.Button,{as:"a",href:p,variant:"secondary",size:"lg",children:i?.learnMoreText||"Learn More"})})]})]})})},J=({searchValue:t,page:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),p=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/${l?.handle}`,d),[l,d]);return(0,e.jsxs)("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(l?.name,t)}),(0,e.jsx)(a.Text,{as:"p",html:(0,n.highlightSearchWord)(l?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),(0,e.jsx)(a.Button,{as:"a",href:p,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:i?.learnMoreText||"Learn More"})]})},I=({url:t,label:l})=>(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),(0,e.jsx)(a.Text,{html:l,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),D=({products:t,title:l,buildProps:i,onSecondaryButton:d,onPrimaryButton:p,badgeVariant:k})=>{const{products:x}=i||{};return console.log(x,"buildProducts"),(0,e.jsxs)("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:l}),(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((o,v)=>{const u=x?.find(h=>h.handle===o.handle);if(!u)return null;const f=u?.variants?.find(h=>h.sku===o.sku);return(0,e.jsx)(O,{product:u,variantData:f,badgeVariant:k,onSecondaryButton:()=>d?.(),onPrimaryButton:()=>p?.()},o.sku+v)})})]})},Q=({searchResult:t,searchValue:l,data:i,onSecondaryButton:d,onPrimaryButton:p,onChangeSort:k,loading:x,shopNowLoadingProductId:o,searchResultCount:v,onChangeTab:u,buildProps:f,componentOverrides:h,className:w,..._})=>{const N=h?.badge?.variant,[r,C]=(0,c.useState)(i?.tabs?.[0]),[m,L]=(0,c.useState)(!1),[z,E]=(0,c.useState)({[b.SearchPageTabType.PRODUCTS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PRODUCTS)?.sortKeys?.[0],[b.SearchPageTabType.BLOGS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.BLOGS)?.sortKeys?.[0],[b.SearchPageTabType.PAGES]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PAGES)?.sortKeys?.[0]}),P=(0,c.useMemo)(()=>t?.products||[],[t]),A=(0,c.useMemo)(()=>t?.blogs||[],[t]),M=(0,c.useMemo)(()=>t?.pages||[],[t]),$=(0,c.useMemo)(()=>Object.values(v||{}).reduce((s,g)=>s+g,0),[v]),V=(0,c.useMemo)(()=>{const s={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const y=[...P||[]];return y.length>=8?y.splice(7,0,s):y.length>0&&y.push(s),y}else return P},[r,P]);return(0,e.jsxs)("div",{..._,className:(0,n.cn)("ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",w),children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:(0,n.replaceTemplate)(i?.title,{totalCount:$?.toString(),inputValue:`"${l}"`})}),(0,e.jsx)("div",{className:"mt-6",children:(0,e.jsxs)(a.Tabs,{className:"ipc_search_page_tabs",defaultValue:"products",children:[(0,e.jsxs)("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[(0,e.jsx)(a.TabsList,{children:i?.tabs?.map(s=>(0,e.jsxs)(a.TabsTrigger,{onClick:()=>{C(s);const g=s?.sortKeys?.[0];g&&(E(y=>({...y,[s?.tabType]:g})),k?.(s?.tabType,g)),u?.(s?.tabType)},defaultValue:"products",value:s.tabType,children:[s.label," (",v?.[s.tabType],")"]},s.id))}),(0,e.jsxs)(a.DropdownMenu,{onOpenChange:L,children:[(0,e.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,e.jsxs)("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",z?.[r?.tabType]?.label," ",(0,e.jsx)(j.DownArrow,{className:(0,n.cn)("inline-block size-4",{"rotate-180":m})})]})}),(0,e.jsx)(a.DropdownMenuContent,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(s=>(0,e.jsx)(a.DropdownMenuItem,{className:(0,n.cn)("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":z?.[r?.tabType]?.value===s.value}),onClick:()=>{k?.(r?.tabType,s),E(g=>({...g,[r?.tabType]:s}))},children:s.label},s.id))})]})]}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:V?.map((s,g)=>(0,e.jsx)(O,{searchValue:l,product:s,shopNowLoadingProductId:o,badgeVariant:N,onSecondaryButton:()=>d?.(s),onPrimaryButton:()=>p?.(s)},(s.id||"")+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex w-full justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!P?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]}),(0,e.jsx)(a.TabsContent,{value:b.SearchPageTabType.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:(0,e.jsxs)("div",{children:[A?.map(s=>(0,e.jsx)(q,{blog:s,searchValue:l},s.id)),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!A?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,badgeVariant:N})]})]})}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PAGES,className:"ipc_search_page_tabs_pages_content",children:[(0,e.jsx)("div",{children:M?.map((s,g)=>(0,e.jsx)(J,{page:s,searchValue:l},(s.global_id||s.id)+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!M?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]})]})})]})};var X=Q;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
2
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
3
|
declare const badgeVariants: (props?: ({
|
|
4
|
-
size?: "lg" | "sm" | null | undefined;
|
|
4
|
+
size?: "lg" | "sm" | "xs" | null | undefined;
|
|
5
5
|
variant?: "fill" | "outline" | "promotional" | null | undefined;
|
|
6
6
|
promotionalType?: "plus-member" | "regular-member" | "regular-discount" | "time-limited-discount" | null | undefined;
|
|
7
7
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var r=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(
|
|
1
|
+
"use strict";var r=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var c=(i,e)=>{for(var l in e)r(i,l,{get:e[l],enumerable:!0})},x=(i,e,l,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of g(e))!u.call(i,o)&&o!==l&&r(i,o,{get:()=>e[o],enumerable:!(n=d(e,o))||n.enumerable});return i};var m=i=>x(r({},"__esModule",{value:!0}),i);var Z={};c(Z,{default:()=>_});module.exports=m(Z);var t=require("react/jsx-runtime"),y=require("react"),p=require("class-variance-authority"),C=require("../helpers/index.js");const f=(0,p.cva)("text-badge-outline-text outline-badge-outline-color inline-flex items-center justify-center whitespace-nowrap rounded-[16px] border-none text-xs font-bold outline outline-[1.6px] outline-offset-[-1.6px] transition-colors focus:outline-none",{variants:{size:{xs:"h-[20px] px-[4px] pb-[2px] pt-1 text-[12px] leading-normal",sm:"h-[24px] px-[6px] pb-[3px] pt-[4px] text-[14px] leading-tight",lg:"lg-desktop:px-[8px] lg-desktop:pb-[4px] lg-desktop:pt-[5px] lg-desktop:text-[16px] lg-desktop:h-[28px] h-[24px] p-[6px] pb-[3px] pt-[4px] text-[14px] leading-tight"},variant:{outline:"bg-transparent",fill:"bg-badge-fill-color bg-badge-fill-gradient text-badge-fill-text",promotional:"bg-gradient-brand text-badge-foreground relative !border-none !outline-none"},promotionalType:{"plus-member":"bg-gradient-to-r from-[#6E6754] via-[#4A453A] to-[#070708] ","regular-member":"bg-brand-0 bg-gradient-brand ","regular-discount":"bg-brand-0 bg-gradient-brand ","time-limited-discount":"bg-brand-0 bg-gradient-brand "}},compoundVariants:[{variant:"promotional",size:"sm",class:"!pl-[24px]"},{variant:"promotional",size:"lg",class:"lg-desktop:!pl-[28px] !pl-[24px]"}],defaultVariants:{size:"lg",variant:"outline"}}),h=()=>(0,t.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 32 28",fill:"none",className:"h-full w-auto",children:[(0,t.jsx)("path",{d:"M23.2222 0C24.2096 0 25.1341 0.501396 25.6903 1.34106L31.4814 10.0846C32.283 11.2948 32.1429 12.9193 31.1474 13.9659L19.0336 26.6998C17.3854 28.4319 14.6772 28.4335 13.0264 26.7039L0.855644 13.9536C-0.130438 12.9204 -0.281462 11.3186 0.492455 10.1091L6.07548 1.38199C6.6279 0.518743 7.56576 0 8.57008 0H23.2222Z",fill:"url(#paint0_linear_22508_6946)"}),(0,t.jsx)("path",{d:"M22.4084 10.2119C22.9545 9.66492 23.8409 9.66346 24.3881 10.2092C24.9351 10.7553 24.9366 11.6416 24.3908 12.1889L17.451 19.1397C16.8776 19.714 15.9474 19.7155 15.3729 19.1424L8.41114 12.1916C7.86414 11.6455 7.86268 10.7592 8.40841 10.2119C8.95451 9.66492 9.84087 9.66346 10.3881 10.2092L16.4092 16.2193L22.4084 10.2119Z",fill:"url(#paint1_linear_22508_6946)"}),(0,t.jsxs)("defs",{children:[(0,t.jsxs)("linearGradient",{id:"paint0_linear_22508_6946",x1:"2.1318",y1:"0.390243",x2:"33.6892",y2:"7.35765",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{offset:"0.0865385",stopColor:"#FFF5E0"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#E8C08A"})]}),(0,t.jsxs)("linearGradient",{id:"paint1_linear_22508_6946",x1:"7.79513",y1:"9.80078",x2:"25.937",y2:"13.8215",gradientUnits:"userSpaceOnUse",children:[(0,t.jsx)("stop",{offset:"0.9999",stopColor:"#6E6754"}),(0,t.jsx)("stop",{offset:"1",stopColor:"#050608"})]})]})]}),b=()=>(0,t.jsxs)("svg",{width:"32",height:"28",viewBox:"0 0 32 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"h-full w-auto",children:[(0,t.jsx)("path",{d:"M23.2222 0C24.2096 0 25.1341 0.501396 25.6903 1.34106L31.4814 10.0846C32.283 11.2948 32.1429 12.9193 31.1474 13.9659L19.0336 26.6998C17.3854 28.4319 14.6772 28.4335 13.0264 26.7039L0.855644 13.9536C-0.130438 12.9204 -0.281462 11.3186 0.492455 10.1091L6.07548 1.38199C6.6279 0.518743 7.56576 0 8.57008 0H23.2222Z",fill:"#B5E5F9"}),(0,t.jsx)("path",{d:"M22.4084 10.2119C22.9545 9.66492 23.8409 9.66346 24.3881 10.2092C24.9351 10.7553 24.9366 11.6416 24.3908 12.1889L17.451 19.1397C16.8776 19.714 15.9474 19.7155 15.3729 19.1424L8.41114 12.1916C7.86414 11.6455 7.86268 10.7592 8.40841 10.2119C8.95451 9.66492 9.84087 9.66346 10.3881 10.2092L16.4092 16.2193L22.4084 10.2119Z",fill:"white"})]}),L=()=>(0,t.jsxs)("svg",{width:"32",height:"28",viewBox:"0 0 32 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"h-full w-auto",children:[(0,t.jsxs)("g",{clipPath:"url(#clip0_20420_244316)",children:[(0,t.jsx)("path",{opacity:"0.4",d:"M3.90567 7.45107C4.19697 6.0806 5.21359 4.9787 6.55622 4.57818L13.8699 2.39643C15.1173 2.02431 16.4683 2.31148 17.4565 3.15879L23.2505 8.12665C24.3141 9.03864 24.7946 10.4588 24.5033 11.8292L21.3938 26.4587C20.9541 28.527 18.921 29.8474 16.8527 29.4077L3.74508 26.6216C1.67675 26.182 0.356442 24.1489 0.796078 22.0805L3.90567 7.45107Z",fill:"#B5E5F9"}),(0,t.jsx)("path",{d:"M5 7.9615C5 6.50843 5.78799 5.16965 7.05839 4.46433L14.0584 0.57797C15.266 -0.0924777 16.734 -0.0924768 17.9416 0.577971L24.9416 4.46434C26.212 5.16966 27 6.50844 27 7.9615V24C27 26.2091 25.2091 28 23 28H9C6.79086 28 5 26.2091 5 24V7.9615Z",fill:"#B5E5F9"}),(0,t.jsx)("path",{d:"M20.3094 17.6141C21.0396 17.6143 21.7533 17.8311 22.3603 18.2371C22.9672 18.6431 23.4402 19.22 23.7194 19.8949C23.9986 20.5698 24.0715 21.3124 23.9288 22.0287C23.7861 22.745 23.4343 23.4029 22.9178 23.9192C22.4013 24.4355 21.7434 24.787 21.0272 24.9293C20.311 25.0715 19.5687 24.9982 18.8942 24.7184C18.2197 24.4387 17.6433 23.9652 17.2378 23.3577C16.8324 22.7503 16.6161 22.0362 16.6163 21.3058C16.6163 19.2667 18.2697 17.6141 20.3094 17.6141ZM10.8221 20.5232L19.527 11.8217C19.7491 11.6041 20.0454 11.4786 20.3562 11.4704C20.667 11.4622 20.9695 11.5719 21.2028 11.7776C21.4361 11.9832 21.583 12.2695 21.6139 12.579C21.6449 12.8885 21.5577 13.1983 21.3698 13.4461L21.2677 13.5618L12.5628 22.2632C12.3407 22.4808 12.0444 22.6064 11.7336 22.6145C11.4228 22.6227 11.1203 22.513 10.887 22.3074C10.6537 22.1017 10.5068 21.8154 10.4759 21.5059C10.4449 21.1964 10.5321 20.8867 10.72 20.6388L10.8221 20.5232ZM20.3094 20.0752C19.9831 20.0752 19.6702 20.2049 19.4395 20.4356C19.2088 20.6664 19.0792 20.9794 19.0792 21.3058C19.0792 21.6322 19.2088 21.9452 19.4395 22.176C19.6702 22.4067 19.9831 22.5364 20.3094 22.5364C20.6357 22.5364 20.9486 22.4067 21.1793 22.176C21.41 21.9452 21.5396 21.6322 21.5396 21.3058C21.5396 20.9794 21.41 20.6664 21.1793 20.4356C20.9486 20.2049 20.6357 20.0752 20.3094 20.0752ZM11.6931 9C12.4232 9.00024 13.1369 9.21707 13.7439 9.62306C14.3509 10.0291 14.8239 10.606 15.1031 11.2809C15.3823 11.9558 15.4552 12.6983 15.3125 13.4146C15.1698 14.131 14.818 14.7889 14.3015 15.3052C13.785 15.8215 13.1271 16.173 12.4109 16.3152C11.6947 16.4575 10.9524 16.3841 10.2779 16.1044C9.60339 15.8246 9.02696 15.3511 8.6215 14.7437C8.21604 14.1362 7.99976 13.4221 8 12.6917C8 10.6527 9.65339 9 11.6931 9ZM11.6931 11.4612C11.5315 11.4611 11.3715 11.4928 11.2222 11.5546C11.073 11.6164 10.9373 11.7069 10.823 11.8212C10.5922 12.0518 10.4624 12.3648 10.4622 12.6911C10.4621 13.0175 10.5915 13.3306 10.8221 13.5615C11.0527 13.7923 11.3656 13.9222 11.6918 13.9223C12.0181 13.9223 12.331 13.7927 12.5617 13.5619C12.7924 13.3311 12.922 13.0181 12.922 12.6917C12.922 12.3654 12.7924 12.0524 12.5617 11.8216C12.331 11.5908 12.0181 11.4612 11.6918 11.4612H11.6931Z",fill:"white"})]}),(0,t.jsx)("defs",{children:(0,t.jsx)("clipPath",{id:"clip0_20420_244316",children:(0,t.jsx)("rect",{width:"32",height:"28",fill:"white"})})})]}),w=()=>(0,t.jsxs)("svg",{width:"24",height:"28",viewBox:"0 0 24 28",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"h-full w-auto",children:[(0,t.jsx)("path",{d:"M0.112855 14.5991L6.23786 0.599179C6.3971 0.235193 6.75672 0 7.15401 0H19.4534C20.1791 0 20.6631 0.74862 20.3653 1.41036L16.5 10H22.5443C23.36 10 23.8326 10.9242 23.3549 11.5855L11.5 28.0001L9.6547 16L1.029 15.9999C0.307853 15.9999 -0.176196 15.2598 0.112855 14.5991Z",fill:"#B5E5F9"}),(0,t.jsx)("path",{d:"M0.112855 14.5991L6.23786 0.599179C6.3971 0.235193 6.75672 0 7.15401 0H19.4534C20.1791 0 20.6631 0.74862 20.3653 1.41036L16.5 10H22.5443C23.36 10 23.8326 10.9242 23.3549 11.5855L11.5 28.0001L9.6547 16L1.029 15.9999C0.307853 15.9999 -0.176196 15.2598 0.112855 14.5991Z",fill:"#B5E5F9"})]}),v={"plus-member":()=>(0,t.jsx)(h,{}),"regular-member":()=>(0,t.jsx)(b,{}),"regular-discount":()=>(0,t.jsx)(L,{}),"time-limited-discount":()=>(0,t.jsx)(w,{})};function M({className:i,size:e,variant:l="outline",promotionalType:n,...o}){const a=l==="promotional",s=a?v[n||"regular-discount"]:null;return(0,t.jsxs)("div",{className:(0,C.cn)(f({size:e,variant:l,promotionalType:a?n:void 0}),i),...o,children:[a&&s&&(0,t.jsx)("div",{className:"absolute inset-y-0 left-0 flex -translate-x-1/3 items-center",children:(0,t.jsx)(s,{})}),(0,t.jsx)("span",{className:a?"relative z-10":"",children:o.children})]})}var _=M;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var h=Object.create;var i=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var x=(e,n)=>{for(var o in n)i(e,o,{get:n[o],enumerable:!0})},m=(e,n,o,a)=>{if(n&&typeof n=="object"||typeof n=="function")for(let l of u(n))!I.call(e,l)&&l!==o&&i(e,l,{get:()=>n[l],enumerable:!(a=p(n,l))||a.enumerable});return e};var k=(e,n,o)=>(o=e!=null?h(b(e)):{},m(n||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),N=e=>m(i({},"__esModule",{value:!0}),e);var y={};x(y,{default:()=>B});module.exports=N(y);var r=require("react/jsx-runtime"),d=require("react"),s=require("../helpers/utils.js"),f=require("./container.js"),c=k(require("./link.js")),t=require("./text.js"),g=require("../biz-components/AiuiProvider/index.js");const v=({data:e,sizeClass:n})=>{const{navCollapsed:o}=(0,g.useAiuiContext)();return(0,r.jsx)("div",{className:"aiui-dark relative z-[46] box-border h-[30px]",children:(0,r.jsxs)(f.Container,{childClassName:"flex !bg-container-primary items-center justify-between",className:"h-full",children:[(0,r.jsx)("div",{className:(0,s.cn)("h-full items-center gap-3",o===void 0?"desktop:flex hidden":o?"hidden":"flex"),children:e?.leftIcon?.map?.((a,l)=>(0,r.jsxs)(d.Fragment,{children:[l>0&&(0,r.jsx)("span",{className:"bg-lines h-3 w-px","aria-hidden":"true"}),a?.link?(0,r.jsx)(c.default,{href:a?.link,variant:"secondary","aria-label":a?.label||a?.title,className:(0,s.cn)("text-sm leading-[1.4] no-underline",n),children:(0,r.jsx)(t.Text,{className:"board-left-icon","aria-hidden":"true",html:a?.logo||""})}):(0,r.jsx)(t.Text,{className:"board-left-icon",html:a?.logo||""})]},l))}),(0,r.jsx)("div",{className:"flex h-full flex-1 items-center justify-end gap-2",children:e?.rightIcon?.map?.((a,l)=>(0,r.jsx)(d.Fragment,{children:a?.link?(0,r.jsx)(c.default,{href:a?.link,variant:"secondary","aria-label":a?.label||a?.title,className:(0,s.cn)("flex items-center text-sm leading-[1.4] no-underline",n),children:(0,r.jsx)(t.Text,{className:"board-right-icon","aria-hidden":"true",html:a?.logo||""})}):(0,r.jsx)(t.Text,{className:"board-right-icon",html:a?.logo||""})},l))})]})})};var B=v;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as Te,jsx as t,jsxs as l}from"react/jsx-runtime";import*as N from"react";import{cn as a}from"../../helpers/index.js";import{Button as $,Badge as fe,Card as ye,CardContent as pe,Picture as U,Text as C,Heading as A,Progress as ve}from"../../components/index.js";import{MemberLabel as Se}from"./MemberLabel.js";import{layoutModeStyles as G}from"./styles.js";const Ce=5;function he(e,i,r,y){if(e===void 0)return!0;switch(e){case"always":return!0;case"never":return!1;case"below-quantity":return i===void 0?!0:r<=i;case"below-percentage":return i===void 0?!0:r/y*100<=i;default:return!0}}const xe=({items:e})=>e?.length?t("div",{className:"active-shelf-display-social-endorsements desktop:gap-2 laptop:flex absolute right-0 top-0 z-10 hidden flex-col items-center gap-1",children:e.slice(0,3).map((i,r)=>typeof i.icon=="string"?t("img",{src:i.icon,alt:i.label||"",loading:"lazy",className:"desktop:size-10 lg-desktop:size-12 size-8 object-contain"},r):t(C,{"aria-label":i.label,className:"desktop:size-10 lg-desktop:size-12 size-8 [&_img]:size-full [&_svg]:size-full",children:i.icon},r))}):null,H={style1:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/2_7746fc9c-d4e4-4a59-a972-fa4cb0f3f8bd.png?v=1789381635",textClass:"aiui-dark text-info-primary"},style2:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/1_e0438358-493b-40cb-9a58-89d6ee2d3751.png?v=1789381628",textClass:"aiui-dark text-info-primary"},style3:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/1_19208ba4-71ea-4580-892d-72167f1cf606.png?v=1789381639",textClass:"aiui-dark text-info-primary"}},ke=({text:e,style:i="style1",icon:r,className:y,textClassName:B,layoutMode:h="flex",renderBadge:p})=>{if(!e)return null;const g=i==="custom",n=g&&!!p,v=g&&!p&&!!r?.url,S=g?void 0:H[i],m=H.style1,c=G[h],x={style1:c.discountBadgeText,style2:c.discountBadgeTextStyle2,style3:c.discountBadgeTextStyle3},k=g?c.discountBadgeTextCenter:x[i];return l("div",{className:a("active-shelf-discount-badge","absolute left-0 top-0 z-10",c.discountBadgeSize,y),children:[n?p({text:e,layoutMode:h}):v?t(U,{source:r.url,alt:r.alt||e,className:"block size-full",imgClassName:"block size-full object-contain"}):t("img",{src:(S??m).bg,alt:e,loading:"lazy",className:"block size-full object-contain"}),!n&&t(C,{className:a("active-shelf-discount-badge-text text-center","absolute inset-0 font-bold !leading-[1.2]",k,(S??m).textClass,B),html:e})]})},z=N.forwardRef(({product:e,className:i,showTags:r=!0,stockDisplayMode:y,stockThresholdValue:B,onLearnMore:h,onShopNow:p,onAddToCart:g,classNames:n,secondaryButtonText:v,secondaryButtonFun:S,primaryButtonText:m,primaryButtonFun:c,showOriginalPrice:x,renderOriginalPrice:k,copy:b,onProductImageClick:T,tagTypeConfig:_,fill:M,outline:w,memberPriceTextColor:R,userType:P,memberImages:K,customTagsIcon:J,customTagStyle:Q,onMemberSignUp:W,onPlusMemberAddCart:X,showMemberPrice:I,layoutMode:L,renderDiscountBadge:Y},Z)=>{const[ee,te]=N.useState(!1),[ae,ie]=N.useState(!1),ne=e?.memberDiscountAmount,oe=e?.plusMemberDiscountAmount,se=e?.activityLabels??[],re=P==="guest"?"guest":"member",E=se.find(s=>s.type===re)?.label,le=P==="guest"?b?.memberActivityLabelUnLogin:b?.memberActivityLabel,ce=!!E||!!le,de=e?.discountAmount,o=G[L??"flex"],ue=N.useMemo(()=>e?.availableForSale&&e?.quantityAvailable<=0?Ce:e?.availableForSale?(e?.quantityAvailable??0)/(e?.totalInventory??1)*100:0,[e?.availableForSale,e?.quantityAvailable,e?.totalInventory]),F=async(s,d)=>{if(!s)return;const u=d==="primary"?te:ie;u(!0);try{switch(s){case"buyNow":await p?.(e);break;case"addCart":await g?.(e);break;case"learnMore":await h?.(e);break;default:break}}finally{u(!1)}},ge=e.availableForSale&&e.quantityAvailable<=0,me=(s,d)=>{const u=s===0?_?.firstTagVariant:s===1?_?.secondTagVariant:void 0,D=(u||void 0)??(d==="fill"?"fill":d!==void 0?"outline":s===0?"fill":"outline"),f=D==="fill"?{outline:M?.outlineColor,bg:M?.bgColor}:{outline:w?.outlineColor,bg:w?.bgColor},O={...f.outline?{outlineColor:f.outline}:{},...f.bg?{backgroundColor:f.bg,backgroundImage:"none"}:{}};return D==="outline"&&f.outline&&(O.color=f.outline),{variant:D,style:O}},j=!!e.custom_bg_image,be=!!e.custom_scene_image,q=s=>s?{backgroundImage:`url(${s})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"}:void 0;return l(ye,{ref:Z,className:a("hover:bg-container-secondary-0 bg-container-primary relative flex h-full cursor-pointer flex-col overflow-hidden border-none",o.cardRadius,i,n?.productCard),children:[t(ke,{text:de,style:Q,icon:J,layoutMode:L,renderBadge:Y,className:n?.discountBadge,textClassName:n?.discountBadgeText}),l(pe,{className:a(o.cardContent,"relative flex flex-1 flex-col justify-between"),children:[l("div",{className:"product-image-wrapper group/product-image laptop:pb-2 laptop:mb-4 desktop:pb-6 desktop:mb-4 relative pb-4",children:[j&&t("div",{"aria-hidden":!0,className:a("pointer-events-none absolute inset-0 z-20",o.imageOffset),style:q(e.custom_bg_image)}),be&&t("div",{"aria-hidden":!0,className:a("laptop:block laptop:group-hover/product-image:opacity-100 pointer-events-none absolute inset-0 z-20 hidden opacity-0 transition-opacity duration-300",o.imageOffset),style:q(e.custom_scene_image)}),t("div",{className:a("product-image mx-auto cursor-pointer overflow-hidden",o.image),children:t("a",{onClick:()=>T?.(e),...!T&&{href:e?.listingLink},rel:"noreferrer",className:a("block size-full",j&&"opacity-0"),children:t(U,{source:e.image,alt:e.name,className:"aspect-square size-full object-contain",imgClassName:"size-full object-contain"})})}),t(xe,{items:e?.socialEndorsements})]}),r&&t("div",{className:"desktop:mb-2 mb-1 flex h-[24px] gap-1",children:e.tags?.map((s,d)=>{if(!s.label)return null;const{variant:u,style:V}=me(d,s.variant);return t(fe,{size:"sm",variant:u,className:"active-shelf-items-tag py-0",style:V,children:s.label},d)})}),l("div",{className:"flex h-full flex-1 grow flex-col justify-between gap-4",children:[l("div",{children:[t(A,{as:"h3",size:"none",className:a("text-info-primary",o.title,n?.productTitle),children:t("a",{onClick:()=>T?.(e),...!T&&{href:e?.listingLink},rel:"noreferrer",className:"hover:text-brand-0 cursor-pointer ",children:e.custom_name||e.name})}),e?.description&&t(C,{size:"none",className:a("active-shelf-product-description text-info-primary",o.description,n?.productDescription),html:e.custom_description||e.description})]}),l("div",{children:[t("div",{className:a(n?.productPrice),children:t("div",{className:a("flex items-baseline",o.priceGap),children:e.availableForSale?l(Te,{children:[t(A,{size:"none",className:a("text-info-primary",o.price),as:"h6",children:e.price}),k?k(e,{showOriginalPrice:x}):x&&e.originalPrice&&t(A,{size:"none",className:a("text-info-tertiary line-through",o.price,n?.originalPrice),as:"h6",children:e.originalPrice})]}):t(A,{size:"none",className:a("text-info-tertiary",o.price),children:b?.outOfStockLabel??"Sold Out"})})}),I&&e?.priceLabel&&e?.availableForSale&&t("div",{className:a("min-h-[1lh]",o.priceLabel),children:t(C,{size:"none",className:a("text-brand-0",n?.productPriceLabel),style:{...R?{color:R}:{}},children:e.priceLabel})}),l("div",{className:a("mt-2 flex",o.buttonContainer,n?.buttonGroup),children:[v&&t($,{variant:"secondary",size:"lg",className:a(o.buttonItem,n?.secondaryButton),onClick:()=>F(S,"secondary"),disabled:!e.availableForSale&&S!=="learnMore",loading:ae,"data-headless-type-name":"ActiveShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${v}`,"data-headless-sku":e.sku,children:v}),m&&t($,{variant:"primary",size:"lg",className:a(o.buttonItem,n?.primaryButton),onClick:()=>F(c,"primary"),disabled:!e.availableForSale&&c!=="learnMore",loading:ee,"data-headless-type-name":"ActiveShelf#ProductCard","data-headless-title-desc-button":`${e.custom_name||e.name}#${e.description||""}#${m}`,"data-headless-sku":e.sku,children:m})]}),he(y,B,e?.quantityAvailable??0,e?.totalInventory??0)&&l("div",{className:"mt-4 flex flex-col gap-1",children:[t(ve,{value:ue,max:100,min:0,size:"base",variant:"default","aria-label":"stock progress",classNames:{root:a("bg-[var(--progress-track-bg,rgba(0,0,0,0.2))]",n?.stockTrack),progressBar:a("bg-brand-0 transition-all duration-300 ease-in-out",n?.stockBar)}}),t(C,{size:3,className:"text-info-tertiary text-[14px]",children:ge?b?.limitedStock:b?.stockDisplayText?.replace("{count}",`${e.availableForSale?e.quantityAvailable:0}`)})]})]})]})]}),I&&P&&t(Se,{userType:P,copy:b,images:K,onSignUp:W,onPlusMemberAddCart:X,hasActivity:ce,activityLabel:E,memberDiscountAmount:ne,plusMemberDiscountAmount:oe,layoutMode:L})]})});z.displayName="ActiveShelf.ProductCard";var Le=z;export{z as ProductCard,Le as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
const t={flex:{cardContent:"px-2 pb-4 pt-6 laptop:px-4 desktop:p-6",image:"size-[125px] laptop:size-[180px] lg-desktop:size-[240px]",imageOffset:"
|
|
1
|
+
const t={flex:{cardContent:"px-2 pb-4 pt-6 laptop:px-4 desktop:p-6 laptop:pt-6 desktop:pt-8 lg-desktop:pt-10",image:"size-[125px] laptop:size-[180px] lg-desktop:size-[240px]",imageOffset:"laptop:-top-6 desktop:-top-8 lg-desktop:-top-10 -left-2 -right-2 laptop:-left-4 laptop:-right-4 desktop:-left-6 desktop:-right-6",title:"text-[14px] leading-tight laptop:mb-1 laptop:text-[20px] lg-desktop:text-[24px] line-clamp-3 laptop:line-clamp-2",description:"hidden text-[14px] desktop:text-[16px] lg-desktop:text-[18px] laptop:block laptop:line-clamp-2 leading-normal",price:"text-[14px] leading-tight laptop:text-[20px] lg-desktop:text-[24px]",priceLabel:"text-[12px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px]",cardRadius:"rounded-box-small tablet:rounded-box",priceGap:"gap-[2px] laptop:gap-1",discountBadgeSize:"size-12 laptop:size-20 lg-desktop:size-24",discountBadgeText:"text-xs laptop:text-base lg-desktop:text-xl pl-2 pt-1 laptop:pl-4 laptop:pt-2",discountBadgeTextStyle2:"text-xs laptop:text-base lg-desktop:text-xl pt-2 desktop:pt-4",discountBadgeTextStyle3:"text-xs laptop:text-base lg-desktop:text-xl flex items-center pl-1 laptop:pl-2",discountBadgeTextCenter:"text-xs laptop:text-base lg-desktop:text-xl flex items-center justify-center",buttonContainer:"flex-wrap gap-2 laptop:flex-nowrap lg-desktop:gap-3",buttonItem:"w-full whitespace-nowrap laptop:w-fit laptop:min-w-0 laptop:whitespace-normal laptop:text-center",memberLabelContainer:"p-2 laptop:px-4 laptop:py-3 desktop:pl-6 desktop:py-4 desktop:pr-12 lg-desktop:pr-16",memberLabelText:"text-xs laptop:text-sm desktop:text-base lg-desktop:text-[18px]"},horizontal:{cardContent:"p-4 desktop:p-6 laptop:pt-6 desktop:pt-8 lg-desktop:pt-10",image:"size-[180px] lg-desktop:size-[240px]",imageOffset:"-top-4 -left-4 -right-4 laptop:-top-6 desktop:-top-8 lg-desktop:-top-10 desktop:-left-6 desktop:-right-6",title:"mb-1 text-[20px] leading-[120%] lg-desktop:text-[24px] line-clamp-2",description:"text-[14px] desktop:text-[16px] lg-desktop:text-[18px] line-clamp-2 leading-normal",price:"text-[20px] leading-[120%] lg-desktop:text-[24px]",priceLabel:"text-[14px] leading-[140%] desktop:text-[16px] lg-desktop:text-[18px]",cardRadius:"rounded-box",priceGap:"gap-1",discountBadgeSize:"size-20 lg-desktop:size-24",discountBadgeText:"text-base lg-desktop:text-xl pt-2 pl-4",discountBadgeTextStyle2:"text-base lg-desktop:text-xl pt-2 desktop:pt-4",discountBadgeTextStyle3:"text-base lg-desktop:text-xl flex items-center pl-1 laptop:pl-2",discountBadgeTextCenter:"text-base lg-desktop:text-xl flex items-center justify-center",buttonContainer:"gap-2 lg-desktop:gap-3",buttonItem:"w-full whitespace-nowrap tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center",memberLabelContainer:"px-4 py-3 desktop:pl-6 desktop:py-4 desktop:pr-12 lg-desktop:pr-16",memberLabelText:"text-xs laptop:text-sm desktop:text-base lg-desktop:text-[18px]"}};export{t as layoutModeStyles};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as b,jsx as s,jsxs as h}from"react/jsx-runtime";import T,{useImperativeHandle as V,useRef as C}from"react";import{Heading as k,Picture as x,Text as y,Button as z,Link as D,Container as H}from"../../components/index.js";import"../../shared/Styles.js";import{cn as a}from"../../helpers/utils.js";import{useExposure as P}from"../../hooks/useExposure.js";import{trackUrlRef as $}from"../../shared/trackUrlRef.js";import{cva as v}from"class-variance-authority";import{getLocalizedPath as A}from"../../helpers/index.js";import{useAiuiContext as w}from"../AiuiProvider/index.js";const m="image",u="activity_mechanism",M=v("line-clamp-2",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),R=v("desktop:text-[16px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] tracking-[-0.02em]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white/80"}},defaultVariants:{theme:"light"}}),L=v("mt-2 !p-0 text-[14px]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),f={default:767,tablet:1024,laptop:1439,desktop:1919,lgDesktop:9999},B=t=>{if(!t)return"";const e=[];return t.lgDesktop?.url&&e.push(`${t.lgDesktop.url}`),t.desktop?.url&&e.push(`${t.desktop.url} ${f.desktop}`),t.laptop?.url&&e.push(`${t.laptop.url} ${f.laptop}`),t.tablet?.url&&e.push(`${t.tablet.url} ${f.tablet}`),t.default?.url&&e.push(`${t.default.url} ${f.default}`),e.join(", ")},E=t=>t&&(t.default?.alt||t.tablet?.alt||t.laptop?.alt||t.desktop?.alt||t.lgDesktop?.alt)||"",S=({item:t,theme:e,classNames:l})=>{const{title:i,description:p,linkText:o,linkHref:n,backgroundImage:c}=t,r=B(c),d=E(c),{locale:g="us"}=w();return s("div",{className:a("rounded-card relative flex flex-col overflow-hidden","desktop:px-6 h-[280px] p-4","laptop:gap-4 gap-3","laptop:h-[320px] lg-desktop:[400px]",l?.card),"data-headless-type-name":`${m}#${u}`,children:n?h(D,{href:A($(n,`${m}_${u}`),g),className:"no-underline",children:[r&&s(x,{source:r,alt:d||i,className:a("absolute inset-0 size-full",l?.background),imgClassName:"size-full object-cover"}),h("div",{className:"relative z-10",children:[s(k,{as:"h3",size:3,className:a(M({theme:e}),l?.title),children:i}),s(y,{as:"p",className:a(R({theme:e}),l?.description),children:p}),o&&s(z,{variant:"link",as:"a",href:A($(n,`${m}_${u}`),g),className:a(L({theme:e}),l?.link),"data-headless-title-desc-button":`${i}#${p}#${o}`,children:o})]})]}):h(b,{children:[r&&s(x,{source:r,alt:d||i,className:a("absolute inset-0 size-full",l?.background),imgClassName:"size-full object-cover"}),h("div",{className:"relative z-10",children:[s(k,{as:"h3",size:3,className:a(M({theme:e}),l?.title),children:i}),s(y,{as:"p",className:a(R({theme:e}),l?.description),children:p})]})]})})},N=T.forwardRef(({data:t,classNames:e},l)=>{const{items:i=[],theme:p="light"}=t,o=C(null);if(V(l,()=>o.current),P(o,{componentType:m,componentName:u,componentTitle:i[0]?.title||"",componentDescription:i[0]?.description||""}),!i||i.length===0)return null;const n={1:"laptop:grid-cols-1 desktop:grid-cols-1 lg-desktop:grid-cols-1",2:"laptop:grid-cols-2 desktop:grid-cols-2 lg-desktop:grid-cols-2",3:"tablet:grid-cols-2 laptop:grid-cols-3 desktop:grid-cols-3 lg-desktop:grid-cols-3",4:"laptop:grid-cols-4 desktop:grid-cols-4 lg-desktop:grid-cols-4"},c=n[Math.min(i.length,4)]||n[4];return s(H,{"data-ui-component-id":"ActivityMechanism",className:a("activity-mechanism","w-full",e?.root),ref:o,children:s("div",{className:a("tablet:grid-cols-2 laptop:gap-4 grid grid-cols-1 gap-3",c,e?.grid),children:i.map((r,d)=>s(S,{item:r,theme:p,classNames:{...e,...i?.length===3&&{card:e?.card+" first:tablet:col-span-full first:laptop:col-span-1"}}},`${r.title}-${d}`))})})});N.displayName="ActivityMechanism";var W=N;export{W as default};
|
|
1
|
+
"use client";import{Fragment as b,jsx as s,jsxs as h}from"react/jsx-runtime";import T,{useImperativeHandle as V,useRef as C}from"react";import{Heading as k,Picture as x,Text as y,Button as z,Link as D,Container as H}from"../../components/index.js";import"../../shared/Styles.js";import{cn as a}from"../../helpers/utils.js";import{useExposure as P}from"../../hooks/useExposure.js";import{trackUrlRef as $}from"../../shared/trackUrlRef.js";import{cva as v}from"class-variance-authority";import{getLocalizedPath as A}from"../../helpers/index.js";import{useAiuiContext as w}from"../AiuiProvider/index.js";const m="image",u="activity_mechanism",M=v("line-clamp-2",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),R=v("desktop:text-[16px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] tracking-[-0.02em]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white/80"}},defaultVariants:{theme:"light"}}),L=v("mt-2 !p-0 text-[14px]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-white"}},defaultVariants:{theme:"light"}}),f={default:767,tablet:1024,laptop:1439,desktop:1919,lgDesktop:9999},B=t=>{if(!t)return"";const e=[];return t.lgDesktop?.url&&e.push(`${t.lgDesktop.url}`),t.desktop?.url&&e.push(`${t.desktop.url} ${f.desktop}`),t.laptop?.url&&e.push(`${t.laptop.url} ${f.laptop}`),t.tablet?.url&&e.push(`${t.tablet.url} ${f.tablet}`),t.default?.url&&e.push(`${t.default.url} ${f.default}`),e.join(", ")},E=t=>t&&(t.default?.alt||t.tablet?.alt||t.laptop?.alt||t.desktop?.alt||t.lgDesktop?.alt)||"",S=({item:t,theme:e,classNames:l})=>{const{title:i,description:p,linkText:o,linkHref:n,backgroundImage:c}=t,r=B(c),d=E(c),{locale:g="us"}=w();return s("div",{className:a("rounded-card relative flex flex-col overflow-hidden","desktop:px-6 h-[280px] p-4","laptop:gap-4 gap-3","laptop:h-[320px] lg-desktop:h-[400px]",l?.card),"data-headless-type-name":`${m}#${u}`,children:n?h(D,{href:A($(n,`${m}_${u}`),g),className:"no-underline",children:[r&&s(x,{source:r,alt:d||i,className:a("absolute inset-0 size-full",l?.background),imgClassName:"size-full object-cover"}),h("div",{className:"relative z-10",children:[s(k,{as:"h3",size:3,className:a(M({theme:e}),l?.title),children:i}),s(y,{as:"p",className:a(R({theme:e}),l?.description),children:p}),o&&s(z,{variant:"link",as:"a",href:A($(n,`${m}_${u}`),g),className:a(L({theme:e}),l?.link),"data-headless-title-desc-button":`${i}#${p}#${o}`,children:o})]})]}):h(b,{children:[r&&s(x,{source:r,alt:d||i,className:a("absolute inset-0 size-full",l?.background),imgClassName:"size-full object-cover"}),h("div",{className:"relative z-10",children:[s(k,{as:"h3",size:3,className:a(M({theme:e}),l?.title),children:i}),s(y,{as:"p",className:a(R({theme:e}),l?.description),children:p})]})]})})},N=T.forwardRef(({data:t,classNames:e},l)=>{const{items:i=[],theme:p="light"}=t,o=C(null);if(V(l,()=>o.current),P(o,{componentType:m,componentName:u,componentTitle:i[0]?.title||"",componentDescription:i[0]?.description||""}),!i||i.length===0)return null;const n={1:"laptop:grid-cols-1 desktop:grid-cols-1 lg-desktop:grid-cols-1",2:"laptop:grid-cols-2 desktop:grid-cols-2 lg-desktop:grid-cols-2",3:"tablet:grid-cols-2 laptop:grid-cols-3 desktop:grid-cols-3 lg-desktop:grid-cols-3",4:"laptop:grid-cols-4 desktop:grid-cols-4 lg-desktop:grid-cols-4"},c=n[Math.min(i.length,4)]||n[4];return s(H,{"data-ui-component-id":"ActivityMechanism",className:a("activity-mechanism","w-full",e?.root),ref:o,children:s("div",{className:a("tablet:grid-cols-2 laptop:gap-4 grid grid-cols-1 gap-3",c,e?.grid),children:i.map((r,d)=>s(S,{item:r,theme:p,classNames:{...e,...i?.length===3&&{card:e?.card+" first:tablet:col-span-full first:laptop:col-span-1"}}},`${r.title}-${d}`))})})});N.displayName="ActivityMechanism";var W=N;export{W as default};
|
|
@@ -81,6 +81,15 @@ interface AiuiContextType {
|
|
|
81
81
|
* @example { 'eu-pl': 'pl-PL', 'eu-pt': 'pt-PT' }
|
|
82
82
|
*/
|
|
83
83
|
localeMap?: Record<string, string>;
|
|
84
|
+
/**
|
|
85
|
+
* 导航折叠状态(HeaderNavigation 内容驱动测量结果),供 Board 等兄弟组件视觉联动。
|
|
86
|
+
* HeaderNavigation 在内部测量后写入,Board 读取以控制 leftIcon 显隐。
|
|
87
|
+
*/
|
|
88
|
+
navCollapsed?: boolean;
|
|
89
|
+
/**
|
|
90
|
+
* 设置导航折叠状态。仅供 HeaderNavigation 内部写入,消费方无需关心。
|
|
91
|
+
*/
|
|
92
|
+
setNavCollapsed?: (_collapsed: boolean) => void;
|
|
84
93
|
}
|
|
85
94
|
export declare const AiuiContext: React.Context<AiuiContextType>;
|
|
86
95
|
export declare const useAiuiContext: () => AiuiContextType;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as f}from"react/jsx-runtime";import{gaTrack as A}from"../../shared/track.js";import{createContext as E,useContext as D,useEffect as c,useMemo as T,useRef as v,useState as _}from"react";import{extendLocaleMap as M}from"../../helpers/index.js";const b=E({trackingData:{},locale:void 0,copyWriting:{}}),S=()=>{const o=D(b);if(!o)throw new Error("useAiui must be used in <AiuiProvider>");return o},P=({children:o,...t})=>{const p=v(null),l=v(t?.trackingData),[u,h]=_(!1);c(()=>{t.localeMap&&Object.keys(t.localeMap).length>0&&M(t.localeMap)},[t.localeMap]),c(()=>{l.current=t?.trackingData},[t?.trackingData]),c(()=>{const r=p.current;if(!r)return;const d=(e,a)=>{const n={};if(!a||!a.attributes)return n;for(const C of Array.from(a.attributes)){const s=C?.name;s?.startsWith("data-headless-")&&(n[s]=a.getAttribute(s))}const x=n?.["data-headless-sku"],g=n?.["data-headless-type-name"]?.split?.("#"),i=n?.["data-headless-title-desc-button"]?.split?.("#"),y=n?.["data-headless-nav-position"]?.split?.("#");A({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:l.current?.pageGroup||"Home Page",component_type:g?.[0]||"",component_name:g?.[1]||"",position:y?.[1]||"",navigation:y?.[0]||"",button_name:i?.[2]||"",SKU:x||"",component_title:i?.[0]||"",component_description:i?.[1]||""}})},m=new MutationObserver(()=>{r.querySelectorAll("[data-headless-type-name]").forEach(e=>{e.hasAttribute("data-headless-track-bound")||(e.addEventListener("click",a=>d(a,e)),e.setAttribute("data-headless-track-bound","true"))})});return m.observe(r,{childList:!0,subtree:!0}),r.querySelectorAll("[data-headless-type-name]").forEach(e=>{e.hasAttribute("data-headless-track-bound")||(e.addEventListener("click",a=>d(a,e)),e.setAttribute("data-headless-track-bound","true"))}),()=>m.disconnect()},[]);const k=T(()=>({...t,navCollapsed:u,setNavCollapsed:h}),[t,u]);return f(b.Provider,{value:k,children:f("div",{ref:p,children:o})})};var w=P;export{b as AiuiContext,w as default,S as useAiuiContext};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use client";import{Fragment as
|
|
1
|
+
"use client";import{Fragment as b,jsx as e,jsxs as i}from"react/jsx-runtime";import{cn as o}from"../../helpers/utils.js";import c from"../SwiperBox/index.js";import{withLayout as f}from"../../shared/Styles.js";import{Grid as u,GridItem as x}from"../../components/grid.js";import{Picture as d,Text as s}from"../../components/index.js";const g=({data:t,configuration:a})=>e("div",{className:o("creativeModuleItem","text-info-primary aspect-h-[360] aspect-w-[296] relative flex-1 shrink-0 overflow-hidden md:basis-[296px]","rounded-box",{"aiui-dark":t.theme==="dark"}),children:i("div",{className:"absolute inset-0",children:[e(d,{className:"h-full",imgClassName:"h-full object-cover",source:t?.mobileImg?.url||t?.img?.url,alt:t?.mobileImg?.alt||t?.img?.alt||""}),i("div",{className:"z-1 absolute inset-x-0 bottom-4 box-border flex w-full flex-col overflow-hidden px-4",children:[e(s,{html:t?.title,className:"graphic-title truncate text-xl font-bold leading-[1.2]"}),t?.description&&e(s,{html:t?.description,className:"graphic-title line-clamp-2 text-sm font-bold leading-[1.2]"})]})]})}),v=({data:t,className:a,...p})=>{const{productsTab:r,shape:m}=t;return i(b,{children:[e("div",{...p,className:o("creativeModuleBlock","laptop:block box-border hidden w-full overflow-hidden",a),children:e(u,{className:o("tablet:gap-4 grid grid-cols-12 gap-3 ",a),children:r?.map((l,n)=>i(x,{span:l.span,className:o("text-info-primary relative w-full overflow-hidden","rounded-box","lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[288px]",{"aiui-dark":l.theme==="dark"}),children:[e(d,{source:l.img.url,className:"size-full",imgClassName:"h-full object-cover"}),i("div",{className:"lg-desktop:bottom-8 lg-desktop:px-8 desktop:bottom-6 desktop:px-6 absolute inset-x-0 bottom-4 flex flex-col gap-[6px] overflow-hidden px-4",children:[l.title&&e(s,{html:l.title,as:"p",className:"desktop:text-[32px] laptop:text-2xl line-clamp-2 text-xl font-bold !leading-tight"}),l.description&&e(s,{html:l.description,className:"desktop:text-lg line-clamp-2 text-sm font-bold !leading-normal"})]})]},n))})}),e("div",{className:"laptop:hidden block w-full",children:e(c,{id:"CreativeModule",className:o("!overflow-visible",a),data:{list:r||[],configuration:{shape:m}},Slide:g,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3}}})})]})};var y=f(v);export{y as default};
|