@anker-in/headless-ui 0.0.27-alpha.52 → 0.0.27-alpha.54
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/BrandEquity/BrandEquity.d.ts +1 -0
- package/dist/cjs/biz-components/Category/index.d.ts +1 -0
- package/dist/cjs/biz-components/Evaluate/index.d.ts +1 -0
- package/dist/cjs/biz-components/Graphic/index.d.ts +1 -0
- package/dist/cjs/biz-components/GraphicAttractionBlock/index.d.ts +1 -0
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.d.ts +1 -0
- package/dist/cjs/biz-components/Marquee/index.d.ts +1 -0
- package/dist/cjs/biz-components/MediaPlayerBase/index.d.ts +1 -0
- package/dist/cjs/biz-components/MediaPlayerMulti/index.d.ts +1 -0
- package/dist/cjs/biz-components/MemberEquity/index.d.ts +1 -0
- package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.d.ts +1 -0
- package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/cjs/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js.map +2 -2
- package/dist/cjs/biz-components/Shelf/Shelf.d.ts +1 -0
- package/dist/cjs/biz-components/ShelfDisplay/index.d.ts +1 -0
- package/dist/cjs/biz-components/Slogan/index.d.ts +1 -0
- package/dist/cjs/biz-components/Slogan/index.js +1 -1
- package/dist/cjs/biz-components/Slogan/index.js.map +2 -2
- package/dist/cjs/biz-components/Tabs/Tabs.d.ts +1 -0
- package/dist/cjs/biz-components/Title/index.d.ts +1 -0
- package/dist/cjs/shared/Styles.d.ts +2 -1
- package/dist/cjs/shared/Styles.js +1 -1
- package/dist/cjs/shared/Styles.js.map +3 -3
- package/dist/cjs/shared/getKeyPropsString.d.ts +4 -0
- package/dist/cjs/shared/getKeyPropsString.js +2 -0
- package/dist/cjs/shared/getKeyPropsString.js.map +7 -0
- package/dist/cjs/shared/simpleHash.d.ts +1 -0
- package/dist/cjs/shared/simpleHash.js +2 -0
- package/dist/cjs/shared/simpleHash.js.map +7 -0
- package/dist/cjs/stories/HeroBanner.stories.d.ts +1 -0
- package/dist/cjs/stories/brandEquity.stories.d.ts +1 -0
- package/dist/cjs/stories/category.stories.d.ts +1 -0
- package/dist/cjs/stories/evaluate.stories.d.ts +1 -0
- package/dist/cjs/stories/graphic.stories.d.ts +2 -1
- package/dist/cjs/stories/marquee.stories.d.ts +1 -0
- package/dist/cjs/stories/mediaplayerMulti.stories.d.ts +1 -0
- package/dist/cjs/stories/shelf.stories.d.ts +1 -0
- package/dist/cjs/stories/shelfDisplay.stories.d.ts +1 -0
- package/dist/cjs/stories/slogan.stories.d.ts +1 -0
- package/dist/esm/biz-components/BrandEquity/BrandEquity.d.ts +1 -0
- package/dist/esm/biz-components/Category/index.d.ts +1 -0
- package/dist/esm/biz-components/Evaluate/index.d.ts +1 -0
- package/dist/esm/biz-components/Graphic/index.d.ts +1 -0
- package/dist/esm/biz-components/GraphicAttractionBlock/index.d.ts +1 -0
- package/dist/esm/biz-components/HeroBanner/HeroBanner.d.ts +1 -0
- package/dist/esm/biz-components/Marquee/index.d.ts +1 -0
- package/dist/esm/biz-components/MediaPlayerBase/index.d.ts +1 -0
- package/dist/esm/biz-components/MediaPlayerMulti/index.d.ts +1 -0
- package/dist/esm/biz-components/MemberEquity/index.d.ts +1 -0
- package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.d.ts +1 -0
- package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js +1 -1
- package/dist/esm/biz-components/MultiLayoutGraphicBlock/MultiLayoutGraphicBlock.js.map +2 -2
- package/dist/esm/biz-components/Shelf/Shelf.d.ts +1 -0
- package/dist/esm/biz-components/ShelfDisplay/index.d.ts +1 -0
- package/dist/esm/biz-components/Slogan/index.d.ts +1 -0
- package/dist/esm/biz-components/Slogan/index.js +1 -1
- package/dist/esm/biz-components/Slogan/index.js.map +2 -2
- package/dist/esm/biz-components/Tabs/Tabs.d.ts +1 -0
- package/dist/esm/biz-components/Title/index.d.ts +1 -0
- package/dist/esm/shared/Styles.d.ts +2 -1
- package/dist/esm/shared/Styles.js +1 -1
- package/dist/esm/shared/Styles.js.map +3 -3
- package/dist/esm/shared/getKeyPropsString.d.ts +4 -0
- package/dist/esm/shared/getKeyPropsString.js +2 -0
- package/dist/esm/shared/getKeyPropsString.js.map +7 -0
- package/dist/esm/shared/simpleHash.d.ts +1 -0
- package/dist/esm/shared/simpleHash.js +2 -0
- package/dist/esm/shared/simpleHash.js.map +7 -0
- package/dist/esm/stories/HeroBanner.stories.d.ts +1 -0
- package/dist/esm/stories/brandEquity.stories.d.ts +1 -0
- package/dist/esm/stories/category.stories.d.ts +1 -0
- package/dist/esm/stories/evaluate.stories.d.ts +1 -0
- package/dist/esm/stories/graphic.stories.d.ts +2 -1
- package/dist/esm/stories/marquee.stories.d.ts +1 -0
- package/dist/esm/stories/mediaplayerMulti.stories.d.ts +1 -0
- package/dist/esm/stories/shelf.stories.d.ts +1 -0
- package/dist/esm/stories/shelfDisplay.stories.d.ts +1 -0
- package/dist/esm/stories/slogan.stories.d.ts +1 -0
- package/package.json +1 -1
|
@@ -19,6 +19,7 @@ export interface BrandEquityProps extends ComponentCommonProps {
|
|
|
19
19
|
declare const _default: {
|
|
20
20
|
(props: Omit<BrandEquityProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
21
21
|
className?: string;
|
|
22
|
+
data?: Record<string, any>;
|
|
22
23
|
}): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
displayName: string;
|
|
24
25
|
};
|
|
@@ -22,6 +22,7 @@ export interface CategoryProps {
|
|
|
22
22
|
declare const _default: {
|
|
23
23
|
(props: Omit<CategoryProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
24
24
|
className?: string;
|
|
25
|
+
data?: Record<string, any>;
|
|
25
26
|
}): import("react/jsx-runtime").JSX.Element;
|
|
26
27
|
displayName: string;
|
|
27
28
|
};
|
|
@@ -26,6 +26,7 @@ export interface EvaluateProps {
|
|
|
26
26
|
declare const _default: {
|
|
27
27
|
(props: Omit<EvaluateProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
28
28
|
className?: string;
|
|
29
|
+
data?: Record<string, any>;
|
|
29
30
|
}): import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
displayName: string;
|
|
31
32
|
};
|
|
@@ -15,6 +15,7 @@ export interface GraphicProps extends ComponentCommonProps {
|
|
|
15
15
|
declare const _default: {
|
|
16
16
|
(props: Omit<GraphicProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
17
17
|
className?: string;
|
|
18
|
+
data?: Record<string, any>;
|
|
18
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
displayName: string;
|
|
20
21
|
};
|
|
@@ -20,6 +20,7 @@ interface GraphicAttractionBlockProps extends ComponentCommonProps {
|
|
|
20
20
|
declare const _default: {
|
|
21
21
|
(props: Omit<GraphicAttractionBlockProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
22
22
|
className?: string;
|
|
23
|
+
data?: Record<string, any>;
|
|
23
24
|
}): import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
displayName: string;
|
|
25
26
|
};
|
|
@@ -3,6 +3,7 @@ import type { HeroBannerProps } from './types.js';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<HeroBannerProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -26,6 +26,7 @@ declare const MarqueeTextContent: React.ForwardRefExoticComponent<MarqueeTextCon
|
|
|
26
26
|
declare const _default: {
|
|
27
27
|
(props: Omit<FastMarqueeProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
28
28
|
className?: string;
|
|
29
|
+
data?: Record<string, any>;
|
|
29
30
|
}): import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
displayName: string;
|
|
31
32
|
};
|
|
@@ -2,6 +2,7 @@ import type { MediaPlayerBaseProps } from './types.js';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
(props: Omit<MediaPlayerBaseProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
4
4
|
className?: string;
|
|
5
|
+
data?: Record<string, any>;
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
@@ -2,6 +2,7 @@ import type { MediaPlayerMultiProps } from './types.js';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
(props: Omit<MediaPlayerMultiProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
4
4
|
className?: string;
|
|
5
|
+
data?: Record<string, any>;
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
@@ -2,6 +2,7 @@ import type { MemberEquityProps } from './types.js';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
(props: Omit<MemberEquityProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
4
4
|
className?: string;
|
|
5
|
+
data?: Record<string, any>;
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
@@ -3,6 +3,7 @@ import type { MultiLayoutGraphicBlockProps } from './types';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<MultiLayoutGraphicBlockProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var M=Object.create;var
|
|
1
|
+
"use strict";var M=Object.create;var N=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,z=Object.prototype.hasOwnProperty;var H=(a,l)=>{for(var i in l)N(a,i,{get:l[i],enumerable:!0})},g=(a,l,i,d)=>{if(l&&typeof l=="object"||typeof l=="function")for(let m of R(l))!z.call(a,m)&&m!==i&&N(a,m,{get:()=>l[m],enumerable:!(d=P(l,m))||d.enumerable});return a};var k=(a,l,i)=>(i=a!=null?M(S(a)):{},g(l||!a||!a.__esModule?N(i,"default",{value:a,enumerable:!0}):i,a)),$=a=>g(N({},"__esModule",{value:!0}),a);var E={};H(E,{default:()=>D});module.exports=$(E);var e=require("react/jsx-runtime"),v=k(require("react")),T=require("../../shared/Styles.js"),I=k(require("../../components/picture.js")),x=k(require("../../components/button.js")),w=require("../../components/heading.js"),B=require("../../components/text.js"),o=require("../../components/carousel.js"),c=require("../../components/gird.js"),G=k(require("../Title/index.js")),L=require("../../helpers/utils.js"),u=require("../../components/tabs.js");const h=({item:a,shape:l="square"})=>{const{theme:i="light",title:d,description:m,imageUrl:p,primaryButton:r,secondaryButton:f}=a;return(0,e.jsxs)("div",{className:(0,L.cn)("item-wrapper group relative w-full",{"rounded-box":l==="rounded","aiui-dark":i==="dark"},"text-info-primary"),children:[(0,e.jsx)(I.default,{source:p?.url,className:"inset-0 overflow-hidden",imgClassName:"transition-all duration-300 group-hover:scale-105",style:{aspectRatio:`${p?.width}/${p?.height}`}}),(0,e.jsxs)("div",{className:"laptop:p-6 desktop:p-[32px] absolute inset-x-0 bottom-0 flex flex-col gap-6 p-3",children:[(0,e.jsxs)("div",{children:[(0,e.jsx)(w.Heading,{size:3,className:"item-title",html:d}),(0,e.jsx)(B.Text,{size:2,className:"item-description",html:m})]}),(0,e.jsxs)("div",{className:"flex gap-[16px]",children:[f&&(0,e.jsx)(x.default,{variant:"secondary",asChild:!0,children:(0,e.jsx)("a",{href:f.link,children:f.text})}),r&&(0,e.jsx)(x.default,{variant:"primary",asChild:!0,children:(0,e.jsx)("a",{href:r.link,children:r.text})})]})]})]})},q=v.default.forwardRef((a,l)=>{const{shape:i,sectionTitle:d,groupByTab:m=!1,items:p=[],carousel:r}=a.data,f=t=>{switch(t){case"full":return 12;case"half":return 6;case"one-third":return 4}},y=p.map(t=>t.tabName).filter(Boolean).filter((t,s,n)=>n.indexOf(t)===s),C=y.map(t=>({tabName:t,items:p.filter(s=>s.tabName===t)})).reduce((t,s)=>(t[s.tabName]=s.items,t),{});return(0,e.jsxs)("section",{"data-ui-component-id":"MultiLayoutGraphicBlock",ref:l,className:"text-info-primary",children:[d&&(0,e.jsx)(G.default,{data:{title:d},className:"section-title"}),m?(0,e.jsxs)(u.Tabs,{shape:i,align:"left",defaultValue:y[0],children:[(0,e.jsx)(u.TabsList,{children:y.map((t,s)=>(0,e.jsx)(u.TabsTrigger,{value:t,children:t},s))}),y.map((t,s)=>(0,e.jsx)(u.TabsContent,{value:t,className:"desktop:mt-[36px] mt-[24px] w-full",children:(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(c.Grid,{className:"w-full",children:[C[t].map((n,b)=>(0,e.jsx)(c.GridItem,{span:f(n.width??"full"),className:"laptop:block hidden",children:(0,e.jsx)(h,{item:n})},b)),(0,e.jsx)(c.GridItem,{className:"laptop:hidden block",span:12,children:(0,e.jsx)(o.Carousel,{className:"",children:(0,e.jsx)(o.CarouselContent,{className:"flex",children:C[t].map((n,b)=>(0,e.jsx)(o.CarouselItem,{className:"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5",children:(0,e.jsx)(h,{item:n,shape:i})},b))})})})]}),r&&r?.items.length>0?(0,e.jsx)(o.Carousel,{className:"laptop:mt-4 mt-3",children:(0,e.jsx)(o.CarouselContent,{className:"flex",children:r.items.map((n,b)=>(0,e.jsx)(o.CarouselItem,{className:"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5",children:(0,e.jsx)(h,{item:n,shape:i})},b))})}):null]})},s))]}):(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)(c.Grid,{className:"w-full",children:[p.map((t,s)=>(0,e.jsx)(c.GridItem,{span:f(t.width??"full"),className:"laptop:block hidden",children:(0,e.jsx)(h,{item:t})},s)),p.map((t,s)=>(0,e.jsx)(c.GridItem,{span:f("full"),className:"laptop:hidden block",children:(0,e.jsx)(h,{item:t})},s))]}),r&&r?.items.length>0?(0,e.jsx)(o.Carousel,{className:"laptop:mt-4 mt-3",children:(0,e.jsx)(o.CarouselContent,{className:"flex",children:r.items.map((t,s)=>(0,e.jsx)(o.CarouselItem,{className:"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5",children:(0,e.jsx)(h,{item:t,shape:i})},s))})}):null]})]})});var D=(0,T.withStyles)(q);
|
|
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 from 'react'\nimport type { MultiLayoutGraphicBlockProps, Item } from './types'\nimport { withStyles } from '../../shared/Styles.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport { Heading } from '../../components/heading.js'\nimport { Text } from '../../components/text.js'\nimport { Carousel, CarouselContent, CarouselItem } from '../../components/carousel.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport Title from '../Title/index.js'\nimport type { Shape } from '../../types/props'\nimport { cn } from '../../helpers/utils.js'\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../../components/tabs.js'\nconst ItemBlock = ({ item, shape = 'square' }: { item: Item } & { shape?: Shape }) => {\n const { theme = 'light', title, description, imageUrl, primaryButton, secondaryButton } = item\n\n return (\n <div\n className={cn(\n `item-wrapper relative w-full`,\n {\n 'rounded-box': shape === 'rounded',\n 'aiui-dark': theme === 'dark',\n },\n 'text-info-primary'\n )}\n >\n <Picture\n source={imageUrl?.url}\n className=\"inset-0\"\n style={{ aspectRatio: `${imageUrl?.width}/${imageUrl?.height}` }}\n />\n <div className=\"laptop:p-6 desktop:p-[32px] absolute inset-x-0 bottom-0 flex flex-col gap-6 p-3\">\n <div>\n <Heading size={3} className=\"item-title\" html={title} />\n <Text size={2} className=\"item-description\" html={description} />\n </div>\n <div className=\"flex gap-[16px]\">\n {secondaryButton && (\n <Button variant=\"secondary\" asChild>\n <a href={secondaryButton.link}>{secondaryButton.text}</a>\n </Button>\n )}\n {primaryButton && (\n <Button variant=\"primary\" asChild>\n <a href={primaryButton.link}>{primaryButton.text}</a>\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\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 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 data-ui-component-id=\"MultiLayoutGraphicBlock\" ref={ref} className=\"text-info-primary\">\n {sectionTitle && <Title data={{ title: sectionTitle }} className=\"section-title\" />}\n\n {groupByTab ? (\n <Tabs shape={shape} align=\"left\" defaultValue={tabNames[0]!}>\n <TabsList>\n {tabNames.map((tabName, index) => (\n <TabsTrigger key={index} value={tabName!}>\n {tabName}\n </TabsTrigger>\n ))}\n </TabsList>\n {tabNames.map((tabName, index) => (\n <TabsContent key={index} value={tabName!} className=\"desktop:mt-[36px] mt-[24px] w-full\">\n <>\n <Grid className=\"w-full\">\n {tabItemsMaps[tabName].map((item, index) => (\n <GridItem key={index} span={getSpan(item.width ?? 'full')} className=\"laptop:block hidden\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n {\n <GridItem className=\"laptop:hidden block\" span={12}>\n <Carousel className=\"\">\n <CarouselContent className=\"flex\">\n {tabItemsMaps[tabName].map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n </GridItem>\n }\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <Carousel className=\"laptop:mt-4 mt-3\">\n <CarouselContent className=\"flex\">\n {carousel.items.map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n ) : null}\n </>\n </TabsContent>\n ))}\n </Tabs>\n ) : (\n <>\n <Grid className=\"w-full\">\n {items.map((item, index) => (\n <GridItem key={index} span={getSpan(item.width ?? 'full')} className=\"laptop:block hidden\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n {items.map((item, index) => (\n <GridItem key={index} span={getSpan('full')} className=\"laptop:hidden block\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <Carousel className=\"laptop:mt-4 mt-3\">\n <CarouselContent className=\"flex\">\n {carousel.items.map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n ) : null}\n </>\n )}\n </section>\n )\n})\n\nexport default withStyles(MultiLayoutGraphicBlock)\nexport type { MultiLayoutGraphicBlockProps }\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA2BM,IAAAI,EAAA,6BA3BNC,EAAkB,oBAElBC,EAA2B,kCAC3BC,EAAoB,0CACpBC,EAAmB,yCACnBC,EAAwB,uCACxBC,EAAqB,oCACrBC,EAAwD,wCACxDC,EAA+B,oCAC/BC,EAAkB,gCAElBC,EAAmB,kCACnBC,EAAyD,oCACzD,MAAMC,EAAY,CAAC,CAAE,KAAAC,EAAM,MAAAC,EAAQ,QAAS,IAA0C,CACpF,KAAM,CAAE,MAAAC,EAAQ,QAAS,MAAAC,EAAO,YAAAC,EAAa,SAAAC,EAAU,cAAAC,EAAe,gBAAAC,CAAgB,EAAIP,EAE1F,SACE,QAAC,OACC,aAAW,MACT
|
|
4
|
+
"sourcesContent": ["import React from 'react'\nimport type { MultiLayoutGraphicBlockProps, Item } from './types'\nimport { withStyles } from '../../shared/Styles.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport { Heading } from '../../components/heading.js'\nimport { Text } from '../../components/text.js'\nimport { Carousel, CarouselContent, CarouselItem } from '../../components/carousel.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport Title from '../Title/index.js'\nimport type { Shape } from '../../types/props'\nimport { cn } from '../../helpers/utils.js'\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../../components/tabs.js'\nconst ItemBlock = ({ item, shape = 'square' }: { item: Item } & { shape?: Shape }) => {\n const { theme = 'light', title, description, imageUrl, primaryButton, secondaryButton } = item\n\n return (\n <div\n className={cn(\n `item-wrapper group relative w-full`,\n {\n 'rounded-box': shape === 'rounded',\n 'aiui-dark': theme === 'dark',\n },\n 'text-info-primary'\n )}\n >\n <Picture\n source={imageUrl?.url}\n className=\"inset-0 overflow-hidden\"\n imgClassName=\"transition-all duration-300 group-hover:scale-105\"\n style={{ aspectRatio: `${imageUrl?.width}/${imageUrl?.height}` }}\n />\n <div className=\"laptop:p-6 desktop:p-[32px] absolute inset-x-0 bottom-0 flex flex-col gap-6 p-3\">\n <div>\n <Heading size={3} className=\"item-title\" html={title} />\n <Text size={2} className=\"item-description\" html={description} />\n </div>\n <div className=\"flex gap-[16px]\">\n {secondaryButton && (\n <Button variant=\"secondary\" asChild>\n <a href={secondaryButton.link}>{secondaryButton.text}</a>\n </Button>\n )}\n {primaryButton && (\n <Button variant=\"primary\" asChild>\n <a href={primaryButton.link}>{primaryButton.text}</a>\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\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 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 data-ui-component-id=\"MultiLayoutGraphicBlock\" ref={ref} className=\"text-info-primary\">\n {sectionTitle && <Title data={{ title: sectionTitle }} className=\"section-title\" />}\n\n {groupByTab ? (\n <Tabs shape={shape} align=\"left\" defaultValue={tabNames[0]!}>\n <TabsList>\n {tabNames.map((tabName, index) => (\n <TabsTrigger key={index} value={tabName!}>\n {tabName}\n </TabsTrigger>\n ))}\n </TabsList>\n {tabNames.map((tabName, index) => (\n <TabsContent key={index} value={tabName!} className=\"desktop:mt-[36px] mt-[24px] w-full\">\n <>\n <Grid className=\"w-full\">\n {tabItemsMaps[tabName].map((item, index) => (\n <GridItem key={index} span={getSpan(item.width ?? 'full')} className=\"laptop:block hidden\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n {\n <GridItem className=\"laptop:hidden block\" span={12}>\n <Carousel className=\"\">\n <CarouselContent className=\"flex\">\n {tabItemsMaps[tabName].map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n </GridItem>\n }\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <Carousel className=\"laptop:mt-4 mt-3\">\n <CarouselContent className=\"flex\">\n {carousel.items.map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n ) : null}\n </>\n </TabsContent>\n ))}\n </Tabs>\n ) : (\n <>\n <Grid className=\"w-full\">\n {items.map((item, index) => (\n <GridItem key={index} span={getSpan(item.width ?? 'full')} className=\"laptop:block hidden\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n {items.map((item, index) => (\n <GridItem key={index} span={getSpan('full')} className=\"laptop:hidden block\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <Carousel className=\"laptop:mt-4 mt-3\">\n <CarouselContent className=\"flex\">\n {carousel.items.map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n ) : null}\n </>\n )}\n </section>\n )\n})\n\nexport default withStyles(MultiLayoutGraphicBlock)\nexport type { MultiLayoutGraphicBlockProps }\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA2BM,IAAAI,EAAA,6BA3BNC,EAAkB,oBAElBC,EAA2B,kCAC3BC,EAAoB,0CACpBC,EAAmB,yCACnBC,EAAwB,uCACxBC,EAAqB,oCACrBC,EAAwD,wCACxDC,EAA+B,oCAC/BC,EAAkB,gCAElBC,EAAmB,kCACnBC,EAAyD,oCACzD,MAAMC,EAAY,CAAC,CAAE,KAAAC,EAAM,MAAAC,EAAQ,QAAS,IAA0C,CACpF,KAAM,CAAE,MAAAC,EAAQ,QAAS,MAAAC,EAAO,YAAAC,EAAa,SAAAC,EAAU,cAAAC,EAAe,gBAAAC,CAAgB,EAAIP,EAE1F,SACE,QAAC,OACC,aAAW,MACT,qCACA,CACE,cAAeC,IAAU,UACzB,YAAaC,IAAU,MACzB,EACA,mBACF,EAEA,oBAAC,EAAAM,QAAA,CACC,OAAQH,GAAU,IAClB,UAAU,0BACV,aAAa,oDACb,MAAO,CAAE,YAAa,GAAGA,GAAU,KAAK,IAAIA,GAAU,MAAM,EAAG,EACjE,KACA,QAAC,OAAI,UAAU,kFACb,qBAAC,OACC,oBAAC,WAAQ,KAAM,EAAG,UAAU,aAAa,KAAMF,EAAO,KACtD,OAAC,QAAK,KAAM,EAAG,UAAU,mBAAmB,KAAMC,EAAa,GACjE,KACA,QAAC,OAAI,UAAU,kBACZ,UAAAG,MACC,OAAC,EAAAE,QAAA,CAAO,QAAQ,YAAY,QAAO,GACjC,mBAAC,KAAE,KAAMF,EAAgB,KAAO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qDAClC,mBAACtB,EAAA,CAAU,KAAMC,EAAM,MAAOC,EAAO,GADpBoB,CAEnB,CACD,EACH,EACF,EACE,MACN,GAEJ,CAEJ,CAAC,EAED,IAAOpC,KAAQ,cAAWyB,CAAuB",
|
|
6
6
|
"names": ["MultiLayoutGraphicBlock_exports", "__export", "MultiLayoutGraphicBlock_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_Styles", "import_picture", "import_button", "import_heading", "import_text", "import_carousel", "import_gird", "import_Title", "import_utils", "import_tabs", "ItemBlock", "item", "shape", "theme", "title", "description", "imageUrl", "primaryButton", "secondaryButton", "Picture", "Button", "MultiLayoutGraphicBlock", "React", "props", "ref", "sectionTitle", "groupByTab", "items", "carousel", "getSpan", "width", "tabNames", "index", "arr", "tabItemsMaps", "tabName", "acc", "cur", "Title"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,7 @@ import type { ShelfProps } from './types.js';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
(props: Omit<ShelfProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
4
4
|
className?: string;
|
|
5
|
+
data?: Record<string, any>;
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
@@ -53,6 +53,7 @@ export interface ShelfDisplayProps {
|
|
|
53
53
|
declare const _default: {
|
|
54
54
|
(props: Omit<ShelfDisplayProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
55
55
|
className?: string;
|
|
56
|
+
data?: Record<string, any>;
|
|
56
57
|
}): import("react/jsx-runtime").JSX.Element;
|
|
57
58
|
displayName: string;
|
|
58
59
|
};
|
|
@@ -3,6 +3,7 @@ import type { SloganProps } from './types.js';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<SloganProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var L=Object.create;var g=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var J=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},G=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Y(e))!B.call(t,s)&&s!==r&&g(t,s,{get:()=>e[s],enumerable:!(l=U(e,s))||l.enumerable});return t};var K=(t,e,r)=>(r=t!=null?L(q(t)):{},G(e||!t||!t.__esModule?g(r,"default",{value:t,enumerable:!0}):r,t)),O=t=>G(g({},"__esModule",{value:!0}),t);var W={};J(W,{default:()=>V});module.exports=O(W);var o=require("react/jsx-runtime"),n=K(require("react")),F=require("@gsap/react"),d=require("gsap"),
|
|
1
|
+
"use strict";"use client";var L=Object.create;var g=Object.defineProperty;var U=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,B=Object.prototype.hasOwnProperty;var J=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},G=(t,e,r,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of Y(e))!B.call(t,s)&&s!==r&&g(t,s,{get:()=>e[s],enumerable:!(l=U(e,s))||l.enumerable});return t};var K=(t,e,r)=>(r=t!=null?L(q(t)):{},G(e||!t||!t.__esModule?g(r,"default",{value:t,enumerable:!0}):r,t)),O=t=>G(g({},"__esModule",{value:!0}),t);var W={};J(W,{default:()=>V});module.exports=O(W);var o=require("react/jsx-runtime"),n=K(require("react")),F=require("@gsap/react"),d=require("gsap"),k=require("gsap/dist/SplitText"),x=require("gsap/dist/ScrollTrigger"),D=require("../../helpers/utils.js"),h=require("../../components/index.js"),H=require("../../shared/Styles.js");d.gsap.registerPlugin(k.SplitText,x.ScrollTrigger);function Q(t=[],e=3){const r=[];for(let l=0;l<t.length;l+=e)r.push(t.slice(l,l+e));return r}const R=n.default.forwardRef(({data:t,className:e=""},r)=>{const{title:l,features:s=[],featureChunkSize:N=3}=t,[w,I]=n.default.useState(0),[P,v]=n.default.useState(!0),u=Q(s,N),y=u.length,p=s.length>N,A=p?[...u,u[0]]:u,S=40;n.default.useEffect(()=>{if(!p)return;const a=setInterval(()=>{I(i=>i+1),v(!0)},3e3);return()=>clearInterval(a)},[y,p]),n.default.useEffect(()=>{if(p)if(w===y){const a=setTimeout(()=>{v(!1),I(0)},500);return()=>clearTimeout(a)}else v(!0)},[w,y,p]);const f=(0,n.useRef)(null),m=(0,n.useRef)(null);return(0,F.useGSAP)(()=>{if(!f.current)return;m.current=new k.SplitText(f.current,{type:"words",wordsClass:"word"});const a=m.current.words;return d.gsap.set(a,{opacity:0}),x.ScrollTrigger.create({trigger:f.current,start:"top 80%",end:"top 50%",scrub:!0,onUpdate:i=>{const T=i.progress,c=a.length,C=1/c,E=.5;a.forEach((M,$)=>{const j=$/c*(1-E),z=C*(1+E);let b=(T-j)/z;b=Math.max(0,Math.min(b,1)),d.gsap.set(M,{opacity:b})})}}),()=>{m.current&&m.current.revert(),x.ScrollTrigger.getAll().forEach(i=>i.kill())}},[]),(0,o.jsxs)("div",{ref:r,className:(0,D.cn)("laptop:flex-row laptop:items-end laptop:justify-between text-info-primary laptop:min-h-[64px] lg-desktop:min-h-[128px] flex h-auto w-full flex-col items-start justify-center gap-[24px] text-center",e),children:[(0,o.jsx)(h.Heading,{ref:f,as:"h2",size:2,weight:"bold",align:"left",className:"slogan-title laptop:text-[40px] desktop:text-[48px] lg-desktop:text-[64px] text-[40px] !leading-none text-[#1D1D1F]",children:l}),s&&s.length>0&&(0,o.jsx)("div",{className:"relative w-full max-w-[500px] overflow-hidden",style:{height:`${S}px`},children:(0,o.jsx)("div",{className:(0,D.cn)(["flex flex-col",P?"transition-transform duration-500 ease-[cubic-bezier(.4,0,.2,1)]":"!transition-none"]),style:{transform:`translateY(-${w*S}px)`},children:A.map((a,i)=>(0,o.jsx)("div",{className:"flex w-full flex-row items-stretch gap-3 overflow-hidden",style:{height:`${S}px`},children:a.map((T,c)=>(0,o.jsxs)(n.default.Fragment,{children:[c>0&&(0,o.jsx)("div",{className:"slogan-feature-divider w-px self-stretch bg-[#D9D9D9]"}),(0,o.jsx)(h.Text,{align:"left",as:"p",className:"slogan-feature-text tablet:text-[13px] laptop:text-[14px] line-clamp-2 text-[12px] font-medium leading-[1.4] text-[#1D1D1F]",html:T.title})]},c))},i))})})]})});R.displayName="Slogan";var V=(0,H.withStyles)(R);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Slogan/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useRef } from 'react'\nimport { useGSAP } from '@gsap/react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/SplitText'\nimport { ScrollTrigger } from 'gsap/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading, Text } from '../../components/index.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport type { SloganProps } from './types.js'\n\ngsap.registerPlugin(SplitText, ScrollTrigger)\n\nfunction chunkArray(array: { title: string }[] = [], size: number = 3) {\n const result = []\n for (let i = 0; i < array.length; i += size) {\n result.push(array.slice(i, i + size))\n }\n return result\n}\n\nconst Slogan = React.forwardRef<HTMLDivElement, SloganProps>(({ data, className }, ref) => {\n const { title, features = [], featureChunkSize = 3 } = data\n const [groupIndex, setGroupIndex] = React.useState(0)\n const [isTransitioning, setIsTransitioning] = React.useState(true)\n const featuresGroups = chunkArray(features, featureChunkSize)\n const totalGroups = featuresGroups.length\n const needCarousel = features.length > featureChunkSize\n const displayGroups = needCarousel ? [...featuresGroups, featuresGroups[0]] : featuresGroups\n const groupHeight = 40\n\n // \u53EA\u5728\u9700\u8981\u8F6E\u64AD\u65F6\u542F\u7528\u5B9A\u65F6\u5668\n React.useEffect(() => {\n if (!needCarousel) return\n const timer = setInterval(() => {\n setGroupIndex(i => i + 1)\n setIsTransitioning(true)\n }, 3000)\n return () => clearInterval(timer)\n }, [totalGroups, needCarousel])\n\n // \u53EA\u5728\u9700\u8981\u8F6E\u64AD\u65F6\u5904\u7406\u65E0\u7F1D\u8DF3\u8F6C\n React.useEffect(() => {\n if (!needCarousel) return\n if (groupIndex === totalGroups) {\n const handle = setTimeout(() => {\n setIsTransitioning(false)\n setGroupIndex(0)\n }, 500) // 500ms\u7B49\u4E8E\u52A8\u753B\u65F6\u957F\n return () => clearTimeout(handle)\n } else {\n setIsTransitioning(true)\n }\n }, [groupIndex, totalGroups, needCarousel])\n\n // \u6807\u9898\u52A8\u753B\u903B\u8F91\u4FDD\u6301\u4E0D\u53D8\n const titleRef = useRef(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n useGSAP(() => {\n if (!titleRef.current) return\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 ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'top 80%',\n end: 'top 50%',\n scrub: true,\n onUpdate: self => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word, i) => {\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 return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n ScrollTrigger.getAll().forEach(t => t.kill())\n }\n }, [])\n\n return (\n <div\n ref={ref}\n className={cn(\n 'laptop:flex-row laptop:items-end laptop:justify-between text-info-primary
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmGM,IAAAI,EAAA,6BAlGNC,EAA8B,oBAC9BA,EAAwB,uBACxBC,EAAqB,gBACrBC,EAA0B,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useRef } from 'react'\nimport { useGSAP } from '@gsap/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, Text } from '../../components/index.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport type { SloganProps } from './types.js'\n\ngsap.registerPlugin(SplitText, ScrollTrigger)\n\nfunction chunkArray(array: { title: string }[] = [], size: number = 3) {\n const result = []\n for (let i = 0; i < array.length; i += size) {\n result.push(array.slice(i, i + size))\n }\n return result\n}\n\nconst Slogan = React.forwardRef<HTMLDivElement, SloganProps>(({ data, className = '' }, ref) => {\n const { title, features = [], featureChunkSize = 3 } = data\n const [groupIndex, setGroupIndex] = React.useState(0)\n const [isTransitioning, setIsTransitioning] = React.useState(true)\n const featuresGroups = chunkArray(features, featureChunkSize)\n const totalGroups = featuresGroups.length\n const needCarousel = features.length > featureChunkSize\n const displayGroups = needCarousel ? [...featuresGroups, featuresGroups[0]] : featuresGroups\n const groupHeight = 40\n\n // \u53EA\u5728\u9700\u8981\u8F6E\u64AD\u65F6\u542F\u7528\u5B9A\u65F6\u5668\n React.useEffect(() => {\n if (!needCarousel) return\n const timer = setInterval(() => {\n setGroupIndex(i => i + 1)\n setIsTransitioning(true)\n }, 3000)\n return () => clearInterval(timer)\n }, [totalGroups, needCarousel])\n\n // \u53EA\u5728\u9700\u8981\u8F6E\u64AD\u65F6\u5904\u7406\u65E0\u7F1D\u8DF3\u8F6C\n React.useEffect(() => {\n if (!needCarousel) return\n if (groupIndex === totalGroups) {\n const handle = setTimeout(() => {\n setIsTransitioning(false)\n setGroupIndex(0)\n }, 500) // 500ms\u7B49\u4E8E\u52A8\u753B\u65F6\u957F\n return () => clearTimeout(handle)\n } else {\n setIsTransitioning(true)\n }\n }, [groupIndex, totalGroups, needCarousel])\n\n // \u6807\u9898\u52A8\u753B\u903B\u8F91\u4FDD\u6301\u4E0D\u53D8\n const titleRef = useRef(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n useGSAP(() => {\n if (!titleRef.current) return\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 ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'top 80%',\n end: 'top 50%',\n scrub: true,\n onUpdate: self => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word, i) => {\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 return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n ScrollTrigger.getAll().forEach(t => t.kill())\n }\n }, [])\n\n return (\n <div\n ref={ref}\n className={cn(\n 'laptop:flex-row laptop:items-end laptop:justify-between text-info-primary laptop:min-h-[64px] lg-desktop:min-h-[128px] flex h-auto w-full flex-col items-start justify-center gap-[24px] text-center',\n className\n )}\n >\n <Heading\n ref={titleRef}\n as=\"h2\"\n size={2}\n weight={'bold'}\n align={'left'}\n className=\"slogan-title laptop:text-[40px] desktop:text-[48px] lg-desktop:text-[64px] text-[40px] !leading-none text-[#1D1D1F]\"\n >\n {title}\n </Heading>\n {features && features.length > 0 && (\n <div className=\"relative w-full max-w-[500px] overflow-hidden\" style={{ height: `${groupHeight}px` }}>\n <div\n className={cn([\n 'flex flex-col',\n isTransitioning ? 'transition-transform duration-500 ease-[cubic-bezier(.4,0,.2,1)]' : '!transition-none',\n ])}\n style={{\n transform: `translateY(-${groupIndex * groupHeight}px)`,\n }}\n >\n {displayGroups.map((group, idx) => (\n <div\n className=\"flex w-full flex-row items-stretch gap-3 overflow-hidden\"\n style={{ height: `${groupHeight}px` }}\n key={idx}\n >\n {group.map((feature, index) => (\n <React.Fragment key={index}>\n {index > 0 && <div className=\"slogan-feature-divider w-px self-stretch bg-[#D9D9D9]\" />}\n <Text\n align=\"left\"\n as=\"p\"\n className=\"slogan-feature-text tablet:text-[13px] laptop:text-[14px] line-clamp-2 text-[12px] font-medium leading-[1.4] text-[#1D1D1F]\"\n html={feature.title}\n />\n </React.Fragment>\n ))}\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n )\n})\n\nSlogan.displayName = 'Slogan'\n\nexport default withStyles(Slogan)\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmGM,IAAAI,EAAA,6BAlGNC,EAA8B,oBAC9BA,EAAwB,uBACxBC,EAAqB,gBACrBC,EAA0B,+BAC1BC,EAA8B,mCAC9BC,EAAmB,kCACnBC,EAA8B,qCAC9BC,EAA2B,kCAG3B,OAAK,eAAe,YAAW,eAAa,EAE5C,SAASC,EAAWC,EAA6B,CAAC,EAAGC,EAAe,EAAG,CACrE,MAAMC,EAAS,CAAC,EAChB,QAASC,EAAI,EAAGA,EAAIH,EAAM,OAAQG,GAAKF,EACrCC,EAAO,KAAKF,EAAM,MAAMG,EAAGA,EAAIF,CAAI,CAAC,EAEtC,OAAOC,CACT,CAEA,MAAME,EAAS,EAAAC,QAAM,WAAwC,CAAC,CAAE,KAAAC,EAAM,UAAAC,EAAY,EAAG,EAAGC,IAAQ,CAC9F,KAAM,CAAE,MAAAC,EAAO,SAAAC,EAAW,CAAC,EAAG,iBAAAC,EAAmB,CAAE,EAAIL,EACjD,CAACM,EAAYC,CAAa,EAAI,EAAAR,QAAM,SAAS,CAAC,EAC9C,CAACS,EAAiBC,CAAkB,EAAI,EAAAV,QAAM,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GAC9B,IAAII,GAAWP,EAAWK,GAASC,EACnCC,EAAU,KAAK,IAAI,EAAG,KAAK,IAAIA,EAAS,CAAC,CAAC,EAC1C,OAAK,IAAIH,EAAM,CAAE,QAAAG,CAAQ,CAAC,CAC5B,CAAC,CACH,CACF,CAAC,EACM,IAAM,CACXV,EAAkB,SAAWA,EAAkB,QAAQ,OAAO,EAC9D,gBAAc,OAAO,EAAE,QAAQW,GAAKA,EAAE,KAAK,CAAC,CAC9C,CACF,EAAG,CAAC,CAAC,KAGH,QAAC,OACC,IAAK3B,EACL,aAAW,MACT,uMACAD,CACF,EAEA,oBAAC,WACC,IAAKgB,EACL,GAAG,KACH,KAAM,EACN,OAAQ,OACR,MAAO,OACP,UAAU,sHAET,SAAAd,EACH,EACCC,GAAYA,EAAS,OAAS,MAC7B,OAAC,OAAI,UAAU,gDAAgD,MAAO,CAAE,OAAQ,GAAGU,CAAW,IAAK,EACjG,mBAAC,OACC,aAAW,MAAG,CACZ,gBACAN,EAAkB,mEAAqE,kBACzF,CAAC,EACD,MAAO,CACL,UAAW,eAAeF,EAAaQ,CAAW,KACpD,EAEC,SAAAD,EAAc,IAAI,CAACiB,EAAOC,OACzB,OAAC,OACC,UAAU,2DACV,MAAO,CAAE,OAAQ,GAAGjB,CAAW,IAAK,EAGnC,SAAAgB,EAAM,IAAI,CAACE,EAASC,OACnB,QAAC,EAAAlC,QAAM,SAAN,CACE,UAAAkC,EAAQ,MAAK,OAAC,OAAI,UAAU,wDAAwD,KACrF,OAAC,QACC,MAAM,OACN,GAAG,IACH,UAAU,8HACV,KAAMD,EAAQ,MAChB,IAPmBC,CAQrB,CACD,GAZIF,CAaP,CACD,EACH,EACF,GAEJ,CAEJ,CAAC,EAEDjC,EAAO,YAAc,SAErB,IAAOf,KAAQ,cAAWe,CAAM",
|
|
6
6
|
"names": ["Slogan_exports", "__export", "Slogan_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_gsap", "import_SplitText", "import_ScrollTrigger", "import_utils", "import_components", "import_Styles", "chunkArray", "array", "size", "result", "i", "Slogan", "React", "data", "className", "ref", "title", "features", "featureChunkSize", "groupIndex", "setGroupIndex", "isTransitioning", "setIsTransitioning", "featuresGroups", "totalGroups", "needCarousel", "displayGroups", "groupHeight", "timer", "handle", "titleRef", "splitTextInstance", "words", "self", "progress", "total", "interval", "overlap", "word", "start", "width", "opacity", "t", "group", "idx", "feature", "index"]
|
|
7
7
|
}
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<TabsProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -3,6 +3,7 @@ import type { TitleProps } from './types.js';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<TitleProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -15,7 +15,7 @@ export declare const getStylesProps: <T extends Record<string, unknown>>(props:
|
|
|
15
15
|
* 样式 Hook,返回样式类名和样式组件
|
|
16
16
|
* @param styleProps - 样式属性
|
|
17
17
|
*/
|
|
18
|
-
export declare const useStyles: (styleProps: Partial<StylesProps>) => {
|
|
18
|
+
export declare const useStyles: (styleProps: Partial<StylesProps>, data?: Record<string, any>) => {
|
|
19
19
|
readonly className: `block-${string} `;
|
|
20
20
|
readonly StyleComponent: import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
readonly uid: string;
|
|
@@ -28,6 +28,7 @@ export declare const useStyles: (styleProps: Partial<StylesProps>) => {
|
|
|
28
28
|
export declare function withStyles<P extends object>(WrappedComponent: React.ComponentType<P>, defaultStyleProps?: Partial<StylesProps>): {
|
|
29
29
|
(props: Omit<P, keyof StylesProps> & Partial<StylesProps> & {
|
|
30
30
|
className?: string;
|
|
31
|
+
data?: Record<string, any>;
|
|
31
32
|
}): import("react/jsx-runtime").JSX.Element;
|
|
32
33
|
displayName: string;
|
|
33
34
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var a=Object.defineProperty;var
|
|
1
|
+
"use strict";var g=Object.create;var a=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var f=Object.getOwnPropertyNames;var N=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var b=(t,e)=>{for(var s in e)a(t,s,{get:e[s],enumerable:!0})},i=(t,e,s,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of f(e))!R.call(t,r)&&r!==s&&a(t,r,{get:()=>e[r],enumerable:!(n=p(e,r))||n.enumerable});return t};var $=(t,e,s)=>(s=t!=null?g(N(t)):{},i(e||!t||!t.__esModule?a(s,"default",{value:t,enumerable:!0}):s,t)),k=t=>i(a({},"__esModule",{value:!0}),t);var C={};b(C,{getStylesProps:()=>m,useStyles:()=>S,withStyles:()=>h});module.exports=k(C);var o=require("react/jsx-runtime"),l=require("react"),y=require("./simpleHash.js"),d=$(require("./getKeyPropsString.js"));const c=t=>{const e=(0,d.default)(t);return`style_${(0,y.simpleHash)(e)}`},m=t=>{const{style:e,uid:s,disabled:n}=t;return{style:e,uid:s,disabled:n}},x=({style:t,uid:e=c({}),disabled:s=!1})=>!t||s?null:(0,o.jsx)("style",{suppressHydrationWarning:!0,"data-style-id":e,children:`.block-${e} { ${t} }`}),S=(t,e)=>{const s=(0,l.useMemo)(()=>t?.uid||c({...t,data:e}),[e,t]),n=(0,l.useMemo)(()=>(0,o.jsx)(x,{...t,uid:s}),[t,s]);return{className:`block-${s} `,StyleComponent:n,uid:s}};function h(t,e){const s=function(n){const r={...e,...m(n)},{className:u,StyleComponent:P}=S(r,n.data);return(0,o.jsxs)(o.Fragment,{children:[P,(0,o.jsx)(t,{...n,className:`${u} ${n.className}`})]})};return s.displayName=t.displayName||t.name||"Component",s}
|
|
2
2
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/shared/Styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react'\n\nexport interface StylesProps {\n /** \u81EA\u5B9A\u4E49\u6837\u5F0F\u5B57\u7B26\u4E32 */\n style?: string\n /** \u552F\u4E00\u6807\u8BC6\u7B26 */\n uid?: string\n /** \u662F\u5426\u7981\u7528 */\n disabled?: boolean\n}\n\n/**\n * \u751F\u6210\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Styles_exports", "__export", "getStylesProps", "useStyles", "withStyles", "__toCommonJS", "import_jsx_runtime", "import_react", "generateUID", "props", "style", "uid", "disabled", "Styles", "styleProps", "StyleComponent", "WrappedComponent", "defaultStyleProps", "WithStyles", "finalStyleProps", "className"]
|
|
4
|
+
"sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\n\nexport interface StylesProps {\n /** \u81EA\u5B9A\u4E49\u6837\u5F0F\u5B57\u7B26\u4E32 */\n style?: string\n /** \u552F\u4E00\u6807\u8BC6\u7B26 */\n uid?: string\n /** \u662F\u5426\u7981\u7528 */\n disabled?: boolean\n}\n\n/**\n * \u6839\u636E props \u751F\u6210\u786E\u5B9A\u6027 uid\n */\nconst generateUID = (props: Record<string, any>) => {\n const keyString = getKeyPropsString(props)\n return `style_${simpleHash(keyString)}`\n}\n\n/**\n * \u4ECE\u7EC4\u4EF6 props \u4E2D\u63D0\u53D6\u6837\u5F0F\u76F8\u5173\u5C5E\u6027\n */\nexport const getStylesProps = <T extends Record<string, unknown>>(props: T & StylesProps): StylesProps => {\n const { style, uid, disabled } = props\n return { style, uid, disabled }\n}\n\n/**\n * \u6837\u5F0F\u6CE8\u5165\u7EC4\u4EF6\n */\nconst Styles: React.FC<StylesProps> = ({ style, uid = generateUID({}), disabled = false }) => {\n if (!style || disabled) {\n return null\n }\n\n return <style suppressHydrationWarning data-style-id={uid}>{`.block-${uid} { ${style} }`}</style>\n}\n\n/**\n * \u6837\u5F0F Hook\uFF0C\u8FD4\u56DE\u6837\u5F0F\u7C7B\u540D\u548C\u6837\u5F0F\u7EC4\u4EF6\n * @param styleProps - \u6837\u5F0F\u5C5E\u6027\n */\nexport const useStyles = (styleProps: Partial<StylesProps>, data?: Record<string, any>) => {\n const uid = useMemo(() => styleProps?.uid || generateUID({ ...styleProps, data }), [data, styleProps])\n\n const StyleComponent = useMemo(() => <Styles {...styleProps} uid={uid} />, [styleProps, uid])\n\n return {\n className: `block-${uid} `,\n StyleComponent,\n uid,\n } as const\n}\n\n/**\n * \u6837\u5F0F\u9AD8\u9636\u7EC4\u4EF6\uFF0C \u7528\u4E8E\u7ED9\u7EC4\u4EF6\u7528style \u6807\u7B7E\u7684\u5F62\u5F0F\u8FFD\u52A0\u6837\u5F0F\n * @param WrappedComponent - \u9700\u8981\u5305\u88C5\u7684\u7EC4\u4EF6\n * @param defaultStyleProps - \u9ED8\u8BA4\u6837\u5F0F\u5C5E\u6027\n */\nexport function withStyles<P extends object>(\n WrappedComponent: React.ComponentType<P>,\n defaultStyleProps?: Partial<StylesProps>\n) {\n const WithStyles = function (\n props: Omit<P, keyof StylesProps> & Partial<StylesProps> & { className?: string; data?: Record<string, any> }\n ) {\n const finalStyleProps = {\n ...defaultStyleProps,\n ...getStylesProps(props),\n }\n\n const { className, StyleComponent } = useStyles(finalStyleProps, props.data)\n\n return (\n <>\n {StyleComponent}\n <WrappedComponent {...(props as P)} className={`${className} ${props.className}`} />\n </>\n )\n }\n\n // \u76F4\u63A5\u4F7F\u7528\u539F\u59CB\u7EC4\u4EF6\u7684\u540D\u79F0\n WithStyles.displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component'\n return WithStyles\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,cAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,GAqCS,IAAAM,EAAA,6BArCTC,EAA+B,iBAC/BC,EAA2B,2BAC3BC,EAA8B,qCAc9B,MAAMC,EAAeC,GAA+B,CAClD,MAAMC,KAAY,EAAAC,SAAkBF,CAAK,EACzC,MAAO,YAAS,cAAWC,CAAS,CAAC,EACvC,EAKaV,EAAqDS,GAAwC,CACxG,KAAM,CAAE,MAAAG,EAAO,IAAAC,EAAK,SAAAC,CAAS,EAAIL,EACjC,MAAO,CAAE,MAAAG,EAAO,IAAAC,EAAK,SAAAC,CAAS,CAChC,EAKMC,EAAgC,CAAC,CAAE,MAAAH,EAAO,IAAAC,EAAML,EAAY,CAAC,CAAC,EAAG,SAAAM,EAAW,EAAM,IAClF,CAACF,GAASE,EACL,QAGF,OAAC,SAAM,yBAAwB,GAAC,gBAAeD,EAAM,mBAAUA,CAAG,MAAMD,CAAK,KAAK,EAO9EX,EAAY,CAACe,EAAkCC,IAA+B,CACzF,MAAMJ,KAAM,WAAQ,IAAMG,GAAY,KAAOR,EAAY,CAAE,GAAGQ,EAAY,KAAAC,CAAK,CAAC,EAAG,CAACA,EAAMD,CAAU,CAAC,EAE/FE,KAAiB,WAAQ,OAAM,OAACH,EAAA,CAAQ,GAAGC,EAAY,IAAKH,EAAK,EAAI,CAACG,EAAYH,CAAG,CAAC,EAE5F,MAAO,CACL,UAAW,SAASA,CAAG,IACvB,eAAAK,EACA,IAAAL,CACF,CACF,EAOO,SAASX,EACdiB,EACAC,EACA,CACA,MAAMC,EAAa,SACjBZ,EACA,CACA,MAAMa,EAAkB,CACtB,GAAGF,EACH,GAAGpB,EAAeS,CAAK,CACzB,EAEM,CAAE,UAAAc,EAAW,eAAAL,CAAe,EAAIjB,EAAUqB,EAAiBb,EAAM,IAAI,EAE3E,SACE,oBACG,UAAAS,KACD,OAACC,EAAA,CAAkB,GAAIV,EAAa,UAAW,GAAGc,CAAS,IAAId,EAAM,SAAS,GAAI,GACpF,CAEJ,EAGA,OAAAY,EAAW,YAAcF,EAAiB,aAAeA,EAAiB,MAAQ,YAC3EE,CACT",
|
|
6
|
+
"names": ["Styles_exports", "__export", "getStylesProps", "useStyles", "withStyles", "__toCommonJS", "import_jsx_runtime", "import_react", "import_simpleHash", "import_getKeyPropsString", "generateUID", "props", "keyString", "getKeyPropsString", "style", "uid", "disabled", "Styles", "styleProps", "data", "StyleComponent", "WrappedComponent", "defaultStyleProps", "WithStyles", "finalStyleProps", "className"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var f=(t,n)=>{for(var e in n)a(t,e,{get:n[e],enumerable:!0})},g=(t,n,e,i)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of c(n))!d.call(t,r)&&r!==e&&a(t,r,{get:()=>n[r],enumerable:!(i=u(n,r))||i.enumerable});return t};var s=t=>g(a({},"__esModule",{value:!0}),t);var l={};f(l,{default:()=>y});module.exports=s(l);function y(t){return["style","className","id","name","type","data"].map(e=>{if(e==="data"&&typeof t[e]=="object"&&t[e]!==null)try{return JSON.stringify(t[e])}catch{return""}return t[e]!==void 0?String(t[e]):""}).join("|")}
|
|
2
|
+
//# sourceMappingURL=getKeyPropsString.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/shared/getKeyPropsString.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * \u9009\u53D6\u5173\u952E props \u751F\u6210 key \u5B57\u7B26\u4E32\n */\nexport default function getKeyPropsString(props: Record<string, any>): string {\n const keys = ['style', 'className', 'id', 'name', 'type', 'data']\n return keys\n .map(k => {\n if (k === 'data' && typeof props[k] === 'object' && props[k] !== null) {\n try {\n return JSON.stringify(props[k])\n } catch {\n return ''\n }\n }\n return props[k] !== undefined ? String(props[k]) : ''\n })\n .join('|')\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAGe,SAARE,EAAmCE,EAAoC,CAE5E,MADa,CAAC,QAAS,YAAa,KAAM,OAAQ,OAAQ,MAAM,EAE7D,IAAIC,GAAK,CACR,GAAIA,IAAM,QAAU,OAAOD,EAAMC,CAAC,GAAM,UAAYD,EAAMC,CAAC,IAAM,KAC/D,GAAI,CACF,OAAO,KAAK,UAAUD,EAAMC,CAAC,CAAC,CAChC,MAAQ,CACN,MAAO,EACT,CAEF,OAAOD,EAAMC,CAAC,IAAM,OAAY,OAAOD,EAAMC,CAAC,CAAC,EAAI,EACrD,CAAC,EACA,KAAK,GAAG,CACb",
|
|
6
|
+
"names": ["getKeyPropsString_exports", "__export", "getKeyPropsString", "__toCommonJS", "props", "k"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function simpleHash(str: string): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var h=Object.defineProperty;var a=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var g=(e,t)=>{for(var n in t)h(e,n,{get:t[n],enumerable:!0})},l=(e,t,n,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of o(t))!s.call(e,r)&&r!==n&&h(e,r,{get:()=>t[r],enumerable:!(i=a(t,r))||i.enumerable});return e};var c=e=>l(h({},"__esModule",{value:!0}),e);var p={};g(p,{simpleHash:()=>f});module.exports=c(p);function f(e){let t=5381;for(let n=0;n<e.length;n++)t=(t<<5)+t+e.charCodeAt(n);return Math.abs(t).toString(36)}
|
|
2
|
+
//# sourceMappingURL=simpleHash.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/shared/simpleHash.ts"],
|
|
4
|
+
"sourcesContent": ["export function simpleHash(str: string): string {\n let hash = 5381\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) + hash + str.charCodeAt(i)\n }\n return Math.abs(hash).toString(36)\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,gBAAAE,IAAA,eAAAC,EAAAH,GAAO,SAASE,EAAWE,EAAqB,CAC9C,IAAIC,EAAO,KACX,QAASC,EAAI,EAAGA,EAAIF,EAAI,OAAQE,IAC9BD,GAAQA,GAAQ,GAAKA,EAAOD,EAAI,WAAWE,CAAC,EAE9C,OAAO,KAAK,IAAID,CAAI,EAAE,SAAS,EAAE,CACnC",
|
|
6
|
+
"names": ["simpleHash_exports", "__export", "simpleHash", "__toCommonJS", "str", "hash", "i"]
|
|
7
|
+
}
|
|
@@ -5,6 +5,7 @@ declare const meta: {
|
|
|
5
5
|
component: {
|
|
6
6
|
(props: Omit<import("../biz-components/HeroBanner/types.js").HeroBannerProps & import("react").RefAttributes<HTMLDivElement>, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
7
7
|
className?: string;
|
|
8
|
+
data?: Record<string, any>;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/BrandEquity/BrandEquity.js").BrandEquityProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/Category/index.js").CategoryProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/Evaluate/index.js").EvaluateProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/Graphic/index.js").GraphicProps & import("react").RefAttributes<HTMLDivElement>, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -40,7 +41,7 @@ declare const meta: {
|
|
|
40
41
|
title: string;
|
|
41
42
|
textColor?: string;
|
|
42
43
|
}[];
|
|
43
|
-
}
|
|
44
|
+
} & Record<string, any>;
|
|
44
45
|
shape?: "round" | "square" | undefined;
|
|
45
46
|
event?: any;
|
|
46
47
|
condition?: any;
|
|
@@ -5,6 +5,7 @@ declare const meta: {
|
|
|
5
5
|
component: {
|
|
6
6
|
(props: Omit<import("react-fast-marquee").MarqueeProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
7
7
|
className?: string;
|
|
8
|
+
data?: Record<string, any>;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/MediaPlayerMulti/types.js").MediaPlayerMultiProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/Shelf/types.js").ShelfProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/ShelfDisplay/index.js").ShelfDisplayProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -5,6 +5,7 @@ declare const meta: {
|
|
|
5
5
|
component: {
|
|
6
6
|
(props: Omit<import("../biz-components/Slogan/types.js").SloganProps & React.RefAttributes<HTMLDivElement>, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
7
7
|
className?: string;
|
|
8
|
+
data?: Record<string, any>;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|
|
@@ -19,6 +19,7 @@ export interface BrandEquityProps extends ComponentCommonProps {
|
|
|
19
19
|
declare const _default: {
|
|
20
20
|
(props: Omit<BrandEquityProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
21
21
|
className?: string;
|
|
22
|
+
data?: Record<string, any>;
|
|
22
23
|
}): import("react/jsx-runtime").JSX.Element;
|
|
23
24
|
displayName: string;
|
|
24
25
|
};
|
|
@@ -22,6 +22,7 @@ export interface CategoryProps {
|
|
|
22
22
|
declare const _default: {
|
|
23
23
|
(props: Omit<CategoryProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
24
24
|
className?: string;
|
|
25
|
+
data?: Record<string, any>;
|
|
25
26
|
}): import("react/jsx-runtime").JSX.Element;
|
|
26
27
|
displayName: string;
|
|
27
28
|
};
|
|
@@ -26,6 +26,7 @@ export interface EvaluateProps {
|
|
|
26
26
|
declare const _default: {
|
|
27
27
|
(props: Omit<EvaluateProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
28
28
|
className?: string;
|
|
29
|
+
data?: Record<string, any>;
|
|
29
30
|
}): import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
displayName: string;
|
|
31
32
|
};
|
|
@@ -15,6 +15,7 @@ export interface GraphicProps extends ComponentCommonProps {
|
|
|
15
15
|
declare const _default: {
|
|
16
16
|
(props: Omit<GraphicProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
17
17
|
className?: string;
|
|
18
|
+
data?: Record<string, any>;
|
|
18
19
|
}): import("react/jsx-runtime").JSX.Element;
|
|
19
20
|
displayName: string;
|
|
20
21
|
};
|
|
@@ -20,6 +20,7 @@ interface GraphicAttractionBlockProps extends ComponentCommonProps {
|
|
|
20
20
|
declare const _default: {
|
|
21
21
|
(props: Omit<GraphicAttractionBlockProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
22
22
|
className?: string;
|
|
23
|
+
data?: Record<string, any>;
|
|
23
24
|
}): import("react/jsx-runtime").JSX.Element;
|
|
24
25
|
displayName: string;
|
|
25
26
|
};
|
|
@@ -3,6 +3,7 @@ import type { HeroBannerProps } from './types.js';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<HeroBannerProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -26,6 +26,7 @@ declare const MarqueeTextContent: React.ForwardRefExoticComponent<MarqueeTextCon
|
|
|
26
26
|
declare const _default: {
|
|
27
27
|
(props: Omit<FastMarqueeProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
28
28
|
className?: string;
|
|
29
|
+
data?: Record<string, any>;
|
|
29
30
|
}): import("react/jsx-runtime").JSX.Element;
|
|
30
31
|
displayName: string;
|
|
31
32
|
};
|
|
@@ -2,6 +2,7 @@ import type { MediaPlayerBaseProps } from './types.js';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
(props: Omit<MediaPlayerBaseProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
4
4
|
className?: string;
|
|
5
|
+
data?: Record<string, any>;
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
@@ -2,6 +2,7 @@ import type { MediaPlayerMultiProps } from './types.js';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
(props: Omit<MediaPlayerMultiProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
4
4
|
className?: string;
|
|
5
|
+
data?: Record<string, any>;
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
@@ -2,6 +2,7 @@ import type { MemberEquityProps } from './types.js';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
(props: Omit<MemberEquityProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
4
4
|
className?: string;
|
|
5
|
+
data?: Record<string, any>;
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
@@ -3,6 +3,7 @@ import type { MultiLayoutGraphicBlockProps } from './types';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<MultiLayoutGraphicBlockProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as v,jsx as e,jsxs as l}from"react/jsx-runtime";import T from"react";import{withStyles as I}from"../../shared/Styles.js";import w from"../../components/picture.js";import C from"../../components/button.js";import{Heading as B}from"../../components/heading.js";import{Text as G}from"../../components/text.js";import{Carousel as y,CarouselContent as N,CarouselItem as k}from"../../components/carousel.js";import{Grid as g,GridItem as d}from"../../components/gird.js";import L from"../Title/index.js";import{cn as M}from"../../helpers/utils.js";import{Tabs as P,TabsList as R,TabsTrigger as S,TabsContent as z}from"../../components/tabs.js";const p=({item:f,shape:h="square"})=>{const{theme:m="light",title:c,description:b,imageUrl:i,primaryButton:s,secondaryButton:r}=f;return l("div",{className:M("item-wrapper group relative w-full",{"rounded-box":h==="rounded","aiui-dark":m==="dark"},"text-info-primary"),children:[e(w,{source:i?.url,className:"inset-0 overflow-hidden",imgClassName:"transition-all duration-300 group-hover:scale-105",style:{aspectRatio:`${i?.width}/${i?.height}`}}),l("div",{className:"laptop:p-6 desktop:p-[32px] absolute inset-x-0 bottom-0 flex flex-col gap-6 p-3",children:[l("div",{children:[e(B,{size:3,className:"item-title",html:c}),e(G,{size:2,className:"item-description",html:b})]}),l("div",{className:"flex gap-[16px]",children:[r&&e(C,{variant:"secondary",asChild:!0,children:e("a",{href:r.link,children:r.text})}),s&&e(C,{variant:"primary",asChild:!0,children:e("a",{href:s.link,children:s.text})})]})]})]})},H=T.forwardRef((f,h)=>{const{shape:m,sectionTitle:c,groupByTab:b=!1,items:i=[],carousel:s}=f.data,r=t=>{switch(t){case"full":return 12;case"half":return 6;case"one-third":return 4}},u=i.map(t=>t.tabName).filter(Boolean).filter((t,a,o)=>o.indexOf(t)===a),x=u.map(t=>({tabName:t,items:i.filter(a=>a.tabName===t)})).reduce((t,a)=>(t[a.tabName]=a.items,t),{});return l("section",{"data-ui-component-id":"MultiLayoutGraphicBlock",ref:h,className:"text-info-primary",children:[c&&e(L,{data:{title:c},className:"section-title"}),b?l(P,{shape:m,align:"left",defaultValue:u[0],children:[e(R,{children:u.map((t,a)=>e(S,{value:t,children:t},a))}),u.map((t,a)=>e(z,{value:t,className:"desktop:mt-[36px] mt-[24px] w-full",children:l(v,{children:[l(g,{className:"w-full",children:[x[t].map((o,n)=>e(d,{span:r(o.width??"full"),className:"laptop:block hidden",children:e(p,{item:o})},n)),e(d,{className:"laptop:hidden block",span:12,children:e(y,{className:"",children:e(N,{className:"flex",children:x[t].map((o,n)=>e(k,{className:"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5",children:e(p,{item:o,shape:m})},n))})})})]}),s&&s?.items.length>0?e(y,{className:"laptop:mt-4 mt-3",children:e(N,{className:"flex",children:s.items.map((o,n)=>e(k,{className:"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5",children:e(p,{item:o,shape:m})},n))})}):null]})},a))]}):l(v,{children:[l(g,{className:"w-full",children:[i.map((t,a)=>e(d,{span:r(t.width??"full"),className:"laptop:block hidden",children:e(p,{item:t})},a)),i.map((t,a)=>e(d,{span:r("full"),className:"laptop:hidden block",children:e(p,{item:t})},a))]}),s&&s?.items.length>0?e(y,{className:"laptop:mt-4 mt-3",children:e(N,{className:"flex",children:s.items.map((t,a)=>e(k,{className:"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5",children:e(p,{item:t,shape:m})},a))})}):null]})]})});var Q=I(H);export{Q 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 from 'react'\nimport type { MultiLayoutGraphicBlockProps, Item } from './types'\nimport { withStyles } from '../../shared/Styles.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport { Heading } from '../../components/heading.js'\nimport { Text } from '../../components/text.js'\nimport { Carousel, CarouselContent, CarouselItem } from '../../components/carousel.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport Title from '../Title/index.js'\nimport type { Shape } from '../../types/props'\nimport { cn } from '../../helpers/utils.js'\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../../components/tabs.js'\nconst ItemBlock = ({ item, shape = 'square' }: { item: Item } & { shape?: Shape }) => {\n const { theme = 'light', title, description, imageUrl, primaryButton, secondaryButton } = item\n\n return (\n <div\n className={cn(\n `item-wrapper relative w-full`,\n {\n 'rounded-box': shape === 'rounded',\n 'aiui-dark': theme === 'dark',\n },\n 'text-info-primary'\n )}\n >\n <Picture\n source={imageUrl?.url}\n className=\"inset-0\"\n style={{ aspectRatio: `${imageUrl?.width}/${imageUrl?.height}` }}\n />\n <div className=\"laptop:p-6 desktop:p-[32px] absolute inset-x-0 bottom-0 flex flex-col gap-6 p-3\">\n <div>\n <Heading size={3} className=\"item-title\" html={title} />\n <Text size={2} className=\"item-description\" html={description} />\n </div>\n <div className=\"flex gap-[16px]\">\n {secondaryButton && (\n <Button variant=\"secondary\" asChild>\n <a href={secondaryButton.link}>{secondaryButton.text}</a>\n </Button>\n )}\n {primaryButton && (\n <Button variant=\"primary\" asChild>\n <a href={primaryButton.link}>{primaryButton.text}</a>\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\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 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 data-ui-component-id=\"MultiLayoutGraphicBlock\" ref={ref} className=\"text-info-primary\">\n {sectionTitle && <Title data={{ title: sectionTitle }} className=\"section-title\" />}\n\n {groupByTab ? (\n <Tabs shape={shape} align=\"left\" defaultValue={tabNames[0]!}>\n <TabsList>\n {tabNames.map((tabName, index) => (\n <TabsTrigger key={index} value={tabName!}>\n {tabName}\n </TabsTrigger>\n ))}\n </TabsList>\n {tabNames.map((tabName, index) => (\n <TabsContent key={index} value={tabName!} className=\"desktop:mt-[36px] mt-[24px] w-full\">\n <>\n <Grid className=\"w-full\">\n {tabItemsMaps[tabName].map((item, index) => (\n <GridItem key={index} span={getSpan(item.width ?? 'full')} className=\"laptop:block hidden\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n {\n <GridItem className=\"laptop:hidden block\" span={12}>\n <Carousel className=\"\">\n <CarouselContent className=\"flex\">\n {tabItemsMaps[tabName].map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n </GridItem>\n }\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <Carousel className=\"laptop:mt-4 mt-3\">\n <CarouselContent className=\"flex\">\n {carousel.items.map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n ) : null}\n </>\n </TabsContent>\n ))}\n </Tabs>\n ) : (\n <>\n <Grid className=\"w-full\">\n {items.map((item, index) => (\n <GridItem key={index} span={getSpan(item.width ?? 'full')} className=\"laptop:block hidden\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n {items.map((item, index) => (\n <GridItem key={index} span={getSpan('full')} className=\"laptop:hidden block\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <Carousel className=\"laptop:mt-4 mt-3\">\n <CarouselContent className=\"flex\">\n {carousel.items.map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n ) : null}\n </>\n )}\n </section>\n )\n})\n\nexport default withStyles(MultiLayoutGraphicBlock)\nexport type { MultiLayoutGraphicBlockProps }\n"],
|
|
5
|
-
"mappings": "AA2BM,
|
|
4
|
+
"sourcesContent": ["import React from 'react'\nimport type { MultiLayoutGraphicBlockProps, Item } from './types'\nimport { withStyles } from '../../shared/Styles.js'\nimport Picture from '../../components/picture.js'\nimport Button from '../../components/button.js'\nimport { Heading } from '../../components/heading.js'\nimport { Text } from '../../components/text.js'\nimport { Carousel, CarouselContent, CarouselItem } from '../../components/carousel.js'\nimport { Grid, GridItem } from '../../components/gird.js'\nimport Title from '../Title/index.js'\nimport type { Shape } from '../../types/props'\nimport { cn } from '../../helpers/utils.js'\nimport { Tabs, TabsList, TabsTrigger, TabsContent } from '../../components/tabs.js'\nconst ItemBlock = ({ item, shape = 'square' }: { item: Item } & { shape?: Shape }) => {\n const { theme = 'light', title, description, imageUrl, primaryButton, secondaryButton } = item\n\n return (\n <div\n className={cn(\n `item-wrapper group relative w-full`,\n {\n 'rounded-box': shape === 'rounded',\n 'aiui-dark': theme === 'dark',\n },\n 'text-info-primary'\n )}\n >\n <Picture\n source={imageUrl?.url}\n className=\"inset-0 overflow-hidden\"\n imgClassName=\"transition-all duration-300 group-hover:scale-105\"\n style={{ aspectRatio: `${imageUrl?.width}/${imageUrl?.height}` }}\n />\n <div className=\"laptop:p-6 desktop:p-[32px] absolute inset-x-0 bottom-0 flex flex-col gap-6 p-3\">\n <div>\n <Heading size={3} className=\"item-title\" html={title} />\n <Text size={2} className=\"item-description\" html={description} />\n </div>\n <div className=\"flex gap-[16px]\">\n {secondaryButton && (\n <Button variant=\"secondary\" asChild>\n <a href={secondaryButton.link}>{secondaryButton.text}</a>\n </Button>\n )}\n {primaryButton && (\n <Button variant=\"primary\" asChild>\n <a href={primaryButton.link}>{primaryButton.text}</a>\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\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 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 data-ui-component-id=\"MultiLayoutGraphicBlock\" ref={ref} className=\"text-info-primary\">\n {sectionTitle && <Title data={{ title: sectionTitle }} className=\"section-title\" />}\n\n {groupByTab ? (\n <Tabs shape={shape} align=\"left\" defaultValue={tabNames[0]!}>\n <TabsList>\n {tabNames.map((tabName, index) => (\n <TabsTrigger key={index} value={tabName!}>\n {tabName}\n </TabsTrigger>\n ))}\n </TabsList>\n {tabNames.map((tabName, index) => (\n <TabsContent key={index} value={tabName!} className=\"desktop:mt-[36px] mt-[24px] w-full\">\n <>\n <Grid className=\"w-full\">\n {tabItemsMaps[tabName].map((item, index) => (\n <GridItem key={index} span={getSpan(item.width ?? 'full')} className=\"laptop:block hidden\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n {\n <GridItem className=\"laptop:hidden block\" span={12}>\n <Carousel className=\"\">\n <CarouselContent className=\"flex\">\n {tabItemsMaps[tabName].map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n </GridItem>\n }\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <Carousel className=\"laptop:mt-4 mt-3\">\n <CarouselContent className=\"flex\">\n {carousel.items.map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n ) : null}\n </>\n </TabsContent>\n ))}\n </Tabs>\n ) : (\n <>\n <Grid className=\"w-full\">\n {items.map((item, index) => (\n <GridItem key={index} span={getSpan(item.width ?? 'full')} className=\"laptop:block hidden\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n {items.map((item, index) => (\n <GridItem key={index} span={getSpan('full')} className=\"laptop:hidden block\">\n <ItemBlock item={item} />\n </GridItem>\n ))}\n </Grid>\n {carousel && carousel?.items.length > 0 ? (\n <Carousel className=\"laptop:mt-4 mt-3\">\n <CarouselContent className=\"flex\">\n {carousel.items.map((item, index) => (\n <CarouselItem key={index} className=\"tablet:basis-2/5 laptop:basis-[32%] flex basis-4/5\">\n <ItemBlock item={item} shape={shape} />\n </CarouselItem>\n ))}\n </CarouselContent>\n </Carousel>\n ) : null}\n </>\n )}\n </section>\n )\n})\n\nexport default withStyles(MultiLayoutGraphicBlock)\nexport type { MultiLayoutGraphicBlockProps }\n"],
|
|
5
|
+
"mappings": "AA2BM,OA2EQ,YAAAA,EA3ER,OAAAC,EAOE,QAAAC,MAPF,oBA3BN,OAAOC,MAAW,QAElB,OAAS,cAAAC,MAAkB,yBAC3B,OAAOC,MAAa,8BACpB,OAAOC,MAAY,6BACnB,OAAS,WAAAC,MAAe,8BACxB,OAAS,QAAAC,MAAY,2BACrB,OAAS,YAAAC,EAAU,mBAAAC,EAAiB,gBAAAC,MAAoB,+BACxD,OAAS,QAAAC,EAAM,YAAAC,MAAgB,2BAC/B,OAAOC,MAAW,oBAElB,OAAS,MAAAC,MAAU,yBACnB,OAAS,QAAAC,EAAM,YAAAC,EAAU,eAAAC,EAAa,eAAAC,MAAmB,2BACzD,MAAMC,EAAY,CAAC,CAAE,KAAAC,EAAM,MAAAC,EAAQ,QAAS,IAA0C,CACpF,KAAM,CAAE,MAAAC,EAAQ,QAAS,MAAAC,EAAO,YAAAC,EAAa,SAAAC,EAAU,cAAAC,EAAe,gBAAAC,CAAg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AR,EAACS,EAAA,CAAgB,UAAU,OACxB,SAAAyB,EAAS,MAAM,IAAI,CAACd,EAAMkB,IACzBtC,EAACU,EAAA,CAAyB,UAAU,qDAClC,SAAAV,EAACmB,EAAA,CAAU,KAAMC,EAAM,MAAOC,EAAO,GADpBiB,CAEnB,CACD,EACH,EACF,EACE,MACN,GAjCgBA,CAkClB,CACD,GACH,EAEArC,EAAAF,EAAA,CACE,UAAAE,EAACU,EAAA,CAAK,UAAU,SACb,UAAAsB,EAAM,IAAI,CAACb,EAAMkB,IAChBtC,EAACY,EAAA,CAAqB,KAAMuB,EAAQf,EAAK,OAAS,MAAM,EAAG,UAAU,sBACnE,SAAApB,EAACmB,EAAA,CAAU,KAAMC,EAAM,GADVkB,CAEf,CACD,EACAL,EAAM,IAAI,CAACb,EAAMkB,IAChBtC,EAACY,EAAA,CAAqB,KAAMuB,EAAQ,MAAM,EAAG,UAAU,sBACrD,SAAAnC,EAACmB,EAAA,CAAU,KAAMC,EAAM,GADVkB,CAEf,CACD,GACH,EACCJ,GAAYA,GAAU,MAAM,OAAS,EACpClC,EAACQ,EAAA,CAAS,UAAU,mBAClB,SAAAR,EAACS,EAAA,CAAgB,UAAU,OACxB,SAAAyB,EAAS,MAAM,IAAI,CAACd,EAAMkB,IACzBtC,EAACU,EAAA,CAAyB,UAAU,qDAClC,SAAAV,EAACmB,EAAA,CAAU,KAAMC,EAAM,MAAOC,EAAO,GADpBiB,CAEnB,CACD,EACH,EACF,EACE,MACN,GAEJ,CAEJ,CAAC,EAED,IAAOM,EAAQzC,EAAWyB,CAAuB",
|
|
6
6
|
"names": ["Fragment", "jsx", "jsxs", "React", "withStyles", "Picture", "Button", "Heading", "Text", "Carousel", "CarouselContent", "CarouselItem", "Grid", "GridItem", "Title", "cn", "Tabs", "TabsList", "TabsTrigger", "TabsContent", "ItemBlock", "item", "shape", "theme", "title", "description", "imageUrl", "primaryButton", "secondaryButton", "MultiLayoutGraphicBlock", "props", "ref", "sectionTitle", "groupByTab", "items", "carousel", "getSpan", "width", "tabNames", "index", "arr", "tabItemsMaps", "tabName", "acc", "cur", "MultiLayoutGraphicBlock_default"]
|
|
7
7
|
}
|
|
@@ -2,6 +2,7 @@ import type { ShelfProps } from './types.js';
|
|
|
2
2
|
declare const _default: {
|
|
3
3
|
(props: Omit<ShelfProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
4
4
|
className?: string;
|
|
5
|
+
data?: Record<string, any>;
|
|
5
6
|
}): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
displayName: string;
|
|
7
8
|
};
|
|
@@ -53,6 +53,7 @@ export interface ShelfDisplayProps {
|
|
|
53
53
|
declare const _default: {
|
|
54
54
|
(props: Omit<ShelfDisplayProps, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
55
55
|
className?: string;
|
|
56
|
+
data?: Record<string, any>;
|
|
56
57
|
}): import("react/jsx-runtime").JSX.Element;
|
|
57
58
|
displayName: string;
|
|
58
59
|
};
|
|
@@ -3,6 +3,7 @@ import type { SloganProps } from './types.js';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<SloganProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as n,jsxs as G}from"react/jsx-runtime";import s,{useRef as D}from"react";import{useGSAP as $}from"@gsap/react";import{gsap as y}from"gsap";import{SplitText as N}from"gsap/SplitText";import{ScrollTrigger as S}from"gsap/ScrollTrigger";import{cn as I}from"../../helpers/utils.js";import{Heading as j,Text as z}from"../../components/index.js";import{withStyles as L}from"../../shared/Styles.js";y.registerPlugin(N,S);function U(a=[],i=3){const p=[];for(let r=0;r<a.length;r+=i)p.push(a.slice(r,r+i));return p}const E=s.forwardRef(({data:a,className:i},p)=>{const{title:r,features:c=[],featureChunkSize:T=3}=a,[g,
|
|
1
|
+
"use client";import{jsx as n,jsxs as G}from"react/jsx-runtime";import s,{useRef as D}from"react";import{useGSAP as $}from"@gsap/react";import{gsap as y}from"gsap";import{SplitText as N}from"gsap/dist/SplitText";import{ScrollTrigger as S}from"gsap/dist/ScrollTrigger";import{cn as I}from"../../helpers/utils.js";import{Heading as j,Text as z}from"../../components/index.js";import{withStyles as L}from"../../shared/Styles.js";y.registerPlugin(N,S);function U(a=[],i=3){const p=[];for(let r=0;r<a.length;r+=i)p.push(a.slice(r,r+i));return p}const E=s.forwardRef(({data:a,className:i=""},p)=>{const{title:r,features:c=[],featureChunkSize:T=3}=a,[g,b]=s.useState(0),[R,d]=s.useState(!0),u=U(c,T),x=u.length,o=c.length>T,F=o?[...u,u[0]]:u,h=40;s.useEffect(()=>{if(!o)return;const t=setInterval(()=>{b(e=>e+1),d(!0)},3e3);return()=>clearInterval(t)},[x,o]),s.useEffect(()=>{if(o)if(g===x){const t=setTimeout(()=>{d(!1),b(0)},500);return()=>clearTimeout(t)}else d(!0)},[g,x,o]);const f=D(null),m=D(null);return $(()=>{if(!f.current)return;m.current=new N(f.current,{type:"words",wordsClass:"word"});const t=m.current.words;return y.set(t,{opacity:0}),S.create({trigger:f.current,start:"top 80%",end:"top 50%",scrub:!0,onUpdate:e=>{const w=e.progress,l=t.length,H=1/l,k=.5;t.forEach((P,A)=>{const C=A/l*(1-k),M=H*(1+k);let v=(w-C)/M;v=Math.max(0,Math.min(v,1)),y.set(P,{opacity:v})})}}),()=>{m.current&&m.current.revert(),S.getAll().forEach(e=>e.kill())}},[]),G("div",{ref:p,className:I("laptop:flex-row laptop:items-end laptop:justify-between text-info-primary laptop:min-h-[64px] lg-desktop:min-h-[128px] flex h-auto w-full flex-col items-start justify-center gap-[24px] text-center",i),children:[n(j,{ref:f,as:"h2",size:2,weight:"bold",align:"left",className:"slogan-title laptop:text-[40px] desktop:text-[48px] lg-desktop:text-[64px] text-[40px] !leading-none text-[#1D1D1F]",children:r}),c&&c.length>0&&n("div",{className:"relative w-full max-w-[500px] overflow-hidden",style:{height:`${h}px`},children:n("div",{className:I(["flex flex-col",R?"transition-transform duration-500 ease-[cubic-bezier(.4,0,.2,1)]":"!transition-none"]),style:{transform:`translateY(-${g*h}px)`},children:F.map((t,e)=>n("div",{className:"flex w-full flex-row items-stretch gap-3 overflow-hidden",style:{height:`${h}px`},children:t.map((w,l)=>G(s.Fragment,{children:[l>0&&n("div",{className:"slogan-feature-divider w-px self-stretch bg-[#D9D9D9]"}),n(z,{align:"left",as:"p",className:"slogan-feature-text tablet:text-[13px] laptop:text-[14px] line-clamp-2 text-[12px] font-medium leading-[1.4] text-[#1D1D1F]",html:w.title})]},l))},e))})})]})});E.displayName="Slogan";var W=L(E);export{W as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Slogan/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useRef } from 'react'\nimport { useGSAP } from '@gsap/react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/SplitText'\nimport { ScrollTrigger } from 'gsap/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { Heading, Text } from '../../components/index.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport type { SloganProps } from './types.js'\n\ngsap.registerPlugin(SplitText, ScrollTrigger)\n\nfunction chunkArray(array: { title: string }[] = [], size: number = 3) {\n const result = []\n for (let i = 0; i < array.length; i += size) {\n result.push(array.slice(i, i + size))\n }\n return result\n}\n\nconst Slogan = React.forwardRef<HTMLDivElement, SloganProps>(({ data, className }, ref) => {\n const { title, features = [], featureChunkSize = 3 } = data\n const [groupIndex, setGroupIndex] = React.useState(0)\n const [isTransitioning, setIsTransitioning] = React.useState(true)\n const featuresGroups = chunkArray(features, featureChunkSize)\n const totalGroups = featuresGroups.length\n const needCarousel = features.length > featureChunkSize\n const displayGroups = needCarousel ? [...featuresGroups, featuresGroups[0]] : featuresGroups\n const groupHeight = 40\n\n // \u53EA\u5728\u9700\u8981\u8F6E\u64AD\u65F6\u542F\u7528\u5B9A\u65F6\u5668\n React.useEffect(() => {\n if (!needCarousel) return\n const timer = setInterval(() => {\n setGroupIndex(i => i + 1)\n setIsTransitioning(true)\n }, 3000)\n return () => clearInterval(timer)\n }, [totalGroups, needCarousel])\n\n // \u53EA\u5728\u9700\u8981\u8F6E\u64AD\u65F6\u5904\u7406\u65E0\u7F1D\u8DF3\u8F6C\n React.useEffect(() => {\n if (!needCarousel) return\n if (groupIndex === totalGroups) {\n const handle = setTimeout(() => {\n setIsTransitioning(false)\n setGroupIndex(0)\n }, 500) // 500ms\u7B49\u4E8E\u52A8\u753B\u65F6\u957F\n return () => clearTimeout(handle)\n } else {\n setIsTransitioning(true)\n }\n }, [groupIndex, totalGroups, needCarousel])\n\n // \u6807\u9898\u52A8\u753B\u903B\u8F91\u4FDD\u6301\u4E0D\u53D8\n const titleRef = useRef(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n useGSAP(() => {\n if (!titleRef.current) return\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 ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'top 80%',\n end: 'top 50%',\n scrub: true,\n onUpdate: self => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word, i) => {\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 return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n ScrollTrigger.getAll().forEach(t => t.kill())\n }\n }, [])\n\n return (\n <div\n ref={ref}\n className={cn(\n 'laptop:flex-row laptop:items-end laptop:justify-between text-info-primary
|
|
5
|
-
"mappings": "aAmGM,cAAAA,EA4BY,QAAAC,MA5BZ,oBAlGN,OAAOC,GAAS,UAAAC,MAAc,QAC9B,OAAS,WAAAC,MAAe,cACxB,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useRef } from 'react'\nimport { useGSAP } from '@gsap/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, Text } from '../../components/index.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport type { SloganProps } from './types.js'\n\ngsap.registerPlugin(SplitText, ScrollTrigger)\n\nfunction chunkArray(array: { title: string }[] = [], size: number = 3) {\n const result = []\n for (let i = 0; i < array.length; i += size) {\n result.push(array.slice(i, i + size))\n }\n return result\n}\n\nconst Slogan = React.forwardRef<HTMLDivElement, SloganProps>(({ data, className = '' }, ref) => {\n const { title, features = [], featureChunkSize = 3 } = data\n const [groupIndex, setGroupIndex] = React.useState(0)\n const [isTransitioning, setIsTransitioning] = React.useState(true)\n const featuresGroups = chunkArray(features, featureChunkSize)\n const totalGroups = featuresGroups.length\n const needCarousel = features.length > featureChunkSize\n const displayGroups = needCarousel ? [...featuresGroups, featuresGroups[0]] : featuresGroups\n const groupHeight = 40\n\n // \u53EA\u5728\u9700\u8981\u8F6E\u64AD\u65F6\u542F\u7528\u5B9A\u65F6\u5668\n React.useEffect(() => {\n if (!needCarousel) return\n const timer = setInterval(() => {\n setGroupIndex(i => i + 1)\n setIsTransitioning(true)\n }, 3000)\n return () => clearInterval(timer)\n }, [totalGroups, needCarousel])\n\n // \u53EA\u5728\u9700\u8981\u8F6E\u64AD\u65F6\u5904\u7406\u65E0\u7F1D\u8DF3\u8F6C\n React.useEffect(() => {\n if (!needCarousel) return\n if (groupIndex === totalGroups) {\n const handle = setTimeout(() => {\n setIsTransitioning(false)\n setGroupIndex(0)\n }, 500) // 500ms\u7B49\u4E8E\u52A8\u753B\u65F6\u957F\n return () => clearTimeout(handle)\n } else {\n setIsTransitioning(true)\n }\n }, [groupIndex, totalGroups, needCarousel])\n\n // \u6807\u9898\u52A8\u753B\u903B\u8F91\u4FDD\u6301\u4E0D\u53D8\n const titleRef = useRef(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n useGSAP(() => {\n if (!titleRef.current) return\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 ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'top 80%',\n end: 'top 50%',\n scrub: true,\n onUpdate: self => {\n const progress = self.progress\n const total = words.length\n const interval = 1 / total\n const overlap = 0.5\n words.forEach((word, i) => {\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 return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n ScrollTrigger.getAll().forEach(t => t.kill())\n }\n }, [])\n\n return (\n <div\n ref={ref}\n className={cn(\n 'laptop:flex-row laptop:items-end laptop:justify-between text-info-primary laptop:min-h-[64px] lg-desktop:min-h-[128px] flex h-auto w-full flex-col items-start justify-center gap-[24px] text-center',\n className\n )}\n >\n <Heading\n ref={titleRef}\n as=\"h2\"\n size={2}\n weight={'bold'}\n align={'left'}\n className=\"slogan-title laptop:text-[40px] desktop:text-[48px] lg-desktop:text-[64px] text-[40px] !leading-none text-[#1D1D1F]\"\n >\n {title}\n </Heading>\n {features && features.length > 0 && (\n <div className=\"relative w-full max-w-[500px] overflow-hidden\" style={{ height: `${groupHeight}px` }}>\n <div\n className={cn([\n 'flex flex-col',\n isTransitioning ? 'transition-transform duration-500 ease-[cubic-bezier(.4,0,.2,1)]' : '!transition-none',\n ])}\n style={{\n transform: `translateY(-${groupIndex * groupHeight}px)`,\n }}\n >\n {displayGroups.map((group, idx) => (\n <div\n className=\"flex w-full flex-row items-stretch gap-3 overflow-hidden\"\n style={{ height: `${groupHeight}px` }}\n key={idx}\n >\n {group.map((feature, index) => (\n <React.Fragment key={index}>\n {index > 0 && <div className=\"slogan-feature-divider w-px self-stretch bg-[#D9D9D9]\" />}\n <Text\n align=\"left\"\n as=\"p\"\n className=\"slogan-feature-text tablet:text-[13px] laptop:text-[14px] line-clamp-2 text-[12px] font-medium leading-[1.4] text-[#1D1D1F]\"\n html={feature.title}\n />\n </React.Fragment>\n ))}\n </div>\n ))}\n </div>\n </div>\n )}\n </div>\n )\n})\n\nSlogan.displayName = 'Slogan'\n\nexport default withStyles(Slogan)\n"],
|
|
5
|
+
"mappings": "aAmGM,cAAAA,EA4BY,QAAAC,MA5BZ,oBAlGN,OAAOC,GAAS,UAAAC,MAAc,QAC9B,OAAS,WAAAC,MAAe,cACxB,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,EAAS,QAAAC,MAAY,4BAC9B,OAAS,cAAAC,MAAkB,yBAG3BN,EAAK,eAAeC,EAAWC,CAAa,EAE5C,SAASK,EAAWC,EAA6B,CAAC,EAAGC,EAAe,EAAG,CACrE,MAAMC,EAAS,CAAC,EAChB,QAASC,EAAI,EAAGA,EAAIH,EAAM,OAAQG,GAAKF,EACrCC,EAAO,KAAKF,EAAM,MAAMG,EAAGA,EAAIF,CAAI,CAAC,EAEtC,OAAOC,CACT,CAEA,MAAME,EAASf,EAAM,WAAwC,CAAC,CAAE,KAAAgB,EAAM,UAAAC,EAAY,EAAG,EAAGC,IAAQ,CAC9F,KAAM,CAAE,MAA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PmBC,CAQrB,CACD,GAZIF,CAaP,CACD,EACH,EACF,GAEJ,CAEJ,CAAC,EAEDhC,EAAO,YAAc,SAErB,IAAOmC,EAAQzC,EAAWM,CAAM",
|
|
6
6
|
"names": ["jsx", "jsxs", "React", "useRef", "useGSAP", "gsap", "SplitText", "ScrollTrigger", "cn", "Heading", "Text", "withStyles", "chunkArray", "array", "size", "result", "i", "Slogan", "data", "className", "ref", "title", "features", "featureChunkSize", "groupIndex", "setGroupIndex", "isTransitioning", "setIsTransitioning", "featuresGroups", "totalGroups", "needCarousel", "displayGroups", "groupHeight", "timer", "handle", "titleRef", "splitTextInstance", "words", "self", "progress", "total", "interval", "overlap", "word", "start", "width", "opacity", "t", "group", "idx", "feature", "index", "Slogan_default"]
|
|
7
7
|
}
|
|
@@ -3,6 +3,7 @@ import React from 'react';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<TabsProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -3,6 +3,7 @@ import type { TitleProps } from './types.js';
|
|
|
3
3
|
declare const _default: {
|
|
4
4
|
(props: Omit<TitleProps & React.RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps> & {
|
|
5
5
|
className?: string;
|
|
6
|
+
data?: Record<string, any>;
|
|
6
7
|
}): import("react/jsx-runtime").JSX.Element;
|
|
7
8
|
displayName: string;
|
|
8
9
|
};
|
|
@@ -15,7 +15,7 @@ export declare const getStylesProps: <T extends Record<string, unknown>>(props:
|
|
|
15
15
|
* 样式 Hook,返回样式类名和样式组件
|
|
16
16
|
* @param styleProps - 样式属性
|
|
17
17
|
*/
|
|
18
|
-
export declare const useStyles: (styleProps: Partial<StylesProps>) => {
|
|
18
|
+
export declare const useStyles: (styleProps: Partial<StylesProps>, data?: Record<string, any>) => {
|
|
19
19
|
readonly className: `block-${string} `;
|
|
20
20
|
readonly StyleComponent: import("react/jsx-runtime").JSX.Element;
|
|
21
21
|
readonly uid: string;
|
|
@@ -28,6 +28,7 @@ export declare const useStyles: (styleProps: Partial<StylesProps>) => {
|
|
|
28
28
|
export declare function withStyles<P extends object>(WrappedComponent: React.ComponentType<P>, defaultStyleProps?: Partial<StylesProps>): {
|
|
29
29
|
(props: Omit<P, keyof StylesProps> & Partial<StylesProps> & {
|
|
30
30
|
className?: string;
|
|
31
|
+
data?: Record<string, any>;
|
|
31
32
|
}): import("react/jsx-runtime").JSX.Element;
|
|
32
33
|
displayName: string;
|
|
33
34
|
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as
|
|
1
|
+
import{Fragment as P,jsx as o,jsxs as g}from"react/jsx-runtime";import{useMemo as r}from"react";import{simpleHash as y}from"./simpleHash.js";import d from"./getKeyPropsString.js";const a=t=>{const e=d(t);return`style_${y(e)}`},m=t=>{const{style:e,uid:s,disabled:n}=t;return{style:e,uid:s,disabled:n}},S=({style:t,uid:e=a({}),disabled:s=!1})=>!t||s?null:o("style",{suppressHydrationWarning:!0,"data-style-id":e,children:`.block-${e} { ${t} }`}),u=(t,e)=>{const s=r(()=>t?.uid||a({...t,data:e}),[e,t]),n=r(()=>o(S,{...t,uid:s}),[t,s]);return{className:`block-${s} `,StyleComponent:n,uid:s}};function b(t,e){const s=function(n){const l={...e,...m(n)},{className:i,StyleComponent:c}=u(l,n.data);return g(P,{children:[c,o(t,{...n,className:`${i} ${n.className}`})]})};return s.displayName=t.displayName||t.name||"Component",s}export{m as getStylesProps,u as useStyles,b as withStyles};
|
|
2
2
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/shared/Styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react'\n\nexport interface StylesProps {\n /** \u81EA\u5B9A\u4E49\u6837\u5F0F\u5B57\u7B26\u4E32 */\n style?: string\n /** \u552F\u4E00\u6807\u8BC6\u7B26 */\n uid?: string\n /** \u662F\u5426\u7981\u7528 */\n disabled?: boolean\n}\n\n/**\n * \u751F\u6210\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "useMemo", "
|
|
4
|
+
"sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\n\nexport interface StylesProps {\n /** \u81EA\u5B9A\u4E49\u6837\u5F0F\u5B57\u7B26\u4E32 */\n style?: string\n /** \u552F\u4E00\u6807\u8BC6\u7B26 */\n uid?: string\n /** \u662F\u5426\u7981\u7528 */\n disabled?: boolean\n}\n\n/**\n * \u6839\u636E props \u751F\u6210\u786E\u5B9A\u6027 uid\n */\nconst generateUID = (props: Record<string, any>) => {\n const keyString = getKeyPropsString(props)\n return `style_${simpleHash(keyString)}`\n}\n\n/**\n * \u4ECE\u7EC4\u4EF6 props \u4E2D\u63D0\u53D6\u6837\u5F0F\u76F8\u5173\u5C5E\u6027\n */\nexport const getStylesProps = <T extends Record<string, unknown>>(props: T & StylesProps): StylesProps => {\n const { style, uid, disabled } = props\n return { style, uid, disabled }\n}\n\n/**\n * \u6837\u5F0F\u6CE8\u5165\u7EC4\u4EF6\n */\nconst Styles: React.FC<StylesProps> = ({ style, uid = generateUID({}), disabled = false }) => {\n if (!style || disabled) {\n return null\n }\n\n return <style suppressHydrationWarning data-style-id={uid}>{`.block-${uid} { ${style} }`}</style>\n}\n\n/**\n * \u6837\u5F0F Hook\uFF0C\u8FD4\u56DE\u6837\u5F0F\u7C7B\u540D\u548C\u6837\u5F0F\u7EC4\u4EF6\n * @param styleProps - \u6837\u5F0F\u5C5E\u6027\n */\nexport const useStyles = (styleProps: Partial<StylesProps>, data?: Record<string, any>) => {\n const uid = useMemo(() => styleProps?.uid || generateUID({ ...styleProps, data }), [data, styleProps])\n\n const StyleComponent = useMemo(() => <Styles {...styleProps} uid={uid} />, [styleProps, uid])\n\n return {\n className: `block-${uid} `,\n StyleComponent,\n uid,\n } as const\n}\n\n/**\n * \u6837\u5F0F\u9AD8\u9636\u7EC4\u4EF6\uFF0C \u7528\u4E8E\u7ED9\u7EC4\u4EF6\u7528style \u6807\u7B7E\u7684\u5F62\u5F0F\u8FFD\u52A0\u6837\u5F0F\n * @param WrappedComponent - \u9700\u8981\u5305\u88C5\u7684\u7EC4\u4EF6\n * @param defaultStyleProps - \u9ED8\u8BA4\u6837\u5F0F\u5C5E\u6027\n */\nexport function withStyles<P extends object>(\n WrappedComponent: React.ComponentType<P>,\n defaultStyleProps?: Partial<StylesProps>\n) {\n const WithStyles = function (\n props: Omit<P, keyof StylesProps> & Partial<StylesProps> & { className?: string; data?: Record<string, any> }\n ) {\n const finalStyleProps = {\n ...defaultStyleProps,\n ...getStylesProps(props),\n }\n\n const { className, StyleComponent } = useStyles(finalStyleProps, props.data)\n\n return (\n <>\n {StyleComponent}\n <WrappedComponent {...(props as P)} className={`${className} ${props.className}`} />\n </>\n )\n }\n\n // \u76F4\u63A5\u4F7F\u7528\u539F\u59CB\u7EC4\u4EF6\u7684\u540D\u79F0\n WithStyles.displayName = WrappedComponent.displayName || WrappedComponent.name || 'Component'\n return WithStyles\n}\n"],
|
|
5
|
+
"mappings": "AAqCS,OAuCH,YAAAA,EAvCG,OAAAC,EAuCH,QAAAC,MAvCG,oBArCT,OAAgB,WAAAC,MAAe,QAC/B,OAAS,cAAAC,MAAkB,kBAC3B,OAAOC,MAAuB,yBAc9B,MAAMC,EAAeC,GAA+B,CAClD,MAAMC,EAAYH,EAAkBE,CAAK,EACzC,MAAO,SAASH,EAAWI,CAAS,CAAC,EACvC,EAKaC,EAAqDF,GAAwC,CACxG,KAAM,CAAE,MAAAG,EAAO,IAAAC,EAAK,SAAAC,CAAS,EAAIL,EACjC,MAAO,CAAE,MAAAG,EAAO,IAAAC,EAAK,SAAAC,CAAS,CAChC,EAKMC,EAAgC,CAAC,CAAE,MAAAH,EAAO,IAAAC,EAAML,EAAY,CAAC,CAAC,EAAG,SAAAM,EAAW,EAAM,IAClF,CAACF,GAASE,EACL,KAGFX,EAAC,SAAM,yBAAwB,GAAC,gBAAeU,EAAM,mBAAUA,CAAG,MAAMD,CAAK,KAAK,EAO9EI,EAAY,CAACC,EAAkCC,IAA+B,CACzF,MAAML,EAAMR,EAAQ,IAAMY,GAAY,KAAOT,EAAY,CAAE,GAAGS,EAAY,KAAAC,CAAK,CAAC,EAAG,CAACA,EAAMD,CAAU,CAAC,EAE/FE,EAAiBd,EAAQ,IAAMF,EAACY,EAAA,CAAQ,GAAGE,EAAY,IAAKJ,EAAK,EAAI,CAACI,EAAYJ,CAAG,CAAC,EAE5F,MAAO,CACL,UAAW,SAASA,CAAG,IACvB,eAAAM,EACA,IAAAN,CACF,CACF,EAOO,SAASO,EACdC,EACAC,EACA,CACA,MAAMC,EAAa,SACjBd,EACA,CACA,MAAMe,EAAkB,CACtB,GAAGF,EACH,GAAGX,EAAeF,CAAK,CACzB,EAEM,CAAE,UAAAgB,EAAW,eAAAN,CAAe,EAAIH,EAAUQ,EAAiBf,EAAM,IAAI,EAE3E,OACEL,EAAAF,EAAA,CACG,UAAAiB,EACDhB,EAACkB,EAAA,CAAkB,GAAIZ,EAAa,UAAW,GAAGgB,CAAS,IAAIhB,EAAM,SAAS,GAAI,GACpF,CAEJ,EAGA,OAAAc,EAAW,YAAcF,EAAiB,aAAeA,EAAiB,MAAQ,YAC3EE,CACT",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "useMemo", "simpleHash", "getKeyPropsString", "generateUID", "props", "keyString", "getStylesProps", "style", "uid", "disabled", "Styles", "useStyles", "styleProps", "data", "StyleComponent", "withStyles", "WrappedComponent", "defaultStyleProps", "WithStyles", "finalStyleProps", "className"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
function n(e){return["style","className","id","name","type","data"].map(t=>{if(t==="data"&&typeof e[t]=="object"&&e[t]!==null)try{return JSON.stringify(e[t])}catch{return""}return e[t]!==void 0?String(e[t]):""}).join("|")}export{n as default};
|
|
2
|
+
//# sourceMappingURL=getKeyPropsString.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/shared/getKeyPropsString.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * \u9009\u53D6\u5173\u952E props \u751F\u6210 key \u5B57\u7B26\u4E32\n */\nexport default function getKeyPropsString(props: Record<string, any>): string {\n const keys = ['style', 'className', 'id', 'name', 'type', 'data']\n return keys\n .map(k => {\n if (k === 'data' && typeof props[k] === 'object' && props[k] !== null) {\n try {\n return JSON.stringify(props[k])\n } catch {\n return ''\n }\n }\n return props[k] !== undefined ? String(props[k]) : ''\n })\n .join('|')\n}\n"],
|
|
5
|
+
"mappings": "AAGe,SAARA,EAAmCC,EAAoC,CAE5E,MADa,CAAC,QAAS,YAAa,KAAM,OAAQ,OAAQ,MAAM,EAE7D,IAAIC,GAAK,CACR,GAAIA,IAAM,QAAU,OAAOD,EAAMC,CAAC,GAAM,UAAYD,EAAMC,CAAC,IAAM,KAC/D,GAAI,CACF,OAAO,KAAK,UAAUD,EAAMC,CAAC,CAAC,CAChC,MAAQ,CACN,MAAO,EACT,CAEF,OAAOD,EAAMC,CAAC,IAAM,OAAY,OAAOD,EAAMC,CAAC,CAAC,EAAI,EACrD,CAAC,EACA,KAAK,GAAG,CACb",
|
|
6
|
+
"names": ["getKeyPropsString", "props", "k"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function simpleHash(str: string): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/shared/simpleHash.ts"],
|
|
4
|
+
"sourcesContent": ["export function simpleHash(str: string): string {\n let hash = 5381\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) + hash + str.charCodeAt(i)\n }\n return Math.abs(hash).toString(36)\n}\n"],
|
|
5
|
+
"mappings": "AAAO,SAASA,EAAWC,EAAqB,CAC9C,IAAIC,EAAO,KACX,QAASC,EAAI,EAAGA,EAAIF,EAAI,OAAQE,IAC9BD,GAAQA,GAAQ,GAAKA,EAAOD,EAAI,WAAWE,CAAC,EAE9C,OAAO,KAAK,IAAID,CAAI,EAAE,SAAS,EAAE,CACnC",
|
|
6
|
+
"names": ["simpleHash", "str", "hash", "i"]
|
|
7
|
+
}
|
|
@@ -5,6 +5,7 @@ declare const meta: {
|
|
|
5
5
|
component: {
|
|
6
6
|
(props: Omit<import("../biz-components/HeroBanner/types.js").HeroBannerProps & import("react").RefAttributes<HTMLDivElement>, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
7
7
|
className?: string;
|
|
8
|
+
data?: Record<string, any>;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/BrandEquity/BrandEquity.js").BrandEquityProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/Category/index.js").CategoryProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/Evaluate/index.js").EvaluateProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/Graphic/index.js").GraphicProps & import("react").RefAttributes<HTMLDivElement>, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -40,7 +41,7 @@ declare const meta: {
|
|
|
40
41
|
title: string;
|
|
41
42
|
textColor?: string;
|
|
42
43
|
}[];
|
|
43
|
-
}
|
|
44
|
+
} & Record<string, any>;
|
|
44
45
|
shape?: "round" | "square" | undefined;
|
|
45
46
|
event?: any;
|
|
46
47
|
condition?: any;
|
|
@@ -5,6 +5,7 @@ declare const meta: {
|
|
|
5
5
|
component: {
|
|
6
6
|
(props: Omit<import("react-fast-marquee").MarqueeProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
7
7
|
className?: string;
|
|
8
|
+
data?: Record<string, any>;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/MediaPlayerMulti/types.js").MediaPlayerMultiProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/Shelf/types.js").ShelfProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -4,6 +4,7 @@ declare const meta: {
|
|
|
4
4
|
component: {
|
|
5
5
|
(props: Omit<import("../biz-components/ShelfDisplay/index.js").ShelfDisplayProps, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
6
6
|
className?: string;
|
|
7
|
+
data?: Record<string, any>;
|
|
7
8
|
}): import("react/jsx-runtime").JSX.Element;
|
|
8
9
|
displayName: string;
|
|
9
10
|
};
|
|
@@ -5,6 +5,7 @@ declare const meta: {
|
|
|
5
5
|
component: {
|
|
6
6
|
(props: Omit<import("../biz-components/Slogan/types.js").SloganProps & React.RefAttributes<HTMLDivElement>, keyof import("../shared/Styles.js").StylesProps> & Partial<import("../shared/Styles.js").StylesProps> & {
|
|
7
7
|
className?: string;
|
|
8
|
+
data?: Record<string, any>;
|
|
8
9
|
}): import("react/jsx-runtime").JSX.Element;
|
|
9
10
|
displayName: string;
|
|
10
11
|
};
|