@anker-in/headless-ui 1.0.10-temp-1 → 1.0.10-temp-dialogs
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/CreativeModule/index.d.ts +1 -1
- package/dist/cjs/biz-components/CreativeModule/index.js +1 -1
- package/dist/cjs/biz-components/CreativeModule/index.js.map +3 -3
- package/dist/cjs/biz-components/Graphic/index.d.ts +7 -0
- package/dist/cjs/biz-components/Graphic/index.js +1 -1
- package/dist/cjs/biz-components/Graphic/index.js.map +3 -3
- package/dist/cjs/biz-components/ShelfDisplay/index.js +2 -2
- package/dist/cjs/biz-components/ShelfDisplay/index.js.map +2 -2
- package/dist/cjs/biz-components/TextModal/index.d.ts +12 -0
- package/dist/cjs/biz-components/TextModal/index.js +2 -0
- package/dist/cjs/biz-components/TextModal/index.js.map +7 -0
- package/dist/cjs/biz-components/Title/index.js +1 -1
- package/dist/cjs/biz-components/Title/index.js.map +3 -3
- package/dist/cjs/biz-components/Title/types.d.ts +2 -3
- package/dist/cjs/biz-components/Title/types.js +1 -1
- package/dist/cjs/biz-components/Title/types.js.map +1 -1
- package/dist/cjs/biz-components/WhyChooses/WhyChoose.d.ts +14 -0
- package/dist/cjs/biz-components/WhyChooses/index.d.ts +2 -0
- package/dist/cjs/biz-components/WhyChooses/types.d.ts +11 -0
- package/dist/cjs/stories/creativeModule.stories.d.ts +0 -1
- package/dist/cjs/stories/graphic.stories.d.ts +7 -0
- package/dist/cjs/stories/graphic.stories.js +1 -1
- package/dist/cjs/stories/graphic.stories.js.map +2 -2
- package/dist/cjs/stories/whychoose.stories.js +1 -1
- package/dist/cjs/stories/whychoose.stories.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/biz-components/CreativeModule/index.d.ts +1 -1
- package/dist/esm/biz-components/CreativeModule/index.js +1 -1
- package/dist/esm/biz-components/CreativeModule/index.js.map +3 -3
- package/dist/esm/biz-components/Graphic/index.d.ts +7 -0
- package/dist/esm/biz-components/Graphic/index.js +1 -1
- package/dist/esm/biz-components/Graphic/index.js.map +3 -3
- package/dist/esm/biz-components/ShelfDisplay/index.js +2 -2
- package/dist/esm/biz-components/ShelfDisplay/index.js.map +2 -2
- package/dist/esm/biz-components/TextModal/index.d.ts +12 -0
- package/dist/esm/biz-components/TextModal/index.js +2 -0
- package/dist/esm/biz-components/TextModal/index.js.map +7 -0
- package/dist/esm/biz-components/Title/index.js +1 -1
- package/dist/esm/biz-components/Title/index.js.map +3 -3
- package/dist/esm/biz-components/Title/types.d.ts +2 -3
- package/dist/esm/biz-components/WhyChooses/WhyChoose.d.ts +14 -0
- package/dist/esm/biz-components/WhyChooses/index.d.ts +2 -0
- package/dist/esm/biz-components/WhyChooses/types.d.ts +11 -0
- package/dist/esm/stories/creativeModule.stories.d.ts +0 -1
- package/dist/esm/stories/graphic.stories.d.ts +7 -0
- package/dist/esm/stories/graphic.stories.js +1 -1
- package/dist/esm/stories/graphic.stories.js.map +2 -2
- package/dist/esm/stories/whychoose.stories.js +1 -1
- package/dist/esm/stories/whychoose.stories.js.map +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/dist/cjs/apps/playground/utils/classnames.d.ts +0 -1
- package/dist/cjs/biz-components/AccordionCards/useDebounce.d.ts +0 -6
- package/dist/cjs/biz-components/MediaPlayerMulti/YouTubePlayer.d.ts +0 -3
- package/dist/cjs/biz-components/SectionHeading/SectionHeading.d.ts +0 -4
- package/dist/cjs/biz-components/SectionHeading/types.d.ts +0 -6
- package/dist/cjs/biz-components/Shelf/Shelf.d.ts +0 -8
- package/dist/cjs/biz-components/Shelf/index.d.ts +0 -1
- package/dist/cjs/biz-components/Shelf/types.d.ts +0 -6
- package/dist/cjs/biz-components/ShelfDisplay/tab.d.ts +0 -7
- package/dist/cjs/components/col.d.ts +0 -29
- package/dist/cjs/components/dropdown.d.ts +0 -27
- package/dist/cjs/components/row.d.ts +0 -18
- package/dist/cjs/helpers/get-subtree.d.ts +0 -12
- package/dist/cjs/packages/ui/src/components/avatar.d.ts +0 -26
- package/dist/cjs/packages/ui/src/components/index.d.ts +0 -20
- package/dist/cjs/packages/ui/src/index.d.ts +0 -1
- package/dist/cjs/packages/ui/src/stories/avatar.stories.d.ts +0 -40
- package/dist/cjs/packages/ui/src/stories/badge.stories.d.ts +0 -26
- package/dist/cjs/packages/ui/src/stories/button.stories.d.ts +0 -48
- package/dist/cjs/packages/ui/src/stories/checkbox.stories.d.ts +0 -46
- package/dist/cjs/packages/ui/src/stories/container.stories.d.ts +0 -36
- package/dist/cjs/packages/ui/src/stories/dialog.stories.d.ts +0 -20
- package/dist/cjs/packages/ui/src/stories/grid.stories.d.ts +0 -42
- package/dist/cjs/packages/ui/src/stories/heading.stories.d.ts +0 -82
- package/dist/cjs/packages/ui/src/stories/input.stories.d.ts +0 -35
- package/dist/cjs/packages/ui/src/stories/picture.stories.d.ts +0 -18
- package/dist/cjs/packages/ui/src/stories/popover.stories.d.ts +0 -17
- package/dist/cjs/packages/ui/src/stories/radio.stories.d.ts +0 -39
- package/dist/cjs/packages/ui/src/stories/skeleton.stories.d.ts +0 -20
- package/dist/cjs/packages/ui/src/stories/text.stories.d.ts +0 -94
- package/dist/cjs/src/components/index.d.ts +0 -21
- package/dist/cjs/src/components/input-number.d.ts +0 -47
- package/dist/cjs/src/index.d.ts +0 -1
- package/dist/cjs/src/stories/avatar.stories.d.ts +0 -40
- package/dist/cjs/src/stories/badge.stories.d.ts +0 -26
- package/dist/cjs/src/stories/button.stories.d.ts +0 -48
- package/dist/cjs/src/stories/checkbox.stories.d.ts +0 -46
- package/dist/cjs/src/stories/container.stories.d.ts +0 -36
- package/dist/cjs/src/stories/dialog.stories.d.ts +0 -20
- package/dist/cjs/src/stories/grid.stories.d.ts +0 -42
- package/dist/cjs/src/stories/heading.stories.d.ts +0 -82
- package/dist/cjs/src/stories/input-number.stories.d.ts +0 -51
- package/dist/cjs/src/stories/input.stories.d.ts +0 -35
- package/dist/cjs/src/stories/picture.stories.d.ts +0 -18
- package/dist/cjs/src/stories/popover.stories.d.ts +0 -17
- package/dist/cjs/src/stories/radio.stories.d.ts +0 -39
- package/dist/cjs/src/stories/skeleton.stories.d.ts +0 -20
- package/dist/cjs/src/stories/text.stories.d.ts +0 -94
- package/dist/cjs/stories/shelf.stories.d.ts +0 -17
- package/dist/cjs/tailwind.config.d.ts +0 -253
- package/dist/esm/apps/playground/utils/classnames.d.ts +0 -1
- package/dist/esm/biz-components/AccordionCards/useDebounce.d.ts +0 -6
- package/dist/esm/biz-components/MediaPlayerMulti/YouTubePlayer.d.ts +0 -3
- package/dist/esm/biz-components/SectionHeading/SectionHeading.d.ts +0 -4
- package/dist/esm/biz-components/SectionHeading/types.d.ts +0 -6
- package/dist/esm/biz-components/Shelf/Shelf.d.ts +0 -8
- package/dist/esm/biz-components/Shelf/index.d.ts +0 -1
- package/dist/esm/biz-components/Shelf/types.d.ts +0 -6
- package/dist/esm/biz-components/ShelfDisplay/tab.d.ts +0 -7
- package/dist/esm/components/col.d.ts +0 -29
- package/dist/esm/components/dropdown.d.ts +0 -27
- package/dist/esm/components/row.d.ts +0 -18
- package/dist/esm/helpers/get-subtree.d.ts +0 -12
- package/dist/esm/packages/ui/src/components/avatar.d.ts +0 -26
- package/dist/esm/packages/ui/src/components/index.d.ts +0 -20
- package/dist/esm/packages/ui/src/index.d.ts +0 -1
- package/dist/esm/packages/ui/src/stories/avatar.stories.d.ts +0 -40
- package/dist/esm/packages/ui/src/stories/badge.stories.d.ts +0 -26
- package/dist/esm/packages/ui/src/stories/button.stories.d.ts +0 -48
- package/dist/esm/packages/ui/src/stories/checkbox.stories.d.ts +0 -46
- package/dist/esm/packages/ui/src/stories/container.stories.d.ts +0 -36
- package/dist/esm/packages/ui/src/stories/dialog.stories.d.ts +0 -20
- package/dist/esm/packages/ui/src/stories/grid.stories.d.ts +0 -42
- package/dist/esm/packages/ui/src/stories/heading.stories.d.ts +0 -82
- package/dist/esm/packages/ui/src/stories/input.stories.d.ts +0 -35
- package/dist/esm/packages/ui/src/stories/picture.stories.d.ts +0 -18
- package/dist/esm/packages/ui/src/stories/popover.stories.d.ts +0 -17
- package/dist/esm/packages/ui/src/stories/radio.stories.d.ts +0 -39
- package/dist/esm/packages/ui/src/stories/skeleton.stories.d.ts +0 -20
- package/dist/esm/packages/ui/src/stories/text.stories.d.ts +0 -94
- package/dist/esm/src/components/index.d.ts +0 -21
- package/dist/esm/src/components/input-number.d.ts +0 -47
- package/dist/esm/src/index.d.ts +0 -1
- package/dist/esm/src/stories/avatar.stories.d.ts +0 -40
- package/dist/esm/src/stories/badge.stories.d.ts +0 -26
- package/dist/esm/src/stories/button.stories.d.ts +0 -48
- package/dist/esm/src/stories/checkbox.stories.d.ts +0 -46
- package/dist/esm/src/stories/container.stories.d.ts +0 -36
- package/dist/esm/src/stories/dialog.stories.d.ts +0 -20
- package/dist/esm/src/stories/grid.stories.d.ts +0 -42
- package/dist/esm/src/stories/heading.stories.d.ts +0 -82
- package/dist/esm/src/stories/input-number.stories.d.ts +0 -51
- package/dist/esm/src/stories/input.stories.d.ts +0 -35
- package/dist/esm/src/stories/picture.stories.d.ts +0 -18
- package/dist/esm/src/stories/popover.stories.d.ts +0 -17
- package/dist/esm/src/stories/radio.stories.d.ts +0 -39
- package/dist/esm/src/stories/skeleton.stories.d.ts +0 -20
- package/dist/esm/src/stories/text.stories.d.ts +0 -94
- package/dist/esm/stories/shelf.stories.d.ts +0 -17
- package/dist/esm/tailwind.config.d.ts +0 -253
- /package/dist/cjs/biz-components/{SectionHeading/index.d.ts → Faq/type.d.ts} +0 -0
- /package/dist/cjs/{components/inputnumber.d.ts → biz-components/WhyChoose/type.d.ts} +0 -0
- /package/dist/cjs/hooks/{useEXposure.d.ts → useExposure.d.ts} +0 -0
- /package/dist/cjs/stories/{whychoose.stories.d.ts → WhyChoose.stories.d.ts} +0 -0
- /package/dist/esm/biz-components/{SectionHeading/index.d.ts → Faq/type.d.ts} +0 -0
- /package/dist/esm/{components/inputnumber.d.ts → biz-components/WhyChoose/type.d.ts} +0 -0
- /package/dist/esm/hooks/{useEXposure.d.ts → useExposure.d.ts} +0 -0
- /package/dist/esm/stories/{whychoose.stories.d.ts → WhyChoose.stories.d.ts} +0 -0
|
@@ -5,11 +5,11 @@ export type CreativeModuleDataType = {
|
|
|
5
5
|
title: string;
|
|
6
6
|
description: string;
|
|
7
7
|
theme: 'light' | 'dark';
|
|
8
|
+
shape: 'rounded' | 'square';
|
|
8
9
|
span: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
|
|
9
10
|
};
|
|
10
11
|
type CreativeModuleType = {
|
|
11
12
|
data: {
|
|
12
|
-
shape?: 'rounded' | 'square';
|
|
13
13
|
products: CreativeModuleDataType[];
|
|
14
14
|
};
|
|
15
15
|
className?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{Fragment as h,jsx as
|
|
1
|
+
"use client";import{Fragment as h,jsx as t,jsxs as o}from"react/jsx-runtime";import{cn as s}from"../../helpers/utils.js";import n from"../SwiperBox/index.js";import{withLayout as c}from"../../shared/Styles.js";import{Grid as u,GridItem as f}from"../../components/gird.js";import{Picture as d,Text as a}from"../../components/index.js";const v=({data:e})=>t("div",{className:s("text-info-primary aspect-h-[360] aspect-w-[296] relative shrink-0 overflow-hidden md:basis-[296px]",e.shape==="rounded"?"rounded-2xl":"rounded-none",{"aiui-dark":e.theme==="dark"}),children:o("div",{className:"absolute inset-0",children:[t(d,{className:"h-full",imgClassName:"h-full object-cover",source:e?.mobileImg?.url||e?.img?.url,alt:e?.mobileImg?.alt||e?.img?.alt||""}),o("div",{className:"z-1 absolute bottom-4 left-4 box-border flex w-full flex-col",children:[t(a,{html:e?.title,className:"graphic-title truncate font-bold leading-[1.2]"}),e?.description&&t(a,{html:e?.description,className:"graphic-title line-clamp-2 text-sm font-bold leading-[1.2]"})]})]})}),g=e=>{const{data:p,className:i}=e,{products:r}=p;return o(h,{children:[t("div",{className:"laptop:block box-border hidden w-full overflow-hidden",children:t(u,{className:s("tablet:gap-4 grid grid-cols-12 gap-3 ",i),children:r?.map((l,m)=>o(f,{span:l.span,className:s("text-info-primary relative w-full overflow-hidden",l.shape==="rounded"?"rounded-2xl":"rounded-none","lg-desktop:max-h-[480px] desktop:max-h-[384px] laptop:max-h-[288px]",{"aiui-dark":l.theme==="dark"}),children:[t(d,{source:l.img.url,className:"size-full",imgClassName:"h-full object-cover"}),o("div",{className:"lg-desktop:bottom-8 lg-desktop:left-8 desktop:bottom-6 desktop:left-6 absolute bottom-4 left-4",children:[l.title&&t(a,{html:l.title,as:"p",className:"desktop:text-[32px] laptop:text-2xl text-xl font-bold"}),l.description&&t(a,{html:l.description,className:"desktop:text-lg text-sm font-bold"})]})]},m))})}),t("div",{className:"laptop:hidden block w-full overflow-hidden",children:t(n,{id:"CreativeModule",className:s("!overflow-visible",i),data:{list:r||[]},Slide:v,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3}}})})]})};var y=c(g);export{y as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/CreativeModule/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport { cn } from '../../helpers/utils.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport type { Img } from '../../types/props.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport { Picture, Text } from '../../components/index.js'\n\nexport type CreativeModuleDataType = {\n img: Img\n mobileImg: Img\n title: string\n description: string\n theme: 'light' | 'dark'\n span: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12\n}\n\ntype CreativeModuleType = {\n data: {\n
|
|
5
|
-
"mappings": "aAqCQ,OAsBJ,YAAAA,EAtBI,OAAAC,EAMA,QAAAC,MANA,oBApCR,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAe,wBAEtB,OAAS,cAAAC,MAAkB,yBAC3B,OAAS,QAAAC,EAAM,YAAAC,MAAgB,2BAC/B,OAAS,WAAAC,EAAS,QAAAC,MAAY,4BAmB9B,MAAMC,EAAO,CAAC,CAAE,KAAAC,
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "cn", "SwiperBox", "withLayout", "Grid", "GridItem", "Picture", "Text", "Item", "data", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport { cn } from '../../helpers/utils.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport type { Img } from '../../types/props.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport { Picture, Text } from '../../components/index.js'\n\nexport type CreativeModuleDataType = {\n img: Img\n mobileImg: Img\n title: string\n description: string\n theme: 'light' | 'dark'\n shape: 'rounded' | 'square'\n span: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12\n}\n\ntype CreativeModuleType = {\n data: {\n products: CreativeModuleDataType[]\n }\n className?: string\n}\n\nconst Item = ({ data }: { data: CreativeModuleDataType }) => {\n return (\n <div\n className={cn(\n 'text-info-primary aspect-h-[360] aspect-w-[296] relative shrink-0 overflow-hidden md:basis-[296px]',\n data.shape === 'rounded' ? 'rounded-2xl' : 'rounded-none',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n <div className=\"absolute inset-0\">\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover\"\n source={data?.mobileImg?.url || data?.img?.url}\n alt={data?.mobileImg?.alt || data?.img?.alt || ''}\n />\n <div className=\"z-1 absolute bottom-4 left-4 box-border flex w-full flex-col\">\n <Text html={data?.title} className=\"graphic-title truncate font-bold leading-[1.2]\" />\n {data?.description && (\n <Text html={data?.description} className=\"graphic-title line-clamp-2 text-sm font-bold leading-[1.2]\" />\n )}\n </div>\n </div>\n </div>\n )\n}\n\nconst CreativeModule = (props: CreativeModuleType) => {\n const { data, className } = props\n const { products } = data\n\n return (\n <>\n <div className=\"laptop:block box-border hidden w-full overflow-hidden\">\n <Grid className={cn('tablet:gap-4 grid grid-cols-12 gap-3 ', className)}>\n {products?.map((item, index) => {\n return (\n <GridItem\n key={index}\n span={item.span}\n className={cn(\n 'text-info-primary relative w-full overflow-hidden',\n item.shape === 'rounded' ? 'rounded-2xl' : 'rounded-none',\n 'lg-desktop:max-h-[480px] desktop:max-h-[384px] laptop:max-h-[288px]',\n {\n 'aiui-dark': item.theme === 'dark',\n }\n )}\n >\n <Picture source={item.img.url} className=\"size-full\" imgClassName=\"h-full object-cover\" />\n <div className=\"lg-desktop:bottom-8 lg-desktop:left-8 desktop:bottom-6 desktop:left-6 absolute bottom-4 left-4\">\n {item.title && (\n <Text html={item.title} as=\"p\" className=\"desktop:text-[32px] laptop:text-2xl text-xl font-bold\" />\n )}\n {item.description && <Text html={item.description} className=\"desktop:text-lg text-sm font-bold\" />}\n </div>\n </GridItem>\n )\n })}\n </Grid>\n </div>\n <div className=\"laptop:hidden block w-full overflow-hidden\">\n <SwiperBox\n id=\"CreativeModule\"\n className={cn('!overflow-visible', className)}\n data={{\n list: products || [],\n }}\n Slide={Item}\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 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 3,\n },\n }}\n />\n </div>\n </>\n )\n}\n\nexport default withLayout(CreativeModule)\n"],
|
|
5
|
+
"mappings": "aAqCQ,OAsBJ,YAAAA,EAtBI,OAAAC,E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AAA,CAAK,KAAMO,EAAK,MAAO,GAAG,IAAI,UAAU,wDAAwD,EAElGA,EAAK,aAAef,EAACQ,EAAA,CAAK,KAAMO,EAAK,YAAa,UAAU,oCAAoC,GACnG,IAjBKC,CAkBP,CAEH,EACH,EACF,EACAhB,EAAC,OAAI,UAAU,6CACb,SAAAA,EAACG,EAAA,CACC,GAAG,iBACH,UAAWD,EAAG,oBAAqBW,CAAS,EAC5C,KAAM,CACJ,KAAMC,GAAY,CAAC,CACrB,EACA,MAAOL,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,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAe,CACjB,CACF,EACF,EACF,GACF,CAEJ,EAEA,IAAOQ,EAAQb,EAAWO,CAAc",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "cn", "SwiperBox", "withLayout", "Grid", "GridItem", "Picture", "Text", "Item", "data", "CreativeModule", "props", "className", "products", "item", "index", "CreativeModule_default"]
|
|
7
7
|
}
|
|
@@ -14,6 +14,13 @@ type GraphicType = {
|
|
|
14
14
|
buttonText?: string;
|
|
15
15
|
icon?: Img;
|
|
16
16
|
theme?: Theme;
|
|
17
|
+
extension?: {
|
|
18
|
+
text: string;
|
|
19
|
+
textDesc: string;
|
|
20
|
+
textTitle: string;
|
|
21
|
+
textPcImg: Img;
|
|
22
|
+
textMobileImg: Img;
|
|
23
|
+
};
|
|
17
24
|
};
|
|
18
25
|
export interface GraphicProps extends ComponentCommonProps {
|
|
19
26
|
className?: string;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as r}from"react/jsx-runtime";import{useMediaQuery as V}from"react-responsive";import
|
|
1
|
+
"use client";import{jsx as t,jsxs as r}from"react/jsx-runtime";import{useMediaQuery as V}from"react-responsive";import P,{useEffect as G,useImperativeHandle as S,useRef as E,useState as c}from"react";import{cn as h}from"../../helpers/utils.js";import{withLayout as B}from"../../shared/Styles.js";import D from"../SwiperBox/index.js";import{Button as H,Heading as L}from"../../components/index.js";import{Picture as v,Text as U}from"../../components/index.js";import z from"../Title/index.js";import{VideoModal as j}from"../VideoModal/index.js";import{TextModal as R}from"../TextModal/index.js";import{useExposure as $}from"../../hooks/useExposure.js";import{trackUrlRef as y}from"../../shared/trackUrlRef.js";const f="image",b="graphic",q=({data:e,configuration:l})=>{const u=()=>{switch(l.num){case 1:return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case 2:return"tablet:aspect-w-[346] tablet:aspect-h-[360] laptop:aspect-w-[440] laptop:aspect-h-[360] desktop:aspect-w-[648] desktop:aspect-h-[384] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[427] desktop:aspect-h-[384] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[480]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[316] desktop:aspect-h-[384] lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480]"}};function g(s){throw new Error("Function not implemented.")}function n(s){throw new Error("Function not implemented.")}return t("div",{className:h(u(),"laptop:h-auto text-info-primary md-tablet:h-[360px] flex-1 shrink-0 md:basis-[296px]",{"aiui-dark":e.theme==="dark"}),children:t("div",{className:h("absolute inset-0",{"rounded-xl overflow-hidden laptop:rounded-2xl":l?.itemShape==="round"}),children:r("a",{"aria-label":e?.title??e?.description,href:y(e?.href,`${f}_${b}`),className:"relative block size-full cursor-pointer overflow-hidden",children:[t(v,{className:"h-full",imgClassName:"h-full object-cover tablet:hover:scale-110 transition-all duration-300",source:e?.imgUrl?.url,alt:e?.imgUrl?.alt||""}),r("div",{className:"laptop:p-6 absolute bottom-0 z-[1] box-border flex w-full flex-col p-4",children:[r("div",{className:h("flex items-end overflow-hidden","graphic-bottom"),children:[r("div",{className:"flex-1 overflow-hidden",children:[t(U,{html:e?.title,style:{color:e?.textColor},className:"graphic-title line-clamp-3 lg-desktop:text-lg desktop:text-base text-sm font-bold leading-[1.2]"}),e?.description&&t(L,{html:e?.description,style:{color:e?.textColor},as:"h3",className:"graphic-description lg-desktop:text-[32px] desktop:mt-2 desktop:text-[24px] text-lines-2 mt-1 line-clamp-3 flex-1 text-[24px] font-bold leading-[1.2]"})]}),!e?.isShowIcon&&(e?.video?.url||e?.youtubeId)&&t("button",{"aria-label":"Play Video",onClick:s=>{s.preventDefault(),s.stopPropagation(),l?.onVideoPlayBtnClick?.(l?.index||0,e)},className:"laptop:size-12 flex size-10 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75",children:t("svg",{width:"12",height:"14",viewBox:"0 0 12 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("path",{d:"M12 7L0 14L0 0L12 7Z",fill:"white"})})}),e?.isShowIcon&&e?.icon?.url&&t("button",{onClick:s=>{s.preventDefault(),s.stopPropagation(),l?.onIconClick?.(e,l)},className:"laptop:size-12 flex size-10 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75",children:t(v,{className:"h-full",imgClassName:"h-full object-cover",source:e?.icon?.url,alt:e?.icon?.alt||""})})]}),e.buttonText&&t(H,{as:"a","aria-label":e?.title??e?.description,variant:"secondary",className:"desktop:mt-[24px] mt-[12px] self-start",href:y(e?.href,`${f}_${b}`),children:e.buttonText})]})]})})})},k=P.forwardRef(({data:e,className:l},u)=>{const g=V({query:"(max-width: 768px)"}),n=E(null),[s,m]=c(!1),[x,T]=c(""),[I,M]=c(""),[N,C]=c(""),[p,w]=c(null),d=i=>{const o=e?.items?.length>3,a=e?.items?.length>2;switch(i){case 1440:return o?4:e?.items?.length;case 1024:return o?3:e?.items?.length;case 768:return o||a?2.3:2;default:return 1.2}};return S(u,()=>n.current),$(n,{componentType:f,componentName:b,componentTitle:e?.title}),G(()=>{const i=n.current?.querySelectorAll(".graphic-description");if(i&&i.length>0){let o=0;i.forEach(a=>{o=Math.max(o,a.offsetHeight)}),i.forEach(a=>{a.style.height=`${o}px`})}},[]),r("div",{className:l,ref:n,children:[r("div",{className:"graphic-box",children:[e?.title&&t(z,{data:{title:e?.title}}),t(D,{id:"Graphic",className:h("!overflow-visible"),data:{list:e?.items||[],configuration:{itemShape:e.itemShape,num:e?.items?.length||0,onVideoPlayBtnClick:(i,o)=>{m(!0),o?.isYouTube?M?.(o?.youtubeId||""):(T?.(o?.video?.url||""),C?.(o?.mobileVideo?.url||""))},onIconClick:i=>{m(!0),w(i)}}},Slide:q,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:d()},768:{spaceBetween:16,freeMode:!1,slidesPerView:d(768)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:d(1024)},1440:{spaceBetween:16,freeMode:!1,slidesPerView:d(1440)}}})]}),t(j,{visible:s,youTubeId:I,onCloseModal:()=>m(!1),videoUrl:g&&N||x}),t(R,{visible:s,textPcImg:p?.extension?.textPcImg||{url:""},textMobileImg:p?.extension?.textMobileImg||{url:""},textTitle:p?.extension?.textTitle||"",text:p?.extension?.text||"",textDesc:p?.extension?.textDesc||"",onCloseModal:()=>{m(!1),w(null)}})]})});k.displayName="Graphic";var te=B(k);export{te as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Graphic/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport { useMediaQuery } from 'react-responsive'\nimport React, { useEffect, useImperativeHandle, useRef, useState } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { Button, Heading } from '../../components/index.js'\nimport { Picture, Text } from '../../components/index.js'\nimport Title from '../Title/index.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport type { ComponentCommonProps, Video, Img, Theme } from '../../types/props.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\n\nconst componentType = 'image'\nconst componentName = 'graphic'\n\ntype GraphicType = {\n imgUrl: Img\n title: string\n description?: string\n textColor?: string\n href?: string\n video?: Video\n mobileVideo?: Video\n youtubeId?: string\n isYouTube?: boolean\n isShowIcon?: boolean\n buttonText?: string\n icon?: Img\n theme?: Theme\n}\nexport interface GraphicProps extends ComponentCommonProps {\n className?: string\n data: {\n title?: string\n items?: GraphicType[]\n itemShape?: 'round' | 'square'\n itemTheme?: Theme\n }\n}\n\nconst Item = ({ data, configuration }: { data: GraphicType; configuration?: any }) => {\n const handleAspect = () => {\n switch (configuration.num) {\n case 1:\n return 'tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]'\n case 2:\n return 'tablet:aspect-w-[346] tablet:aspect-h-[360] laptop:aspect-w-[440] laptop:aspect-h-[360] desktop:aspect-w-[648] desktop:aspect-h-[384] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480]'\n case 3:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[427] desktop:aspect-h-[384] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[480]'\n default:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[316] desktop:aspect-h-[384] lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480]'\n }\n }\n\n return (\n <div\n className={cn(\n handleAspect(),\n 'laptop:h-auto text-info-primary md-tablet:h-[360px] flex-1 shrink-0 md:basis-[296px]',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n <div\n className={cn('absolute inset-0', {\n ['rounded-xl overflow-hidden laptop:rounded-2xl']: configuration?.itemShape === 'round',\n })}\n >\n <a\n aria-label={data?.title ?? data?.description}\n href={trackUrlRef(data?.href, `${componentType}_${componentName}`)}\n className=\"relative block size-full cursor-pointer overflow-hidden\"\n >\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover tablet:hover:scale-110 transition-all duration-300\"\n source={data?.imgUrl?.url}\n alt={data?.imgUrl?.alt || ''}\n />\n <div className=\"laptop:p-6 absolute bottom-0 z-[1] box-border flex w-full flex-col p-4\">\n <div className={cn('flex items-end overflow-hidden', 'graphic-bottom')}>\n <div className=\"flex-1 overflow-hidden\">\n <Text\n html={data?.title}\n style={{ color: data?.textColor }}\n // eslint-disable-next-line tailwindcss/classnames-order\n className=\"graphic-title line-clamp-3 lg-desktop:text-lg desktop:text-base text-sm font-bold leading-[1.2]\"\n />\n {data?.description && (\n <Heading\n html={data?.description}\n style={{\n color: data?.textColor,\n }}\n as=\"h3\"\n className=\"graphic-description lg-desktop:text-[32px] desktop:mt-2 desktop:text-[24px] text-lines-2 mt-1 line-clamp-3 flex-1 text-[24px] font-bold leading-[1.2]\"\n />\n )}\n </div>\n {!data?.isShowIcon && (data?.video?.url || data?.youtubeId) && (\n <button\n aria-label=\"Play Video\"\n onClick={(e: any) => {\n e.preventDefault()\n e.stopPropagation()\n configuration?.onVideoPlayBtnClick?.(configuration?.index || 0, data)\n }}\n className=\"laptop:size-12 flex size-10 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75\"\n >\n <svg width=\"12\" height=\"14\" viewBox=\"0 0 12 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 7L0 14L0 0L12 7Z\" fill=\"white\" />\n </svg>\n </button>\n )}\n {data?.isShowIcon && data?.icon?.url && (\n <button\n onClick={(e: any) => {\n e.preventDefault()\n e.stopPropagation()\n configuration?.onIconClick?.(data, configuration)\n }}\n className=\"laptop:size-12 flex size-10 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75\"\n >\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover\"\n source={data?.icon?.url}\n alt={data?.icon?.alt || ''}\n />\n </button>\n )}\n </div>\n {data.buttonText && (\n <Button\n as=\"a\"\n aria-label={data?.title ?? data?.description}\n variant=\"secondary\"\n className=\"desktop:mt-[24px] mt-[12px] self-start\"\n href={trackUrlRef(data?.href, `${componentType}_${componentName}`)}\n >\n {data.buttonText}\n </Button>\n )}\n </div>\n </a>\n </div>\n </div>\n )\n}\n\nconst Graphic = React.forwardRef<HTMLDivElement, GraphicProps>(({ data, className }, ref) => {\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const innerRef = useRef<HTMLDivElement>(null)\n const [visible, setVisible] = useState<boolean>(false)\n const [videoUrl, setVideoUrl] = useState<string>('')\n const [youTubeId, setYouTubeId] = useState<string>('')\n const [mobileVideoUrl, setMobileVideoUrl] = useState<string>('')\n\n const handleSwiperShow = (width?: number) => {\n const isShow = (data?.items as GraphicType[])?.length > 3\n const isMobile = (data?.items as GraphicType[])?.length > 2\n switch (width) {\n case 1440:\n return isShow ? 4 : data?.items?.length\n case 1024:\n return isShow ? 3 : data?.items?.length\n case 768:\n return isShow ? 2.3 : isMobile ? 2.3 : 2\n default:\n return 1.2\n }\n }\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n useEffect(() => {\n const descriptions = innerRef.current?.querySelectorAll<HTMLDivElement>('.graphic-description')\n if (descriptions && descriptions.length > 0) {\n let maxHeight = 0\n descriptions.forEach((el: HTMLDivElement) => {\n maxHeight = Math.max(maxHeight, el.offsetHeight)\n })\n descriptions.forEach((el: HTMLDivElement) => {\n el.style.height = `${maxHeight}px`\n })\n }\n }, [])\n\n return (\n <div className={className} ref={innerRef}>\n <div className=\"graphic-box\">\n {data?.title && <Title data={{ title: data?.title }} />}\n <SwiperBox\n id=\"Graphic\"\n className={cn('!overflow-visible')}\n data={{\n list: data?.items || [],\n configuration: {\n itemShape: data.itemShape,\n num: data?.items?.length || 0,\n onVideoPlayBtnClick: (_: number, data: GraphicType) => {\n setVisible(true)\n if (data?.isYouTube) {\n setYouTubeId?.(data?.youtubeId || '')\n } else {\n setVideoUrl?.(data?.video?.url || '')\n setMobileVideoUrl?.(data?.mobileVideo?.url || '')\n }\n },\n onIconClick: (data: GraphicType) => {\n // configuration?.onIconClick?.(configuration?.index || 0, data)\n },\n },\n }}\n Slide={Item}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: handleSwiperShow(),\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(768),\n },\n 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(1024),\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(1440),\n },\n }}\n />\n </div>\n <VideoModal\n visible={visible}\n youTubeId={youTubeId}\n onCloseModal={() => setVisible(false)}\n videoUrl={isMobile ? mobileVideoUrl || videoUrl : videoUrl}\n />\n </div>\n )\n})\n\nGraphic.displayName = 'Graphic'\n\nexport default withLayout(Graphic)\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "useMediaQuery", "React", "useEffect", "useImperativeHandle", "useRef", "useState", "cn", "withLayout", "SwiperBox", "Button", "Heading", "Picture", "Text", "Title", "VideoModal", "useExposure", "trackUrlRef", "componentType", "componentName", "Item", "data", "configuration", "e", "Graphic", "className", "ref", "isMobile", "innerRef", "visible", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport { useMediaQuery } from 'react-responsive'\nimport React, { useEffect, useImperativeHandle, useRef, useState } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { Button, Heading } from '../../components/index.js'\nimport { Picture, Text } from '../../components/index.js'\nimport Title from '../Title/index.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport { TextModal } from '../TextModal/index.js'\nimport type { ComponentCommonProps, Video, Img, Theme } from '../../types/props.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Media } from '../../types/props.js'\n\nconst componentType = 'image'\nconst componentName = 'graphic'\n\ntype GraphicType = {\n imgUrl: Img\n title: string\n description?: string\n textColor?: string\n href?: string\n video?: Video\n mobileVideo?: Video\n youtubeId?: string\n isYouTube?: boolean\n isShowIcon?: boolean\n buttonText?: string\n icon?: Img\n theme?: Theme\n extension?: {\n text: string\n textDesc: string\n textTitle: string\n textPcImg: Img\n textMobileImg: Img\n }\n // textPcImg?: Img\n // textMobileImg?: Img\n // text?: string\n // textDesc?: string\n // textTitle?: string\n}\nexport interface GraphicProps extends ComponentCommonProps {\n className?: string\n data: {\n title?: string\n items?: GraphicType[]\n itemShape?: 'round' | 'square'\n itemTheme?: Theme\n }\n}\n\nconst Item = ({ data, configuration }: { data: GraphicType; configuration?: any }) => {\n const handleAspect = () => {\n switch (configuration.num) {\n case 1:\n return 'tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]'\n case 2:\n return 'tablet:aspect-w-[346] tablet:aspect-h-[360] laptop:aspect-w-[440] laptop:aspect-h-[360] desktop:aspect-w-[648] desktop:aspect-h-[384] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480]'\n case 3:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[427] desktop:aspect-h-[384] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[480]'\n default:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[316] desktop:aspect-h-[384] lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480]'\n }\n }\n\n function setVisible(arg0: boolean) {\n throw new Error('Function not implemented.')\n }\n\n function setCurrentItem(data: GraphicType) {\n throw new Error('Function not implemented.')\n }\n\n return (\n <div\n className={cn(\n handleAspect(),\n 'laptop:h-auto text-info-primary md-tablet:h-[360px] flex-1 shrink-0 md:basis-[296px]',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n <div\n className={cn('absolute inset-0', {\n ['rounded-xl overflow-hidden laptop:rounded-2xl']: configuration?.itemShape === 'round',\n })}\n >\n <a\n aria-label={data?.title ?? data?.description}\n href={trackUrlRef(data?.href, `${componentType}_${componentName}`)}\n className=\"relative block size-full cursor-pointer overflow-hidden\"\n >\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover tablet:hover:scale-110 transition-all duration-300\"\n source={data?.imgUrl?.url}\n alt={data?.imgUrl?.alt || ''}\n />\n <div className=\"laptop:p-6 absolute bottom-0 z-[1] box-border flex w-full flex-col p-4\">\n <div className={cn('flex items-end overflow-hidden', 'graphic-bottom')}>\n <div className=\"flex-1 overflow-hidden\">\n <Text\n html={data?.title}\n style={{ color: data?.textColor }}\n // eslint-disable-next-line tailwindcss/classnames-order\n className=\"graphic-title line-clamp-3 lg-desktop:text-lg desktop:text-base text-sm font-bold leading-[1.2]\"\n />\n {data?.description && (\n <Heading\n html={data?.description}\n style={{\n color: data?.textColor,\n }}\n as=\"h3\"\n className=\"graphic-description lg-desktop:text-[32px] desktop:mt-2 desktop:text-[24px] text-lines-2 mt-1 line-clamp-3 flex-1 text-[24px] font-bold leading-[1.2]\"\n />\n )}\n </div>\n {!data?.isShowIcon && (data?.video?.url || data?.youtubeId) && (\n <button\n aria-label=\"Play Video\"\n onClick={(e: any) => {\n e.preventDefault()\n e.stopPropagation()\n configuration?.onVideoPlayBtnClick?.(configuration?.index || 0, data)\n }}\n className=\"laptop:size-12 flex size-10 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75\"\n >\n <svg width=\"12\" height=\"14\" viewBox=\"0 0 12 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 7L0 14L0 0L12 7Z\" fill=\"white\" />\n </svg>\n </button>\n )}\n {data?.isShowIcon && data?.icon?.url && (\n <button\n onClick={(e: any) => {\n e.preventDefault()\n e.stopPropagation()\n configuration?.onIconClick?.(data, configuration)\n }}\n className=\"laptop:size-12 flex size-10 items-center justify-center rounded-full bg-white bg-opacity-20 hover:bg-black/75\"\n >\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover\"\n source={data?.icon?.url}\n alt={data?.icon?.alt || ''}\n />\n </button>\n )}\n </div>\n {data.buttonText && (\n <Button\n as=\"a\"\n aria-label={data?.title ?? data?.description}\n variant=\"secondary\"\n className=\"desktop:mt-[24px] mt-[12px] self-start\"\n href={trackUrlRef(data?.href, `${componentType}_${componentName}`)}\n >\n {data.buttonText}\n </Button>\n )}\n </div>\n </a>\n </div>\n </div>\n )\n}\n\nconst Graphic = React.forwardRef<HTMLDivElement, GraphicProps>(({ data, className }, ref) => {\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const innerRef = useRef<HTMLDivElement>(null)\n const [visible, setVisible] = useState<boolean>(false)\n const [videoUrl, setVideoUrl] = useState<string>('')\n const [youTubeId, setYouTubeId] = useState<string>('')\n const [mobileVideoUrl, setMobileVideoUrl] = useState<string>('')\n const [currentItem, setCurrentItem] = useState<GraphicType | null>(null)\n\n const handleSwiperShow = (width?: number) => {\n const isShow = (data?.items as GraphicType[])?.length > 3\n const isMobile = (data?.items as GraphicType[])?.length > 2\n switch (width) {\n case 1440:\n return isShow ? 4 : data?.items?.length\n case 1024:\n return isShow ? 3 : data?.items?.length\n case 768:\n return isShow ? 2.3 : isMobile ? 2.3 : 2\n default:\n return 1.2\n }\n }\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n useEffect(() => {\n const descriptions = innerRef.current?.querySelectorAll<HTMLDivElement>('.graphic-description')\n if (descriptions && descriptions.length > 0) {\n let maxHeight = 0\n descriptions.forEach((el: HTMLDivElement) => {\n maxHeight = Math.max(maxHeight, el.offsetHeight)\n })\n descriptions.forEach((el: HTMLDivElement) => {\n el.style.height = `${maxHeight}px`\n })\n }\n }, [])\n\n return (\n <div className={className} ref={innerRef}>\n <div className=\"graphic-box\">\n {data?.title && <Title data={{ title: data?.title }} />}\n <SwiperBox\n id=\"Graphic\"\n className={cn('!overflow-visible')}\n data={{\n list: data?.items || [],\n configuration: {\n itemShape: data.itemShape,\n num: data?.items?.length || 0,\n onVideoPlayBtnClick: (_: number, data: GraphicType) => {\n setVisible(true)\n if (data?.isYouTube) {\n setYouTubeId?.(data?.youtubeId || '')\n } else {\n setVideoUrl?.(data?.video?.url || '')\n setMobileVideoUrl?.(data?.mobileVideo?.url || '')\n }\n },\n onIconClick: (data: GraphicType) => {\n setVisible(true)\n setCurrentItem(data)\n },\n },\n }}\n Slide={Item}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: handleSwiperShow(),\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(768),\n },\n 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(1024),\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(1440),\n },\n }}\n />\n </div>\n <VideoModal\n visible={visible}\n youTubeId={youTubeId}\n onCloseModal={() => setVisible(false)}\n videoUrl={isMobile ? mobileVideoUrl || videoUrl : videoUrl}\n />\n <TextModal\n visible={visible}\n textPcImg={currentItem?.extension?.textPcImg || { url: '' }}\n textMobileImg={currentItem?.extension?.textMobileImg || { url: '' }}\n textTitle={currentItem?.extension?.textTitle || ''}\n text={currentItem?.extension?.text || ''}\n textDesc={currentItem?.extension?.textDesc || ''}\n onCloseModal={() => {\n setVisible(false)\n setCurrentItem(null)\n }}\n />\n </div>\n )\n})\n\nGraphic.displayName = 'Graphic'\n\nexport default withLayout(Graphic)\n"],
|
|
5
|
+
"mappings": "aAkGU,cAAAA,EAQI,QAAAC,MARJ,oBAjGV,OAAS,iBAAAC,MAAqB,mBAC9B,OAAOC,GAAS,aAAAC,EAAW,uBAAAC,EAAqB,UAAAC,EAAQ,YAAAC,MAAgB,QACxE,OAAS,MAAAC,MAAU,yBACnB,OAAS,cAAAC,MAAkB,yBAC3B,OAAOC,MAAe,wBACtB,OAAS,UAAAC,EAAQ,WAAAC,MAAe,4BAChC,OAAS,WAAAC,EAAS,QAAAC,MAAY,4BAC9B,OAAOC,MAAW,oBAClB,OAAS,cAAAC,MAAkB,yBAC3B,OAAS,aAAAC,MAAiB,wBAE1B,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,eAAAC,MAAmB,8BAG5B,MAAMC,EAAgB,QAChBC,EAAgB,UAuChBC,EAAO,CAAC,CAAE,KAAAC,EAAM,cAAAC,CAAc,IAAkD,CACpF,MAAMC,EAAe,IAAM,CACzB,OAAQD,EAAc,IAAK,CACzB,IAAK,GACH,MAAO,8LACT,IAAK,GACH,MAAO,4LACT,IAAK,GACH,MAAO,4LACT,QACE,MAAO,2LACX,CACF,EAEA,SAASE,EAAWC,EAAe,CACjC,MAAM,IAAI,MAAM,2BAA2B,CAC7C,CAEA,SAASC,EAAeL,EAAmB,CACzC,MAAM,IAA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iB,IAAI,CACtC,CACF,EACF,GACF,EACA3C,EAACgB,EAAA,CACC,QAASmB,EACT,UAAWG,EACX,aAAc,IAAMZ,EAAW,EAAK,EACpC,SAAUO,GAAWO,GAAkBJ,EACzC,EACApC,EAACiB,EAAA,CACC,QAASkB,EACT,UAAWO,GAAa,WAAW,WAAa,CAAE,IAAK,EAAG,EAC1D,cAAeA,GAAa,WAAW,eAAiB,CAAE,IAAK,EAAG,EAClE,UAAWA,GAAa,WAAW,WAAa,GAChD,KAAMA,GAAa,WAAW,MAAQ,GACtC,SAAUA,GAAa,WAAW,UAAY,GAC9C,aAAc,IAAM,CAClBhB,EAAW,EAAK,EAChBE,EAAe,IAAI,CACrB,EACF,GACF,CAEJ,CAAC,EAEDE,EAAQ,YAAc,UAEtB,IAAOoB,GAAQzC,EAAWqB,CAAO",
|
|
6
|
+
"names": ["jsx", "jsxs", "useMediaQuery", "React", "useEffect", "useImperativeHandle", "useRef", "useState", "cn", "withLayout", "SwiperBox", "Button", "Heading", "Picture", "Text", "Title", "VideoModal", "TextModal", "useExposure", "trackUrlRef", "componentType", "componentName", "Item", "data", "configuration", "handleAspect", "setVisible", "arg0", "setCurrentItem", "e", "Graphic", "className", "ref", "isMobile", "innerRef", "visible", "videoUrl", "setVideoUrl", "youTubeId", "setYouTubeId", "mobileVideoUrl", "setMobileVideoUrl", "currentItem", "handleSwiperShow", "width", "isShow", "descriptions", "maxHeight", "el", "_", "Graphic_default"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{Fragment as le,jsx as n,jsxs as T}from"react/jsx-runtime";import U,{useState as I,useEffect as R,useRef as k,useImperativeHandle as z}from"react";import{cn as _}from"../../helpers/utils.js";import W from"../../components/picture.js";import G from"./tabSwitch.js";import O from"../../components/button.js";import J from"../Title/index.js";import K from"../SwiperBox/index.js";import{withLayout as Q}from"../../shared/Styles.js";import{formatVariantPrice as X}from"./shelfDisplay.js";import{useExposure as Y}from"../../hooks/useExposure.js";import{gaTrack as E}from"../../shared/track.js";import{useAiuiContext as Z}from"../AiuiProvider/index.js";import ee from"../../components/badge.js";import{Heading as te}from"../../components/heading.js";import{Text as ne}from"../../components/text.js";import{trackUrlRef as
|
|
1
|
+
"use client";import{Fragment as le,jsx as n,jsxs as T}from"react/jsx-runtime";import U,{useState as I,useEffect as R,useRef as k,useImperativeHandle as z}from"react";import{cn as _}from"../../helpers/utils.js";import W from"../../components/picture.js";import G from"./tabSwitch.js";import O from"../../components/button.js";import J from"../Title/index.js";import K from"../SwiperBox/index.js";import{withLayout as Q}from"../../shared/Styles.js";import{formatVariantPrice as X}from"./shelfDisplay.js";import{useExposure as Y}from"../../hooks/useExposure.js";import{gaTrack as E}from"../../shared/track.js";import{useAiuiContext as Z}from"../AiuiProvider/index.js";import ee from"../../components/badge.js";import{Heading as te}from"../../components/heading.js";import{Text as ne}from"../../components/text.js";import{trackUrlRef as ie}from"../../shared/trackUrlRef.js";const V="image",H="product_shelf",re=999999999e-2;function se(e){const t=k(null),[p,u]=I(!1);return R(()=>{if(p)return;const m=t.current;if(!m||typeof IntersectionObserver>"u")return;const o=new IntersectionObserver(([r])=>{r.isIntersecting&&(u(!0),o.disconnect())},e);return o.observe(m),()=>o.disconnect()},[p,e]),[t,p]}const ae=({data:e,configuration:t})=>{const{locale:p="us",copyWriting:u}=Z(),m=(i,s,d)=>t?.event?.primaryButton?.(i,s+1,d),o=(i,s,d)=>t?.event?.secondaryButton?.(i,s+1,d),r=e?.variants?.find(i=>i?.sku===e?.sku)||e?.variants?.[0]||{},B=!r?.availableForSale&&r?.price?.amount===re,f=t?.isShowTag,h=t?.isShowOriginalPrice,y=r?.coupons?.[0],{price:b,basePrice:D}=X({locale:p,amount:h&&y?y.variant_price4wscode:r.price,baseAmount:h&&y?r.price:0,currencyCode:e?.price?.currencyCode||"USD"}),g=()=>{const i=e?.sku,s=e?.variants;return s?.find(w=>w?.sku===i)?.image?.url||s?.[0]?.image?.url||""},c=e?.custom_name||e?.title,v=e?.custom_description||e?.description;return n("div",{className:_("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300",t?.itemShape==="round"?"rounded-2xl":"rounded-none","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px]"),children:T("div",{className:"absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4",children:[n("div",{className:_("lg-desktop:mb-3 lg-desktop:h-[195px] relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden"),children:n("a",{"aria-label":c,target:t?.target,href:ie(`${p==="us"||!p?"":`/${p}`}/products/${e?.handle}`,`${V}_${H}`),onClick:()=>{E({event:"ga4Event",event_name:"select_item",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:[{item_id:e?.sku||r?.sku,item_name:e?.name,item_variant:r?.name,price:r?.price,index:t?.index+1}]}})},children:n(W,{source:g(),alt:"",className:"flex h-full justify-center object-cover [&_img]:w-auto"})})}),f?n("div",{className:"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden",children:e?.tags?.filter?.(i=>i?.startsWith?.("CLtag"))?.map?.(i=>i?.replace?.("CLtag:",""))?.slice?.(0,2)?.map?.((i,s)=>n(ee,{children:i},s))}):null,c?n(te,{as:"h3",title:c||"",size:2,className:"shelf-display-product-title lg-desktop:h-[58px] mb-1 line-clamp-2 flex h-[48px] items-end justify-start",html:c||""}):null,v?n(ne,{size:2,className:"shelf-display-product-description lg-desktop:text-[18px] lg-desktop:h-[26px] desktop:text-[16px] desktop:h-[24px] line-clamp-1 h-[20px] text-[14px]",html:v||""}):null,n("div",{className:"mb-2 mt-[20px] flex items-center",children:B?n("div",{className:"tablet:text-2xl text-info-primary text-xl font-bold",children:u?.soldOutText}):T(le,{children:[n("div",{className:"final-price tablet:text-2xl text-info-primary text-xl font-bold",children:r?.availableForSale&&b||""}),n("div",{className:"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through",children:r?.availableForSale&&D||""})]})}),T("div",{className:_("lg-desktop:gap-3 flex items-center gap-2",t.direction==="vertical"?"flex-col":""),children:[t?.secondaryButton?n(O,{variant:"secondary",onClick:()=>o(e,t?.index,t),className:`
|
|
2
2
|
${t.direction==="vertical"?"w-full":""}
|
|
3
3
|
`,children:t?.secondaryButton||""}):null,t?.primaryButton?n(O,{variant:"primary",onClick:()=>m(e,t?.index,t),className:`
|
|
4
4
|
${t.direction==="vertical"?"w-full":""}
|
|
5
|
-
`,children:t?.primaryButton||""}):null]})]})},e?.id||e?.handle)},oe=U.forwardRef(({data:e,buildData:t,className:p="",key:
|
|
5
|
+
`,children:t?.primaryButton||""}):null]})]})},e?.id||e?.handle)},oe=U.forwardRef(({data:e,buildData:t,className:p="",key:u,event:m,recommendedData:o,target:r="_self"},B)=>{const[f,h]=I(""),[y,b]=I([]),[D,g]=se({threshold:0}),c=k(!1),v=k(!1),i=k(null);z(B,()=>i.current),Y(i,{componentType:V,componentName:H,componentTitle:e?.title,navigation:f});const{productsTab:s=[],productsCard:d=[],title:w,isShowTab:P=!0,tabShape:L="square",isShowTag:$=!1,isShowOriginalPrice:A=!0,isShowRecommendedCard:F=!1,...j}=e,M=()=>{E({event:"ga4Event",event_name:"view_item_list",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:o?.map((a,C)=>{const l=a?.variants?.find(S=>S?.sku===a?.sku)||a?.variants?.[0];return{item_id:a?.sku||l?.sku,item_name:a?.name,item_variant:l?.name,price:l?.price,index:C+1}})}})},N=(a,C)=>{if(C){const x=o?.map(l=>({...l,isShowRecommended:!0}));b(x||[])}else{const x=a?.map(l=>{const S=t?.products?.find(q=>q?.handle===l?.handle);if(S)return{sku:l.sku,isShowRecommended:!1,custom_name:l.custom_name,custom_description:l.custom_description,...S}})?.filter(l=>l);b(x||[])}};return R(()=>{g&&o?.length&&!v.current&&(v.current=!0,M())},[g,o]),R(()=>{if(!c.current){if(!c.current&&o?.length&&(c.current=!0),P){h(s?.[0]?.tab||""),N(s?.[0]?.data||[],s?.[0]?.isShowRecommendedTab);return}N(d,F)}},[o]),T("div",{ref:i,className:_("shelf-display-wrap w-full",p,{"aiui-dark":e?.theme==="dark"}),children:[w&&n(J,{data:{title:w}}),P&&n("div",{className:"md-tablet:w-full md-tablet:overflow-hidden",children:n(G,{value:f,tabs:s,tabShape:L,onTabClick:a=>{if(h(a?.tab),N(a?.data||[],a?.isShowRecommendedTab),!a?.isShowRecommendedTab){E({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:V,component_name:H,component_title:e?.title,component_position:1,navigation:a?.tab}});return}M()}})}),n("div",{ref:D,className:"tablet:min-h-[393px] laptop:min-h-[425px] desktop:min-h-[405px] lg-desktop:min-h-[409px]",children:n(K,{className:`${P?"mt-6":""} !overflow-visible`,id:`ShelfDisplay${u}${f}`,data:{list:y,configuration:{...j,event:m,isShowTag:$,isShowOriginalPrice:A,target:r}},Slide:ae,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}})})]})});var Te=Q(oe);export{Te as default};
|
|
6
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/ShelfDisplay/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport TabSwitch from './tabSwitch.js'\nimport Button from '../../components/button.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { formatVariantPrice } from './shelfDisplay.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { gaTrack } from '../../shared/track.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport Badge from '../../components/badge.js'\nimport { Heading } from '../../components/heading.js'\nimport { Text } from '../../components/text.js'\nimport type { ContainerProps } from '../../types/props.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\n\nconst componentType = 'image'\nconst componentName = 'product_shelf'\n\nconst SOLD_OUT_PRICE = 9999999.99\n\nexport interface ShelfDisplayItem {\n id?: string\n /** \u4EA7\u54C1\u56FE\u7247*/\n img?: {\n url: string\n }\n handle?: string\n sku?: string\n /** \u6298\u6263\u540E\u4EF7\u683C*/\n price?: string\n title?: string\n /** \u6298\u6263\u524D\u4EF7\u683C*/\n basePrice?: string\n subTitle?: string\n /** \u6807\u7B7E*/\n tagItems?: string[]\n tab?: string\n data?: ShelfDisplayItem[]\n custom_name?: string\n custom_description?: string\n}\n\ntype EventType = {\n primaryButton?: (v: any, index: number, data: ShelfDisplayType) => void\n secondaryButton?: (v: any, index: number, data: ShelfDisplayType) => void\n}\n\ntype ShelfDisplayType = {\n title?: string\n isShowTab?: boolean\n isShowTag?: boolean\n isShowRecommendedCard?: boolean\n isShowOriginalPrice?: boolean\n direction?: 'horizontal' | 'vertical'\n align?: 'left' | 'center' | 'right'\n productsTab?: any[]\n productsCard?: any[]\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u6807\u7B7E\u9875\u5F62\u72B6*/\n tabShape?: 'rounded' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n primaryFun?: 'AddCart' | 'BuyNow' | 'LearnMore'\n /** \u526F\u6309\u94AE\u914D\u7F6E */\n secondaryButton?: string\n secondaryFun?: 'AddCart' | 'BuyNow' | 'LearnMore'\n theme?: 'light' | 'dark'\n containerProps?: ContainerProps\n}\n\nexport interface ShelfDisplayProps {\n data: ShelfDisplayType\n buildData?: {\n categories: any[]\n products: any[]\n }\n recommendedData?: any[]\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: EventType\n className?: string\n key?: string\n target?: '_self' | '_blank'\n}\n\nfunction useOnceInView<T extends Element>(options: any) {\n const ref = useRef<T>(null)\n const [inView, setInView] = useState(false)\n\n useEffect(() => {\n if (inView) return // \u5DF2\u8FDB\u5165\u8FC7\uFF0C\u5219\u4E0D\u518D\u89C2\u5BDF\n const el = ref.current\n if (!el || typeof IntersectionObserver === 'undefined') return\n\n const observer = new IntersectionObserver(([entry]) => {\n if (entry.isIntersecting) {\n setInView(true)\n observer.disconnect() // \u505C\u6B62\u89C2\u5BDF\n }\n }, options)\n\n observer.observe(el)\n return () => observer.disconnect()\n }, [inView, options])\n\n return [ref, inView]\n}\n\nconst ShelfDisplayItem = ({ data, configuration }: { data: any; configuration?: any }) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n\n const onPrimaryButton = (params: ShelfDisplayItem, index: number, data: ShelfDisplayType) =>\n configuration?.event?.primaryButton?.(params, index + 1, data)\n\n const onSecondaryButton = (params: ShelfDisplayItem, index: number, data: ShelfDisplayType) =>\n configuration?.event?.secondaryButton?.(params, index + 1, data)\n\n const variant = data?.variants?.find((item: any) => item?.sku === data?.sku) || data?.variants?.[0] || {}\n\n const isSoldOut = !variant?.availableForSale && variant?.price?.amount === SOLD_OUT_PRICE\n const isShowTag = configuration?.isShowTag\n const isShowOriginalPrice = configuration?.isShowOriginalPrice\n\n // active \u7684 \u901A\u7528\u6298\u6263\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: locale,\n amount: isShowOriginalPrice && coupon ? coupon.variant_price4wscode : variant.price,\n baseAmount: isShowOriginalPrice && coupon ? variant.price : 0,\n currencyCode: data?.price?.currencyCode || 'USD',\n })\n\n const handleUrl = () => {\n const sku = data?.sku\n const skuArray = data?.variants\n const findSku = skuArray?.find((item: any) => item?.sku === sku)\n return findSku?.image?.url || skuArray?.[0]?.image?.url || ''\n }\n\n const displayTitle = data?.custom_name || data?.title\n const displayDescription = data?.custom_description || data?.description\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n 'bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]',\n 'laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative',\n 'md-tablet:h-[360px]'\n )}\n >\n <div className=\"absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4\">\n <div\n className={cn(\n 'lg-desktop:mb-3 lg-desktop:h-[195px] relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden'\n )}\n >\n <a\n aria-label={displayTitle}\n target={configuration?.target}\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n onClick={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'select_item',\n event_parameters: {\n page_group: 'Home Page',\n item_list_name: 'Home_Page_Bundle',\n items: [\n {\n item_id: data?.sku || variant?.sku,\n item_name: data?.name,\n item_variant: variant?.name,\n price: variant?.price,\n index: configuration?.index + 1,\n },\n ],\n },\n })\n }}\n >\n <Picture source={handleUrl()} alt=\"\" className=\"flex h-full justify-center object-cover [&_img]:w-auto\" />\n </a>\n </div>\n {isShowTag ? (\n <div className=\"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden\">\n {data?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n ?.map?.((item: any, index: number) => <Badge key={index}>{item}</Badge>)}\n </div>\n ) : null}\n {displayTitle ? (\n <Heading\n as=\"h3\"\n title={displayTitle || ''}\n size={2}\n className=\"shelf-display-product-title lg-desktop:h-[58px] mb-1 line-clamp-2 flex h-[48px] items-end justify-start\"\n html={displayTitle || ''}\n />\n ) : null}\n {displayDescription ? (\n <Text\n size={2}\n className=\"shelf-display-product-description lg-desktop:text-[18px] lg-desktop:h-[26px] desktop:text-[16px] desktop:h-[24px] line-clamp-1 h-[20px] text-[14px]\"\n html={displayDescription || ''}\n />\n ) : null}\n <div className=\"mb-2 mt-[20px] flex items-center\">\n {isSoldOut ? (\n <div className=\"tablet:text-2xl text-info-primary text-xl font-bold\">{copyWriting?.soldOutText}</div>\n ) : (\n <>\n <div className=\"final-price tablet:text-2xl text-info-primary text-xl font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div\n className={cn(\n 'lg-desktop:gap-3 flex items-center gap-2',\n configuration.direction === 'vertical' ? 'flex-col' : ''\n )}\n >\n {configuration?.secondaryButton ? (\n <Button\n variant=\"secondary\"\n onClick={() => onSecondaryButton(data, configuration?.index, configuration)}\n className={`\n ${configuration.direction === 'vertical' ? 'w-full' : ''}\n `}\n >\n {configuration?.secondaryButton || ''}\n </Button>\n ) : null}\n {configuration?.primaryButton ? (\n <Button\n variant=\"primary\"\n onClick={() => onPrimaryButton(data, configuration?.index, configuration)}\n className={`\n ${configuration.direction === 'vertical' ? 'w-full' : ''}\n `}\n >\n {configuration?.primaryButton || ''}\n </Button>\n ) : null}\n </div>\n </div>\n </div>\n )\n}\n\nconst ShelfDisplay = React.forwardRef<HTMLDivElement, ShelfDisplayProps>(\n ({ data, buildData, className = '', key, event, recommendedData, target = '_self' }, ref) => {\n const [tabId, setTabId] = useState<string>('')\n const [currentItems, setCurrentItems] = useState<ShelfDisplayItem[]>([])\n\n const [viewRef, inView] = useOnceInView<HTMLDivElement>({ threshold: 0 })\n const isRecommend = useRef<boolean>(false)\n const isView = useRef<boolean>(false)\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType: componentType,\n componentName: componentName,\n componentTitle: data?.title,\n navigation: tabId,\n })\n\n const {\n productsTab = [],\n productsCard = [],\n title,\n isShowTab = true,\n tabShape = 'square',\n isShowTag = false,\n isShowOriginalPrice = true,\n isShowRecommendedCard = false,\n ...other\n } = data\n\n const gackViewEvent = () => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'view_item_list',\n event_parameters: {\n page_group: 'Home Page',\n item_list_name: 'Home_Page_Bundle',\n items: recommendedData?.map((item, index) => {\n const findData = item?.variants?.find((v: any) => v?.sku === item?.sku)\n const variant = findData || item?.variants?.[0]\n return {\n item_id: item?.sku || variant?.sku,\n item_name: item?.name,\n item_variant: variant?.name,\n price: variant?.price,\n index: index + 1,\n }\n }),\n },\n })\n }\n\n const handleCurrentTab = (currentData: ShelfDisplayItem[], flag: boolean) => {\n if (flag) {\n const newCurrentData = recommendedData?.map(item => {\n return {\n ...item,\n isShowRecommended: true,\n }\n })\n console.log('newCurrentData1', newCurrentData)\n setCurrentItems(newCurrentData || [])\n } else {\n const newCurrentData = currentData\n ?.map(item => {\n const findData = buildData?.products?.find(params => params?.handle === item?.handle)\n if (findData) {\n return {\n sku: item.sku,\n isShowRecommended: false,\n custom_name: item.custom_name,\n custom_description: item.custom_description,\n ...findData,\n }\n }\n })\n ?.filter(item => item)\n console.log('newCurrentData2', newCurrentData)\n setCurrentItems(newCurrentData || [])\n }\n }\n\n useEffect(() => {\n if (inView && recommendedData?.length && !isView.current) {\n isView.current = true\n gackViewEvent()\n }\n }, [inView, recommendedData])\n\n // \u7B97\u6CD5\u6570\u636E\u4F1A\u7A0D\u5FAE\u5EF6\u8FDF\uFF0C\u6240\u4EE5\u9700\u76D1\u542CrecommendedData\uFF0C\u4E3A\u4E86\u9632\u6B62\u5728\u6709\u7B97\u6CD5\u6570\u636E\u4E14\u5BF9\u9ED8\u8BA4\u6E32\u67D3\u7B2C\u4E00\u4E2A\u540E\u53CD\u590D\u89E6\u53D1\uFF0C\u7528isRecommend\u5173\u95ED\n useEffect(() => {\n if (isRecommend.current) return\n if (!isRecommend.current && recommendedData?.length) {\n isRecommend.current = true\n }\n if (isShowTab) {\n setTabId(productsTab?.[0]?.tab || '')\n handleCurrentTab(productsTab?.[0]?.data || [], productsTab?.[0]?.isShowRecommendedTab)\n return\n }\n handleCurrentTab(productsCard, isShowRecommendedCard)\n }, [recommendedData])\n\n return (\n <div\n ref={innerRef}\n className={cn('shelf-display-wrap w-full', className, { 'aiui-dark': data?.theme === 'dark' })}\n >\n {title && <Title data={{ title: title }} />}\n {isShowTab && (\n <div className=\"md-tablet:w-full md-tablet:overflow-hidden\">\n <TabSwitch\n value={tabId}\n tabs={productsTab}\n tabShape={tabShape}\n onTabClick={v => {\n setTabId(v?.tab)\n handleCurrentTab(v?.data || [], v?.isShowRecommendedTab)\n if (!v?.isShowRecommendedTab) {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n page_group: 'Home Page',\n component_type: componentType,\n component_name: componentName,\n component_title: data?.title,\n component_position: 1,\n navigation: v?.tab,\n },\n })\n return\n }\n gackViewEvent()\n }}\n />\n </div>\n )}\n <div\n ref={viewRef as any}\n className=\"tablet:min-h-[393px] laptop:min-h-[425px] desktop:min-h-[405px] lg-desktop:min-h-[409px]\"\n >\n <SwiperBox\n className={`${isShowTab ? 'mt-6' : ''} !overflow-visible`}\n id={`ShelfDisplay${key}${tabId}`}\n data={{\n list: currentItems,\n configuration: { ...other, event: event, isShowTag, isShowOriginalPrice, target: target },\n }}\n Slide={ShelfDisplayItem}\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 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 3,\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n </div>\n </div>\n )\n }\n)\n\nexport default withLayout(ShelfDisplay)\n"],
|
|
5
|
-
"mappings": "aAiMY,OAgCA,YAAAA,GAhCA,OAAAC,EAgCA,QAAAC,MAhCA,oBAhMZ,OAAOC,GAAS,YAAAC,EAAU,aAAAC,EAAW,UAAAC,EAAQ,uBAAAC,MAA2B,QACxE,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAa,8BACpB,OAAOC,MAAe,iBACtB,OAAOC,MAAY,6BACnB,OAAOC,MAAW,oBAClB,OAAOC,MAAe,wBACtB,OAAS,cAAAC,MAAkB,yBAC3B,OAAS,sBAAAC,MAA0B,oBACnC,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,WAAAC,MAAe,wBACxB,OAAS,kBAAAC,MAAsB,2BAC/B,OAAOC,OAAW,4BAClB,OAAS,WAAAC,OAAe,8BACxB,OAAS,QAAAC,OAAY,2BAErB,OAAS,eAAAC,OAAmB,8BAE5B,MAAMC,EAAgB,QAChBC,EAAgB,gBAEhBC,GAAiB,aAqEvB,SAASC,GAAiCC,EAAc,CACtD,MAAMC,EAAMtB,EAAU,IAAI,EACpB,CAACuB,EAAQC,CAAS,EAAI1B,EAAS,EAAK,EAE1C,OAAAC,EAAU,IAAM,CACd,GAAIwB,EAAQ,OACZ,MAAME,EAAKH,EAAI,QACf,GAAI,CAACG,GAAM,OAAO,qBAAyB,IAAa,OAExD,MAAMC,EAAW,IAAI,qBAAqB,CAAC,CAACC,CAAK,IAAM,CACjDA,EAAM,iBACRH,EAAU,EAAI,EACdE,EAAS,WAAW,EAExB,EAAGL,CAAO,EAEV,OAAAK,EAAS,QAAQD,CAAE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YAAAQ,EAAc,CAAC,EACf,aAAAC,EAAe,CAAC,EAChB,MAAAC,EACA,UAAAC,EAAY,GACZ,SAAAC,EAAW,SACX,UAAA7B,EAAY,GACZ,oBAAAC,EAAsB,GACtB,sBAAA6B,EAAwB,GACxB,GAAGC,CACL,EAAI1C,EAEE2C,EAAgB,IAAM,CAC1B7D,EAAQ,CACN,MAAO,WACP,WAAY,iBACZ,iBAAkB,CAChB,WAAY,YACZ,eAAgB,mBAChB,MAAO4C,GAAiB,IAAI,CAACjB,EAAMH,IAAU,CAE3C,MAAME,EADWC,GAAM,UAAU,KAAMmC,GAAWA,GAAG,MAAQnC,GAAM,GAAG,GAC1CA,GAAM,WAAW,CAAC,EAC9C,MAAO,CACL,QAASA,GAAM,KAAOD,GAAS,IAC/B,UAAWC,GAAM,KACjB,aAAcD,GAAS,KACvB,MAAOA,GAAS,MAChB,MAAOF,EAAQ,CACjB,CACF,CAAC,CACH,CACF,CAAC,CACH,EAEMuC,EAAmB,CAACC,EAAiCC,IAAkB,CAC3E,GAAIA,EAAM,CACR,MAAMC,EAAiBtB,GAAiB,IAAIjB,IACnC,CACL,GAAGA,EACH,kBAAmB,EACrB,EACD,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useState, useEffect, useRef, useImperativeHandle } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport TabSwitch from './tabSwitch.js'\nimport Button from '../../components/button.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { formatVariantPrice } from './shelfDisplay.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { gaTrack } from '../../shared/track.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport Badge from '../../components/badge.js'\nimport { Heading } from '../../components/heading.js'\nimport { Text } from '../../components/text.js'\nimport type { ContainerProps } from '../../types/props.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\n\nconst componentType = 'image'\nconst componentName = 'product_shelf'\n\nconst SOLD_OUT_PRICE = 9999999.99\n\nexport interface ShelfDisplayItem {\n id?: string\n /** \u4EA7\u54C1\u56FE\u7247*/\n img?: {\n url: string\n }\n handle?: string\n sku?: string\n /** \u6298\u6263\u540E\u4EF7\u683C*/\n price?: string\n title?: string\n /** \u6298\u6263\u524D\u4EF7\u683C*/\n basePrice?: string\n subTitle?: string\n /** \u6807\u7B7E*/\n tagItems?: string[]\n tab?: string\n data?: ShelfDisplayItem[]\n custom_name?: string\n custom_description?: string\n}\n\ntype EventType = {\n primaryButton?: (v: any, index: number, data: ShelfDisplayType) => void\n secondaryButton?: (v: any, index: number, data: ShelfDisplayType) => void\n}\n\ntype ShelfDisplayType = {\n title?: string\n isShowTab?: boolean\n isShowTag?: boolean\n isShowRecommendedCard?: boolean\n isShowOriginalPrice?: boolean\n direction?: 'horizontal' | 'vertical'\n align?: 'left' | 'center' | 'right'\n productsTab?: any[]\n productsCard?: any[]\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u6807\u7B7E\u9875\u5F62\u72B6*/\n tabShape?: 'rounded' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n primaryFun?: 'AddCart' | 'BuyNow' | 'LearnMore'\n /** \u526F\u6309\u94AE\u914D\u7F6E */\n secondaryButton?: string\n secondaryFun?: 'AddCart' | 'BuyNow' | 'LearnMore'\n theme?: 'light' | 'dark'\n containerProps?: ContainerProps\n}\n\nexport interface ShelfDisplayProps {\n data: ShelfDisplayType\n buildData?: {\n categories: any[]\n products: any[]\n }\n recommendedData?: any[]\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: EventType\n className?: string\n key?: string\n target?: '_self' | '_blank'\n}\n\nfunction useOnceInView<T extends Element>(options: any) {\n const ref = useRef<T>(null)\n const [inView, setInView] = useState(false)\n\n useEffect(() => {\n if (inView) return // \u5DF2\u8FDB\u5165\u8FC7\uFF0C\u5219\u4E0D\u518D\u89C2\u5BDF\n const el = ref.current\n if (!el || typeof IntersectionObserver === 'undefined') return\n\n const observer = new IntersectionObserver(([entry]) => {\n if (entry.isIntersecting) {\n setInView(true)\n observer.disconnect() // \u505C\u6B62\u89C2\u5BDF\n }\n }, options)\n\n observer.observe(el)\n return () => observer.disconnect()\n }, [inView, options])\n\n return [ref, inView]\n}\n\nconst ShelfDisplayItem = ({ data, configuration }: { data: any; configuration?: any }) => {\n const { locale = 'us', copyWriting } = useAiuiContext()\n\n const onPrimaryButton = (params: ShelfDisplayItem, index: number, data: ShelfDisplayType) =>\n configuration?.event?.primaryButton?.(params, index + 1, data)\n\n const onSecondaryButton = (params: ShelfDisplayItem, index: number, data: ShelfDisplayType) =>\n configuration?.event?.secondaryButton?.(params, index + 1, data)\n\n const variant = data?.variants?.find((item: any) => item?.sku === data?.sku) || data?.variants?.[0] || {}\n\n const isSoldOut = !variant?.availableForSale && variant?.price?.amount === SOLD_OUT_PRICE\n const isShowTag = configuration?.isShowTag\n const isShowOriginalPrice = configuration?.isShowOriginalPrice\n\n // active \u7684 \u901A\u7528\u6298\u6263\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: locale,\n amount: isShowOriginalPrice && coupon ? coupon.variant_price4wscode : variant.price,\n baseAmount: isShowOriginalPrice && coupon ? variant.price : 0,\n currencyCode: data?.price?.currencyCode || 'USD',\n })\n\n const handleUrl = () => {\n const sku = data?.sku\n const skuArray = data?.variants\n const findSku = skuArray?.find((item: any) => item?.sku === sku)\n return findSku?.image?.url || skuArray?.[0]?.image?.url || ''\n }\n\n const displayTitle = data?.custom_name || data?.title\n const displayDescription = data?.custom_description || data?.description\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n 'bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full cursor-pointer overflow-hidden duration-300',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]',\n 'laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative',\n 'md-tablet:h-[360px]'\n )}\n >\n <div className=\"absolute inset-0 box-border flex flex-col justify-between overflow-hidden p-4\">\n <div\n className={cn(\n 'lg-desktop:mb-3 lg-desktop:h-[195px] relative mb-2 inline-block h-[140px] w-full flex-1 overflow-hidden'\n )}\n >\n <a\n aria-label={displayTitle}\n target={configuration?.target}\n href={trackUrlRef(\n `${locale === 'us' || !locale ? '' : `/${locale}`}/products/${data?.handle}`,\n `${componentType}_${componentName}`\n )}\n onClick={() => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'select_item',\n event_parameters: {\n page_group: 'Home Page',\n item_list_name: 'Home_Page_Bundle',\n items: [\n {\n item_id: data?.sku || variant?.sku,\n item_name: data?.name,\n item_variant: variant?.name,\n price: variant?.price,\n index: configuration?.index + 1,\n },\n ],\n },\n })\n }}\n >\n <Picture source={handleUrl()} alt=\"\" className=\"flex h-full justify-center object-cover [&_img]:w-auto\" />\n </a>\n </div>\n {isShowTag ? (\n <div className=\"mb-1 box-border flex h-8 flex-wrap gap-1 overflow-hidden\">\n {data?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n ?.map?.((item: any, index: number) => <Badge key={index}>{item}</Badge>)}\n </div>\n ) : null}\n {displayTitle ? (\n <Heading\n as=\"h3\"\n title={displayTitle || ''}\n size={2}\n className=\"shelf-display-product-title lg-desktop:h-[58px] mb-1 line-clamp-2 flex h-[48px] items-end justify-start\"\n html={displayTitle || ''}\n />\n ) : null}\n {displayDescription ? (\n <Text\n size={2}\n className=\"shelf-display-product-description lg-desktop:text-[18px] lg-desktop:h-[26px] desktop:text-[16px] desktop:h-[24px] line-clamp-1 h-[20px] text-[14px]\"\n html={displayDescription || ''}\n />\n ) : null}\n <div className=\"mb-2 mt-[20px] flex items-center\">\n {isSoldOut ? (\n <div className=\"tablet:text-2xl text-info-primary text-xl font-bold\">{copyWriting?.soldOutText}</div>\n ) : (\n <>\n <div className=\"final-price tablet:text-2xl text-info-primary text-xl font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div\n className={cn(\n 'lg-desktop:gap-3 flex items-center gap-2',\n configuration.direction === 'vertical' ? 'flex-col' : ''\n )}\n >\n {configuration?.secondaryButton ? (\n <Button\n variant=\"secondary\"\n onClick={() => onSecondaryButton(data, configuration?.index, configuration)}\n className={`\n ${configuration.direction === 'vertical' ? 'w-full' : ''}\n `}\n >\n {configuration?.secondaryButton || ''}\n </Button>\n ) : null}\n {configuration?.primaryButton ? (\n <Button\n variant=\"primary\"\n onClick={() => onPrimaryButton(data, configuration?.index, configuration)}\n className={`\n ${configuration.direction === 'vertical' ? 'w-full' : ''}\n `}\n >\n {configuration?.primaryButton || ''}\n </Button>\n ) : null}\n </div>\n </div>\n </div>\n )\n}\n\nconst ShelfDisplay = React.forwardRef<HTMLDivElement, ShelfDisplayProps>(\n ({ data, buildData, className = '', key, event, recommendedData, target = '_self' }, ref) => {\n const [tabId, setTabId] = useState<string>('')\n const [currentItems, setCurrentItems] = useState<ShelfDisplayItem[]>([])\n\n const [viewRef, inView] = useOnceInView<HTMLDivElement>({ threshold: 0 })\n const isRecommend = useRef<boolean>(false)\n const isView = useRef<boolean>(false)\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType: componentType,\n componentName: componentName,\n componentTitle: data?.title,\n navigation: tabId,\n })\n\n const {\n productsTab = [],\n productsCard = [],\n title,\n isShowTab = true,\n tabShape = 'square',\n isShowTag = false,\n isShowOriginalPrice = true,\n isShowRecommendedCard = false,\n ...other\n } = data\n\n const gackViewEvent = () => {\n gaTrack({\n event: 'ga4Event',\n event_name: 'view_item_list',\n event_parameters: {\n page_group: 'Home Page',\n item_list_name: 'Home_Page_Bundle',\n items: recommendedData?.map((item, index) => {\n const findData = item?.variants?.find((v: any) => v?.sku === item?.sku)\n const variant = findData || item?.variants?.[0]\n return {\n item_id: item?.sku || variant?.sku,\n item_name: item?.name,\n item_variant: variant?.name,\n price: variant?.price,\n index: index + 1,\n }\n }),\n },\n })\n }\n\n const handleCurrentTab = (currentData: ShelfDisplayItem[], flag: boolean) => {\n if (flag) {\n const newCurrentData = recommendedData?.map(item => {\n return {\n ...item,\n isShowRecommended: true,\n }\n })\n setCurrentItems(newCurrentData || [])\n } else {\n const newCurrentData = currentData\n ?.map(item => {\n const findData = buildData?.products?.find(params => params?.handle === item?.handle)\n if (findData) {\n return {\n sku: item.sku,\n isShowRecommended: false,\n custom_name: item.custom_name,\n custom_description: item.custom_description,\n ...findData,\n }\n }\n })\n ?.filter(item => item)\n setCurrentItems(newCurrentData || [])\n }\n }\n\n useEffect(() => {\n if (inView && recommendedData?.length && !isView.current) {\n isView.current = true\n gackViewEvent()\n }\n }, [inView, recommendedData])\n\n // \u7B97\u6CD5\u6570\u636E\u4F1A\u7A0D\u5FAE\u5EF6\u8FDF\uFF0C\u6240\u4EE5\u9700\u76D1\u542CrecommendedData\uFF0C\u4E3A\u4E86\u9632\u6B62\u5728\u6709\u7B97\u6CD5\u6570\u636E\u4E14\u5BF9\u9ED8\u8BA4\u6E32\u67D3\u7B2C\u4E00\u4E2A\u540E\u53CD\u590D\u89E6\u53D1\uFF0C\u7528isRecommend\u5173\u95ED\n useEffect(() => {\n if (isRecommend.current) return\n if (!isRecommend.current && recommendedData?.length) {\n isRecommend.current = true\n }\n if (isShowTab) {\n setTabId(productsTab?.[0]?.tab || '')\n handleCurrentTab(productsTab?.[0]?.data || [], productsTab?.[0]?.isShowRecommendedTab)\n return\n }\n handleCurrentTab(productsCard, isShowRecommendedCard)\n }, [recommendedData])\n\n return (\n <div\n ref={innerRef}\n className={cn('shelf-display-wrap w-full', className, { 'aiui-dark': data?.theme === 'dark' })}\n >\n {title && <Title data={{ title: title }} />}\n {isShowTab && (\n <div className=\"md-tablet:w-full md-tablet:overflow-hidden\">\n <TabSwitch\n value={tabId}\n tabs={productsTab}\n tabShape={tabShape}\n onTabClick={v => {\n setTabId(v?.tab)\n handleCurrentTab(v?.data || [], v?.isShowRecommendedTab)\n if (!v?.isShowRecommendedTab) {\n gaTrack({\n event: 'ga4Event',\n event_name: 'component_click',\n event_parameters: {\n page_group: 'Home Page',\n component_type: componentType,\n component_name: componentName,\n component_title: data?.title,\n component_position: 1,\n navigation: v?.tab,\n },\n })\n return\n }\n gackViewEvent()\n }}\n />\n </div>\n )}\n <div\n ref={viewRef as any}\n className=\"tablet:min-h-[393px] laptop:min-h-[425px] desktop:min-h-[405px] lg-desktop:min-h-[409px]\"\n >\n <SwiperBox\n className={`${isShowTab ? 'mt-6' : ''} !overflow-visible`}\n id={`ShelfDisplay${key}${tabId}`}\n data={{\n list: currentItems,\n configuration: { ...other, event: event, isShowTag, isShowOriginalPrice, target: target },\n }}\n Slide={ShelfDisplayItem}\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 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 3,\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n </div>\n </div>\n )\n }\n)\n\nexport default withLayout(ShelfDisplay)\n"],
|
|
5
|
+
"mappings": "aAiMY,OAgCA,YAAAA,GAhCA,OAAAC,EAgCA,QAAAC,MAhCA,oBA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s", "React", "useState", "useEffect", "useRef", "useImperativeHandle", "cn", "Picture", "TabSwitch", "Button", "Title", "SwiperBox", "withLayout", "formatVariantPrice", "useExposure", "gaTrack", "useAiuiContext", "Badge", "Heading", "Text", "trackUrlRef", "componentType", "componentName", "SOLD_OUT_PRICE", "useOnceInView", "options", "ref", "inView", "setInView", "el", "observer", "entry", "ShelfDisplayItem", "data", "configuration", "locale", "copyWriting", "onPrimaryButton", "params", "index", "onSecondaryButton", "variant", "item", "isSoldOut", "isShowTag", "isShowOriginalPrice", "coupon", "price", "basePrice", "handleUrl", "sku", "skuArray", "displayTitle", "displayDescription", "ShelfDisplay", "buildData", "className", "key", "event", "recommendedData", "target", "tabId", "setTabId", "currentItems", "setCurrentItems", "viewRef", "isRecommend", "isView", "innerRef", "productsTab", "productsCard", "title", "isShowTab", "tabShape", "isShowRecommendedCard", "other", "gackViewEvent", "v", "handleCurrentTab", "currentData", "flag", "newCurrentData", "findData", "ShelfDisplay_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Img } from '../../types/props.js';
|
|
2
|
+
export type TextModalType = {
|
|
3
|
+
visible: boolean;
|
|
4
|
+
textPcImg: Img;
|
|
5
|
+
textMobileImg: Img;
|
|
6
|
+
textTitle: string;
|
|
7
|
+
text: string;
|
|
8
|
+
textDesc: string;
|
|
9
|
+
onCloseModal: () => void;
|
|
10
|
+
};
|
|
11
|
+
declare const TextModal: (props: TextModalType) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export { TextModal };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{jsx as t,jsxs as l}from"react/jsx-runtime";import{Dialog as r,DialogContent as d}from"../../components/dialog.js";import{Picture as g,Text as e}from"../../components/index.js";import"../../helpers/index.js";const b=a=>{const{visible:i,textPcImg:s,textMobileImg:p,textTitle:x,text:n,textDesc:m,onCloseModal:o}=a;return t(r,{open:i,onOpenChange:()=>o(),children:t(d,{className:" tablet:max-h-[535px] tablet:max-w-[896px] md-tablet:h-[490px] md-tablet:w-[358px] mx-auto border-none bg-transparent p-0 text-white [&_button]:hidden",children:l("div",{className:" relative",children:[t(g,{source:`${s?.url||""} , ${p?.url||""} 767`,className:"h-full w-full",imgClassName:"h-full object-cover"}),t("div",{className:" tablet:inset-x-[32px] tablet:top-[32px] absolute inset-x-[16px] top-[16px]",children:l("div",{className:"flex items-center justify-between",children:[t(e,{html:x,className:"tablet:text-[24px] text-[20px] font-bold leading-[1.2]"}),t("div",{onClick:()=>o(),className:" cursor-pointer",children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"25",viewBox:"0 0 24 25",fill:"none",children:t("g",{"clip-path":"url(#clip0_2548_10038)",children:t("path",{d:"M5.63545 6.13604C6.02592 5.74546 6.65913 5.74551 7.04966 6.13604L11.9994 11.0858L16.9492 6.13604C17.3397 5.74552 17.9729 5.74546 18.3634 6.13604C18.7538 6.52659 18.7538 7.15972 18.3634 7.55025L13.4136 12.5L18.3634 17.4497C18.7538 17.8403 18.7538 18.4734 18.3634 18.864C17.9729 19.2545 17.3397 19.2545 16.9492 18.864L11.9994 13.9142L7.04966 18.864C6.65913 19.2545 6.02592 19.2545 5.63545 18.864C5.24501 18.4734 5.24502 17.8403 5.63545 17.4497L10.5852 12.5L5.63545 7.55025C5.24502 7.15972 5.24501 6.52658 5.63545 6.13604Z",fill:"white"})})})})]})}),l("div",{className:"tablet:p-[32px] p-[16px]",children:[t(e,{html:n,className:" tablet:text-[24px] text-[20px] font-bold leading-[1.2]"}),t("br",{}),t(e,{html:m,className:"tablet:leading-[1.2] pt-1 text-[16px] font-bold leading-[1.4]"})]})]})})})};export{b as TextModal};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/TextModal/index.tsx"],
|
|
4
|
+
"sourcesContent": ["import type { Media } from '../../types/props.js'\nimport { Dialog, DialogContent } from '../../components/dialog.js'\nimport { Picture, Text } from '../../components/index.js'\nimport { cn } from '../../helpers/index.js'\nimport type { Img } from '../../types/props.js'\n\nexport type TextModalType = {\n visible: boolean\n textPcImg: Img\n textMobileImg: Img\n textTitle: string\n text: string\n textDesc: string\n onCloseModal: () => void\n}\n\nconst TextModal = (props: TextModalType) => {\n const { visible, textPcImg, textMobileImg, textTitle, text, textDesc, onCloseModal } = props\n\n return (\n <Dialog open={visible} onOpenChange={() => onCloseModal()}>\n <DialogContent className=\" tablet:max-h-[535px] tablet:max-w-[896px] md-tablet:h-[490px] md-tablet:w-[358px] mx-auto border-none bg-transparent p-0 text-white [&_button]:hidden\">\n <div className=\" relative\">\n <Picture\n source={`${textPcImg?.url || ''} , ${textMobileImg?.url || ''} 767`}\n className=\"h-full w-full\"\n imgClassName=\"h-full object-cover\"\n />\n <div className=\" tablet:inset-x-[32px] tablet:top-[32px] absolute inset-x-[16px] top-[16px]\">\n <div className=\"flex items-center justify-between\">\n <Text html={textTitle} className=\"tablet:text-[24px] text-[20px] font-bold leading-[1.2]\" />\n <div onClick={() => onCloseModal()} className=\" cursor-pointer\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"24\" height=\"25\" viewBox=\"0 0 24 25\" fill=\"none\">\n <g clip-path=\"url(#clip0_2548_10038)\">\n <path\n d=\"M5.63545 6.13604C6.02592 5.74546 6.65913 5.74551 7.04966 6.13604L11.9994 11.0858L16.9492 6.13604C17.3397 5.74552 17.9729 5.74546 18.3634 6.13604C18.7538 6.52659 18.7538 7.15972 18.3634 7.55025L13.4136 12.5L18.3634 17.4497C18.7538 17.8403 18.7538 18.4734 18.3634 18.864C17.9729 19.2545 17.3397 19.2545 16.9492 18.864L11.9994 13.9142L7.04966 18.864C6.65913 19.2545 6.02592 19.2545 5.63545 18.864C5.24501 18.4734 5.24502 17.8403 5.63545 17.4497L10.5852 12.5L5.63545 7.55025C5.24502 7.15972 5.24501 6.52658 5.63545 6.13604Z\"\n fill=\"white\"\n />\n </g>\n </svg>\n </div>\n </div>\n </div>\n <div className=\"tablet:p-[32px] p-[16px]\">\n <Text html={text} className=\" tablet:text-[24px] text-[20px] font-bold leading-[1.2]\" />\n <br />\n <Text html={textDesc} className=\"tablet:leading-[1.2] pt-1 text-[16px] font-bold leading-[1.4]\" />\n </div>\n </div>\n </DialogContent>\n </Dialog>\n )\n}\n\nexport { TextModal }\n"],
|
|
5
|
+
"mappings": "AAuBU,cAAAA,EAME,QAAAC,MANF,oBAtBV,OAAS,UAAAC,EAAQ,iBAAAC,MAAqB,6BACtC,OAAS,WAAAC,EAAS,QAAAC,MAAY,4BAC9B,MAAmB,yBAanB,MAAMC,EAAaC,GAAyB,CAC1C,KAAM,CAAE,QAAAC,EAAS,UAAAC,EAAW,cAAAC,EAAe,UAAAC,EAAW,KAAAC,EAAM,SAAAC,EAAU,aAAAC,CAAa,EAAIP,EAEvF,OACEP,EAACE,EAAA,CAAO,KAAMM,EAAS,aAAc,IAAMM,EAAa,EACtD,SAAAd,EAACG,EAAA,CAAc,UAAU,yJACvB,SAAAF,EAAC,OAAI,UAAU,YACb,UAAAD,EAACI,EAAA,CACC,OAAQ,GAAGK,GAAW,KAAO,EAAE,MAAMC,GAAe,KAAO,EAAE,OAC7D,UAAU,gBACV,aAAa,sBACf,EACAV,EAAC,OAAI,UAAU,8EACb,SAAAC,EAAC,OAAI,UAAU,oCACb,UAAAD,EAACK,EAAA,CAAK,KAAMM,EAAW,UAAU,yDAAyD,EAC1FX,EAAC,OAAI,QAAS,IAAMc,EAAa,EAAG,UAAU,kBAC5C,SAAAd,EAAC,OAAI,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACtF,SAAAA,EAAC,KAAE,YAAU,yBACX,SAAAA,EAAC,QACC,EAAE,0gBACF,KAAK,QACP,EACF,EACF,EACF,GACF,EACF,EACAC,EAAC,OAAI,UAAU,2BACb,UAAAD,EAACK,EAAA,CAAK,KAAMO,EAAM,UAAU,0DAA0D,EACtFZ,EAAC,OAAG,EACJA,EAACK,EAAA,CAAK,KAAMQ,EAAU,UAAU,gEAAgE,GAClG,GACF,EACF,EACF,CAEJ",
|
|
6
|
+
"names": ["jsx", "jsxs", "Dialog", "DialogContent", "Picture", "Text", "TextModal", "props", "visible", "textPcImg", "textMobileImg", "textTitle", "text", "textDesc", "onCloseModal"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as
|
|
1
|
+
"use client";import{jsx as a,jsxs as q}from"react/jsx-runtime";import V,{useEffect as $,useRef as r,useImperativeHandle as z}from"react";import{gsap as c}from"gsap";import{SplitText as T}from"gsap/dist/SplitText";import{ScrollTrigger as h}from"gsap/dist/ScrollTrigger";import{cn as w}from"../../helpers/utils.js";import{Heading as U}from"../../components/index.js";import{withLayout as j}from"../../shared/Styles.js";import{useExposure as C}from"../../hooks/useExposure.js";import{trackUrlRef as F}from"../../shared/trackUrlRef.js";import{useInView as _}from"react-intersection-observer";const x="link",v="title",y=V.forwardRef(({data:m,className:k},b)=>{const{title:u,theme:p,extension:n}=m,o=r(null),t=r(null),e=r(null),i=r(null),{ref:R,inView:f}=_();return z(b,()=>o.current),C(o,{componentType:x,componentName:v,componentTitle:m?.title}),$(()=>{c.registerPlugin(T,h);function H(){if(!t.current)return;const E=t.current?.clientHeight||80;e.current=new T(t.current,{type:"words",wordsClass:"word"});const s=e.current.words;c.set(s,{opacity:0}),i.current=h.create({trigger:t.current,start:"bottom bottom-=4%",end:`bottom+=${E*1.5+60}px bottom-=4%`,scrub:!0,onUpdate:L=>{const M=L.progress,d=s.length,D=1/d,g=.5;s.forEach((N,S)=>{const I=S/d*(1-g),P=D*(1+g);let l=(M-I)/P;l=Math.max(0,Math.min(l,1)),c.set(N,{opacity:l})})}})}return f&&H(),()=>{e.current&&e.current.revert(),i.current&&i.current.kill()}},[f]),u&&q("div",{className:"mb-6 flex items-end justify-between",ref:o,children:[a("div",{ref:R,className:w("space-y-4",k,{"aiui-dark":p==="dark"}),children:a(U,{ref:t,as:"h2",size:4,html:u})}),n?.textLink&&a("a",{className:w({"aiui-dark":p==="dark"},"text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]"),href:F(n?.link,`${x}_${v}`),children:n?.textLink})]})});y.displayName="Title";var Z=j(y);export{Z as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Title/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className }, ref) => {\n const { title,
|
|
5
|
-
"mappings": "aA8EM,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBA7EN,OAAOC,GAAS,aAAAC,EAAW,UAAAC,EAAQ,uBAAAC,MAA2B,QAC9D,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,MAAe,4BACxB,OAAS,cAAAC,MAAkB,yBAE3B,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,eAAAC,MAAmB,8BAC5B,OAAS,aAAAC,MAAiB,8BAE1B,MAAMC,EAAgB,OAChBC,EAAgB,QAEhBC,EAAQf,EAAM,WAAuC,CAAC,CAAE,KAAAgB,EAAM,UAAAC,CAAU,EAAGC,IAAQ,CACvF,KAAM,CAAE,MAAAC,EAAO,
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "useEffect", "useRef", "useImperativeHandle", "gsap", "SplitText", "ScrollTrigger", "cn", "Heading", "withLayout", "useExposure", "trackUrlRef", "useInView", "componentType", "componentName", "Title", "data", "className", "ref", "title", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className }, ref) => {\n const { title, theme, extension } = data\n const innerRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word: any, i: number) => {\n const start = (i / total) * (1 - overlap)\n const width = interval * (1 + overlap)\n let opacity = (progress - start) / width\n opacity = Math.max(0, Math.min(opacity, 1))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n title && (\n <div className=\"mb-6 flex items-end justify-between\" ref={innerRef}>\n <div ref={inViewRef} className={cn('space-y-4', className, { 'aiui-dark': theme === 'dark' })}>\n <Heading ref={titleRef} as=\"h2\" size={4} html={title} />\n </div>\n {extension?.textLink && (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]'\n )}\n href={trackUrlRef(extension?.link, `${componentType}_${componentName}`)}\n >\n {extension?.textLink}\n </a>\n )}\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
|
|
5
|
+
"mappings": "aA8EM,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBA7EN,OAAOC,GAAS,aAAAC,EAAW,UAAAC,EAAQ,uBAAAC,MAA2B,QAC9D,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,MAAe,4BACxB,OAAS,cAAAC,MAAkB,yBAE3B,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,eAAAC,MAAmB,8BAC5B,OAAS,aAAAC,MAAiB,8BAE1B,MAAMC,EAAgB,OAChBC,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AAI,CAAQ,CAAC,CAC5B,CAAC,CACH,CACF,CAAC,CACH,CAEA,OAAIb,GACFC,EAAW,EAGN,IAAM,CACXJ,EAAkB,SAAWA,EAAkB,QAAQ,OAAO,EAE9DC,EAAiB,SAAWA,EAAiB,QAAQ,KAAK,CAC5D,CACF,EAAG,CAACE,CAAM,CAAC,EAGTR,GACEpB,EAAC,OAAI,UAAU,sCAAsC,IAAKuB,EACxD,UAAAxB,EAAC,OAAI,IAAK4B,EAAW,UAAWnB,EAAG,YAAaU,EAAW,CAAE,YAAaG,IAAU,MAAO,CAAC,EAC1F,SAAAtB,EAACU,EAAA,CAAQ,IAAKe,EAAU,GAAG,KAAK,KAAM,EAAG,KAAMJ,EAAO,EACxD,EACCE,GAAW,UACVvB,EAAC,KACC,UAAWS,EACT,CAAE,YAAaa,IAAU,MAAO,EAChC,oGACF,EACA,KAAMT,EAAYU,GAAW,KAAM,GAAGR,CAAa,IAAIC,CAAa,EAAE,EAErE,SAAAO,GAAW,SACd,GAEJ,CAGN,CAAC,EAEDN,EAAM,YAAc,QAEpB,IAAO0B,EAAQhC,EAAWM,CAAK",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "useEffect", "useRef", "useImperativeHandle", "gsap", "SplitText", "ScrollTrigger", "cn", "Heading", "withLayout", "useExposure", "trackUrlRef", "useInView", "componentType", "componentName", "Title", "data", "className", "ref", "title", "theme", "extension", "innerRef", "titleRef", "splitTextInstance", "scrollTriggerRef", "inViewRef", "inView", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity", "Title_default"]
|
|
7
7
|
}
|
|
@@ -10,8 +10,7 @@ export interface TitleProps {
|
|
|
10
10
|
/**
|
|
11
11
|
* 主标题
|
|
12
12
|
*/
|
|
13
|
-
title
|
|
14
|
-
caption?: string;
|
|
13
|
+
title: string;
|
|
15
14
|
/**
|
|
16
15
|
* 特性列表,最多支持3个
|
|
17
16
|
*/
|
|
@@ -23,7 +22,7 @@ export interface TitleProps {
|
|
|
23
22
|
/**
|
|
24
23
|
* 扩展数据
|
|
25
24
|
*/
|
|
26
|
-
|
|
25
|
+
extension?: any;
|
|
27
26
|
};
|
|
28
27
|
/**
|
|
29
28
|
* 自定义类名
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { WhyChooseProps, WhyChooseItem as ItemType } from './types.js';
|
|
3
|
+
declare const WhyChooseItem: {
|
|
4
|
+
({ data }: {
|
|
5
|
+
data: ItemType;
|
|
6
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<Omit<WhyChooseProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps> & {
|
|
10
|
+
className?: string;
|
|
11
|
+
data?: Record<string, any>;
|
|
12
|
+
}, "ref"> & React.RefAttributes<any>>;
|
|
13
|
+
export default _default;
|
|
14
|
+
export { WhyChooseItem };
|
|
@@ -38,6 +38,13 @@ declare const meta: {
|
|
|
38
38
|
buttonText?: string;
|
|
39
39
|
icon?: import("../types/props.js").Img;
|
|
40
40
|
theme?: import("../types/props.js").Theme;
|
|
41
|
+
extension?: {
|
|
42
|
+
text: string;
|
|
43
|
+
textDesc: string;
|
|
44
|
+
textTitle: string;
|
|
45
|
+
textPcImg: import("../types/props.js").Img;
|
|
46
|
+
textMobileImg: import("../types/props.js").Img;
|
|
47
|
+
};
|
|
41
48
|
}[];
|
|
42
49
|
itemShape?: "round" | "square";
|
|
43
50
|
itemTheme?: import("../types/props.js").Theme;
|