@anker-in/headless-ui 1.1.16 → 1.1.17-alpha-1765978730
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/AccordionCards/index.d.ts +17 -0
- package/dist/cjs/biz-components/AccordionCards/index.js +1 -1
- package/dist/cjs/biz-components/AccordionCards/index.js.map +3 -3
- package/dist/cjs/biz-components/AnchorNavigation/index.d.ts +22 -0
- package/dist/cjs/biz-components/AnchorNavigation/index.js +2 -0
- package/dist/cjs/biz-components/AnchorNavigation/index.js.map +7 -0
- package/dist/cjs/biz-components/AnchorNavigation/useAnchorPosition.d.ts +2 -0
- package/dist/cjs/biz-components/AnchorNavigation/useAnchorPosition.js +2 -0
- package/dist/cjs/biz-components/AnchorNavigation/useAnchorPosition.js.map +7 -0
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.js +1 -1
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.js.map +2 -2
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +83 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js.map +7 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.d.ts +40 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +2 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/Category/index.js.map +2 -2
- package/dist/cjs/biz-components/Evaluate/index.js +1 -1
- package/dist/cjs/biz-components/Evaluate/index.js.map +2 -2
- package/dist/cjs/biz-components/EventSchedule/index.d.ts +39 -0
- package/dist/cjs/biz-components/EventSchedule/index.js +2 -0
- package/dist/cjs/biz-components/EventSchedule/index.js.map +7 -0
- package/dist/cjs/biz-components/FooterNavigation/icons/Subtract.js +1 -1
- package/dist/cjs/biz-components/FooterNavigation/icons/Subtract.js.map +2 -2
- package/dist/cjs/biz-components/FooterNavigation/index.js +1 -1
- package/dist/cjs/biz-components/FooterNavigation/index.js.map +2 -2
- package/dist/cjs/biz-components/GraphicAttractionBlock/index.js +1 -1
- package/dist/cjs/biz-components/GraphicAttractionBlock/index.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/icons/Close.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/icons/Close.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/icons/DownArrow.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/icons/DownArrow.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/icons/LeftArrow.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/icons/LeftArrow.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/icons/RightArrow.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/icons/RightArrow.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/index.js.map +3 -3
- package/dist/cjs/biz-components/HeroBanner/Countdown.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/Countdown.js.map +2 -2
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.d.ts +4 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js.map +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +3 -3
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/cjs/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +2 -2
- package/dist/cjs/biz-components/Media/index.d.ts +32 -0
- package/dist/cjs/biz-components/Media/index.js +2 -0
- package/dist/cjs/biz-components/Media/index.js.map +7 -0
- package/dist/cjs/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerMulti/index.js.map +2 -2
- package/dist/cjs/biz-components/MediaPlayerSticky/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerSticky/index.js.map +3 -3
- package/dist/cjs/biz-components/MemberEquity/index.js +2 -2
- package/dist/cjs/biz-components/MemberEquity/index.js.map +2 -2
- package/dist/cjs/biz-components/NavigationSearch/index.js +2 -2
- package/dist/cjs/biz-components/NavigationSearch/index.js.map +2 -2
- package/dist/cjs/biz-components/PromotionalBar/index.d.ts +35 -0
- package/dist/cjs/biz-components/PromotionalBar/index.js +2 -0
- package/dist/cjs/biz-components/PromotionalBar/index.js.map +7 -0
- package/dist/cjs/biz-components/SearchPage/index.js +1 -1
- package/dist/cjs/biz-components/SearchPage/index.js.map +3 -3
- package/dist/cjs/biz-components/SecondaryBanner/index.d.ts +61 -0
- package/dist/cjs/biz-components/SecondaryBanner/index.js +2 -0
- package/dist/cjs/biz-components/SecondaryBanner/index.js.map +7 -0
- package/dist/cjs/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/index.js.map +2 -2
- package/dist/cjs/biz-components/Specs/index.js +1 -1
- package/dist/cjs/biz-components/Specs/index.js.map +2 -2
- package/dist/cjs/biz-components/StockShelf/index.d.ts +21 -0
- package/dist/cjs/biz-components/StockShelf/index.js +2 -0
- package/dist/cjs/biz-components/StockShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/Subscribe/index.js.map +2 -2
- package/dist/cjs/biz-components/Tabs/Tabs.js +1 -1
- package/dist/cjs/biz-components/Tabs/Tabs.js.map +2 -2
- package/dist/cjs/biz-components/TabsGroup/index.js +1 -1
- package/dist/cjs/biz-components/TabsGroup/index.js.map +2 -2
- package/dist/cjs/biz-components/TextModal/index.js +1 -1
- package/dist/cjs/biz-components/TextModal/index.js.map +2 -2
- package/dist/cjs/biz-components/VideoModal/index.js +1 -1
- package/dist/cjs/biz-components/VideoModal/index.js.map +2 -2
- package/dist/cjs/biz-components/index.d.ts +5 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/cjs/components/container.js +1 -1
- package/dist/cjs/components/container.js.map +2 -2
- package/dist/cjs/components/drop-down.js +1 -1
- package/dist/cjs/components/drop-down.js.map +2 -2
- package/dist/cjs/components/picture.d.ts +2 -0
- package/dist/cjs/components/picture.js +1 -1
- package/dist/cjs/components/picture.js.map +3 -3
- package/dist/cjs/helpers/ScrollLoadVideo.d.ts +5 -1
- package/dist/cjs/helpers/ScrollLoadVideo.js +1 -1
- package/dist/cjs/helpers/ScrollLoadVideo.js.map +3 -3
- package/dist/cjs/stories/HeroBanner.stories.d.ts +4 -1
- package/dist/cjs/stories/HeroBanner.stories.js +2 -2
- package/dist/cjs/stories/HeroBanner.stories.js.map +3 -3
- package/dist/cjs/stories/accordionCards.stories.d.ts +21 -0
- package/dist/cjs/stories/accordionCards.stories.js +1 -1
- package/dist/cjs/stories/accordionCards.stories.js.map +3 -3
- package/dist/cjs/stories/anchorNavigation.stories.d.ts +27 -0
- package/dist/cjs/stories/anchorNavigation.stories.js +2 -0
- package/dist/cjs/stories/anchorNavigation.stories.js.map +7 -0
- package/dist/cjs/stories/buyOneGetOneShelf.stories.d.ts +56 -0
- package/dist/cjs/stories/buyOneGetOneShelf.stories.js +2 -0
- package/dist/cjs/stories/buyOneGetOneShelf.stories.js.map +7 -0
- package/dist/cjs/stories/eventSchedule.stories.d.ts +47 -0
- package/dist/cjs/stories/eventSchedule.stories.js +2 -0
- package/dist/cjs/stories/eventSchedule.stories.js.map +7 -0
- package/dist/cjs/stories/promotionalBar.stories.d.ts +26 -0
- package/dist/cjs/stories/promotionalBar.stories.js +2 -0
- package/dist/cjs/stories/promotionalBar.stories.js.map +7 -0
- package/dist/cjs/stories/secondaryBanner.stories.d.ts +47 -0
- package/dist/cjs/stories/secondaryBanner.stories.js +2 -0
- package/dist/cjs/stories/secondaryBanner.stories.js.map +7 -0
- package/dist/cjs/stories/stockShelf.stories.d.ts +27 -0
- package/dist/cjs/stories/stockShelf.stories.js +2 -0
- package/dist/cjs/stories/stockShelf.stories.js.map +7 -0
- package/dist/esm/biz-components/AccordionCards/index.d.ts +17 -0
- package/dist/esm/biz-components/AccordionCards/index.js +1 -1
- package/dist/esm/biz-components/AccordionCards/index.js.map +3 -3
- package/dist/esm/biz-components/AnchorNavigation/index.d.ts +22 -0
- package/dist/esm/biz-components/AnchorNavigation/index.js +2 -0
- package/dist/esm/biz-components/AnchorNavigation/index.js.map +7 -0
- package/dist/esm/biz-components/AnchorNavigation/useAnchorPosition.d.ts +2 -0
- package/dist/esm/biz-components/AnchorNavigation/useAnchorPosition.js +2 -0
- package/dist/esm/biz-components/AnchorNavigation/useAnchorPosition.js.map +7 -0
- package/dist/esm/biz-components/BrandEquity/BrandEquity.js +1 -1
- package/dist/esm/biz-components/BrandEquity/BrandEquity.js.map +2 -2
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.d.ts +83 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js.map +7 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.d.ts +40 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +2 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js.map +7 -0
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/Category/index.js.map +2 -2
- package/dist/esm/biz-components/Evaluate/index.js +1 -1
- package/dist/esm/biz-components/Evaluate/index.js.map +2 -2
- package/dist/esm/biz-components/EventSchedule/index.d.ts +39 -0
- package/dist/esm/biz-components/EventSchedule/index.js +2 -0
- package/dist/esm/biz-components/EventSchedule/index.js.map +7 -0
- package/dist/esm/biz-components/FooterNavigation/icons/Subtract.js +1 -1
- package/dist/esm/biz-components/FooterNavigation/icons/Subtract.js.map +2 -2
- package/dist/esm/biz-components/FooterNavigation/index.js +1 -1
- package/dist/esm/biz-components/FooterNavigation/index.js.map +2 -2
- package/dist/esm/biz-components/GraphicAttractionBlock/index.js +1 -1
- package/dist/esm/biz-components/GraphicAttractionBlock/index.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/icons/Close.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/icons/Close.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/icons/DownArrow.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/icons/DownArrow.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/icons/LeftArrow.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/icons/LeftArrow.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/icons/RightArrow.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/icons/RightArrow.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/index.js.map +2 -2
- package/dist/esm/biz-components/HeroBanner/Countdown.js +1 -1
- package/dist/esm/biz-components/HeroBanner/Countdown.js.map +2 -2
- package/dist/esm/biz-components/HeroBanner/HeroBanner.d.ts +4 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js.map +3 -3
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/BenefitsTab.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductBenefitsTabs/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductDetail/ProductHighlight/index.js.map +2 -2
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js +1 -1
- package/dist/esm/biz-components/Listing/components/ProductCard/ProductGallery/index.js.map +2 -2
- package/dist/esm/biz-components/Media/index.d.ts +32 -0
- package/dist/esm/biz-components/Media/index.js +2 -0
- package/dist/esm/biz-components/Media/index.js.map +7 -0
- package/dist/esm/biz-components/MediaPlayerMulti/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerMulti/index.js.map +2 -2
- package/dist/esm/biz-components/MediaPlayerSticky/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerSticky/index.js.map +3 -3
- package/dist/esm/biz-components/MemberEquity/index.js +2 -2
- package/dist/esm/biz-components/MemberEquity/index.js.map +2 -2
- package/dist/esm/biz-components/NavigationSearch/index.js +2 -2
- package/dist/esm/biz-components/NavigationSearch/index.js.map +2 -2
- package/dist/esm/biz-components/PromotionalBar/index.d.ts +35 -0
- package/dist/esm/biz-components/PromotionalBar/index.js +2 -0
- package/dist/esm/biz-components/PromotionalBar/index.js.map +7 -0
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/biz-components/SearchPage/index.js.map +3 -3
- package/dist/esm/biz-components/SecondaryBanner/index.d.ts +61 -0
- package/dist/esm/biz-components/SecondaryBanner/index.js +2 -0
- package/dist/esm/biz-components/SecondaryBanner/index.js.map +7 -0
- package/dist/esm/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/index.js.map +2 -2
- package/dist/esm/biz-components/Specs/index.js +1 -1
- package/dist/esm/biz-components/Specs/index.js.map +2 -2
- package/dist/esm/biz-components/StockShelf/index.d.ts +21 -0
- package/dist/esm/biz-components/StockShelf/index.js +2 -0
- package/dist/esm/biz-components/StockShelf/index.js.map +7 -0
- package/dist/esm/biz-components/Subscribe/index.js.map +2 -2
- package/dist/esm/biz-components/Tabs/Tabs.js +1 -1
- package/dist/esm/biz-components/Tabs/Tabs.js.map +2 -2
- package/dist/esm/biz-components/TabsGroup/index.js +1 -1
- package/dist/esm/biz-components/TabsGroup/index.js.map +2 -2
- package/dist/esm/biz-components/TextModal/index.js +1 -1
- package/dist/esm/biz-components/TextModal/index.js.map +2 -2
- package/dist/esm/biz-components/VideoModal/index.js +1 -1
- package/dist/esm/biz-components/VideoModal/index.js.map +2 -2
- package/dist/esm/biz-components/index.d.ts +5 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +2 -2
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/components/container.js.map +2 -2
- package/dist/esm/components/drop-down.js +1 -1
- package/dist/esm/components/drop-down.js.map +2 -2
- package/dist/esm/components/picture.d.ts +2 -0
- package/dist/esm/components/picture.js +1 -1
- package/dist/esm/components/picture.js.map +3 -3
- package/dist/esm/helpers/ScrollLoadVideo.d.ts +5 -1
- package/dist/esm/helpers/ScrollLoadVideo.js +1 -1
- package/dist/esm/helpers/ScrollLoadVideo.js.map +3 -3
- package/dist/esm/stories/HeroBanner.stories.d.ts +4 -1
- package/dist/esm/stories/HeroBanner.stories.js +2 -2
- package/dist/esm/stories/HeroBanner.stories.js.map +3 -3
- package/dist/esm/stories/accordionCards.stories.d.ts +21 -0
- package/dist/esm/stories/accordionCards.stories.js +1 -1
- package/dist/esm/stories/accordionCards.stories.js.map +3 -3
- package/dist/esm/stories/anchorNavigation.stories.d.ts +27 -0
- package/dist/esm/stories/anchorNavigation.stories.js +2 -0
- package/dist/esm/stories/anchorNavigation.stories.js.map +7 -0
- package/dist/esm/stories/buyOneGetOneShelf.stories.d.ts +56 -0
- package/dist/esm/stories/buyOneGetOneShelf.stories.js +2 -0
- package/dist/esm/stories/buyOneGetOneShelf.stories.js.map +7 -0
- package/dist/esm/stories/eventSchedule.stories.d.ts +47 -0
- package/dist/esm/stories/eventSchedule.stories.js +2 -0
- package/dist/esm/stories/eventSchedule.stories.js.map +7 -0
- package/dist/esm/stories/promotionalBar.stories.d.ts +26 -0
- package/dist/esm/stories/promotionalBar.stories.js +2 -0
- package/dist/esm/stories/promotionalBar.stories.js.map +7 -0
- package/dist/esm/stories/secondaryBanner.stories.d.ts +47 -0
- package/dist/esm/stories/secondaryBanner.stories.js +2 -0
- package/dist/esm/stories/secondaryBanner.stories.js.map +7 -0
- package/dist/esm/stories/stockShelf.stories.d.ts +27 -0
- package/dist/esm/stories/stockShelf.stories.js +2 -0
- package/dist/esm/stories/stockShelf.stories.js.map +7 -0
- package/package.json +2 -1
|
@@ -26,6 +26,23 @@ export type AccordionCardsType = {
|
|
|
26
26
|
primaryButton?: string;
|
|
27
27
|
theme?: 'light' | 'dark';
|
|
28
28
|
};
|
|
29
|
+
/**
|
|
30
|
+
* 自动播放配置
|
|
31
|
+
*/
|
|
32
|
+
autoplay?: {
|
|
33
|
+
/**
|
|
34
|
+
* 是否开启自动播放
|
|
35
|
+
*/
|
|
36
|
+
enabled: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* 是否循环播放
|
|
39
|
+
*/
|
|
40
|
+
loop?: boolean;
|
|
41
|
+
/**
|
|
42
|
+
* 自动播放间隔时间,单位毫秒
|
|
43
|
+
*/
|
|
44
|
+
interval?: number;
|
|
45
|
+
};
|
|
29
46
|
/** 按钮事件*/
|
|
30
47
|
event?: {
|
|
31
48
|
primaryButton?: (_v: any, _index: number) => void;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var D=Object.create;var T=Object.defineProperty;var j=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var z=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var V=(e,t)=>{for(var i in t)T(e,i,{get:t[i],enumerable:!0})},E=(e,t,i,p)=>{if(t&&typeof t=="object"||typeof t=="function")for(let m of A(t))!P.call(e,m)&&m!==i&&T(e,m,{get:()=>t[m],enumerable:!(p=j(t,m))||p.enumerable});return e};var v=(e,t,i)=>(i=e!=null?D(z(e)):{},E(t||!e||!e.__esModule?T(i,"default",{value:e,enumerable:!0}):i,e)),W=e=>E(T({},"__esModule",{value:!0}),e);var U={};V(U,{default:()=>J});module.exports=W(U);var n=require("react/jsx-runtime"),M=v(require("../Title/index.js")),l=require("../../helpers/utils.js"),N=v(require("../../components/picture.js")),_=v(require("../../components/button.js")),H=v(require("../SwiperBox/index.js")),C=require("../../shared/Styles.js"),r=v(require("react")),R=require("../../hooks/useExposure.js"),g=require("../../shared/trackUrlRef.js"),S=v(require("../../shared/throttle.js")),B=require("../../components/heading.js");const a="image",d="scene_banner",q=({item:e,idx:t,itemShape:i,hoverIndex:p,getRef:m,handleSwiperItemClick:u,contentWidth:h,primaryButton:c,event:f,data:w,accordionRef:k})=>{const y=p===t,$=y?8:1;return(0,R.useExposure)({current:k.current[t]},{componentType:a,componentName:d,componentTitle:e?.title,position:t+1,componentDescription:e?.subTitle}),(0,n.jsxs)("div",{style:{flex:`${$} 1 0%`,transition:"all 0.6s"},ref:x=>{x&&m(t,x)},className:(0,l.cn)("relative cursor-pointer overflow-hidden",i==="round"?"rounded-2xl":""),onMouseEnter:()=>u(t),onClick:()=>{u(t)},children:[(0,n.jsx)("a",{href:(0,g.trackUrlRef)(e?.imgLink,`${a}_${d}`),"data-headless-type-name":`${a}#${d}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}`,children:(0,n.jsx)(N.default,{source:e?.img?.url,className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",alt:e?.img?.alt||""})}),(0,n.jsxs)("div",{style:{width:h},className:(0,l.cn)("absolute inset-x-0 bottom-0 flex w-full items-end justify-between overflow-hidden px-8 pb-8 opacity-0 transition-opacity duration-[600ms] ease-in",y&&h?"opacity-100":"opacity-0"),children:[(0,n.jsxs)("div",{className:"mr-16 flex-1 overflow-hidden",children:[(0,n.jsx)(B.Heading,{as:"h3",className:"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold",children:e?.title}),(0,n.jsx)(B.Heading,{as:"h4",className:"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]",children:e?.subTitle})]}),c&&(0,n.jsxs)(_.default,{className:(0,l.cn)("mb-1.5 font-bold"),as:"a",href:(0,g.trackUrlRef)(e?.link,`${a}_${d}`),"data-headless-type-name":`${a}#${d}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${c}`,onClick:()=>f?.primaryButton?.(w,t),children:[c,(0,n.jsx)("span",{className:"sr-only",children:e?.title??e?.subTitle})]})]})]},t)},O=({data:e,configuration:t})=>{const i=(0,r.useRef)(null);return(0,R.useExposure)(i,{componentType:a,componentName:d,componentTitle:e?.title,position:t?.index+1,componentDescription:e?.subTitle}),(0,n.jsxs)("div",{ref:i,className:(0,l.cn)("bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid",t?.itemShape==="round"?"rounded-2xl":""),children:[(0,n.jsx)("a",{href:(0,g.trackUrlRef)(e?.imgLink,`${a}_${d}`),"data-headless-type-name":`${a}#${d}`,"data-headless-title-desc-button":`${e?.title}@${e?.subTitle}`,"data-headless-nav-postion":`''#${t?.index+1}`,children:(0,n.jsx)(N.default,{className:"size-full object-cover [&_img]:h-full [&_img]:object-cover",source:e?.mobileImg?.url||"",alt:e?.mobileImg?.alt||""})}),(0,n.jsxs)("div",{className:(0,l.cn)("absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4"),children:[(0,n.jsxs)("div",{className:"tablet:mb-6 mb-4 flex-1 overflow-hidden",children:[(0,n.jsx)("p",{className:"text-info-primary text-2xl font-bold leading-[1.2]",children:e?.title}),(0,n.jsx)("h3",{className:"text-info-primary line-clamp-2 text-sm font-semibold",children:e?.subTitle})]}),t?.primaryButton&&(0,n.jsx)(_.default,{as:"a",variant:"secondary","aria-label":e?.title??e?.subTitle,className:(0,l.cn)("text-info-primary text-sm font-bold"),href:(0,g.trackUrlRef)(e.link,`${a}_${d}`),"data-headless-type-name":`${a}#${d}`,"data-headless-nav-postion":`''#${t?.index+1}`,"data-headless-title-desc-button":`${e?.title}#${e?.subTitle}#${t?.primaryButton}`,children:t?.primaryButton})]})]})},L=r.default.forwardRef(({data:e,autoplay:t={enabled:!1,loop:!1,interval:1500},className:i="",event:p},m)=>{const[u,h]=(0,r.useState)(0),c=(0,r.useRef)(0),f=(0,r.useRef)([]),[w,k]=(0,r.useState)(0),y=(0,r.useRef)(null);(0,r.useImperativeHandle)(m,()=>y.current);const $=(o,s)=>{s&&(f.current[o]=s)};(0,r.useEffect)(()=>{const o=()=>{f.current[c.current]&&k(f.current[c.current].offsetWidth)};o();const s=(0,S.default)(o,300);return window.addEventListener("resize",s),()=>window.removeEventListener("resize",s)},[]);const x=(0,r.useCallback)(o=>{u!==o&&(h(o),c.current=o)},[e?.products,u]);return(0,r.useEffect)(()=>{let o;return t?.enabled&&(o=setInterval(()=>{h(s=>{const I=s??0;let b;if(t.loop!==!1)b=(I+1)%e?.products?.length;else if(b=I+1,b>=e?.products?.length)return b=e?.products?.length-1,o&&clearInterval(o),I;return c.current=b,b})},t?.interval)),()=>{o&&clearInterval(o)}},[t?.enabled,t?.interval,t?.loop,e?.products?.length,x]),(0,n.jsxs)(n.Fragment,{children:[e?.title&&(0,n.jsx)(M.default,{data:{title:e?.title}}),(0,n.jsx)("div",{ref:y,className:(0,l.cn)("laptop:block hidden",{"aiui-dark":e?.theme==="dark"}),children:(0,n.jsx)("div",{className:(0,l.cn)("lg-desktop:h-[calc(560_/_1920*100vw)] desktop:h-[calc(448_/_1440*100vw)] laptop:h-[calc(336_/_1025*100vw)] flex max-h-[560px] min-h-[336px] w-full gap-4 overflow-hidden",i),children:e?.products?.map((o,s)=>(0,n.jsx)(q,{item:o,idx:s,itemShape:e?.itemShape,hoverIndex:u,getRef:$,handleSwiperItemClick:x,contentWidth:w,primaryButton:e?.primaryButton,event:p,data:e,accordionRef:f},s))})}),(0,n.jsx)("div",{className:(0,l.cn)("laptop:hidden block",{"aiui-dark":e?.theme==="dark"}),children:(0,n.jsx)(H.default,{className:(0,l.cn)("h-[400px] !overflow-visible",i),id:"AccordionCards"+e?.key,data:{list:e?.products,configuration:{shape:e?.shape,itemShape:e?.itemShape,primaryButton:e?.primaryButton,event:p,title:e?.title}},Slide:O,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3}}})})]})});L.displayName="AccordionCards";var J=(0,C.withLayout)(L);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/AccordionCards/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport Title from '../Title/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport React, { useState, useRef, useCallback, useImperativeHandle, useEffect, type RefObject } from 'react'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\nimport throttle from '../../shared/throttle.js'\nimport { Heading } from '../../components/heading.js'\n\nconst componentType = 'image'\nconst componentName = 'scene_banner'\n\n/** Hook\uFF1A\u76D1\u542C\u7A97\u53E3\u5BBD\u5EA6 */\ntype ItemType = {\n /** \u6807\u9898\u6587\u672C */\n title: string\n /** \u56FE\u7247*/\n img: Img\n mobileImg?: Img\n /** \u5185\u5BB9\u8282\u70B9 */\n subTitle: string\n link?: string\n imgLink?: string\n}\n\nexport type AccordionCardsType = {\n className?: string\n data: {\n key?: string\n title?: string\n products: Array<ItemType>\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n theme?: 'light' | 'dark'\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (_v: any, _index: number) => void\n }\n}\n\nconst AccordionCardsPcItem = ({\n item,\n idx,\n itemShape,\n hoverIndex,\n getRef,\n handleSwiperItemClick,\n isAnimation,\n contentWidth,\n primaryButton,\n event,\n data,\n accordionRef,\n}: {\n item: ItemType\n idx: number\n itemShape: 'round' | 'square' | undefined\n hoverIndex: number | null\n getRef: (_idx: number, _el: HTMLDivElement) => void\n handleSwiperItemClick: (_idx: number) => void\n isAnimation: any\n contentWidth: number\n primaryButton: string | undefined\n event: any\n data: AccordionCardsType['data']\n accordionRef: React.MutableRefObject<HTMLDivElement[]>\n}) => {\n const isExpanded = hoverIndex === idx\n const flexValue = isExpanded ? 8 : 1\n\n useExposure({ current: accordionRef.current[idx] } as RefObject<HTMLDivElement>, {\n componentType,\n componentName,\n componentTitle: item?.title,\n position: idx + 1,\n componentDescription: item?.subTitle,\n })\n\n return (\n <div\n key={idx}\n style={{\n flex: `${flexValue} 1 0%`,\n transition: 'all 0.6s',\n }}\n ref={(el: HTMLDivElement | null) => {\n if (el) getRef(idx, el)\n }}\n className={cn('relative cursor-pointer overflow-hidden', itemShape === 'round' ? 'rounded-2xl' : '')}\n onMouseEnter={() => handleSwiperItemClick(idx)}\n onMouseLeave={() => {\n isAnimation.current = false\n }}\n onClick={() => {\n handleSwiperItemClick(idx)\n }}\n >\n <a\n href={trackUrlRef(item?.imgLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${item?.title}#${item?.subTitle}`}\n >\n <Picture\n source={item?.img?.url}\n className=\"size-full object-cover [&_img]:h-full [&_img]:object-cover\"\n alt={item?.img?.alt || ''}\n />\n </a>\n <div\n style={{\n width: contentWidth,\n }}\n className={cn(\n 'absolute inset-x-0 bottom-0 flex w-full items-end justify-between overflow-hidden px-8 pb-8 opacity-0 transition-opacity duration-[600ms] ease-in',\n isExpanded && contentWidth ? 'opacity-100' : 'opacity-0'\n )}\n >\n <div className=\"mr-16 flex-1 overflow-hidden\">\n <Heading as=\"h3\" className=\"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold\">\n {item?.title}\n </Heading>\n <Heading\n as=\"h4\"\n className=\"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]\"\n >\n {item?.subTitle}\n </Heading>\n </div>\n <Button\n className={cn('mb-1.5 font-bold')}\n as=\"a\"\n href={trackUrlRef(item?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${item?.title}#${item?.subTitle}#${primaryButton}`}\n onClick={() => event?.primaryButton?.(data, idx)}\n >\n {primaryButton}\n <span className=\"sr-only\">{item?.title ?? item?.subTitle}</span>\n </Button>\n </div>\n </div>\n )\n}\n\nconst MobileItem = ({ data, configuration }: { data: ItemType; configuration?: any }) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.title,\n position: configuration?.index + 1,\n componentDescription: data?.subTitle,\n })\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : ''\n )}\n >\n <a\n href={trackUrlRef(data?.imgLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}@${data?.subTitle}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n >\n <Picture\n className=\"size-full object-cover [&_img]:h-full [&_img]:object-cover\"\n source={data?.mobileImg?.url || ''}\n alt={data?.mobileImg?.alt || ''}\n />\n </a>\n <div className={cn('absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4')}>\n <div className=\"tablet:mb-6 mb-4 flex-1 overflow-hidden\">\n <p className=\"text-info-primary text-2xl font-bold leading-[1.2]\">{data?.title}</p>\n <h3 className=\"text-info-primary line-clamp-2 text-sm font-semibold\">{data?.subTitle}</h3>\n </div>\n\n <Button\n as=\"a\"\n variant=\"secondary\"\n aria-label={data?.title ?? data?.subTitle}\n className={cn('text-info-primary text-sm font-bold')}\n href={trackUrlRef(data.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n data-headless-title-desc-button={`${data?.title}#${data?.subTitle}#${configuration?.primaryButton}`}\n >\n {configuration?.primaryButton}\n </Button>\n </div>\n </div>\n )\n}\n\nconst AccordionCards = React.forwardRef<HTMLDivElement, AccordionCardsType>(({ data, className = '', event }, ref) => {\n const [hoverIndex, setHoverIndex] = useState<number | null>(0)\n\n const hoverIndexRef = useRef<number>(0)\n const accordionRef = useRef<HTMLDivElement[]>([])\n const isAnimation = useRef<boolean>(false)\n const [contentWidth, setContentWidth] = useState<number>(0)\n\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n const getRef = (index: number, el: HTMLDivElement) => {\n if (el) {\n accordionRef.current[index] = el\n }\n }\n\n useEffect(() => {\n const handleResize = () => {\n if (accordionRef.current[hoverIndexRef.current]) {\n setContentWidth(accordionRef.current[hoverIndexRef.current].offsetWidth)\n }\n }\n handleResize()\n const throttleResize = throttle(handleResize, 300)\n window.addEventListener('resize', throttleResize)\n return () => window.removeEventListener('resize', throttleResize)\n }, [])\n\n const handleSwiperItemClick = useCallback(\n (idx: number) => {\n if (hoverIndex === idx || isAnimation.current) return\n isAnimation.current = true\n // \u66F4\u65B0\u5BBD\u5EA6\u76F8\u5173\u72B6\u6001\n setHoverIndex(idx)\n hoverIndexRef.current = idx\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [data?.products, hoverIndex]\n )\n\n return (\n <>\n {data?.title && <Title data={{ title: data?.title }} />}\n <div ref={innerRef} className={cn('laptop:block hidden', { 'aiui-dark': data?.theme === 'dark' })}>\n <div\n className={cn(\n 'lg-desktop:h-[calc(560_/_1920*100vw)] desktop:h-[calc(448_/_1440*100vw)] laptop:h-[calc(336_/_1025*100vw)] flex max-h-[560px] min-h-[336px] w-full gap-4 overflow-hidden',\n className\n )}\n >\n {data?.products?.map((item, idx) => (\n <AccordionCardsPcItem\n key={idx}\n item={item}\n idx={idx}\n itemShape={data?.itemShape}\n hoverIndex={hoverIndex}\n getRef={getRef}\n handleSwiperItemClick={handleSwiperItemClick}\n isAnimation={isAnimation}\n contentWidth={contentWidth}\n primaryButton={data?.primaryButton}\n event={event}\n data={data}\n accordionRef={accordionRef}\n />\n ))}\n </div>\n </div>\n <div className={cn('laptop:hidden block', { 'aiui-dark': data?.theme === 'dark' })}>\n <SwiperBox\n className={cn('h-[400px] !overflow-visible', className)}\n id={'AccordionCards' + data?.key}\n data={{\n list: data?.products,\n configuration: {\n shape: data?.shape,\n itemShape: data?.itemShape,\n primaryButton: data?.primaryButton,\n event: event,\n title: data?.title,\n },\n }}\n Slide={MobileItem}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1.2,\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 2.3,\n },\n }}\n />\n </div>\n </>\n )\n})\nexport default withLayout(AccordionCards)\n"],
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["AccordionCards_exports", "__export", "AccordionCards_default", "__toCommonJS", "import_jsx_runtime", "import_Title", "import_utils", "import_picture", "import_button", "import_SwiperBox", "import_Styles", "import_react", "import_useExposure", "import_trackUrlRef", "import_throttle", "import_heading", "componentType", "componentName", "AccordionCardsPcItem", "item", "idx", "itemShape", "hoverIndex", "getRef", "handleSwiperItemClick", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport Title from '../Title/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport React, { useState, useRef, useCallback, useImperativeHandle, useEffect, type RefObject } from 'react'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\nimport throttle from '../../shared/throttle.js'\nimport { Heading } from '../../components/heading.js'\n\nconst componentType = 'image'\nconst componentName = 'scene_banner'\n\n/** Hook\uFF1A\u76D1\u542C\u7A97\u53E3\u5BBD\u5EA6 */\ntype ItemType = {\n /** \u6807\u9898\u6587\u672C */\n title: string\n /** \u56FE\u7247*/\n img: Img\n mobileImg?: Img\n /** \u5185\u5BB9\u8282\u70B9 */\n subTitle: string\n link?: string\n imgLink?: string\n}\n\nexport type AccordionCardsType = {\n className?: string\n data: {\n key?: string\n title?: string\n products: Array<ItemType>\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n theme?: 'light' | 'dark'\n }\n /**\n * \u81EA\u52A8\u64AD\u653E\u914D\u7F6E\n */\n autoplay?: {\n /**\n * \u662F\u5426\u5F00\u542F\u81EA\u52A8\u64AD\u653E\n */\n enabled: boolean\n /**\n * \u662F\u5426\u5FAA\u73AF\u64AD\u653E\n */\n loop?: boolean\n /**\n * \u81EA\u52A8\u64AD\u653E\u95F4\u9694\u65F6\u95F4\uFF0C\u5355\u4F4D\u6BEB\u79D2\n */\n interval?: number\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (_v: any, _index: number) => void\n }\n}\n\nconst AccordionCardsPcItem = ({\n item,\n idx,\n itemShape,\n hoverIndex,\n getRef,\n handleSwiperItemClick,\n contentWidth,\n primaryButton,\n event,\n data,\n accordionRef,\n}: {\n item: ItemType\n idx: number\n itemShape: 'round' | 'square' | undefined\n hoverIndex: number | null\n getRef: (_idx: number, _el: HTMLDivElement) => void\n handleSwiperItemClick: (_idx: number) => void\n contentWidth: number\n primaryButton: string | undefined\n event: any\n data: AccordionCardsType['data']\n accordionRef: React.MutableRefObject<HTMLDivElement[]>\n}) => {\n const isExpanded = hoverIndex === idx\n const flexValue = isExpanded ? 8 : 1\n\n useExposure({ current: accordionRef.current[idx] } as RefObject<HTMLDivElement>, {\n componentType,\n componentName,\n componentTitle: item?.title,\n position: idx + 1,\n componentDescription: item?.subTitle,\n })\n\n return (\n <div\n key={idx}\n style={{\n flex: `${flexValue} 1 0%`,\n transition: 'all 0.6s',\n }}\n ref={(el: HTMLDivElement | null) => {\n if (el) getRef(idx, el)\n }}\n className={cn('relative cursor-pointer overflow-hidden', itemShape === 'round' ? 'rounded-2xl' : '')}\n onMouseEnter={() => handleSwiperItemClick(idx)}\n onClick={() => {\n handleSwiperItemClick(idx)\n }}\n >\n <a\n href={trackUrlRef(item?.imgLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${item?.title}#${item?.subTitle}`}\n >\n <Picture\n source={item?.img?.url}\n className=\"size-full object-cover [&_img]:h-full [&_img]:object-cover\"\n alt={item?.img?.alt || ''}\n />\n </a>\n <div\n style={{\n width: contentWidth,\n }}\n className={cn(\n 'absolute inset-x-0 bottom-0 flex w-full items-end justify-between overflow-hidden px-8 pb-8 opacity-0 transition-opacity duration-[600ms] ease-in',\n isExpanded && contentWidth ? 'opacity-100' : 'opacity-0'\n )}\n >\n <div className=\"mr-16 flex-1 overflow-hidden\">\n <Heading as=\"h3\" className=\"laptop:text-2xl desktop:text-[32px] text-info-primary mb-1 text-xl font-bold\">\n {item?.title}\n </Heading>\n <Heading\n as=\"h4\"\n className=\"lg-desktop:text-[18px] desktop:text-[16px] text-info-primary line-clamp-2 text-[14px] font-[700]\"\n >\n {item?.subTitle}\n </Heading>\n </div>\n {primaryButton && (\n <Button\n className={cn('mb-1.5 font-bold')}\n as=\"a\"\n href={trackUrlRef(item?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${item?.title}#${item?.subTitle}#${primaryButton}`}\n onClick={() => event?.primaryButton?.(data, idx)}\n >\n {primaryButton}\n <span className=\"sr-only\">{item?.title ?? item?.subTitle}</span>\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst MobileItem = ({ data, configuration }: { data: ItemType; configuration?: any }) => {\n const ref = useRef<HTMLDivElement>(null)\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.title,\n position: configuration?.index + 1,\n componentDescription: data?.subTitle,\n })\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-secondary-1 relative w-full shrink-0 grow-0 overflow-hidden border border-solid',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : ''\n )}\n >\n <a\n href={trackUrlRef(data?.imgLink, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}@${data?.subTitle}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n >\n <Picture\n className=\"size-full object-cover [&_img]:h-full [&_img]:object-cover\"\n source={data?.mobileImg?.url || ''}\n alt={data?.mobileImg?.alt || ''}\n />\n </a>\n <div className={cn('absolute inset-x-0 bottom-0 overflow-hidden px-4 pb-4')}>\n <div className=\"tablet:mb-6 mb-4 flex-1 overflow-hidden\">\n <p className=\"text-info-primary text-2xl font-bold leading-[1.2]\">{data?.title}</p>\n <h3 className=\"text-info-primary line-clamp-2 text-sm font-semibold\">{data?.subTitle}</h3>\n </div>\n\n {configuration?.primaryButton && (\n <Button\n as=\"a\"\n variant=\"secondary\"\n aria-label={data?.title ?? data?.subTitle}\n className={cn('text-info-primary text-sm font-bold')}\n href={trackUrlRef(data.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n data-headless-title-desc-button={`${data?.title}#${data?.subTitle}#${configuration?.primaryButton}`}\n >\n {configuration?.primaryButton}\n </Button>\n )}\n </div>\n </div>\n )\n}\n\nconst AccordionCards = React.forwardRef<HTMLDivElement, AccordionCardsType>(\n ({ data, autoplay = { enabled: false, loop: false, interval: 1500 }, className = '', event }, ref) => {\n const [hoverIndex, setHoverIndex] = useState<number | null>(0)\n\n const hoverIndexRef = useRef<number>(0)\n const accordionRef = useRef<HTMLDivElement[]>([])\n const [contentWidth, setContentWidth] = useState<number>(0)\n\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n const getRef = (index: number, el: HTMLDivElement) => {\n if (el) {\n accordionRef.current[index] = el\n }\n }\n\n useEffect(() => {\n const handleResize = () => {\n if (accordionRef.current[hoverIndexRef.current]) {\n setContentWidth(accordionRef.current[hoverIndexRef.current].offsetWidth)\n }\n }\n handleResize()\n const throttleResize = throttle(handleResize, 300)\n window.addEventListener('resize', throttleResize)\n return () => window.removeEventListener('resize', throttleResize)\n }, [])\n\n const handleSwiperItemClick = useCallback(\n (idx: number) => {\n if (hoverIndex === idx) return\n // \u66F4\u65B0\u5BBD\u5EA6\u76F8\u5173\u72B6\u6001\n setHoverIndex(idx)\n hoverIndexRef.current = idx\n },\n // eslint-disable-next-line react-hooks/exhaustive-deps\n [data?.products, hoverIndex]\n )\n\n useEffect(() => {\n let autoPlayTimer: NodeJS.Timeout\n if (autoplay?.enabled) {\n autoPlayTimer = setInterval(() => {\n setHoverIndex(prev => {\n const currentIndex = prev ?? 0\n let nextIndex: number\n\n if (autoplay.loop !== false) {\n // \u9ED8\u8BA4\u5FAA\u73AF\u64AD\u653E\n nextIndex = (currentIndex + 1) % data?.products?.length\n } else {\n // \u4E0D\u5FAA\u73AF\uFF1A\u64AD\u653E\u5230\u6700\u540E\u4E00\u4E2A\u540E\u505C\u6B62\n nextIndex = currentIndex + 1\n if (nextIndex >= data?.products?.length) {\n nextIndex = data?.products?.length - 1\n // \u505C\u6B62\u81EA\u52A8\u64AD\u653E\n if (autoPlayTimer) {\n clearInterval(autoPlayTimer)\n }\n return currentIndex // \u4FDD\u6301\u5728\u6700\u540E\u4E00\u4E2A\n }\n }\n\n hoverIndexRef.current = nextIndex\n return nextIndex\n })\n }, autoplay?.interval)\n }\n return () => {\n if (autoPlayTimer) {\n clearInterval(autoPlayTimer)\n }\n }\n }, [autoplay?.enabled, autoplay?.interval, autoplay?.loop, data?.products?.length, handleSwiperItemClick])\n\n return (\n <>\n {data?.title && <Title data={{ title: data?.title }} />}\n <div ref={innerRef} className={cn('laptop:block hidden', { 'aiui-dark': data?.theme === 'dark' })}>\n <div\n className={cn(\n 'lg-desktop:h-[calc(560_/_1920*100vw)] desktop:h-[calc(448_/_1440*100vw)] laptop:h-[calc(336_/_1025*100vw)] flex max-h-[560px] min-h-[336px] w-full gap-4 overflow-hidden',\n className\n )}\n >\n {data?.products?.map((item, idx) => (\n <AccordionCardsPcItem\n key={idx}\n item={item}\n idx={idx}\n itemShape={data?.itemShape}\n hoverIndex={hoverIndex}\n getRef={getRef}\n handleSwiperItemClick={handleSwiperItemClick}\n contentWidth={contentWidth}\n primaryButton={data?.primaryButton}\n event={event}\n data={data}\n accordionRef={accordionRef}\n />\n ))}\n </div>\n </div>\n <div className={cn('laptop:hidden block', { 'aiui-dark': data?.theme === 'dark' })}>\n <SwiperBox\n className={cn('h-[400px] !overflow-visible', className)}\n id={'AccordionCards' + data?.key}\n data={{\n list: data?.products,\n configuration: {\n shape: data?.shape,\n itemShape: data?.itemShape,\n primaryButton: data?.primaryButton,\n event: event,\n title: data?.title,\n },\n }}\n Slide={MobileItem}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1.2,\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 2.3,\n },\n }}\n />\n </div>\n </>\n )\n }\n)\n\nAccordionCards.displayName = 'AccordionCards'\nexport default withLayout(AccordionCards)\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA4HQ,IAAAI,EAAA,6BA3HRC,EAAkB,gCAClBC,EAAmB,kCACnBC,EAAoB,0CACpBC,EAAmB,yCACnBC,EAAsB,oCACtBC,EAA2B,kCAC3BC,EAAqG,oBACrGC,EAA4B,sCAC5BC,EAA4B,uCAE5BC,EAAqB,uCACrBC,EAAwB,uCAExB,MAAMC,EAAgB,QAChBC,EAAgB,eAoDhBC,EAAuB,CAAC,CAC5B,KAAAC,EACA,IAAAC,EACA,UAAAC,EACA,WAAAC,EACA,OAAAC,EACA,sBAAAC,EACA,aAAAC,EACA,cAAAC,EACA,MAAAC,EACA,KAAAC,EACA,aAAAC,CACF,IAYM,CACJ,MAAMC,EAAaR,IAAeF,EAC5BW,EAAYD,EAAa,EAAI,EAEnC,wBAAY,CAAE,QAASD,EAAa,QAAQT,CAAG,CAAE,EAAgC,CAC/E,cAAAJ,EACA,cAAAC,EACA,eAAgBE,GAAM,MACtB,SAAUC,EAAM,EAChB,qBAAsBD,GAAM,QAC9B,CAAC,KAGC,QAAC,OAEC,MAAO,CACL,KAAM,GAAGY,CAAS,QAClB,WAAY,UACd,EACA,IAAMC,GAA8B,CAC9BA,GAAIT,EAAOH,EAAKY,CAAE,CACxB,EACA,aAAW,MAAG,0CAA2CX,IAAc,QAAU,cAAgB,EAAE,EACnG,aAAc,IAAMG,EAAsBJ,CAAG,EAC7C,QAAS,IAAM,CACbI,EAAsBJ,CAAG,CAC3B,EAEA,oBAAC,KACC,QAAM,eAAYD,GAAM,QAAS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,QAAU,MAAO,CAAC,EAC9F,mBAAC,OACC,aAAW,MACT,2KACAa,CACF,EAEC,SAAAb,GAAM,UAAU,IAAI,CAACT,EAAMC,OAC1B,OAACF,EAAA,CAEC,KAAMC,EACN,IAAKC,EACL,UAAWQ,GAAM,UACjB,WAAYN,EACZ,OAAQC,EACR,sBAAuBC,EACvB,aAAcC,EACd,cAAeG,GAAM,cACrB,MAAOD,EACP,KAAMC,EACN,aAAcC,GAXTT,CAYP,CACD,EACH,EACF,KACA,OAAC,OAAI,aAAW,MAAG,sBAAuB,CAAE,YAAaQ,GAAM,QAAU,MAAO,CAAC,EAC/E,mBAAC,EAAA2B,QAAA,CACC,aAAW,MAAG,8BAA+Bd,CAAS,EACtD,GAAI,iBAAmBb,GAAM,IAC7B,KAAM,CACJ,KAAMA,GAAM,SACZ,cAAe,CACb,MAAOA,GAAM,MACb,UAAWA,GAAM,UACjB,cAAeA,GAAM,cACrB,MAAOD,EACP,MAAOC,GAAM,KACf,CACF,EACA,MAAOO,EACP,YAAa,CACX,EAAG,CACD,aAAc,GACd,SAAU,GACV,cAAe,CACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,GACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,GACjB,CACF,EACF,EACF,GACF,CAEJ,CACF,EAEAG,EAAe,YAAc,iBAC7B,IAAOpC,KAAQ,cAAWoC,CAAc",
|
|
6
|
+
"names": ["AccordionCards_exports", "__export", "AccordionCards_default", "__toCommonJS", "import_jsx_runtime", "import_Title", "import_utils", "import_picture", "import_button", "import_SwiperBox", "import_Styles", "import_react", "import_useExposure", "import_trackUrlRef", "import_throttle", "import_heading", "componentType", "componentName", "AccordionCardsPcItem", "item", "idx", "itemShape", "hoverIndex", "getRef", "handleSwiperItemClick", "contentWidth", "primaryButton", "event", "data", "accordionRef", "isExpanded", "flexValue", "el", "Picture", "Button", "MobileItem", "configuration", "ref", "AccordionCards", "React", "autoplay", "className", "setHoverIndex", "hoverIndexRef", "setContentWidth", "innerRef", "index", "handleResize", "throttleResize", "throttle", "autoPlayTimer", "prev", "currentIndex", "nextIndex", "Title", "SwiperBox"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* AnchorNavigation 业务组件数据接口
|
|
4
|
+
*/
|
|
5
|
+
export interface AnchorNavigationData {
|
|
6
|
+
/** 锚点列表 */
|
|
7
|
+
sectionIds: {
|
|
8
|
+
id: string;
|
|
9
|
+
label: string;
|
|
10
|
+
}[];
|
|
11
|
+
}
|
|
12
|
+
export interface AnchorNavigationProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
13
|
+
/** 业务数据 */
|
|
14
|
+
data: AnchorNavigationData;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* AnchorNavigation - 锚点导航
|
|
18
|
+
*
|
|
19
|
+
* @description 锚点导航
|
|
20
|
+
*/
|
|
21
|
+
declare const AnchorNavigation: React.ForwardRefExoticComponent<AnchorNavigationProps & React.RefAttributes<HTMLDivElement>>;
|
|
22
|
+
export default AnchorNavigation;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var R=Object.create;var l=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var I=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,T=Object.prototype.hasOwnProperty;var w=(t,e)=>{for(var o in e)l(t,o,{get:e[o],enumerable:!0})},p=(t,e,o,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of I(e))!T.call(t,r)&&r!==o&&l(t,r,{get:()=>e[r],enumerable:!(c=x(e,r))||c.enumerable});return t};var v=(t,e,o)=>(o=t!=null?R(L(t)):{},p(e||!t||!t.__esModule?l(o,"default",{value:t,enumerable:!0}):o,t)),y=t=>p(l({},"__esModule",{value:!0}),t);var D={};w(D,{default:()=>C});module.exports=y(D);var s=require("react/jsx-runtime"),f=v(require("react")),b=require("../../helpers/utils.js"),g=require("../../components/container.js"),A=v(require("./useAnchorPosition.js"));const h=f.forwardRef(({className:t,data:e,...o},c)=>{const r=(0,A.default)(e.sectionIds?.map(n=>n.id)||[]),d=f.useRef(null),m=f.useRef([]),N=f.useCallback(n=>{const i=m.current[n];if(i&&d.current){const a=d.current,u=i,k=u.offsetLeft-a.offsetWidth/2+u.offsetWidth/2;a.scrollTo({left:k,behavior:"smooth"})}},[]);return(0,s.jsx)("div",{ref:c,className:(0,b.cn)("sticky top-0 z-10 w-full bg-white",t),...o,children:(0,s.jsx)(g.Container,{children:(0,s.jsx)("div",{ref:d,className:"anchor-navigation-content desktop:gap-6 flex items-center gap-4 overflow-x-auto [&::-webkit-scrollbar]:hidden",children:e.sectionIds?.map((n,i)=>(0,s.jsx)("button",{ref:a=>{a&&(m.current[i]=a)},onClick:()=>{N(i),document.getElementById(n.id)?.scrollIntoView({behavior:"smooth"})},className:(0,b.cn)("anchor-navigation-item desktop:py-4 shrink-0 border-b-4 border-b-transparent py-3 text-base font-bold text-[#4A4C56]",{"border-b-brand text-[#080A0F]":r===n.id}),children:n.label},n.id))})})})});h.displayName="AnchorNavigation";var C=h;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/AnchorNavigation/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { Container } from '../../components/container.js'\nimport useAnchorPosition from './useAnchorPosition.js'\n/**\n * AnchorNavigation \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface AnchorNavigationData {\n /** \u951A\u70B9\u5217\u8868 */\n sectionIds: {\n id: string\n label: string\n }[]\n}\n\nexport interface AnchorNavigationProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: AnchorNavigationData\n}\n\n/**\n * AnchorNavigation - \u951A\u70B9\u5BFC\u822A\n *\n * @description \u951A\u70B9\u5BFC\u822A\n */\nconst AnchorNavigation = React.forwardRef<HTMLDivElement, AnchorNavigationProps>(\n ({ className, data, ...props }, ref) => {\n const activeId = useAnchorPosition(data.sectionIds?.map(item => item.id) || [])\n const containerRef = React.useRef<HTMLDivElement>(null)\n const sectionRefs = React.useRef<HTMLButtonElement[]>([])\n\n const autoScrollToActiveItem = React.useCallback((activeIdIndex: number) => {\n const curRef = sectionRefs.current[activeIdIndex]\n\n if (curRef && containerRef.current) {\n const container = containerRef.current\n const button = curRef\n const scrollLeft = button.offsetLeft - container.offsetWidth / 2 + button.offsetWidth / 2\n\n container.scrollTo({\n left: scrollLeft,\n behavior: 'smooth',\n })\n }\n }, [])\n\n return (\n <div ref={ref} className={cn('sticky top-0 z-10 w-full bg-white', className)} {...props}>\n <Container>\n <div\n ref={containerRef}\n className=\"anchor-navigation-content desktop:gap-6 flex items-center gap-4 overflow-x-auto [&::-webkit-scrollbar]:hidden\"\n >\n {data.sectionIds?.map((item, index) => (\n <button\n key={item.id}\n ref={el => {\n if (el) {\n sectionRefs.current[index] = el\n }\n }}\n onClick={() => {\n autoScrollToActiveItem(index)\n document.getElementById(item.id)?.scrollIntoView({ behavior: 'smooth' })\n }}\n className={cn(\n 'anchor-navigation-item desktop:py-4 shrink-0 border-b-4 border-b-transparent py-3 text-base font-bold text-[#4A4C56]',\n {\n 'border-b-brand text-[#080A0F]': activeId === item.id,\n }\n )}\n >\n {item.label}\n </button>\n ))}\n </div>\n </Container>\n </div>\n )\n }\n)\n\nAnchorNavigation.displayName = 'AnchorNavigation'\nexport default AnchorNavigation\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAwDc,IAAAI,EAAA,6BAtDdC,EAAuB,oBACvBC,EAAmB,kCACnBC,EAA0B,yCAC1BC,EAA8B,qCAsB9B,MAAMC,EAAmBJ,EAAM,WAC7B,CAAC,CAAE,UAAAK,EAAW,KAAAC,EAAM,GAAGC,CAAM,EAAGC,IAAQ,CACtC,MAAMC,KAAW,EAAAC,SAAkBJ,EAAK,YAAY,IAAIK,GAAQA,EAAK,EAAE,GAAK,CAAC,CAAC,EACxEC,EAAeZ,EAAM,OAAuB,IAAI,EAChDa,EAAcb,EAAM,OAA4B,CAAC,CAAC,EAElDc,EAAyBd,EAAM,YAAae,GAA0B,CAC1E,MAAMC,EAASH,EAAY,QAAQE,CAAa,EAEhD,GAAIC,GAAUJ,EAAa,QAAS,CAClC,MAAMK,EAAYL,EAAa,QACzBM,EAASF,EACTG,EAAaD,EAAO,WAAaD,EAAU,YAAc,EAAIC,EAAO,YAAc,EAExFD,EAAU,SAAS,CACjB,KAAME,EACN,SAAU,QACZ,CAAC,CACH,CACF,EAAG,CAAC,CAAC,EAEL,SACE,OAAC,OAAI,IAAKX,EAAK,aAAW,MAAG,oCAAqCH,CAAS,EAAI,GAAGE,EAChF,mBAAC,aACC,mBAAC,OACC,IAAKK,EACL,UAAU,gHAET,SAAAN,EAAK,YAAY,IAAI,CAACK,EAAMS,OAC3B,OAAC,UAEC,IAAKC,GAAM,CACLA,IACFR,EAAY,QAAQO,CAAK,EAAIC,EAEjC,EACA,QAAS,IAAM,CACbP,EAAuBM,CAAK,EAC5B,SAAS,eAAeT,EAAK,EAAE,GAAG,eAAe,CAAE,SAAU,QAAS,CAAC,CACzE,EACA,aAAW,MACT,uHACA,CACE,gCAAiCF,IAAaE,EAAK,EACrD,CACF,EAEC,SAAAA,EAAK,OAjBDA,EAAK,EAkBZ,CACD,EACH,EACF,EACF,CAEJ,CACF,EAEAP,EAAiB,YAAc,mBAC/B,IAAOP,EAAQO",
|
|
6
|
+
"names": ["AnchorNavigation_exports", "__export", "AnchorNavigation_default", "__toCommonJS", "import_jsx_runtime", "React", "import_utils", "import_container", "import_useAnchorPosition", "AnchorNavigation", "className", "data", "props", "ref", "activeId", "useAnchorPosition", "item", "containerRef", "sectionRefs", "autoScrollToActiveItem", "activeIdIndex", "curRef", "container", "button", "scrollLeft", "index", "el"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var i=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var p=(o,e)=>{for(var n in e)i(o,n,{get:e[n],enumerable:!0})},h=(o,e,n,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of m(e))!g.call(o,t)&&t!==n&&i(o,t,{get:()=>e[t],enumerable:!(l=w(e,t))||l.enumerable});return o};var v=o=>h(i({},"__esModule",{value:!0}),o);var S={};p(S,{default:()=>b});module.exports=v(S);var r=require("react"),u=require("es-toolkit");const E=(o,e=100)=>{const[n,l]=(0,r.useState)("");return(0,r.useEffect)(()=>{const t=()=>{const a=Math.ceil(window.scrollY+e+10);for(let c=o.length-1;c>=0;c--){const d=document.getElementById(o[c]);if(d){const f=Math.ceil(d.getBoundingClientRect().top+window.scrollY);if(console.log(f,"offsetTop"),a>=f){l(o[c]);break}}}};t();const s=(0,u.debounce)(t,50);return window.addEventListener("scroll",s),()=>{window.removeEventListener("scroll",s)}},[o,e]),n};var b=E;
|
|
2
|
+
//# sourceMappingURL=useAnchorPosition.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/AnchorNavigation/useAnchorPosition.tsx"],
|
|
4
|
+
"sourcesContent": ["import { useState, useEffect } from 'react'\nimport { debounce } from 'es-toolkit'\n\nconst useAnchorPosition = (sectionIds: string[], offset = 100) => {\n const [activeId, setActiveId] = useState('')\n\n useEffect(() => {\n const handleScroll = () => {\n const scrollPosition = Math.ceil(window.scrollY + offset + 10)\n\n // \u904D\u5386\u6240\u6709section\uFF0C\u627E\u5230\u5F53\u524D\u53EF\u89C6\u533A\u57DF\u5185\u7684section\n for (let i = sectionIds.length - 1; i >= 0; i--) {\n const section = document.getElementById(sectionIds[i])\n if (section) {\n const offsetTop = Math.ceil(section.getBoundingClientRect().top + window.scrollY)\n console.log(offsetTop, 'offsetTop')\n if (scrollPosition >= offsetTop) {\n setActiveId(sectionIds[i])\n break\n }\n }\n }\n }\n\n // \u521D\u59CB\u5316\u65F6\u6267\u884C\u4E00\u6B21\n handleScroll()\n\n // \u521B\u5EFAdebounce\u51FD\u6570\u5E76\u4FDD\u5B58\u5F15\u7528\uFF0C\u786E\u4FDD\u80FD\u6B63\u786E\u79FB\u9664\u76D1\u542C\u5668\n const debouncedHandleScroll = debounce(handleScroll, 50)\n window.addEventListener('scroll', debouncedHandleScroll)\n\n return () => {\n window.removeEventListener('scroll', debouncedHandleScroll)\n }\n }, [sectionIds, offset])\n\n return activeId\n}\n\nexport default useAnchorPosition\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAoC,iBACpCC,EAAyB,sBAEzB,MAAMC,EAAoB,CAACC,EAAsBC,EAAS,MAAQ,CAChE,KAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAE,EAE3C,sBAAU,IAAM,CACd,MAAMC,EAAe,IAAM,CACzB,MAAMC,EAAiB,KAAK,KAAK,OAAO,QAAUJ,EAAS,EAAE,EAG7D,QAASK,EAAIN,EAAW,OAAS,EAAGM,GAAK,EAAGA,IAAK,CAC/C,MAAMC,EAAU,SAAS,eAAeP,EAAWM,CAAC,CAAC,EACrD,GAAIC,EAAS,CACX,MAAMC,EAAY,KAAK,KAAKD,EAAQ,sBAAsB,EAAE,IAAM,OAAO,OAAO,EAEhF,GADA,QAAQ,IAAIC,EAAW,WAAW,EAC9BH,GAAkBG,EAAW,CAC/BL,EAAYH,EAAWM,CAAC,CAAC,EACzB,KACF,CACF,CACF,CACF,EAGAF,EAAa,EAGb,MAAMK,KAAwB,YAASL,EAAc,EAAE,EACvD,cAAO,iBAAiB,SAAUK,CAAqB,EAEhD,IAAM,CACX,OAAO,oBAAoB,SAAUA,CAAqB,CAC5D,CACF,EAAG,CAACT,EAAYC,CAAM,CAAC,EAEhBC,CACT,EAEA,IAAOP,EAAQI",
|
|
6
|
+
"names": ["useAnchorPosition_exports", "__export", "useAnchorPosition_default", "__toCommonJS", "import_react", "import_es_toolkit", "useAnchorPosition", "sectionIds", "offset", "activeId", "setActiveId", "handleScroll", "scrollPosition", "i", "section", "offsetTop", "debouncedHandleScroll"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var j=Object.create;var m=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var H=(e,t)=>{for(var o in t)m(e,o,{get:t[o],enumerable:!0})},b=(e,t,o,a)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of P(t))!L.call(e,s)&&s!==o&&m(e,s,{get:()=>t[s],enumerable:!(a=A(t,s))||a.enumerable});return e};var h=(e,t,o)=>(o=e!=null?j(T(e)):{},b(t||!e||!e.__esModule?m(o,"default",{value:e,enumerable:!0}):o,e)),z=e=>b(m({},"__esModule",{value:!0}),e);var C={};H(C,{default:()=>Q});module.exports=z(C);var r=require("react/jsx-runtime"),i=require("react"),l=require("../../helpers/utils.js"),f=h(require("../../components/picture.js")),N=require("../../shared/Styles.js"),E=require("react-responsive"),q=require("../../hooks/useExposure.js"),c=require("swiper/react"),p=require("swiper/modules"),S=h(require("../Title/index.js"));const D="copy",R="store_benefits",F=(e,t)=>{const o=[];for(let a=0;a<e.length;a+=t)o.push(e.slice(a,a+t));return o},k=(0,i.forwardRef)(({data:{items:e=[],itemShape:t,title:o},className:a},s)=>{const[x,M]=(0,i.useState)(!1),y=(0,E.useMediaQuery)({query:"(max-width: 768px)"}),v=(0,i.useRef)(null),u=(0,i.useRef)(null);(0,i.useImperativeHandle)(s,()=>u.current),(0,q.useExposure)(u,{componentType:D,componentName:R}),(0,i.useEffect)(()=>{M(y)},[y]);const B=x?F(e,3):e;return(0,r.jsxs)("div",{ref:u,className:(0,l.cn)("brand-equity-wrapper w-full",a),children:[o&&(0,r.jsx)(S.default,{data:{title:o}}),x?(0,r.jsxs)(c.Swiper,{className:(0,l.cn)(a),modules:[p.FreeMode,p.Mousewheel,p.Pagination],freeMode:!0,mousewheel:{forceToAxis:!0},pagination:{clickable:!0,el:v.current},breakpoints:{0:{spaceBetween:12}},children:[B?.map((n,d)=>(0,r.jsx)(c.SwiperSlide,{className:"!flex flex-col gap-3",children:Array.isArray(n)&&n?.map((I,g)=>(0,r.jsx)(w,{data:I,itemShape:t,index:g},g))},"SwiperSlide"+d)),(0,r.jsx)("div",{ref:v,className:"mt-3 flex justify-center"})]}):(0,r.jsx)("div",{className:(0,l.cn)("grid grid-cols-1 gap-3","tablet:grid-cols-2","laptop:gap-4 laptop:grid-cols-10"),children:e.map((n,d)=>(0,r.jsx)(w,{data:n,itemShape:t,index:d},d))})]})}),w=({data:e,itemShape:t,index:o})=>(0,r.jsxs)("div",{className:(0,l.cn)("brand-equity-item","box-border flex w-full flex-col bg-white p-4","desktop:p-6 justify-between","laptop:col-span-3 lg-desktop:p-8","laptop:h-[192px] lg-desktop:h-[240px] h-[160px]",{"laptop:col-span-4":[0,5,6,11].includes(o)},t==="round"?"rounded-box":"rounded-none"),children:[(0,r.jsxs)("div",{className:"lg-desktop:h-[36px] flex h-[30px] items-center justify-between gap-3",children:[(0,r.jsx)("h3",{className:"lg-desktop:text-[18px] desktop:text-[16px] text-[14px] font-bold leading-[1.2] tracking-[-0.02em] text-[#080A0F]",children:e.title}),e.type==="avatar"?(0,r.jsx)("div",{className:"flex -space-x-2",children:e?.avatarList?.map((a,s)=>(0,r.jsx)("div",{className:(0,l.cn)("size-[30px] overflow-hidden rounded-full border-2 border-white","relative inline-block","lg-desktop:size-[36px]"),children:(0,r.jsx)(f.default,{source:a.avatar?.url,alt:a.avatar?.alt,className:"size-full object-cover"})},s))}):(0,r.jsx)(f.default,{className:"lg-desktop:size-[36px] size-[30px] shrink-0 object-cover",source:e.icon?.url,alt:e.icon?.alt,imgClassName:"w-full h-full object-cover"})]}),(0,r.jsx)("p",{className:"lg-desktop:text-[24px] line-clamp-3 text-[20px] font-bold leading-[1.2] tracking-[-0.04em] text-[#080A0F]",children:e.description})]});k.displayName="BrandEquity";var Q=(0,N.withLayout)(k);
|
|
2
2
|
//# sourceMappingURL=BrandEquity.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BrandEquity/BrandEquity.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport { forwardRef, useEffect, useRef, useState, useImperativeHandle } from 'react'\n\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { BrandEquityProps, BrandEquityItemProps } from './types.js'\n\nimport type { Img } from '../../types/props.js'\nimport { useMediaQuery } from 'react-responsive'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Pagination, FreeMode, Mousewheel } from 'swiper/modules'\nimport Title from '../Title/index.js'\n\nconst componentType = 'copy'\nconst componentName = 'store_benefits'\n\nconst chunkArray = (arr: BrandEquityItemProps[], size: number) => {\n const chunks = []\n for (let i = 0; i < arr.length; i += size) {\n chunks.push(arr.slice(i, i + size))\n }\n return chunks\n}\n\nconst BrandEquity = forwardRef<HTMLDivElement, BrandEquityProps>(\n ({ data: { items = [], itemShape, title }, className }, ref) => {\n const [isMobile, setIsMobile] = useState(false)\n const mediaQuery = useMediaQuery({ query: '(max-width: 768px)' })\n const paginationRef = useRef<HTMLDivElement>(null)\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n useExposure(innerRef, {\n componentType,\n componentName,\n })\n\n useEffect(() => {\n setIsMobile(mediaQuery)\n }, [mediaQuery])\n\n const itemsArray = isMobile ? chunkArray(items, 3) : items\n return (\n <div ref={innerRef} className={cn('brand-equity-wrapper w-full', className)}>\n {title && <Title data={{ title: title }} />}\n {isMobile ? (\n <Swiper\n className={cn(className)}\n modules={[FreeMode, Mousewheel, Pagination]}\n freeMode={true}\n mousewheel={{\n forceToAxis: true,\n }}\n pagination={{\n clickable: true,\n el: paginationRef.current,\n }}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n },\n }}\n >\n {itemsArray?.map((item, jIndex) => (\n <SwiperSlide key={'SwiperSlide' + jIndex} className=\"!flex flex-col gap-3\">\n {Array.isArray(item) &&\n item?.map((item, index) => (\n <BrandEquityItem key={index} data={item} itemShape={itemShape} index={index} />\n ))}\n </SwiperSlide>\n ))}\n <div ref={paginationRef} className=\"mt-3 flex justify-center\"></div>\n </Swiper>\n ) : (\n <div className={cn('grid grid-cols-1 gap-3', 'tablet:grid-cols-2', 'laptop:gap-4 laptop:grid-cols-10')}>\n {items.map((item, index) => (\n <BrandEquityItem key={index} data={item} itemShape={itemShape} index={index} />\n ))}\n </div>\n )}\n </div>\n )\n }\n)\n\nconst BrandEquityItem = ({\n data,\n itemShape,\n index,\n}: {\n data: BrandEquityItemProps\n itemShape?: 'round' | 'square'\n index: number\n}) => {\n return (\n <div\n className={cn(\n 'brand-equity-item',\n 'box-border flex w-full flex-col bg-white p-4',\n 'desktop:p-6 justify-between',\n 'laptop:col-span-3 lg-desktop:p-8',\n 'laptop:h-[192px] lg-desktop:h-[240px] h-[160px]',\n {\n ['laptop:col-span-4']: [0, 5, 6, 11].includes(index),\n },\n itemShape === 'round' ? 'rounded-box' : 'rounded-none'\n )}\n >\n <div className=\"lg-desktop:h-[36px] flex h-[30px] items-center justify-between gap-3\">\n <h3 className=\"lg-desktop:text-[18px] desktop:text-[16px] text-[14px] font-bold leading-[1.2] tracking-[-0.02em] text-[#080A0F]\">\n {data.title}\n </h3>\n {data.type === 'avatar' ? (\n <div className=\"flex -space-x-2\">\n {data?.avatarList?.map((item: { avatar: Img }, index: number) => (\n <div\n key={index}\n className={cn(\n 'size-[30px] overflow-hidden rounded-full border-2 border-white',\n 'relative inline-block',\n 'lg-desktop:size-[36px]'\n )}\n >\n <Picture source={item.avatar?.url} alt={item.avatar?.alt} className=\"size-full object-cover\" />\n </div>\n ))}\n </div>\n ) : (\n <Picture\n className=\"lg-desktop:size-[36px] size-[30px] shrink-0 object-cover\"\n source={data.icon?.url}\n alt={data.icon?.alt}\n imgClassName=\"w-full h-full object-cover\"\n />\n )}\n </div>\n <p className=\"lg-desktop:text-[24px] line-clamp-3 text-[20px] font-bold leading-[1.2] tracking-[-0.04em] text-[#080A0F]\">\n {data.description}\n </p>\n </div>\n )\n}\n\nexport default withLayout(BrandEquity)\n"],
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA8CkB,IAAAI,EAAA,6BA7ClBC,EAA6E,iBAE7EC,EAAmB,kCACnBC,EAAoB,0CACpBC,EAA2B,kCAI3BC,EAA8B,4BAC9BC,EAA4B,sCAE5BL,EAAoC,wBACpCM,EAAiD,0BACjDC,EAAkB,gCAElB,MAAMC,EAAgB,OAChBC,EAAgB,iBAEhBC,EAAa,CAACC,EAA6BC,IAAiB,CAChE,MAAMC,EAAS,CAAC,EAChB,QAASC,EAAI,EAAGA,EAAIH,EAAI,OAAQG,GAAKF,EACnCC,EAAO,KAAKF,EAAI,MAAMG,EAAGA,EAAIF,CAAI,CAAC,EAEpC,OAAOC,CACT,EAEME,KAAc,cAClB,CAAC,CAAE,KAAM,CAAE,MAAAC,EAAQ,CAAC,EAAG,UAAAC,EAAW,MAAAC,CAAM,EAAG,UAAAC,CAAU,EAAGC,IAAQ,CAC9D,KAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACx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,oBACA,+CACA,8BACA,mCACA,kDACA,CACG,oBAAsB,CAAC,EAAG,EAAG,EAAG,EAAE,EAAE,SAASA,CAAK,CACrD,EACAb,IAAc,QAAU,cAAgB,cAC1C,EAEA,qBAAC,OAAI,UAAU,uEACb,oBAAC,MAAG,UAAU,mHACX,SAAAe,EAAK,MACR,EACCA,EAAK,OAAS,YACb,OAAC,OAAI,UAAU,kBACZ,SAAAA,GAAM,YAAY,IAAI,CAACJ,EAAuBE,OAC7C,OAAC,OAEC,aAAW,MACT,iEACA,wBACA,wBACF,EAEA,mBAAC,EAAAG,QAAA,CAAQ,OAAQL,EAAK,QAAQ,IAAK,IAAKA,EAAK,QAAQ,IAAK,UAAU,yBAAyB,GAPxFE,CAQP,CACD,EACH,KAEA,OAAC,EAAAG,QAAA,CACC,UAAU,2DACV,OAAQD,EAAK,MAAM,IACnB,IAAKA,EAAK,MAAM,IAChB,aAAa,6BACf,GAEJ,KACA,OAAC,KAAE,UAAU,4GACV,SAAAA,EAAK,YACR,GACF,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport { forwardRef, useEffect, useRef, useState, useImperativeHandle } from 'react'\n\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { BrandEquityProps, BrandEquityItemProps } from './types.js'\n\nimport type { Img } from '../../types/props.js'\nimport { useMediaQuery } from 'react-responsive'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Pagination, FreeMode, Mousewheel } from 'swiper/modules'\nimport Title from '../Title/index.js'\n\nconst componentType = 'copy'\nconst componentName = 'store_benefits'\n\nconst chunkArray = (arr: BrandEquityItemProps[], size: number) => {\n const chunks = []\n for (let i = 0; i < arr.length; i += size) {\n chunks.push(arr.slice(i, i + size))\n }\n return chunks\n}\n\nconst BrandEquity = forwardRef<HTMLDivElement, BrandEquityProps>(\n ({ data: { items = [], itemShape, title }, className }, ref) => {\n const [isMobile, setIsMobile] = useState(false)\n const mediaQuery = useMediaQuery({ query: '(max-width: 768px)' })\n const paginationRef = useRef<HTMLDivElement>(null)\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n useExposure(innerRef, {\n componentType,\n componentName,\n })\n\n useEffect(() => {\n setIsMobile(mediaQuery)\n }, [mediaQuery])\n\n const itemsArray = isMobile ? chunkArray(items, 3) : items\n return (\n <div ref={innerRef} className={cn('brand-equity-wrapper w-full', className)}>\n {title && <Title data={{ title: title }} />}\n {isMobile ? (\n <Swiper\n className={cn(className)}\n modules={[FreeMode, Mousewheel, Pagination]}\n freeMode={true}\n mousewheel={{\n forceToAxis: true,\n }}\n pagination={{\n clickable: true,\n el: paginationRef.current,\n }}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n },\n }}\n >\n {itemsArray?.map((item, jIndex) => (\n <SwiperSlide key={'SwiperSlide' + jIndex} className=\"!flex flex-col gap-3\">\n {Array.isArray(item) &&\n item?.map((item, index) => (\n <BrandEquityItem key={index} data={item} itemShape={itemShape} index={index} />\n ))}\n </SwiperSlide>\n ))}\n <div ref={paginationRef} className=\"mt-3 flex justify-center\"></div>\n </Swiper>\n ) : (\n <div className={cn('grid grid-cols-1 gap-3', 'tablet:grid-cols-2', 'laptop:gap-4 laptop:grid-cols-10')}>\n {items.map((item, index) => (\n <BrandEquityItem key={index} data={item} itemShape={itemShape} index={index} />\n ))}\n </div>\n )}\n </div>\n )\n }\n)\n\nconst BrandEquityItem = ({\n data,\n itemShape,\n index,\n}: {\n data: BrandEquityItemProps\n itemShape?: 'round' | 'square'\n index: number\n}) => {\n return (\n <div\n className={cn(\n 'brand-equity-item',\n 'box-border flex w-full flex-col bg-white p-4',\n 'desktop:p-6 justify-between',\n 'laptop:col-span-3 lg-desktop:p-8',\n 'laptop:h-[192px] lg-desktop:h-[240px] h-[160px]',\n {\n ['laptop:col-span-4']: [0, 5, 6, 11].includes(index),\n },\n itemShape === 'round' ? 'rounded-box' : 'rounded-none'\n )}\n >\n <div className=\"lg-desktop:h-[36px] flex h-[30px] items-center justify-between gap-3\">\n <h3 className=\"lg-desktop:text-[18px] desktop:text-[16px] text-[14px] font-bold leading-[1.2] tracking-[-0.02em] text-[#080A0F]\">\n {data.title}\n </h3>\n {data.type === 'avatar' ? (\n <div className=\"flex -space-x-2\">\n {data?.avatarList?.map((item: { avatar: Img }, index: number) => (\n <div\n key={index}\n className={cn(\n 'size-[30px] overflow-hidden rounded-full border-2 border-white',\n 'relative inline-block',\n 'lg-desktop:size-[36px]'\n )}\n >\n <Picture source={item.avatar?.url} alt={item.avatar?.alt} className=\"size-full object-cover\" />\n </div>\n ))}\n </div>\n ) : (\n <Picture\n className=\"lg-desktop:size-[36px] size-[30px] shrink-0 object-cover\"\n source={data.icon?.url}\n alt={data.icon?.alt}\n imgClassName=\"w-full h-full object-cover\"\n />\n )}\n </div>\n <p className=\"lg-desktop:text-[24px] line-clamp-3 text-[20px] font-bold leading-[1.2] tracking-[-0.04em] text-[#080A0F]\">\n {data.description}\n </p>\n </div>\n )\n}\n\nBrandEquity.displayName = 'BrandEquity'\n\nexport default withLayout(BrandEquity)\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA8CkB,IAAAI,EAAA,6BA7ClBC,EAA6E,iBAE7EC,EAAmB,kCACnBC,EAAoB,0CACpBC,EAA2B,kCAI3BC,EAA8B,4BAC9BC,EAA4B,sCAE5BL,EAAoC,wBACpCM,EAAiD,0BACjDC,EAAkB,gCAElB,MAAMC,EAAgB,OAChBC,EAAgB,iBAEhBC,EAAa,CAACC,EAA6BC,IAAiB,CAChE,MAAMC,EAAS,CAAC,EAChB,QAASC,EAAI,EAAGA,EAAIH,EAAI,OAAQG,GAAKF,EACnCC,EAAO,KAAKF,EAAI,MAAMG,EAAGA,EAAIF,CAAI,CAAC,EAEpC,OAAOC,CACT,E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AAA,CAA4B,KAAMH,EAAM,UAAWX,EAAW,MAAOa,GAAhDA,CAAuD,CAC9E,EACH,GAEJ,CAEJ,CACF,EAEMC,EAAkB,CAAC,CACvB,KAAAC,EACA,UAAAf,EACA,MAAAa,CACF,OAMI,QAAC,OACC,aAAW,MACT,oBACA,+CACA,8BACA,mCACA,kDACA,CACG,oBAAsB,CAAC,EAAG,EAAG,EAAG,EAAE,EAAE,SAASA,CAAK,CACrD,EACAb,IAAc,QAAU,cAAgB,cAC1C,EAEA,qBAAC,OAAI,UAAU,uEACb,oBAAC,MAAG,UAAU,mHACX,SAAAe,EAAK,MACR,EACCA,EAAK,OAAS,YACb,OAAC,OAAI,UAAU,kBACZ,SAAAA,GAAM,YAAY,IAAI,CAACJ,EAAuBE,OAC7C,OAAC,OAEC,aAAW,MACT,iEACA,wBACA,wBACF,EAEA,mBAAC,EAAAG,QAAA,CAAQ,OAAQL,EAAK,QAAQ,IAAK,IAAKA,EAAK,QAAQ,IAAK,UAAU,yBAAyB,GAPxFE,CAQP,CACD,EACH,KAEA,OAAC,EAAAG,QAAA,CACC,UAAU,2DACV,OAAQD,EAAK,MAAM,IACnB,IAAKA,EAAK,MAAM,IAChB,aAAa,6BACf,GAEJ,KACA,OAAC,KAAE,UAAU,4GACV,SAAAA,EAAK,YACR,GACF,EAIJjB,EAAY,YAAc,cAE1B,IAAOlB,KAAQ,cAAWkB,CAAW",
|
|
6
6
|
"names": ["BrandEquity_exports", "__export", "BrandEquity_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_picture", "import_Styles", "import_react_responsive", "import_useExposure", "import_modules", "import_Title", "componentType", "componentName", "chunkArray", "arr", "size", "chunks", "i", "BrandEquity", "items", "itemShape", "title", "className", "ref", "isMobile", "setIsMobile", "mediaQuery", "paginationRef", "innerRef", "itemsArray", "Title", "item", "jIndex", "index", "BrandEquityItem", "data", "Picture"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* 产品标签接口
|
|
4
|
+
*/
|
|
5
|
+
export interface ProductTag {
|
|
6
|
+
/** 标签文本 */
|
|
7
|
+
text: string;
|
|
8
|
+
/** 标签类型 */
|
|
9
|
+
type?: 'discount' | 'new' | 'default';
|
|
10
|
+
/** 标签样式变体 */
|
|
11
|
+
variant?: 'filled' | 'outlined';
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 免费赠品接口
|
|
15
|
+
*/
|
|
16
|
+
export interface FreeGift {
|
|
17
|
+
/** 赠品ID */
|
|
18
|
+
id: string;
|
|
19
|
+
/** 赠品图片URL */
|
|
20
|
+
image: string;
|
|
21
|
+
/** 赠品名称 */
|
|
22
|
+
name: string;
|
|
23
|
+
/** 原价 */
|
|
24
|
+
originalPrice: string;
|
|
25
|
+
/** 现价(通常为Free) */
|
|
26
|
+
currentPrice: string;
|
|
27
|
+
/** 是否为新品 */
|
|
28
|
+
isNew?: boolean;
|
|
29
|
+
/** 是否被选中 */
|
|
30
|
+
selected?: boolean;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* 产品卡片数据接口
|
|
34
|
+
*/
|
|
35
|
+
export interface ProductCardData {
|
|
36
|
+
/** 产品图片URL */
|
|
37
|
+
image: string;
|
|
38
|
+
/** 产品标签列表 */
|
|
39
|
+
tags?: ProductTag[];
|
|
40
|
+
/** 产品名称 */
|
|
41
|
+
name: string;
|
|
42
|
+
/** 产品描述 */
|
|
43
|
+
description: string;
|
|
44
|
+
/** 免费赠品说明文字 */
|
|
45
|
+
freeGiftLabel?: string;
|
|
46
|
+
/** 免费赠品列表 */
|
|
47
|
+
freeGifts?: FreeGift[];
|
|
48
|
+
/** 赠品选择模式:单选或多选 */
|
|
49
|
+
giftSelectionMode?: 'single' | 'multiple';
|
|
50
|
+
/** 当前价格 */
|
|
51
|
+
currentPrice: string;
|
|
52
|
+
/** 原价 */
|
|
53
|
+
originalPrice?: string;
|
|
54
|
+
/** Learn More按钮文本 */
|
|
55
|
+
learnMoreText?: string;
|
|
56
|
+
/** Shop Now按钮文本 */
|
|
57
|
+
shopNowText?: string;
|
|
58
|
+
}
|
|
59
|
+
export interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
60
|
+
/** 产品数据 */
|
|
61
|
+
data: ProductCardData;
|
|
62
|
+
/** 布局模式:一排一个或一排两个 */
|
|
63
|
+
layout?: 'single' | 'double';
|
|
64
|
+
/** 产品卡片点击事件 */
|
|
65
|
+
onProductClick?: (product: ProductCardData) => void;
|
|
66
|
+
/** 产品图片点击事件 */
|
|
67
|
+
onProductImageClick?: (product: ProductCardData) => void;
|
|
68
|
+
/** Learn More按钮点击事件 */
|
|
69
|
+
onLearnMore?: (product: ProductCardData) => void;
|
|
70
|
+
/** Shop Now按钮点击事件 */
|
|
71
|
+
onShopNow?: (product: ProductCardData) => void;
|
|
72
|
+
/** 赠品点击事件 */
|
|
73
|
+
onGiftClick?: (gift: FreeGift, product: ProductCardData) => void;
|
|
74
|
+
/** 赠品选择变化事件 */
|
|
75
|
+
onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* ProductCard - 买赠货架产品卡片
|
|
79
|
+
*
|
|
80
|
+
* @description 用于买一赠一活动的产品展示卡片,左侧展示产品图片和标签,右侧展示产品信息、赠品和购买按钮
|
|
81
|
+
*/
|
|
82
|
+
declare const ProductCard: React.ForwardRefExoticComponent<ProductCardProps & React.RefAttributes<HTMLDivElement>>;
|
|
83
|
+
export default ProductCard;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var E=Object.create;var f=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var A=Object.getOwnPropertyNames;var W=Object.getPrototypeOf,j=Object.prototype.hasOwnProperty;var q=(t,e)=>{for(var r in e)f(t,r,{get:e[r],enumerable:!0})},w=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of A(e))!j.call(t,n)&&n!==r&&f(t,n,{get:()=>e[n],enumerable:!(l=B(e,n))||l.enumerable});return t};var p=(t,e,r)=>(r=t!=null?E(W(t)):{},w(e||!t||!t.__esModule?f(r,"default",{value:t,enumerable:!0}):r,t)),J=t=>w(f({},"__esModule",{value:!0}),t);var O={};q(O,{default:()=>K});module.exports=J(O);var i=require("react/jsx-runtime"),m=p(require("react")),a=require("../../helpers/index.js"),u=p(require("../../components/picture.js")),b=p(require("../../components/button.js")),s=require("../../components/text.js"),G=require("../../components/heading.js"),v=p(require("../../components/badge.js"));const N=t=>t.type==="discount"||t.type==="new"?t.variant==="outlined"?"border-[1.6px] border-brand-0 text-brand-0 bg-container-primary":"bg-brand-0 text-info-white border-none":"bg-info-primary text-info-white border-none",h=m.forwardRef(({image:t,name:e,tags:r,layout:l="single",className:n,onClick:o},c)=>(0,i.jsxs)("div",{ref:c,className:(0,a.cn)("rounded-l-box laptop:rounded-l-box tablet:rounded-t-box tablet:rounded-r-none relative flex items-start gap-6 overflow-hidden p-6",l==="single"?"w-[964px]":"w-[482px]",l==="single"?" tablet:w-full tablet:p-4":"",o?"cursor-pointer":"",n),onClick:o,children:[(0,i.jsx)(u.default,{source:t,alt:e,className:"absolute inset-0 w-full max-w-none",imgClassName:"h-full object-cover"}),r&&r.length>0&&(0,i.jsx)("div",{className:"relative z-10 flex flex-wrap items-start gap-1",children:r.map((g,x)=>(0,i.jsx)(v.default,{size:"lg",className:(0,a.cn)(N(g),"tracking-[-0.64px]","tablet:text-sm tablet:px-[6px] tablet:py-[3px] tablet:tracking-[-0.56px]"),children:g.text},x))})]}));h.displayName="ProductImage";const P=m.forwardRef(({name:t,description:e,layout:r="single",className:l},n)=>(0,i.jsxs)("div",{ref:n,className:(0,a.cn)("flex w-full flex-col gap-1",l),children:[(0,i.jsx)(G.Heading,{as:"h4",size:4,weight:"semibold",className:(0,a.cn)("text-info-primary w-full text-2xl leading-[1.2] tracking-[-0.96px]","tablet:text-[20px] tablet:tracking-[-0.8px]"),children:t}),(0,i.jsx)(s.Text,{size:4,weight:"semibold",className:(0,a.cn)("text-info-primary w-full leading-[1.4] tracking-[-0.36px]","tablet:text-sm tablet:tracking-[-0.28px]"),children:e})]}));P.displayName="ProductInfo";const y=m.forwardRef(({gift:t,onClick:e,className:r},l)=>(0,i.jsx)("div",{ref:l,className:(0,a.cn)("bg-container-primary rounded-box relative flex w-full cursor-pointer flex-col border-2 transition-all hover:shadow-sm",t.selected?"border-brand-0":"border-container-secondary-1",r),onClick:()=>e?.(t),children:(0,i.jsxs)("div",{className:"flex w-full flex-col items-end",children:[t.isNew&&(0,i.jsx)("div",{className:"absolute right-0 top-0 flex items-start",children:(0,i.jsx)(v.default,{size:"lg",className:(0,a.cn)(N({text:"New",type:"new",variant:"filled"}),"tracking-[-0.64px]"),children:"New"})}),(0,i.jsxs)("div",{className:(0,a.cn)("flex w-full items-center gap-4 p-4","tablet:p-2"),children:[(0,i.jsx)("div",{className:(0,a.cn)("size-14 shrink-0","tablet:size-12"),children:(0,i.jsx)(u.default,{source:t.image,alt:t.name,className:"size-full object-cover"})}),(0,i.jsxs)("div",{className:"flex min-w-0 flex-1 flex-col gap-1",children:[(0,i.jsx)(s.Text,{size:4,weight:"semibold",className:(0,a.cn)("text-info-primary truncate leading-[1.4] tracking-[-0.36px]","tablet:text-sm tablet:tracking-[-0.28px]"),children:t.name}),(0,i.jsxs)("div",{className:"flex items-center gap-1",children:[(0,i.jsx)(s.Text,{size:4,weight:"semibold",className:(0,a.cn)(),children:t.currentPrice}),(0,i.jsx)(s.Text,{size:4,weight:"semibold",className:(0,a.cn)(),children:t.originalPrice})]})]})]})]})}));y.displayName="FreeGiftItem";const k=m.forwardRef(({freeGiftLabel:t,freeGifts:e,onGiftClick:r,layout:l="single",className:n},o)=>!e||e.length===0?null:(0,i.jsxs)("div",{ref:o,className:(0,a.cn)("flex w-full flex-col gap-2",n),children:[t&&(0,i.jsx)(s.Text,{size:4,weight:"semibold",className:(0,a.cn)("text-info-primary w-full leading-[1.4] tracking-[-0.36px]","tablet:text-sm tablet:tracking-[-0.28px]"),children:t}),(0,i.jsx)("div",{className:(0,a.cn)("tablet:flex-row laptop:flex-col flex flex-col gap-2"),children:e.map((c,d)=>(0,i.jsx)("div",{children:(0,i.jsx)(y,{gift:c,onClick:r})},c.id||d))})]}));k.displayName="GiftSelection";const C=m.forwardRef(({currentPrice:t,originalPrice:e,learnMoreText:r="Learn More",shopNowText:l="Shop Now",onLearnMore:n,onShopNow:o,layout:c="single",className:d},g)=>(0,i.jsxs)("div",{ref:g,className:(0,a.cn)("flex w-full flex-col justify-center gap-2",d),children:[(0,i.jsxs)("div",{className:"flex w-full items-center gap-1",children:[(0,i.jsx)(s.Text,{size:4,weight:"semibold",className:(0,a.cn)(),children:t}),e&&(0,i.jsx)(s.Text,{size:4,weight:"semibold",className:(0,a.cn)("line-through"),children:e})]}),(0,i.jsxs)("div",{className:(0,a.cn)("flex items-start gap-3","tablet:gap-2"),children:[(0,i.jsx)(b.default,{variant:"secondary",size:"lg",className:(0,a.cn)("tablet:px-5 tablet:py-[10px] tablet:text-sm tablet:tracking-[-0.56px]"),onClick:n,children:r}),(0,i.jsx)(b.default,{variant:"primary",size:"lg",className:(0,a.cn)("tablet:px-5 tablet:py-[10px] tablet:text-sm tablet:tracking-[-0.56px]"),onClick:o,children:l})]})]}));C.displayName="PriceAndActions";const T=m.forwardRef(({className:t,data:e,layout:r="single",onProductClick:l,onProductImageClick:n,onLearnMore:o,onShopNow:c,onGiftClick:d,onGiftSelectionChange:g,...x},M)=>{const z=r==="single"?"w-full max-w-[1664px]":"w-full",L=r==="single"?"w-[700px]":"w-[350px]",D=()=>{l?.(e)},F=()=>{n?.(e)},S=()=>{o?.(e)},H=()=>{c?.(e)},I=R=>{d?.(R,e)};return(0,i.jsxs)("div",{ref:M,className:(0,a.cn)("bg-container-primary laptop:flex-row rounded-box flex flex-col items-stretch",z,r==="single"?"tablet:flex-col tablet:max-w-[704px]":"",l?"cursor-pointer":"",t),onClick:D,...x,children:[(0,i.jsx)(h,{image:e.image,name:e.name,tags:e.tags,layout:r,onClick:F}),(0,i.jsxs)("div",{className:(0,a.cn)("bg-container-secondary-1 rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none flex flex-col justify-between p-6",L,r==="single"?"tablet:w-full tablet:p-4 tablet:gap-4":""),children:[(0,i.jsx)(P,{name:e.name,description:e.description,layout:r}),(0,i.jsx)(k,{freeGiftLabel:e.freeGiftLabel,freeGifts:e.freeGifts,onGiftClick:I,layout:r}),(0,i.jsx)(C,{currentPrice:e.currentPrice,originalPrice:e.originalPrice,learnMoreText:e.learnMoreText,shopNowText:e.shopNowText,onLearnMore:S,onShopNow:H,layout:r})]})]})});T.displayName="ProductCard";var K=T;
|
|
2
|
+
//# sourceMappingURL=ProductCard.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/ProductCard.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport { Text } from '../../components/text.js'\nimport { Heading } from '../../components/heading.js'\nimport Badge from '../../components/badge.js'\n\n/**\n * \u4EA7\u54C1\u6807\u7B7E\u63A5\u53E3\n */\nexport interface ProductTag {\n /** \u6807\u7B7E\u6587\u672C */\n text: string\n /** \u6807\u7B7E\u7C7B\u578B */\n type?: 'discount' | 'new' | 'default'\n /** \u6807\u7B7E\u6837\u5F0F\u53D8\u4F53 */\n variant?: 'filled' | 'outlined'\n}\n\n/**\n * \u514D\u8D39\u8D60\u54C1\u63A5\u53E3\n */\nexport interface FreeGift {\n /** \u8D60\u54C1ID */\n id: string\n /** \u8D60\u54C1\u56FE\u7247URL */\n image: string\n /** \u8D60\u54C1\u540D\u79F0 */\n name: string\n /** \u539F\u4EF7 */\n originalPrice: string\n /** \u73B0\u4EF7\uFF08\u901A\u5E38\u4E3AFree\uFF09 */\n currentPrice: string\n /** \u662F\u5426\u4E3A\u65B0\u54C1 */\n isNew?: boolean\n /** \u662F\u5426\u88AB\u9009\u4E2D */\n selected?: boolean\n}\n\n/**\n * \u4EA7\u54C1\u5361\u7247\u6570\u636E\u63A5\u53E3\n */\nexport interface ProductCardData {\n /** \u4EA7\u54C1\u56FE\u7247URL */\n image: string\n /** \u4EA7\u54C1\u6807\u7B7E\u5217\u8868 */\n tags?: ProductTag[]\n /** \u4EA7\u54C1\u540D\u79F0 */\n name: string\n /** \u4EA7\u54C1\u63CF\u8FF0 */\n description: string\n /** \u514D\u8D39\u8D60\u54C1\u8BF4\u660E\u6587\u5B57 */\n freeGiftLabel?: string\n /** \u514D\u8D39\u8D60\u54C1\u5217\u8868 */\n freeGifts?: FreeGift[]\n /** \u8D60\u54C1\u9009\u62E9\u6A21\u5F0F\uFF1A\u5355\u9009\u6216\u591A\u9009 */\n giftSelectionMode?: 'single' | 'multiple'\n /** \u5F53\u524D\u4EF7\u683C */\n currentPrice: string\n /** \u539F\u4EF7 */\n originalPrice?: string\n /** Learn More\u6309\u94AE\u6587\u672C */\n learnMoreText?: string\n /** Shop Now\u6309\u94AE\u6587\u672C */\n shopNowText?: string\n}\n\nexport interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4EA7\u54C1\u6570\u636E */\n data: ProductCardData\n /** \u5E03\u5C40\u6A21\u5F0F\uFF1A\u4E00\u6392\u4E00\u4E2A\u6216\u4E00\u6392\u4E24\u4E2A */\n layout?: 'single' | 'double'\n /** \u4EA7\u54C1\u5361\u7247\u70B9\u51FB\u4E8B\u4EF6 */\n onProductClick?: (product: ProductCardData) => void\n /** \u4EA7\u54C1\u56FE\u7247\u70B9\u51FB\u4E8B\u4EF6 */\n onProductImageClick?: (product: ProductCardData) => void\n /** Learn More\u6309\u94AE\u70B9\u51FB\u4E8B\u4EF6 */\n onLearnMore?: (product: ProductCardData) => void\n /** Shop Now\u6309\u94AE\u70B9\u51FB\u4E8B\u4EF6 */\n onShopNow?: (product: ProductCardData) => void\n /** \u8D60\u54C1\u70B9\u51FB\u4E8B\u4EF6 */\n onGiftClick?: (gift: FreeGift, product: ProductCardData) => void\n /** \u8D60\u54C1\u9009\u62E9\u53D8\u5316\u4E8B\u4EF6 */\n onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void\n}\n\n/**\n * \u83B7\u53D6\u6807\u7B7E\u6837\u5F0F\n */\nconst getTagStyles = (tag: ProductTag) => {\n if (tag.type === 'discount') {\n return tag.variant === 'outlined'\n ? 'border-[1.6px] border-brand-0 text-brand-0 bg-container-primary'\n : 'bg-brand-0 text-info-white border-none'\n }\n\n if (tag.type === 'new') {\n return tag.variant === 'outlined'\n ? 'border-[1.6px] border-brand-0 text-brand-0 bg-container-primary'\n : 'bg-brand-0 text-info-white border-none'\n }\n\n return 'bg-info-primary text-info-white border-none'\n}\n\n/**\n * ProductImage - \u4EA7\u54C1\u56FE\u7247\u533A\u57DF\n */\nconst ProductImage = React.forwardRef<\n HTMLDivElement,\n {\n image: string\n name: string\n tags?: ProductTag[]\n layout?: 'single' | 'double'\n className?: string\n onClick?: () => void\n }\n>(({ image, name, tags, layout = 'single', className, onClick }, ref) => {\n const imageWidth = layout === 'single' ? 'w-[964px]' : 'w-[482px]'\n\n return (\n <div\n ref={ref}\n className={cn(\n 'rounded-l-box laptop:rounded-l-box tablet:rounded-t-box tablet:rounded-r-none relative flex items-start gap-6 overflow-hidden p-6',\n imageWidth,\n // \u79FB\u52A8\u7AEF\u6837\u5F0F\n layout === 'single' ? ' tablet:w-full tablet:p-4' : '',\n onClick ? 'cursor-pointer' : '',\n className\n )}\n onClick={onClick}\n >\n {/* \u80CC\u666F\u56FE\u7247 */}\n\n <Picture\n source={image}\n alt={name}\n className=\"absolute inset-0 w-full max-w-none\"\n imgClassName=\"h-full object-cover\"\n />\n\n {/* \u4EA7\u54C1\u6807\u7B7E */}\n {tags && tags.length > 0 && (\n <div className=\"relative z-10 flex flex-wrap items-start gap-1\">\n {tags.map((tag, index) => (\n <Badge\n key={index}\n size=\"lg\"\n className={cn(\n getTagStyles(tag),\n 'tracking-[-0.64px]',\n 'tablet:text-sm tablet:px-[6px] tablet:py-[3px] tablet:tracking-[-0.56px]'\n )}\n >\n {tag.text}\n </Badge>\n ))}\n </div>\n )}\n </div>\n )\n})\n\nProductImage.displayName = 'ProductImage'\n\n/**\n * ProductInfo - \u4EA7\u54C1\u4FE1\u606F\u533A\u57DF\n */\nconst ProductInfo = React.forwardRef<\n HTMLDivElement,\n {\n name: string\n description: string\n layout?: 'single' | 'double'\n className?: string\n }\n>(({ name, description, layout = 'single', className }, ref) => {\n return (\n <div ref={ref} className={cn('flex w-full flex-col gap-1', className)}>\n <Heading\n as=\"h4\"\n size={4}\n weight=\"semibold\"\n className={cn(\n 'text-info-primary w-full text-2xl leading-[1.2] tracking-[-0.96px]',\n 'tablet:text-[20px] tablet:tracking-[-0.8px]'\n )}\n >\n {name}\n </Heading>\n <Text\n size={4}\n weight=\"semibold\"\n className={cn(\n 'text-info-primary w-full leading-[1.4] tracking-[-0.36px]',\n 'tablet:text-sm tablet:tracking-[-0.28px]'\n )}\n >\n {description}\n </Text>\n </div>\n )\n})\n\nProductInfo.displayName = 'ProductInfo'\n\n/**\n * FreeGiftItem - \u514D\u8D39\u8D60\u54C1\u9879\n */\nconst FreeGiftItem = React.forwardRef<\n HTMLDivElement,\n {\n gift: FreeGift\n onClick?: (gift: FreeGift) => void\n className?: string\n }\n>(({ gift, onClick, className }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary rounded-box relative flex w-full cursor-pointer flex-col border-2 transition-all hover:shadow-sm',\n gift.selected ? 'border-brand-0' : 'border-container-secondary-1',\n className\n )}\n onClick={() => onClick?.(gift)}\n >\n <div className=\"flex w-full flex-col items-end\">\n {gift.isNew && (\n <div className=\"absolute right-0 top-0 flex items-start\">\n <Badge\n size=\"lg\"\n className={cn(getTagStyles({ text: 'New', type: 'new', variant: 'filled' }), 'tracking-[-0.64px]')}\n >\n New\n </Badge>\n </div>\n )}\n <div className={cn('flex w-full items-center gap-4 p-4', 'tablet:p-2')}>\n <div className={cn('size-14 shrink-0', 'tablet:size-12')}>\n <Picture source={gift.image} alt={gift.name} className=\"size-full object-cover\" />\n </div>\n <div className=\"flex min-w-0 flex-1 flex-col gap-1\">\n <Text\n size={4}\n weight=\"semibold\"\n className={cn(\n 'text-info-primary truncate leading-[1.4] tracking-[-0.36px]',\n 'tablet:text-sm tablet:tracking-[-0.28px]'\n )}\n >\n {gift.name}\n </Text>\n <div className=\"flex items-center gap-1\">\n <Text size={4} weight=\"semibold\" className={cn()}>\n {gift.currentPrice}\n </Text>\n <Text size={4} weight=\"semibold\" className={cn()}>\n {gift.originalPrice}\n </Text>\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n})\n\nFreeGiftItem.displayName = 'FreeGiftItem'\n\n/**\n * GiftSelection - \u8D60\u54C1\u9009\u62E9\u533A\u57DF\n */\nconst GiftSelection = React.forwardRef<\n HTMLDivElement,\n {\n freeGiftLabel?: string\n freeGifts?: FreeGift[]\n onGiftClick?: (gift: FreeGift) => void\n layout?: 'single' | 'double'\n className?: string\n }\n>(({ freeGiftLabel, freeGifts, onGiftClick, layout = 'single', className }, ref) => {\n if (!freeGifts || freeGifts.length === 0) {\n return null\n }\n\n return (\n <div ref={ref} className={cn('flex w-full flex-col gap-2', className)}>\n {freeGiftLabel && (\n <Text\n size={4}\n weight=\"semibold\"\n className={cn(\n 'text-info-primary w-full leading-[1.4] tracking-[-0.36px]',\n 'tablet:text-sm tablet:tracking-[-0.28px]'\n )}\n >\n {freeGiftLabel}\n </Text>\n )}\n <div className={cn('tablet:flex-row laptop:flex-col flex flex-col gap-2')}>\n {freeGifts.map((gift, index) => (\n <div key={gift.id || index}>\n <FreeGiftItem gift={gift} onClick={onGiftClick} />\n </div>\n ))}\n </div>\n </div>\n )\n})\n\nGiftSelection.displayName = 'GiftSelection'\n\n/**\n * PriceAndActions - \u4EF7\u683C\u548C\u64CD\u4F5C\u533A\u57DF\n */\nconst PriceAndActions = React.forwardRef<\n HTMLDivElement,\n {\n currentPrice: string\n originalPrice?: string\n learnMoreText?: string\n shopNowText?: string\n onLearnMore?: () => void\n onShopNow?: () => void\n layout?: 'single' | 'double'\n className?: string\n }\n>(\n (\n {\n currentPrice,\n originalPrice,\n learnMoreText = 'Learn More',\n shopNowText = 'Shop Now',\n onLearnMore,\n onShopNow,\n layout = 'single',\n className,\n },\n ref\n ) => {\n return (\n <div ref={ref} className={cn('flex w-full flex-col justify-center gap-2', className)}>\n {/* \u4EF7\u683C */}\n <div className=\"flex w-full items-center gap-1\">\n <Text size={4} weight=\"semibold\" className={cn()}>\n {currentPrice}\n </Text>\n {originalPrice && (\n <Text size={4} weight=\"semibold\" className={cn('line-through')}>\n {originalPrice}\n </Text>\n )}\n </div>\n\n {/* \u6309\u94AE\u7EC4 */}\n <div className={cn('flex items-start gap-3', 'tablet:gap-2')}>\n <Button\n variant=\"secondary\"\n size=\"lg\"\n className={cn('tablet:px-5 tablet:py-[10px] tablet:text-sm tablet:tracking-[-0.56px]')}\n onClick={onLearnMore}\n >\n {learnMoreText}\n </Button>\n <Button\n variant=\"primary\"\n size=\"lg\"\n className={cn('tablet:px-5 tablet:py-[10px] tablet:text-sm tablet:tracking-[-0.56px]')}\n onClick={onShopNow}\n >\n {shopNowText}\n </Button>\n </div>\n </div>\n )\n }\n)\n\nPriceAndActions.displayName = 'PriceAndActions'\n\n/**\n * ProductCard - \u4E70\u8D60\u8D27\u67B6\u4EA7\u54C1\u5361\u7247\n *\n * @description \u7528\u4E8E\u4E70\u4E00\u8D60\u4E00\u6D3B\u52A8\u7684\u4EA7\u54C1\u5C55\u793A\u5361\u7247\uFF0C\u5DE6\u4FA7\u5C55\u793A\u4EA7\u54C1\u56FE\u7247\u548C\u6807\u7B7E\uFF0C\u53F3\u4FA7\u5C55\u793A\u4EA7\u54C1\u4FE1\u606F\u3001\u8D60\u54C1\u548C\u8D2D\u4E70\u6309\u94AE\n */\nconst ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(\n (\n {\n className,\n data,\n layout = 'single',\n onProductClick,\n onProductImageClick,\n onLearnMore,\n onShopNow,\n onGiftClick,\n onGiftSelectionChange,\n ...props\n },\n ref\n ) => {\n const containerWidth = layout === 'single' ? 'w-full max-w-[1664px]' : 'w-full'\n const contentWidth = layout === 'single' ? 'w-[700px]' : 'w-[350px]'\n\n const handleProductClick = () => {\n onProductClick?.(data)\n }\n\n const handleProductImageClick = () => {\n onProductImageClick?.(data)\n }\n\n const handleLearnMoreClick = () => {\n onLearnMore?.(data)\n }\n\n const handleShopNowClick = () => {\n onShopNow?.(data)\n }\n\n const handleGiftClick = (gift: FreeGift) => {\n onGiftClick?.(gift, data)\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary laptop:flex-row rounded-box flex flex-col items-stretch',\n containerWidth,\n layout === 'single' ? 'tablet:flex-col tablet:max-w-[704px]' : '',\n onProductClick ? 'cursor-pointer' : '',\n className\n )}\n onClick={handleProductClick}\n {...props}\n >\n {/* \u4EA7\u54C1\u56FE\u7247\u533A\u57DF */}\n <ProductImage\n image={data.image}\n name={data.name}\n tags={data.tags}\n layout={layout}\n onClick={handleProductImageClick}\n />\n\n {/* \u4EA7\u54C1\u4FE1\u606F\u533A\u57DF */}\n <div\n className={cn(\n 'bg-container-secondary-1 rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none flex flex-col justify-between p-6',\n contentWidth,\n // \u79FB\u52A8\u7AEF\u6837\u5F0F\n layout === 'single' ? 'tablet:w-full tablet:p-4 tablet:gap-4' : ''\n )}\n >\n {/* \u4EA7\u54C1\u6807\u9898\u548C\u63CF\u8FF0 */}\n <ProductInfo name={data.name} description={data.description} layout={layout} />\n\n {/* \u514D\u8D39\u8D60\u54C1\u533A\u57DF */}\n <GiftSelection\n freeGiftLabel={data.freeGiftLabel}\n freeGifts={data.freeGifts}\n onGiftClick={handleGiftClick}\n layout={layout}\n />\n\n {/* \u4EF7\u683C\u548C\u6309\u94AE\u533A\u57DF */}\n <PriceAndActions\n currentPrice={data.currentPrice}\n originalPrice={data.originalPrice}\n learnMoreText={data.learnMoreText}\n shopNowText={data.shopNowText}\n onLearnMore={handleLearnMoreClick}\n onShopNow={handleShopNowClick}\n layout={layout}\n />\n </div>\n </div>\n )\n }\n)\n\nProductCard.displayName = 'ProductCard'\n\nexport default ProductCard\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA6HI,IAAAI,EAAA,6BA3HJC,EAAuB,oBACvBC,EAAmB,kCACnBC,EAAoB,0CACpBC,EAAmB,yCACnBC,EAAqB,oCACrBC,EAAwB,uCACxBC,EAAkB,wCAoFlB,MAAMC,EAAgBC,GAChBA,EAAI,OAAS,YAMbA,EAAI,OAAS,MACRA,EAAI,UAAY,WACnB,kEACA,yCAGC,8CAMHC,EAAeT,EAAM,WAUzB,CAAC,CAAE,MAAAU,EAAO,KAAAC,EAAM,KAAAC,EAAM,OAAAC,EAAS,SAAU,UAAAC,EAAW,QAAAC,CAAQ,EAAGC,OAI7D,QAAC,OACC,IAAKA,EACL,aAAW,MACT,oIANaH,IAAW,SAAW,YAAc,YASjDA,IAAW,SAAW,4BAA8B,GACpDE,EAAU,iBAAmB,GAC7BD,CACF,EACA,QAASC,EAIT,oBAAC,EAAAE,QAAA,CACC,OAAQP,EACR,IAAKC,EACL,UAAU,sCACV,aAAa,sBACf,EAGCC,GAAQA,EAAK,OAAS,MACrB,OAAC,OAAI,UAAU,iDACZ,SAAAA,EAAK,IAAI,CAACJ,EAAKU,OACd,OAAC,EAAAC,QAAA,CAEC,KAAK,KACL,aAAW,MACTZ,EAAaC,CAAG,EAChB,qBACA,0EACF,EAEC,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pB,cAAeA,EAAK,cACpB,YAAaA,EAAK,YAClB,YAAaS,EACb,UAAWC,EACX,OAAQlC,EACV,GACF,GACF,CAEJ,CACF,EAEAuB,EAAY,YAAc,cAE1B,IAAOvC,EAAQuC",
|
|
6
|
+
"names": ["ProductCard_exports", "__export", "ProductCard_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_picture", "import_button", "import_text", "import_heading", "import_badge", "getTagStyles", "tag", "ProductImage", "image", "name", "tags", "layout", "className", "onClick", "ref", "Picture", "index", "Badge", "ProductInfo", "description", "FreeGiftItem", "gift", "GiftSelection", "freeGiftLabel", "freeGifts", "onGiftClick", "PriceAndActions", "currentPrice", "originalPrice", "learnMoreText", "shopNowText", "onLearnMore", "onShopNow", "Button", "ProductCard", "data", "onProductClick", "onProductImageClick", "onGiftSelectionChange", "props", "containerWidth", "contentWidth", "handleProductClick", "handleProductImageClick", "handleLearnMoreClick", "handleShopNowClick", "handleGiftClick"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type ProductCardData, type FreeGift } from './ProductCard.js';
|
|
3
|
+
export type BuyOneGetOneShelfSemanticName = 'root' | 'title' | 'description' | 'content' | 'productCard' | 'productCardImage' | 'productCardTitle' | 'productCardDescription' | 'productCardPrice' | 'productCardGiftsContainer' | 'productCardBtnGroup';
|
|
4
|
+
/**
|
|
5
|
+
* BuyOneGetOneShelf 业务组件数据接口
|
|
6
|
+
*/
|
|
7
|
+
export interface BuyOneGetOneShelfData {
|
|
8
|
+
/** 组件标题 */
|
|
9
|
+
title?: string;
|
|
10
|
+
/** 组件描述 */
|
|
11
|
+
description?: string;
|
|
12
|
+
/** 产品列表 */
|
|
13
|
+
products?: ProductCardData[];
|
|
14
|
+
/** 布局模式:一排一个或一排两个 */
|
|
15
|
+
layout?: 'single' | 'double';
|
|
16
|
+
}
|
|
17
|
+
export interface BuyOneGetOneShelfProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
18
|
+
/** 业务数据 */
|
|
19
|
+
data: BuyOneGetOneShelfData;
|
|
20
|
+
/** 产品卡片点击事件 */
|
|
21
|
+
onProductClick?: (product: ProductCardData) => void;
|
|
22
|
+
/** 产品图片点击事件 */
|
|
23
|
+
onProductImageClick?: (product: ProductCardData) => void;
|
|
24
|
+
/** Learn More按钮点击事件 */
|
|
25
|
+
onLearnMore?: (product: ProductCardData) => void;
|
|
26
|
+
/** Shop Now按钮点击事件 */
|
|
27
|
+
onShopNow?: (product: ProductCardData) => void;
|
|
28
|
+
/** 赠品点击事件 */
|
|
29
|
+
onGiftClick?: (gift: FreeGift, product: ProductCardData) => void;
|
|
30
|
+
/** 赠品选择变化事件 */
|
|
31
|
+
onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void;
|
|
32
|
+
classNames?: Partial<Record<BuyOneGetOneShelfSemanticName, string>>;
|
|
33
|
+
}
|
|
34
|
+
/**
|
|
35
|
+
* BuyOneGetOneShelf - 买赠货架
|
|
36
|
+
*
|
|
37
|
+
* @description 这是一个买主商品赠送赠品的活动组件,展示产品卡片,支持一排一个或一排两个的布局
|
|
38
|
+
*/
|
|
39
|
+
declare const BuyOneGetOneShelf: React.ForwardRefExoticComponent<BuyOneGetOneShelfProps & React.RefAttributes<HTMLDivElement>>;
|
|
40
|
+
export default BuyOneGetOneShelf;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var S=Object.create;var n=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var N=(t,e)=>{for(var o in e)n(t,o,{get:e[o],enumerable:!0})},l=(t,e,o,d)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of v(e))!B.call(t,r)&&r!==o&&n(t,r,{get:()=>e[r],enumerable:!(d=D(e,r))||d.enumerable});return t};var p=(t,e,o)=>(o=t!=null?S(x(t)):{},l(e||!t||!t.__esModule?n(o,"default",{value:t,enumerable:!0}):o,t)),k=t=>l(n({},"__esModule",{value:!0}),t);var L={};N(L,{default:()=>b});module.exports=k(L);var a=require("react/jsx-runtime"),w=p(require("react")),i=require("../../helpers/index.js"),f=p(require("./ProductCard.js"));const u=w.forwardRef(({className:t,classNames:e={},data:o,onProductClick:d,onProductImageClick:r,onLearnMore:s,onShopNow:C,onGiftClick:m,onGiftSelectionChange:y,...G},P)=>{const{products:O=[],layout:c="single"}=o;return(0,a.jsxs)("div",{ref:P,className:(0,i.cn)("w-full px-32 py-0",t,e?.root),...G,children:[o.title&&(0,a.jsx)("h2",{className:(0,i.cn)("mb-4 text-2xl font-bold",e?.title),children:o.title}),o.description&&(0,a.jsx)("p",{className:(0,i.cn)("mb-6 text-gray-600",e?.description),children:o.description}),(0,a.jsx)("div",{className:(0,i.cn)("flex flex-wrap",c==="single"?"flex-col gap-6":"flex-row gap-6"),children:O.map((g,h)=>(0,a.jsx)(f.default,{data:g,layout:c,onProductClick:d,onProductImageClick:r,onLearnMore:s,onShopNow:C,onGiftClick:m,onGiftSelectionChange:y},h))})]})});u.displayName="BuyOneGetOneShelf";var b=u;
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductCard, { type ProductCardData, type FreeGift } from './ProductCard.js'\n\nexport type BuyOneGetOneShelfSemanticName =\n | 'root'\n | 'title'\n | 'description'\n | 'content'\n | 'productCard'\n | 'productCardImage'\n | 'productCardTitle'\n | 'productCardDescription'\n | 'productCardPrice'\n | 'productCardGiftsContainer'\n | 'productCardBtnGroup'\n\n/**\n * BuyOneGetOneShelf \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface BuyOneGetOneShelfData {\n /** \u7EC4\u4EF6\u6807\u9898 */\n title?: string\n /** \u7EC4\u4EF6\u63CF\u8FF0 */\n description?: string\n /** \u4EA7\u54C1\u5217\u8868 */\n products?: ProductCardData[]\n /** \u5E03\u5C40\u6A21\u5F0F\uFF1A\u4E00\u6392\u4E00\u4E2A\u6216\u4E00\u6392\u4E24\u4E2A */\n layout?: 'single' | 'double'\n}\n\nexport interface BuyOneGetOneShelfProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: BuyOneGetOneShelfData\n /** \u4EA7\u54C1\u5361\u7247\u70B9\u51FB\u4E8B\u4EF6 */\n onProductClick?: (product: ProductCardData) => void\n /** \u4EA7\u54C1\u56FE\u7247\u70B9\u51FB\u4E8B\u4EF6 */\n onProductImageClick?: (product: ProductCardData) => void\n /** Learn More\u6309\u94AE\u70B9\u51FB\u4E8B\u4EF6 */\n onLearnMore?: (product: ProductCardData) => void\n /** Shop Now\u6309\u94AE\u70B9\u51FB\u4E8B\u4EF6 */\n onShopNow?: (product: ProductCardData) => void\n /** \u8D60\u54C1\u70B9\u51FB\u4E8B\u4EF6 */\n onGiftClick?: (gift: FreeGift, product: ProductCardData) => void\n /** \u8D60\u54C1\u9009\u62E9\u53D8\u5316\u4E8B\u4EF6 */\n onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void\n classNames?: Partial<Record<BuyOneGetOneShelfSemanticName, string>>\n}\n\n/**\n * BuyOneGetOneShelf - \u4E70\u8D60\u8D27\u67B6\n *\n * @description \u8FD9\u662F\u4E00\u4E2A\u4E70\u4E3B\u5546\u54C1\u8D60\u9001\u8D60\u54C1\u7684\u6D3B\u52A8\u7EC4\u4EF6\uFF0C\u5C55\u793A\u4EA7\u54C1\u5361\u7247\uFF0C\u652F\u6301\u4E00\u6392\u4E00\u4E2A\u6216\u4E00\u6392\u4E24\u4E2A\u7684\u5E03\u5C40\n */\nconst BuyOneGetOneShelf = React.forwardRef<HTMLDivElement, BuyOneGetOneShelfProps>(\n (\n {\n className,\n classNames = {},\n data,\n onProductClick,\n onProductImageClick,\n onLearnMore,\n onShopNow,\n onGiftClick,\n onGiftSelectionChange,\n ...props\n },\n ref\n ) => {\n const { products = [], layout = 'single' } = data\n\n return (\n <div ref={ref} className={cn('w-full px-32 py-0', className, classNames?.root)} {...props}>\n {data.title && <h2 className={cn('mb-4 text-2xl font-bold', classNames?.title)}>{data.title}</h2>}\n {data.description && <p className={cn('mb-6 text-gray-600', classNames?.description)}>{data.description}</p>}\n\n {/* \u4E70\u8D60\u8D27\u67B6\u4EA7\u54C1\u533A\u57DF */}\n <div className={cn('flex flex-wrap', layout === 'single' ? 'flex-col gap-6' : 'flex-row gap-6')}>\n {products.map((product, index) => (\n <ProductCard\n key={index}\n data={product}\n layout={layout}\n onProductClick={onProductClick}\n onProductImageClick={onProductImageClick}\n onLearnMore={onLearnMore}\n onShopNow={onShopNow}\n onGiftClick={onGiftClick}\n onGiftSelectionChange={onGiftSelectionChange}\n />\n ))}\n </div>\n </div>\n )\n }\n)\n\nBuyOneGetOneShelf.displayName = 'BuyOneGetOneShelf'\nexport default BuyOneGetOneShelf\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA2EM,IAAAI,EAAA,6BAzENC,EAAuB,oBACvBC,EAAmB,kCACnBC,EAAiE,+BAoDjE,MAAMC,EAAoBH,EAAM,WAC9B,CACE,CACE,UAAAI,EACA,WAAAC,EAAa,CAAC,EACd,KAAAC,EACA,eAAAC,EACA,oBAAAC,EACA,YAAAC,EACA,UAAAC,EACA,YAAAC,EACA,sBAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,KAAM,CAAE,SAAAC,EAAW,CAAC,EAAG,OAAAC,EAAS,QAAS,EAAIV,EAE7C,SACE,QAAC,OAAI,IAAKQ,EAAK,aAAW,MAAG,oBAAqBV,EAAWC,GAAY,IAAI,EAAI,GAAGQ,EACjF,UAAAP,EAAK,UAAS,OAAC,MAAG,aAAW,MAAG,0BAA2BD,GAAY,KAAK,EAAI,SAAAC,EAAK,MAAM,EAC3FA,EAAK,gBAAe,OAAC,KAAE,aAAW,MAAG,qBAAsBD,GAAY,WAAW,EAAI,SAAAC,EAAK,YAAY,KAGxG,OAAC,OAAI,aAAW,MAAG,iBAAkBU,IAAW,SAAW,iBAAmB,gBAAgB,EAC3F,SAAAD,EAAS,IAAI,CAACE,EAASC,OACtB,OAAC,EAAAC,QAAA,CAEC,KAAMF,EACN,OAAQD,EACR,eAAgBT,EAChB,oBAAqBC,EACrB,YAAaC,EACb,UAAWC,EACX,YAAaC,EACb,sBAAuBC,GARlBM,CASP,CACD,EACH,GACF,CAEJ,CACF,EAEAf,EAAkB,YAAc,oBAChC,IAAON,EAAQM",
|
|
6
|
+
"names": ["BuyOneGetOneShelf_exports", "__export", "BuyOneGetOneShelf_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_ProductCard", "BuyOneGetOneShelf", "className", "classNames", "data", "onProductClick", "onProductImageClick", "onLearnMore", "onShopNow", "onGiftClick", "onGiftSelectionChange", "props", "ref", "products", "layout", "product", "index", "ProductCard"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var E=Object.create;var d=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var S=Object.getOwnPropertyNames;var T=Object.getPrototypeOf,M=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var o in t)d(e,o,{get:t[o],enumerable:!0})},C=(e,t,o,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of S(t))!M.call(e,n)&&n!==o&&d(e,n,{get:()=>t[n],enumerable:!(r=L(t,n))||r.enumerable});return e};var u=(e,t,o)=>(o=e!=null?E(T(e)):{},C(t||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e)),H=e=>C(d({},"__esModule",{value:!0}),e);var F={};D(F,{default:()=>R});module.exports=H(F);var a=require("react/jsx-runtime"),l=u(require("react")),s=require("../../helpers/utils.js"),h=u(require("../../components/picture.js")),I=require("../../shared/Styles.js"),N=u(require("../Title/index.js")),x=u(require("./SwiperCategory.js")),f=require("../../hooks/useExposure.js"),y=require("../../shared/trackUrlRef.js"),_=require("../../components/heading.js");const m="image",p="category_banner",g=5,P=3,j=(e,t)=>{const o=[];for(let r=0;r<e.length;r+=t)o.push(e.slice(r,r+t));return o},A=({data:e,configuration:t})=>{const o=(0,l.useRef)(null);return(0,f.useExposure)(o,{componentType:m,componentName:p,componentTitle:e?.name,position:t?.index+1}),(0,a.jsxs)("div",{ref:o,className:(0,s.cn)("tablet:h-[120px] laptop:h-[144px] desktop:h-[192px] lg-desktop:h-[240px]","tablet:p-3 laptop:p-4 desktop:p-6 lg-desktop:p-8","bg-container-secondary-1 hover:bg-info-white group box-border flex size-full cursor-pointer flex-col overflow-hidden duration-300",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[(0,a.jsx)("div",{className:"transition-all duration-300 group-hover:scale-110",children:(0,a.jsx)("a",{"aria-label":e?.name,href:(0,y.trackUrlRef)(e?.link,`${m}_${p}`),"data-headless-type-name":`${m}#${p}`,"data-headless-title-desc-button":`${e?.name}`,onClick:()=>t?.event?.primaryButton(e,t?.index),children:(0,a.jsx)(h.default,{alt:e?.image?.alt||"",source:e?.image?.url||"",className:"laptop:size-[88px] tablet:size-[72px] desktop:size-[116px] lg-desktop:size-[146px] m-auto flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover"})})}),(0,a.jsx)(_.Heading,{as:"h3",className:"lg-desktop:text-[18px] text-info-primary box-border line-clamp-2 flex-1 text-center text-[14px] font-bold",children:e?.name})]})},B=({data:e,configuration:t,index:o,isFirstItemLarger:r})=>{const n=(0,l.useRef)(null);(0,f.useExposure)(n,{componentType:m,componentName:p,componentTitle:e?.name,position:t?.index+1});const i=o===0;return(0,a.jsxs)("div",{ref:n,className:(0,s.cn)("bg-container-secondary-1 box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden","hover:bg-info-white cursor-pointer duration-300",r?(0,s.cn)("p-4",i?"aspect-h-[252] row-span-2":"aspect-h-[120]"):"max-h-[126px] px-3 py-4",t?.shape==="round"?"rounded-2xl":"rounded-none"),children:[(0,a.jsx)("a",{href:(0,y.trackUrlRef)(e?.link,`${m}_${p}`),"data-headless-type-name":`${m}#${p}`,"data-headless-title-desc-button":`${e?.name}`,"data-headless-nav-postion":`''#${t?.index+1}`,onClick:()=>t?.event?.primaryButton(e,t?.index+1),children:(0,a.jsx)(h.default,{source:e?.image?.url||"",alt:e?.image?.alt||"",className:(0,s.cn)("m-auto mb-2 flex justify-center object-cover [&_img]:h-full [&_img]:w-auto [&_img]:object-cover",r?(0,s.cn)(i?"max-h-[146px] overflow-hidden":"max-h-[72px] max-w-[72px]"):"size-[72px]")})}),(0,a.jsx)("p",{className:(0,s.cn)("text-info-primary text-center text-sm font-bold",r?"line-clamp-2":"shrink-0 truncate"),children:e?.name})]})},z=({data:e,configuration:t})=>{const r=(t?.totalCategories??0)<=g;return(0,a.jsx)("div",{className:`gap-3 ${r?"grid grid-cols-2":"flex h-full flex-col"}`,children:e?.map((n,i)=>(0,a.jsx)(B,{index:i,data:n,configuration:t,isFirstItemLarger:r},i))})},w=l.default.forwardRef((e,t)=>{const{data:o,className:r="",key:n,event:i}=e,c=(o?.isShowSelect?o?.products:o?.productData)||[],v=c.length>g,b=c.length,$=j(c,v?P:g),k=(0,l.useRef)(null);return(0,l.useImperativeHandle)(t,()=>k.current),(0,a.jsxs)("div",{ref:k,className:(0,s.cn)("w-full overflow-hidden",r,{"aiui-dark":o?.theme==="dark"}),children:[o?.title&&(0,a.jsx)(N.default,{data:{title:o?.title},className:"text-4xl"}),(0,a.jsx)("div",{className:"tablet:block hidden",children:(0,a.jsx)(x.default,{id:`Category${n}`,Slide:A,data:{list:c,configuration:{shape:o?.shape,event:i,title:o?.title,totalCategories:b}}})}),(0,a.jsx)("div",{className:"tablet:hidden block",children:(0,a.jsx)(x.default,{id:`Category1${n}`,Slide:z,data:{list:$,configuration:{shape:o?.shape,event:i,title:o?.title,totalCategories:b}},isHalf:v})}),(0,a.jsx)("div",{className:"h-7"})]})});w.displayName="Category";var R=(0,I.withLayout)(w);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|