@anker-in/headless-ui 1.0.9-temp-box → 1.0.9-temp-10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (153) hide show
  1. package/dist/cjs/apps/playground/utils/classnames.d.ts +1 -0
  2. package/dist/cjs/biz-components/AccordionCards/useDebounce.d.ts +6 -0
  3. package/dist/cjs/biz-components/CreativeModule/index.d.ts +20 -0
  4. package/dist/cjs/biz-components/CreativeModule/index.js +2 -0
  5. package/dist/cjs/biz-components/CreativeModule/index.js.map +7 -0
  6. package/dist/cjs/biz-components/Graphic/index.js +1 -1
  7. package/dist/cjs/biz-components/Graphic/index.js.map +2 -2
  8. package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
  9. package/dist/cjs/biz-components/MediaPlayerBase/index.js.map +2 -2
  10. package/dist/cjs/biz-components/MediaPlayerMulti/YouTubePlayer.d.ts +3 -0
  11. package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
  12. package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js.map +1 -1
  13. package/dist/cjs/biz-components/SectionHeading/SectionHeading.d.ts +4 -0
  14. package/dist/cjs/biz-components/SectionHeading/types.d.ts +6 -0
  15. package/dist/cjs/biz-components/Shelf/Shelf.d.ts +8 -0
  16. package/dist/cjs/biz-components/Shelf/index.d.ts +1 -0
  17. package/dist/cjs/biz-components/Shelf/types.d.ts +6 -0
  18. package/dist/cjs/biz-components/ShelfDisplay/tab.d.ts +7 -0
  19. package/dist/cjs/biz-components/Title/index.js +1 -1
  20. package/dist/cjs/biz-components/Title/index.js.map +3 -3
  21. package/dist/cjs/biz-components/Title/types.d.ts +4 -0
  22. package/dist/cjs/biz-components/Title/types.js +1 -1
  23. package/dist/cjs/biz-components/Title/types.js.map +1 -1
  24. package/dist/cjs/components/col.d.ts +29 -0
  25. package/dist/cjs/components/dropdown.d.ts +27 -0
  26. package/dist/cjs/components/row.d.ts +18 -0
  27. package/dist/cjs/helpers/get-subtree.d.ts +12 -0
  28. package/dist/cjs/packages/ui/src/components/avatar.d.ts +26 -0
  29. package/dist/cjs/packages/ui/src/components/index.d.ts +20 -0
  30. package/dist/cjs/packages/ui/src/index.d.ts +1 -0
  31. package/dist/cjs/packages/ui/src/stories/avatar.stories.d.ts +40 -0
  32. package/dist/cjs/packages/ui/src/stories/badge.stories.d.ts +26 -0
  33. package/dist/cjs/packages/ui/src/stories/button.stories.d.ts +48 -0
  34. package/dist/cjs/packages/ui/src/stories/checkbox.stories.d.ts +46 -0
  35. package/dist/cjs/packages/ui/src/stories/container.stories.d.ts +36 -0
  36. package/dist/cjs/packages/ui/src/stories/dialog.stories.d.ts +20 -0
  37. package/dist/cjs/packages/ui/src/stories/grid.stories.d.ts +42 -0
  38. package/dist/cjs/packages/ui/src/stories/heading.stories.d.ts +82 -0
  39. package/dist/cjs/packages/ui/src/stories/input.stories.d.ts +35 -0
  40. package/dist/cjs/packages/ui/src/stories/picture.stories.d.ts +18 -0
  41. package/dist/cjs/packages/ui/src/stories/popover.stories.d.ts +17 -0
  42. package/dist/cjs/packages/ui/src/stories/radio.stories.d.ts +39 -0
  43. package/dist/cjs/packages/ui/src/stories/skeleton.stories.d.ts +20 -0
  44. package/dist/cjs/packages/ui/src/stories/text.stories.d.ts +94 -0
  45. package/dist/cjs/shared/Styles.js +1 -1
  46. package/dist/cjs/shared/Styles.js.map +2 -2
  47. package/dist/cjs/src/components/index.d.ts +21 -0
  48. package/dist/cjs/src/components/input-number.d.ts +47 -0
  49. package/dist/cjs/src/index.d.ts +1 -0
  50. package/dist/cjs/src/stories/avatar.stories.d.ts +40 -0
  51. package/dist/cjs/src/stories/badge.stories.d.ts +26 -0
  52. package/dist/cjs/src/stories/button.stories.d.ts +48 -0
  53. package/dist/cjs/src/stories/checkbox.stories.d.ts +46 -0
  54. package/dist/cjs/src/stories/container.stories.d.ts +36 -0
  55. package/dist/cjs/src/stories/dialog.stories.d.ts +20 -0
  56. package/dist/cjs/src/stories/grid.stories.d.ts +42 -0
  57. package/dist/cjs/src/stories/heading.stories.d.ts +82 -0
  58. package/dist/cjs/src/stories/input-number.stories.d.ts +51 -0
  59. package/dist/cjs/src/stories/input.stories.d.ts +35 -0
  60. package/dist/cjs/src/stories/picture.stories.d.ts +18 -0
  61. package/dist/cjs/src/stories/popover.stories.d.ts +17 -0
  62. package/dist/cjs/src/stories/radio.stories.d.ts +39 -0
  63. package/dist/cjs/src/stories/skeleton.stories.d.ts +20 -0
  64. package/dist/cjs/src/stories/text.stories.d.ts +94 -0
  65. package/dist/cjs/stories/creativeModule.stories.d.ts +18 -0
  66. package/dist/cjs/stories/creativeModule.stories.js +2 -0
  67. package/dist/cjs/stories/creativeModule.stories.js.map +7 -0
  68. package/dist/cjs/stories/shelf.stories.d.ts +17 -0
  69. package/dist/cjs/tailwind.config.d.ts +253 -0
  70. package/dist/cjs/tsconfig.tsbuildinfo +1 -1
  71. package/dist/esm/apps/playground/utils/classnames.d.ts +1 -0
  72. package/dist/esm/biz-components/AccordionCards/useDebounce.d.ts +6 -0
  73. package/dist/esm/biz-components/CreativeModule/index.d.ts +20 -0
  74. package/dist/esm/biz-components/CreativeModule/index.js +2 -0
  75. package/dist/esm/biz-components/CreativeModule/index.js.map +7 -0
  76. package/dist/esm/biz-components/Graphic/index.js +1 -1
  77. package/dist/esm/biz-components/Graphic/index.js.map +2 -2
  78. package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
  79. package/dist/esm/biz-components/MediaPlayerBase/index.js.map +2 -2
  80. package/dist/esm/biz-components/MediaPlayerMulti/YouTubePlayer.d.ts +3 -0
  81. package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
  82. package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js.map +1 -1
  83. package/dist/esm/biz-components/SectionHeading/SectionHeading.d.ts +4 -0
  84. package/dist/esm/biz-components/SectionHeading/types.d.ts +6 -0
  85. package/dist/esm/biz-components/Shelf/Shelf.d.ts +8 -0
  86. package/dist/esm/biz-components/Shelf/index.d.ts +1 -0
  87. package/dist/esm/biz-components/Shelf/types.d.ts +6 -0
  88. package/dist/esm/biz-components/ShelfDisplay/tab.d.ts +7 -0
  89. package/dist/esm/biz-components/Title/index.js +1 -1
  90. package/dist/esm/biz-components/Title/index.js.map +3 -3
  91. package/dist/esm/biz-components/Title/types.d.ts +4 -0
  92. package/dist/esm/components/col.d.ts +29 -0
  93. package/dist/esm/components/dropdown.d.ts +27 -0
  94. package/dist/esm/components/row.d.ts +18 -0
  95. package/dist/esm/helpers/get-subtree.d.ts +12 -0
  96. package/dist/esm/packages/ui/src/components/avatar.d.ts +26 -0
  97. package/dist/esm/packages/ui/src/components/index.d.ts +20 -0
  98. package/dist/esm/packages/ui/src/index.d.ts +1 -0
  99. package/dist/esm/packages/ui/src/stories/avatar.stories.d.ts +40 -0
  100. package/dist/esm/packages/ui/src/stories/badge.stories.d.ts +26 -0
  101. package/dist/esm/packages/ui/src/stories/button.stories.d.ts +48 -0
  102. package/dist/esm/packages/ui/src/stories/checkbox.stories.d.ts +46 -0
  103. package/dist/esm/packages/ui/src/stories/container.stories.d.ts +36 -0
  104. package/dist/esm/packages/ui/src/stories/dialog.stories.d.ts +20 -0
  105. package/dist/esm/packages/ui/src/stories/grid.stories.d.ts +42 -0
  106. package/dist/esm/packages/ui/src/stories/heading.stories.d.ts +82 -0
  107. package/dist/esm/packages/ui/src/stories/input.stories.d.ts +35 -0
  108. package/dist/esm/packages/ui/src/stories/picture.stories.d.ts +18 -0
  109. package/dist/esm/packages/ui/src/stories/popover.stories.d.ts +17 -0
  110. package/dist/esm/packages/ui/src/stories/radio.stories.d.ts +39 -0
  111. package/dist/esm/packages/ui/src/stories/skeleton.stories.d.ts +20 -0
  112. package/dist/esm/packages/ui/src/stories/text.stories.d.ts +94 -0
  113. package/dist/esm/shared/Styles.js +1 -1
  114. package/dist/esm/shared/Styles.js.map +2 -2
  115. package/dist/esm/src/components/index.d.ts +21 -0
  116. package/dist/esm/src/components/input-number.d.ts +47 -0
  117. package/dist/esm/src/index.d.ts +1 -0
  118. package/dist/esm/src/stories/avatar.stories.d.ts +40 -0
  119. package/dist/esm/src/stories/badge.stories.d.ts +26 -0
  120. package/dist/esm/src/stories/button.stories.d.ts +48 -0
  121. package/dist/esm/src/stories/checkbox.stories.d.ts +46 -0
  122. package/dist/esm/src/stories/container.stories.d.ts +36 -0
  123. package/dist/esm/src/stories/dialog.stories.d.ts +20 -0
  124. package/dist/esm/src/stories/grid.stories.d.ts +42 -0
  125. package/dist/esm/src/stories/heading.stories.d.ts +82 -0
  126. package/dist/esm/src/stories/input-number.stories.d.ts +51 -0
  127. package/dist/esm/src/stories/input.stories.d.ts +35 -0
  128. package/dist/esm/src/stories/picture.stories.d.ts +18 -0
  129. package/dist/esm/src/stories/popover.stories.d.ts +17 -0
  130. package/dist/esm/src/stories/radio.stories.d.ts +39 -0
  131. package/dist/esm/src/stories/skeleton.stories.d.ts +20 -0
  132. package/dist/esm/src/stories/text.stories.d.ts +94 -0
  133. package/dist/esm/stories/creativeModule.stories.d.ts +18 -0
  134. package/dist/esm/stories/creativeModule.stories.js +2 -0
  135. package/dist/esm/stories/creativeModule.stories.js.map +7 -0
  136. package/dist/esm/stories/shelf.stories.d.ts +17 -0
  137. package/dist/esm/tailwind.config.d.ts +253 -0
  138. package/dist/esm/tsconfig.tsbuildinfo +1 -1
  139. package/package.json +1 -1
  140. package/dist/cjs/biz-components/WhyChooses/WhyChoose.d.ts +0 -14
  141. package/dist/cjs/biz-components/WhyChooses/index.d.ts +0 -2
  142. package/dist/cjs/biz-components/WhyChooses/types.d.ts +0 -11
  143. package/dist/esm/biz-components/WhyChooses/WhyChoose.d.ts +0 -14
  144. package/dist/esm/biz-components/WhyChooses/index.d.ts +0 -2
  145. package/dist/esm/biz-components/WhyChooses/types.d.ts +0 -11
  146. /package/dist/cjs/biz-components/{Faq/type.d.ts → SectionHeading/index.d.ts} +0 -0
  147. /package/dist/cjs/{biz-components/WhyChoose/type.d.ts → components/inputnumber.d.ts} +0 -0
  148. /package/dist/cjs/hooks/{useExposure.d.ts → useEXposure.d.ts} +0 -0
  149. /package/dist/cjs/stories/{WhyChoose.stories.d.ts → whychoose.stories.d.ts} +0 -0
  150. /package/dist/esm/biz-components/{Faq/type.d.ts → SectionHeading/index.d.ts} +0 -0
  151. /package/dist/esm/{biz-components/WhyChoose/type.d.ts → components/inputnumber.d.ts} +0 -0
  152. /package/dist/esm/hooks/{useExposure.d.ts → useEXposure.d.ts} +0 -0
  153. /package/dist/esm/stories/{WhyChoose.stories.d.ts → whychoose.stories.d.ts} +0 -0
@@ -0,0 +1 @@
1
+ export declare function classNames(...arr: unknown[]): string;
@@ -0,0 +1,6 @@
1
+ type DebounceOptions = {
2
+ leading?: boolean;
3
+ trailing?: boolean;
4
+ };
5
+ export declare function useDebounce<T extends any[]>(func: (...args: T) => void, delay?: number, options?: DebounceOptions): (...args: T) => void;
6
+ export {};
@@ -0,0 +1,20 @@
1
+ import type { Img } from '../../types/props.js';
2
+ export type CreativeModuleDataType = {
3
+ img: Img;
4
+ title: string;
5
+ description: string;
6
+ theme: 'light' | 'dark';
7
+ shape: 'rounded' | 'square';
8
+ span: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12;
9
+ };
10
+ type CreativeModuleType = {
11
+ data: {
12
+ products: CreativeModuleDataType[];
13
+ };
14
+ className?: string;
15
+ };
16
+ declare const _default: import("react").ForwardRefExoticComponent<Omit<CreativeModuleType, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps> & {
17
+ className?: string;
18
+ data?: Record<string, any>;
19
+ } & import("react").RefAttributes<any>>;
20
+ export default _default;
@@ -0,0 +1,2 @@
1
+ "use client";import{Fragment as f,jsx as e,jsxs as a}from"react/jsx-runtime";import{cn as s}from"../../helpers/utils.js";import c from"../SwiperBox/index.js";import{withLayout as n}from"../../shared/Styles.js";import{Grid as u,GridItem as h}from"../../components/gird.js";import{Picture as d,Text as o}from"../../components/index.js";const v=({data:t})=>e("div",{className:s("laptop:h-auto text-info-primary md-tablet:h-[360px] relative flex-1 shrink-0 md:basis-[296px]",{"aiui-dark":t.theme==="dark"}),children:a("div",{className:"absolute inset-0",children:[e(d,{className:"h-full",imgClassName:"h-full object-cover",source:t?.img?.url,alt:t?.img?.alt||""}),a("div",{className:"laptop:p-6 z-1 absolute bottom-0 box-border flex w-full flex-col p-4",children:[e(o,{html:t?.title,className:"graphic-title lg-desktop:text-lg desktop:text-base truncate text-sm font-bold leading-[1.2]"}),t?.description&&e(o,{html:t?.description,className:"graphic-title lg-desktop:text-lg desktop:text-base truncate text-sm font-bold leading-[1.2]"})]})]})}),x=t=>{const{data:p,className:i}=t,{products:r}=p;return a(f,{children:[e("div",{className:"laptop:block box-border hidden w-full overflow-hidden",children:e(u,{className:s("tablet:gap-4 grid grid-cols-12 gap-3 ",i),children:r?.map((l,m)=>a(h,{span:l.span,className:s("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]"),children:[e(d,{source:l.img.url,className:"size-full",imgClassName:"h-full object-cover"}),a("div",{className:"absolute inset-0",children:[e(o,{html:l.title,className:"text-white"}),e(o,{html:l.description,className:"text-white"})]})]},m))})}),e("div",{className:"laptop:hidden block w-full overflow-hidden",children:e(c,{id:"CreativeModule",className:s("!overflow-visible",i),data:{list:r||[]},Slide:v})})]})};var y=n(x);export{y as default};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1,7 @@
1
+ {
2
+ "version": 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 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('laptop:h-auto text-info-primary md-tablet:h-[360px] relative flex-1 shrink-0 md:basis-[296px]', {\n 'aiui-dark': data.theme === 'dark',\n })}\n >\n <div className=\"absolute inset-0\">\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover\"\n source={data?.img?.url}\n alt={data?.img?.alt || ''}\n />\n <div className=\"laptop:p-6 z-1 absolute bottom-0 box-border flex w-full flex-col p-4\">\n <Text\n html={data?.title}\n className=\"graphic-title lg-desktop:text-lg desktop:text-base truncate text-sm font-bold leading-[1.2]\"\n />\n {data?.description && (\n <Text\n html={data?.description}\n className=\"graphic-title lg-desktop:text-lg desktop:text-base truncate text-sm font-bold leading-[1.2]\"\n />\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 '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 >\n <Picture source={item.img.url} className=\"size-full\" imgClassName=\"h-full object-cover\" />\n <div className=\"absolute inset-0\">\n <Text html={item.title} className=\"text-white\" />\n <Text html={item.description} className=\"text-white\" />\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 />\n </div>\n </>\n )\n}\n\nexport default withLayout(CreativeModule)\n"],
5
+ "mappings": "aAgCQ,OA4BJ,YAAAA,EA5BI,OAAAC,EAMA,QAAAC,MANA,oBA/BR,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAe,wBAEtB,OAAS,cAAAC,MAAkB,yBAC3B,OAAS,QAAAC,EAAM,YAAAC,MAAgB,2BAC/B,OAAS,WAAAC,EAAS,QAAAC,MAAY,4BAkB9B,MAAMC,EAAO,CAAC,CAAE,KAAAC,CAAK,IAEjBV,EAAC,OACC,UAAWE,EAAG,gGAAiG,CAC7G,YAAaQ,EAAK,QAAU,MAC9B,CAAC,EAED,SAAAT,EAAC,OAAI,UAAU,mBACb,UAAAD,EAACO,EAAA,CACC,UAAU,SACV,aAAa,sBACb,OAAQG,GAAM,KAAK,IACnB,IAAKA,GAAM,KAAK,KAAO,GACzB,EACAT,EAAC,OAAI,UAAU,uEACb,UAAAD,EAACQ,EAAA,CACC,KAAME,GAAM,MACZ,UAAU,8FACZ,EACCA,GAAM,aACLV,EAACQ,EAAA,CACC,KAAME,GAAM,YACZ,UAAU,8FACZ,GAEJ,GACF,EACF,EAIEC,EAAkBC,GAA8B,CACpD,KAAM,CAAE,KAAAF,EAAM,UAAAG,CAAU,EAAID,EACtB,CAAE,SAAAE,CAAS,EAAIJ,EAErB,OACET,EAAAF,EAAA,CACE,UAAAC,EAAC,OAAI,UAAU,wDACb,SAAAA,EAACK,EAAA,CAAK,UAAWH,EAAG,wCAAyCW,CAAS,EACnE,SAAAC,GAAU,IAAI,CAACC,EAAMC,IAElBf,EAACK,EAAA,CAEC,KAAMS,EAAK,KACX,UAAWb,EACT,kCACAa,EAAK,QAAU,UAAY,cAAgB,eAC3C,qEACF,EAEA,UAAAf,EAACO,EAAA,CAAQ,OAAQQ,EAAK,IAAI,IAAK,UAAU,YAAY,aAAa,sBAAsB,EACxFd,EAAC,OAAI,UAAU,mBACb,UAAAD,EAACQ,EAAA,CAAK,KAAMO,EAAK,MAAO,UAAU,aAAa,EAC/Cf,EAACQ,EAAA,CAAK,KAAMO,EAAK,YAAa,UAAU,aAAa,GACvD,IAZKC,CAaP,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,EACT,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
+ }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as t,jsxs as p}from"react/jsx-runtime";import T,{useEffect as N,useImperativeHandle as M,useRef as P,useState as c}from"react";import{cn as m}from"../../helpers/utils.js";import{withLayout as V}from"../../shared/Styles.js";import C from"../SwiperBox/index.js";import{Button as B,Heading as G}from"../../components/index.js";import{Picture as S,Text as E}from"../../components/index.js";import H from"../Title/index.js";import{VideoModal as I}from"../VideoModal/index.js";import{useExposure as L}from"../../hooks/useExposure.js";import{trackUrlRef as f}from"../../shared/trackUrlRef.js";const d="image",h="graphic",D=({data:e,configuration:i})=>t("div",{className:m((()=>{switch(i.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]"}})(),"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:m("absolute inset-0",{"rounded-xl overflow-hidden laptop:rounded-2xl":i?.itemShape==="round"}),children:p("a",{"aria-label":e?.title??e?.description,href:f(e?.href,`${d}_${h}`),className:"relative block size-full cursor-pointer overflow-hidden",children:[t(S,{className:"h-full",imgClassName:"h-full object-cover tablet:hover:scale-110 transition-all duration-300",source:e?.imgUrl?.url,alt:e?.imgUrl?.alt||""}),p("div",{className:"laptop:p-6 absolute bottom-0 z-[1] box-border flex w-full flex-col p-4",children:[t(E,{style:{color:e?.textColor},html:e?.title,className:"graphic-title line-clamp-3 lg-desktop:text-[18px] desktop:text-[16px] text-[14px] font-bold leading-[1.2]"}),p("div",{className:"flex items-end justify-between",children:[t("div",{className:"flex-1",children:e?.description&&t(G,{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?.video?.url||e?.youtubeId)&&t("button",{"aria-label":"Play Video",onClick:r=>{r.preventDefault(),r.stopPropagation(),i?.onVideoPlayBtnClick?.(i?.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.buttonText&&t(B,{"aria-label":e?.title??e?.description,variant:"secondary",className:"desktop:mt-[24px] mt-[12px] self-start",as:"a",href:f(e?.href,`${d}_${h}`),children:e.buttonText})]})]})})}),b=T.forwardRef(({data:e,className:i,...g},r)=>{const a=P(null),[w,u]=c(!1),[x,v]=c(""),[k,y]=c(""),n=o=>{const s=e?.items?.length>3,l=e?.items?.length>2;switch(o){case 1440:return s?4:e?.items?.length;case 1024:return s?3:e?.items?.length;case 768:return s||l?2.3:2;default:return 1.2}};return M(r,()=>a.current),L(a,{componentType:d,componentName:h,componentTitle:e?.title}),N(()=>{const o=a.current?.querySelectorAll(".graphic-description");if(o&&o.length>0){let s=0;o.forEach(l=>{s=Math.max(s,l.offsetHeight)}),o.forEach(l=>{l.style.height=`${s}px`})}},[]),p("div",{className:i,ref:a,children:[p("div",{className:"graphic-box",children:[e?.title&&t(H,{data:{title:e?.title}}),t(C,{id:"Graphic",className:m("!overflow-visible"),data:{list:e?.items||[],configuration:{itemShape:e.itemShape,num:e?.items?.length||0,onVideoPlayBtnClick:(o,s)=>{u(!0),s?.isYouTube?y?.(s?.youtubeId||""):v?.(s?.video?.url||"")}}},Slide:D,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:n()},768:{spaceBetween:16,freeMode:!1,slidesPerView:n(768)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:n(1024)},1440:{spaceBetween:16,freeMode:!1,slidesPerView:n(1440)}}})]}),t(I,{visible:w,youTubeId:k,videoUrl:x,onCloseModal:()=>u(!1)})]})});b.displayName="Graphic";var F=V(b);export{F as default};
1
+ "use client";import{jsx as t,jsxs as l}from"react/jsx-runtime";import T,{useEffect as N,useImperativeHandle as M,useRef as P,useState as m}from"react";import{cn as c}from"../../helpers/utils.js";import{withLayout as V}from"../../shared/Styles.js";import C from"../SwiperBox/index.js";import{Button as B,Heading as G}from"../../components/index.js";import{Picture as S,Text as E}from"../../components/index.js";import H from"../Title/index.js";import{VideoModal as I}from"../VideoModal/index.js";import{useExposure as L}from"../../hooks/useExposure.js";import{trackUrlRef as f}from"../../shared/trackUrlRef.js";const d="image",h="graphic",D=({data:e,configuration:i})=>t("div",{className:c((()=>{switch(i.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]"}})(),"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:c("absolute inset-0",{"rounded-xl overflow-hidden laptop:rounded-2xl":i?.itemShape==="round"}),children:l("a",{"aria-label":e?.title??e?.description,href:f(e?.href,`${d}_${h}`),className:"relative block size-full cursor-pointer overflow-hidden",children:[t(S,{className:"h-full",imgClassName:"h-full object-cover tablet:hover:scale-110 transition-all duration-300",source:e?.imgUrl?.url,alt:e?.imgUrl?.alt||""}),l("div",{className:"laptop:p-6 absolute bottom-0 z-[1] box-border flex w-full flex-col p-4",children:[l("div",{className:c("flex items-end overflow-hidden","graphic-bottom"),children:[l("div",{className:"flex-1 overflow-hidden",children:[t(E,{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(G,{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?.video?.url||e?.youtubeId)&&t("button",{"aria-label":"Play Video",onClick:r=>{r.preventDefault(),r.stopPropagation(),i?.onVideoPlayBtnClick?.(i?.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.buttonText&&t(B,{as:"a","aria-label":e?.title??e?.description,variant:"secondary",className:"desktop:mt-[24px] mt-[12px] self-start",href:f(e?.href,`${d}_${h}`),children:e.buttonText})]})]})})}),b=T.forwardRef(({data:e,className:i,...g},r)=>{const a=P(null),[w,u]=m(!1),[v,x]=m(""),[k,y]=m(""),n=o=>{const s=e?.items?.length>3,p=e?.items?.length>2;switch(o){case 1440:return s?4:e?.items?.length;case 1024:return s?3:e?.items?.length;case 768:return s||p?2.3:2;default:return 1.2}};return M(r,()=>a.current),L(a,{componentType:d,componentName:h,componentTitle:e?.title}),N(()=>{const o=a.current?.querySelectorAll(".graphic-description");if(o&&o.length>0){let s=0;o.forEach(p=>{s=Math.max(s,p.offsetHeight)}),o.forEach(p=>{p.style.height=`${s}px`})}},[]),l("div",{className:i,ref:a,children:[l("div",{className:"graphic-box",children:[e?.title&&t(H,{data:{title:e?.title}}),t(C,{id:"Graphic",className:c("!overflow-visible"),data:{list:e?.items||[],configuration:{itemShape:e.itemShape,num:e?.items?.length||0,onVideoPlayBtnClick:(o,s)=>{u(!0),s?.isYouTube?y?.(s?.youtubeId||""):x?.(s?.video?.url||"")}}},Slide:D,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:n()},768:{spaceBetween:16,freeMode:!1,slidesPerView:n(768)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:n(1024)},1440:{spaceBetween:16,freeMode:!1,slidesPerView:n(1440)}}})]}),t(I,{visible:w,youTubeId:k,videoUrl:v,onCloseModal:()=>u(!1)})]})});b.displayName="Graphic";var F=V(b);export{F 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 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 youtubeId?: string\n isYouTube?: boolean\n buttonText?: string\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 <Text\n style={{\n color: data?.textColor,\n }}\n html={data?.title}\n // eslint-disable-next-line tailwindcss/classnames-order\n className=\"graphic-title line-clamp-3 lg-desktop:text-[18px] desktop:text-[16px] text-[14px] font-bold leading-[1.2]\"\n />\n <div className=\"flex items-end justify-between\">\n <div className=\"flex-1\">\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?.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 </div>\n {data.buttonText && (\n <Button\n aria-label={data?.title ?? data?.description}\n variant=\"secondary\"\n className=\"desktop:mt-[24px] mt-[12px] self-start\"\n as=\"a\"\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, ...props }, ref) => {\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\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 }\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 visible={visible} youTubeId={youTubeId} videoUrl={videoUrl} onCloseModal={() => setVisible(false)} />\n </div>\n )\n})\n\nGraphic.displayName = 'Graphic'\n\nexport default withLayout(Graphic)\n"],
5
- "mappings": "aAwEU,cAAAA,EAeE,QAAAC,MAfF,oBAvEV,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,WA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ffect, 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 youtubeId?: string\n isYouTube?: boolean\n buttonText?: string\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?.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 </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, ...props }, ref) => {\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\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 }\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 visible={visible} youTubeId={youTubeId} videoUrl={videoUrl} onCloseModal={() => setVisible(false)} />\n </div>\n )\n})\n\nGraphic.displayName = 'Graphic'\n\nexport default withLayout(Graphic)\n"],
5
+ "mappings": "aAwEU,cAAAA,EAQI,QAAAC,MARJ,oBAvEV,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,yBAE3B,OAAS,eAAAC,MAAmB,6BAC5B,OAAS,eAAAC,MAAmB,8BAE5B,MAAMC,EAAgB,QAChBC,EAAgB,UAwBhBC,EAAO,CAAC,CAAE,KAAAC,EAAM,cAAAC,CAAc,IAehCtB,EAAC,OACC,UAAWO,GAfM,IAAM,CACzB,OAAQe,EAAc,IAAK,CACzB,IAAK,GACH,MAAO,8LACT,IAAK,GACH,MAAO,4LACT,IAAK,GACH,MAAO,4LACT,QACE,MAAO,2LACX,CACF,GAKmB,EACb,uFACA,CACE,YAAaD,EAAK,QAAU,MAC9B,CACF,EAEA,SAAArB,EAAC,OACC,UAAWO,EA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EACtB,cAAe,CACb,UAAWA,EAAK,UAChB,IAAKA,GAAM,OAAO,QAAU,EAC5B,oBAAqB,CAACqB,EAAWrB,IAAsB,CACrDS,EAAW,EAAI,EACXT,GAAM,UACRa,IAAeb,GAAM,WAAa,EAAE,EAEpCW,IAAcX,GAAM,OAAO,KAAO,EAAE,CAExC,CACF,CACF,EACA,MAAOD,EACP,YAAa,CACX,EAAG,CACD,aAAc,GACd,SAAU,GACV,cAAe,CACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAee,EAAiB,CAClC,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAeA,EAAiB,GAAG,CACrC,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAeA,EAAiB,IAAI,CACtC,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAeA,EAAiB,IAAI,CACtC,CACF,EACF,GACF,EACAnC,EAACe,EAAA,CAAW,QAASc,EAAS,UAAWI,EAAW,SAAUF,EAAU,aAAc,IAAMD,EAAW,EAAK,EAAG,GACjH,CAEJ,CAAC,EAEDN,EAAQ,YAAc,UAEtB,IAAOmB,EAAQnC,EAAWgB,CAAO",
6
6
  "names": ["jsx", "jsxs", "React", "useEffect", "useImperativeHandle", "useRef", "useState", "cn", "withLayout", "SwiperBox", "Button", "Heading", "Picture", "Text", "Title", "VideoModal", "useExposure", "trackUrlRef", "componentType", "componentName", "Item", "data", "configuration", "e", "Graphic", "className", "props", "ref", "innerRef", "visible", "setVisible", "videoUrl", "setVideoUrl", "youTubeId", "setYouTubeId", "handleSwiperShow", "width", "isShow", "isMobile", "descriptions", "maxHeight", "el", "_", "Graphic_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{Fragment as ye,jsx as e,jsxs as c}from"react/jsx-runtime";import{useState as y,useRef as r,useEffect as R,forwardRef as se,useImperativeHandle as le}from"react";import{debounce as ae}from"lodash";import{cn as b}from"../../helpers/utils.js";import{withLayout as ie}from"../../shared/Styles.js";import ce from"../../components/button.js";import{VideoModal as de}from"../VideoModal/index.js";import{convertLexicalToHTML as O}from"@payloadcms/richtext-lexical/html";import{useInView as pe}from"react-intersection-observer";import{useExposure as ue}from"../../hooks/useExposure.js";import U from"../../helpers/ScrollLoadVideo.js";import{gsap as E}from"gsap";import{SplitText as me}from"gsap/dist/SplitText";import{ScrollTrigger as fe}from"gsap/dist/ScrollTrigger";const ge="media_player_base",ve="video",G=({defaultConverters:h})=>({...h,text:d=>{const{node:t}=d;return t.$&&t.$.color?`<span class="lexical-${t.$.color}">${t.text}</span>`:t.text}}),xe=se(({className:h="",onBtnClick:d,data:{title:t,videoTitle:p,btnText:z,youtubeId:I,video:_,mobileVideo:J,theme:P,img:S,shape:$,titleAnimation:u,...K}},Q)=>{const{sticky:s}=K,[B,C]=y(!1),[V,W]=y(0),[X,Z]=y(0),[D,F]=y(!1),m=r(null),j=r(null),o=r(null),f=r(null),Y=r(null),g=r(null),w=r(null),{ref:A,inView:v}=pe();le(Q,()=>o.current);const x=typeof t=="string"?t:t&&O({data:t,converters:G}),H=typeof p=="string"?p:p&&O({data:p,converters:G});R(()=>{v?(m.current?.play(),C(!0)):(m.current?.pause(),C(!1))},[v]);const T=ae(()=>{if(o.current){const l=o.current.getBoundingClientRect(),n=window.innerHeight,a=window.scrollY||window.pageYOffset,M=l.bottom+a,i=document.documentElement.scrollHeight-M;W(i>n?n:i)}if(o.current){const l=o.current.clientHeight,n=window.innerHeight;Z(l+n)}},600);R(()=>(T(),window.addEventListener("resize",T),()=>{window.removeEventListener("resize",T)}),[]),R(()=>{function l(){if(!f.current||u!=="fade-in")return;const n=f.current?.clientHeight||80;g.current=new me(f.current,{type:"words",wordsClass:"word"});const a=g.current.words;E.set(a,{opacity:0}),w.current=fe.create({trigger:o.current,start:"top center-=10%",end:`top+=${n*1.5+80}px center-=10%`,scrub:!0,onUpdate:M=>{const L=M.progress,i=a.length,ee=1/i,q=.5;a.forEach((te,oe)=>{const re=oe/i*(1-q),ne=ee*(1+q);let N=(L-re)/ne;N=Math.max(0,Math.min(N,1)),E.set(te,{opacity:N})}),E.set(j.current,{opacity:L})}})}return v&&l(),()=>{g.current&&g.current.revert(),w.current&&w.current.kill()}},[u,v]),ue(Y,{componentType:ve,componentName:ge,componentTitle:H});const k="lg-desktop:aspect-w-[1920] lg-desktop:aspect-h-[930] desktop:aspect-w-[1024] desktop:aspect-h-[520] laptop:aspect-w-[1024] laptop:aspect-h-[520] tablet:aspect-w-[768] tablet:aspect-h-[660] aspect-w-[390] aspect-h-[660]";return c(ye,{children:[s&&e("div",{ref:o,className:b("relative z-10 ",k,{"aiui-dark":P==="dark","rounded-box":$==="rounded"},h),children:e("div",{ref:A,children:!u&&c("div",{className:"media-content absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 px-4 text-center",children:[x&&!B&&e("div",{className:"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:x}}),H&&B&&e("div",{className:"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:H}}),z&&e(ce,{variant:"link",className:b("member-equity-button-secondary text-btn-primary-foreground"),onClick:()=>{F(!0),d&&d?.()},children:z})]})})}),c("div",{style:s?{marginBottom:`-${V}px`,marginTop:`-${X}px`}:{},className:"relative",children:[e("div",{className:"sticky top-0 ",children:c("div",{className:b("relative overflow-hidden",s?"h-screen w-full":k,{"aiui-dark":P==="dark","rounded-box":$==="rounded"}),children:[u==="fade-in"&&x&&e("div",{ref:f,className:"lg-desktop:text-[64px] text-btn-primary-foreground absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:x}}),c("div",{className:"media-cover left-0 top-0 h-screen w-screen",children:[e(U,{videoRef:m,poster:S?.url||"",src:_?.url,className:"tablet:block hidden size-full",videoClassName:"object-cover",muted:!0,loop:!0,playsInline:!0,autoplay:!0,"webkit-playsinline":!0,"x5-playsinline":!0}),e(U,{videoRef:m,poster:S?.url||"",src:J?.url||_?.url,className:"tablet:hidden block size-full",videoClassName:"object-cover",muted:!0,loop:!0,playsInline:!0,autoplay:!0,"webkit-playsinline":!0,"x5-playsinline":!0}),e("div",{ref:j,className:"absolute left-0 top-0 z-10 size-full opacity-0",style:{background:"rgba(0, 0, 0, 0.2)"}})]})]})}),e("div",{className:b(s&&"relative box-content block",k),style:s?{height:`${V}px`}:{},ref:Y})]}),D&&I&&e(de,{visible:D,youTubeId:I,onCloseModal:()=>F(!1)})]})});var _e=ie(xe);export{_e as default};
1
+ "use client";import{Fragment as ye,jsx as e,jsxs as c}from"react/jsx-runtime";import{useState as y,useRef as r,useEffect as R,forwardRef as se,useImperativeHandle as le}from"react";import{debounce as ae}from"lodash";import{cn as b}from"../../helpers/utils.js";import{withLayout as ie}from"../../shared/Styles.js";import ce from"../../components/button.js";import{VideoModal as de}from"../VideoModal/index.js";import{convertLexicalToHTML as O}from"@payloadcms/richtext-lexical/html";import{useInView as pe}from"react-intersection-observer";import{useExposure as ue}from"../../hooks/useExposure.js";import U from"../../helpers/ScrollLoadVideo.js";import{gsap as E}from"gsap";import{SplitText as me}from"gsap/dist/SplitText";import{ScrollTrigger as fe}from"gsap/dist/ScrollTrigger";const ge="media_player_base",ve="video",G=({defaultConverters:h})=>({...h,text:d=>{const{node:t}=d;return t.$&&t.$.color?`<span class="lexical-${t.$.color}">${t.text}</span>`:t.text}}),xe=se(({className:h="",onBtnClick:d,data:{title:t,videoTitle:p,btnText:z,youtubeId:I,video:_,mobileVideo:J,theme:P,img:S,shape:$,titleAnimation:u,...K}},Q)=>{const{sticky:s}=K,[B,C]=y(!1),[V,W]=y(0),[X,Z]=y(0),[D,F]=y(!1),m=r(null),j=r(null),o=r(null),f=r(null),Y=r(null),g=r(null),w=r(null),{ref:A,inView:v}=pe();le(Q,()=>o.current);const x=typeof t=="string"?t:t&&O({data:t,converters:G}),H=typeof p=="string"?p:p&&O({data:p,converters:G});R(()=>{v?(m.current?.play(),C(!0)):(m.current?.pause(),C(!1))},[v]);const T=ae(()=>{if(o.current){const l=o.current.getBoundingClientRect(),n=window.innerHeight,a=window.scrollY||window.pageYOffset,M=l.bottom+a,i=document.documentElement.scrollHeight-M;W(i>n?n:i)}if(o.current){const l=o.current.clientHeight,n=window.innerHeight;Z(l+n)}},600);R(()=>(T(),window.addEventListener("resize",T),()=>{window.removeEventListener("resize",T)}),[]),R(()=>{function l(){if(!f.current||u!=="fade-in")return;const n=f.current?.clientHeight||80;g.current=new me(f.current,{type:"words",wordsClass:"word"});const a=g.current.words;E.set(a,{opacity:0}),w.current=fe.create({trigger:o.current,start:"top center-=10%",end:`top+=${n*1.5+80}px center-=10%`,scrub:!0,onUpdate:M=>{const L=M.progress,i=a.length,ee=1/i,q=.5;a.forEach((te,oe)=>{const re=oe/i*(1-q),ne=ee*(1+q);let N=(L-re)/ne;N=Math.max(0,Math.min(N,1)),E.set(te,{opacity:N})}),E.set(j.current,{opacity:L})}})}return v&&l(),()=>{g.current&&g.current.revert(),w.current&&w.current.kill()}},[u,v]),ue(Y,{componentType:ve,componentName:ge,componentTitle:H});const k="lg-desktop:aspect-w-[1920] lg-desktop:aspect-h-[930] desktop:aspect-w-[1024] desktop:aspect-h-[520] laptop:aspect-w-[1024] laptop:aspect-h-[520] tablet:aspect-w-[768] tablet:aspect-h-[660] aspect-w-[390] aspect-h-[660]";return c(ye,{children:[s&&e("div",{ref:o,className:b("relative z-10",k,{"aiui-dark":P==="dark","rounded-box":$==="rounded"},h),children:e("div",{ref:A,children:!u&&c("div",{className:"media-content absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 px-4 text-center",children:[x&&!B&&e("div",{className:"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:x}}),H&&B&&e("div",{className:"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:H}}),z&&e(ce,{variant:"link",className:b("member-equity-button-secondary text-btn-primary-foreground"),onClick:()=>{F(!0),d&&d?.()},children:z})]})})}),c("div",{style:s?{marginBottom:`-${V}px`,marginTop:`-${X}px`}:{},className:"relative",children:[e("div",{className:"sticky top-0 ",children:c("div",{className:b("relative overflow-hidden",s?"h-screen w-full":k,{"aiui-dark":P==="dark","rounded-box":$==="rounded"}),children:[u==="fade-in"&&x&&e("div",{ref:f,className:"lg-desktop:text-[64px] text-btn-primary-foreground absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 text-center text-[40px] font-bold leading-none lg:text-5xl",dangerouslySetInnerHTML:{__html:x}}),c("div",{className:"media-cover left-0 top-0 h-screen w-screen",children:[e(U,{videoRef:m,poster:S?.url||"",src:_?.url,className:"tablet:block hidden size-full",videoClassName:"object-cover",muted:!0,loop:!0,playsInline:!0,autoplay:!0,"webkit-playsinline":!0,"x5-playsinline":!0}),e(U,{videoRef:m,poster:S?.url||"",src:J?.url||_?.url,className:"tablet:hidden block size-full",videoClassName:"object-cover",muted:!0,loop:!0,playsInline:!0,autoplay:!0,"webkit-playsinline":!0,"x5-playsinline":!0}),e("div",{ref:j,className:"absolute left-0 top-0 z-10 size-full opacity-0",style:{background:"rgba(0, 0, 0, 0.2)"}})]})]})}),e("div",{className:b(s&&"relative box-content block",k),style:s?{height:`${V}px`}:{},ref:Y})]}),D&&I&&e(de,{visible:D,youTubeId:I,onCloseModal:()=>F(!1)})]})});var _e=ie(xe);export{_e as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/MediaPlayerBase/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport { useState, useRef, useEffect, forwardRef, useImperativeHandle } from 'react'\nimport { debounce } from 'lodash'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport Button from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport { convertLexicalToHTML } from '@payloadcms/richtext-lexical/html'\nimport type { MediaPlayerBaseProps } from './types.js'\n// import { Right } from './right.js'\nimport { useInView } from 'react-intersection-observer'\nimport type { HTMLConvertersFunction } from '@payloadcms/richtext-lexical/html'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\n\nconst componentName = 'media_player_base'\nconst componentType = 'video'\n\nconst htmlConverters: HTMLConvertersFunction = ({ defaultConverters }) => ({\n ...defaultConverters,\n text: args => {\n const { node } = args\n // \u68C0\u67E5\u662F\u5426\u6709\u81EA\u5B9A\u4E49 color\n if (node.$ && node.$.color) {\n return `<span class=\"lexical-${node.$.color}\">${node.text}</span>`\n }\n return node.text\n },\n})\n\nconst MediaPlayerBase = forwardRef<HTMLDivElement, MediaPlayerBaseProps>(\n (\n {\n className = '',\n onBtnClick,\n data: { title, videoTitle, btnText, youtubeId, video, mobileVideo, theme, img, shape, titleAnimation, ...rest },\n },\n ref\n ) => {\n const { sticky } = rest\n const [isPlaying, setIsPlaying] = useState(false)\n const [btb, setbtb] = useState(0)\n const [titleHeight, setTitleHeight] = useState(0)\n const [visible, setVisible] = useState<boolean>(false)\n\n const videoRef = useRef<HTMLVideoElement>(null)\n const bgRef = useRef<HTMLImageElement>(null)\n const titleRef = useRef<HTMLDivElement>(null)\n const titleFadeInRef = useRef<HTMLDivElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => titleRef.current as HTMLDivElement)\n\n const title_html =\n typeof title === 'string' ? title : title && convertLexicalToHTML({ data: title, converters: htmlConverters })\n const videoTitle_html =\n typeof videoTitle === 'string'\n ? videoTitle\n : videoTitle && convertLexicalToHTML({ data: videoTitle, converters: htmlConverters })\n\n useEffect(() => {\n if (inView) {\n videoRef.current?.play()\n setIsPlaying(true)\n } else {\n videoRef.current?.pause()\n setIsPlaying(false)\n }\n }, [inView])\n\n const debouncedHandleResize = debounce(() => {\n if (titleRef.current) {\n const rect = titleRef.current.getBoundingClientRect()\n const screenHeight = window.innerHeight\n const scrollTop = window.scrollY || window.pageYOffset\n const elementBottomToPageTop = rect.bottom + scrollTop\n const pageHeight = document.documentElement.scrollHeight\n const distanceToPageBottom = pageHeight - elementBottomToPageTop\n setbtb(distanceToPageBottom > screenHeight ? screenHeight : distanceToPageBottom)\n }\n if (titleRef.current) {\n const titleHeight = titleRef.current.clientHeight\n const screenHeight = window.innerHeight\n setTitleHeight(titleHeight + screenHeight)\n }\n }, 600)\n\n useEffect(() => {\n debouncedHandleResize()\n window.addEventListener('resize', debouncedHandleResize)\n return () => {\n window.removeEventListener('resize', debouncedHandleResize)\n }\n }, [])\n\n useEffect(() => {\n function gsapResize() {\n if (!titleFadeInRef.current || titleAnimation !== 'fade-in') return\n const height = titleFadeInRef.current?.clientHeight || 80\n splitTextInstance.current = new SplitText(titleFadeInRef.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: 'top center-=10%',\n end: `top+=${height * 1.5 + 80}px center-=10%`,\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 gsap.set(bgRef.current, { opacity: progress })\n },\n })\n }\n\n if (inView) gsapResize()\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 }, [titleAnimation, inView])\n\n useExposure(trackRef, {\n componentType,\n componentName,\n componentTitle: videoTitle_html,\n })\n\n const aspect =\n 'lg-desktop:aspect-w-[1920] lg-desktop:aspect-h-[930] desktop:aspect-w-[1024] desktop:aspect-h-[520] laptop:aspect-w-[1024] laptop:aspect-h-[520] tablet:aspect-w-[768] tablet:aspect-h-[660] aspect-w-[390] aspect-h-[660]'\n return (\n <>\n {sticky && (\n <div\n ref={titleRef}\n className={cn(\n 'relative z-10 ',\n aspect,\n {\n 'aiui-dark': theme === 'dark',\n 'rounded-box': shape === 'rounded',\n },\n className\n )}\n >\n <div ref={inViewRef}>\n {!titleAnimation && (\n <div className=\"media-content absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 px-4 text-center\">\n {title_html && !isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n {videoTitle_html && isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: videoTitle_html }}\n />\n )}\n {btnText && (\n <Button\n variant=\"link\"\n className={cn('member-equity-button-secondary text-btn-primary-foreground')}\n onClick={() => {\n setVisible(true)\n // if (isPlaying) {\n // if (videoRef.current) {\n // videoRef.current.pause()\n // }\n // setIsPlaying(false)\n // } else {\n // if (videoRef.current) {\n // videoRef.current.play()\n // }\n // setIsPlaying(true)\n // }\n onBtnClick && onBtnClick?.()\n }}\n >\n {btnText}\n {/* <Right /> */}\n </Button>\n )}\n </div>\n )}\n </div>\n </div>\n )}\n <div style={sticky ? { marginBottom: `-${btb}px`, marginTop: `-${titleHeight}px` } : {}} className=\"relative\">\n <div className=\"sticky top-0 \">\n <div\n className={cn('relative overflow-hidden', sticky ? 'h-screen w-full' : aspect, {\n 'aiui-dark': theme === 'dark',\n 'rounded-box': shape === 'rounded',\n })}\n >\n {titleAnimation === 'fade-in' && title_html && (\n <div\n ref={titleFadeInRef}\n className=\"lg-desktop:text-[64px] text-btn-primary-foreground absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n <div className=\"media-cover left-0 top-0 h-screen w-screen\">\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={video?.url!}\n className=\"tablet:block hidden size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={mobileVideo?.url || video?.url!}\n className=\"tablet:hidden block size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n <div\n ref={bgRef}\n className=\"absolute left-0 top-0 z-10 size-full opacity-0\"\n style={{\n background: 'rgba(0, 0, 0, 0.2)',\n }}\n />\n </div>\n </div>\n </div>\n <div\n className={cn(sticky && 'relative box-content block', aspect)}\n style={sticky ? { height: `${btb}px` } : {}}\n ref={trackRef}\n />\n </div>\n {visible && youtubeId && (\n <VideoModal visible={visible} youTubeId={youtubeId} onCloseModal={() => setVisible(false)} />\n )}\n </>\n )\n }\n)\n\nexport default withLayout(MediaPlayerBase)\n"],
5
- "mappings": "aAuJM,mBAAAA,GAkBc,OAAAC,EAFJ,QAAAC,MAhBV,oBAtJN,OAAS,YAAAC,EAAU,UAAAC,EAAQ,aAAAC,EAAW,cAAAC,GAAY,uBAAAC,OAA2B,QAC7E,OAAS,YAAAC,OA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AAGG,CAAG,IAAK,EAAI,CAAC,EAC1C,IAAKU,EACP,GACF,EACCN,GAAWhB,GACV/B,EAACW,GAAA,CAAW,QAASoC,EAAS,UAAWhB,EAAW,aAAc,IAAMiB,EAAW,EAAK,EAAG,GAE/F,CAEJ,CACF,EAEA,IAAOgC,GAAQvE,GAAWgB,EAAe",
4
+ "sourcesContent": ["'use client'\nimport { useState, useRef, useEffect, forwardRef, useImperativeHandle } from 'react'\nimport { debounce } from 'lodash'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport Button from '../../components/button.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport { convertLexicalToHTML } from '@payloadcms/richtext-lexical/html'\nimport type { MediaPlayerBaseProps } from './types.js'\n// import { Right } from './right.js'\nimport { useInView } from 'react-intersection-observer'\nimport type { HTMLConvertersFunction } from '@payloadcms/richtext-lexical/html'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport ScrollLoadVideo from '../../helpers/ScrollLoadVideo.js'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\n\nconst componentName = 'media_player_base'\nconst componentType = 'video'\n\nconst htmlConverters: HTMLConvertersFunction = ({ defaultConverters }) => ({\n ...defaultConverters,\n text: args => {\n const { node } = args\n // \u68C0\u67E5\u662F\u5426\u6709\u81EA\u5B9A\u4E49 color\n if (node.$ && node.$.color) {\n return `<span class=\"lexical-${node.$.color}\">${node.text}</span>`\n }\n return node.text\n },\n})\n\nconst MediaPlayerBase = forwardRef<HTMLDivElement, MediaPlayerBaseProps>(\n (\n {\n className = '',\n onBtnClick,\n data: { title, videoTitle, btnText, youtubeId, video, mobileVideo, theme, img, shape, titleAnimation, ...rest },\n },\n ref\n ) => {\n const { sticky } = rest\n const [isPlaying, setIsPlaying] = useState(false)\n const [btb, setbtb] = useState(0)\n const [titleHeight, setTitleHeight] = useState(0)\n const [visible, setVisible] = useState<boolean>(false)\n\n const videoRef = useRef<HTMLVideoElement>(null)\n const bgRef = useRef<HTMLImageElement>(null)\n const titleRef = useRef<HTMLDivElement>(null)\n const titleFadeInRef = useRef<HTMLDivElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => titleRef.current as HTMLDivElement)\n\n const title_html =\n typeof title === 'string' ? title : title && convertLexicalToHTML({ data: title, converters: htmlConverters })\n const videoTitle_html =\n typeof videoTitle === 'string'\n ? videoTitle\n : videoTitle && convertLexicalToHTML({ data: videoTitle, converters: htmlConverters })\n\n useEffect(() => {\n if (inView) {\n videoRef.current?.play()\n setIsPlaying(true)\n } else {\n videoRef.current?.pause()\n setIsPlaying(false)\n }\n }, [inView])\n\n const debouncedHandleResize = debounce(() => {\n if (titleRef.current) {\n const rect = titleRef.current.getBoundingClientRect()\n const screenHeight = window.innerHeight\n const scrollTop = window.scrollY || window.pageYOffset\n const elementBottomToPageTop = rect.bottom + scrollTop\n const pageHeight = document.documentElement.scrollHeight\n const distanceToPageBottom = pageHeight - elementBottomToPageTop\n setbtb(distanceToPageBottom > screenHeight ? screenHeight : distanceToPageBottom)\n }\n if (titleRef.current) {\n const titleHeight = titleRef.current.clientHeight\n const screenHeight = window.innerHeight\n setTitleHeight(titleHeight + screenHeight)\n }\n }, 600)\n\n useEffect(() => {\n debouncedHandleResize()\n window.addEventListener('resize', debouncedHandleResize)\n return () => {\n window.removeEventListener('resize', debouncedHandleResize)\n }\n }, [])\n\n useEffect(() => {\n function gsapResize() {\n if (!titleFadeInRef.current || titleAnimation !== 'fade-in') return\n const height = titleFadeInRef.current?.clientHeight || 80\n splitTextInstance.current = new SplitText(titleFadeInRef.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: 'top center-=10%',\n end: `top+=${height * 1.5 + 80}px center-=10%`,\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 gsap.set(bgRef.current, { opacity: progress })\n },\n })\n }\n\n if (inView) gsapResize()\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 }, [titleAnimation, inView])\n\n useExposure(trackRef, {\n componentType,\n componentName,\n componentTitle: videoTitle_html,\n })\n\n const aspect =\n 'lg-desktop:aspect-w-[1920] lg-desktop:aspect-h-[930] desktop:aspect-w-[1024] desktop:aspect-h-[520] laptop:aspect-w-[1024] laptop:aspect-h-[520] tablet:aspect-w-[768] tablet:aspect-h-[660] aspect-w-[390] aspect-h-[660]'\n return (\n <>\n {sticky && (\n <div\n ref={titleRef}\n className={cn(\n 'relative z-10',\n aspect,\n {\n 'aiui-dark': theme === 'dark',\n 'rounded-box': shape === 'rounded',\n },\n className\n )}\n >\n <div ref={inViewRef}>\n {!titleAnimation && (\n <div className=\"media-content absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 px-4 text-center\">\n {title_html && !isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n {videoTitle_html && isPlaying && (\n <div\n className=\"lg-desktop:text-[64px] text-btn-primary-foreground text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: videoTitle_html }}\n />\n )}\n {btnText && (\n <Button\n variant=\"link\"\n className={cn('member-equity-button-secondary text-btn-primary-foreground')}\n onClick={() => {\n setVisible(true)\n // if (isPlaying) {\n // if (videoRef.current) {\n // videoRef.current.pause()\n // }\n // setIsPlaying(false)\n // } else {\n // if (videoRef.current) {\n // videoRef.current.play()\n // }\n // setIsPlaying(true)\n // }\n onBtnClick && onBtnClick?.()\n }}\n >\n {btnText}\n {/* <Right /> */}\n </Button>\n )}\n </div>\n )}\n </div>\n </div>\n )}\n <div style={sticky ? { marginBottom: `-${btb}px`, marginTop: `-${titleHeight}px` } : {}} className=\"relative\">\n <div className=\"sticky top-0 \">\n <div\n className={cn('relative overflow-hidden', sticky ? 'h-screen w-full' : aspect, {\n 'aiui-dark': theme === 'dark',\n 'rounded-box': shape === 'rounded',\n })}\n >\n {titleAnimation === 'fade-in' && title_html && (\n <div\n ref={titleFadeInRef}\n className=\"lg-desktop:text-[64px] text-btn-primary-foreground absolute left-1/2 top-1/2 z-20 w-full -translate-x-1/2 -translate-y-1/2 text-center text-[40px] font-bold leading-none lg:text-5xl\"\n dangerouslySetInnerHTML={{ __html: title_html }}\n />\n )}\n <div className=\"media-cover left-0 top-0 h-screen w-screen\">\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={video?.url!}\n className=\"tablet:block hidden size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n <ScrollLoadVideo\n videoRef={videoRef}\n poster={img?.url || ''}\n src={mobileVideo?.url || video?.url!}\n className=\"tablet:hidden block size-full\"\n videoClassName=\"object-cover\"\n muted\n loop\n playsInline\n autoplay\n webkit-playsinline\n x5-playsinline\n />\n <div\n ref={bgRef}\n className=\"absolute left-0 top-0 z-10 size-full opacity-0\"\n style={{\n background: 'rgba(0, 0, 0, 0.2)',\n }}\n />\n </div>\n </div>\n </div>\n <div\n className={cn(sticky && 'relative box-content block', aspect)}\n style={sticky ? { height: `${btb}px` } : {}}\n ref={trackRef}\n />\n </div>\n {visible && youtubeId && (\n <VideoModal visible={visible} youTubeId={youtubeId} onCloseModal={() => setVisible(false)} />\n )}\n </>\n )\n }\n)\n\nexport default withLayout(MediaPlayerBase)\n"],
5
+ "mappings": "aAuJM,mBAAAA,GAkBc,OAAAC,EAFJ,QAAAC,MAhBV,oBAtJN,OAAS,YAAAC,EAAU,UAAAC,EAAQ,aAAAC,EAAW,cAAAC,GAAY,uBAAAC,OAA2B,QAC7E,OAAS,YAAAC,OAAgB,SACzB,OAAS,MAAAC,MAAU,yBACnB,OAAS,cAAAC,OAAkB,yBAC3B,OAAOC,OAAY,6BACnB,OAAS,cAAAC,OAAkB,yBAC3B,OAAS,wBAAAC,MAA4B,oCAGrC,OAAS,aAAAC,OAAiB,8BAE1B,OAAS,eAAAC,OAAmB,6BAC5B,OAAOC,MAAqB,mCAC5B,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,OAAiB,sBAC1B,OAAS,iBAAAC,OAAqB,0BAE9B,MAAMC,GAAgB,oBAChBC,GAAgB,QAEhBC,EAAyC,CAAC,CAAE,kBAAAC,CAAkB,KAAO,CACzE,GAAGA,EACH,KAAMC,GAAQ,CACZ,KAAM,CAAE,KAAAC,CAAK,EAAID,EAEjB,OAAIC,EAAK,GAAKA,EAAK,EAAE,MACZ,wBAAwBA,EAAK,EAAE,KAAK,KAAKA,EAAK,IAAI,UAEpDA,EAAK,IACd,CACF,GAEMC,GAAkBpB,GACtB,CACE,CACE,UAAAqB,EAAY,GACZ,WAAAC,EACA,KAAM,CAAE,MAAAC,EAAO,WAAAC,EAAY,QAAAC,EAAS,UAAAC,EAAW,MAAAC,EAAO,YAAAC,EAAa,MAAAC,EAAO,IAAAC,EAAK,MAAAC,EAAO,eAAAC,EAAgB,GAAGC,CAAK,CAChH,EACAC,IACG,CACH,KAAM,CAAE,OAAAC,CAAO,EAAIF,EACb,CAACG,EAAWC,CAAY,EAAIxC,EAAS,EAAK,EAC1C,CAACyC,EAAKC,CAAM,EAAI1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AAa,KAAOD,GAAO,IAChC,UAAU,gCACV,eAAe,eACf,MAAK,GACL,KAAI,GACJ,YAAW,GACX,SAAQ,GACR,qBAAkB,GAClB,iBAAc,GAChB,EACAhC,EAAC,OACC,IAAKkD,EACL,UAAU,iDACV,MAAO,CACL,WAAY,oBACd,EACF,GACF,GACF,EACF,EACAlD,EAAC,OACC,UAAWQ,EAAGgC,GAAU,6BAA8BuC,CAAM,EAC5D,MAAOvC,EAAS,CAAE,OAAQ,GAAGG,CAAG,IAAK,EAAI,CAAC,EAC1C,IAAKU,EACP,GACF,EACCN,GAAWhB,GACV/B,EAACW,GAAA,CAAW,QAASoC,EAAS,UAAWhB,EAAW,aAAc,IAAMiB,EAAW,EAAK,EAAG,GAE/F,CAEJ,CACF,EAEA,IAAOgC,GAAQvE,GAAWgB,EAAe",
6
6
  "names": ["Fragment", "jsx", "jsxs", "useState", "useRef", "useEffect", "forwardRef", "useImperativeHandle", "debounce", "cn", "withLayout", "Button", "VideoModal", "convertLexicalToHTML", "useInView", "useExposure", "ScrollLoadVideo", "gsap", "SplitText", "ScrollTrigger", "componentName", "componentType", "htmlConverters", "defaultConverters", "args", "node", "MediaPlayerBase", "className", "onBtnClick", "title", "videoTitle", "btnText", "youtubeId", "video", "mobileVideo", "theme", "img", "shape", "titleAnimation", "rest", "ref", "sticky", "isPlaying", "setIsPlaying", "btb", "setbtb", "titleHeight", "setTitleHeight", "visible", "setVisible", "videoRef", "bgRef", "titleRef", "titleFadeInRef", "trackRef", "splitTextInstance", "scrollTriggerRef", "inViewRef", "inView", "title_html", "videoTitle_html", "debouncedHandleResize", "rect", "screenHeight", "scrollTop", "elementBottomToPageTop", "distanceToPageBottom", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity", "aspect", "MediaPlayerBase_default"]
7
7
  }
@@ -0,0 +1,3 @@
1
+ export declare function YouTubePlayer({ youTubeId }: {
2
+ youTubeId: string;
3
+ }): import("react/jsx-runtime").JSX.Element;
@@ -1,2 +1,2 @@
1
- import{Fragment as R,jsx as t,jsxs as s}from"react/jsx-runtime";import U,{useState as M,useEffect as j,useRef as E}from"react";import{useMediaQuery as H}from"react-responsive";import{withLayout as D}from"../../shared/Styles.js";import C from"../../components/picture.js";import G from"../../components/button.js";import{Heading as _}from"../../components/heading.js";import{VideoModal as Q}from"../VideoModal/index.js";import{Grid as Y,GridItem as $}from"../../components/gird.js";import q from"../Title/index.js";import{cn as P,spaceToHyphen as V}from"../../helpers/utils.js";import I from"../SwiperBox/index.js";import{isVideo as S}from"../../shared/mimeType.js";import{Tabs as A,TabsList as O,TabsTrigger as Z,TabsContent as F}from"../../components/tabs.js";import{useExposure as J}from"../../hooks/useExposure.js";import{trackUrlRef as L}from"../../shared/trackUrlRef.js";import{gaTrack as K}from"../../shared/track.js";const v="image",y="p1_banner",B=({data:n,configuration:r,jIndex:c,spanType:m})=>{const[h,f]=M(!1),p=H({query:"(max-width: 768px)"}),k=E(null),x=()=>{if(m)switch(m){case"full":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"half":return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case"one-third":return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}else switch(r?.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-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}};J(k,{componentType:v,componentName:y,position:c,componentTitle:n.title,componentDescription:n.description,navigation:r?.activeTab}),j(()=>{f(p)},[p]);const{theme:N="light",title:w,description:b,imageUrl:o,primaryButton:d,secondaryButton:i,imageMobileUrl:l,blockLink:g,video:u,youtubeId:e,isYouTube:a}=n,T="lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]";return s("div",{className:P("item-wrapper text-info-primary group relative box-border w-full overflow-hidden",x(),{"rounded-2xl":r?.shape==="rounded","aiui-dark":N==="dark","h-[480px]":h&&!r?.isTab,"h-[400px]":h&&r?.isTab},"text-info-primary"),ref:k,children:[g&&t("a",{className:"absolute inset-0 z-10",href:L(g,`${v}_${y}`),"aria-hidden":"true",tabIndex:-1}),s("div",{className:"absolute inset-0",children:[S(o?.mimeType)?t("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:block hidden h-full overflow-hidden",children:t("source",{src:o?.url,type:"video/mp4"})}):t(C,{source:o?.url,alt:o?.alt||"",className:"tablet:block hidden h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 group-hover:scale-105 object-cover",style:{aspectRatio:`${o?.width}/${o?.height}`}}),S(l?.mimeType)?t("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:hidden block h-full overflow-hidden",children:t("source",{src:l?.url,type:"video/mp4"})}):t(C,{source:l?.url||o?.url,alt:l?.alt||o?.alt||"",className:"tablet:hidden block h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 object-cover"}),s("div",{className:P("laptop:p-6 desktop:p-[32px] laptop:gap-4 desktop:gap-6 absolute inset-x-0 bottom-0 z-20 flex w-fit flex-col gap-6 p-3",{"laptop:top-1/2 laptop:-translate-y-1/2 laptop:bottom-auto":n?.width==="full"}),children:[s("div",{children:[t(_,{size:3,as:"h3",className:"item-title",html:w}),t(_,{as:"h4",className:"item-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1 text-[14px]",html:b})]}),s("div",{className:"lg-desktop:gap-3 flex gap-2",children:[i&&i.text&&s(G,{"aria-label":w??b,className:T,variant:"secondary",as:"a",href:L(i.link,`${v}_${y}`),children:[i.text,t("span",{className:"sr-only",children:w??b})]}),d&&d.text&&t(G,{"aria-label":w??b,className:T,variant:"primary",as:"a",href:L(d.link,`${v}_${y}`),children:d.text})]})]})]}),t("div",{children:t("div",{className:"laptop:bottom-6 laptop:right-6 absolute bottom-4 right-4",children:(u?.url||e)&&t("button",{onClick:()=>{r?.onVideoPlayBtnClick?.(u?.url||e,a)},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"})})})})})]})},z=U.forwardRef((n,r)=>{const{shape:c,sectionTitle:m,groupByTab:h=!1,items:f=[],carousel:p}=n.data,[k,x]=M(!1),[N,w]=M(""),[b,o]=M(""),d=e=>{switch(e){case"full":return 12;case"half":return 6;case"one-third":return 4}},i=f.map(e=>e.tabName).filter(Boolean).filter((e,a,T)=>T.indexOf(e)===a),l=(e,a)=>{x(!0),a?o?.(e||""):w?.(e||"")},g=(e,a)=>{switch(e){case 1:return 1;case 2:return 2;default:return a?2.3:3}},u=i.map(e=>({tabName:e,items:f.filter(a=>a.tabName===e)})).reduce((e,a)=>(e[a.tabName]=a.items,e),{});return s("section",{"data-ui-component-id":"MultiLayoutGraphicBlock",ref:r,className:P("text-info-primary",n.className),children:[m&&t(q,{data:{title:m},className:"section-title"}),h?s(A,{shape:c,align:"left",defaultValue:V(i[0]),children:[t(O,{children:i.map((e,a)=>t(Z,{value:V(e),onClick:()=>{K({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:v,component_name:y,component_title:m,component_position:1,navigation:e,button_name:e}})},children:e},a))}),i.map((e,a)=>t(F,{value:V(e),className:"desktop:mt-[36px] mt-[24px] w-full",children:s(R,{children:[t(I,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock1",data:{list:u?.[e]||[],configuration:{shape:c,isTab:h,activeTab:e,num:u?.[e]?.length||0,onVideoPlayBtnClick:l}},Slide:B,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:g(u?.[e]?.length||0,!0)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:g(u?.[e]?.length||0)}}}),p&&p?.items.length>0?t(I,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock2",data:{list:p?.items||[],configuration:{shape:c,isTab:h,onVideoPlayBtnClick:l}},Slide:B,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.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]})},a))]}):s(R,{children:[s(Y,{className:"w-full",children:[f.map((e,a)=>t($,{span:d(e.width??"full"),className:"laptop:block hidden",children:t(B,{data:e,configuration:{shape:c,onVideoPlayBtnClick:l},jIndex:a,spanType:e.width})},`${e?.title||""}${a}`)),f.map((e,a)=>t($,{span:d("full"),className:"laptop:hidden block",children:t(B,{data:e,configuration:{shape:c,onVideoPlayBtnClick:l},jIndex:a,spanType:"full"})},`${e?.title||""}${a}`))]}),p&&p?.items.length>0?t(I,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock3",data:{list:p?.items||[],configuration:{shape:c,onVideoPlayBtnClick:l}},Slide:B,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.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]}),k&&t(Q,{visible:k,youTubeId:b,videoUrl:N,onCloseModal:()=>x(!1)})]})});z.displayName="MultiLayoutGraphicBlock";var he=D(z);export{he as default};
1
+ import{Fragment as R,jsx as t,jsxs as s}from"react/jsx-runtime";import U,{useState as M,useEffect as j,useRef as E}from"react";import{useMediaQuery as H}from"react-responsive";import{withLayout as D}from"../../shared/Styles.js";import C from"../../components/picture.js";import G from"../../components/button.js";import{Heading as _}from"../../components/heading.js";import{VideoModal as Q}from"../VideoModal/index.js";import{Grid as Y,GridItem as $}from"../../components/gird.js";import q from"../Title/index.js";import{cn as P,spaceToHyphen as V}from"../../helpers/utils.js";import I from"../SwiperBox/index.js";import{isVideo as S}from"../../shared/mimeType.js";import{Tabs as A,TabsList as O,TabsTrigger as Z,TabsContent as F}from"../../components/tabs.js";import{useExposure as J}from"../../hooks/useExposure.js";import{trackUrlRef as L}from"../../shared/trackUrlRef.js";import{gaTrack as K}from"../../shared/track.js";const v="image",y="p1_banner",B=({data:n,configuration:r,jIndex:c,spanType:m})=>{const[h,f]=M(!1),p=H({query:"(max-width: 768px)"}),k=E(null),x=()=>{if(m)switch(m){case"full":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"half":return"tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case"one-third":return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}else switch(r?.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-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]"}};J(k,{componentType:v,componentName:y,position:c,componentTitle:n.title,componentDescription:n.description,navigation:r?.activeTab}),j(()=>{f(p)},[p]);const{theme:N="light",title:w,description:b,imageUrl:o,primaryButton:d,secondaryButton:i,imageMobileUrl:l,blockLink:g,video:u,youtubeId:e,isYouTube:a}=n,T="lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]";return s("div",{className:P("item-wrapper text-info-primary group relative box-border w-full overflow-hidden",x(),{"rounded-2xl":r?.shape==="rounded","aiui-dark":N==="dark","h-[480px]":h&&!r?.isTab,"h-[400px]":h&&r?.isTab},"text-info-primary"),ref:k,children:[g&&t("a",{className:"absolute inset-0 z-10",href:L(g,`${v}_${y}`),"aria-hidden":"true",tabIndex:-1}),s("div",{className:"absolute inset-0",children:[S(o?.mimeType)?t("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:block hidden h-full overflow-hidden",children:t("source",{src:o?.url,type:"video/mp4"})}):t(C,{source:o?.url,alt:o?.alt||"",className:"tablet:block hidden h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 group-hover:scale-105 object-cover",style:{aspectRatio:`${o?.width}/${o?.height}`}}),S(l?.mimeType)?t("video",{autoPlay:!0,muted:!0,playsInline:!0,loop:!0,className:"tablet:hidden block h-full overflow-hidden",children:t("source",{src:l?.url,type:"video/mp4"})}):t(C,{source:l?.url||o?.url,alt:l?.alt||o?.alt||"",className:"tablet:hidden block h-full overflow-hidden",imgClassName:"h-full transition-all duration-300 object-cover"}),s("div",{className:P("laptop:p-6 desktop:p-[32px] laptop:gap-4 desktop:gap-6 absolute inset-x-0 bottom-0 z-20 flex w-fit flex-col gap-6 p-4",{"laptop:top-1/2 laptop:-translate-y-1/2 laptop:bottom-auto":n?.width==="full"}),children:[s("div",{children:[t(_,{size:3,as:"h3",className:"item-title",html:w}),t(_,{as:"h4",className:"item-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1 text-[14px]",html:b})]}),s("div",{className:"lg-desktop:gap-3 flex gap-2",children:[i&&i.text&&s(G,{"aria-label":w??b,className:T,variant:"secondary",as:"a",href:L(i.link,`${v}_${y}`),children:[i.text,t("span",{className:"sr-only",children:w??b})]}),d&&d.text&&t(G,{"aria-label":w??b,className:T,variant:"primary",as:"a",href:L(d.link,`${v}_${y}`),children:d.text})]})]})]}),t("div",{children:t("div",{className:"laptop:bottom-6 laptop:right-6 absolute bottom-4 right-4",children:(u?.url||e)&&t("button",{onClick:()=>{r?.onVideoPlayBtnClick?.(u?.url||e,a)},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"})})})})})]})},z=U.forwardRef((n,r)=>{const{shape:c,sectionTitle:m,groupByTab:h=!1,items:f=[],carousel:p}=n.data,[k,x]=M(!1),[N,w]=M(""),[b,o]=M(""),d=e=>{switch(e){case"full":return 12;case"half":return 6;case"one-third":return 4}},i=f.map(e=>e.tabName).filter(Boolean).filter((e,a,T)=>T.indexOf(e)===a),l=(e,a)=>{x(!0),a?o?.(e||""):w?.(e||"")},g=(e,a)=>{switch(e){case 1:return 1;case 2:return 2;default:return a?2.3:3}},u=i.map(e=>({tabName:e,items:f.filter(a=>a.tabName===e)})).reduce((e,a)=>(e[a.tabName]=a.items,e),{});return s("section",{"data-ui-component-id":"MultiLayoutGraphicBlock",ref:r,className:P("text-info-primary",n.className),children:[m&&t(q,{data:{title:m},className:"section-title"}),h?s(A,{shape:c,align:"left",defaultValue:V(i[0]),children:[t(O,{children:i.map((e,a)=>t(Z,{value:V(e),onClick:()=>{K({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:v,component_name:y,component_title:m,component_position:1,navigation:e,button_name:e}})},children:e},a))}),i.map((e,a)=>t(F,{value:V(e),className:"desktop:mt-[36px] mt-[24px] w-full",children:s(R,{children:[t(I,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock1",data:{list:u?.[e]||[],configuration:{shape:c,isTab:h,activeTab:e,num:u?.[e]?.length||0,onVideoPlayBtnClick:l}},Slide:B,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:g(u?.[e]?.length||0,!0)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:g(u?.[e]?.length||0)}}}),p&&p?.items.length>0?t(I,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock2",data:{list:p?.items||[],configuration:{shape:c,isTab:h,onVideoPlayBtnClick:l}},Slide:B,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.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]})},a))]}):s(R,{children:[s(Y,{className:"w-full",children:[f.map((e,a)=>t($,{span:d(e.width??"full"),className:"laptop:block hidden",children:t(B,{data:e,configuration:{shape:c,onVideoPlayBtnClick:l},jIndex:a,spanType:e.width})},`${e?.title||""}${a}`)),f.map((e,a)=>t($,{span:d("full"),className:"laptop:hidden block",children:t(B,{data:e,configuration:{shape:c,onVideoPlayBtnClick:l},jIndex:a,spanType:"full"})},`${e?.title||""}${a}`))]}),p&&p?.items.length>0?t(I,{className:"!overflow-visible",id:"MultiLayoutGraphicBlock3",data:{list:p?.items||[],configuration:{shape:c,onVideoPlayBtnClick:l}},Slide:B,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.1},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}}):null]}),k&&t(Q,{visible:k,youTubeId:b,videoUrl:N,onCloseModal:()=>x(!1)})]})});z.displayName="MultiLayoutGraphicBlock";var he=D(z);export{he as default};
2
2
  //# sourceMappingURL=MultiLayoutGraphicBlock.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.tsx"],
4
- "sourcesContent": ["import React, { useState, useEffect, useRef } from 'react'\nimport { useMediaQuery } from 'react-responsive'\nimport type { MultiLayoutGraphicBlockProps, Item } from './types'\nimport { withLayout } from '../../shared/Styles.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport { Heading } from '../../components/heading.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport Title from '../Title/index.js'\nimport { cn, spaceToHyphen } from '../../helpers/utils.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { isVideo } from '../../shared/mimeType.js'\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../../components/tabs.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { gaTrack } from '../../shared/track.js'\n\nconst componentType = 'image'\nconst componentName = 'p1_banner'\n\nconst ItemBlock = ({\n data: item,\n configuration,\n jIndex,\n spanType,\n}: {\n data: Item\n configuration?: any\n jIndex?: number\n spanType?: string\n}) => {\n const [isMobile, setIsMobile] = useState<boolean>(false)\n const mediaQuery = useMediaQuery({ query: '(max-width: 768px)' })\n\n const ref = useRef<HTMLDivElement>(null)\n\n const handleAspect = () => {\n if (spanType) {\n switch (spanType) {\n case 'full':\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 'half':\n return 'tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]'\n case 'one-third':\n return 'tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]'\n default:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]'\n }\n } else {\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-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]'\n case 3:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]'\n default:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]'\n }\n }\n }\n\n useExposure(ref, {\n componentType: componentType,\n componentName: componentName,\n position: jIndex,\n componentTitle: item.title,\n componentDescription: item.description,\n navigation: configuration?.activeTab,\n })\n\n useEffect(() => {\n setIsMobile(mediaQuery)\n }, [mediaQuery])\n\n const {\n theme = 'light',\n title,\n description,\n imageUrl,\n primaryButton,\n secondaryButton,\n imageMobileUrl,\n blockLink,\n video,\n youtubeId,\n isYouTube,\n } = item\n const lgButtonSize = 'lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]'\n\n return (\n <div\n className={cn(\n 'item-wrapper text-info-primary group relative box-border w-full overflow-hidden',\n handleAspect(),\n {\n 'rounded-2xl': configuration?.shape === 'rounded',\n 'aiui-dark': theme === 'dark',\n 'h-[480px]': isMobile && !configuration?.isTab,\n 'h-[400px]': isMobile && configuration?.isTab,\n },\n `text-info-primary`\n )}\n ref={ref}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(blockLink, `${componentType}_${componentName}`)}\n aria-hidden=\"true\"\n tabIndex={-1}\n ></a>\n )}\n <div className=\"absolute inset-0\">\n {isVideo(imageUrl?.mimeType) ? (\n <video autoPlay muted playsInline loop className=\"tablet:block hidden h-full overflow-hidden\">\n <source src={imageUrl?.url} type=\"video/mp4\" />\n </video>\n ) : (\n <Picture\n source={imageUrl?.url}\n alt={imageUrl?.alt || ''}\n className=\"tablet:block hidden h-full overflow-hidden\"\n imgClassName=\"h-full transition-all duration-300 group-hover:scale-105 object-cover\"\n style={{ aspectRatio: `${imageUrl?.width}/${imageUrl?.height}` }}\n />\n )}\n {isVideo(imageMobileUrl?.mimeType) ? (\n <video autoPlay muted playsInline loop className=\"tablet:hidden block h-full overflow-hidden\">\n <source src={imageMobileUrl?.url} type=\"video/mp4\" />\n </video>\n ) : (\n <Picture\n source={imageMobileUrl?.url || imageUrl?.url}\n alt={imageMobileUrl?.alt || imageUrl?.alt || ''}\n className=\"tablet:hidden block h-full overflow-hidden\"\n imgClassName=\"h-full transition-all duration-300 object-cover\"\n />\n )}\n <div\n className={cn(\n 'laptop:p-6 desktop:p-[32px] laptop:gap-4 desktop:gap-6 absolute inset-x-0 bottom-0 z-20 flex w-fit flex-col gap-6 p-3',\n {\n 'laptop:top-1/2 laptop:-translate-y-1/2 laptop:bottom-auto': item?.width === 'full',\n }\n )}\n >\n <div>\n <Heading size={3} as=\"h3\" className=\"item-title\" html={title} />\n <Heading\n as=\"h4\"\n className=\"item-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1 text-[14px]\"\n html={description}\n />\n </div>\n <div className=\"lg-desktop:gap-3 flex gap-2\">\n {secondaryButton && secondaryButton.text && (\n <Button\n aria-label={title ?? description}\n className={lgButtonSize}\n variant=\"secondary\"\n as=\"a\"\n href={trackUrlRef(secondaryButton.link, `${componentType}_${componentName}`)}\n >\n {secondaryButton.text}\n <span className=\"sr-only\">{title ?? description}</span>\n </Button>\n )}\n {primaryButton && primaryButton.text && (\n <Button\n aria-label={title ?? description}\n className={lgButtonSize}\n variant=\"primary\"\n as=\"a\"\n href={trackUrlRef(primaryButton.link, `${componentType}_${componentName}`)}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n </div>\n </div>\n <div>\n <div className=\"laptop:bottom-6 laptop:right-6 absolute bottom-4 right-4\">\n {(video?.url || youtubeId) && (\n <button\n onClick={() => {\n configuration?.onVideoPlayBtnClick?.(video?.url || youtubeId, isYouTube)\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 </div>\n </div>\n </div>\n )\n}\n\nconst MultiLayoutGraphicBlock = React.forwardRef<HTMLDivElement, MultiLayoutGraphicBlockProps>((props, ref) => {\n const { shape, sectionTitle, groupByTab = false, items = [], carousel } = props.data\n const [visible, setVisible] = useState<boolean>(false)\n const [videoUrl, setVideoUrl] = useState<string>('')\n const [youTubeId, setYouTubeId] = useState<string>('')\n\n const getSpan = (width: 'full' | 'half' | 'one-third') => {\n switch (width) {\n case 'full':\n return 12\n case 'half':\n return 6\n case 'one-third':\n return 4\n }\n }\n\n const tabNames = items\n .map(item => item.tabName)\n .filter(Boolean)\n .filter((item, index, arr) => arr.indexOf(item) === index) as string[]\n\n const handleVideoPlayBtnClick = (url: string, isYouTube: boolean) => {\n setVisible(true)\n if (isYouTube) {\n setYouTubeId?.(url || '')\n } else {\n setVideoUrl?.(url || '')\n }\n }\n const handleTabNumber = (num: Number, flag?: boolean) => {\n switch (num) {\n case 1:\n return 1\n case 2:\n return 2\n default:\n return flag ? 2.3 : 3\n }\n }\n\n const tabItemsMaps = tabNames\n .map(tabName => ({\n tabName,\n items: items.filter(item => item.tabName === tabName),\n }))\n .reduce(\n (acc, cur) => {\n acc[cur.tabName] = cur.items\n return acc\n },\n {} as Record<string, (Item & { width?: 'full' | 'half' | 'one-third' })[]>\n )\n\n return (\n <section\n data-ui-component-id=\"MultiLayoutGraphicBlock\"\n ref={ref}\n className={cn('text-info-primary', props.className)}\n >\n {sectionTitle && <Title data={{ title: sectionTitle }} className=\"section-title\" />}\n\n {groupByTab ? (\n <Tabs shape={shape} align=\"left\" defaultValue={spaceToHyphen(tabNames[0]!)}>\n <TabsList>\n {tabNames.map((tabName, index) => (\n <TabsTrigger\n key={index}\n value={spaceToHyphen(tabName!)}\n onClick={() => {\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: sectionTitle,\n component_position: 1,\n navigation: tabName,\n button_name: tabName,\n },\n })\n }}\n >\n {tabName}\n </TabsTrigger>\n ))}\n </TabsList>\n {tabNames.map((tabName, index) => (\n <TabsContent key={index} value={spaceToHyphen(tabName!)} className=\"desktop:mt-[36px] mt-[24px] w-full\">\n <>\n <SwiperBox\n className=\"!overflow-visible\"\n id={'MultiLayoutGraphicBlock1'}\n data={{\n list: tabItemsMaps?.[tabName] || [],\n configuration: {\n shape: shape,\n isTab: groupByTab,\n activeTab: tabName,\n num: tabItemsMaps?.[tabName]?.length || 0,\n onVideoPlayBtnClick: handleVideoPlayBtnClick,\n },\n }}\n Slide={ItemBlock}\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: handleTabNumber(tabItemsMaps?.[tabName]?.length || 0, true),\n },\n 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleTabNumber(tabItemsMaps?.[tabName]?.length || 0),\n },\n }}\n />\n {carousel && carousel?.items.length > 0 ? (\n <SwiperBox\n className=\"!overflow-visible\"\n id={'MultiLayoutGraphicBlock2'}\n data={{\n list: carousel?.items || [],\n configuration: { shape: shape, isTab: groupByTab, onVideoPlayBtnClick: handleVideoPlayBtnClick },\n }}\n Slide={ItemBlock}\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.1,\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n ) : null}\n </>\n </TabsContent>\n ))}\n </Tabs>\n ) : (\n <>\n <Grid className=\"w-full\">\n {items.map((item, index) => {\n return (\n <GridItem\n key={`${item?.title || ''}${index}`}\n span={getSpan(item.width ?? 'full')}\n className=\"laptop:block hidden\"\n >\n <ItemBlock\n data={item}\n configuration={{ shape: shape, onVideoPlayBtnClick: handleVideoPlayBtnClick }}\n jIndex={index}\n spanType={item.width}\n />\n </GridItem>\n )\n })}\n {items.map((item, index) => (\n <GridItem key={`${item?.title || ''}${index}`} span={getSpan('full')} className=\"laptop:hidden block\">\n <ItemBlock\n data={item}\n configuration={{ shape: shape, onVideoPlayBtnClick: handleVideoPlayBtnClick }}\n jIndex={index}\n spanType={'full'}\n />\n </GridItem>\n ))}\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <SwiperBox\n className=\"!overflow-visible\"\n id={'MultiLayoutGraphicBlock3'}\n data={{\n list: carousel?.items || [],\n configuration: { shape: shape, onVideoPlayBtnClick: handleVideoPlayBtnClick },\n }}\n Slide={ItemBlock}\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.1,\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n ) : null}\n </>\n )}\n {visible && (\n <VideoModal\n visible={visible}\n youTubeId={youTubeId}\n videoUrl={videoUrl}\n onCloseModal={() => setVisible(false)}\n />\n )}\n </section>\n )\n})\n\nMultiLayoutGraphicBlock.displayName = 'MultiLayoutGraphicBlock'\n\nexport default withLayout(MultiLayoutGraphicBlock)\nexport type { MultiLayoutGraphicBlockProps }\n"],
4
+ "sourcesContent": ["import React, { useState, useEffect, useRef } from 'react'\nimport { useMediaQuery } from 'react-responsive'\nimport type { MultiLayoutGraphicBlockProps, Item } from './types'\nimport { withLayout } from '../../shared/Styles.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport { Heading } from '../../components/heading.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport Title from '../Title/index.js'\nimport { cn, spaceToHyphen } from '../../helpers/utils.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { isVideo } from '../../shared/mimeType.js'\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../../components/tabs.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { gaTrack } from '../../shared/track.js'\n\nconst componentType = 'image'\nconst componentName = 'p1_banner'\n\nconst ItemBlock = ({\n data: item,\n configuration,\n jIndex,\n spanType,\n}: {\n data: Item\n configuration?: any\n jIndex?: number\n spanType?: string\n}) => {\n const [isMobile, setIsMobile] = useState<boolean>(false)\n const mediaQuery = useMediaQuery({ query: '(max-width: 768px)' })\n\n const ref = useRef<HTMLDivElement>(null)\n\n const handleAspect = () => {\n if (spanType) {\n switch (spanType) {\n case 'full':\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 'half':\n return 'tablet:aspect-w-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]'\n case 'one-third':\n return 'tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]'\n default:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]'\n }\n } else {\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-[704] tablet:aspect-h-[480] laptop:aspect-w-[440] laptop:aspect-h-[384] desktop:aspect-w-[648] desktop:aspect-h-[512] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[640]'\n case 3:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]'\n default:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[400] laptop:aspect-w-[288] laptop:aspect-h-[384] desktop:aspect-w-[427] desktop:aspect-h-[512] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[640]'\n }\n }\n }\n\n useExposure(ref, {\n componentType: componentType,\n componentName: componentName,\n position: jIndex,\n componentTitle: item.title,\n componentDescription: item.description,\n navigation: configuration?.activeTab,\n })\n\n useEffect(() => {\n setIsMobile(mediaQuery)\n }, [mediaQuery])\n\n const {\n theme = 'light',\n title,\n description,\n imageUrl,\n primaryButton,\n secondaryButton,\n imageMobileUrl,\n blockLink,\n video,\n youtubeId,\n isYouTube,\n } = item\n const lgButtonSize = 'lg-desktop:px-7 lg-desktop:pb-[14px] lg-desktop:pt-[15px] lg-desktop:text-[16px]'\n\n return (\n <div\n className={cn(\n 'item-wrapper text-info-primary group relative box-border w-full overflow-hidden',\n handleAspect(),\n {\n 'rounded-2xl': configuration?.shape === 'rounded',\n 'aiui-dark': theme === 'dark',\n 'h-[480px]': isMobile && !configuration?.isTab,\n 'h-[400px]': isMobile && configuration?.isTab,\n },\n `text-info-primary`\n )}\n ref={ref}\n >\n {blockLink && (\n <a\n className=\"absolute inset-0 z-10\"\n href={trackUrlRef(blockLink, `${componentType}_${componentName}`)}\n aria-hidden=\"true\"\n tabIndex={-1}\n ></a>\n )}\n <div className=\"absolute inset-0\">\n {isVideo(imageUrl?.mimeType) ? (\n <video autoPlay muted playsInline loop className=\"tablet:block hidden h-full overflow-hidden\">\n <source src={imageUrl?.url} type=\"video/mp4\" />\n </video>\n ) : (\n <Picture\n source={imageUrl?.url}\n alt={imageUrl?.alt || ''}\n className=\"tablet:block hidden h-full overflow-hidden\"\n imgClassName=\"h-full transition-all duration-300 group-hover:scale-105 object-cover\"\n style={{ aspectRatio: `${imageUrl?.width}/${imageUrl?.height}` }}\n />\n )}\n {isVideo(imageMobileUrl?.mimeType) ? (\n <video autoPlay muted playsInline loop className=\"tablet:hidden block h-full overflow-hidden\">\n <source src={imageMobileUrl?.url} type=\"video/mp4\" />\n </video>\n ) : (\n <Picture\n source={imageMobileUrl?.url || imageUrl?.url}\n alt={imageMobileUrl?.alt || imageUrl?.alt || ''}\n className=\"tablet:hidden block h-full overflow-hidden\"\n imgClassName=\"h-full transition-all duration-300 object-cover\"\n />\n )}\n <div\n className={cn(\n 'laptop:p-6 desktop:p-[32px] laptop:gap-4 desktop:gap-6 absolute inset-x-0 bottom-0 z-20 flex w-fit flex-col gap-6 p-4',\n {\n 'laptop:top-1/2 laptop:-translate-y-1/2 laptop:bottom-auto': item?.width === 'full',\n }\n )}\n >\n <div>\n <Heading size={3} as=\"h3\" className=\"item-title\" html={title} />\n <Heading\n as=\"h4\"\n className=\"item-description desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1 text-[14px]\"\n html={description}\n />\n </div>\n <div className=\"lg-desktop:gap-3 flex gap-2\">\n {secondaryButton && secondaryButton.text && (\n <Button\n aria-label={title ?? description}\n className={lgButtonSize}\n variant=\"secondary\"\n as=\"a\"\n href={trackUrlRef(secondaryButton.link, `${componentType}_${componentName}`)}\n >\n {secondaryButton.text}\n <span className=\"sr-only\">{title ?? description}</span>\n </Button>\n )}\n {primaryButton && primaryButton.text && (\n <Button\n aria-label={title ?? description}\n className={lgButtonSize}\n variant=\"primary\"\n as=\"a\"\n href={trackUrlRef(primaryButton.link, `${componentType}_${componentName}`)}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n </div>\n </div>\n <div>\n <div className=\"laptop:bottom-6 laptop:right-6 absolute bottom-4 right-4\">\n {(video?.url || youtubeId) && (\n <button\n onClick={() => {\n configuration?.onVideoPlayBtnClick?.(video?.url || youtubeId, isYouTube)\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 </div>\n </div>\n </div>\n )\n}\n\nconst MultiLayoutGraphicBlock = React.forwardRef<HTMLDivElement, MultiLayoutGraphicBlockProps>((props, ref) => {\n const { shape, sectionTitle, groupByTab = false, items = [], carousel } = props.data\n const [visible, setVisible] = useState<boolean>(false)\n const [videoUrl, setVideoUrl] = useState<string>('')\n const [youTubeId, setYouTubeId] = useState<string>('')\n\n const getSpan = (width: 'full' | 'half' | 'one-third') => {\n switch (width) {\n case 'full':\n return 12\n case 'half':\n return 6\n case 'one-third':\n return 4\n }\n }\n\n const tabNames = items\n .map(item => item.tabName)\n .filter(Boolean)\n .filter((item, index, arr) => arr.indexOf(item) === index) as string[]\n\n const handleVideoPlayBtnClick = (url: string, isYouTube: boolean) => {\n setVisible(true)\n if (isYouTube) {\n setYouTubeId?.(url || '')\n } else {\n setVideoUrl?.(url || '')\n }\n }\n const handleTabNumber = (num: Number, flag?: boolean) => {\n switch (num) {\n case 1:\n return 1\n case 2:\n return 2\n default:\n return flag ? 2.3 : 3\n }\n }\n\n const tabItemsMaps = tabNames\n .map(tabName => ({\n tabName,\n items: items.filter(item => item.tabName === tabName),\n }))\n .reduce(\n (acc, cur) => {\n acc[cur.tabName] = cur.items\n return acc\n },\n {} as Record<string, (Item & { width?: 'full' | 'half' | 'one-third' })[]>\n )\n\n return (\n <section\n data-ui-component-id=\"MultiLayoutGraphicBlock\"\n ref={ref}\n className={cn('text-info-primary', props.className)}\n >\n {sectionTitle && <Title data={{ title: sectionTitle }} className=\"section-title\" />}\n\n {groupByTab ? (\n <Tabs shape={shape} align=\"left\" defaultValue={spaceToHyphen(tabNames[0]!)}>\n <TabsList>\n {tabNames.map((tabName, index) => (\n <TabsTrigger\n key={index}\n value={spaceToHyphen(tabName!)}\n onClick={() => {\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: sectionTitle,\n component_position: 1,\n navigation: tabName,\n button_name: tabName,\n },\n })\n }}\n >\n {tabName}\n </TabsTrigger>\n ))}\n </TabsList>\n {tabNames.map((tabName, index) => (\n <TabsContent key={index} value={spaceToHyphen(tabName!)} className=\"desktop:mt-[36px] mt-[24px] w-full\">\n <>\n <SwiperBox\n className=\"!overflow-visible\"\n id={'MultiLayoutGraphicBlock1'}\n data={{\n list: tabItemsMaps?.[tabName] || [],\n configuration: {\n shape: shape,\n isTab: groupByTab,\n activeTab: tabName,\n num: tabItemsMaps?.[tabName]?.length || 0,\n onVideoPlayBtnClick: handleVideoPlayBtnClick,\n },\n }}\n Slide={ItemBlock}\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: handleTabNumber(tabItemsMaps?.[tabName]?.length || 0, true),\n },\n 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleTabNumber(tabItemsMaps?.[tabName]?.length || 0),\n },\n }}\n />\n {carousel && carousel?.items.length > 0 ? (\n <SwiperBox\n className=\"!overflow-visible\"\n id={'MultiLayoutGraphicBlock2'}\n data={{\n list: carousel?.items || [],\n configuration: { shape: shape, isTab: groupByTab, onVideoPlayBtnClick: handleVideoPlayBtnClick },\n }}\n Slide={ItemBlock}\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.1,\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n ) : null}\n </>\n </TabsContent>\n ))}\n </Tabs>\n ) : (\n <>\n <Grid className=\"w-full\">\n {items.map((item, index) => {\n return (\n <GridItem\n key={`${item?.title || ''}${index}`}\n span={getSpan(item.width ?? 'full')}\n className=\"laptop:block hidden\"\n >\n <ItemBlock\n data={item}\n configuration={{ shape: shape, onVideoPlayBtnClick: handleVideoPlayBtnClick }}\n jIndex={index}\n spanType={item.width}\n />\n </GridItem>\n )\n })}\n {items.map((item, index) => (\n <GridItem key={`${item?.title || ''}${index}`} span={getSpan('full')} className=\"laptop:hidden block\">\n <ItemBlock\n data={item}\n configuration={{ shape: shape, onVideoPlayBtnClick: handleVideoPlayBtnClick }}\n jIndex={index}\n spanType={'full'}\n />\n </GridItem>\n ))}\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <SwiperBox\n className=\"!overflow-visible\"\n id={'MultiLayoutGraphicBlock3'}\n data={{\n list: carousel?.items || [],\n configuration: { shape: shape, onVideoPlayBtnClick: handleVideoPlayBtnClick },\n }}\n Slide={ItemBlock}\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.1,\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n ) : null}\n </>\n )}\n {visible && (\n <VideoModal\n visible={visible}\n youTubeId={youTubeId}\n videoUrl={videoUrl}\n onCloseModal={() => setVisible(false)}\n />\n )}\n </section>\n )\n})\n\nMultiLayoutGraphicBlock.displayName = 'MultiLayoutGraphicBlock'\n\nexport default withLayout(MultiLayoutGraphicBlock)\nexport type { MultiLayoutGraphicBlockProps }\n"],
5
5
  "mappings": "AA2GQ,OA2LM,YAAAA,EA3LN,OAAAC,EAyCE,QAAAC,MAzCF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AAU,GACV,cAAe,CACjB,CACF,EACF,EACE,MACN,EAED6B,GACCzD,EAACW,EAAA,CACC,QAAS8C,EACT,UAAWI,EACX,SAAUF,EACV,aAAc,IAAMD,EAAW,EAAK,EACtC,GAEJ,CAEJ,CAAC,EAEDR,EAAwB,YAAc,0BAEtC,IAAO2B,GAAQtE,EAAW2C,CAAuB",
6
6
  "names": ["Fragment", "jsx", "jsxs", "React", "useState", "useEffect", "useRef", "useMediaQuery", "withLayout", "Picture", "Button", "Heading", "VideoModal", "Grid", "GridItem", "Title", "cn", "spaceToHyphen", "SwiperBox", "isVideo", "Tabs", "TabsList", "TabsTrigger", "TabsContent", "useExposure", "trackUrlRef", "gaTrack", "componentType", "componentName", "ItemBlock", "item", "configuration", "jIndex", "spanType", "isMobile", "setIsMobile", "mediaQuery", "ref", "handleAspect", "theme", "title", "description", "imageUrl", "primaryButton", "secondaryButton", "imageMobileUrl", "blockLink", "video", "youtubeId", "isYouTube", "lgButtonSize", "MultiLayoutGraphicBlock", "props", "shape", "sectionTitle", "groupByTab", "items", "carousel", "visible", "setVisible", "videoUrl", "setVideoUrl", "youTubeId", "setYouTubeId", "getSpan", "width", "tabNames", "index", "arr", "handleVideoPlayBtnClick", "url", "handleTabNumber", "num", "flag", "tabItemsMaps", "tabName", "acc", "cur", "MultiLayoutGraphicBlock_default"]
7
7
  }
@@ -0,0 +1,4 @@
1
+ import React from 'react';
2
+ import type { SectionHeadingProps } from './types.js';
3
+ declare const SectionHeading: React.ForwardRefExoticComponent<SectionHeadingProps & React.RefAttributes<HTMLDivElement>>;
4
+ export default SectionHeading;
@@ -0,0 +1,6 @@
1
+ import React from 'react';
2
+ export interface SectionHeadingProps {
3
+ title: string;
4
+ className?: string;
5
+ children: React.ReactNode;
6
+ }
@@ -0,0 +1,8 @@
1
+ import type { ShelfProps } from './types.js';
2
+ declare const _default: {
3
+ (props: Omit<ShelfProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
4
+ className?: string;
5
+ }): import("react/jsx-runtime").JSX.Element;
6
+ displayName: string;
7
+ };
8
+ export default _default;
@@ -0,0 +1 @@
1
+ export { default } from './Shelf.js';
@@ -0,0 +1,6 @@
1
+ export type ShelfProps = {
2
+ id: string;
3
+ title: string;
4
+ subtitle: string;
5
+ products: any[];
6
+ };
@@ -0,0 +1,7 @@
1
+ import React from 'react';
2
+ interface TabsProps {
3
+ tabs: any[];
4
+ onTabClick?: (value: any) => void;
5
+ }
6
+ declare const Tab: React.FC<TabsProps>;
7
+ export default Tab;
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as g}from"react/jsx-runtime";import k,{useEffect as L,useRef as i}from"react";import{gsap as s}from"gsap";import{SplitText as p}from"gsap/dist/SplitText";import{ScrollTrigger as u}from"gsap/dist/ScrollTrigger";import{cn as P}from"../../helpers/utils.js";import{Heading as V}from"../../components/index.js";import{withLayout as z}from"../../shared/Styles.js";import{useInView as I}from"react-intersection-observer";const f=k.forwardRef(({data:d,className:h})=>{const{title:l,theme:w}=d,t=i(null),r=i(null),e=i(null),{ref:T,inView:c}=I();return L(()=>{s.registerPlugin(p,u);function y(){if(!t.current)return;const b=t.current?.clientHeight||80;r.current=new p(t.current,{type:"words",wordsClass:"word"});const o=r.current.words;s.set(o,{opacity:0}),e.current=u.create({trigger:t.current,start:"bottom bottom-=4%",end:`bottom+=${b*1.5+60}px bottom-=4%`,scrub:!0,onUpdate:R=>{const v=R.progress,a=o.length,x=1/a,m=.5;o.forEach((H,E)=>{const M=E/a*(1-m),S=x*(1+m);let n=(v-M)/S;n=Math.max(0,Math.min(n,1)),s.set(H,{opacity:n})})}})}return c&&y(),()=>{r.current&&r.current.revert(),e.current&&e.current.kill()}},[c]),l&&g("div",{ref:T,className:P("mb-[24px] space-y-4",h,{"aiui-dark":w==="dark"}),children:g(V,{ref:t,as:"h2",size:4,html:l})})});f.displayName="Title";var B=z(f);export{B as default};
1
+ "use client";import{jsx as a,jsxs as j}from"react/jsx-runtime";import S,{useEffect as D,useRef as s}from"react";import{gsap as l}from"gsap";import{SplitText as d}from"gsap/dist/SplitText";import{ScrollTrigger as g}from"gsap/dist/ScrollTrigger";import{cn as h}from"../../helpers/utils.js";import{Heading as P}from"../../components/index.js";import{withLayout as V}from"../../shared/Styles.js";import{trackUrlRef as $}from"../../shared/trackUrlRef.js";import{useInView as z}from"react-intersection-observer";const I="link",U="title",w=S.forwardRef(({data:T,className:x})=>{const{title:c,theme:m,extension:r}=T,t=s(null),e=s(null),n=s(null),{ref:y,inView:p}=z();return D(()=>{l.registerPlugin(d,g);function k(){if(!t.current)return;const b=t.current?.clientHeight||80;e.current=new d(t.current,{type:"words",wordsClass:"word"});const o=e.current.words;l.set(o,{opacity:0}),n.current=g.create({trigger:t.current,start:"bottom bottom-=4%",end:`bottom+=${b*1.5+60}px bottom-=4%`,scrub:!0,onUpdate:v=>{const R=v.progress,u=o.length,H=1/u,f=.5;o.forEach((L,N)=>{const E=N/u*(1-f),M=H*(1+f);let i=(R-E)/M;i=Math.max(0,Math.min(i,1)),l.set(L,{opacity:i})})}})}return p&&k(),()=>{e.current&&e.current.revert(),n.current&&n.current.kill()}},[p]),c&&j("div",{className:"mb-6 flex items-end justify-between",children:[a("div",{ref:y,className:h("space-y-4",x,{"aiui-dark":m==="dark"}),children:a(P,{ref:t,as:"h2",size:4,html:c})}),r?.textLink&&a("a",{className:h({"aiui-dark":m==="dark"},"text-base font-[700] leading-[1.4] text-[#777] transition-all duration-[0.4s] hover:text-[#1D1D1F]"),href:$(r?.link,`${I}_${U}`),children:r?.textLink})]})});w.displayName="Title";var O=V(w);export{O 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 } 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 { useInView } from 'react-intersection-observer'\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className }) => {\n const { title, theme } = data\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 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 ref={inViewRef} className={cn('mb-[24px] space-y-4', className, { 'aiui-dark': theme === 'dark' })}>\n <Heading ref={titleRef} as=\"h2\" size={4} html={title} />\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
5
- "mappings": "aAiEQ,cAAAA,MAAA,oBAhER,OAAOC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C,EAC1C7B,EAAK,IAAIyB,EAAM,CAAE,QAAAI,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,EAGTN,GACEd,EAAC,OAAI,IAAKmB,EAAW,UAAWZ,EAAG,sBAAuBM,EAAW,CAAE,YAAaE,IAAU,MAAO,CAAC,EACpG,SAAAf,EAACQ,EAAA,CAAQ,IAAKQ,EAAU,GAAG,KAAK,KAAM,EAAG,KAAMF,EAAO,EACxD,CAGN,CAAC,EAEDH,EAAM,YAAc,QAEpB,IAAOuB,EAAQzB,EAAWE,CAAK",
6
- "names": ["jsx", "React", "useEffect", "useRef", "gsap", "SplitText", "ScrollTrigger", "cn", "Heading", "withLayout", "useInView", "Title", "data", "className", "title", "theme", "titleRef", "splitTextInstance", "scrollTriggerRef", "inViewRef", "inView", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity", "Title_default"]
4
+ "sourcesContent": ["'use client'\nimport React, { useEffect, useRef } 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 { 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 }) => {\n const { title, theme, extension } = data\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 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\">\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": "aAoEM,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBAnEN,OAAOC,GAAS,aAAAC,EAAW,UAAAC,MAAc,QACzC,OAAS,QAAAC,MAAY,OACrB,OAAS,a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,CAAC,CAAC,EAC1CjC,EAAK,IAAI6B,EAAM,CAAE,QAAAI,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,EAGTP,GACEjB,EAAC,OAAI,UAAU,sCACb,UAAAD,EAAC,OAAI,IAAKwB,EAAW,UAAWhB,EAAG,YAAaS,EAAW,CAAE,YAAaE,IAAU,MAAO,CAAC,EAC1F,SAAAnB,EAACS,EAAA,CAAQ,IAAKY,EAAU,GAAG,KAAK,KAAM,EAAG,KAAMH,EAAO,EACxD,EACCE,GAAW,UACVpB,EAAC,KACC,UAAWQ,EACT,CAAE,YAAaW,IAAU,MAAO,EAChC,oGACF,EACA,KAAMR,EAAYS,GAAW,KAAM,GAAGP,CAAa,IAAIC,CAAa,EAAE,EAErE,SAAAM,GAAW,SACd,GAEJ,CAGN,CAAC,EAEDL,EAAM,YAAc,QAEpB,IAAOwB,EAAQ7B,EAAWK,CAAK",
6
+ "names": ["jsx", "jsxs", "React", "useEffect", "useRef", "gsap", "SplitText", "ScrollTrigger", "cn", "Heading", "withLayout", "trackUrlRef", "useInView", "componentType", "componentName", "Title", "data", "className", "title", "theme", "extension", "titleRef", "splitTextInstance", "scrollTriggerRef", "inViewRef", "inView", "gsapResize", "height", "words", "self", "progress", "total", "interval", "overlap", "word", "i", "start", "width", "opacity", "Title_default"]
7
7
  }
@@ -19,6 +19,10 @@ export interface TitleProps {
19
19
  * 主题色
20
20
  */
21
21
  theme?: Theme;
22
+ /**
23
+ * 扩展数据
24
+ */
25
+ extension?: any;
22
26
  };
23
27
  /**
24
28
  * 自定义类名