@anker-in/headless-ui 1.3.80 → 1.3.82

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 (102) hide show
  1. package/dist/cjs/biz-components/ActiveShelf/ProductCard.d.ts +2 -0
  2. package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
  3. package/dist/cjs/biz-components/ActiveShelf/index.d.ts +2 -0
  4. package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
  5. package/dist/cjs/biz-components/ActiveShelf/styles.js +1 -1
  6. package/dist/cjs/biz-components/BuyOneGetOneShelf/DiscountBadge.d.ts +25 -0
  7. package/dist/cjs/biz-components/BuyOneGetOneShelf/DiscountBadge.js +1 -0
  8. package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +4 -0
  9. package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
  10. package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +4 -0
  11. package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
  12. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -2
  13. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
  14. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +0 -3
  15. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
  16. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductTags.d.ts +14 -0
  17. package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductTags.js +1 -0
  18. package/dist/cjs/biz-components/BuyOneGetOneShelf/context.d.ts +2 -1
  19. package/dist/cjs/biz-components/BuyOneGetOneShelf/context.js +1 -1
  20. package/dist/cjs/biz-components/BuyOneGetOneShelf/index.d.ts +1 -1
  21. package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
  22. package/dist/cjs/biz-components/BuyOneGetOneShelf/types.d.ts +70 -3
  23. package/dist/cjs/biz-components/BuyOneGetOneShelf/types.js +1 -1
  24. package/dist/cjs/biz-components/Category/index.js +1 -1
  25. package/dist/cjs/biz-components/EventSchedule/index.js +1 -1
  26. package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
  27. package/dist/cjs/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
  28. package/dist/cjs/biz-components/MediaShelf/ProductCard.d.ts +2 -0
  29. package/dist/cjs/biz-components/MediaShelf/ProductCard.js +1 -1
  30. package/dist/cjs/biz-components/MediaShelf/index.js +1 -1
  31. package/dist/cjs/biz-components/MiniCart/CircleProgress.d.ts +22 -1
  32. package/dist/cjs/biz-components/MiniCart/CircleProgress.js +2 -1
  33. package/dist/cjs/biz-components/MiniCart/MiniCartDialog.d.ts +4 -2
  34. package/dist/cjs/biz-components/MiniCart/MiniCartDialog.js +1 -1
  35. package/dist/cjs/biz-components/MiniCart/index.d.ts +45 -0
  36. package/dist/cjs/biz-components/MiniCart/index.js +1 -1
  37. package/dist/cjs/biz-components/PromotionalBar/index.js +1 -1
  38. package/dist/cjs/biz-components/SceneShelf/ProductCard.js +1 -1
  39. package/dist/cjs/biz-components/Title/index.js +1 -1
  40. package/dist/cjs/biz-components/index.d.ts +2 -2
  41. package/dist/cjs/biz-components/index.js +1 -1
  42. package/dist/cjs/helpers/ScrollLoadVideo.d.ts +9 -1
  43. package/dist/cjs/helpers/ScrollLoadVideo.js +1 -1
  44. package/dist/cjs/material/breakpoints.d.ts +97 -0
  45. package/dist/cjs/material/breakpoints.js +1 -0
  46. package/dist/cjs/material/contract.d.ts +72 -0
  47. package/dist/cjs/material/contract.js +1 -0
  48. package/dist/cjs/material/index.d.ts +17 -0
  49. package/dist/cjs/material/index.js +1 -0
  50. package/dist/cjs/material/material-meta.d.ts +76 -0
  51. package/dist/cjs/material/material-meta.js +1 -0
  52. package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +2 -0
  53. package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
  54. package/dist/esm/biz-components/ActiveShelf/index.d.ts +2 -0
  55. package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
  56. package/dist/esm/biz-components/ActiveShelf/styles.js +1 -1
  57. package/dist/esm/biz-components/BuyOneGetOneShelf/DiscountBadge.d.ts +25 -0
  58. package/dist/esm/biz-components/BuyOneGetOneShelf/DiscountBadge.js +1 -0
  59. package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +4 -0
  60. package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
  61. package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +4 -0
  62. package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
  63. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +2 -2
  64. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
  65. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.d.ts +0 -3
  66. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductImage.js +1 -1
  67. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductTags.d.ts +14 -0
  68. package/dist/esm/biz-components/BuyOneGetOneShelf/ProductTags.js +1 -0
  69. package/dist/esm/biz-components/BuyOneGetOneShelf/context.d.ts +2 -1
  70. package/dist/esm/biz-components/BuyOneGetOneShelf/index.d.ts +1 -1
  71. package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
  72. package/dist/esm/biz-components/BuyOneGetOneShelf/types.d.ts +70 -3
  73. package/dist/esm/biz-components/Category/index.js +1 -1
  74. package/dist/esm/biz-components/EventSchedule/index.js +1 -1
  75. package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
  76. package/dist/esm/biz-components/HeroBanner/HeroBannerCarousel.js +1 -1
  77. package/dist/esm/biz-components/MediaShelf/ProductCard.d.ts +2 -0
  78. package/dist/esm/biz-components/MediaShelf/ProductCard.js +1 -1
  79. package/dist/esm/biz-components/MediaShelf/index.js +1 -1
  80. package/dist/esm/biz-components/MiniCart/CircleProgress.d.ts +22 -1
  81. package/dist/esm/biz-components/MiniCart/CircleProgress.js +2 -1
  82. package/dist/esm/biz-components/MiniCart/MiniCartDialog.d.ts +4 -2
  83. package/dist/esm/biz-components/MiniCart/MiniCartDialog.js +1 -1
  84. package/dist/esm/biz-components/MiniCart/index.d.ts +45 -0
  85. package/dist/esm/biz-components/MiniCart/index.js +1 -1
  86. package/dist/esm/biz-components/PromotionalBar/index.js +1 -1
  87. package/dist/esm/biz-components/SceneShelf/ProductCard.js +1 -1
  88. package/dist/esm/biz-components/Title/index.js +1 -1
  89. package/dist/esm/biz-components/index.d.ts +2 -2
  90. package/dist/esm/biz-components/index.js +1 -1
  91. package/dist/esm/helpers/ScrollLoadVideo.d.ts +9 -1
  92. package/dist/esm/helpers/ScrollLoadVideo.js +1 -1
  93. package/dist/esm/material/breakpoints.d.ts +97 -0
  94. package/dist/esm/material/breakpoints.js +1 -0
  95. package/dist/esm/material/contract.d.ts +72 -0
  96. package/dist/esm/material/contract.js +1 -0
  97. package/dist/esm/material/index.d.ts +17 -0
  98. package/dist/esm/material/index.js +1 -0
  99. package/dist/esm/material/material-meta.d.ts +76 -0
  100. package/dist/esm/material/material-meta.js +1 -0
  101. package/package.json +13 -2
  102. package/style.css +26 -2
@@ -1 +1 @@
1
- "use client";import{Fragment as me,jsx as t,jsxs as n}from"react/jsx-runtime";import*as i from"react";import{cn as p}from"../../helpers/index.js";import{withLayout as we}from"../../shared/Styles.js";import{Text as Ce,Heading as ve,Tabs as xe,TabsList as Pe,TabsTrigger as Me,TabsContent as ke}from"../../components/index.js";import ne from"../PromotionalBar/index.js";import{Swiper as Se,SwiperSlide as Be}from"swiper/react";import{Navigation as De}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import{ProductCard as oe}from"./ProductCard.js";import{useExposure as Le}from"../../hooks/useExposure.js";const Ne="shelf",Re="active_shelf",Ae=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"prev-mask bg-masks-0 group-hover/prev-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M15 6L9 12L15 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Ee=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"next-mask bg-masks-0 group-hover/next-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M9 6L15 12L9 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});function le(r){return typeof window>"u"?2:window.matchMedia("(min-width: 1440px)").matches?r==="3"?3:4:window.matchMedia("(min-width: 768px)").matches?3:2}function ce(){return typeof window>"u"?!0:!window.matchMedia("(min-width: 768px)").matches}function de(){return typeof window>"u"?!1:window.matchMedia("(min-width: 1025px)").matches}const ie=i.forwardRef(({products:r,layoutMode:o,className:$,copy:c,showTags:f,stockDisplayMode:y,stockThresholdValue:h,onLearnMore:T,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:v,showOriginalPrice:x,renderOriginalPrice:P,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,renderDiscountBadge:D,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,onMemberSignUp:A,onPlusMemberAddCart:E,tileMaxRowsPc:te,tileMaxRowsMob:q,tileDesktopColumns:l,tileExpandText:Z,tileCollapseText:G,showMemberPrice:I},J)=>{const z=i.useId().replace(/:/g,""),F=`swiper-button-next-custom-${z}`,H=`swiper-button-prev-custom-${z}`,[O,d]=i.useState({isBeginning:!0,isEnd:!1}),K=i.useRef(null),u=i.useCallback(()=>{const e=K.current;if(!e?.slides||e.slides.length===0)return;e.slides.forEach(U=>{U.style.height="auto"});const V=Array.from(e.slides).map(U=>U.scrollHeight),ae=Math.max(...V);ae>0&&e.slides.forEach(U=>{U.style.height=`${ae}px`})},[]);i.useEffect(()=>{const e=()=>{requestAnimationFrame(u)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[u]);const[g,s]=i.useState(!1),[Q,X]=i.useState(()=>le(l)),[ge,fe]=i.useState(()=>ce()),[ye,he]=i.useState(()=>de());i.useEffect(()=>{const e=()=>{X(le(l)),fe(ce()),he(de())};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[l]);const Y=o==="horizontal"&&!ye?"flex":o,ee=ge?q:te,se=Y==="flex"&&!!ee&&ee>0,re=ee?ee*Q:r.length,Te=se&&r.length>re,be=se&&!g?r.slice(0,re):r;return r?.length===0?null:t("div",{ref:J,className:$,children:Y==="flex"?n(me,{children:[t("div",{className:p("tablet:grid-cols-3 tablet:gap-4 grid grid-cols-2 justify-start gap-3",l==="3"?"desktop:grid-cols-3 lg-desktop:grid-cols-3":"desktop:grid-cols-4 lg-desktop:grid-cols-4"),children:be.map((e,V)=>t(oe,{product:e,layoutMode:Y,className:"shrink-0",showTags:f,stockDisplayMode:y,stockThresholdValue:h,onLearnMore:T,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:v,showOriginalPrice:x,renderOriginalPrice:P,renderDiscountBadge:D,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,copy:c,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,onMemberSignUp:A,onPlusMemberAddCart:E,showMemberPrice:I},e.shopify_id+"-"+e.sku||V))}),Te&&n("div",{className:"laptop:hover:text-brand-0 text-info-primary mt-6 flex items-center justify-center",children:[t("button",{className:"laptop:text-base text-sm font-bold",onClick:()=>s(e=>!e),children:g?G??"Show less":Z??"Show more"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",className:p("laptop:size-5 size-4",g&&"rotate-180"),width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:t("path",{d:"M17.2929 8.29302C17.6834 7.90249 18.3164 7.90249 18.707 8.29302C19.0975 8.68354 19.0975 9.31655 18.707 9.70708L12.707 15.7071C12.3164 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70708C4.90237 9.31655 4.90237 8.68354 5.29289 8.29302C5.68342 7.90249 6.31643 7.90249 6.70696 8.29302L11.9999 13.586L17.2929 8.29302Z",fill:"currentColor"})})]})]}):n("div",{className:"group relative",children:[t(Se,{modules:[De],spaceBetween:16,navigation:{nextEl:`.${F}`,prevEl:`.${H}`},onSwiper:e=>{K.current=e,d({isBeginning:e.isBeginning,isEnd:e.isEnd}),setTimeout(u,100)},slidesPerView:3,breakpoints:{1025:{freeMode:!1,slidesPerView:3},1440:{freeMode:!1,slidesPerView:l==="3"?3:4}},onReachEnd:()=>{d(e=>({...e,isEnd:!0}))},onReachBeginning:()=>{d(e=>({...e,isBeginning:!0}))},onFromEdge:()=>{d({isBeginning:!1,isEnd:!1})},className:"!overflow-visible [&_.swiper-wrapper]:items-start",children:r.map((e,V)=>t(Be,{className:"overflow-hidden",children:t(oe,{product:e,layoutMode:Y,className:"w-full max-w-full",showTags:f,stockDisplayMode:y,stockThresholdValue:h,onLearnMore:T,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:v,showOriginalPrice:x,renderOriginalPrice:P,renderDiscountBadge:D,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,copy:c,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,onMemberSignUp:A,onPlusMemberAddCart:E,showMemberPrice:I})},e.shopify_id+"-"+e.sku||V))}),t("button",{className:`${H} tablet:block group/prev-mask absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 ${O.isBeginning?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":c?.previousSlideLabel,children:t(Ae,{})}),t("button",{className:`${F} tablet:block group/next-mask absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 ${O.isEnd?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":c?.nextSlideLabel,children:t(Ee,{})})]})})});ie.displayName="ProductsList";const ue=i.forwardRef(({className:r,data:o,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:y,onMemberSignUp:h,onPlusMemberAddCart:T,classNames:a,renderOriginalPrice:b,renderDiscountBadge:w,...j},W)=>{const m=i.useRef(null);Le(m,{componentType:Ne,componentName:Re,componentTitle:o.title,componentDescription:o.description}),i.useImperativeHandle(W,()=>m.current);const{theme:C="light",layoutMode:v="flex",showTags:x=!0,stockDisplayMode:P,stockThresholdValue:M,showOriginalPrice:k,secondaryButtonText:S,primaryButtonText:B,secondaryButtonFun:D,primaryButtonFun:L,isShowTab:_=!0,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,copy:te,userType:q,memberImages:l,customTagsIcon:Z,customTagStyle:G,showMemberPrice:I,tileMaxRowsPc:J,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O}=o,d=te||{},K=o.productsTab&&o.productsTab.length>0,u=_&&K,g=u?void 0:o.resourceBlocks?.find(s=>s.blockType==="PromotionalBar"&&s.display==="visible");return n("div",{ref:m,className:p("w-full",{"aiui-dark":C==="dark"},r,a?.root),style:{"--progress-track-bg":C==="dark"?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)"},...j,children:[o.title&&t(ve,{as:"h2",html:o.title,size:4,className:p("text-info-primary mb-4 leading-tight",a?.title)}),o.description&&t(Ce,{size:3,as:"p",html:o.description,className:p("text-info-primary mb-6",a?.description)}),n(xe,{defaultValue:o.productsTab?.[0]?.id,className:"w-full",children:[u&&t(Pe,{className:"mb-6",children:o.productsTab?.map(s=>t(Me,{value:s.id,children:s.tab},"tab-"+s.id))}),u?o.productsTab?.map(s=>{const Q=s.resourceBlocks?.find(X=>X.blockType==="PromotionalBar"&&X.display==="visible");return n(ke,{value:s.id,children:[Q&&t(ne,{data:Q,className:p("laptop:mb-4 mb-3",a?.promotionalBar)}),t(ie,{products:s.data,layoutMode:v,copy:d,showTags:x,stockDisplayMode:P,stockThresholdValue:M,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:y,classNames:a,secondaryButtonText:S,secondaryButtonFun:D,primaryButtonText:B,primaryButtonFun:L,showOriginalPrice:k,renderOriginalPrice:b,renderDiscountBadge:w,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,userType:q,memberImages:l,customTagsIcon:Z,customTagStyle:G,onMemberSignUp:h,onPlusMemberAddCart:T,showMemberPrice:I,tileMaxRowsPc:J,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O})]},"tab-content-"+s.id)}):n(me,{children:[g&&t(ne,{data:g,className:p("laptop:mb-4 mb-3",a?.promotionalBar)}),t(ie,{products:o.productsCard,layoutMode:v,copy:d,showTags:x,stockDisplayMode:P,stockThresholdValue:M,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:y,classNames:a,secondaryButtonText:S,secondaryButtonFun:D,primaryButtonText:B,primaryButtonFun:L,showOriginalPrice:k,renderOriginalPrice:b,renderDiscountBadge:w,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,userType:q,memberImages:l,customTagsIcon:Z,customTagStyle:G,onMemberSignUp:h,onPlusMemberAddCart:T,showMemberPrice:I,tileMaxRowsPc:J,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O})]})]})]})});ue.displayName="ActiveShelf";const pe=ue;pe.ProductCard=oe;const Ie=we(pe);var Ze=Ie;export{Ze as default};
1
+ "use client";import{Fragment as ge,jsx as t,jsxs as n}from"react/jsx-runtime";import*as i from"react";import{cn as p}from"../../helpers/index.js";import{withLayout as Ce}from"../../shared/Styles.js";import{Text as xe,Heading as ve,Tabs as Pe,TabsList as Me,TabsTrigger as ke,TabsContent as Se}from"../../components/index.js";import le from"../PromotionalBar/index.js";import{Swiper as Be,SwiperSlide as De}from"swiper/react";import{Navigation as Le}from"swiper/modules";import"swiper/css";import"swiper/css/navigation";import{ProductCard as ie}from"./ProductCard.js";import{useExposure as Ne}from"../../hooks/useExposure.js";const Re="shelf",Ae="active_shelf",Ee=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"prev-mask bg-masks-0 group-hover/prev-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M15 6L9 12L15 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),Ie=()=>n("span",{className:"lg-desktop:size-14 relative flex size-10 items-center justify-center",children:[t("span",{className:"next-mask bg-masks-0 group-hover/next-mask:bg-masks-1 absolute inset-0 rounded-full transition-colors"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"20",height:"20",viewBox:"0 0 24 24",fill:"none",className:"lg-desktop:size-6 relative size-5",children:t("path",{d:"M9 6L15 12L9 18",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});function ce(r){return typeof window>"u"?2:window.matchMedia("(min-width: 1440px)").matches?r==="3"?3:4:window.matchMedia("(min-width: 768px)").matches?3:2}function de(){return typeof window>"u"?!0:!window.matchMedia("(min-width: 768px)").matches}function ue(){return typeof window>"u"?!1:window.matchMedia("(min-width: 1025px)").matches}const se=i.forwardRef(({products:r,layoutMode:o,className:$,copy:c,showTags:f,stockDisplayMode:T,stockThresholdValue:y,onLearnMore:h,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:P,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,renderDiscountBadge:D,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,discountTagTextColor:A,onMemberSignUp:E,onPlusMemberAddCart:q,tileMaxRowsPc:Z,tileMaxRowsMob:G,tileDesktopColumns:l,tileExpandText:J,tileCollapseText:K,showMemberPrice:I},Q)=>{const z=i.useId().replace(/:/g,""),F=`swiper-button-next-custom-${z}`,H=`swiper-button-prev-custom-${z}`,[O,d]=i.useState({isBeginning:!0,isEnd:!1}),X=i.useRef(null),u=i.useCallback(()=>{const e=X.current;if(!e?.slides||e.slides.length===0)return;e.slides.forEach(U=>{U.style.height="auto"});const V=Array.from(e.slides).map(U=>U.scrollHeight),ne=Math.max(...V);ne>0&&e.slides.forEach(U=>{U.style.height=`${ne}px`})},[]);i.useEffect(()=>{const e=()=>{requestAnimationFrame(u)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[u]);const[g,s]=i.useState(!1),[Y,ee]=i.useState(()=>ce(l)),[fe,Te]=i.useState(()=>de()),[ye,he]=i.useState(()=>ue());i.useEffect(()=>{const e=()=>{ee(ce(l)),Te(de()),he(ue())};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[l]);const te=o==="horizontal"&&!ye?"flex":o,oe=fe?G:Z,re=te==="flex"&&!!oe&&oe>0,ae=oe?oe*Y:r.length,be=re&&r.length>ae,we=re&&!g?r.slice(0,ae):r;return r?.length===0?null:t("div",{ref:Q,className:$,children:te==="flex"?n(ge,{children:[t("div",{className:p("tablet:grid-cols-3 tablet:gap-4 grid grid-cols-2 justify-start gap-3",l==="3"?"desktop:grid-cols-3 lg-desktop:grid-cols-3":"desktop:grid-cols-4 lg-desktop:grid-cols-4"),children:we.map((e,V)=>t(ie,{product:e,layoutMode:te,className:"shrink-0",showTags:f,stockDisplayMode:T,stockThresholdValue:y,onLearnMore:h,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:P,renderDiscountBadge:D,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,copy:c,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,discountTagTextColor:A,onMemberSignUp:E,onPlusMemberAddCart:q,showMemberPrice:I},e.shopify_id+"-"+e.sku||V))}),be&&n("div",{className:"active-shelf-toggle laptop:hover:text-brand-0 text-info-primary mt-6 flex items-center justify-center",children:[t("button",{className:"laptop:text-base text-sm font-bold",onClick:()=>s(e=>!e),children:g?K??"Show less":J??"Show more"}),t("svg",{xmlns:"http://www.w3.org/2000/svg",className:p("laptop:size-5 size-4",g&&"rotate-180"),width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",children:t("path",{d:"M17.2929 8.29302C17.6834 7.90249 18.3164 7.90249 18.707 8.29302C19.0975 8.68354 19.0975 9.31655 18.707 9.70708L12.707 15.7071C12.3164 16.0976 11.6834 16.0976 11.2929 15.7071L5.29289 9.70708C4.90237 9.31655 4.90237 8.68354 5.29289 8.29302C5.68342 7.90249 6.31643 7.90249 6.70696 8.29302L11.9999 13.586L17.2929 8.29302Z",fill:"currentColor"})})]})]}):n("div",{className:"group relative",children:[t(Be,{modules:[Le],spaceBetween:16,navigation:{nextEl:`.${F}`,prevEl:`.${H}`},onSwiper:e=>{X.current=e,d({isBeginning:e.isBeginning,isEnd:e.isEnd}),setTimeout(u,100)},slidesPerView:3,breakpoints:{1025:{freeMode:!1,slidesPerView:3},1440:{freeMode:!1,slidesPerView:l==="3"?3:4}},onReachEnd:()=>{d(e=>({...e,isEnd:!0}))},onReachBeginning:()=>{d(e=>({...e,isBeginning:!0}))},onFromEdge:()=>{d({isBeginning:!1,isEnd:!1})},className:"!overflow-visible [&_.swiper-wrapper]:items-start",children:r.map((e,V)=>t(De,{className:"overflow-hidden",children:t(ie,{product:e,layoutMode:te,className:"w-full max-w-full",showTags:f,stockDisplayMode:T,stockThresholdValue:y,onLearnMore:h,onShopNow:a,onAddToCart:b,onProductImageClick:w,classNames:j,secondaryButtonText:W,secondaryButtonFun:m,primaryButtonText:C,primaryButtonFun:x,showOriginalPrice:v,renderOriginalPrice:P,renderDiscountBadge:D,tagTypeConfig:M,fill:k,outline:S,memberPriceTextColor:B,copy:c,userType:L,memberImages:_,customTagsIcon:N,customTagStyle:R,discountTagTextColor:A,onMemberSignUp:E,onPlusMemberAddCart:q,showMemberPrice:I})},e.shopify_id+"-"+e.sku||V))}),t("button",{className:`${H} tablet:block group/prev-mask absolute left-4 top-1/2 z-10 hidden -translate-y-1/2 ${O.isBeginning?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":c?.previousSlideLabel,children:t(Ee,{})}),t("button",{className:`${F} tablet:block group/next-mask absolute right-4 top-1/2 z-10 hidden -translate-y-1/2 ${O.isEnd?"pointer-events-none opacity-0":"opacity-100"}`,"aria-label":c?.nextSlideLabel,children:t(Ie,{})})]})})});se.displayName="ProductsList";const pe=i.forwardRef(({className:r,data:o,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:T,onMemberSignUp:y,onPlusMemberAddCart:h,classNames:a,renderOriginalPrice:b,renderDiscountBadge:w,...j},W)=>{const m=i.useRef(null);Ne(m,{componentType:Re,componentName:Ae,componentTitle:o.title,componentDescription:o.description}),i.useImperativeHandle(W,()=>m.current);const{theme:C="light",layoutMode:x="flex",showTags:v=!0,stockDisplayMode:P,stockThresholdValue:M,showOriginalPrice:k,secondaryButtonText:S,primaryButtonText:B,secondaryButtonFun:D,primaryButtonFun:L,isShowTab:_=!0,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,copy:q,userType:Z,memberImages:G,customTagsIcon:l,customTagStyle:J,discountTagTextColor:K,showMemberPrice:I,tileMaxRowsPc:Q,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O}=o,d=q||{},X=o.productsTab&&o.productsTab.length>0,u=_&&X,g=u?void 0:o.resourceBlocks?.find(s=>s.blockType==="PromotionalBar"&&s.display==="visible");return n("div",{ref:m,className:p("w-full",{"aiui-dark":C==="dark"},r,a?.root),style:{"--progress-track-bg":C==="dark"?"rgba(255, 255, 255, 0.2)":"rgba(0, 0, 0, 0.2)"},...j,children:[o.title&&t(ve,{as:"h2",html:o.title,size:4,className:p("text-info-primary mb-4 leading-tight",a?.title)}),o.description&&t(xe,{size:3,as:"p",html:o.description,className:p("text-info-primary mb-6",a?.description)}),n(Pe,{defaultValue:o.productsTab?.[0]?.id,className:"w-full",children:[u&&t(Me,{className:"mb-6",children:o.productsTab?.map(s=>t(ke,{value:s.id,children:s.tab},"tab-"+s.id))}),u?o.productsTab?.map(s=>{const Y=s.resourceBlocks?.find(ee=>ee.blockType==="PromotionalBar"&&ee.display==="visible");return n(Se,{value:s.id,children:[Y&&t(le,{data:Y,className:p("laptop:mb-4 mb-3",a?.promotionalBar)}),t(se,{products:s.data,layoutMode:x,copy:d,showTags:v,stockDisplayMode:P,stockThresholdValue:M,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:T,classNames:a,secondaryButtonText:S,secondaryButtonFun:D,primaryButtonText:B,primaryButtonFun:L,showOriginalPrice:k,renderOriginalPrice:b,renderDiscountBadge:w,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,userType:Z,memberImages:G,customTagsIcon:l,customTagStyle:J,discountTagTextColor:K,onMemberSignUp:y,onPlusMemberAddCart:h,showMemberPrice:I,tileMaxRowsPc:Q,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O})]},"tab-content-"+s.id)}):n(ge,{children:[g&&t(le,{data:g,className:p("laptop:mb-4 mb-3",a?.promotionalBar)}),t(se,{products:o.productsCard,layoutMode:x,copy:d,showTags:v,stockDisplayMode:P,stockThresholdValue:M,onLearnMore:$,onShopNow:c,onAddToCart:f,onProductImageClick:T,classNames:a,secondaryButtonText:S,secondaryButtonFun:D,primaryButtonText:B,primaryButtonFun:L,showOriginalPrice:k,renderOriginalPrice:b,renderDiscountBadge:w,tagTypeConfig:N,fill:R,outline:A,memberPriceTextColor:E,userType:Z,memberImages:G,customTagsIcon:l,customTagStyle:J,discountTagTextColor:K,onMemberSignUp:y,onPlusMemberAddCart:h,showMemberPrice:I,tileMaxRowsPc:Q,tileMaxRowsMob:z,tileDesktopColumns:F,tileExpandText:H,tileCollapseText:O})]})]})]})});pe.displayName="ActiveShelf";const me=pe;me.ProductCard=ie;const ze=Ce(me);var Ge=ze;export{Ge as default};
@@ -1 +1 @@
1
- const t={flex:{cardContent:"px-2 pb-4 pt-6 laptop:px-4 desktop:p-6 laptop:pt-6 desktop:pt-8 lg-desktop:pt-10",image:"size-[125px] laptop:size-[180px] lg-desktop:size-[240px]",imageOffset:"laptop:-top-6 desktop:-top-8 lg-desktop:-top-10 -left-2 -right-2 laptop:-left-4 laptop:-right-4 desktop:-left-6 desktop:-right-6",title:"text-[14px] leading-tight laptop:mb-1 laptop:text-[20px] lg-desktop:text-[24px] line-clamp-3 laptop:line-clamp-2",description:"hidden text-[14px] desktop:text-[16px] lg-desktop:text-[18px] laptop:block laptop:line-clamp-2 leading-normal",price:"text-[14px] leading-tight laptop:text-[20px] lg-desktop:text-[24px]",priceLabel:"text-[12px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px]",cardRadius:"rounded-box-small tablet:rounded-box",priceGap:"gap-[2px] laptop:gap-1",discountBadgeSize:"size-12 laptop:size-20 lg-desktop:size-24",discountBadgeText:"text-xs laptop:text-base lg-desktop:text-xl pl-2 pt-1 laptop:pl-4 laptop:pt-2",discountBadgeTextStyle2:"text-xs laptop:text-base lg-desktop:text-xl pt-2 desktop:pt-4",discountBadgeTextStyle3:"text-xs laptop:text-base lg-desktop:text-xl flex items-center pl-1 laptop:pl-2",discountBadgeTextCenter:"text-xs laptop:text-base lg-desktop:text-xl flex items-center justify-center",buttonContainer:"flex-wrap gap-2 laptop:flex-nowrap lg-desktop:gap-3",buttonItem:"w-full whitespace-nowrap laptop:w-fit laptop:min-w-0 laptop:whitespace-normal laptop:text-center",memberLabelContainer:"p-2 laptop:px-4 laptop:py-3 desktop:pl-6 desktop:py-4 desktop:pr-12 lg-desktop:pr-16",memberLabelText:"text-xs laptop:text-sm desktop:text-base lg-desktop:text-[18px]"},horizontal:{cardContent:"p-4 desktop:p-6 laptop:pt-6 desktop:pt-8 lg-desktop:pt-10",image:"size-[180px] lg-desktop:size-[240px]",imageOffset:"-top-4 -left-4 -right-4 laptop:-top-6 desktop:-top-8 lg-desktop:-top-10 desktop:-left-6 desktop:-right-6",title:"mb-1 text-[20px] leading-[120%] lg-desktop:text-[24px] line-clamp-2",description:"text-[14px] desktop:text-[16px] lg-desktop:text-[18px] line-clamp-2 leading-normal",price:"text-[20px] leading-[120%] lg-desktop:text-[24px]",priceLabel:"text-[14px] leading-[140%] desktop:text-[16px] lg-desktop:text-[18px]",cardRadius:"rounded-box",priceGap:"gap-1",discountBadgeSize:"size-20 lg-desktop:size-24",discountBadgeText:"text-base lg-desktop:text-xl pt-2 pl-4",discountBadgeTextStyle2:"text-base lg-desktop:text-xl pt-2 desktop:pt-4",discountBadgeTextStyle3:"text-base lg-desktop:text-xl flex items-center pl-1 laptop:pl-2",discountBadgeTextCenter:"text-base lg-desktop:text-xl flex items-center justify-center",buttonContainer:"gap-2 lg-desktop:gap-3",buttonItem:"w-full whitespace-nowrap tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center",memberLabelContainer:"px-4 py-3 desktop:pl-6 desktop:py-4 desktop:pr-12 lg-desktop:pr-16",memberLabelText:"text-xs laptop:text-sm desktop:text-base lg-desktop:text-[18px]"}};export{t as layoutModeStyles};
1
+ const t={flex:{cardContent:"px-2 pb-4 pt-6 laptop:px-4 desktop:p-6 laptop:pt-6 desktop:pt-8 lg-desktop:pt-10",image:"size-[125px] laptop:size-[180px] lg-desktop:size-[240px]",imageOffset:"-top-6 desktop:-top-8 lg-desktop:-top-10 -left-2 -right-2 laptop:-left-4 laptop:-right-4 desktop:-left-6 desktop:-right-6",title:"text-[14px] leading-tight laptop:mb-1 laptop:text-[20px] lg-desktop:text-[24px] line-clamp-3 laptop:line-clamp-2",description:"hidden text-[14px] desktop:text-[16px] lg-desktop:text-[18px] laptop:block laptop:line-clamp-2 leading-normal",price:"text-[14px] leading-tight laptop:text-[20px] lg-desktop:text-[24px]",priceLabel:"text-[12px] laptop:text-[14px] desktop:text-[16px] lg-desktop:text-[18px]",cardRadius:"rounded-box-small tablet:rounded-box",priceGap:"gap-[2px] laptop:gap-1",discountBadgeSize:"size-12 laptop:size-20 lg-desktop:size-24",discountBadgeText:"text-xs laptop:text-base lg-desktop:text-xl pl-2 pt-1 laptop:pl-4 laptop:pt-2",discountBadgeTextStyle2:"text-xs laptop:text-base lg-desktop:text-xl pt-2 desktop:pt-4",discountBadgeTextStyle3:"text-xs laptop:text-base lg-desktop:text-xl flex items-center pl-1 laptop:pl-2",discountBadgeTextCenter:"text-xs laptop:text-base lg-desktop:text-xl flex items-center justify-center",buttonContainer:"flex-wrap gap-2 laptop:flex-nowrap lg-desktop:gap-3",buttonItem:"w-full whitespace-nowrap laptop:w-fit laptop:min-w-0 laptop:whitespace-normal laptop:text-center",memberLabelContainer:"p-2 laptop:px-4 laptop:py-3 desktop:pl-6 desktop:py-4 desktop:pr-12 lg-desktop:pr-16",memberLabelText:"text-xs laptop:text-sm desktop:text-base lg-desktop:text-[18px]"},horizontal:{cardContent:"p-4 desktop:p-6 laptop:pt-6 desktop:pt-8 lg-desktop:pt-10",image:"size-[180px] lg-desktop:size-[240px]",imageOffset:"-top-4 -left-4 -right-4 laptop:-top-6 desktop:-top-8 lg-desktop:-top-10 desktop:-left-6 desktop:-right-6",title:"mb-1 text-[20px] leading-[120%] lg-desktop:text-[24px] line-clamp-2",description:"text-[14px] desktop:text-[16px] lg-desktop:text-[18px] line-clamp-2 leading-normal",price:"text-[20px] leading-[120%] lg-desktop:text-[24px]",priceLabel:"text-[14px] leading-[140%] desktop:text-[16px] lg-desktop:text-[18px]",cardRadius:"rounded-box",priceGap:"gap-1",discountBadgeSize:"size-20 lg-desktop:size-24",discountBadgeText:"text-base lg-desktop:text-xl pt-2 pl-4",discountBadgeTextStyle2:"text-base lg-desktop:text-xl pt-2 desktop:pt-4",discountBadgeTextStyle3:"text-base lg-desktop:text-xl flex items-center pl-1 laptop:pl-2",discountBadgeTextCenter:"text-base lg-desktop:text-xl flex items-center justify-center",buttonContainer:"gap-2 lg-desktop:gap-3",buttonItem:"w-full whitespace-nowrap tablet:w-fit tablet:min-w-0 tablet:whitespace-normal tablet:text-center",memberLabelContainer:"px-4 py-3 desktop:pl-6 desktop:py-4 desktop:pr-12 lg-desktop:pr-16",memberLabelText:"text-xs laptop:text-sm desktop:text-base lg-desktop:text-[18px]"}};export{t as layoutModeStyles};
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import type { Img } from '../../types/props.js';
3
+ import type { DiscountBadgeRenderContext, DiscountTagStyle } from './types.js';
4
+ export interface DiscountBadgeProps {
5
+ /** 折扣文案,为空时不渲染 */
6
+ text?: string;
7
+ /** 角标样式,默认 style1 */
8
+ style?: DiscountTagStyle;
9
+ /** 自定义角标图标(style=custom 时生效) */
10
+ icon?: Img;
11
+ /** 自定义渲染(style=custom 时生效) */
12
+ renderBadge?: (ctx: DiscountBadgeRenderContext) => React.ReactNode;
13
+ className?: string;
14
+ textClassName?: string;
15
+ /** 折扣文案颜色,设置后覆盖默认文字色 */
16
+ textColor?: string;
17
+ }
18
+ /**
19
+ * DiscountBadge - 买赠货架左上角折扣角标
20
+ */
21
+ declare const DiscountBadge: {
22
+ ({ text, style, icon, renderBadge, className, textClassName, textColor, }: DiscountBadgeProps): import("react/jsx-runtime").JSX.Element | null;
23
+ displayName: string;
24
+ };
25
+ export default DiscountBadge;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as l,jsxs as y}from"react/jsx-runtime";import"react";import{cn as p}from"../../helpers/index.js";import m from"../../components/picture.js";import{Text as b}from"../../components/text.js";const r={style1:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/2_7746fc9c-d4e4-4a59-a972-fa4cb0f3f8bd.png?v=1789381635",textClass:"text-base lg-desktop:text-xl pt-2 pl-4"},style2:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/1_e0438358-493b-40cb-9a58-89d6ee2d3751.png?v=1789381628",textClass:"text-base lg-desktop:text-xl pt-2 desktop:pt-4"},style3:{bg:"https://cdn.shopify.com/s/files/1/0521/9411/5753/files/1_19208ba4-71ea-4580-892d-72167f1cf606.png?v=1789381639",textClass:"text-base lg-desktop:text-xl flex items-center pl-1 laptop:pl-2"}},x="text-base lg-desktop:text-xl flex items-center justify-center",d=({text:t,style:a="style1",icon:s,renderBadge:o,className:g,textClassName:f,textColor:c})=>{if(!t)return null;const e=a==="custom",i=e&&!!o,u=e&&!o&&!!s?.url,n=e?r.style1:r[a];return y("div",{className:p("bogo-shelf-discount-badge absolute left-0 top-0 z-10","lg-desktop:size-24 size-20",g),children:[i?o({text:t}):u?l(m,{source:s.url,alt:s.alt||t,className:"block size-full",imgClassName:"block size-full object-contain"}):l("img",{src:n.bg,alt:t,loading:"lazy",className:"block size-full object-contain"}),!i&&l(b,{className:p("bogo-shelf-discount-badge-text aiui-dark text-info-primary text-center","absolute inset-0 font-bold !leading-[1.2]",e?x:n.textClass,f),style:c?{color:c}:void 0,html:t})]})};d.displayName="BuyOneGetOneShelf.DiscountBadge";var N=d;export{N as default};
@@ -8,6 +8,10 @@ export interface FreeGiftItemProps extends Omit<React.HTMLAttributes<HTMLDivElem
8
8
  /** 赠品类型 1-> 单选模式, 2 -> 全选模式 */
9
9
  giftType?: 1 | 2;
10
10
  theme?: 'light' | 'dark';
11
+ /** 赠品角标背景色,覆盖默认品牌色 */
12
+ tagBgColor?: string;
13
+ /** 赠品角标文字颜色,覆盖默认文字色 */
14
+ tagTextColor?: string;
11
15
  }
12
16
  /**
13
17
  * FreeGiftItem - 免费赠品项
@@ -1 +1 @@
1
- "use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import*as x from"react";import{cn as r}from"../../helpers/index.js";import"../../components/badge.js";import c from"../../components/picture.js";import{Text as s}from"../../components/text.js";const m=({checked:e,theme:l})=>{const o=l==="dark";return e?i("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",fill:o?"#F5F6F7":"#080A0F"}),t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:o?"#F5F6F7":"#080A0F",strokeWidth:"1.6"}),t("path",{d:"M8 11.5833L10.9474 14.5L16 9.5",stroke:o?"#1E2024":"white",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]}):t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:o?"#B5B7BB":"#2A2C32",strokeWidth:"1.6"})})},d=x.forwardRef(({gift:e,onClick:l,className:o,giftType:a,theme:n},p)=>t("div",{ref:p,className:r("bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all",a===2?"border-brand-0 bg-container-secondary-0 cursor-default":`cursor-pointer hover:shadow-sm ${e.selected?"border-brand-0 bg-container-secondary-0":"border-lines bg-secondary-0"}`,o),onClick:()=>{a===1&&l?.(e)},children:i("div",{className:"flex size-full flex-col",children:[t("div",{className:"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end",children:e.tag&&t("div",{className:"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]",children:e.tag})}),i("div",{className:r("laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2"),children:[t("div",{className:"flex size-5 shrink-0 items-center justify-center",children:t(m,{checked:!!e.selected,theme:n})}),t("div",{className:r("size-14 shrink-0","tablet:size-12"),children:t(c,{source:e.image,alt:e.name,className:"size-full rounded object-cover"})}),i("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1",children:[t(s,{size:2,html:e.name,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1")}),i("div",{className:"mt-auto flex items-center justify-between gap-2",children:[i("div",{className:"flex items-center gap-2",children:[t(s,{size:2,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px]"),children:e.currentPrice}),e.originalPrice&&e.originalPrice!==e.currentPrice&&t(s,{size:2,className:r("text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through"),children:e.originalPrice})]}),e.quantity>=1&&i(s,{size:4,className:r("text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]"),children:["x",e.quantity]})]})]})]})]})}));d.displayName="FreeGiftItem";var k=d;export{k as default};
1
+ "use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import*as m from"react";import{cn as r}from"../../helpers/index.js";import"../../components/badge.js";import h from"../../components/picture.js";import{Text as s}from"../../components/text.js";const f=({checked:e,theme:l})=>{const o=l==="dark";return e?i("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",fill:o?"#F5F6F7":"#080A0F"}),t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:o?"#F5F6F7":"#080A0F",strokeWidth:"1.6"}),t("path",{d:"M8 11.5833L10.9474 14.5L16 9.5",stroke:o?"#1E2024":"white",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]}):t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:o?"#B5B7BB":"#2A2C32",strokeWidth:"1.6"})})},p=m.forwardRef(({gift:e,onClick:l,className:o,giftType:a,theme:c,tagBgColor:d,tagTextColor:n},x)=>t("div",{ref:x,className:r("bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all",a===2?"border-brand-0 bg-container-secondary-0 cursor-default":`cursor-pointer hover:shadow-sm ${e.selected?"border-brand-0 bg-container-secondary-0":"border-lines bg-secondary-0 hover:bg-container-secondary"}`,o),onClick:()=>{a===1&&l?.(e)},children:i("div",{className:"flex size-full flex-col",children:[t("div",{className:"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end",children:e.tag&&t("div",{className:"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]",style:{...d?{backgroundColor:d}:{},...n?{color:n}:{}},children:e.tag})}),i("div",{className:r("laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2"),children:[t("div",{className:"flex size-5 shrink-0 items-center justify-center",children:t(f,{checked:!!e.selected,theme:c})}),t("div",{className:r("size-14 shrink-0","tablet:size-12"),children:t(h,{source:e.image,alt:e.name,className:"size-full rounded object-cover"})}),i("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1",children:[t(s,{size:2,html:e.name,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1")}),i("div",{className:"mt-auto flex items-center justify-between gap-2",children:[i("div",{className:"flex items-center gap-2",children:[t(s,{size:2,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px]"),children:e.currentPrice}),e.originalPrice&&e.originalPrice!==e.currentPrice&&t(s,{size:2,className:r("text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through"),children:e.originalPrice})]}),e.quantity>=1&&i(s,{size:4,className:r("text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]"),children:["x",e.quantity]})]})]})]})]})}));p.displayName="FreeGiftItem";var y=p;export{y as default};
@@ -11,6 +11,10 @@ export interface GiftSelectionProps extends React.HTMLAttributes<HTMLDivElement>
11
11
  giftType?: 1 | 2;
12
12
  selectedGiftSku?: string;
13
13
  theme?: 'light' | 'dark';
14
+ /** 赠品角标背景色 */
15
+ tagBgColor?: string;
16
+ /** 赠品角标文字颜色 */
17
+ tagTextColor?: string;
14
18
  }
15
19
  /**
16
20
  * GiftSelection - 赠品选择区域
@@ -1 +1 @@
1
- "use client";import{jsx as e,jsxs as g}from"react/jsx-runtime";import*as c from"react";import{cn as i}from"../../helpers/index.js";import{Text as d}from"../../components/text.js";import x from"./FreeGiftItem.js";const o=c.forwardRef(({freeGiftLabel:l,freeGifts:t,onGiftClick:r,className:p,giftType:a,theme:m},n)=>!t||t.length===0?null:g("div",{ref:n,className:i("flex w-full flex-col gap-2",p),children:[l&&e(d,{size:2,className:i("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] w-full"),children:l}),e("div",{className:i("tablet:flex-row laptop:flex-col flex flex-col gap-2"),children:t.map((f,s)=>e("div",{className:"min-w-0 flex-1",children:e(x,{gift:f,onClick:r,giftType:a,theme:m})},f.id||s))})]}));o.displayName="GiftSelection";var k=o;export{k as default};
1
+ "use client";import{jsx as e,jsxs as v}from"react/jsx-runtime";import*as x from"react";import{cn as i}from"../../helpers/index.js";import{Text as d}from"../../components/text.js";import G from"./FreeGiftItem.js";const r=x.forwardRef(({freeGiftLabel:l,freeGifts:t,onGiftClick:f,className:a,giftType:n,theme:p,tagBgColor:s,tagTextColor:m},c)=>!t||t.length===0?null:v("div",{ref:c,className:i("flex w-full flex-col gap-2",a),children:[l&&e(d,{size:2,className:i("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] w-full"),children:l}),e("div",{className:i("tablet:flex-row laptop:flex-col flex flex-col gap-2"),children:t.map((o,g)=>e("div",{className:"min-w-0 flex-1",children:e(G,{gift:o,onClick:f,giftType:n,theme:p,tagBgColor:s,tagTextColor:m})},o.id||g))})]}));r.displayName="GiftSelection";var y=r;export{y as default};
@@ -1,6 +1,6 @@
1
1
  import * as React from 'react';
2
- import type { FreeGift, ProductCardData, PureProductData, ProductTag, BuyOneGetOneShelfProductCardSemanticName } from './types.js';
3
- export interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {
2
+ import type { FreeGift, ProductCardData, PureProductData, ProductTag, BuyOneGetOneShelfCustomTagProps, BuyOneGetOneShelfProductCardSemanticName } from './types.js';
3
+ export interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement>, BuyOneGetOneShelfCustomTagProps {
4
4
  /** 产品数据(不包含赠品信息) */
5
5
  productData: PureProductData;
6
6
  /** 赠品列表 */
@@ -1 +1 @@
1
- "use client";import{jsx as c,jsxs as w}from"react/jsx-runtime";import*as i from"react";import{cn as y}from"../../helpers/index.js";import Q from"./ProductImage.js";import U from"./ProductInfo.js";import X from"./GiftSelection.js";import Y from"./PriceAndActions.js";import{BuyOneGetOneShelfContext as Z}from"./context.js";const k=i.forwardRef(({productData:e,gifts:t=[],giftType:a=1,selectedGiftSku:F,sceneImages:g,tags:v,layout:N,className:L,onProductClick:p,onProductImageClick:h,onLearnMore:M,onShopNow:O,onAddToCart:T,onGiftClick:G,onGiftSelectionChange:I,classNames:P,soldOutText:B,renderOriginalPrice:R,...H},A)=>{const{layout:j,theme:z}=i.useContext(Z),f=N??j,[E,W]=i.useState(!1),[V,_]=i.useState(!1),[b,s]=i.useState(()=>!t||t.length===0?[]:a===2?t.map(r=>r.id):[t[0].id]),m=i.useMemo(()=>t?t.map(r=>({...r,selected:b.includes(r.id)})):[],[t,b]);i.useEffect(()=>{if(!t||t.length===0){s([]);return}s(a===2?t.map(r=>r.id):r=>{const o=r[0];return o&&t.some(l=>l.id===o)?[o]:[t[0].id]})},[t,a]);const d=i.useMemo(()=>({...e,gifts:t,gift_type:a}),[e,t,a]),$=r=>{if(a===2){const o=m.filter(n=>n.selected);G?.(r,o);return}s(()=>{const o=[r.id],n=t?.filter(l=>o.includes(l.id))||[];return G?.(r,n),I?.(n,d),o})},u=!!(h??p),S=`/products/${e.handle}`,x=()=>{(h??p)?.(d)},C=async(r,o)=>{const n=m.filter(K=>K.selected),l=o==="primary"?_:W;l(!0);try{switch(r){case"buyNow":await O?.(d,n);break;case"addCart":await T?.(d,n);break;case"learnMore":await M?.(d,n);break}}finally{l(!1)}},q=e.learnMoreFun??"learnMore",J=e.shopNowFun??"buyNow";return w("div",{ref:A,className:y("bg-container-primary rounded-box flex items-stretch overflow-hidden",f==="horizontal"?["laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col","laptop:col-span-2"]:["flex-col justify-between"],L),...H,children:[c(Q,{images:g,name:e.name,layout:f,tags:e.tags||v,onClick:u?x:void 0,href:u?void 0:S}),c("div",{className:y("bg-container-primary desktop:p-6 flex flex-col justify-between p-4",f==="horizontal"?["rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none","laptop:basis-[39.1%]","desktop:basis-[42.1%]","lg-desktop:basis-[42.1%]","shrink-0"]:["rounded-b-box","w-full","grow"]),children:w("div",{className:"flex flex-1 flex-col justify-between gap-6",children:[c(U,{name:e.name,onClick:u?x:void 0,href:u?void 0:S,description:e.description,classNames:P}),c(X,{freeGiftLabel:e.freeGiftLabel,freeGifts:m,onGiftClick:$,giftType:a,selectedGiftSku:F,theme:z}),c(Y,{currentPrice:e.currentPrice??"",originalPrice:e.originalPrice,priceLabel:e.priceLabel,learnMoreText:e.learnMoreText,shopNowText:e.shopNowText,soldOutText:B,onLearnMore:()=>C(q,"secondary"),onShopNow:()=>C(J,"primary"),availableForSale:e.availableForSale,learnMoreLoading:E,shopNowLoading:V,trackingTitle:e.name,trackingDescription:e.description,trackingSku:e.sku,classNames:P,renderOriginalPrice:R})]})})]})});k.displayName="BuyOneGetOneShelf.ProductCard";var ie=k;export{ie as default};
1
+ "use client";import{jsx as l,jsxs as p}from"react/jsx-runtime";import*as i from"react";import{cn as S}from"../../helpers/index.js";import ye from"./ProductImage.js";import Pe from"./ProductInfo.js";import Se from"./ProductTags.js";import be from"./DiscountBadge.js";import ke from"./GiftSelection.js";import Fe from"./PriceAndActions.js";import{BuyOneGetOneShelfContext as we}from"./context.js";const ve=[],b=i.forwardRef(({productData:e,gifts:t=ve,giftType:a=1,selectedGiftSku:k,sceneImages:F,tags:w,layout:v,className:B,onProductClick:C,onProductImageClick:x,onLearnMore:N,onShopNow:L,onAddToCart:M,onGiftClick:T,onGiftSelectionChange:O,classNames:d,soldOutText:I,renderOriginalPrice:R,tagTypeConfig:A,fill:H,outline:D,customTagStyle:E,customTagsIcon:j,renderDiscountBadge:z,discountTagTextColor:W,giftTagBgColor:V,giftTagTextColor:_,...Y},$)=>{const{layout:q,theme:J,tagTypeConfig:K,fill:Q,outline:U,customTagStyle:X,customTagsIcon:Z,renderDiscountBadge:ee,discountTagTextColor:te,giftTagBgColor:oe,giftTagTextColor:ne}=i.useContext(we),g=v??q,re=A??K,ie=H??Q,ae=D??U,le=E??X,ce=j??Z,se=z??ee,de=W??te,ue=V??oe,fe=_??ne,[ge,me]=i.useState(!1),[pe,Ce]=i.useState(!1),[G,u]=i.useState(()=>!t||t.length===0?[]:a===2?t.map(o=>o.id):[t[0].id]),m=i.useMemo(()=>t?t.map(o=>({...o,selected:G.includes(o.id)})):[],[t,G]);i.useEffect(()=>{if(!t||t.length===0){u([]);return}u(a===2?t.map(o=>o.id):o=>{const n=o[0];return n&&t.some(c=>c.id===n)?[n]:[t[0].id]})},[t,a]);const s=i.useMemo(()=>({...e,gifts:t,gift_type:a}),[e,t,a]),xe=o=>{if(a===2){const n=m.filter(r=>r.selected);T?.(o,n);return}u(()=>{const n=[o.id],r=t?.filter(c=>n.includes(c.id))||[];return T?.(o,r),O?.(r,s),n})},f=!!(x??C),h=`/products/${e.handle}`,y=()=>{(x??C)?.(s)},P=async(o,n)=>{const r=m.filter(he=>he.selected),c=n==="primary"?Ce:me;c(!0);try{switch(o){case"buyNow":await L?.(s,r);break;case"addCart":await M?.(s,r);break;case"learnMore":await N?.(s,r);break}}finally{c(!1)}},Te=e.learnMoreFun??"learnMore",Ge=e.shopNowFun??"buyNow";return p("div",{ref:$,className:S("bg-container-primary rounded-box relative flex items-stretch overflow-hidden",g==="horizontal"?["laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col","laptop:col-span-2"]:["flex-col justify-between"],B),...Y,children:[l(be,{text:e.discountAmount,style:le,icon:ce,renderBadge:se,className:d?.productCardDiscountBadge,textClassName:d?.productCardDiscountBadgeText,textColor:de}),l(ye,{images:F,name:e.name,layout:g,onClick:f?y:void 0,href:f?void 0:h}),l("div",{className:S("bg-container-primary desktop:p-6 flex flex-col justify-between p-4",g==="horizontal"?["rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none","laptop:basis-[39.1%]","desktop:basis-[42.1%]","lg-desktop:basis-[42.1%]","shrink-0"]:["rounded-b-box","w-full","grow"]),children:p("div",{className:"flex flex-1 flex-col justify-between gap-6",children:[p("div",{className:"flex flex-col gap-2",children:[l(Se,{tags:e.tags||w,tagTypeConfig:re,fill:ie,outline:ae}),l(Pe,{name:e.name,onClick:f?y:void 0,href:f?void 0:h,description:e.description,classNames:d})]}),l(ke,{freeGiftLabel:e.freeGiftLabel,freeGifts:m,onGiftClick:xe,giftType:a,selectedGiftSku:k,theme:J,tagBgColor:ue,tagTextColor:fe}),l(Fe,{currentPrice:e.currentPrice??"",originalPrice:e.originalPrice,priceLabel:e.priceLabel,learnMoreText:e.learnMoreText,shopNowText:e.shopNowText,soldOutText:I,onLearnMore:()=>P(Te,"secondary"),onShopNow:()=>P(Ge,"primary"),availableForSale:e.availableForSale,learnMoreLoading:ge,shopNowLoading:pe,trackingTitle:e.name,trackingDescription:e.description,trackingSku:e.sku,classNames:d,renderOriginalPrice:R})]})})]})});b.displayName="BuyOneGetOneShelf.ProductCard";var He=b;export{He as default};
@@ -1,12 +1,9 @@
1
1
  import * as React from 'react';
2
- import type { ProductTag } from './types.js';
3
2
  export interface ProductImageProps extends React.HTMLAttributes<HTMLDivElement> {
4
3
  /** 响应式图片集合 */
5
4
  images: any;
6
5
  /** 产品名称,用作 alt 文本 */
7
6
  name: string;
8
- /** 产品标签 */
9
- tags?: ProductTag[];
10
7
  /** 布局模式 */
11
8
  layout?: 'horizontal' | 'vertical';
12
9
  /** 点击回调 */
@@ -1 +1 @@
1
- "use client";import{Fragment as h,jsx as e,jsxs as z}from"react/jsx-runtime";import*as g from"react";import{cn as d}from"../../helpers/index.js";import v from"../../components/picture.js";import P from"../../components/badge.js";import{LocalizedLink as b}from"../../shared/LocalizedLink.js";const c=({images:a,name:r,tags:t,layout:o})=>{const{laptop:p,mobile:i,tablet:l,desktop:s,lgDesktop:n}=a;return z(h,{children:[e(v,{source:`${i?.url}, ${l?.url} 768, ${p?.url} 1024, ${s?.url} 1440, ${n?.url} 1920`,alt:r,className:d({"laptop:absolute inset-0 size-full static":o==="horizontal","w-full h-auto":o==="vertical"}),imgClassName:"size-full object-cover"}),t&&t.length>0&&e("div",{className:"absolute left-4 top-4 flex gap-2",children:t.map((m,f)=>e(P,{variant:m.variant,size:"lg",promotionalType:m.variant==="promotional"?m.promotionalType:void 0,children:m.label},f))})]})},u=g.forwardRef(({images:a,name:r,tags:t,layout:o="horizontal",className:p,onClick:i,href:l},s)=>{const n=d("relative grow overflow-hidden",o==="horizontal"?["min-h-[240px]","laptop:basis-[60.9%]","desktop:basis-[57.9%]","lg-desktop:basis-[57.9%]"]:["h-fit grow-0"],i||l?"cursor-pointer":"",p);return i?e("div",{ref:s,className:n,onClick:i,children:e(c,{images:a,name:r,tags:t,layout:o})}):l?e(b,{href:l,className:n,children:e("div",{ref:s,children:e(c,{images:a,name:r,tags:t,layout:o})})}):e("div",{ref:s,className:n,children:e(c,{images:a,name:r,tags:t,layout:o})})});u.displayName="ProductImage";var T=u;export{T as default};
1
+ "use client";import{jsx as t}from"react/jsx-runtime";import*as P from"react";import{cn as p}from"../../helpers/index.js";import b from"../../components/picture.js";import{LocalizedLink as h}from"../../shared/LocalizedLink.js";const m=({images:r,name:a,layout:e})=>{const{laptop:n,mobile:i,tablet:s,desktop:l,lgDesktop:o}=r,c=l?.url||o?.url,u=n?.url||c,d=s?.url||u,g=i?.url||d,v=[o?.url||c,`${c} 1919`,`${u} 1439`,`${d} 1024`,`${g} 767`].join(", ");return t(b,{source:v,alt:a,className:p({"laptop:absolute inset-0 size-full static":e==="horizontal","w-full h-auto":e==="vertical"}),imgClassName:"size-full object-cover"})},f=P.forwardRef(({images:r,name:a,layout:e="horizontal",className:n,onClick:i,href:s},l)=>{const o=p("relative grow overflow-hidden",e==="horizontal"?["min-h-[240px]","laptop:basis-[60.9%]","desktop:basis-[57.9%]","lg-desktop:basis-[57.9%]"]:["h-fit grow-0"],i||s?"cursor-pointer":"",n);return i?t("div",{ref:l,className:o,onClick:i,children:t(m,{images:r,name:a,layout:e})}):s?t(h,{href:s,className:o,children:t("div",{ref:l,children:t(m,{images:r,name:a,layout:e})})}):t("div",{ref:l,className:o,children:t(m,{images:r,name:a,layout:e})})});f.displayName="ProductImage";var I=f;export{I as default};
@@ -0,0 +1,14 @@
1
+ import type { BuyOneGetOneShelfCustomTagProps, ProductTag } from './types.js';
2
+ export interface ProductTagsProps extends Pick<BuyOneGetOneShelfCustomTagProps, 'tagTypeConfig' | 'fill' | 'outline'> {
3
+ /** 产品标签 */
4
+ tags?: ProductTag[];
5
+ className?: string;
6
+ }
7
+ /**
8
+ * ProductTags - 产品标题上方的标签列表
9
+ */
10
+ declare const ProductTags: {
11
+ ({ tags, tagTypeConfig, fill, outline, className }: ProductTagsProps): import("react/jsx-runtime").JSX.Element | null;
12
+ displayName: string;
13
+ };
14
+ export default ProductTags;
@@ -0,0 +1 @@
1
+ "use client";import{jsx as g}from"react/jsx-runtime";import"react";import{cn as d}from"../../helpers/index.js";import f from"../../components/badge.js";const p=(t,r,{tagTypeConfig:n,fill:a,outline:i})=>{const o=((r===0?n?.firstTagVariant:r===1?n?.secondTagVariant:void 0)||void 0)??t.variant;if(o==="promotional")return{variant:o};const e=o==="fill"?{outline:a?.outlineColor,bg:a?.bgColor}:{outline:i?.outlineColor,bg:i?.bgColor},u={...e.outline?{outlineColor:e.outline}:{},...e.bg?{backgroundColor:e.bg,backgroundImage:"none"}:{}};return o==="outline"&&e.outline&&(u.color=e.outline),{variant:o,style:Object.keys(u).length>0?u:void 0}},c=({tags:t,tagTypeConfig:r,fill:n,outline:a,className:i})=>!t||t.length===0?null:g("div",{className:d("bogo-shelf-tags flex flex-wrap gap-2",i),children:t.map((l,s)=>{const{variant:o,style:e}=p(l,s,{tagTypeConfig:r,fill:n,outline:a});return g(f,{variant:o,size:"lg",style:e,promotionalType:o==="promotional"?l.promotionalType:void 0,children:l.label},s)})});c.displayName="BuyOneGetOneShelf.ProductTags";var y=c;export{y as default};
@@ -1,5 +1,6 @@
1
1
  import * as React from 'react';
2
+ import type { BuyOneGetOneShelfCustomTagProps } from './types.js';
2
3
  export declare const BuyOneGetOneShelfContext: React.Context<{
3
4
  layout: "horizontal" | "vertical";
4
5
  theme?: "light" | "dark";
5
- }>;
6
+ } & BuyOneGetOneShelfCustomTagProps>;
@@ -5,4 +5,4 @@ declare const BuyOneGetOneShelf: {
5
5
  ProductCard: React.ForwardRefExoticComponent<import("./ProductCard.js").ProductCardProps & React.RefAttributes<HTMLDivElement>>;
6
6
  };
7
7
  export default BuyOneGetOneShelf;
8
- export type { FreeGift, FreeGiftWithSelection, ProductTag, ButtonFunctionType, BuyOneGetOneShelfSemanticName, BuyOneGetOneShelfRootSemanticName, BuyOneGetOneShelfProductCardSemanticName, ResponsiveImage, ResponsiveImages, BaseProductData, PureProductData, WithGiftData, ProductData, ProductCardData, CopyConfig, BogoItem, BuyOneGetOneShelfData, BuyOneGetOneShelfProps, BuyOneGetOneShelfCardProps, } from './types.js';
8
+ export type { FreeGift, FreeGiftWithSelection, ProductTag, ButtonFunctionType, BuyOneGetOneShelfSemanticName, BuyOneGetOneShelfRootSemanticName, BuyOneGetOneShelfProductCardSemanticName, BuyOneGetOneShelfCustomTagProps, DiscountTagStyle, DiscountBadgeRenderContext, TagVariant, TagTypeConfig, TagColorConfig, ResponsiveImage, ResponsiveImages, BaseProductData, PureProductData, WithGiftData, ProductData, ProductCardData, CopyConfig, BogoItem, BuyOneGetOneShelfData, BuyOneGetOneShelfProps, BuyOneGetOneShelfCardProps, } from './types.js';
@@ -1 +1 @@
1
- "use client";import{jsx as s,jsxs as O}from"react/jsx-runtime";import*as t from"react";import{cn as i}from"../../helpers/index.js";import S from"./ProductCard.js";import{Heading as G,Text as P}from"../../components/index.js";import{BuyOneGetOneShelfContext as b}from"./context.js";import{useExposure as E}from"../../hooks/useExposure.js";const D="shelf",k="buy_one_get_one_shelf";function h(o){return t.Children.toArray(o).flatMap(e=>t.isValidElement(e)&&e.type===t.Fragment?h(e.props.children):[e])}function z(o){return t.isValidElement(o)?o.props.layout??"horizontal":"horizontal"}function T(o,e){let n=0,l=0;for(let r=0;r<e;r++){const p=z(o[r])==="horizontal"?2:1;p===2&&n>0&&(n=0),n+=p,n===2&&(l=r+1,n=0)}return o.slice(0,l)}const g=t.forwardRef(({className:o,classNames:e={},theme:n,title:l,subtitle:r,children:p,viewMoreThreshold:f=4,viewMoreText:R="View More",viewLessText:x="View Less",...v},C)=>{const d=t.useRef(null),[c,N]=t.useState(!1);E(d,{componentType:D,componentName:k,componentTitle:l,componentDescription:r}),t.useImperativeHandle(C,()=>d.current);const u=h(p),m=u.length>f,B=(m&&!c?T(u,f):u).map(a=>{if(!t.isValidElement(a))return a;const y=a.props;return y.layout==="horizontal"?t.cloneElement(a,{className:i(y.className,"laptop:col-span-2")}):a});return s(b.Provider,{value:{layout:"horizontal",theme:n},children:O("div",{ref:d,className:i("bogo-shelf-root w-full py-0",{"aiui-dark":n==="dark"},o,e?.root),...v,children:[l&&s(G,{as:"h2",size:3,html:l,className:i("bogo-shelf-title text-info-primary mb-4",e?.title)}),r&&s(P,{size:3,as:"p",html:r,className:i("bogo-shelf-description text-info-primary mb-6",e?.description)}),s("div",{className:i("grid grid-cols-1 gap-6","laptop:grid-cols-2"),children:B}),m&&s("div",{className:"mt-6 flex justify-center",children:O("button",{type:"button",onClick:()=>N(a=>!a),"aria-expanded":c,className:i("hover:text-brand-0 lg-desktop:text-[16px] text-info-primary flex cursor-pointer items-center gap-2 border-none bg-transparent text-[14px] font-bold outline-none transition-colors",e?.viewMoreBtn),children:[c?x:R,s("svg",{className:i("size-4 transition-transform",c&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})})]})})});g.displayName="BuyOneGetOneShelf.Root";const w={Root:g,ProductCard:S};var _=w;export{_ as default};
1
+ "use client";import{jsx as i,jsxs as P}from"react/jsx-runtime";import*as t from"react";import{cn as s}from"../../helpers/index.js";import V from"./ProductCard.js";import{Heading as I,Text as T}from"../../components/index.js";import{BuyOneGetOneShelfContext as H}from"./context.js";import{useExposure as F}from"../../hooks/useExposure.js";const _="shelf",j="buy_one_get_one_shelf";function B(o){return t.Children.toArray(o).flatMap(e=>t.isValidElement(e)&&e.type===t.Fragment?B(e.props.children):[e])}function W(o){return t.isValidElement(o)?o.props.layout??"horizontal":"horizontal"}function A(o,e){let n=0,l=0;for(let r=0;r<e;r++){const p=W(o[r])==="horizontal"?2:1;p===2&&n>0&&(n=0),n+=p,n===2&&(l=r+1,n=0)}return o.slice(0,l)}const G=t.forwardRef(({className:o,classNames:e={},theme:n,title:l,subtitle:r,children:p,viewMoreThreshold:f=4,viewMoreText:b="View More",viewLessText:D="View Less",tagTypeConfig:m,fill:y,outline:h,customTagStyle:O,customTagsIcon:R,renderDiscountBadge:g,discountTagTextColor:x,giftTagBgColor:v,giftTagTextColor:C,...E},k)=>{const u=t.useRef(null),[c,z]=t.useState(!1);F(u,{componentType:_,componentName:j,componentTitle:l,componentDescription:r}),t.useImperativeHandle(k,()=>u.current);const d=B(p),N=d.length>f,w=N&&!c?A(d,f):d,L=t.useMemo(()=>({layout:"horizontal",theme:n,tagTypeConfig:m,fill:y,outline:h,customTagStyle:O,customTagsIcon:R,renderDiscountBadge:g,discountTagTextColor:x,giftTagBgColor:v,giftTagTextColor:C}),[n,m,y,h,O,R,g,x,v,C]),M=w.map(a=>{if(!t.isValidElement(a))return a;const S=a.props;return S.layout==="horizontal"?t.cloneElement(a,{className:s(S.className,"laptop:col-span-2")}):a});return i(H.Provider,{value:L,children:P("div",{ref:u,className:s("bogo-shelf-root w-full py-0",{"aiui-dark":n==="dark"},o,e?.root),...E,children:[l&&i(I,{as:"h2",size:3,html:l,className:s("bogo-shelf-title text-info-primary mb-4",e?.title)}),r&&i(T,{size:3,as:"p",html:r,className:s("bogo-shelf-description text-info-primary mb-6",e?.description)}),i("div",{className:s("grid grid-cols-1 gap-6","laptop:grid-cols-2"),children:M}),N&&i("div",{className:"mt-6 flex justify-center",children:P("button",{type:"button",onClick:()=>z(a=>!a),"aria-expanded":c,className:s("hover:text-brand-0 lg-desktop:text-[16px] text-info-primary flex cursor-pointer items-center gap-2 border-none bg-transparent text-[14px] font-bold outline-none transition-colors",e?.viewMoreBtn),children:[c?D:b,i("svg",{className:s("size-4 transition-transform",c&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:i("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})})]})})});G.displayName="BuyOneGetOneShelf.Root";const q={Root:G,ProductCard:V};var Y=q;export{Y as default};
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import type { Theme } from '../../types/props';
2
+ import type { Theme, Img } from '../../types/props';
3
3
  /**
4
4
  * 按钮功能类型
5
5
  */
@@ -47,8 +47,73 @@ export interface ProductTag {
47
47
  /** 促销类型(仅当 variant 为 'promotional' 时有效) */
48
48
  promotionalType?: 'plus-member' | 'regular-member' | 'regular-discount' | 'time-limited-discount';
49
49
  }
50
+ /**
51
+ * 自定义折扣角标样式
52
+ * style1/style2/style3 为内置预设样式,custom 为自定义上传图标或 renderDiscountBadge 自渲染
53
+ */
54
+ export type DiscountTagStyle = 'style1' | 'style2' | 'style3' | 'custom';
55
+ /**
56
+ * 自定义标签形态
57
+ * fill=填充(品牌渐变背景),outline=描边(透明背景 + 描边)
58
+ */
59
+ export type TagVariant = 'fill' | 'outline';
60
+ /**
61
+ * 标签形态配置
62
+ * 按标签位置(第 0 个 / 第 1 个)统一指定形态,优先于 tag 数据自带 variant。
63
+ */
64
+ export interface TagTypeConfig {
65
+ /** 第 0 个标签的形态,空字符串视为未设置 */
66
+ firstTagVariant?: TagVariant | '';
67
+ /** 第 1 个标签的形态,空字符串视为未设置 */
68
+ secondTagVariant?: TagVariant | '';
69
+ }
70
+ /**
71
+ * 标签颜色配置
72
+ * 按形态(fill / outline)统一指定颜色,覆盖默认品牌色。
73
+ * - fill:bgColor=背景色,outlineColor=描边色
74
+ * - outline:outlineColor=描边色(文字色自动跟随),bgColor=背景色
75
+ */
76
+ export interface TagColorConfig {
77
+ fill?: {
78
+ bgColor?: string;
79
+ outlineColor?: string;
80
+ };
81
+ outline?: {
82
+ outlineColor?: string;
83
+ bgColor?: string;
84
+ };
85
+ }
86
+ /**
87
+ * 折扣角标渲染上下文
88
+ */
89
+ export interface DiscountBadgeRenderContext {
90
+ text?: string;
91
+ }
92
+ /**
93
+ * 自定义标签相关配置(折扣角标 + tag 颜色),Root 与 ProductCard 共用
94
+ */
95
+ export interface BuyOneGetOneShelfCustomTagProps {
96
+ /** 标签形态配置:按位置(第 0/第 1 个)指定形态,优先于 tag 数据自带 variant */
97
+ tagTypeConfig?: TagTypeConfig;
98
+ /** fill 形态标签颜色(bgColor=背景色,outlineColor=描边色),覆盖默认品牌色 */
99
+ fill?: TagColorConfig['fill'];
100
+ /** outline 形态标签颜色(outlineColor=描边色,bgColor=背景色),覆盖默认品牌色 */
101
+ outline?: TagColorConfig['outline'];
102
+ /** 折扣角标样式(style1/style2/style3 为内置预设,custom 为自定义上传),默认 style1 */
103
+ customTagStyle?: DiscountTagStyle;
104
+ /** 自定义折扣角标图标(仅 customTagStyle=custom 时生效) */
105
+ customTagsIcon?: Img;
106
+ /** 自定义折扣角标渲染(仅 customTagStyle=custom 时生效) */
107
+ renderDiscountBadge?: (ctx: DiscountBadgeRenderContext) => React.ReactNode;
108
+ /** 左上角折扣角标文字颜色,覆盖默认文字色;未设置时保持原样式 */
109
+ discountTagTextColor?: string;
110
+ /** 赠品角标(gift.tag)背景色,覆盖默认品牌色;未设置时保持原样式 */
111
+ giftTagBgColor?: string;
112
+ /** 赠品角标(gift.tag)文字颜色,覆盖默认文字色;未设置时保持原样式 */
113
+ giftTagTextColor?: string;
114
+ }
50
115
  export type BuyOneGetOneShelfRootSemanticName = 'root' | 'title' | 'description' | 'content' | 'viewMoreBtn';
51
- export type BuyOneGetOneShelfProductCardSemanticName = 'productCard' | 'productCardImage' | 'productCardTitle' | 'productCardDescription' | 'productCardPriceLabel' | 'productCardPrice' | 'productCardOriginalPrice' | 'productCardGiftsContainer' | 'productCardBtnGroup';
116
+ export type BuyOneGetOneShelfProductCardSemanticName = 'productCard' | 'productCardImage' | 'productCardDiscountBadge' | 'productCardDiscountBadgeText' | 'productCardTitle' | 'productCardDescription' | 'productCardPriceLabel' | 'productCardPrice' | 'productCardOriginalPrice' | 'productCardGiftsContainer' | 'productCardBtnGroup';
52
117
  export type BuyOneGetOneShelfSemanticName = BuyOneGetOneShelfRootSemanticName | BuyOneGetOneShelfProductCardSemanticName;
53
118
  /**
54
119
  * 响应式图片接口
@@ -114,6 +179,8 @@ export interface PureProductData extends BaseProductData {
114
179
  freeGiftLabel?: string;
115
180
  /** 产品标签 */
116
181
  tags?: ProductTag[];
182
+ /** 折扣金额文案(如 '$20'),用于左上角折扣角标;为空时不渲染角标 */
183
+ discountAmount?: string;
117
184
  /** 赠品选择模式 */
118
185
  giftSelectionMode?: 'single' | 'multiple';
119
186
  /** Learn More 按钮功能(默认 'learnMore') */
@@ -177,7 +244,7 @@ export interface BuyOneGetOneShelfData {
177
244
  /** View Less 按钮文案,默认 'View Less' */
178
245
  viewLessText?: string;
179
246
  }
180
- export interface BuyOneGetOneShelfProps extends React.HTMLAttributes<HTMLDivElement> {
247
+ export interface BuyOneGetOneShelfProps extends React.HTMLAttributes<HTMLDivElement>, BuyOneGetOneShelfCustomTagProps {
181
248
  /** 标题 */
182
249
  title?: string;
183
250
  /** 副标题 */
@@ -1 +1 @@
1
- "use client";import{jsx as o,jsxs as u}from"react/jsx-runtime";import N,{useImperativeHandle as I,useRef as c}from"react";import{cn as s}from"../../helpers/utils.js";import h from"../../components/picture.js";import{withLayout as _}from"../../shared/Styles.js";import $ from"../Title/index.js";import y from"./SwiperCategory.js";import{useExposure as b}from"../../hooks/useExposure.js";import{trackUrlRef as v}from"../../shared/trackUrlRef.js";const l="image",m="category_banner",d=5,L=3,T=(e,a)=>{const t=[];for(let i=0;i<e.length;i+=a)t.push(e.slice(i,i+a));return t},E=({data:e,configuration:a})=>{const t=c(null);return b(t,{componentType:l,componentName:m,componentTitle:e?.name,position:a?.index+1}),u("div",{ref:t,className:s("tablet:p-3 laptop:p-4 desktop:p-6","bg-container-primary hover:bg-info-white group box-border flex h-full cursor-pointer flex-col justify-start overflow-hidden duration-300","desktop:gap-2 gap-1","rounded-box"),children:[o("div",{className:"flex items-center justify-center transition-all duration-300 group-hover:scale-110",children:o("a",{"aria-label":e?.name,href:v(e?.link,`${l}_${m}`),"data-headless-type-name":`${l}#${m}`,"data-headless-title-desc-button":`${e?.name}`,onClick:()=>a?.event?.primaryButton(e,a?.index),children:o(h,{alt:e?.image?.alt||"",source:e?.image?.url||"",className:"laptop:size-[88px] desktop:size-[116px] lg-desktop:size-[146px] size-[72px]",imgClassName:"size-full object-cover"})})}),o("p",{className:"lg-desktop:text-lg lg-desktop:!leading-6 text-info-primary box-border line-clamp-2 text-center text-sm font-bold leading-4",children:e?.name})]})},M=({data:e,configuration:a,index:t,isFirstItemLarger:i})=>{const r=c(null);b(r,{componentType:l,componentName:m,componentTitle:e?.name,position:a?.index+1});const n=t===0;return u("div",{ref:r,className:s("bg-container-primary box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden","hover:bg-info-white cursor-pointer duration-300",i?s("p-4",n?"aspect-h-[252] row-span-2":"aspect-h-[120]"):"max-h-[126px] px-3 py-4","rounded-box"),children:[o("a",{href:v(e?.link,`${l}_${m}`),"data-headless-type-name":`${l}#${m}`,"data-headless-title-desc-button":`${e?.name}`,"data-headless-nav-position":`''#${a?.index+1}`,onClick:()=>a?.event?.primaryButton(e,a?.index+1),children:o(h,{source:e?.image?.url||"",alt:e?.image?.alt||"",className:s("m-auto mb-2 flex justify-center object-contain [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",i?s(n?"size-full max-h-[146px] overflow-hidden":"max-h-[72px] max-w-[72px]"):"size-[72px]")})}),o("p",{className:s("text-info-primary w-full text-center text-sm font-bold",i?"line-clamp-2":"shrink-0 truncate"),children:e?.name})]})},S=({data:e,configuration:a})=>{const i=(a?.totalCategories??0)<=d;return o("div",{className:`gap-3 ${i?"grid grid-cols-2":"flex h-full flex-col"}`,children:e?.map((r,n)=>o(M,{index:n,data:r,configuration:a,isFirstItemLarger:i},n))})},C=N.forwardRef((e,a)=>{const{data:t,className:i="",key:r,event:n,...k}=e,p=(t?.isShowSelect?t?.products:t?.productData)||[],g=p.length>d,f=p.length,w=T(p,g?L:d),x=c(null);return I(a,()=>x.current),u("div",{...k,ref:x,className:s("w-full overflow-hidden",i,{"aiui-dark":t?.theme==="dark"}),children:[t?.title&&o($,{data:{title:t?.title},className:"text-4xl"}),o("div",{className:"tablet:block hidden",children:o(y,{id:`Category${r}`,Slide:E,data:{list:p,configuration:{shape:t?.shape,event:n,title:t?.title,totalCategories:f}},paginationClassName:"[&_.swiper-pagination]:!-bottom-6"})}),o("div",{className:"tablet:hidden block",children:o(y,{id:`Category1${r}`,Slide:S,data:{list:w,configuration:{shape:t?.shape,event:n,title:t?.title,totalCategories:f}},isHalf:g,paginationClassName:"[&_.swiper-pagination]:!-bottom-6"})}),o("div",{className:"h-7"})]})});C.displayName="Category";var F=_(C);export{F as default};
1
+ "use client";import{jsx as i,jsxs as g}from"react/jsx-runtime";import I,{useImperativeHandle as _,useRef as d}from"react";import{cn as s,getLocalizedPath as L}from"../../helpers/utils.js";import y from"../../components/picture.js";import{withLayout as T}from"../../shared/Styles.js";import{useAiuiContext as b}from"../AiuiProvider/index.js";import E from"../Title/index.js";import v from"./SwiperCategory.js";import{useExposure as C}from"../../hooks/useExposure.js";import{trackUrlRef as M}from"../../shared/trackUrlRef.js";const l="image",m="category_banner",u=5,$=3,S=(e,o)=>{const t=[];for(let a=0;a<e.length;a+=o)t.push(e.slice(a,a+o));return t},k=(e,o)=>e?.trim()?M(L(e,o),`${l}_${m}`):void 0,D=({data:e,configuration:o})=>{const t=d(null),{locale:a="us"}=b();return C(t,{componentType:l,componentName:m,componentTitle:e?.name,position:o?.index+1}),g("div",{ref:t,className:s("tablet:p-3 laptop:p-4 desktop:p-6","bg-container-primary hover:bg-info-white group box-border flex h-full cursor-pointer flex-col justify-start overflow-hidden duration-300","desktop:gap-2 gap-1","rounded-box"),children:[i("div",{className:"flex items-center justify-center transition-all duration-300 group-hover:scale-110",children:i("a",{"aria-label":e?.name,href:k(e?.link,a),"data-headless-type-name":`${l}#${m}`,"data-headless-title-desc-button":`${e?.name}`,onClick:()=>o?.event?.primaryButton(e,o?.index),children:i(y,{alt:e?.image?.alt||"",source:e?.image?.url||"",className:"laptop:size-[88px] desktop:size-[116px] lg-desktop:size-[146px] size-[72px]",imgClassName:"size-full object-cover"})})}),i("p",{className:"lg-desktop:text-lg lg-desktop:!leading-6 text-info-primary box-border line-clamp-2 text-center text-sm font-bold leading-4",children:e?.name})]})},H=({data:e,configuration:o,index:t,isFirstItemLarger:a})=>{const n=d(null),{locale:r="us"}=b();C(n,{componentType:l,componentName:m,componentTitle:e?.name,position:o?.index+1});const c=t===0;return g("div",{ref:n,className:s("bg-container-primary box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden","hover:bg-info-white cursor-pointer duration-300",a?s("p-4",c?"aspect-h-[252] row-span-2":"aspect-h-[120]"):"max-h-[126px] px-3 py-4","rounded-box"),children:[i("a",{href:k(e?.link,r),"data-headless-type-name":`${l}#${m}`,"data-headless-title-desc-button":`${e?.name}`,"data-headless-nav-position":`''#${o?.index+1}`,onClick:()=>o?.event?.primaryButton(e,o?.index+1),children:i(y,{source:e?.image?.url||"",alt:e?.image?.alt||"",className:s("m-auto mb-2 flex justify-center object-contain [&_img]:h-full [&_img]:w-auto [&_img]:object-contain",a?s(c?"size-full max-h-[146px] overflow-hidden":"max-h-[72px] max-w-[72px]"):"size-[72px]")})}),i("p",{className:s("text-info-primary w-full text-center text-sm font-bold",a?"line-clamp-2":"shrink-0 truncate"),children:e?.name})]})},P=({data:e,configuration:o})=>{const a=(o?.totalCategories??0)<=u;return i("div",{className:`gap-3 ${a?"grid grid-cols-2":"flex h-full flex-col"}`,children:e?.map((n,r)=>i(H,{index:r,data:n,configuration:o,isFirstItemLarger:a},r))})},w=I.forwardRef((e,o)=>{const{data:t,className:a="",key:n,event:r,...c}=e,p=(t?.isShowSelect?t?.products:t?.productData)||[],f=p.length>u,x=p.length,N=S(p,f?$:u),h=d(null);return _(o,()=>h.current),g("div",{...c,ref:h,className:s("w-full overflow-hidden",a,{"aiui-dark":t?.theme==="dark"}),children:[t?.title&&i(E,{data:{title:t?.title},className:"text-4xl"}),i("div",{className:"tablet:block hidden",children:i(v,{id:`Category${n}`,Slide:D,data:{list:p,configuration:{shape:t?.shape,event:r,title:t?.title,totalCategories:x}},paginationClassName:"[&_.swiper-pagination]:!-bottom-6"})}),i("div",{className:"tablet:hidden block",children:i(v,{id:`Category1${n}`,Slide:P,data:{list:N,configuration:{shape:t?.shape,event:r,title:t?.title,totalCategories:x}},isHalf:f,paginationClassName:"[&_.swiper-pagination]:!-bottom-6"})}),i("div",{className:"h-7"})]})});w.displayName="Category";var q=T(w);export{q as default};
@@ -1 +1 @@
1
- "use client";import{jsx as s,jsxs as g}from"react/jsx-runtime";import*as n from"react";import{cn as d}from"../../helpers/index.js";import{withLayout as A}from"../../shared/Styles.js";import{Text as _,Picture as B,Heading as P,Container as R}from"../../components/index.js";import{Swiper as D,SwiperSlide as y}from"swiper/react";import{cva as b}from"class-variance-authority";const x=(e,r)=>{const c=Date.now(),u=new Date(e).getTime(),m=new Date(r).getTime();return c>m?"completed":c<u?"not-started":"in-progress"},z=b("h-1 w-full overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),H=b("size-4 rounded-full transition-colors",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),S=b("font-bold leading-[1.2]",{variants:{state:{"in-progress-light":"text-[#080A0F]","in-progress-dark":"text-white","not-started-light":"text-[#080A0F]","not-started-dark":"text-[#F5F6F7]","completed-light":"text-[#4A4C56]/60","completed-dark":"text-[#F5F6F7]/60"}},defaultVariants:{state:"not-started-light"}}),j=b("laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F4E8BC]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F4E8BC]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),q=({timeStatus:e,theme:r="light",className:c,index:u,nodeLength:m})=>{const o=`${e}-${r}`,i=u===0,l=u===m-1;return g("div",{className:d(`event-schedule-timeline-node event-schedule-timeline-node--${e} relative my-2 flex h-1 w-full items-center justify-center`,c),children:[s("div",{className:d(`event-schedule-timeline-progress event-schedule-timeline-progress--${e}`,z({state:o}),i&&"rounded-l-full",l&&"rounded-r-full")}),s("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:s("div",{className:d(`event-schedule-timeline-dot event-schedule-timeline-dot--${e}`,H({state:o}))})})]})},G=(e,r)=>{if(e)return r==="in-progress"?e.active:r==="completed"&&e.completed||e.inactive},J=({timeStatus:e,item:r,theme:c="light",className:u,scheduleCount:m})=>{const o=n.useMemo(()=>G(r.icon,e),[r.icon,e]),i=`${e}-${c}`;return g("div",{className:d(`event-schedule-card event-schedule-card--${e}`,j({state:i}),u),children:[o&&s("div",{className:`event-schedule-card__background-icon event-schedule-card__background-icon--${e} laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]`,children:s(B,{source:o.url,alt:o.alt,className:"aspect-square"})}),g("div",{className:`event-schedule-card__content event-schedule-card__content--${e} tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8`,children:[s(P,{html:r.title,className:d(`event-schedule-card__title event-schedule-card__title--${e}`,m>=4?"desktop:text-[24px]":"desktop:text-[32px]","laptop:text-[24px] line-clamp-1 text-[20px]",S({state:i}))}),s("div",{className:`event-schedule-card__details event-schedule-card__details--${e} flex flex-col gap-0.5`,children:r.items.map((l,a)=>g("div",{className:`event-schedule-card__detail-item event-schedule-card__detail-item--${e} flex items-center gap-2`,children:[l.icon&&s(_,{className:d(`event-schedule-card__detail-icon event-schedule-card__detail-icon--${e} desktop:size-6 size-5 shrink-0`,S({state:i})),html:l.icon}),s(_,{html:l.label,className:d(`event-schedule-card__detail-text event-schedule-card__detail-text--${e} lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]`,S({state:i}))})]},a))})]})]})},L=n.forwardRef(({classNames:e={},data:r,className:c,...u},m)=>{const o=r.theme||"light",i=n.useRef(null),l=n.useRef(null),a=n.useRef(!1),f=n.useMemo(()=>r?.scheduleList?.length||2,[r?.scheduleList]),v=n.useMemo(()=>r.scheduleList.findIndex(t=>x(t.startDate,t.endDate)==="in-progress"),[r.scheduleList]),w=n.useCallback((t,h=!1)=>{const p=M=>{switch(M){case"mobile":return{slidesPerView:1.17};case"tablet":return t===2?{slidesPerView:2}:{slidesPerView:2.4};case"laptop":return t===2?{}:t===4?{slidesPerView:3.2}:{slidesPerView:t};case"desktop":return t===2?{slidesPerView:2}:{slidesPerView:t}}},T=p("mobile"),E=p("tablet"),C=p("laptop"),N=p("desktop");return h?{0:{...T,spaceBetween:12},768:{...E,spaceBetween:12},1024:{...C,spaceBetween:16},1440:{...N,spaceBetween:16}}:{0:T,768:E,1024:C,1440:N}},[]),F=n.useMemo(()=>w(f,!0),[f,w]),V=n.useMemo(()=>w(f,!1),[f,w]),k=r.showTimeline!==!1,$=n.useCallback(t=>{a.current||!l.current||(a.current=!0,l.current.slideTo(t.activeIndex,t.params.speed),setTimeout(()=>{a.current=!1},50))},[]),I=n.useCallback(t=>{a.current||!i.current||(a.current=!0,i.current.slideTo(t.activeIndex,t.params.speed),setTimeout(()=>{a.current=!1},50))},[]);return n.useEffect(()=>{i.current&&l.current&&v>=0&&setTimeout(()=>{a.current=!0,i.current?.slideTo(v,500),l.current?.slideTo(v,500),setTimeout(()=>{a.current=!1},600)},100)},[v]),g(R,{...u,ref:m,className:d("event-schedule-root overflow-hidden",e?.root,c),children:[k&&s(D,{breakpoints:V,className:"event-schedule-timeline h-4 w-full !overflow-visible",onSwiper:t=>{l.current=t},onSlideChange:I,children:r.scheduleList.map((t,h)=>{const p=x(t.startDate,t.endDate);return s(y,{className:"",children:s(q,{className:e?.timeline,timeStatus:p,theme:o,index:h,nodeLength:r.scheduleList.length})},"timelineNode"+h)})}),s(D,{breakpoints:F,className:"event-schedule-cards w-full !overflow-visible",onSwiper:t=>{i.current=t},onSlideChange:$,children:r.scheduleList.map((t,h)=>{const p=x(t.startDate,t.endDate);return s(y,{children:s(J,{timeStatus:p,className:d(k?"laptop:mt-4 mt-2":"",e?.eventScheduleCard),item:t,theme:o,scheduleCount:r.scheduleList.length})},"SwiperSlideItem"+h)})})]})});L.displayName="EventSchedule";var X=A(L);export{X as default};
1
+ "use client";import{jsx as r,jsxs as g}from"react/jsx-runtime";import*as n from"react";import{cn as a}from"../../helpers/index.js";import{withLayout as j}from"../../shared/Styles.js";import{Text as F,Picture as W,Heading as q}from"../../components/index.js";import{Swiper as V,SwiperSlide as A}from"swiper/react";import{cva as w}from"class-variance-authority";import{buildSsrSlideCss as B}from"../SwiperBox/buildSsrSlideCss.js";const N=(e,s)=>{const c=Date.now(),u=new Date(e).getTime(),m=new Date(s).getTime();return c>m?"completed":c<u?"not-started":"in-progress"},Z=w("h-1 w-full overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),G=w("size-4 rounded-full transition-colors",{variants:{state:{"in-progress-light":"bg-[#F6CD4E]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F6CD4E]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),y=w("font-bold leading-[1.2]",{variants:{state:{"in-progress-light":"text-[#080A0F]","in-progress-dark":"text-white","not-started-light":"text-[#080A0F]","not-started-dark":"text-[#F5F6F7]","completed-light":"text-[#4A4C56]/60","completed-dark":"text-[#F5F6F7]/60"}},defaultVariants:{state:"not-started-light"}}),J=w("laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden",{variants:{state:{"in-progress-light":"bg-[#F4E8BC]","in-progress-dark":"bg-[#D79941]","not-started-light":"bg-[#EAEAEC]","not-started-dark":"bg-[#1E2024]","completed-light":"bg-[#F4E8BC]","completed-dark":"bg-[#D79941]"}},defaultVariants:{state:"not-started-light"}}),K=({timeStatus:e,theme:s="light",className:c,index:u,nodeLength:m})=>{const d=`${e}-${s}`,i=u===0,l=u===m-1;return g("div",{className:a(`event-schedule-timeline-node event-schedule-timeline-node--${e} relative my-2 flex h-1 w-full items-center justify-center`,c),children:[r("div",{className:a(`event-schedule-timeline-progress event-schedule-timeline-progress--${e}`,Z({state:d}),i&&"rounded-l-full",l&&"rounded-r-full")}),r("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:r("div",{className:a(`event-schedule-timeline-dot event-schedule-timeline-dot--${e}`,G({state:d}))})})]})},O=(e,s)=>{if(e)return s==="in-progress"?e.active:s==="completed"&&e.completed||e.inactive},Q=({timeStatus:e,item:s,theme:c="light",className:u,scheduleCount:m})=>{const d=n.useMemo(()=>O(s.icon,e),[s.icon,e]),i=`${e}-${c}`;return g("div",{className:a(`event-schedule-card event-schedule-card--${e}`,J({state:i}),u),children:[d&&r("div",{className:`event-schedule-card__background-icon event-schedule-card__background-icon--${e} laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]`,children:r(W,{source:d.url,alt:d.alt,className:"aspect-square"})}),g("div",{className:`event-schedule-card__content event-schedule-card__content--${e} tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8`,children:[r(q,{html:s.title,className:a(`event-schedule-card__title event-schedule-card__title--${e}`,m>=4?"desktop:text-[24px]":"desktop:text-[32px]","laptop:text-[24px] line-clamp-1 text-[20px]",y({state:i}))}),r("div",{className:`event-schedule-card__details event-schedule-card__details--${e} flex flex-col gap-0.5`,children:s.items.map((l,o)=>g("div",{className:`event-schedule-card__detail-item event-schedule-card__detail-item--${e} flex items-center gap-2`,children:[l.icon&&r(F,{className:a(`event-schedule-card__detail-icon event-schedule-card__detail-icon--${e} desktop:size-6 size-5 shrink-0`,y({state:i})),html:l.icon}),r(F,{html:l.label,className:a(`event-schedule-card__detail-text event-schedule-card__detail-text--${e} lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]`,y({state:i}))})]},o))})]})]})},P=n.forwardRef(({classNames:e={},data:s,className:c,...u},m)=>{const d=s.theme||"light",i=n.useRef(null),l=n.useRef(null),o=n.useRef(!1),f=n.useMemo(()=>s?.scheduleList?.length||2,[s?.scheduleList]),v=n.useMemo(()=>s.scheduleList.findIndex(t=>N(t.startDate,t.endDate)==="in-progress"),[s.scheduleList]),S=n.useCallback((t,h=!1)=>{const p=R=>{switch(R){case"mobile":return{slidesPerView:1.17};case"tablet":return t===2?{slidesPerView:2}:{slidesPerView:2.4};case"laptop":return t===2?{}:t===4?{slidesPerView:3.2}:{slidesPerView:t};case"desktop":return t===2?{slidesPerView:2}:{slidesPerView:t}}},$=p("mobile"),L=p("tablet"),I=p("laptop"),M=p("desktop");return h?{0:{...$,spaceBetween:12},768:{...L,spaceBetween:12},1024:{...I,spaceBetween:16},1440:{...M,spaceBetween:16}}:{0:$,768:L,1024:I,1440:M}},[]),b=n.useMemo(()=>S(f,!0),[f,S]),x=n.useMemo(()=>S(f,!1),[f,S]),D=n.useId().replace(/[^a-zA-Z0-9_-]/g,""),k=`swiper-ssr-timeline-${D}`,T=`swiper-ssr-cards-${D}`,C=n.useMemo(()=>B(`.${k}`,x),[k,x]),E=n.useMemo(()=>B(`.${T}`,b),[T,b]),_=s.showTimeline!==!1,H=n.useCallback(t=>{o.current||!l.current||(o.current=!0,l.current.slideTo(t.activeIndex,t.params.speed),setTimeout(()=>{o.current=!1},50))},[]),z=n.useCallback(t=>{o.current||!i.current||(o.current=!0,i.current.slideTo(t.activeIndex,t.params.speed),setTimeout(()=>{o.current=!1},50))},[]);return n.useEffect(()=>{i.current&&l.current&&v>=0&&setTimeout(()=>{o.current=!0,i.current?.slideTo(v,500),l.current?.slideTo(v,500),setTimeout(()=>{o.current=!1},600)},100)},[v]),g("div",{...u,ref:m,className:a("event-schedule-root overflow-hidden",e?.root,c),children:[_&&C&&r("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:C}}),E&&r("style",{suppressHydrationWarning:!0,dangerouslySetInnerHTML:{__html:E}}),_&&r(V,{breakpoints:x,className:a("event-schedule-timeline h-4 w-full !overflow-visible",C&&k),onSwiper:t=>{l.current=t},onSlideChange:z,children:s.scheduleList.map((t,h)=>{const p=N(t.startDate,t.endDate);return r(A,{className:"",children:r(K,{className:e?.timeline,timeStatus:p,theme:d,index:h,nodeLength:s.scheduleList.length})},"timelineNode"+h)})}),r(V,{breakpoints:b,className:a("event-schedule-cards w-full !overflow-visible",E&&T),onSwiper:t=>{i.current=t},onSlideChange:H,children:s.scheduleList.map((t,h)=>{const p=N(t.startDate,t.endDate);return r(A,{children:r(Q,{timeStatus:p,className:a(_?"laptop:mt-4 mt-2":"",e?.eventScheduleCard),item:t,theme:d,scheduleCount:s.scheduleList.length})},"SwiperSlideItem"+h)})})]})});P.displayName="EventSchedule";var re=j(P);export{re as default};
@@ -1 +1 @@
1
- "use client";import{Fragment as tt,jsx as e,jsxs as u}from"react/jsx-runtime";import le,{useImperativeHandle as Se,useRef as k,useState as Pe,useEffect as Me}from"react";import C from"gsap";import{ScrollTrigger as H}from"gsap/dist/ScrollTrigger";import O from"jump.js";import{buildPictureSource as Re,resolveTierMedia as V,useMediaTier as Ee}from"./mediaResolver.js";import{useInView as De}from"react-intersection-observer";import je from"../../helpers/ScrollLoadVideo.js";import{Button as z,Heading as Ae,Picture as U,Text as G,Countdown as Oe}from"../../components/index.js";import{cn as p}from"../../helpers/index.js";import{cva as I}from"class-variance-authority";import{withLayout as Ue}from"../../shared/Styles.js";import{useExposure as Ge}from"../../hooks/useExposure.js";import{buildTrackingRef as Je,trackUrlRef as L}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as h,resolveComponentMediaType as _e}from"../../shared/track.js";import{getLocalizedPath as qe}from"../../helpers/utils.js";import{useAiuiContext as Fe}from"../AiuiProvider/index.js";import{sizeMap as We}from"../../components/button.js";import{VideoModal as Ye}from"../VideoModal/index.js";import Ze from"./HeroBannerCarousel.js";const f="hero_banner",Ke=I("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"tablet:px-[32px] laptop:top-1/2 laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] laptop:-translate-y-1/2 left-0 px-[16px]",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Qe=I("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),Xe=I("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),$e=I("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),et=({size:i="base"})=>{const{width:T,height:c}=We[i];return e("svg",{width:T,height:c,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:e("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},pe=le.forwardRef(({data:i,className:T,classNames:c={},onSecondaryClick:J,onPrimaryClick:_,onTertiaryClick:q,jumpOptions:ce={},a11yLabels:ue,...F},W)=>{const{locale:Y,pageHandle:me}=Fe(),Z=i.mode!=="single"&&!!i.items&&i.items.length>0,S={...{duration:500,offset:0},...ce},w=t=>!t||!Y?t:qe(t,Y),{label:K,title:s,subtitle:n,endDate:Q,endDate_tz:de,dateFormat:fe,pcImage:P,isShowVideo:X,isVideoLoop:ge=!0,primaryButton:o,secondaryButton:r,tertiaryButton:a,theme:be="light",size:M="default",titleSize:R,caption:$=[],blockLink:B,iconArray:ee,align:b="left",enableParallax:te=!0}=i,E=Array.isArray($)?$:[],ve=Array.isArray(ee)?ee:void 0,re=Ee(),ne=Re(i),xe=V(i,re,"video")?.url||"",[oe,ae]=Pe(!1),{ref:ye,inView:ie}=De(),D=k(null),j=k(null),A=k(null),v=k(null),d=k(null),m=_e(X),N=Je(me??"",m,f),g=V(i,re,m==="video"?"video":"image")?.id||P?.id||"",ke=s?.trim()||n?.trim()||P?.alt?.trim()||void 0,he=s!==void 0?s?.trim()||n?.trim()||P?.alt?.trim()||void 0:n&&n.trim()||"",Te=n&&n.trim()||"";Ge(d,{componentType:m,componentName:f,componentTitle:he,componentDescription:Te,creativeId:g,position:1});const we=B?L(w(B),N):void 0,Be=r?.link?L(w(r.link),N):void 0,Ne=o?.link?L(w(o.link),N):void 0,Ce=a?.link?L(w(a.link),N):void 0,He=h({interactive:!!B,componentType:m,componentName:f,title:s,description:n,position:1,creativeId:g}),Ve=h({interactive:!0,componentType:m,componentName:f,title:s,description:n,buttonName:"video play",position:1,creativeId:g}),ze=h({interactive:!!(r?.link||r?.isCustomSecondaryButton),componentType:m,componentName:f,title:s,description:n,buttonName:r?.text,position:1,creativeId:g}),Ie=h({interactive:!!(o?.link||o?.isCustomPrimaryButton),componentType:m,componentName:f,title:s,description:n,buttonName:o?.text,position:1,creativeId:g}),Le=h({interactive:!!(a?.link||a?.isCustomTertiaryButton),componentType:m,componentName:f,title:s,description:n,buttonName:a?.text,position:1,creativeId:g});return Se(W,()=>d.current),Me(()=>{if(Z||!te)return;C.registerPlugin(H);function t(){if(!v.current)return;const l=d.current?.clientHeight||100;window.innerHeight<=l?D.current=H.create({trigger:d.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:x=>{const y=x.progress*40-20;C.set(v.current,{yPercent:y})}}):(A.current=H.create({trigger:d.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:x=>{const y=x.progress*20-20;C.set(v.current,{yPercent:y})}}),j.current=H.create({trigger:d.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:x=>{const y=x.progress*20;C.set(v.current,{yPercent:y})}}))}return ie&&t(),()=>{D.current&&D.current.kill(),A.current&&A.current.kill(),j.current&&j.current.kill()}},[ie,i.items,te]),Z?e(Ze,{data:i,className:T,classNames:c,onPrimaryClick:_,onSecondaryClick:J,onTertiaryClick:q,a11yLabels:ue,ref:W,...F}):e("div",{...F,ref:ye,"data-ui-component-id":"HeroBanner",className:p(c.root),children:u("div",{ref:d,className:p(be==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":M==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":M==="sm"},T),children:[B&&e("a",{className:"absolute inset-0 z-10",href:we,tabIndex:-1,"aria-hidden":"true","aria-label":ke,...He}),e("div",{ref:v,className:p("absolute left-0 top-0 size-full"),children:X?u(tt,{children:[e(je,{poster:void 0,src:xe,className:"laptop:w-full absolute inset-0 h-full",videoClassName:"h-full object-cover",muted:!0,loop:ge,playsInline:!0,onPlaying:t=>{t.currentTarget.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")}}),e("div",{"data-video-poster":"true",className:"laptop:w-full pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:e(U,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:V(i,"lgDesktop","image")?.alt||"",source:ne})})]}):e(U,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:V(i,"lgDesktop","image")?.alt||"",source:ne})}),u("div",{className:Ke({align:b}),children:[u("div",{className:Qe({align:b}),children:[K&&e(G,{size:2,as:"p",className:p("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:K}),s&&e(Ae,{as:R==="4"?"h1":"h2",html:s,className:p("hero-banner-title",c.title),size:R?Number(R||"5"):M==="sm"?4:5}),n&&e(G,{as:"p",size:2,className:p("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",c.subtitle),html:n}),Q&&e("div",{className:"mt-3",children:e(Oe,{endDate:Q,endDate_tz:de,dateFormat:fe,variant:"spacious",align:b})})]}),u("div",{className:p(Xe({align:b}),c.buttonGroup),children:[u("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[r?.isShowPlayVideoButton&&r?.playVideoButtonText?u(z,{onClick:()=>ae(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...Ve,children:[r?.playVideoButtonText," ",e(et,{size:"lg"})]}):r?.text?u(z,{"aria-label":s??n,size:"lg",variant:"secondary",className:p("hero-banner-secondary-button",c.secondaryButton),as:r?.isCustomSecondaryButton?"button":"a",href:Be,target:r?.target,rel:r?.target==="_blank"?r?.rel??"noopener noreferrer":r?.rel,onClick:t=>{if(r.link?.startsWith("#")){t.preventDefault();const l=document.querySelector(r.link);l&&O(l,S)}r?.isCustomSecondaryButton&&J?.(i,t,r?.customSecondaryEventId)},...ze,children:[r?.text,e("span",{className:"sr-only",children:s??n})]}):null,o&&o.text&&e(z,{"aria-label":s??n,size:"lg",variant:"primary",className:p("hero-banner-primary-button",c.primaryButton),as:o?.isCustomPrimaryButton?"button":"a",href:Ne,target:o?.target,rel:o?.target==="_blank"?o?.rel??"noopener noreferrer":o?.rel,onClick:t=>{if(o.link?.startsWith("#")){t.preventDefault();const l=document.querySelector(o.link);l&&O(l,S)}o?.isCustomPrimaryButton&&_?.(i,t,o?.customPrimaryEventId)},...Ie,children:o.text})]}),a&&a.text&&u(z,{"aria-label":s??n,size:"lg",variant:"link",className:p("hero-banner-tertiary-button w-auto p-0",c.tertiaryButton),as:a?.isCustomTertiaryButton?"button":"a",href:Ce,target:a?.target,rel:a?.target==="_blank"?a?.rel??"noopener noreferrer":a?.rel,onClick:t=>{if(a.link?.startsWith("#")){t.preventDefault();const l=document.querySelector(a.link);l&&O(l,S)}a?.isCustomTertiaryButton&&q?.(i,t,a?.customTertiaryEventId)},...Le,children:[a.text,e("span",{className:"sr-only",children:s??n})]})]}),e("div",{className:$e({align:b}),children:ve?.map(t=>e("div",{className:"h-12",children:e(U,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:t?.pcImage?.alt||"",source:t?.pcImage?.url})},t?.pcImage?.url||t?.pcImage?.alt))})]}),E.length>0&&e("div",{className:p("hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]",c.captionGroup),children:E.map((t,l)=>u(le.Fragment,{children:[e(G,{size:2,className:p("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:t.title}),l<E.length-1&&e("div",{className:p("bg-info-primary w-px")})]},t.title))}),oe&&e(Ye,{visible:oe,videoUrl:r?.isYoutubeVideo?void 0:r?.videoUrl?.url,youTubeId:r?.isYoutubeVideo?r?.youtubeId:void 0,onCloseModal:()=>ae(!1)})]})})});pe.displayName="HeroBanner";var wt=Ue(pe);export{wt as default};
1
+ "use client";import{Fragment as rt,jsx as t,jsxs as u}from"react/jsx-runtime";import pe,{useImperativeHandle as Ee,useRef as k,useState as Me,useEffect as Pe}from"react";import N from"gsap";import{ScrollTrigger as C}from"gsap/dist/ScrollTrigger";import O from"jump.js";import{buildPictureSource as Re,resolveTierMedia as L,useMediaTier as De}from"./mediaResolver.js";import{useInView as je}from"react-intersection-observer";import Ae from"../../helpers/ScrollLoadVideo.js";import{Button as V,Heading as Oe,Picture as U,Text as G,Countdown as Ue}from"../../components/index.js";import{cn as p}from"../../helpers/index.js";import{cva as S}from"class-variance-authority";import{withLayout as Ge}from"../../shared/Styles.js";import{useExposure as Je}from"../../hooks/useExposure.js";import{buildTrackingRef as _e,trackUrlRef as z}from"../../shared/trackUrlRef.js";import{buildClickTrackingProps as h,resolveComponentMediaType as qe}from"../../shared/track.js";import{getLocalizedPath as Fe}from"../../helpers/utils.js";import{useAiuiContext as We}from"../AiuiProvider/index.js";import{sizeMap as Ye}from"../../components/button.js";import{VideoModal as Ze}from"../VideoModal/index.js";import Ke from"./HeroBannerCarousel.js";const f="hero_banner",Qe=S("hero-banner-content lg-desktop:gap-[32px] pointer-events-none absolute top-24 z-10 flex w-full flex-col gap-[24px]",{variants:{align:{left:"tablet:px-[32px] laptop:top-1/2 laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] laptop:-translate-y-1/2 left-0 px-[16px]",center:"tablet:top-[84px] laptop:top-[76px] desktop:top-[176px] lg-desktop:top-[192px] left-1/2 top-[84px] -translate-x-1/2 translate-y-0 items-center text-center"}},defaultVariants:{align:"left"}}),Xe=S("hero-banner-wrap-text lg-desktop:max-w-[824px] desktop:max-w-[648px] laptop:max-w-[440px] tablet:max-w-[704px] max-w-[358px]",{variants:{align:{left:"laptop:text-left",center:"text-center"}},defaultVariants:{align:"left"}}),$e=S("hero-banner-button-group lg-desktop:gap-x-3 pointer-events-auto flex flex-wrap items-center gap-x-2 gap-y-3",{variants:{align:{left:"laptop:justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),et=S("hero-banner-icon-group flex items-center gap-2",{variants:{align:{left:"justify-start",center:"justify-center"}},defaultVariants:{align:"left"}}),tt=({size:s="base"})=>{const{width:T,height:c}=Ye[s];return t("svg",{width:T,height:c,viewBox:"0 0 20 20",fill:"currentcolor",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M13.9599 9.30662C14.4547 9.63647 14.4547 10.3635 13.9599 10.6934L6.29558 15.8029C5.74179 16.1721 5 15.7751 5 15.1096V4.89042C5 4.22484 5.74179 3.82785 6.29558 4.19705L13.9599 9.30662Z",fill:"currentcolor"})})},ce=pe.forwardRef(({data:s,className:T,classNames:c={},onSecondaryClick:J,onPrimaryClick:_,onTertiaryClick:q,jumpOptions:ue={},a11yLabels:me,...F},W)=>{const{locale:Y,pageHandle:de}=We(),Z=s.mode!=="single"&&!!s.items&&s.items.length>0,I={...{duration:500,offset:0},...ue},w=e=>!e||!Y?e:Fe(e,Y),{label:K,title:l,subtitle:o,endDate:Q,endDate_tz:fe,dateFormat:ge,pcImage:E,isShowVideo:X,isVideoLoop:be=!0,primaryButton:a,secondaryButton:r,tertiaryButton:i,theme:ve="light",size:M="default",titleSize:P,caption:$=[],blockLink:B,iconArray:ee,align:b="left",enableParallax:te=!0}=s,R=Array.isArray($)?$:[],ye=Array.isArray(ee)?ee:void 0,re=De(),ne=Re(s),xe=L(s,re,"video")?.url||"",[oe,ae]=Me(!1),{ref:ke,inView:ie}=je(),D=k(null),j=k(null),A=k(null),v=k(null),d=k(null),m=qe(X),H=_e(de??"",m,f),g=L(s,re,m==="video"?"video":"image")?.id||E?.id||"",he=l?.trim()||o?.trim()||E?.alt?.trim()||void 0,Te=l!==void 0?l?.trim()||o?.trim()||E?.alt?.trim()||void 0:o&&o.trim()||"",we=o&&o.trim()||"";Je(d,{componentType:m,componentName:f,componentTitle:Te,componentDescription:we,creativeId:g,position:1});const Be=B?z(w(B),H):void 0,He=r?.link?z(w(r.link),H):void 0,Ne=a?.link?z(w(a.link),H):void 0,Ce=i?.link?z(w(i.link),H):void 0,Le=h({interactive:!!B,componentType:m,componentName:f,title:l,description:o,position:1,creativeId:g}),Ve=h({interactive:!0,componentType:m,componentName:f,title:l,description:o,buttonName:"video play",position:1,creativeId:g}),Se=h({interactive:!!(r?.link||r?.isCustomSecondaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:r?.text,position:1,creativeId:g}),ze=h({interactive:!!(a?.link||a?.isCustomPrimaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:a?.text,position:1,creativeId:g}),Ie=h({interactive:!!(i?.link||i?.isCustomTertiaryButton),componentType:m,componentName:f,title:l,description:o,buttonName:i?.text,position:1,creativeId:g});return Ee(W,()=>d.current),Pe(()=>{if(Z||!te)return;N.registerPlugin(C);function e(){if(!v.current)return;const n=d.current?.clientHeight||100;window.innerHeight<=n?D.current=C.create({trigger:d.current,start:"top bottom",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*40-20;N.set(v.current,{yPercent:x})}}):(A.current=C.create({trigger:d.current,start:"top bottom",end:"bottom bottom",scrub:!0,onUpdate:y=>{const x=y.progress*20-20;N.set(v.current,{yPercent:x})}}),j.current=C.create({trigger:d.current,start:"top top",end:"bottom top",scrub:!0,onUpdate:y=>{const x=y.progress*20;N.set(v.current,{yPercent:x})}}))}return ie&&e(),()=>{D.current&&D.current.kill(),A.current&&A.current.kill(),j.current&&j.current.kill()}},[ie,s.items,te]),Z?t(Ke,{data:s,className:T,classNames:c,onPrimaryClick:_,onSecondaryClick:J,onTertiaryClick:q,a11yLabels:me,ref:W,...F}):t("div",{...F,ref:ke,"data-ui-component-id":"HeroBanner",className:p(c.root),children:u("div",{ref:d,className:p(ve==="dark"?"aiui-dark":"","text-info-primary relative w-full overflow-hidden",{"tablet:aspect-[768/560] laptop:aspect-[1024/400] desktop:aspect-[1440/560] lg-desktop:aspect-[1920/800] aspect-[390/560]":M==="default","lg-desktop:aspect-[1920/800] desktop:aspect-[1440/640] laptop:aspect-[1024/480] tablet:aspect-[768/560] aspect-[390/560]":M==="sm"},T),children:[B&&t("a",{className:"absolute inset-0 z-10",href:Be,tabIndex:-1,"aria-hidden":"true","aria-label":he,...Le}),t("div",{ref:v,className:p("absolute left-0 top-0 size-full"),children:X?u(rt,{children:[t(Ae,{poster:void 0,src:xe,className:"laptop:w-full absolute inset-0 h-full transition-opacity duration-500",videoLayerClassName:"opacity-0",videoClassName:"h-full object-cover",muted:!0,loop:be,playsInline:!0,onPlaying:e=>{const n=e.currentTarget;n.parentElement?.classList.remove("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.add("opacity-0")},onWaiting:e=>{const n=e.currentTarget;if(n.currentTime>=.5)return;n.parentElement?.classList.add("opacity-0"),n.closest('[data-ui-component-id="HeroBanner"]')?.querySelector('[data-video-poster="true"]')?.classList.remove("opacity-0")}}),t("div",{"data-video-poster":"true",className:"laptop:w-full bg-container-primary pointer-events-none absolute inset-0 h-full transition-opacity duration-500",children:t(U,{className:"absolute inset-0 size-full",imgClassName:"size-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})})]}):t(U,{className:"laptop:w-full h-full",imgClassName:"h-full object-cover",loading:"eager",fetchPriority:"high",alt:L(s,"lgDesktop","image")?.alt||"",source:ne})}),u("div",{className:Qe({align:b}),children:[u("div",{className:Xe({align:b}),children:[K&&t(G,{size:2,as:"p",className:p("hero-banner-label font-heading lg-desktop:text-[18px] desktop:text-base text-sm"),html:K}),l&&t(Oe,{as:P==="4"?"h1":"h2",html:l,className:p("hero-banner-title",c.title),size:P?Number(P||"5"):M==="sm"?4:5}),o&&t(G,{as:"p",size:2,className:p("hero-banner-subtitle font-heading lg-desktop:text-[18px] desktop:text-base laptop:mt-2 lg-desktop:mt-4 mt-1 text-sm",c.subtitle),html:o}),Q&&t("div",{className:"mt-3",children:t(Ue,{endDate:Q,endDate_tz:fe,dateFormat:ge,variant:"spacious",align:b})})]}),u("div",{className:p($e({align:b}),c.buttonGroup),children:[u("div",{className:"lg-desktop:gap-3 flex items-center gap-2",children:[r?.isShowPlayVideoButton&&r?.playVideoButtonText?u(V,{onClick:()=>ae(!0),size:"lg",variant:"secondary",className:"hero-banner-play-video-button",...Ve,children:[r?.playVideoButtonText," ",t(tt,{size:"lg"})]}):r?.text?u(V,{"aria-label":l??o,size:"lg",variant:"secondary",className:p("hero-banner-secondary-button",c.secondaryButton),as:r?.isCustomSecondaryButton?"button":"a",href:He,target:r?.target,rel:r?.target==="_blank"?r?.rel??"noopener noreferrer":r?.rel,onClick:e=>{if(r.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(r.link);n&&O(n,I)}r?.isCustomSecondaryButton&&J?.(s,e,r?.customSecondaryEventId)},...Se,children:[r?.text,t("span",{className:"sr-only",children:l??o})]}):null,a&&a.text&&t(V,{"aria-label":l??o,size:"lg",variant:"primary",className:p("hero-banner-primary-button",c.primaryButton),as:a?.isCustomPrimaryButton?"button":"a",href:Ne,target:a?.target,rel:a?.target==="_blank"?a?.rel??"noopener noreferrer":a?.rel,onClick:e=>{if(a.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(a.link);n&&O(n,I)}a?.isCustomPrimaryButton&&_?.(s,e,a?.customPrimaryEventId)},...ze,children:a.text})]}),i&&i.text&&u(V,{"aria-label":l??o,size:"lg",variant:"link",className:p("hero-banner-tertiary-button w-auto p-0",c.tertiaryButton),as:i?.isCustomTertiaryButton?"button":"a",href:Ce,target:i?.target,rel:i?.target==="_blank"?i?.rel??"noopener noreferrer":i?.rel,onClick:e=>{if(i.link?.startsWith("#")){e.preventDefault();const n=document.querySelector(i.link);n&&O(n,I)}i?.isCustomTertiaryButton&&q?.(s,e,i?.customTertiaryEventId)},...Ie,children:[i.text,t("span",{className:"sr-only",children:l??o})]})]}),t("div",{className:et({align:b}),children:ye?.map(e=>t("div",{className:"h-12",children:t(U,{className:"!inline-block h-full !w-auto",imgClassName:"!w-auto h-full object-contain",loading:"eager",alt:e?.pcImage?.alt||"",source:e?.pcImage?.url})},e?.pcImage?.url||e?.pcImage?.alt))})]}),R.length>0&&t("div",{className:p("hero-banner-caption-group laptop:gap-3 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] desktop:pb-[24px] pointer-events-none absolute bottom-0 z-10 flex items-stretch gap-2 px-[16px] pb-[16px]",c.captionGroup),children:R.map((e,n)=>u(pe.Fragment,{children:[t(G,{size:2,className:p("hero-banner-product-text tablet:w-[108px] loptop:w-[150px] desktop:w-[156px] lg-desktop:w-[180px] laptop:text-[14px] flex-1 text-[12px]"),html:e.title}),n<R.length-1&&t("div",{className:p("bg-info-primary w-px")})]},e.title))}),oe&&t(Ze,{visible:oe,videoUrl:r?.isYoutubeVideo?void 0:r?.videoUrl?.url,youTubeId:r?.isYoutubeVideo?r?.youtubeId:void 0,onCloseModal:()=>ae(!1)})]})})});ce.displayName="HeroBanner";var wt=Ge(ce);export{wt as default};