@anker-in/headless-ui 1.3.73 → 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.
Files changed (55) hide show
  1. package/dist/cjs/biz-components/AiuiProvider/index.d.ts +9 -0
  2. package/dist/cjs/biz-components/AiuiProvider/index.js +1 -1
  3. package/dist/cjs/biz-components/FooterNavigation/index.js +1 -1
  4. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +2 -1
  5. package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
  6. package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +1 -1
  7. package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.js +1 -1
  8. package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.js +1 -1
  9. package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.js +1 -1
  10. package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.js +1 -1
  11. package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +1 -1
  12. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.d.ts +2 -1
  13. package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
  14. package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.js +1 -1
  15. package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
  16. package/dist/cjs/biz-components/HeaderNavigation/types.d.ts +1 -0
  17. package/dist/cjs/biz-components/HeaderNavigation/types.js +1 -1
  18. package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.d.ts +30 -0
  19. package/dist/cjs/biz-components/HeaderNavigation/useNavCollapse.js +1 -0
  20. package/dist/cjs/biz-components/HeaderNavigation/useScrollLock.d.ts +2 -1
  21. package/dist/cjs/biz-components/HeaderNavigation/useScrollLock.js +1 -1
  22. package/dist/cjs/biz-components/HeaderNavigation/withCategory.js +1 -1
  23. package/dist/cjs/biz-components/SearchPage/index.js +1 -1
  24. package/dist/cjs/components/badge.d.ts +1 -1
  25. package/dist/cjs/components/badge.js +1 -1
  26. package/dist/cjs/components/board.js +1 -1
  27. package/dist/esm/biz-components/AiuiProvider/index.d.ts +9 -0
  28. package/dist/esm/biz-components/AiuiProvider/index.js +1 -1
  29. package/dist/esm/biz-components/FooterNavigation/index.js +1 -1
  30. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +2 -1
  31. package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js +1 -1
  32. package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +1 -1
  33. package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.js +1 -1
  34. package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.js +1 -1
  35. package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.js +1 -1
  36. package/dist/esm/biz-components/HeaderNavigation/ResourceItem.js +1 -1
  37. package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +1 -1
  38. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.d.ts +2 -1
  39. package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
  40. package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.js +1 -1
  41. package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
  42. package/dist/esm/biz-components/HeaderNavigation/types.d.ts +1 -0
  43. package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.d.ts +30 -0
  44. package/dist/esm/biz-components/HeaderNavigation/useNavCollapse.js +1 -0
  45. package/dist/esm/biz-components/HeaderNavigation/useScrollLock.d.ts +2 -1
  46. package/dist/esm/biz-components/HeaderNavigation/useScrollLock.js +1 -1
  47. package/dist/esm/biz-components/HeaderNavigation/withCategory.js +1 -1
  48. package/dist/esm/biz-components/SearchPage/index.js +1 -1
  49. package/dist/esm/components/badge.d.ts +1 -1
  50. package/dist/esm/components/badge.js +1 -1
  51. package/dist/esm/components/board.js +1 -1
  52. package/dist/tokens/oneAnker.css +22 -0
  53. package/package.json +1 -1
  54. package/style.css +29 -2
  55. package/tailwind.config.js +5 -0
@@ -1 +1 @@
1
- "use strict";var u=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var i=Object.prototype.hasOwnProperty;var m=(n,e)=>{for(var o in e)u(n,o,{get:e[o],enumerable:!0})},s=(n,e,o,f)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of l(e))!i.call(n,t)&&t!==o&&u(n,t,{get:()=>e[t],enumerable:!(f=c(e,t))||f.enumerable});return n};var p=n=>s(u({},"__esModule",{value:!0}),n);var w={};m(w,{default:()=>v,useScrollLock:()=>d});module.exports=p(w);var r=require("react");function d(n){const e=(0,r.useRef)(void 0);(0,r.useEffect)(()=>{typeof e.current>"u"&&(e.current=document.documentElement.style.overflow),document.documentElement.style.overflow=n?"hidden":e.current},[n])}var v=d;
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 r in e)d(a,r,{get:e[r],enumerable:!0})},l=(a,e,r,u)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of M(e))!w.call(a,n)&&n!==r&&d(a,n,{get:()=>e[n],enumerable:!(u=y(e,n))||u.enumerable});return a};var P=(a,e,r)=>(r=a!=null?p(f(a)):{},l(e||!a||!a.__esModule?d(r,"default",{value:a,enumerable:!0}):r,a)),N=a=>l(d({},"__esModule",{value:!0}),a);var g={};h(g,{WithGroupCategory:()=>D,WithMulticol:()=>S,WithResource:()=>b,WithSidebar:()=>m,WithSupports:()=>R});module.exports=N(g);var c=require("react/jsx-runtime"),s=P(require("react"));function m(a,e){const r=(0,s.useMemo)(()=>{let t=null;try{t=JSON.parse(e?.components?.[0]?.sidebar?.categoriesMetadata||"{}")}catch(o){console.log("categoriesMetadata Parse error",o)}return t},[e]),u=(0,s.useMemo)(()=>{let t=null;try{t=JSON.parse(e?.components?.[0]?.sidebar?.seriesMetadata||"[]")}catch(o){console.log("seriesMetadata Parse error",o)}return t},[e]),n=s.default.forwardRef((t,o)=>(0,c.jsx)(a,{...t,ref:o,seriesMetadata:u,sidebarCategoriesMetadata:r}));return n.displayName=a.displayName||a.name||"WithSidebarDropdown",n}function R(a,{categoriesItem:e,currentNavItemRef:r}){const u=(0,s.useMemo)(()=>e?.components?.[0]?.supports,[e]),n=s.default.forwardRef((t,o)=>(0,c.jsx)(a,{...t,supportsMetadata:u,currentNavItemRef:r,ref:o}));return n.displayName=a.displayName||a.name||"WithSupportsDropdown",n}function S(a,e){const r=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]),t=s.default.forwardRef((o,i)=>(0,c.jsx)(a,{...o,ref:i,multicolMetadata:n,showStatsBanner:r,statsBannerData:u}));return t.displayName=a.displayName||a.name||"WithMulticolDropdown",t}function b(a,e){const r=(0,s.useMemo)(()=>{let t=null;try{t=JSON.parse(e?.components?.[0]?.resource?.categoriesMetadata||"{}")}catch(o){console.log("resourceCategoriesMetadata Parse error",o)}return t},[e]),u=(0,s.useMemo)(()=>{let t=null;try{t=JSON.parse(e?.components?.[0]?.resource?.resourceMetadata||"[]")}catch(o){console.log("resourcesMetadata Parse error",o)}return t},[e]),n=s.default.forwardRef((t,o)=>(0,c.jsx)(a,{...t,ref:o,resourcesMetadata:u,resourceCategoriesMetadata:r}));return n.displayName=a.displayName||a.name||"WithResourceDropdown",n}function D(a){return a?Object.values(a?.reduce((e,r)=>(e[r.group]||(e[r.group]=[]),e[r.group].push(r),e),{})):[[]]}
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 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=(n,e)=>{for(var o in e)r(n,o,{get:e[o],enumerable:!0})},m=(n,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of g(e))!u.call(n,i)&&i!==o&&r(n,i,{get:()=>e[i],enumerable:!(a=d(e,i))||a.enumerable});return n};var f=n=>m(r({},"__esModule",{value:!0}),n);var Z={};c(Z,{default:()=>_});module.exports=f(Z);var t=require("react/jsx-runtime"),y=require("react"),p=require("class-variance-authority"),C=require("../helpers/index.js");const x=(0,p.cva)("text-brand-0 outline-brand-0 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:{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-brand-0 bg-gradient-brand text-badge-foreground",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:n,size:e,variant:o="outline",promotionalType:a,...i}){const l=o==="promotional",s=l?v[a||"regular-discount"]:null;return(0,t.jsxs)("div",{className:(0,C.cn)(x({size:e,variant:o,promotionalType:l?a:void 0}),n),...i,children:[l&&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:l?"relative z-10":"",children:i.children})]})}var _=M;
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 g=Object.create;var i=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var I=(e,n)=>{for(var a in n)i(e,a,{get:n[a],enumerable:!0})},m=(e,n,a,l)=>{if(n&&typeof n=="object"||typeof n=="function")for(let o of p(n))!u.call(e,o)&&o!==a&&i(e,o,{get:()=>n[o],enumerable:!(l=h(n,o))||l.enumerable});return e};var k=(e,n,a)=>(a=e!=null?g(b(e)):{},m(n||!e||!e.__esModule?i(a,"default",{value:e,enumerable:!0}):a,e)),N=e=>m(i({},"__esModule",{value:!0}),e);var v={};I(v,{default:()=>B});module.exports=N(v);var r=require("react/jsx-runtime"),s=require("react"),d=require("../helpers/utils.js"),f=require("./container.js"),c=k(require("./link.js")),t=require("./text.js");const x=({data:e,sizeClass:n})=>(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:"desktop:flex hidden h-full items-center gap-3",children:e?.leftIcon?.map?.((a,l)=>(0,r.jsxs)(s.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,d.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)(s.Fragment,{children:a?.link?(0,r.jsx)(c.default,{href:a?.link,variant:"secondary","aria-label":a?.label||a?.title,className:(0,d.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=x;
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;
@@ -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 b}from"react/jsx-runtime";import{gaTrack as k}from"../../shared/track.js";import{createContext as x,useContext as A,useEffect as c,useRef as y}from"react";import{extendLocaleMap as E}from"../../helpers/index.js";const f=x({trackingData:{},locale:void 0,copyWriting:{}}),P=()=>{const o=A(f);if(!o)throw new Error("useAiui must be used in <AiuiProvider>");return o},C=({children:o,...e})=>{const p=y(null),u=y(e?.trackingData);return c(()=>{e.localeMap&&Object.keys(e.localeMap).length>0&&E(e.localeMap)},[e.localeMap]),c(()=>{u.current=e?.trackingData},[e?.trackingData]),c(()=>{const r=p.current;if(!r)return;const l=(t,n)=>{const a={};if(!n||!n.attributes)return a;for(const h of Array.from(n.attributes)){const s=h?.name;s?.startsWith("data-headless-")&&(a[s]=n.getAttribute(s))}const v=a?.["data-headless-sku"],m=a?.["data-headless-type-name"]?.split?.("#"),i=a?.["data-headless-title-desc-button"]?.split?.("#"),g=a?.["data-headless-nav-position"]?.split?.("#");k({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:u.current?.pageGroup||"Home Page",component_type:m?.[0]||"",component_name:m?.[1]||"",position:g?.[1]||"",navigation:g?.[0]||"",button_name:i?.[2]||"",SKU:v||"",component_title:i?.[0]||"",component_description:i?.[1]||""}})},d=new MutationObserver(()=>{r.querySelectorAll("[data-headless-type-name]").forEach(t=>{t.hasAttribute("data-headless-track-bound")||(t.addEventListener("click",n=>l(n,t)),t.setAttribute("data-headless-track-bound","true"))})});return d.observe(r,{childList:!0,subtree:!0}),r.querySelectorAll("[data-headless-type-name]").forEach(t=>{t.hasAttribute("data-headless-track-bound")||(t.addEventListener("click",n=>l(n,t)),t.setAttribute("data-headless-track-bound","true"))}),()=>d.disconnect()},[]),b(f.Provider,{value:e,children:b("div",{ref:p,children:o})})};var R=C;export{f as AiuiContext,R as default,P as useAiuiContext};
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
- import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Fragment as D,useEffect as w,useMemo as S,useState as y}from"react";import{Text as d,Container as z,Link as m}from"../../components/index.js";import A from"../Subscribe/index.js";import{FooterNavigationBlockType as v}from"./types.js";import{AddIcon as B,SubtractIcon as C,ArrowRightIcon as E,CountryIcon as T}from"./icons/index.js";import{useMediaQuery as M}from"react-responsive";import{cn as x,getLocalizedPath as u}from"../../helpers/utils.js";import{useAiuiContext as k}from"../AiuiProvider/index.js";import{withLayout as P}from"../../shared/Styles.js";const $=({data:{footer:a}={},currentCountry:p,event:n,subscribeLoading:f,classNames:i,className:s,moduleIds:l,...g})=>{const[c,r]=y(!1),b=M({query:"(max-width: 1439px)"});w(()=>{r(b)},[b]);const h=S(()=>a?.blocks?.find(t=>t?.blockType===v.Brand)?.country||{},[a]);return e("footer",{...g,className:x(i?.root,s),children:o(z,{className:x(i?.child),childClassName:x("laptop:py-16 desktop:gap-16 flex flex-col gap-8 bg-black py-8"),children:[e(d,{html:a?.story,className:"desktop:text-sm text-xs font-bold text-[#6D6D6F]"}),a?.blocks?.map(t=>{if(t?.blockType===v.Signup)return e(O,{subscribeLoading:f,data:t,onSubmit:n?.signup,id:l?.marketingConversion},t.id);if(t?.blockType===v.Brand)return e(Q,{data:t,isMobile:c,event:n,currentCountry:p,id:l?.footerBrand},t?.id);if(t?.blockType===v.Main)return e(j,{data:{...t,country:h},event:n,isMobile:c,currentCountry:p,id:l?.mainServices},t.id)})]})})},O=({data:a,onSubmit:p,subscribeLoading:n,id:f="footer-marketing-conversion"})=>{const{locale:i="us"}=k();return o("div",{id:f,className:"desktop:py-16 desktop:gap-16 laptop:px-8 desktop:flex-row rounded-btn flex flex-col gap-8 bg-[#1E2024] px-4 py-8",children:[e(A,{subscribeMetadata:a?.signup,className:"desktop:flex-[744]",onSubmit:p,loading:n}),e("div",{className:"desktop:hidden h-px w-full bg-[#3D3E3F]"}),o("div",{className:"desktop:gap-6 laptop:flex-row desktop:flex-[792] flex flex-col gap-4",children:[o("div",{className:"flex-1",children:[e(d,{html:a?.enjoy?.title,className:" text-xl font-bold leading-[1.2] text-white"}),e("div",{className:"mt-4 flex flex-col gap-2",children:a?.enjoy?.enjoys?.map(s=>o("div",{className:"flex-start flex gap-2",children:[e("img",{src:s?.icon?.url,loading:"lazy",alt:s?.icon?.alt||"",className:"size-5 shrink-0"}),e(d,{html:s?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA]"})]},s?.id))})]}),e("div",{className:"desktop:block hidden w-px bg-[#3D3E3F]"}),o("div",{className:"flex-1",children:[e(d,{html:a?.benefit?.title,className:"text-xl font-bold leading-[1.2] text-white"}),e("div",{className:"mt-4 flex flex-col gap-2",children:a?.benefit?.benefits?.map(s=>e(m,{href:u(s?.link,i,"ref=footer"),asChild:!s?.link,className:"no-underline",children:e(d,{html:s?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] hover:text-white"})},s?.id))})]})]})]})},j=({data:a,event:p,isMobile:n,currentCountry:f,id:i="footer-main-services"})=>{const{locale:s="us"}=k(),[l,g]=y(!1),{services:c,mainNav:r,country:b}=a,h="contact-section";return o("nav",{id:i,className:"flex flex-col gap-8","aria-label":"Main navigation",children:[o("div",{className:x({"desktop:gap-16 flex":c?.download?.title}),children:[o("div",{className:x("w-full",{"desktop:flex-[1260]":c?.download?.title}),children:[e(d,{html:c?.storeBenefits?.title,className:" text-xl font-bold leading-[1.2] text-white"}),e("div",{className:x("laptop:flex-row desktop:gap-4 laptop:flex-wrap mt-4 flex flex-col gap-2",{"desktop:max-w-[648px]":c?.download?.title}),children:c?.storeBenefits?.reasons?.map(t=>o("div",{className:"desktop:min-w-[288px] flex flex-1 shrink-0 items-center gap-2",children:[e("img",{src:t?.icon?.url,loading:"lazy",alt:t?.icon?.alt||"",className:"size-5 shrink-0"}),e(m,{href:u(t?.link,s,"ref=footer"),asChild:!t?.link,className:"no-underline",children:e(d,{html:t?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA]"})})]},t?.id))})]}),e(F,{className:x({"desktop:flex-[404] hidden desktop:block":c?.download?.title}),title:c?.download?.title,apps:c?.download?.apps})]}),e("div",{className:"desktop:block hidden h-px bg-[#3D3E3F]","aria-hidden":"true"}),o("div",{className:"desktop:grid grid-cols-4 gap-4",children:[e(N,{title:r?.products?.title,lists:r?.products?.products}),e(N,{title:r?.explore?.title,lists:r?.explore?.explores}),e(N,{title:r?.support?.title,lists:r?.support?.supports}),o("div",{className:"desktop:py-0 desktop:border-none border-t border-[#3D3E3F] pt-4",children:[o("div",{className:"desktop:pb-0 flex items-center justify-between pb-4",children:[e(d,{as:"p",html:r?.contact?.title,className:"text-xl font-bold leading-[1.2] text-white",id:h}),n&&e("button",{onClick:()=>g(!l),"aria-expanded":l,"aria-controls":h,"aria-label":l?"Collapse contact section":"Expand contact section",children:l?e(C,{width:20,height:20}):e(B,{width:20,height:20})})]}),(l&&n||!n)&&e("div",{className:"desktop:mt-4 desktop:mb-0 mb-4 flex flex-col gap-2",role:"region","aria-labelledby":h,children:r?.contact?.contacts?.map(t=>o(m,{href:t?.link,className:"group flex items-start gap-2 no-underline",children:[e("img",{src:t?.icon?.url,loading:"lazy",alt:t?.icon?.alt,className:"size-5 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"}),e(d,{html:t?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] transition-colors duration-200 group-hover:text-white"})]},t?.id))}),e(L,{country:f||b,className:"desktop:hidden border-b border-[#3D3E3F]",isMobile:n,onChangeCountry:p?.country}),e("div",{className:"desktop:hidden mt-8",children:e(F,{title:c?.download?.title,apps:c?.download?.apps})}),!!r?.socials?.length&&e("div",{className:"mt-8 flex items-center gap-2",role:"list","aria-label":"Social media links",children:r?.socials?.map(t=>e(m,{href:u(t?.link,s,"ref=footer"),className:"group",role:"listitem","aria-label":t?.icon?.alt||"Social media",children:e("img",{src:t?.icon?.url,loading:"lazy",alt:t?.icon?.alt,className:"size-8 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"})},t?.id))}),e("div",{className:"mt-4 flex flex-wrap gap-2",role:"list","aria-label":"Payment methods",children:r?.payment?.map(t=>e(m,{href:u(t?.link,s),asChild:!t?.link,role:"listitem","aria-label":t?.icon?.alt||"Payment method",children:e("img",{src:t?.icon?.url,loading:"lazy",alt:t?.icon?.alt||"",className:"h-[28px] w-[44px] shrink-0"})},t?.id))})]})]})]})},Q=({data:a,isMobile:p,event:n,currentCountry:f,id:i="footer-brand"})=>{const{locale:s="us"}=k();return o("div",{id:i,className:"flex flex-col gap-4",children:[o("div",{className:"desktop:items-center desktop:flex desktop:gap-4",children:[e("div",{className:"laptop:flex-row aiui-dark laptop:items-center desktop:flex-[980] flex flex-col items-start gap-3",children:o("div",{className:"flex flex-wrap items-center gap-3",children:[e(m,{variant:"secondary",href:u(a?.brand?.link,s,"ref=footer"),asChild:!a?.brand?.link,children:e(d,{html:a?.brand?.currentBrand,"aria-hidden":"true"})}),!!a?.brand?.brands?.length&&a?.brand?.brands?.map((l,g)=>o(D,{children:[g<=0&&e("span",{className:"bg-lines h-3 w-px","aria-hidden":"true"}),e(m,{variant:"secondary",href:u(l?.link,s,"ref=footer"),className:"text-base leading-normal no-underline",children:e(d,{html:l?.icon,"aria-hidden":"true"})},l?.id)]},g))]})}),e(L,{country:f||a?.country,className:"desktop:flex-[316] desktop:block hidden",isMobile:p,onChangeCountry:n?.country})]}),e("div",{className:"h-px bg-[#3D3E3F]"}),o("div",{className:"laptop:flex-row desktop:gap-4 desktop:items-center flex flex-col items-start gap-1",children:[e(d,{html:a?.copyright?.label,className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#6D6D6F]"}),o("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[a?.policy?.policies?.map(l=>e(m,{href:u(l?.link,s,"ref=footer"),className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#B6B6BA] no-underline hover:text-white",children:l?.label},l?.id)),a?.policy?.cookies&&e("button",{"data-cc":"show-preferencesModal",onClick:n?.cookiesSet,className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#B6B6BA] no-underline hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black","aria-label":`Cookie preferences: ${a?.policy?.cookies}`,children:a?.policy?.cookies})]})]})]})},N=({title:a,lists:p,className:n})=>{const{locale:f="us"}=k(),[i,s]=y(!1),[l,g]=y(!1),c=M({query:"(max-width: 1439px)"});w(()=>{g(c)},[c]);const r=`nav-section-${a?.replace(/\s+/g,"-").toLowerCase()}`;return o("div",{className:x("desktop:py-0 desktop:border-none border-t border-[#3D3E3F] py-4",n),children:[o("div",{className:"flex items-center justify-between",children:[e(d,{as:"p",html:a,className:"text-xl font-bold leading-[1.2] text-white",id:r}),l&&e("button",{onClick:()=>s(!i),"aria-expanded":i,"aria-controls":r,"aria-label":i?`Collapse ${a}`:`Expand ${a}`,className:"focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black",children:i?e(C,{width:20,height:20}):e(B,{width:20,height:20})})]}),(i&&l||!l)&&e("nav",{className:"mt-4 flex flex-col gap-2",role:"region","aria-labelledby":r,children:p?.map(b=>e(m,{href:u(b?.link,f,"ref=footer"),className:"no-underline",children:e(d,{html:b?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] hover:text-white"})},b?.id))})]})},F=({title:a,apps:p,className:n})=>{const{locale:f="us"}=k();return p?.length?o("div",{className:n,children:[e(d,{html:a,className:" text-xl font-bold leading-[1.2] text-white"}),e("div",{className:"mt-4 flex items-center gap-4",role:"list","aria-label":"Download apps",children:p?.map(i=>o(m,{href:u(i?.link,f),className:"group flex flex-col items-center gap-[6px]",role:"listitem","aria-label":i?.icon?.alt||i?.label||"Download app",children:[e("img",{src:i?.icon?.url,loading:"lazy",alt:i?.icon?.alt,className:"size-10 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"}),i?.label&&e(d,{html:i?.label,className:"text-xs font-bold text-[#999999] transition-colors duration-200 group-hover:text-white"})]},i?.id))})]}):null},L=({country:a,isMobile:p,className:n,onChangeCountry:f})=>e("div",{className:x("desktop:py-0 desktop:border-none border-t border-[#3D3E3F] py-4",n),children:o("button",{onClick:()=>f?.(),className:"flex w-full items-center justify-between focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black","aria-label":`Change country/region, current: ${a?.countryName||a?.country}`,children:[o("div",{className:"group flex items-center gap-2",children:[e(T,{width:20,height:20,className:"shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100","aria-hidden":"true"}),e(d,{as:"span",html:a?.countryName||a?.country,className:"desktop:text-[#B6B6BA] desktop:group-hover:text-white text-base font-bold leading-[1.4] text-white transition-colors duration-200"})]}),p&&e(E,{width:20,height:20,"aria-hidden":"true"})]})});var W=P($);export{W as default};
1
+ import{jsx as e,jsxs as o}from"react/jsx-runtime";import{Fragment as D,useEffect as w,useMemo as S,useState as y}from"react";import{Text as d,Container as z,Link as m}from"../../components/index.js";import A from"../Subscribe/index.js";import{FooterNavigationBlockType as v}from"./types.js";import{AddIcon as B,SubtractIcon as C,ArrowRightIcon as E,CountryIcon as T}from"./icons/index.js";import{useMediaQuery as M}from"react-responsive";import{cn as x,getLocalizedPath as u}from"../../helpers/utils.js";import{useAiuiContext as k}from"../AiuiProvider/index.js";import{withLayout as P}from"../../shared/Styles.js";const $=({data:{footer:a}={},currentCountry:p,event:n,subscribeLoading:f,classNames:i,className:s,moduleIds:l,...g})=>{const[c,r]=y(!1),b=M({query:"(max-width: 1439px)"});w(()=>{r(b)},[b]);const h=S(()=>a?.blocks?.find(t=>t?.blockType===v.Brand)?.country||{},[a]);return e("footer",{...g,className:x(i?.root,s),children:o(z,{className:x(i?.child),childClassName:x("laptop:py-16 desktop:gap-16 flex flex-col gap-8 bg-black py-8"),children:[e(d,{html:a?.story,className:"desktop:text-sm text-xs font-bold text-[#6D6D6F]"}),a?.blocks?.map(t=>{if(t?.blockType===v.Signup)return e(O,{subscribeLoading:f,data:t,onSubmit:n?.signup,id:l?.marketingConversion},t.id);if(t?.blockType===v.Brand)return e(Q,{data:t,isMobile:c,event:n,currentCountry:p,id:l?.footerBrand},t?.id);if(t?.blockType===v.Main)return e(j,{data:{...t,country:h},event:n,isMobile:c,currentCountry:p,id:l?.mainServices},t.id)})]})})},O=({data:a,onSubmit:p,subscribeLoading:n,id:f="footer-marketing-conversion"})=>{const{locale:i="us"}=k();return o("div",{id:f,className:"desktop:py-16 desktop:gap-16 laptop:px-8 desktop:flex-row rounded-btn flex flex-col gap-8 bg-[#1E2024] px-4 py-8",children:[e(A,{subscribeMetadata:a?.signup,className:"desktop:flex-[744]",onSubmit:p,loading:n}),e("div",{className:"desktop:hidden h-px w-full bg-[#3D3E3F]"}),o("div",{className:"desktop:gap-6 laptop:flex-row desktop:flex-[792] flex flex-col gap-4",children:[o("div",{className:"flex-1",children:[e(d,{html:a?.enjoy?.title,className:" text-xl font-bold leading-[1.2] text-white"}),e("div",{className:"mt-4 flex flex-col gap-2",children:a?.enjoy?.enjoys?.map(s=>o("div",{className:"flex-start flex gap-2",children:[e("img",{src:s?.icon?.url,loading:"lazy",alt:s?.icon?.alt||"",className:"size-5 shrink-0"}),e(d,{html:s?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA]"})]},s?.id))})]}),e("div",{className:"desktop:block hidden w-px bg-[#3D3E3F]"}),o("div",{className:"flex-1",children:[e(d,{html:a?.benefit?.title,className:"text-xl font-bold leading-[1.2] text-white"}),e("div",{className:"mt-4 flex flex-col gap-2",children:a?.benefit?.benefits?.map(s=>e(m,{href:u(s?.link,i,"ref=footer"),asChild:!s?.link,className:"no-underline",children:e(d,{html:s?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] hover:text-white"})},s?.id))})]})]})]})},j=({data:a,event:p,isMobile:n,currentCountry:f,id:i="footer-main-services"})=>{const{locale:s="us"}=k(),[l,g]=y(!1),{services:c,mainNav:r,country:b}=a,h="contact-section";return o("nav",{id:i,className:"flex flex-col gap-8","aria-label":"Main navigation",children:[o("div",{className:x({"desktop:gap-16 flex":c?.download?.title}),children:[o("div",{className:x("w-full",{"desktop:flex-[1260]":c?.download?.title}),children:[e(d,{html:c?.storeBenefits?.title,className:" text-xl font-bold leading-[1.2] text-white"}),e("div",{className:x("laptop:flex-row desktop:gap-4 laptop:flex-wrap mt-4 flex flex-col gap-2",{"desktop:max-w-[648px]":c?.download?.title}),children:c?.storeBenefits?.reasons?.map(t=>o("div",{className:"desktop:min-w-[288px] flex flex-1 shrink-0 items-center gap-2",children:[e("img",{src:t?.icon?.url,loading:"lazy",alt:t?.icon?.alt||"",className:"size-5 shrink-0"}),e(m,{href:u(t?.link,s,"ref=footer"),asChild:!t?.link,className:"no-underline",children:e(d,{html:t?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA]"})})]},t?.id))})]}),e(F,{className:x({"desktop:flex-[404] hidden desktop:block":c?.download?.title}),title:c?.download?.title,apps:c?.download?.apps})]}),e("div",{className:"desktop:block hidden h-px bg-[#3D3E3F]","aria-hidden":"true"}),o("div",{className:"desktop:grid grid-cols-4 gap-4",children:[e(N,{title:r?.products?.title,lists:r?.products?.products}),e(N,{title:r?.explore?.title,lists:r?.explore?.explores}),e(N,{title:r?.support?.title,lists:r?.support?.supports}),o("div",{className:"desktop:py-0 desktop:border-none border-t border-[#3D3E3F] pt-4",children:[o("div",{className:"desktop:pb-0 flex items-center justify-between pb-4",children:[e(d,{as:"p",html:r?.contact?.title,className:"text-xl font-bold leading-[1.2] text-white",id:h}),n&&e("button",{onClick:()=>g(!l),"aria-expanded":l,"aria-controls":h,"aria-label":l?"Collapse contact section":"Expand contact section",children:l?e(C,{width:20,height:20}):e(B,{width:20,height:20})})]}),(l&&n||!n)&&e("div",{className:"desktop:mt-4 desktop:mb-0 mb-4 flex flex-col gap-2",role:"region","aria-labelledby":h,children:r?.contact?.contacts?.map(t=>o(m,{href:t?.link,className:"group flex items-start gap-2 no-underline",children:[e("img",{src:t?.icon?.url,loading:"lazy",alt:t?.icon?.alt,className:"size-5 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"}),e(d,{html:t?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] transition-colors duration-200 group-hover:text-white"})]},t?.id))}),e(L,{country:f||b,className:"desktop:hidden border-b border-[#3D3E3F]",isMobile:n,onChangeCountry:p?.country}),e("div",{className:"desktop:hidden mt-8",children:e(F,{title:c?.download?.title,apps:c?.download?.apps})}),!!r?.socials?.length&&e("div",{className:"mt-8 flex items-center gap-2",role:"list","aria-label":"Social media links",children:r?.socials?.map(t=>e(m,{href:u(t?.link,s,"ref=footer"),className:"group",role:"listitem","aria-label":t?.icon?.alt||"Social media",children:e("img",{src:t?.icon?.url,loading:"lazy",alt:t?.icon?.alt,className:"size-8 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"})},t?.id))}),e("div",{className:"mt-4 flex flex-wrap gap-2",role:"list","aria-label":"Payment methods",children:r?.payment?.map(t=>e(m,{href:u(t?.link,s,"ref=footer"),asChild:!t?.link,role:"listitem","aria-label":t?.icon?.alt||"Payment method",children:e("img",{src:t?.icon?.url,loading:"lazy",alt:t?.icon?.alt||"",className:"h-[28px] w-[44px] shrink-0"})},t?.id))})]})]})]})},Q=({data:a,isMobile:p,event:n,currentCountry:f,id:i="footer-brand"})=>{const{locale:s="us"}=k();return o("div",{id:i,className:"flex flex-col gap-4",children:[o("div",{className:"desktop:items-center desktop:flex desktop:gap-4",children:[e("div",{className:"laptop:flex-row aiui-dark laptop:items-center desktop:flex-[980] flex flex-col items-start gap-3",children:o("div",{className:"flex flex-wrap items-center gap-3",children:[e(m,{variant:"secondary",href:u(a?.brand?.link,s,"ref=footer"),asChild:!a?.brand?.link,children:e(d,{html:a?.brand?.currentBrand,"aria-hidden":"true"})}),!!a?.brand?.brands?.length&&a?.brand?.brands?.map((l,g)=>o(D,{children:[g<=0&&e("span",{className:"bg-lines h-3 w-px","aria-hidden":"true"}),e(m,{variant:"secondary",href:u(l?.link,s,"ref=footer"),className:"text-base leading-normal no-underline",children:e(d,{html:l?.icon,"aria-hidden":"true"})},l?.id)]},g))]})}),e(L,{country:f||a?.country,className:"desktop:flex-[316] desktop:block hidden",isMobile:p,onChangeCountry:n?.country})]}),e("div",{className:"h-px bg-[#3D3E3F]"}),o("div",{className:"laptop:flex-row desktop:gap-4 desktop:items-center flex flex-col items-start gap-1",children:[e(d,{html:a?.copyright?.label,className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#6D6D6F]"}),o("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1",children:[a?.policy?.policies?.map(l=>e(m,{href:u(l?.link,s,"ref=footer"),className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#B6B6BA] no-underline hover:text-white",children:l?.label},l?.id)),a?.policy?.cookies&&e("button",{"data-cc":"show-preferencesModal",onClick:n?.cookiesSet,className:"desktop:text-base text-xs font-bold leading-[1.4] text-[#B6B6BA] no-underline hover:text-white focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black","aria-label":`Cookie preferences: ${a?.policy?.cookies}`,children:a?.policy?.cookies})]})]})]})},N=({title:a,lists:p,className:n})=>{const{locale:f="us"}=k(),[i,s]=y(!1),[l,g]=y(!1),c=M({query:"(max-width: 1439px)"});w(()=>{g(c)},[c]);const r=`nav-section-${a?.replace(/\s+/g,"-").toLowerCase()}`;return o("div",{className:x("desktop:py-0 desktop:border-none border-t border-[#3D3E3F] py-4",n),children:[o("div",{className:"flex items-center justify-between",children:[e(d,{as:"p",html:a,className:"text-xl font-bold leading-[1.2] text-white",id:r}),l&&e("button",{onClick:()=>s(!i),"aria-expanded":i,"aria-controls":r,"aria-label":i?`Collapse ${a}`:`Expand ${a}`,className:"focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black",children:i?e(C,{width:20,height:20}):e(B,{width:20,height:20})})]}),(i&&l||!l)&&e("nav",{className:"mt-4 flex flex-col gap-2",role:"region","aria-labelledby":r,children:p?.map(b=>e(m,{href:u(b?.link,f,"ref=footer"),className:"no-underline",children:e(d,{html:b?.label,className:"desktop:text-base text-sm font-bold leading-[1.2] text-[#B6B6BA] hover:text-white"})},b?.id))})]})},F=({title:a,apps:p,className:n})=>{const{locale:f="us"}=k();return p?.length?o("div",{className:n,children:[e(d,{html:a,className:" text-xl font-bold leading-[1.2] text-white"}),e("div",{className:"mt-4 flex items-center gap-4",role:"list","aria-label":"Download apps",children:p?.map(i=>o(m,{href:u(i?.link,f,"ref=footer"),className:"group flex flex-col items-center gap-[6px]",role:"listitem","aria-label":i?.icon?.alt||i?.label||"Download app",children:[e("img",{src:i?.icon?.url,loading:"lazy",alt:i?.icon?.alt,className:"size-10 shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100"}),i?.label&&e(d,{html:i?.label,className:"text-xs font-bold text-[#999999] transition-colors duration-200 group-hover:text-white"})]},i?.id))})]}):null},L=({country:a,isMobile:p,className:n,onChangeCountry:f})=>e("div",{className:x("desktop:py-0 desktop:border-none border-t border-[#3D3E3F] py-4",n),children:o("button",{onClick:()=>f?.(),className:"flex w-full items-center justify-between focus:outline-none focus:ring-2 focus:ring-white focus:ring-offset-2 focus:ring-offset-black","aria-label":`Change country/region, current: ${a?.countryName||a?.country}`,children:[o("div",{className:"group flex items-center gap-2",children:[e(T,{width:20,height:20,className:"shrink-0 opacity-70 transition-opacity duration-200 group-hover:opacity-100","aria-hidden":"true"}),e(d,{as:"span",html:a?.countryName||a?.country,className:"desktop:text-[#B6B6BA] desktop:group-hover:text-white text-base font-bold leading-[1.4] text-white transition-colors duration-200"})]}),p&&e(E,{width:20,height:20,"aria-hidden":"true"})]})});var W=P($);export{W as default};
@@ -1,9 +1,10 @@
1
1
  /**
2
2
  * 移动端菜单项
3
3
  */
4
- export declare const MenuItem: ({ label, href, onClick, active, icon, className, }: {
4
+ export declare const MenuItem: ({ label, href, target, onClick, active, icon, className, }: {
5
5
  label: string;
6
6
  href?: string;
7
+ target?: string;
7
8
  onClick?: () => void;
8
9
  active?: boolean;
9
10
  icon?: string;
@@ -1 +1 @@
1
- import{Fragment as c,jsx as t,jsxs as r}from"react/jsx-runtime";import"react";import{Text as b,Link as p,Heading as d,Picture as u}from"../../components/index.js";import{cn as i,getLocalizedPath as f}from"../../helpers/utils.js";import{DownArrow as g}from"./icons/index.js";import{SeriesProductItem as x}from"./SidebarDropdown.js";import{useAiuiContext as v}from"../AiuiProvider/index.js";const $=({label:e,href:n,onClick:l,active:o,icon:s,className:a})=>{const m=r(c,{children:[r("div",{className:"flex items-center gap-4",children:[t(b,{html:e,className:i("text-sm font-bold leading-[1.4]",{underline:s})}),s&&t(b,{html:s,"aria-hidden":"true"})]}),t("svg",{className:`size-5 ${o?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:t("path",{d:"M9 5L16 12L9 19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});return n?t(p,{href:n,className:i("flex cursor-pointer items-center justify-between py-4 no-underline",a),onClick:l,children:m}):t("button",{onClick:l,className:i("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",a),"aria-expanded":o,children:m})},j=({matchSeriesMetadata:e,onSubSubCategoryItemClick:n,expanded:l})=>{const o=r(c,{children:[e?.label&&t(b,{html:e?.label,className:"text-sm font-bold leading-[1.4]"}),n&&t(g,{"aria-hidden":"true",className:i("size-5",{"rotate-180":l})})]});return n?t("button",{className:"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:n,"aria-expanded":l,children:o}):t("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:o})},z=({matchSeriesMetadata:e})=>{const{locale:n="us"}=v();return t("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!e?.series?.length&&e?.series?.map((l,o)=>r("div",{children:[l.label&&t(b,{html:l.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),r("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!e?.banner&&t(p,{asChild:!e?.banner?.href,href:f(e?.banner?.href,n),children:r("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[t(u,{source:e?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),r("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[t(d,{size:2,html:e?.banner?.title||"Buy in Guide",className:i("font-bold text-white",{"text-black":e?.banner?.theme==="dark"})}),t(b,{html:e?.banner?.desc||"20.000mAh",className:i("text-sm font-bold text-white",{"text-black":e?.banner?.theme==="dark"})})]})]})}),l.products?.map((s,a)=>t(x,{position:a,product:s,seriesLabel:e?.label,isCollection:e?.isCollection},`seriesProductItem-${l?.label||""}-${o}-${a}`))]})]},`seriesItem-${l?.label||""}-${o}`))})};export{$ as MenuItem,z as SubSubCategoryContentComp,j as SubSubCategoryItemComp};
1
+ import{Fragment as c,jsx as t,jsxs as r}from"react/jsx-runtime";import"react";import{Text as a,Link as p,Heading as u,Picture as f}from"../../components/index.js";import{cn as s,getLocalizedPath as g}from"../../helpers/utils.js";import{DownArrow as x}from"./icons/index.js";import{SeriesProductItem as v}from"./SidebarDropdown.js";import{useAiuiContext as h}from"../AiuiProvider/index.js";const j=({label:e,href:l,target:n,onClick:o,active:b,icon:i,className:d})=>{const m=r(c,{children:[r("div",{className:"flex items-center gap-4",children:[t(a,{html:e,className:s("text-sm font-bold leading-[1.4]",{underline:i})}),i&&t(a,{html:i,"aria-hidden":"true"})]}),t("svg",{className:`size-5 ${b?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:t("path",{d:"M9 5L16 12L9 19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});return l?t(p,{href:l,target:n,rel:n==="_blank"?"noopener noreferrer":void 0,className:s("flex cursor-pointer items-center justify-between py-4 no-underline",d),onClick:o,children:m}):t("button",{onClick:o,className:s("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",d),"aria-expanded":b,children:m})},z=({matchSeriesMetadata:e,onSubSubCategoryItemClick:l,expanded:n})=>{const o=r(c,{children:[e?.label&&t(a,{html:e?.label,className:"text-sm font-bold leading-[1.4]"}),l&&t(x,{"aria-hidden":"true",className:s("size-5",{"rotate-180":n})})]});return l?t("button",{className:"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:l,"aria-expanded":n,children:o}):t("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:o})},P=({matchSeriesMetadata:e})=>{const{locale:l="us"}=h();return t("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!e?.series?.length&&e?.series?.map((n,o)=>r("div",{children:[n.label&&t(a,{html:n.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),r("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!e?.banner&&t(p,{asChild:!e?.banner?.href,href:g(e?.banner?.href,l,"ref=navMenu"),children:r("div",{className:"rounded-sidebar-shelf relative overflow-hidden [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[t(f,{source:e?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),r("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[t(u,{size:2,html:e?.banner?.title||"Buy in Guide",className:s("font-bold text-white",{"text-black":e?.banner?.theme==="dark"})}),t(a,{html:e?.banner?.desc||"20.000mAh",className:s("text-sm font-bold text-white",{"text-black":e?.banner?.theme==="dark"})})]})]})}),n.products?.map((b,i)=>t(v,{position:i,product:b,seriesLabel:e?.label,isCollection:e?.isCollection},`seriesProductItem-${n?.label||""}-${o}-${i}`))]})]},`seriesItem-${n?.label||""}-${o}`))})};export{j as MenuItem,P as SubSubCategoryContentComp,z as SubSubCategoryItemComp};
@@ -1 +1 @@
1
- import{Fragment as I,jsx as t,jsxs as i}from"react/jsx-runtime";import{useCallback as z,useEffect as S,useMemo as B,useState as w}from"react";import{Button as R}from"../../components/index.js";import{HeaderNavigationMenu as g}from"./types.js";import{useNavContext as E}from"./NavProvider.js";import{ResourceSubSubCategoryItemComp as N,ResourceSubSubCategoryContentComp as k}from"./ResourceItem.js";import{useAiuiContext as _}from"../AiuiProvider/index.js";import{getLocalizedPath as M}from"../../helpers/utils.js";const A=({label:a,onClick:l,active:u})=>i("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:l,"aria-expanded":u,children:[t("div",{className:"flex items-center gap-1",children:t("span",{className:"text-sm font-bold leading-[1.4]",children:a})}),t("svg",{className:`size-5 ${u?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:t("path",{d:"M6.91009 4.41009C7.23553 4.08466 7.76304 4.08466 8.08848 4.41009L13.0885 9.41009C13.4139 9.73553 13.4139 10.263 13.0885 10.5885L8.08848 15.5885C7.76304 15.9139 7.23553 15.9139 6.91009 15.5885C6.58466 15.263 6.58466 14.7355 6.91009 14.4101L11.3209 9.99929L6.91009 5.58848C6.58466 5.26304 6.58466 4.73553 6.91009 4.41009Z",fill:"#080A0F"})})]}),G=({resourceCategoriesMetadata:a,resourcesMetadata:l})=>{const{currentMenu:u,setCurrentMenu:b,subSubCategory:r,setSubSubCategory:v,onSidebarNavClick:p,currentResourceMetadata:c,setCurrentResourceMetadata:m}=E(),{locale:d="us"}=_(),[C,L]=w([]),[f,x]=w([]);S(()=>{a?.subcategories?.length&&L(a?.subcategories?.map((n,e)=>({index:e,open:!1})))},[a]),S(()=>{r?.subSubCategories?.length&&x(r?.subSubCategories?.map((n,e)=>({index:e,open:e===0})))},[r]);const h=z(n=>{v?.(n);const e=l?.find(s=>n?.label?.toLowerCase()===s.label?.toLowerCase())||{};b&&b(g.Third),m&&m(e)},[l,b,v,m]);return B(()=>{switch(u){case g.Secondary:return i("div",{className:"tablet:px-8 laptop:px-16 flex h-full flex-col gap-8 p-4",children:[t("div",{children:a?.subcategories?.map((n,e)=>t("div",{children:t(A,{label:n?.label,active:C.find(s=>s.index===e)?.open,onClick:()=>{h(n),p?.(n,e)}})},`${n.label}-${e}`))}),i("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[a?.primary&&t(R,{as:"a",href:`${M(a?.primary?.url,d)}?ref=${a?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:a?.primary?.label}),a?.secondary&&t(R,{as:"a",href:M(a?.secondary?.url,d),variant:"link",size:"lg",className:"tablet:w-auto tablet:px-0 w-full py-0 text-base",children:a?.secondary?.label})]})]});case g.Third:return t("div",{className:"tablet:px-8 laptop:px-16 p-4",children:r?.subSubCategories?r?.subSubCategories?.map((n,e)=>{const s=l?.find(o=>o.label.toLowerCase()===n?.label?.toLowerCase())||{};return i("div",{children:[Reflect.ownKeys(n).length>0&&t(N,{matchResourcesMetadata:s,onSubSubCategoryItemClick:()=>{p?.(n,e),x(o=>o.map((y,$)=>({...y,open:$===e?!y.open:y.open})))},expanded:!!f?.find(o=>o.index===e)?.open}),f?.find(o=>o.index===e)?.open&&t(k,{matchResourcesMetadata:s})]},`${n.label}-${e}`)}):i(I,{children:[Reflect.ownKeys(c).length>0&&t(N,{matchResourcesMetadata:c}),t(k,{matchResourcesMetadata:c})]})});default:return null}},[u,a,l,C,f,r,c,h,p,d])};export{G as MobileResourceSidebarMenu};
1
+ import{Fragment as I,jsx as t,jsxs as i}from"react/jsx-runtime";import{useCallback as z,useEffect as S,useMemo as B,useState as w}from"react";import{Button as R}from"../../components/index.js";import{HeaderNavigationMenu as v}from"./types.js";import{useNavContext as E}from"./NavProvider.js";import{ResourceSubSubCategoryItemComp as N,ResourceSubSubCategoryContentComp as k}from"./ResourceItem.js";import{useAiuiContext as _}from"../AiuiProvider/index.js";import{getLocalizedPath as M}from"../../helpers/utils.js";const A=({label:a,onClick:l,active:u})=>i("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:l,"aria-expanded":u,children:[t("div",{className:"flex items-center gap-1",children:t("span",{className:"text-sm font-bold leading-[1.4]",children:a})}),t("svg",{className:`size-5 ${u?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:t("path",{d:"M6.91009 4.41009C7.23553 4.08466 7.76304 4.08466 8.08848 4.41009L13.0885 9.41009C13.4139 9.73553 13.4139 10.263 13.0885 10.5885L8.08848 15.5885C7.76304 15.9139 7.23553 15.9139 6.91009 15.5885C6.58466 15.263 6.58466 14.7355 6.91009 14.4101L11.3209 9.99929L6.91009 5.58848C6.58466 5.26304 6.58466 4.73553 6.91009 4.41009Z",fill:"#080A0F"})})]}),G=({resourceCategoriesMetadata:a,resourcesMetadata:l})=>{const{currentMenu:u,setCurrentMenu:b,subSubCategory:r,setSubSubCategory:g,onSidebarNavClick:p,currentResourceMetadata:c,setCurrentResourceMetadata:m}=E(),{locale:d="us"}=_(),[C,L]=w([]),[f,x]=w([]);S(()=>{a?.subcategories?.length&&L(a?.subcategories?.map((n,e)=>({index:e,open:!1})))},[a]),S(()=>{r?.subSubCategories?.length&&x(r?.subSubCategories?.map((n,e)=>({index:e,open:e===0})))},[r]);const h=z(n=>{g?.(n);const e=l?.find(s=>n?.label?.toLowerCase()===s.label?.toLowerCase())||{};b&&b(v.Third),m&&m(e)},[l,b,g,m]);return B(()=>{switch(u){case v.Secondary:return i("div",{className:"tablet:px-8 laptop:px-16 flex h-full flex-col gap-8 p-4",children:[t("div",{children:a?.subcategories?.map((n,e)=>t("div",{children:t(A,{label:n?.label,active:C.find(s=>s.index===e)?.open,onClick:()=>{h(n),p?.(n,e)}})},`${n.label}-${e}`))}),i("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[a?.primary&&t(R,{as:"a",href:M(a?.primary?.url,d,`ref=${a?.primary?.label}_shopall`),variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:a?.primary?.label}),a?.secondary&&t(R,{as:"a",href:M(a?.secondary?.url,d,"ref=navMenu"),variant:"link",size:"lg",className:"link-btn tablet:w-auto tablet:px-0 w-full py-0 text-base",children:a?.secondary?.label})]})]});case v.Third:return t("div",{className:"tablet:px-8 laptop:px-16 p-4",children:r?.subSubCategories?r?.subSubCategories?.map((n,e)=>{const s=l?.find(o=>o.label.toLowerCase()===n?.label?.toLowerCase())||{};return i("div",{children:[Reflect.ownKeys(n).length>0&&t(N,{matchResourcesMetadata:s,onSubSubCategoryItemClick:()=>{p?.(n,e),x(o=>o.map((y,$)=>({...y,open:$===e?!y.open:y.open})))},expanded:!!f?.find(o=>o.index===e)?.open}),f?.find(o=>o.index===e)?.open&&t(k,{matchResourcesMetadata:s})]},`${n.label}-${e}`)}):i(I,{children:[Reflect.ownKeys(c).length>0&&t(N,{matchResourcesMetadata:c}),t(k,{matchResourcesMetadata:c})]})});default:return null}},[u,a,l,C,f,r,c,h,p,d])};export{G as MobileResourceSidebarMenu};
@@ -1 +1 @@
1
- import{Fragment as M,jsx as l,jsxs as u}from"react/jsx-runtime";import{useCallback as R,useEffect as L,useMemo as T,useState as $}from"react";import{Button as d,Text as D,Link as K}from"../../components/index.js";import{HeaderNavigationMenu as h}from"./types.js";import{useNavContext as P}from"./NavProvider.js";import{MenuItem as A,SubSubCategoryItemComp as z,SubSubCategoryContentComp as B}from"./MobileMenuComponents.js";import{useAiuiContext as F}from"../AiuiProvider/index.js";import{getLocalizedPath as p}from"../../helpers/utils.js";const X=({sidebarCategoriesMetadata:r,seriesMetadata:b})=>{const{currentMenu:x,setCurrentMenu:y,subSubCategory:i,setSubSubCategory:C,setCurrentSeriesMetadata:f,currentSeriesMetadata:s,buildProps:m,onSidebarNavClick:S}=P(),{locale:c="us"}=F(),[w,_]=$([]),[v,N]=$([]);L(()=>{r?.subcategories?.length&&_(r?.subcategories?.map((e,a)=>({index:a,open:!1})))},[r]),L(()=>{i?.subSubCategories?.length&&N(i?.subSubCategories?.map((e,a)=>({index:a,open:a===0})))},[i]);const k=R((e,a)=>{y&&y(h.Third),C?.(e);const o=b?.find(n=>a!==void 0?e?.subSubCategories?.[a]?.label?.toLowerCase()===n.label?.toLowerCase():e?.label?.toLowerCase()===n.label?.toLowerCase())||{};if(e?.collections){const n=m?.categories?.[e?.collections]||{};f?.({label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,series:[{products:n?.products}]})}else f?.(o)},[b,y,C,f,m?.categories]);return T(()=>{switch(x){case h.Secondary:return u("div",{className:"tablet:px-8 laptop:px-16 flex h-full flex-col gap-8 p-4",children:[u("div",{children:[r?.subcategories?.map((e,a)=>l("div",{children:l(A,{label:e?.label,active:w.find(o=>o.index===a)?.open,onClick:()=>{k(e),S?.(e,a)}})},`${e.label}-${a}`)),r?.guide?.label&&l(K,{href:p(r?.guide?.url,c),children:l("div",{className:"mt-4",children:l(D,{html:r?.guide?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]}),u("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[r?.primary&&l(d,{as:"a",href:`${p(r?.primary?.url,c)}?ref=${r?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:r?.primary?.label}),r?.secondary&&l(d,{as:"a",href:p(r?.secondary?.url,c),variant:"link",size:"lg",className:"tablet:w-auto tablet:px-0 w-full py-0 text-base",children:r?.secondary?.label})]})]});case h.Third:return l("div",{className:"tablet:px-8 laptop:px-16 p-4",children:i?.subSubCategories?i?.subSubCategories?.map((e,a)=>{const o=b?.find(t=>t.label.toLowerCase()===e?.label?.toLowerCase())||{};let n={};if(e?.collections){const t=m?.categories?.[e?.collections]||{};n={label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,series:[{products:t?.products}]}}else n=o;return u("div",{children:[Reflect.ownKeys(e).length>0&&l(z,{matchSeriesMetadata:n,onSubSubCategoryItemClick:()=>{S?.(e,a),N(t=>t.map((g,E)=>({...g,open:E===a?!g.open:g.open})))},expanded:!!v?.find(t=>t.index===a)?.open}),v?.find(t=>t.index===a)?.open&&u(M,{children:[l(B,{matchSeriesMetadata:n}),n?.primary&&l("div",{className:"my-4 text-center",children:l(d,{as:"a",href:p(n?.primary?.url,c),className:"text-base leading-[1.2] no-underline",variant:"secondary",size:"base",children:n?.primary?.label})})]})]},`${e.label}-${a}`)}):u(M,{children:[Reflect.ownKeys(s).length>0&&l(z,{matchSeriesMetadata:s}),l(B,{matchSeriesMetadata:s}),s?.primary&&l("div",{className:"my-4 text-center ",children:l(d,{as:"a",href:`${p(s?.primary?.url,c)}?ref=${s?.label}_viewmore`,variant:"secondary",size:"base",className:"text-base leading-[1.2] no-underline",children:s?.primary?.label})})]})});default:return null}},[x,r,b,w,v,i,s,m?.categories,k,S,c])};export{X as MobileSidebarMenu};
1
+ import{Fragment as B,jsx as l,jsxs as c}from"react/jsx-runtime";import{useCallback as R,useEffect as L,useMemo as T,useState as M}from"react";import{Button as d,Text as D,Link as K}from"../../components/index.js";import{HeaderNavigationMenu as h}from"./types.js";import{useNavContext as P}from"./NavProvider.js";import{MenuItem as A,SubSubCategoryItemComp as $,SubSubCategoryContentComp as z}from"./MobileMenuComponents.js";import{useAiuiContext as F}from"../AiuiProvider/index.js";import{getLocalizedPath as p}from"../../helpers/utils.js";const X=({sidebarCategoriesMetadata:n,seriesMetadata:b})=>{const{currentMenu:x,setCurrentMenu:y,subSubCategory:i,setSubSubCategory:C,setCurrentSeriesMetadata:f,currentSeriesMetadata:s,buildProps:m,onSidebarNavClick:v}=P(),{locale:u="us"}=F(),[w,_]=M([]),[S,N]=M([]);L(()=>{n?.subcategories?.length&&_(n?.subcategories?.map((e,a)=>({index:a,open:!1})))},[n]),L(()=>{i?.subSubCategories?.length&&N(i?.subSubCategories?.map((e,a)=>({index:a,open:a===0})))},[i]);const k=R((e,a)=>{y&&y(h.Third),C?.(e);const t=b?.find(r=>a!==void 0?e?.subSubCategories?.[a]?.label?.toLowerCase()===r.label?.toLowerCase():e?.label?.toLowerCase()===r.label?.toLowerCase())||{};if(e?.collections){const r=m?.categories?.[e?.collections]||{};f?.({label:t?.label,isCollection:!0,banner:t?.banner,primary:t?.primary,series:[{products:r?.products}]})}else f?.(t)},[b,y,C,f,m?.categories]);return T(()=>{switch(x){case h.Secondary:return c("div",{className:"tablet:px-8 laptop:px-16 flex h-full flex-col gap-8 p-4",children:[c("div",{children:[n?.subcategories?.map((e,a)=>l("div",{children:l(A,{label:e?.label,active:w.find(t=>t.index===a)?.open,onClick:()=>{k(e),v?.(e,a)}})},`${e.label}-${a}`)),n?.guide?.label&&l(K,{href:p(n?.guide?.url,u,"ref=navMenu"),children:l("div",{className:"mt-4",children:l(D,{html:n?.guide?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]}),c("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[n?.primary&&l(d,{as:"a",href:p(n?.primary?.url,u,`ref=${n?.primary?.label}_shopall`),variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:n?.primary?.label}),n?.secondary&&l(d,{as:"a",href:p(n?.secondary?.url,u,"ref=navMenu"),variant:"link",size:"lg",className:"link-btn tablet:w-auto tablet:px-0 w-full py-0 text-base",children:n?.secondary?.label})]})]});case h.Third:return l("div",{className:"tablet:px-8 laptop:px-16 p-4",children:i?.subSubCategories?i?.subSubCategories?.map((e,a)=>{const t=b?.find(o=>o.label.toLowerCase()===e?.label?.toLowerCase())||{};let r={};if(e?.collections){const o=m?.categories?.[e?.collections]||{};r={label:t?.label,isCollection:!0,banner:t?.banner,primary:t?.primary,series:[{products:o?.products}]}}else r=t;return c("div",{children:[Reflect.ownKeys(e).length>0&&l($,{matchSeriesMetadata:r,onSubSubCategoryItemClick:()=>{v?.(e,a),N(o=>o.map((g,E)=>({...g,open:E===a?!g.open:g.open})))},expanded:!!S?.find(o=>o.index===a)?.open}),S?.find(o=>o.index===a)?.open&&c(B,{children:[l(z,{matchSeriesMetadata:r}),r?.primary&&l("div",{className:"my-4 text-center",children:l(d,{as:"a",href:p(r?.primary?.url,u,"ref=navMenu"),className:"text-base leading-[1.2] no-underline",variant:"secondary",size:"base",children:r?.primary?.label})})]})]},`${e.label}-${a}`)}):c(B,{children:[Reflect.ownKeys(s).length>0&&l($,{matchSeriesMetadata:s}),l(z,{matchSeriesMetadata:s}),s?.primary&&l("div",{className:"my-4 text-center ",children:l(d,{as:"a",href:p(s?.primary?.url,u,`ref=${s?.label}_viewmore`),variant:"secondary",size:"base",className:"text-base leading-[1.2] no-underline",children:s?.primary?.label})})]})});default:return null}},[x,n,b,w,S,i,s,m?.categories,k,v,u])};export{X as MobileSidebarMenu};
@@ -1 +1 @@
1
- import{jsx as a}from"react/jsx-runtime";import"react";import{MenuItem as l}from"./MobileMenuComponents.js";import{useAiuiContext as i}from"../AiuiProvider/index.js";import{getLocalizedPath as p}from"../../helpers/utils.js";const d=({supportsMetadata:e})=>{const{locale:t="us"}=i();return a("div",{className:"tablet:px-8 laptop:px-16 p-4",children:e?.map(o=>a(l,{href:p(o.url,t),label:o.label,onClick:()=>{}},o.id))})};export{d as MobileSupportMenu};
1
+ import{jsx as o}from"react/jsx-runtime";import"react";import{MenuItem as l}from"./MobileMenuComponents.js";import{useAiuiContext as r}from"../AiuiProvider/index.js";import{getLocalizedPath as i}from"../../helpers/utils.js";const f=({supportsMetadata:a})=>{const{locale:t="us"}=r();return o("div",{className:"tablet:px-8 laptop:px-16 p-4",children:a?.map(e=>o(l,{href:i(e.url,t,"ref=navMenu"),label:e.label,onClick:()=>{}},e.id))})};export{f as MobileSupportMenu};
@@ -1 +1 @@
1
- import{Fragment as c,jsx as a,jsxs as t}from"react/jsx-runtime";import{useRef as x}from"react";import{Container as u,Text as d,Link as p,Picture as f,Button as b,Badge as v}from"../../components/index.js";import h from"./CompanyStatsBanner/index.js";import{cn as n,getLocalizedPath as m}from"../../helpers/utils.js";import{useAiuiContext as g}from"../AiuiProvider/index.js";import{useNavContext as N}from"./NavProvider.js";const L=({multicolMetadata:e,showStatsBanner:i,statsBannerData:o})=>{const r=x(null);return a("div",{ref:r,className:"bg-white py-4",children:a(u,{childClassName:"bg-white",className:"h-full",children:t("div",{className:"laptop:gap-4 flex flex-col gap-3",children:[i&&a(h,{data:o}),a("div",{className:"flex gap-4",children:e?.map((s,l)=>a("div",{className:"w-1/4",children:a(k,{item:s})},`multicolItem-${s?.label}-${l}`))})]})})})},k=({item:e,allPicture:i})=>{const{locale:o="us"}=g(),{componentOverrides:r}=N(),s=r?.badge?.variant;return t(c,{children:[e?.columns&&t(c,{children:[a(d,{html:e.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),a("div",{className:"mt-2 flex flex-col",children:e.columns?.map(l=>t("div",{className:"flex items-center gap-1 py-2",children:[a(p,{href:`${m(l.url,o)}?ref=navMenu`,asChild:!l.url,className:"text-sm font-bold leading-[1.4] no-underline",children:l.label}),l?.badge&&a(v,{size:"sm",variant:s,children:l?.badge||"badge"})]},l.label))})]}),e?.imageUrl&&a("div",{className:n("rounded-image-text laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-[346px] laptop:max-w-[440px] desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",{"tablet:max-w-none laptop:max-w-none":i}),children:a(p,{href:`${m(e.url,o)}?ref=navMenu`,asChild:!e.url,children:t("div",{className:"size-full",children:[a(f,{source:e.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),t("div",{className:"absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",children:[a(d,{html:e.title,className:n("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":e?.theme==="dark"})}),e.subtitle&&a(d,{html:e.subtitle,className:n("text-sm font-bold leading-[1.4] text-white",{"text-black":e?.theme==="dark"})}),e?.primary?.label&&a(b,{as:"a",href:m(e?.primary?.url,o),variant:"link",size:"lg",iconClassName:"size-4 lg-desktop:size-5",className:n("mr-auto !p-0 text-sm font-bold leading-[1.4] text-white",{"text-black":e?.theme==="dark"}),children:e?.primary?.label||"more"})]})]})})})]})};export{L as MulticolDropdown,k as MulticolItem};
1
+ import{Fragment as c,jsx as a,jsxs as t}from"react/jsx-runtime";import{useRef as x}from"react";import{Container as u,Text as d,Link as p,Picture as f,Button as b,Badge as h}from"../../components/index.js";import v from"./CompanyStatsBanner/index.js";import{cn as s,getLocalizedPath as m}from"../../helpers/utils.js";import{useAiuiContext as g}from"../AiuiProvider/index.js";import{useNavContext as N}from"./NavProvider.js";const L=({multicolMetadata:e,showStatsBanner:i,statsBannerData:o})=>{const r=x(null);return a("div",{ref:r,className:"bg-white py-4",children:a(u,{childClassName:"bg-white",className:"h-full",children:t("div",{className:"laptop:gap-4 flex flex-col gap-3",children:[i&&a(v,{data:o}),a("div",{className:"flex gap-4",children:e?.map((n,l)=>a("div",{className:"w-1/4",children:a(k,{item:n})},`multicolItem-${n?.label}-${l}`))})]})})})},k=({item:e,allPicture:i})=>{const{locale:o="us"}=g(),{componentOverrides:r}=N(),n=r?.badge?.variant;return t(c,{children:[e?.columns&&t(c,{children:[a(d,{html:e.label,as:"div",className:"my-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),a("div",{className:"mt-2 flex flex-col",children:e.columns?.map(l=>t("div",{className:"flex items-center gap-1 py-2",children:[a(p,{href:m(l.url,o,"ref=navMenu"),asChild:!l.url,className:"text-sm font-bold leading-[1.4] no-underline",children:l.label}),l?.badge&&a(h,{size:"xs",variant:n,children:l?.badge||"badge"})]},l.label))})]}),e?.imageUrl&&a("div",{className:s("rounded-image-text laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-[346px] laptop:max-w-[440px] desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",{"tablet:max-w-none laptop:max-w-none":i}),children:a(p,{href:m(e.url,o,"ref=navMenu"),asChild:!e.url,children:t("div",{className:"size-full",children:[a(f,{source:e.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),t("div",{className:s("absolute bottom-4 left-4 z-10 flex flex-col justify-end no-underline",{"aiui-dark":e?.theme==="light"}),children:[a(d,{html:e.title,className:s("lg-desktop:text-2xl text-xl font-bold leading-[1.2] text-white",{"text-black":e?.theme==="dark"})}),e.subtitle&&a(d,{html:e.subtitle,className:s("text-sm font-bold leading-[1.4] text-white",{"text-black":e?.theme==="dark"})}),e?.primary?.label&&a(b,{as:"a",href:m(e?.primary?.url,o,"ref=navMenu"),variant:"link",size:"lg",iconClassName:"size-4 lg-desktop:size-5",className:s("link-btn mr-auto !p-0 text-sm font-bold leading-[1.4] text-white",{"text-black":e?.theme==="dark"}),children:e?.primary?.label||"more"})]})]})})})]})};export{L as MulticolDropdown,k as MulticolItem};
@@ -1 +1 @@
1
- import{Fragment as c,jsx as e,jsxs as o}from"react/jsx-runtime";import{Picture as d,Text as i,Link as m}from"../../components/index.js";import{cn as s,getLocalizedPath as r}from"../../helpers/utils.js";import{useAiuiContext as h}from"../AiuiProvider/index.js";const f=({resource:t})=>{const{locale:l="us"}=h();return e("div",{className:"laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-none desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",children:e(m,{href:r(t?.href,l),className:"no-underline hover:text-current",children:o("div",{className:"relative h-full overflow-hidden [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(d,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),o("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(i,{as:"p",html:t?.title,className:s("text-xl font-bold leading-[1.2]",{"text-white":t?.theme!=="dark","text-black":t?.theme==="dark"})}),t?.desc&&e(i,{html:t?.desc,className:s("text-sm font-bold leading-[1.4]",{"text-white":t?.theme!=="dark","text-black":t?.theme==="dark"})})]})]})})})},b=({matchResourcesMetadata:t,onSubSubCategoryItemClick:l,expanded:a})=>{const n=o(c,{children:[t?.label&&e(i,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),l&&e("svg",{className:s("size-5",{"rotate-180":a}),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M6.91009 4.41009C7.23553 4.08466 7.76304 4.08466 8.08848 4.41009L13.0885 9.41009C13.4139 9.73553 13.4139 10.263 13.0885 10.5885L8.08848 15.5885C7.76304 15.9139 7.23553 15.9139 6.91009 15.5885C6.58466 15.263 6.58466 14.7355 6.91009 14.4101L11.3209 9.99929L6.91009 5.58848C6.58466 5.26304 6.58466 4.73553 6.91009 4.41009Z",fill:"#080A0F"})})]});return l?e("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:l,"aria-expanded":a,children:n}):e("div",{className:"flex items-center justify-between py-4",children:n})},g=({matchResourcesMetadata:t})=>{const{locale:l="us"}=h();return e("div",{className:"tablet:grid tablet:grid-cols-2 flex grid-cols-1 flex-col gap-4",children:!!t?.resources?.length&&t?.resources?.map((a,n)=>e(m,{href:r(a?.href,l),className:"no-underline hover:text-current",children:e("div",{className:"laptop:h-[280px] tablet:max-w-none relative h-[240px] max-w-[358px]",children:o("div",{className:"relative h-full overflow-hidden",children:[e(d,{source:a.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),o("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(i,{html:a?.title,as:"p",className:s("text-xl font-bold leading-[1.2]",{"text-white":a?.theme!=="dark","text-black":a?.theme==="dark"})}),a?.desc&&e(i,{html:a?.desc,className:s("text-sm font-bold leading-[1.4]",{"text-white":a?.theme!=="dark","text-black":a?.theme==="dark"})})]})]})})},`resourceItem-${n}`))})};export{f as ResourceItem,g as ResourceSubSubCategoryContentComp,b as ResourceSubSubCategoryItemComp};
1
+ import{Fragment as c,jsx as e,jsxs as o}from"react/jsx-runtime";import{Picture as d,Text as i,Link as r}from"../../components/index.js";import{cn as s,getLocalizedPath as m}from"../../helpers/utils.js";import{useAiuiContext as h}from"../AiuiProvider/index.js";const f=({resource:t})=>{const{locale:l="us"}=h();return e("div",{className:"laptop:h-[280px] desktop:h-[224px] lg-desktop:h-[280px] tablet:max-w-none desktop:w-full relative h-[240px] max-w-[358px] overflow-hidden",children:e(r,{href:m(t?.href,l,"ref=navMenu"),className:"no-underline hover:text-current",children:o("div",{className:"relative h-full overflow-hidden [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(d,{source:t.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),o("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(i,{as:"p",html:t?.title,className:s("text-xl font-bold leading-[1.2]",{"text-white":t?.theme!=="dark","text-black":t?.theme==="dark"})}),t?.desc&&e(i,{html:t?.desc,className:s("text-sm font-bold leading-[1.4]",{"text-white":t?.theme!=="dark","text-black":t?.theme==="dark"})})]})]})})})},b=({matchResourcesMetadata:t,onSubSubCategoryItemClick:l,expanded:a})=>{const n=o(c,{children:[t?.label&&e(i,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),l&&e("svg",{className:s("size-5",{"rotate-180":a}),viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:e("path",{d:"M6.91009 4.41009C7.23553 4.08466 7.76304 4.08466 8.08848 4.41009L13.0885 9.41009C13.4139 9.73553 13.4139 10.263 13.0885 10.5885L8.08848 15.5885C7.76304 15.9139 7.23553 15.9139 6.91009 15.5885C6.58466 15.263 6.58466 14.7355 6.91009 14.4101L11.3209 9.99929L6.91009 5.58848C6.58466 5.26304 6.58466 4.73553 6.91009 4.41009Z",fill:"#080A0F"})})]});return l?e("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:l,"aria-expanded":a,children:n}):e("div",{className:"flex items-center justify-between py-4",children:n})},u=({matchResourcesMetadata:t})=>{const{locale:l="us"}=h();return e("div",{className:"tablet:grid tablet:grid-cols-2 flex grid-cols-1 flex-col gap-4",children:!!t?.resources?.length&&t?.resources?.map((a,n)=>e(r,{href:m(a?.href,l,"ref=navMenu"),className:"no-underline hover:text-current",children:e("div",{className:"laptop:h-[280px] tablet:max-w-none relative h-[240px] max-w-[358px]",children:o("div",{className:"relative h-full overflow-hidden",children:[e(d,{source:a.imageUrl,width:404,height:280,className:"size-full",imgClassName:"object-cover h-full hover:scale-105 transition-all duration-300"}),o("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[e(i,{html:a?.title,as:"p",className:s("text-xl font-bold leading-[1.2]",{"text-white":a?.theme!=="dark","text-black":a?.theme==="dark"})}),a?.desc&&e(i,{html:a?.desc,className:s("text-sm font-bold leading-[1.4]",{"text-white":a?.theme!=="dark","text-black":a?.theme==="dark"})})]})]})})},`resourceItem-${n}`))})};export{f as ResourceItem,u as ResourceSubSubCategoryContentComp,b as ResourceSubSubCategoryItemComp};
@@ -1 +1 @@
1
- import{jsx as r,jsxs as i}from"react/jsx-runtime";import R,{useCallback as v,useEffect as F,useMemo as L,useRef as $,useState as S}from"react";import{Button as h,Container as D,Text as w}from"../../components/index.js";import{cn as m,getLocalizedPath as N}from"../../helpers/utils.js";import{DownArrow as E}from"./icons/index.js";import{useNavContext as z}from"./NavProvider.js";import{ResourceItem as O}from"./ResourceItem.js";import{useAiuiContext as B}from"../AiuiProvider/index.js";const I=R.memo(({resourceCategoriesMetadata:s,resourcesMetadata:u})=>{const{onSidebarNavClick:f}=z(),[c,b]=S([]),[d,p]=S(-1),C=$(null),{locale:y="us"}=B(),g=v(()=>{const e=s?.subcategories;if(!e?.length)return;const o=e.findIndex(t=>!!t?.subSubCategories),n=e.findIndex(t=>!t?.subSubCategories),a=e.map((t,l)=>({index:l,open:o===l||n===l}));b(a)},[s]);F(()=>{g()},[g]);const x=L(()=>{const e=s?.subcategories?.[c?.find(n=>n.open)?.index||0],o=u?.find(n=>n?.label?.toLowerCase()===e?.label?.toLowerCase())||{};if(e?.subSubCategories){const n=e?.subSubCategories?.[d];return u?.find(t=>t?.label?.toLowerCase()===n?.label?.toLowerCase())||{}}else return o},[s,c,d,u]),k=v((e,o)=>{o?.subSubCategories?.length>0?p(0):p(-1),b(n=>n.map((a,t)=>({...a,open:t===e?!a.open:!1})))},[]),A=(e,o)=>{b(n=>n.map(a=>a.index===e?{...a,open:!0}:{...a,open:!1})),p(o)};return i(D,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[i("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:C,children:[r("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:s?.subcategories?.map((e,o)=>{const n=Array.isArray(e?.subSubCategories)&&e?.subSubCategories?.length>0,a=c?.find(t=>t.index===o)?.open;return i("div",{children:[i("button",{className:m("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!n&&a}),onClick:()=>{k(o,e),f?.(e,o)},"aria-expanded":n?a:void 0,"aria-haspopup":n?"true":void 0,children:[r(w,{html:e.label,className:"p-4 text-sm font-bold leading-[1.4]"}),n&&r(E,{"aria-hidden":"true",className:m("size-4",{"rotate-180":a})})]}),a&&r("div",{className:"flex flex-col",role:"menu",children:e.subSubCategories?.map((t,l)=>r("button",{onClick:()=>{A(o,l),f?.(t,l)},className:m("rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":d===l}),role:"menuitem","aria-label":t.label,children:r(w,{html:t.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${o}-${l}`))})]},`subcategoryItem-${o}`)})}),s&&r("div",{className:"flex",children:i("div",{className:"flex flex-col gap-4",children:[s?.primary&&r(h,{as:"a",href:`${N(s?.primary?.url,y)}?ref=${s?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:s?.primary?.label}),s?.secondary&&r(h,{as:"a",href:N(s?.secondary?.url,y),variant:"link",size:"lg",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:s?.secondary?.label})]})})]}),r("div",{className:"desktop:h-[509px] flex-1 overflow-y-auto py-4",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:r("div",{className:"grid grid-cols-3 gap-4 ",children:Array.isArray(x?.resources)?x.resources.map((e,o)=>r(O,{resource:e},`resourceItem-${o}`)):null})})]})});I.displayName="ResourceSidebarDropdown";export{I as ResourceSidebarDropdown};
1
+ import{jsx as r,jsxs as i}from"react/jsx-runtime";import R,{useCallback as v,useEffect as F,useMemo as L,useRef as D,useState as S}from"react";import{Button as h,Container as E,Text as w}from"../../components/index.js";import{cn as m,getLocalizedPath as N}from"../../helpers/utils.js";import{DownArrow as $}from"./icons/index.js";import{useNavContext as z}from"./NavProvider.js";import{ResourceItem as O}from"./ResourceItem.js";import{useAiuiContext as B}from"../AiuiProvider/index.js";const I=R.memo(({resourceCategoriesMetadata:s,resourcesMetadata:u})=>{const{onSidebarNavClick:f}=z(),[c,b]=S([]),[d,p]=S(-1),k=D(null),{locale:y="us"}=B(),g=v(()=>{const e=s?.subcategories;if(!e?.length)return;const n=e.findIndex(t=>!!t?.subSubCategories),o=e.findIndex(t=>!t?.subSubCategories),a=e.map((t,l)=>({index:l,open:n===l||o===l}));b(a)},[s]);F(()=>{g()},[g]);const x=L(()=>{const e=s?.subcategories?.[c?.find(o=>o.open)?.index||0],n=u?.find(o=>o?.label?.toLowerCase()===e?.label?.toLowerCase())||{};if(e?.subSubCategories){const o=e?.subSubCategories?.[d];return u?.find(t=>t?.label?.toLowerCase()===o?.label?.toLowerCase())||{}}else return n},[s,c,d,u]),C=v((e,n)=>{n?.subSubCategories?.length>0?p(0):p(-1),b(o=>o.map((a,t)=>({...a,open:t===e?!a.open:!1})))},[]),A=(e,n)=>{b(o=>o.map(a=>a.index===e?{...a,open:!0}:{...a,open:!1})),p(n)};return i(E,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[i("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:k,children:[r("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:s?.subcategories?.map((e,n)=>{const o=Array.isArray(e?.subSubCategories)&&e?.subSubCategories?.length>0,a=c?.find(t=>t.index===n)?.open;return i("div",{children:[i("button",{className:m("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!o&&a}),onClick:()=>{C(n,e),f?.(e,n)},"aria-expanded":o?a:void 0,"aria-haspopup":o?"true":void 0,children:[r(w,{html:e.label,className:"p-4 text-sm font-bold leading-[1.4]"}),o&&r($,{"aria-hidden":"true",className:m("size-4",{"rotate-180":a})})]}),a&&r("div",{className:"flex flex-col",role:"menu",children:e.subSubCategories?.map((t,l)=>r("button",{onClick:()=>{A(n,l),f?.(t,l)},className:m("rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":d===l}),role:"menuitem","aria-label":t.label,children:r(w,{html:t.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${n}-${l}`))})]},`subcategoryItem-${n}`)})}),s&&r("div",{className:"flex",children:i("div",{className:"flex flex-col gap-4",children:[s?.primary&&r(h,{as:"a",href:N(s?.primary?.url,y,`ref=${s?.primary?.label}_shopall`),variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:s?.primary?.label}),s?.secondary&&r(h,{as:"a",href:N(s?.secondary?.url,y,"ref=navMenu"),variant:"link",size:"lg",className:"link-btn lg-desktop:text-base justify-start !p-0 text-sm",children:s?.secondary?.label})]})})]}),r("div",{className:"desktop:h-[509px] flex-1 overflow-y-auto py-4",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:r("div",{className:"grid grid-cols-3 gap-4 ",children:Array.isArray(x?.resources)?x.resources.map((e,n)=>r(O,{resource:e},`resourceItem-${n}`)):null})})]})});I.displayName="ResourceSidebarDropdown";export{I as ResourceSidebarDropdown};
@@ -3,9 +3,10 @@ import React from 'react';
3
3
  * 侧边栏下拉
4
4
  * @param categoriesItem 分类项
5
5
  */
6
- export declare const SidebarDropdown: React.MemoExoticComponent<({ sidebarCategoriesMetadata, seriesMetadata }: {
6
+ export declare const SidebarDropdown: React.MemoExoticComponent<({ sidebarCategoriesMetadata, seriesMetadata, navigationTitle, }: {
7
7
  sidebarCategoriesMetadata: any;
8
8
  seriesMetadata: any;
9
+ navigationTitle?: string;
9
10
  }) => import("react/jsx-runtime").JSX.Element>;
10
11
  /**
11
12
  * 系列产品项组件
@@ -1 +1 @@
1
- import{Fragment as U,jsx as t,jsxs as c}from"react/jsx-runtime";import j,{useCallback as D,useEffect as E,useMemo as $,useRef as P,useState as _}from"react";import{Button as F,Container as O,Text as p,Link as L,Heading as R,Picture as V,Badge as W}from"../../components/index.js";import{cn as S,atobID as H,getLocalizedPath as k}from"../../helpers/utils.js";import{DownArrow as T}from"./icons/index.js";import{useNavContext as z}from"./NavProvider.js";import{useAiuiContext as A}from"../AiuiProvider/index.js";const G=j.memo(({sidebarCategoriesMetadata:a,seriesMetadata:g})=>{const{buildProps:h,onSidebarNavClick:C}=z(),{locale:f="us"}=A(),[y,x]=_([]),[m,v]=_(-1),d=P(null),b=P(null),N=D(()=>{const e=a?.subcategories;if(!e?.length)return;const r=e.findIndex(o=>!!o?.subSubCategories),l=e.findIndex(o=>!o?.subSubCategories),s=e.map((o,i)=>({index:i,open:r===i||l===i}));x(s)},[a]);E(()=>{N()},[N]);const n=$(()=>{const e=a?.subcategories?.[y?.find(l=>l.open)?.index||0],r=g?.find(l=>l?.label?.toLowerCase()===e?.label?.toLowerCase())||{};if(e?.collections){const l=h?.categories?.[e?.collections]||{};return{label:r?.label,isCollection:!0,banner:r?.banner,primary:r?.primary,series:[{products:l?.products}]}}else if(e?.subSubCategories){const l=e?.subSubCategories?.[m],s=g?.find(o=>o?.label?.toLowerCase()===l?.label?.toLowerCase())||{};if(l?.collections){const o=h?.categories?.[l?.collections]||{};return{label:s?.label,isCollection:!0,banner:s?.banner,primary:s?.primary,series:[{products:o?.products}]}}else return s}else return r},[a,y,m,g,h]),u=D((e,r)=>{const l=r?.subSubCategories?.length>0;v(l?0:-1);const s=b.current;x(o=>o.map((i,B)=>B===e?{...i,open:!i.open}:l?{...i,open:!1}:!s&&m===-1?{...i,open:!1}:s&&!s.hasSubSubCategories&&!l&&m===-1?{...i,open:!1}:i)),b.current={index:e,hasSubSubCategories:l}},[m]),w=(e,r)=>{x(l=>l.map(s=>s.index===e?{...s,open:!0}:{...s,open:!1})),v(r)};return c(O,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[c("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:d,children:[t("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a?.subcategories?.map((e,r)=>{const l=Array.isArray(e?.subSubCategories)&&e?.subSubCategories?.length>0,s=y?.find(o=>o.index===r)?.open;return c("div",{children:[c("button",{className:S("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!l&&s}),onClick:()=>{u(r,e),C?.(e,r)},"aria-expanded":l?s:void 0,"aria-haspopup":l?"true":void 0,children:[t(p,{html:e.label,className:"p-4 text-sm font-bold leading-[1.4]"}),l&&t(T,{"aria-hidden":"true",className:S("size-4",{"rotate-180":s})})]}),s&&t("div",{className:"flex flex-col",role:"menu",children:e.subSubCategories?.map((o,i)=>t("button",{onClick:()=>{w(r,i),C?.(o,i)},className:S("rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":m===i}),role:"menuitem","aria-label":o.label,children:t(p,{html:o.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${r}-${i}`))})]},`${e?.label||""}subcategoryItem-${r}`)})}),a&&t("div",{className:"flex",children:c("div",{className:"flex flex-col gap-4",children:[a?.primary&&t(F,{as:"a",href:`${k(a?.primary?.url,f)}?ref=${a?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:a?.primary?.label}),a?.secondary&&t(F,{as:"a",href:a?.secondary?.url,variant:"link",size:"lg",iconClassName:"size-4",className:"lg-desktop:text-base justify-start !p-0 text-sm",children:a?.secondary?.label})]})})]}),c("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(n).length>0&&c("div",{className:"mb-4 flex items-center justify-between",children:[(()=>{const e=c(U,{children:[t(p,{html:n?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),n?.primary&&!n?.primary?.hide&&t(p,{className:"lg-desktop:text-base text-sm font-bold leading-[1.2]",html:n?.primary?.label})]});return n?.primary?.url?t(F,{as:"a",href:`${k(n?.primary?.url,f)}?ref=${n?.label}_viewmore`,variant:"link",size:"lg",iconClassName:"size-4",className:"flex items-center justify-start gap-2 !p-0 no-underline",children:e}):t("div",{className:"flex items-center gap-2",children:e})})(),a?.guide?.label&&t(L,{href:k(a?.guide?.url,f),className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:a?.guide?.label})]}),t("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:n?.series?.map((e,r)=>c("div",{children:[e.label&&t(p,{html:e.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),c("div",{className:"grid grid-cols-3 gap-4",children:[!!n?.banner&&t(L,{asChild:!n?.banner?.href,href:k(n?.banner?.href,f),children:c("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[t(V,{source:n?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),c("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[t(R,{size:2,html:n?.banner?.title||"Buy in Guide",className:S("font-bold text-white",{"text-black":n?.banner?.theme==="dark"})}),t(p,{html:n?.banner?.desc||"20.000mAh",className:S("text-sm font-bold text-white",{"text-black":n?.banner?.theme==="dark"})})]})]})}),e.products?.map((l,s)=>t(K,{seriesLabel:n?.label,product:l,isCollection:n?.isCollection},`seriesProductItem-${e?.label||""}-${r}-${s}`))]})]},`seriesItem-${e?.label||""}-${r}`))})]})]})});G.displayName="SidebarDropdown";const K=({product:a,isCollection:g,position:h,seriesLabel:C})=>{const{locale:f="us"}=A(),{buildProps:y,onSeriesProductClick:x,componentOverrides:m}=z(),v=m?.badge?.variant;let d=g?a:y?.products?.find(u=>u.handle===a.handle);const b=d?.variants?.find(u=>u.sku===a.sku)||d?.variants?.[0],N=$(()=>`${k(`/products/${d?.handle}`,f)}?variant=${H(b?.id)}`,[d?.handle,b?.id,f]),n=$(()=>d?.tags?.filter?.(u=>u?.startsWith?.("CLtag"))?.map?.(u=>u?.replace?.("CLtag:",""))?.slice?.(0,2),[d?.tags]);return b?.availableForSale?t(L,{href:N,onClick:u=>{u.preventDefault(),window.open(N,"_self"),x?.(d,h||0,C)},className:"no-underline hover:text-current",children:c("div",{className:"rounded-sidebar-shelf flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110 [&_img]:hover:duration-500",children:[t("div",{className:"shrink-0",children:t("img",{src:`${b?.image?.url||a?.images?.[0]?.url}&width=200`,loading:"lazy",alt:d?.title||a?.name,width:90,height:90,className:"size-[96px] object-contain"})}),c("div",{className:"relative",children:[t("div",{className:"flex gap-1",children:Array.isArray(n)&&n?.map((u,w)=>t(W,{size:"sm",variant:v,className:"mb-1 whitespace-nowrap",children:u},w))}),t(p,{className:"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]",html:a?.custom_name||b?.metafields?.infos?.page_short_title||d?.title}),a?.desc&&t(p,{as:"p",html:a?.desc,className:"lg-desktop:text-sm mt-1 line-clamp-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]"})]})]})}):null};export{K as SeriesProductItem,G as SidebarDropdown};
1
+ import{Fragment as Y,jsx as t,jsxs as u}from"react/jsx-runtime";import T,{useCallback as z,useEffect as A,useMemo as k,useRef as j,useState as B}from"react";import{Button as L,Container as V,Text as p,Link as $,Heading as W,Picture as K,Badge as U}from"../../components/index.js";import{cn as S,atobID as q,getLocalizedPath as C}from"../../helpers/utils.js";import{DownArrow as I}from"./icons/index.js";import{useNavContext as E}from"./NavProvider.js";import{useAiuiContext as O}from"../AiuiProvider/index.js";import{gaTrack as J}from"../../shared/track.js";const Q=T.memo(({sidebarCategoriesMetadata:a,seriesMetadata:v,navigationTitle:w})=>{const{buildProps:y,onSidebarNavClick:h}=E(),{locale:f="us",pageHandle:x,trackingData:_}=O(),[b,d]=B([]),[m,g]=B(-1),N=j(null),c=j(null),F=z(()=>{const e=a?.subcategories;if(!e?.length)return;const r=e.findIndex(o=>!!o?.subSubCategories),n=e.findIndex(o=>!o?.subSubCategories),s=e.map((o,i)=>({index:i,open:r===i||n===i}));d(s)},[a]);A(()=>{F()},[F]);const l=k(()=>{const e=a?.subcategories?.[b?.find(n=>n.open)?.index||0],r=v?.find(n=>n?.label?.toLowerCase()===e?.label?.toLowerCase())||{};if(e?.collections){const n=y?.categories?.[e?.collections]||{};return{label:r?.label,isCollection:!0,banner:r?.banner,primary:r?.primary,series:[{products:n?.products}]}}else if(e?.subSubCategories){const n=e?.subSubCategories?.[m],s=v?.find(o=>o?.label?.toLowerCase()===n?.label?.toLowerCase())||{};if(n?.collections){const o=y?.categories?.[n?.collections]||{};return{label:s?.label,isCollection:!0,banner:s?.banner,primary:s?.primary,series:[{products:o?.products}]}}else return s}else return r},[a,b,m,v,y]),D=k(()=>b?.find(e=>e.open)?.index??-1,[b]),P=k(()=>x?`Activity Page_${x}`:_?.pageGroup||"Home Page",[x,_]);A(()=>{D<0||!l?.label||J({event:"ga4Event",event_name:"component_impression",event_parameters:{page_group:P,component_type:"copy",component_name:"navigation",position:D+1,component_title:l?.label,navigation:w||""}})},[l?.label,D,P,w]);const R=z((e,r)=>{const n=r?.subSubCategories?.length>0;g(n?0:-1);const s=c.current;d(o=>o.map((i,G)=>G===e?{...i,open:!i.open}:n?{...i,open:!1}:!s&&m===-1?{...i,open:!1}:s&&!s.hasSubSubCategories&&!n&&m===-1?{...i,open:!1}:i)),c.current={index:e,hasSubSubCategories:n}},[m]),H=(e,r)=>{d(n=>n.map(s=>s.index===e?{...s,open:!0}:{...s,open:!1})),g(r)};return u(V,{childClassName:"lg-desktop:gap-12 flex bg-white gap-8",children:[u("div",{className:"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4",style:{userSelect:"none"},ref:N,children:[t("div",{className:"desktop:h-[416px] flex flex-col overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:a?.subcategories?.map((e,r)=>{const n=Array.isArray(e?.subSubCategories)&&e?.subSubCategories?.length>0,s=b?.find(o=>o.index===r)?.open;return u("div",{children:[u("button",{className:S("rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left",{"bg-[#F5F5F7]":!n&&s}),onClick:()=>{R(r,e),h?.(e,r)},"aria-expanded":n?s:void 0,"aria-haspopup":n?"true":void 0,children:[t(p,{html:e.label,className:"p-4 text-sm font-bold leading-[1.4]"}),n&&t(I,{"aria-hidden":"true",className:S("size-4",{"rotate-180":s})})]}),s&&t("div",{className:"flex flex-col",role:"menu",children:e.subSubCategories?.map((o,i)=>t("button",{onClick:()=>{H(r,i),h?.(o,i)},className:S("rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]",{"bg-[#F5F5F7]":m===i}),role:"menuitem","aria-label":o.label,children:t(p,{html:o.label,className:"text-sm font-bold leading-[1.4] text-[#4A4C56]"})},`subSubItem-${r}-${i}`))})]},`${e?.label||""}subcategoryItem-${r}`)})}),a&&t("div",{className:"flex",children:u("div",{className:"flex flex-col gap-4",children:[a?.primary&&t(L,{as:"a",href:C(a?.primary?.url,f,`ref=${a?.primary?.label}_shopall`),variant:"primary",size:"lg",className:"lg-desktop:text-base text-sm",children:a?.primary?.label}),a?.secondary&&t(L,{as:"a",href:a?.secondary?.url,variant:"link",size:"lg",iconClassName:"size-4",className:"link-btn lg-desktop:text-base justify-start !p-0 text-sm",children:a?.secondary?.label})]})})]}),u("div",{className:"flex-1 py-4",children:[Reflect.ownKeys(l).length>0&&u("div",{className:"mb-4 flex items-center justify-between",children:[(()=>{const e=u(Y,{children:[t(p,{html:l?.label,className:"lg-desktop:text-2xl text-xl font-bold leading-[1.4]"}),l?.primary&&!l?.primary?.hide&&t(p,{className:"lg-desktop:text-base text-sm font-bold leading-[1.2]",html:l?.primary?.label})]});return l?.primary?.url?t(L,{as:"a",href:C(l?.primary?.url,f,`ref=${l?.label}_viewmore`),variant:"link",size:"lg",iconClassName:"size-4",className:"link-btn flex items-center justify-start gap-2 !p-0 no-underline",children:e}):t("div",{className:"flex items-center gap-2",children:e})})(),a?.guide?.label&&t($,{href:C(a?.guide?.url,f,"ref=navMenu"),className:"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]",children:a?.guide?.label})]}),t("div",{className:"flex h-[426px] flex-col gap-4 overflow-y-auto",style:{scrollbarWidth:"none",msOverflowStyle:"none"},children:l?.series?.map((e,r)=>u("div",{children:[e.label&&t(p,{html:e.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]"}),u("div",{className:"grid grid-cols-3 gap-4",children:[!!l?.banner&&t($,{asChild:!l?.banner?.href,href:C(l?.banner?.href,f,"ref=navMenu"),children:u("div",{className:"rounded-sidebar-shelf relative overflow-hidden [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[t(K,{source:l?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),u("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[t(W,{size:2,html:l?.banner?.title||"Buy in Guide",className:S("font-bold text-white",{"text-black":l?.banner?.theme==="dark"})}),t(p,{html:l?.banner?.desc||"20.000mAh",className:S("text-sm font-bold text-white",{"text-black":l?.banner?.theme==="dark"})})]})]})}),e.products?.map((n,s)=>t(X,{seriesLabel:l?.label,product:n,isCollection:l?.isCollection},`seriesProductItem-${e?.label||""}-${r}-${s}`))]})]},`seriesItem-${e?.label||""}-${r}`))})]})]})});Q.displayName="SidebarDropdown";const X=({product:a,isCollection:v,position:w,seriesLabel:y})=>{const{locale:h="us"}=O(),{buildProps:f,onSeriesProductClick:x,componentOverrides:_}=E(),b=_?.badge?.variant;let d=v?a:f?.products?.find(c=>c.handle===a.handle);const m=d?.variants?.find(c=>c.sku===a.sku)||d?.variants?.[0],g=k(()=>C(`/products/${d?.handle}`,h,`variant=${q(m?.id)}&ref=navMenu`),[d?.handle,m?.id,h]),N=k(()=>d?.tags?.filter?.(c=>c?.startsWith?.("CLtag"))?.map?.(c=>c?.replace?.("CLtag:",""))?.slice?.(0,1),[d?.tags]);return m?.availableForSale?t($,{href:g,onClick:c=>{c.preventDefault(),window.open(g,"_self"),x?.(d,w||0,y)},className:"no-underline hover:text-current",children:u("div",{className:"rounded-sidebar-shelf relative flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110 [&_img]:hover:duration-500",children:[t("div",{className:"shrink-0",children:t("img",{src:`${m?.image?.url||a?.images?.[0]?.url}&width=200`,loading:"lazy",alt:d?.title||a?.name,width:90,height:90,className:"size-[96px] object-contain"})}),Array.isArray(N)&&N?.length>0&&t("div",{className:"absolute right-1 top-1 flex gap-1",children:N?.map((c,F)=>t(U,{size:"xs",variant:b,className:"whitespace-nowrap",children:c},F))}),u("div",{className:"flex min-w-0 flex-1 flex-col justify-center",children:[t(p,{className:"lg-desktop:text-base line-clamp-2 text-sm font-bold leading-[1.4]",html:a?.custom_name||m?.metafields?.infos?.page_short_title||d?.title}),a?.desc&&t(p,{as:"p",html:a?.desc,className:"lg-desktop:text-sm mt-1 line-clamp-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]"})]})]})}):null};export{X as SeriesProductItem,Q as SidebarDropdown};
@@ -1 +1 @@
1
- import{jsx as i}from"react/jsx-runtime";import{useEffect as s,useRef as g,useState as l}from"react";import{Link as m}from"../../components/index.js";import{debounce as f}from"es-toolkit";import{useAiuiContext as h}from"../AiuiProvider/index.js";import{getLocalizedPath as v}from"../../helpers/utils.js";const E=({supportsMetadata:d,currentNavItemRef:t})=>{const{locale:a="us"}=h(),o=g(null),[c,r]=l(null),[u,p]=l(0);s(()=>{if(o?.current){const e=o?.current?.getBoundingClientRect();p(e.height)}},[o]);const n=f(()=>{if(t){const e=t.getBoundingClientRect();r(e)}},500);return s(()=>(n(),window.addEventListener("resize",n),()=>{window.removeEventListener("resize",n)}),[n]),s(()=>{if(t){const e=t.getBoundingClientRect();r(e)}},[t]),i("div",{className:"rounded-b-box absolute top-0 h-full overflow-hidden bg-white transition-all duration-500",style:{right:`calc(100% - ${c?.right}px)`,height:u},children:i("div",{ref:o,className:"p-4",children:d?.map(e=>i("div",{className:"py-2",children:i(m,{href:v(e.url,a),className:"text-sm font-bold leading-[1.4] no-underline",children:e.label})},e.id))})})};export{E as SupportsDropdown};
1
+ import{jsx as i}from"react/jsx-runtime";import{useEffect as s,useRef as f,useState as l}from"react";import{Link as g}from"../../components/index.js";import{debounce as m}from"es-toolkit";import{useAiuiContext as h}from"../AiuiProvider/index.js";import{getLocalizedPath as v}from"../../helpers/utils.js";const E=({supportsMetadata:d,currentNavItemRef:t})=>{const{locale:a="us"}=h(),n=f(null),[c,r]=l(null),[u,p]=l(0);s(()=>{if(n?.current){const e=n?.current?.getBoundingClientRect();p(e.height)}},[n]);const o=m(()=>{if(t){const e=t.getBoundingClientRect();r(e)}},500);return s(()=>(o(),window.addEventListener("resize",o),()=>{window.removeEventListener("resize",o)}),[o]),s(()=>{if(t){const e=t.getBoundingClientRect();r(e)}},[t]),i("div",{className:"rounded-b-box absolute top-0 h-full overflow-hidden bg-white transition-all duration-500",style:{right:`calc(100% - ${c?.right}px)`,height:u},children:i("div",{ref:n,className:"p-4",children:d?.map(e=>i("div",{className:"py-2",children:i(g,{href:v(e.url,a,"ref=navMenu"),className:"text-sm font-bold leading-[1.4] no-underline",children:e.label})},e.id))})})};export{E as SupportsDropdown};