@anker-in/headless-ui 1.2.2 → 1.2.3
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/Faq/Faq.js +1 -1
- package/dist/cjs/biz-components/Faq/Faq.js.map +2 -2
- package/dist/cjs/biz-components/Graphic/index.js +1 -1
- package/dist/cjs/biz-components/Graphic/index.js.map +3 -3
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/HeroBanner.js.map +3 -3
- package/dist/cjs/biz-components/HeroBanner/types.d.ts +5 -0
- package/dist/cjs/biz-components/HeroBanner/types.js +1 -1
- package/dist/cjs/biz-components/HeroBanner/types.js.map +1 -1
- package/dist/cjs/biz-components/ImageOverlayShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ImageOverlayShelf/ProductCard.js.map +2 -2
- package/dist/cjs/biz-components/Marquee/Marquee.d.ts +11 -4
- package/dist/cjs/biz-components/Marquee/Marquee.js +1 -1
- package/dist/cjs/biz-components/Marquee/Marquee.js.map +3 -3
- package/dist/cjs/biz-components/Marquee/index.d.ts +1 -1
- package/dist/cjs/biz-components/Marquee/index.js +1 -1
- package/dist/cjs/biz-components/Marquee/index.js.map +2 -2
- package/dist/cjs/biz-components/Marquee/type.d.ts +22 -4
- package/dist/cjs/biz-components/Marquee/type.js +1 -1
- package/dist/cjs/biz-components/Marquee/type.js.map +1 -1
- package/dist/cjs/biz-components/Media/index.js +1 -1
- package/dist/cjs/biz-components/Media/index.js.map +2 -2
- package/dist/cjs/biz-components/MediaTextOverlay/MediaTextOverlay.d.ts +9 -0
- package/dist/cjs/biz-components/MediaTextOverlay/MediaTextOverlay.js +2 -0
- package/dist/cjs/biz-components/MediaTextOverlay/MediaTextOverlay.js.map +7 -0
- package/dist/cjs/biz-components/MediaTextOverlay/index.d.ts +2 -0
- package/dist/cjs/biz-components/MediaTextOverlay/index.js +2 -0
- package/dist/cjs/biz-components/MediaTextOverlay/index.js.map +7 -0
- package/dist/cjs/biz-components/MediaTextOverlay/types.d.ts +24 -0
- package/dist/cjs/biz-components/MediaTextOverlay/types.js +2 -0
- package/dist/cjs/biz-components/MediaTextOverlay/types.js.map +7 -0
- package/dist/cjs/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/index.js.map +2 -2
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.d.ts +1 -0
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.js.map +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/cjs/biz-components/index.d.ts +2 -0
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/esm/biz-components/Faq/Faq.js +1 -1
- package/dist/esm/biz-components/Faq/Faq.js.map +2 -2
- package/dist/esm/biz-components/Graphic/index.js +1 -1
- package/dist/esm/biz-components/Graphic/index.js.map +3 -3
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js +1 -1
- package/dist/esm/biz-components/HeroBanner/HeroBanner.js.map +3 -3
- package/dist/esm/biz-components/HeroBanner/types.d.ts +5 -0
- package/dist/esm/biz-components/ImageOverlayShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ImageOverlayShelf/ProductCard.js.map +2 -2
- package/dist/esm/biz-components/Marquee/Marquee.d.ts +11 -4
- package/dist/esm/biz-components/Marquee/Marquee.js +1 -1
- package/dist/esm/biz-components/Marquee/Marquee.js.map +3 -3
- package/dist/esm/biz-components/Marquee/index.d.ts +1 -1
- package/dist/esm/biz-components/Marquee/index.js +1 -1
- package/dist/esm/biz-components/Marquee/index.js.map +3 -3
- package/dist/esm/biz-components/Marquee/type.d.ts +22 -4
- package/dist/esm/biz-components/Media/index.js +1 -1
- package/dist/esm/biz-components/Media/index.js.map +2 -2
- package/dist/esm/biz-components/MediaTextOverlay/MediaTextOverlay.d.ts +9 -0
- package/dist/esm/biz-components/MediaTextOverlay/MediaTextOverlay.js +2 -0
- package/dist/esm/biz-components/MediaTextOverlay/MediaTextOverlay.js.map +7 -0
- package/dist/esm/biz-components/MediaTextOverlay/index.d.ts +2 -0
- package/dist/esm/biz-components/MediaTextOverlay/index.js +2 -0
- package/dist/esm/biz-components/MediaTextOverlay/index.js.map +7 -0
- package/dist/esm/biz-components/MediaTextOverlay/types.d.ts +24 -0
- package/dist/esm/biz-components/MediaTextOverlay/types.js +1 -0
- package/dist/esm/biz-components/MediaTextOverlay/types.js.map +7 -0
- package/dist/esm/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/index.js.map +2 -2
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.d.ts +1 -0
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.js.map +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/esm/biz-components/index.d.ts +2 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +2 -2
- package/package.json +1 -1
- package/style.css +49 -8
- package/tailwind.config.js +10 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/ImageOverlayShelf/ProductCard.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/utils.js'\n\nimport Badge from '../../components/badge.js'\nimport { Text } from '../../components/text.js'\nimport Button from '../../components/button.js'\nimport Picture from '../../components/picture.js'\nimport { Heading } from '../../components/heading.js'\nimport type { ProductCardProps, ButtonFunctionType, ImageObjectPosition } from './types.js'\n\n/**\n * \u56FE\u7247\u88C1\u5207\u4F4D\u7F6E\u6620\u5C04\n */\nconst objectPositionClassMap: Record<ImageObjectPosition, string> = {\n center: 'object-center',\n top: 'object-top',\n bottom: 'object-bottom',\n left: 'object-left',\n right: 'object-right',\n 'top-left': 'object-left-top',\n 'top-right': 'object-right-top',\n 'bottom-left': 'object-left-bottom',\n 'bottom-right': 'object-right-bottom',\n}\n\n/**\n * ProductCard - ImageOverlayShelf \u7684\u5355\u4E2A\u4EA7\u54C1\u5361\u7247\n * \u56FE\u6587\u53E0\u52A0\u6837\u5F0F\uFF0C\u80CC\u666F\u56FE\u5B8C\u5168\u8986\u76D6\u5361\u7247\n */\nconst ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(\n (\n {\n product,\n className,\n showTags = true,\n showOriginalPrice = true,\n onLearnMore,\n onShopNow,\n onAddToCart,\n onProductImageClick,\n classNames,\n secondaryButtonText,\n secondaryButtonFun,\n primaryButtonText,\n primaryButtonFun,\n copy,\n },\n ref\n ) => {\n const [primaryLoading, setPrimaryLoading] = React.useState(false)\n const [secondaryLoading, setSecondaryLoading] = React.useState(false)\n\n const isSoldOut = !product.availableForSale\n\n // \u6839\u636E\u6309\u94AE\u529F\u80FD\u7C7B\u578B\u8C03\u7528\u76F8\u5E94\u7684\u56DE\u8C03\u51FD\u6570\n const handleButtonClick = async (buttonFun?: ButtonFunctionType, buttonType?: 'primary' | 'secondary') => {\n if (!buttonFun) return\n\n const setLoading = buttonType === 'primary' ? setPrimaryLoading : setSecondaryLoading\n setLoading(true)\n\n try {\n switch (buttonFun) {\n case 'buyNow':\n await onShopNow?.(product)\n break\n case 'addCart':\n await onAddToCart?.(product)\n break\n case 'learnMore':\n await onLearnMore?.(product)\n break\n default:\n break\n }\n } finally {\n setLoading(false)\n }\n }\n\n const displayTitle = product.custom_name || product.name\n const displayDescription = product.custom_description || product.description\n const theme = product.custom_theme ?? 'dark'\n\n return (\n <div\n ref={ref}\n className={cn(\n 'rounded-box relative box-border w-full cursor-pointer overflow-hidden duration-300',\n 'desktop:h-[384px] lg-desktop:h-[480px] h-[360px]',\n 'tablet:min-w-[auto] min-w-[296px] max-w-[824px]',\n {\n 'aiui-dark': theme === 'dark',\n },\n className,\n classNames?.productCard\n )}\n >\n <div className=\"box-border flex h-full flex-col justify-between overflow-hidden\">\n {/* \u80CC\u666F\u56FE */}\n <a\n onClick={() => onProductImageClick?.(product)}\n {...(!onProductImageClick &&\n product.listingLink && {\n href: product.listingLink,\n })}\n rel=\"noreferrer\"\n className={cn('absolute inset-0', classNames?.productImage)}\n >\n <Picture\n alt={product.name}\n source={product.custom_image ?? product.image}\n className={cn(\n 'rounded-box h-full overflow-hidden object-cover transition-all duration-300 [&_img]:size-full'\n )}\n imgClassName={cn('object-cover', objectPositionClassMap[product.imageObjectPosition ?? 'center'])}\n />\n </a>\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div\n className={cn(\n 'desktop:p-6 collection-shelves-product-content pointer-events-none z-10 box-border flex flex-1 flex-col justify-end overflow-hidden p-4',\n classNames?.productContent\n )}\n >\n {/* \u6807\u7B7E */}\n {showTags && product.tags?.length ? (\n <div className={cn('mb-2 box-border flex flex-wrap gap-1 overflow-visible', classNames?.tagsContainer)}>\n {product.tags.map((tag: any, index: number) =>\n (tag as any).label ? (\n <Badge\n key={index}\n size=\"sm\"\n variant={(tag.variant as any) || 'outline'}\n promotionalType={tag.promotionalType}\n >\n {tag.label}\n </Badge>\n ) : (\n React.isValidElement(tag) && <React.Fragment key={index}>{tag}</React.Fragment>\n )\n )}\n </div>\n ) : null}\n\n {/* \u4EA7\u54C1\u6807\u9898 */}\n {displayTitle ? (\n <Heading\n as=\"h3\"\n title={displayTitle}\n html={displayTitle}\n className={cn(\n 'lg-desktop:text-2xl lg-desktop:leading-7 tablet:text-xl text-info-primary tablet:leading-6 line-clamp-2 text-base font-bold',\n classNames?.productTitle\n )}\n />\n ) : null}\n\n {/* \u4EA7\u54C1\u63CF\u8FF0 */}\n {displayDescription ? (\n <Text\n size={2}\n html={displayDescription}\n className={cn(\n 'lg-desktop:text-lg desktop:text-base text-info-primary line-clamp-1 text-sm font-bold',\n classNames?.productDescription\n )}\n />\n ) : null}\n\n {/* \u4EF7\u683C\u533A\u57DF */}\n <div className={cn('mb-1 mt-4 flex items-center', classNames?.priceContainer)}>\n {isSoldOut ? (\n <div className={cn('tablet:text-
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GA+GY,IAAAK,EAAA,6BA7GZC,EAAuB,oBACvBC,EAAmB,kCAEnBC,EAAkB,wCAClBC,EAAqB,oCACrBC,EAAmB,yCACnBC,EAAoB,0CACpBC,EAAwB,uCAMxB,MAAMC,EAA8D,CAClE,OAAQ,gBACR,IAAK,aACL,OAAQ,gBACR,KAAM,cACN,MAAO,eACP,WAAY,kBACZ,YAAa,mBACb,cAAe,qBACf,eAAgB,qBAClB,EAMMX,EAAcI,EAAM,WACxB,CACE,CACE,QAAAQ,EACA,UAAAC,EACA,SAAAC,EAAW,GACX,kBAAAC,EAAoB,GACpB,YAAAC,EACA,UAAAC,EACA,YAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,iBAAAC,EACA,KAAAC,CACF,EACAC,IACG,CACH,KAAM,CAACC,EAAgBC,CAAiB,EAAIxB,EAAM,SAAS,EAAK,EAC1D,CAACyB,EAAkBC,CAAmB,EAAI1B,EAAM,SAAS,EAAK,EAE9D2B,EAAY,CAACnB,EAAQ,iBAGrBoB,EAAoB,MAAOC,EAAgCC,IAAyC,CACxG,GAAI,CAACD,EAAW,OAEhB,MAAME,EAAaD,IAAe,UAAYN,EAAoBE,EAClEK,EAAW,EAAI,EAEf,GAAI,CACF,OAAQF,EAAW,CACjB,IAAK,SACH,MAAMhB,IAAYL,CAAO,EACzB,MACF,IAAK,UACH,MAAMM,IAAcN,CAAO,EAC3B,MACF,IAAK,YACH,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N,aAAW,MACT,wFACAjB,GAAY,kBACd,EACF,EACE,QAGJ,OAAC,OAAI,aAAW,MAAG,8BAA+BA,GAAY,cAAc,EACzE,SAAAW,KACC,OAAC,OAAI,aAAW,MAAG,
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/utils.js'\n\nimport Badge from '../../components/badge.js'\nimport { Text } from '../../components/text.js'\nimport Button from '../../components/button.js'\nimport Picture from '../../components/picture.js'\nimport { Heading } from '../../components/heading.js'\nimport type { ProductCardProps, ButtonFunctionType, ImageObjectPosition } from './types.js'\n\n/**\n * \u56FE\u7247\u88C1\u5207\u4F4D\u7F6E\u6620\u5C04\n */\nconst objectPositionClassMap: Record<ImageObjectPosition, string> = {\n center: 'object-center',\n top: 'object-top',\n bottom: 'object-bottom',\n left: 'object-left',\n right: 'object-right',\n 'top-left': 'object-left-top',\n 'top-right': 'object-right-top',\n 'bottom-left': 'object-left-bottom',\n 'bottom-right': 'object-right-bottom',\n}\n\n/**\n * ProductCard - ImageOverlayShelf \u7684\u5355\u4E2A\u4EA7\u54C1\u5361\u7247\n * \u56FE\u6587\u53E0\u52A0\u6837\u5F0F\uFF0C\u80CC\u666F\u56FE\u5B8C\u5168\u8986\u76D6\u5361\u7247\n */\nconst ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(\n (\n {\n product,\n className,\n showTags = true,\n showOriginalPrice = true,\n onLearnMore,\n onShopNow,\n onAddToCart,\n onProductImageClick,\n classNames,\n secondaryButtonText,\n secondaryButtonFun,\n primaryButtonText,\n primaryButtonFun,\n copy,\n },\n ref\n ) => {\n const [primaryLoading, setPrimaryLoading] = React.useState(false)\n const [secondaryLoading, setSecondaryLoading] = React.useState(false)\n\n const isSoldOut = !product.availableForSale\n\n // \u6839\u636E\u6309\u94AE\u529F\u80FD\u7C7B\u578B\u8C03\u7528\u76F8\u5E94\u7684\u56DE\u8C03\u51FD\u6570\n const handleButtonClick = async (buttonFun?: ButtonFunctionType, buttonType?: 'primary' | 'secondary') => {\n if (!buttonFun) return\n\n const setLoading = buttonType === 'primary' ? setPrimaryLoading : setSecondaryLoading\n setLoading(true)\n\n try {\n switch (buttonFun) {\n case 'buyNow':\n await onShopNow?.(product)\n break\n case 'addCart':\n await onAddToCart?.(product)\n break\n case 'learnMore':\n await onLearnMore?.(product)\n break\n default:\n break\n }\n } finally {\n setLoading(false)\n }\n }\n\n const displayTitle = product.custom_name || product.name\n const displayDescription = product.custom_description || product.description\n const theme = product.custom_theme ?? 'dark'\n\n return (\n <div\n ref={ref}\n className={cn(\n 'rounded-box relative box-border w-full cursor-pointer overflow-hidden duration-300',\n 'desktop:h-[384px] lg-desktop:h-[480px] h-[360px]',\n 'tablet:min-w-[auto] min-w-[296px] max-w-[824px]',\n {\n 'aiui-dark': theme === 'dark',\n },\n className,\n classNames?.productCard\n )}\n >\n <div className=\"box-border flex h-full flex-col justify-between overflow-hidden\">\n {/* \u80CC\u666F\u56FE */}\n <a\n onClick={() => onProductImageClick?.(product)}\n {...(!onProductImageClick &&\n product.listingLink && {\n href: product.listingLink,\n })}\n rel=\"noreferrer\"\n className={cn('absolute inset-0', classNames?.productImage)}\n >\n <Picture\n alt={product.name}\n source={product.custom_image ?? product.image}\n className={cn(\n 'rounded-box h-full overflow-hidden object-cover transition-all duration-300 [&_img]:size-full'\n )}\n imgClassName={cn('object-cover', objectPositionClassMap[product.imageObjectPosition ?? 'center'])}\n />\n </a>\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div\n className={cn(\n 'desktop:p-6 collection-shelves-product-content pointer-events-none z-10 box-border flex flex-1 flex-col justify-end overflow-hidden p-4',\n classNames?.productContent\n )}\n >\n {/* \u6807\u7B7E */}\n {showTags && product.tags?.length ? (\n <div className={cn('mb-2 box-border flex flex-wrap gap-1 overflow-visible', classNames?.tagsContainer)}>\n {product.tags.map((tag: any, index: number) =>\n (tag as any).label ? (\n <Badge\n key={index}\n size=\"sm\"\n variant={(tag.variant as any) || 'outline'}\n promotionalType={tag.promotionalType}\n >\n {tag.label}\n </Badge>\n ) : (\n React.isValidElement(tag) && <React.Fragment key={index}>{tag}</React.Fragment>\n )\n )}\n </div>\n ) : null}\n\n {/* \u4EA7\u54C1\u6807\u9898 */}\n {displayTitle ? (\n <Heading\n as=\"h3\"\n title={displayTitle}\n html={displayTitle}\n className={cn(\n 'lg-desktop:text-2xl lg-desktop:leading-7 tablet:text-xl text-info-primary tablet:leading-6 line-clamp-2 text-base font-bold',\n classNames?.productTitle\n )}\n />\n ) : null}\n\n {/* \u4EA7\u54C1\u63CF\u8FF0 */}\n {displayDescription ? (\n <Text\n size={2}\n html={displayDescription}\n className={cn(\n 'lg-desktop:text-lg desktop:text-base text-info-primary line-clamp-1 text-sm font-bold',\n classNames?.productDescription\n )}\n />\n ) : null}\n\n {/* \u4EF7\u683C\u533A\u57DF */}\n <div className={cn('mb-1 mt-4 flex items-center', classNames?.priceContainer)}>\n {isSoldOut ? (\n <div className={cn('tablet:text-xl text-info-primary text-xl font-bold', classNames?.productPrice)}>\n {copy?.outOfStockLabel ?? 'Sold Out'}\n </div>\n ) : (\n <>\n <div className={cn('tablet:text-xl text-info-primary text-xl font-bold', classNames?.productPrice)}>\n {product.price}\n </div>\n {showOriginalPrice && product.originalPrice && (\n <div\n className={cn(\n 'tablet:text-xl text-info-secondary ml-1 text-lg font-bold line-through',\n classNames?.originalPrice\n )}\n >\n {product.originalPrice}\n </div>\n )}\n </>\n )}\n </div>\n\n {/* \u6309\u94AE\u533A\u57DF */}\n <div\n className={cn('lg-desktop:gap-3 pointer-events-auto flex items-center gap-2', classNames?.buttonGroup)}\n >\n {secondaryButtonText && (\n <Button\n variant=\"secondary\"\n onClick={() => handleButtonClick(secondaryButtonFun, 'secondary')}\n disabled={isSoldOut && secondaryButtonFun !== 'learnMore'}\n loading={secondaryLoading}\n className={cn(classNames?.secondaryButton)}\n data-headless-type-name=\"ImageOverlayShelf#ProductCard\"\n data-headless-title-desc-button={`${displayTitle}#${displayDescription || ''}#${secondaryButtonText}`}\n data-headless-sku={product.sku}\n >\n {secondaryButtonText}\n </Button>\n )}\n {primaryButtonText && (\n <Button\n variant=\"primary\"\n onClick={() => handleButtonClick(primaryButtonFun, 'primary')}\n disabled={isSoldOut && primaryButtonFun !== 'learnMore'}\n loading={primaryLoading}\n className={cn(classNames?.primaryButton)}\n data-headless-type-name=\"ImageOverlayShelf#ProductCard\"\n data-headless-title-desc-button={`${displayTitle}#${displayDescription || ''}#${primaryButtonText}`}\n data-headless-sku={product.sku}\n >\n {primaryButtonText}\n </Button>\n )}\n </div>\n </div>\n </div>\n </div>\n )\n }\n)\n\nProductCard.displayName = 'ImageOverlayShelf.ProductCard'\n\nexport { ProductCard }\nexport default ProductCard\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,iBAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GA+GY,IAAAK,EAAA,6BA7GZC,EAAuB,oBACvBC,EAAmB,kCAEnBC,EAAkB,wCAClBC,EAAqB,oCACrBC,EAAmB,yCACnBC,EAAoB,0CACpBC,EAAwB,uCAMxB,MAAMC,EAA8D,CAClE,OAAQ,gBACR,IAAK,aACL,OAAQ,gBACR,KAAM,cACN,MAAO,eACP,WAAY,kBACZ,YAAa,mBACb,cAAe,qBACf,eAAgB,qBAClB,EAMMX,EAAcI,EAAM,WACxB,CACE,CACE,QAAAQ,EACA,UAAAC,EACA,SAAAC,EAAW,GACX,kBAAAC,EAAoB,GACpB,YAAAC,EACA,UAAAC,EACA,YAAAC,EACA,oBAAAC,EACA,WAAAC,EACA,oBAAAC,EACA,mBAAAC,EACA,kBAAAC,EACA,iBAAAC,EACA,KAAAC,CACF,EACAC,IACG,CACH,KAAM,CAACC,EAAgBC,CAAiB,EAAIxB,EAAM,SAAS,EAAK,EAC1D,CAACyB,EAAkBC,CAAmB,EAAI1B,EAAM,SAAS,EAAK,EAE9D2B,EAAY,CAACnB,EAAQ,iBAGrBoB,E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,IAE1B,SAAAW,EACH,GAEJ,GACF,GACF,EACF,CAEJ,CACF,EAEAvB,EAAY,YAAc,gCAG1B,IAAOC,EAAQD",
|
|
6
6
|
"names": ["ProductCard_exports", "__export", "ProductCard", "ProductCard_default", "__toCommonJS", "import_jsx_runtime", "React", "import_utils", "import_badge", "import_text", "import_button", "import_picture", "import_heading", "objectPositionClassMap", "product", "className", "showTags", "showOriginalPrice", "onLearnMore", "onShopNow", "onAddToCart", "onProductImageClick", "classNames", "secondaryButtonText", "secondaryButtonFun", "primaryButtonText", "primaryButtonFun", "copy", "ref", "primaryLoading", "setPrimaryLoading", "secondaryLoading", "setSecondaryLoading", "isSoldOut", "handleButtonClick", "buttonFun", "buttonType", "setLoading", "displayTitle", "displayDescription", "theme", "Picture", "tag", "index", "Badge", "Button"]
|
|
7
7
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import type { MarqueeProps, MarqueeItemProps, MarqueeImageContentProps, MarqueeTextContentProps } from './type.js';
|
|
3
|
-
import { type SwiperRef } from 'swiper/react';
|
|
2
|
+
import type { MarqueeProps, MarqueeItemProps, MarqueeImageContentProps, MarqueeTextContentProps, MarqueeIconAndTextContentProps, MarqueePictureContentProps } from './type.js';
|
|
4
3
|
import 'swiper/css';
|
|
5
4
|
declare const MarqueeItem: {
|
|
6
5
|
({ data, configuration }: MarqueeItemProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -11,8 +10,16 @@ declare const MarqueeImageContent: {
|
|
|
11
10
|
displayName: string;
|
|
12
11
|
};
|
|
13
12
|
declare const MarqueeTextContent: React.ForwardRefExoticComponent<MarqueeTextContentProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
-
declare const
|
|
13
|
+
declare const MarqueeIconAndTextContent: {
|
|
14
|
+
({ icon, text, iconClassName, textClassName }: MarqueeIconAndTextContentProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
displayName: string;
|
|
16
|
+
};
|
|
17
|
+
declare const MarqueePictureContent: {
|
|
18
|
+
({ pictureImage, pictureClassName }: MarqueePictureContentProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
displayName: string;
|
|
20
|
+
};
|
|
21
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<MarqueeProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../WheelLottery/index.js").ContainerProps & React.RefAttributes<unknown>> & {
|
|
15
22
|
readonly $$typeof: symbol;
|
|
16
23
|
};
|
|
17
24
|
export default _default;
|
|
18
|
-
export { MarqueeItem, MarqueeImageContent, MarqueeTextContent };
|
|
25
|
+
export { MarqueeItem, MarqueeImageContent, MarqueeTextContent, MarqueeIconAndTextContent, MarqueePictureContent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var E=Object.create;var v=Object.defineProperty;var L=Object.getOwnPropertyDescriptor;var H=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,A=Object.prototype.hasOwnProperty;var D=(e,t)=>{for(var a in t)v(e,a,{get:t[a],enumerable:!0})},q=(e,t,a,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of H(t))!A.call(e,l)&&l!==a&&v(e,l,{get:()=>t[l],enumerable:!(o=L(t,l))||o.enumerable});return e};var W=(e,t,a)=>(a=e!=null?E(j(e)):{},q(t||!e||!e.__esModule?v(a,"default",{value:e,enumerable:!0}):a,e)),$=e=>q(v({},"__esModule",{value:!0}),e);var B={};D(B,{MarqueeIconAndTextContent:()=>N,MarqueeImageContent:()=>M,MarqueeItem:()=>d,MarqueePictureContent:()=>h,MarqueeTextContent:()=>C,default:()=>_});module.exports=$(B);var s=require("react/jsx-runtime"),r=W(require("react")),m=require("../../components/index.js"),i=require("../../helpers/utils.js"),k=require("../../shared/Styles.js"),G=require("swiper/css"),P=require("../../hooks/useExposure.js");const O="image",S="marquee",g=r.default.forwardRef(({data:{items:e=[],speed:t=3e3,reverseDirection:a=!1,key:o}={},className:l},T)=>{const c=(0,r.useRef)(null),y=(0,r.useRef)(null);(0,r.useImperativeHandle)(T,()=>c.current),(0,P.useExposure)(c,{componentType:O,componentName:S});const w=`${t*5}ms`,x="clamp(24px, 4vw, 64px)",[I,R]=(0,r.useState)(2);return(0,r.useLayoutEffect)(()=>{const n=y.current;if(!n)return;const p=()=>{const f=n.offsetWidth;if(f===0)return;const b=window.innerWidth,z=Math.ceil(b/f);R(Math.max(2,z))};p(),c.current?.style.setProperty("--track-width",`${n.offsetWidth}px`);const u=new ResizeObserver(()=>{p(),c.current?.style.setProperty("--track-width",`${n.offsetWidth}px`)});return u.observe(n),()=>u.disconnect()},[e]),(0,s.jsx)("div",{ref:c,id:o?`Marquee-${o}`:void 0,className:(0,i.cn)("text-info-primary w-full",l),children:(0,s.jsxs)("div",{className:(0,i.cn)("flex h-full w-max items-center",a?"animate-marquee-reverse":"animate-marquee"),style:{"--marquee-duration":w},children:[(0,s.jsx)("div",{ref:y,className:"flex h-full shrink-0 items-center",style:{gap:x,paddingRight:x},children:e.map((n,p)=>(0,s.jsx)("div",{className:"shrink-0",children:(0,s.jsx)(d,{data:n})},(n?.id??"")+"-orig-"+p))}),Array.from({length:I}).map((n,p)=>(0,s.jsx)("div",{className:"flex h-full shrink-0 items-center",style:{gap:x,paddingRight:x},"aria-hidden":"true",children:e.map((u,f)=>(0,s.jsx)("div",{className:"shrink-0",children:(0,s.jsx)(d,{data:u})},(u?.id??"")+"-copy-"+p+"-"+f))},`copy-group-${p}`))]})})});g.displayName="Marquee";const d=({data:e,configuration:t})=>(0,s.jsxs)(s.Fragment,{children:[e.type==="image"&&(0,s.jsx)(M,{image:e?.image,imageClassName:t?.imageClassName}),e.type==="text"&&(0,s.jsx)(C,{text:e?.text,textClassName:t?.textClassName}),e.type==="iconAndText"&&(0,s.jsx)(N,{icon:e?.iconImage,text:e?.iconText,iconClassName:t?.iconClassName,textClassName:t?.textClassName}),e.type==="picture"&&(0,s.jsx)(h,{pictureImage:e?.pictureImage,pictureClassName:t?.pictureClassName})]});d.displayName="MarqueeItem";const M=({image:e,imageClassName:t})=>(0,s.jsx)("div",{className:"laptop:w-[120px] h-full w-[72px] shrink-0",children:(0,s.jsx)(m.Picture,{source:e?.url,alt:e?.alt||"",imgClassName:(0,i.cn)("object-cover",t)})});M.displayName="MarqueeImageContent";const C=r.default.forwardRef(({text:e,textClassName:t},a)=>(0,s.jsx)(m.Text,{as:"div",ref:a,html:e,className:(0,i.cn)("text-lines-2 flex size-full items-center justify-center font-bold leading-[1.2]",t)}));C.displayName="MarqueeTextContent";const N=({icon:e,text:t,iconClassName:a,textClassName:o})=>(0,s.jsxs)("div",{className:"laptop:h-[72px] laptop:gap-2 flex h-[48px] items-center gap-1",children:[e&&(0,s.jsx)("img",{src:e?.url,alt:e?.alt||"",className:(0,i.cn)("desktop:size-6 size-5 shrink-0 object-contain",a)}),t&&(0,s.jsx)(m.Text,{as:"div",html:t,className:(0,i.cn)("laptop:text-[16px] lg-desktop::text-[18px] flex h-full items-center text-[14px] ",o)})]});N.displayName="MarqueeIconAndTextContent";const h=({pictureImage:e,pictureClassName:t})=>(0,s.jsx)("div",{className:"lg-desktop:size-[128px] desktop:size-[112px] laptop:size-[96px] tablet:size-[72px] size-[72px] shrink-0",children:(0,s.jsx)(m.Picture,{source:e?.url,alt:e?.alt||"",className:"w-full",imgClassName:(0,i.cn)("object-contain",t)})});h.displayName="MarqueePictureContent";var _=(0,k.withLayout)(g);
|
|
2
2
|
//# sourceMappingURL=Marquee.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Marquee/Marquee.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle,
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,
|
|
6
|
-
"names": ["Marquee_exports", "__export", "MarqueeImageContent", "MarqueeItem", "MarqueeTextContent", "Marquee_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_utils", "import_Styles", "import_css", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useRef, useImperativeHandle, useLayoutEffect, useState, type RefObject } from 'react'\nimport { Picture, Text } from '../../components/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type {\n MarqueeProps,\n MarqueeItemProps,\n MarqueeImageContentProps,\n MarqueeTextContentProps,\n MarqueeIconAndTextContentProps,\n MarqueePictureContentProps,\n} from './type.js'\n\nimport 'swiper/css'\n\nimport { useExposure } from '../../hooks/useExposure.js'\n\nconst componentType = 'image'\nconst componentName = 'marquee'\n\nconst Marquee = React.forwardRef<HTMLDivElement, MarqueeProps>(\n ({ data: { items = [], speed = 3000, reverseDirection = false, key: dataKey } = {}, className }, ref) => {\n const innerRef = useRef<HTMLDivElement>(null)\n const trackRef = useRef<HTMLDivElement>(null)\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef as unknown as RefObject<HTMLDivElement>, {\n componentType,\n componentName,\n })\n\n const duration = `${speed * 5}ms`\n const gap = 'clamp(24px, 4vw, 64px)'\n\n const [copies, setCopies] = useState(2)\n\n useLayoutEffect(() => {\n const track = trackRef.current\n if (!track) return\n\n const calcCopies = () => {\n const trackWidth = track.offsetWidth\n if (trackWidth === 0) return\n const viewportWidth = window.innerWidth\n const minCopies = Math.ceil(viewportWidth / trackWidth)\n setCopies(Math.max(2, minCopies))\n }\n\n calcCopies()\n innerRef.current?.style.setProperty('--track-width', `${track.offsetWidth}px`)\n\n const ro = new ResizeObserver(() => {\n calcCopies()\n innerRef.current?.style.setProperty('--track-width', `${track.offsetWidth}px`)\n })\n ro.observe(track)\n return () => ro.disconnect()\n }, [items])\n\n return (\n <div\n ref={innerRef}\n id={dataKey ? `Marquee-${dataKey}` : undefined}\n className={cn('text-info-primary w-full', className)}\n >\n <div\n className={cn(\n 'flex h-full w-max items-center',\n reverseDirection ? 'animate-marquee-reverse' : 'animate-marquee'\n )}\n style={{ '--marquee-duration': duration } as React.CSSProperties}\n >\n {/* \u539F\u59CB\u8F68\u9053\uFF1A\u7528 ref \u6D4B\u91CF\u771F\u5B9E\u5BBD\u5EA6 */}\n <div ref={trackRef} className=\"flex h-full shrink-0 items-center\" style={{ gap, paddingRight: gap }}>\n {items.map((item, index) => (\n <div key={(item?.id ?? '') + '-orig-' + index} className=\"shrink-0\">\n <MarqueeItem data={item} />\n </div>\n ))}\n </div>\n\n {Array.from({ length: copies }).map((_, copyIndex) => (\n <div\n key={`copy-group-${copyIndex}`}\n className=\"flex h-full shrink-0 items-center\"\n style={{ gap, paddingRight: gap }}\n aria-hidden=\"true\"\n >\n {items.map((item, index) => (\n <div key={(item?.id ?? '') + '-copy-' + copyIndex + '-' + index} className=\"shrink-0\">\n <MarqueeItem data={item} />\n </div>\n ))}\n </div>\n ))}\n </div>\n </div>\n )\n }\n)\n\nMarquee.displayName = 'Marquee'\n\n// \u2500\u2500\u2500 Sub-components \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst MarqueeItem = ({ data, configuration }: MarqueeItemProps) => {\n return (\n <>\n {data.type === 'image' && (\n <MarqueeImageContent image={data?.image} imageClassName={configuration?.imageClassName} />\n )}\n {data.type === 'text' && <MarqueeTextContent text={data?.text} textClassName={configuration?.textClassName} />}\n {data.type === 'iconAndText' && (\n <MarqueeIconAndTextContent\n icon={data?.iconImage}\n text={data?.iconText}\n iconClassName={configuration?.iconClassName}\n textClassName={configuration?.textClassName}\n />\n )}\n {data.type === 'picture' && (\n <MarqueePictureContent pictureImage={data?.pictureImage} pictureClassName={configuration?.pictureClassName} />\n )}\n </>\n )\n}\n\nMarqueeItem.displayName = 'MarqueeItem'\n\nconst MarqueeImageContent = ({ image, imageClassName }: MarqueeImageContentProps) => {\n return (\n <div className=\"laptop:w-[120px] h-full w-[72px] shrink-0\">\n <Picture source={image?.url} alt={image?.alt || ''} imgClassName={cn('object-cover', imageClassName)} />\n </div>\n )\n}\n\nMarqueeImageContent.displayName = 'MarqueeImageContent'\n\nconst MarqueeTextContent = React.forwardRef<HTMLDivElement, MarqueeTextContentProps>(({ text, textClassName }, ref) => {\n return (\n <Text\n as=\"div\"\n ref={ref}\n html={text}\n className={cn('text-lines-2 flex size-full items-center justify-center font-bold leading-[1.2]', textClassName)}\n />\n )\n})\n\nMarqueeTextContent.displayName = 'MarqueeTextContent'\n\nconst MarqueeIconAndTextContent = ({ icon, text, iconClassName, textClassName }: MarqueeIconAndTextContentProps) => {\n return (\n <div className=\"laptop:h-[72px] laptop:gap-2 flex h-[48px] items-center gap-1\">\n {icon && (\n <img\n src={icon?.url}\n alt={icon?.alt || ''}\n className={cn('desktop:size-6 size-5 shrink-0 object-contain', iconClassName)}\n />\n )}\n {text && (\n <Text\n as=\"div\"\n html={text}\n className={cn(\n 'laptop:text-[16px] lg-desktop::text-[18px] flex h-full items-center text-[14px] ',\n textClassName\n )}\n />\n )}\n </div>\n )\n}\n\nMarqueeIconAndTextContent.displayName = 'MarqueeIconAndTextContent'\n\nconst MarqueePictureContent = ({ pictureImage, pictureClassName }: MarqueePictureContentProps) => {\n return (\n <div className=\"lg-desktop:size-[128px] desktop:size-[112px] laptop:size-[96px] tablet:size-[72px] size-[72px] shrink-0\">\n <Picture\n source={pictureImage?.url}\n alt={pictureImage?.alt || ''}\n className=\"w-full\"\n imgClassName={cn('object-contain', pictureClassName)}\n />\n </div>\n )\n}\n\nMarqueePictureContent.displayName = 'MarqueePictureContent'\n\nexport default withLayout(Marquee)\nexport { MarqueeItem, MarqueeImageContent, MarqueeTextContent, MarqueeIconAndTextContent, MarqueePictureContent }\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,+BAAAE,EAAA,wBAAAC,EAAA,gBAAAC,EAAA,0BAAAC,EAAA,uBAAAC,EAAA,YAAAC,IAAA,eAAAC,EAAAR,GAmEQ,IAAAS,EAAA,6BAlERC,EAA8F,oBAC9FC,EAA8B,qCAC9BC,EAAmB,kCACnBC,EAA2B,kCAU3BC,EAAO,sBAEPC,EAA4B,sCAE5B,MAAMC,EAAgB,QAChBC,EAAgB,UAEhBC,EAAU,EAAAC,QAAM,WACpB,CAAC,CAAE,KAAM,CAAE,MAAAC,EAAQ,CAAC,EAAG,MAAAC,EAAQ,IAAM,iBAAAC,EAAmB,GAAO,IAAKC,CAAQ,EAAI,CAAC,EAAG,UAAAC,CAAU,EAAGC,IAAQ,CACvG,MAAMC,KAAW,UAAuB,IAAI,EACtCC,KAAW,UAAuB,IAAI,KAE5C,uBAAoBF,EAAK,IAAMC,EAAS,OAAyB,KAEjE,eAAYA,EAAkD,CAC5D,cAAAV,EACA,cAAAC,CACF,CAAC,EAED,MAAMW,EAAW,GAAGP,EAAQ,CAAC,KACvBQ,EAAM,yBAEN,CAACC,EAAQC,CAAS,KAAI,YAAS,CAAC,EAEtC,4BAAgB,IAAM,CACpB,MAAMC,EAAQL,EAAS,QACvB,GAAI,CAACK,EAAO,OAEZ,MAAMC,EAAa,IAAM,CACvB,MAAMC,EAAaF,EAAM,YACzB,GAAIE,IAAe,EAAG,OACtB,MAAMC,EAAgB,OAAO,WACvBC,EAAY,KAAK,KAAKD,EAAgBD,CAAU,EACtDH,EAAU,KAAK,IAAI,EAAGK,CAAS,CAAC,CAClC,EAEAH,EAAW,EACXP,EAAS,SAAS,MAAM,YAAY,gBAAiB,GAAGM,EAAM,WAAW,IAAI,EAE7E,MAAMK,EAAK,IA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B,YAAc,wBAEpC,IAAOE,KAAQ,cAAWW,CAAO",
|
|
6
|
+
"names": ["Marquee_exports", "__export", "MarqueeIconAndTextContent", "MarqueeImageContent", "MarqueeItem", "MarqueePictureContent", "MarqueeTextContent", "Marquee_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_utils", "import_Styles", "import_css", "import_useExposure", "componentType", "componentName", "Marquee", "React", "items", "speed", "reverseDirection", "dataKey", "className", "ref", "innerRef", "trackRef", "duration", "gap", "copies", "setCopies", "track", "calcCopies", "trackWidth", "viewportWidth", "minCopies", "ro", "item", "index", "_", "copyIndex", "data", "configuration", "image", "imageClassName", "text", "textClassName", "icon", "iconClassName", "pictureImage", "pictureClassName"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
export { default } from './Marquee.js';
|
|
2
|
-
export { MarqueeItem, MarqueeImageContent, MarqueeTextContent } from './Marquee.js';
|
|
2
|
+
export { MarqueeItem, MarqueeImageContent, MarqueeTextContent, MarqueeIconAndTextContent, MarqueePictureContent, } from './Marquee.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var m=Object.create;var a=Object.defineProperty;var x=Object.getOwnPropertyDescriptor;var C=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var c=(e,t)=>{for(var r in t)a(e,r,{get:t[r],enumerable:!0})},q=(e,t,r,u)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of C(t))!I.call(e,o)&&o!==r&&a(e,o,{get:()=>t[o],enumerable:!(u=x(t,o))||u.enumerable});return e};var d=(e,t,r)=>(r=e!=null?m(f(e)):{},q(t||!e||!e.__esModule?a(r,"default",{value:e,enumerable:!0}):r,e)),p=e=>q(a({},"__esModule",{value:!0}),e);var T={};c(T,{MarqueeIconAndTextContent:()=>n.MarqueeIconAndTextContent,MarqueeImageContent:()=>n.MarqueeImageContent,MarqueeItem:()=>n.MarqueeItem,MarqueePictureContent:()=>n.MarqueePictureContent,MarqueeTextContent:()=>n.MarqueeTextContent,default:()=>M.default});module.exports=p(T);var M=d(require("./Marquee.js")),n=require("./Marquee.js");
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Marquee/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default } from './Marquee.js'\nexport {
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,
|
|
4
|
+
"sourcesContent": ["export { default } from './Marquee.js'\nexport {\n MarqueeItem,\n MarqueeImageContent,\n MarqueeTextContent,\n MarqueeIconAndTextContent,\n MarqueePictureContent,\n} from './Marquee.js'\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,4QAAAE,EAAAF,GAAA,IAAAG,EAAwB,2BACxBA,EAMO",
|
|
6
6
|
"names": ["Marquee_exports", "__export", "__toCommonJS", "import_Marquee"]
|
|
7
7
|
}
|
|
@@ -2,9 +2,11 @@ import type { Img } from '../../types/props.js';
|
|
|
2
2
|
interface MarqueeProps {
|
|
3
3
|
data: {
|
|
4
4
|
key?: string;
|
|
5
|
-
/**
|
|
5
|
+
/** 是否反向滚动 */
|
|
6
6
|
reverseDirection?: boolean;
|
|
7
|
-
/**
|
|
7
|
+
/**
|
|
8
|
+
* 一轮动画时长(ms)。数值越小滚动越快,默认 8000(即 8s 完成一轮)
|
|
9
|
+
*/
|
|
8
10
|
speed?: number;
|
|
9
11
|
/** 跑马灯内容 */
|
|
10
12
|
items: any[];
|
|
@@ -13,13 +15,19 @@ interface MarqueeProps {
|
|
|
13
15
|
}
|
|
14
16
|
interface MarqueeItemProps {
|
|
15
17
|
data: {
|
|
16
|
-
|
|
18
|
+
id?: string;
|
|
19
|
+
type: 'image' | 'text' | 'iconAndText' | 'picture';
|
|
17
20
|
image?: Img;
|
|
18
21
|
text?: string;
|
|
22
|
+
iconImage?: Img;
|
|
23
|
+
iconText?: string;
|
|
24
|
+
pictureImage?: Img;
|
|
19
25
|
};
|
|
20
26
|
configuration?: {
|
|
21
27
|
imageClassName?: string;
|
|
22
28
|
textClassName?: string;
|
|
29
|
+
iconClassName?: string;
|
|
30
|
+
pictureClassName?: string;
|
|
23
31
|
};
|
|
24
32
|
}
|
|
25
33
|
interface MarqueeImageContentProps {
|
|
@@ -30,4 +38,14 @@ interface MarqueeTextContentProps {
|
|
|
30
38
|
text?: string;
|
|
31
39
|
textClassName?: string;
|
|
32
40
|
}
|
|
33
|
-
|
|
41
|
+
interface MarqueeIconAndTextContentProps {
|
|
42
|
+
icon?: Img;
|
|
43
|
+
text?: string;
|
|
44
|
+
iconClassName?: string;
|
|
45
|
+
textClassName?: string;
|
|
46
|
+
}
|
|
47
|
+
interface MarqueePictureContentProps {
|
|
48
|
+
pictureImage?: Img;
|
|
49
|
+
pictureClassName?: string;
|
|
50
|
+
}
|
|
51
|
+
export type { MarqueeProps, MarqueeItemProps, MarqueeImageContentProps, MarqueeTextContentProps, MarqueeIconAndTextContentProps, MarqueePictureContentProps, };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var g=Object.prototype.hasOwnProperty;var m=(t,e,s,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of o(e))!g.call(t,r)&&r!==s&&n(t,r,{get:()=>e[r],enumerable:!(a=i(e,r))||a.enumerable});return t};var p=t=>m(n({},"__esModule",{value:!0}),t);var c={};module.exports=p(c);
|
|
2
2
|
//# sourceMappingURL=type.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Marquee/type.ts"],
|
|
4
|
-
"sourcesContent": ["import type { Img } from '../../types/props.js'\n\ninterface MarqueeProps {\n data: {\n key?: string\n /** \u662F\u5426\u53CD\u5411 */\n reverseDirection?: boolean\n
|
|
4
|
+
"sourcesContent": ["import type { Img } from '../../types/props.js'\n\ninterface MarqueeProps {\n data: {\n key?: string\n /** \u662F\u5426\u53CD\u5411\u6EDA\u52A8 */\n reverseDirection?: boolean\n /**\n * \u4E00\u8F6E\u52A8\u753B\u65F6\u957F\uFF08ms\uFF09\u3002\u6570\u503C\u8D8A\u5C0F\u6EDA\u52A8\u8D8A\u5FEB\uFF0C\u9ED8\u8BA4 8000\uFF08\u5373 8s \u5B8C\u6210\u4E00\u8F6E\uFF09\n */\n speed?: number\n /** \u8DD1\u9A6C\u706F\u5185\u5BB9 */\n items: any[]\n }\n className?: string\n}\n\ninterface MarqueeItemProps {\n data: {\n id?: string\n type: 'image' | 'text' | 'iconAndText' | 'picture'\n image?: Img\n text?: string\n iconImage?: Img\n iconText?: string\n pictureImage?: Img\n }\n configuration?: {\n imageClassName?: string\n textClassName?: string\n iconClassName?: string\n pictureClassName?: string\n }\n}\n\ninterface MarqueeImageContentProps {\n image?: Img\n imageClassName?: string\n}\n\ninterface MarqueeTextContentProps {\n text?: string\n textClassName?: string\n}\n\ninterface MarqueeIconAndTextContentProps {\n icon?: Img\n text?: string\n iconClassName?: string\n textClassName?: string\n}\n\ninterface MarqueePictureContentProps {\n pictureImage?: Img\n pictureClassName?: string\n}\n\nexport type {\n MarqueeProps,\n MarqueeItemProps,\n MarqueeImageContentProps,\n MarqueeTextContentProps,\n MarqueeIconAndTextContentProps,\n MarqueePictureContentProps,\n}\n"],
|
|
5
5
|
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
6
|
"names": ["type_exports", "__toCommonJS"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var B=Object.create;var n=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var J=(e,i)=>{for(var o in i)n(e,o,{get:i[o],enumerable:!0})},c=(e,i,o,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Q(i))!G.call(e,r)&&r!==o&&n(e,r,{get:()=>i[r],enumerable:!(t=O(i,r))||t.enumerable});return e};var K=(e,i,o)=>(o=e!=null?B(F(e)):{},c(i||!e||!e.__esModule?n(o,"default",{value:e,enumerable:!0}):o,e)),U=e=>c(n({},"__esModule",{value:!0}),e);var X={};J(X,{default:()=>W});module.exports=U(X);var d=require("react/jsx-runtime"),y=K(require("react")),s=require("react-responsive"),
|
|
1
|
+
"use strict";"use client";var B=Object.create;var n=Object.defineProperty;var O=Object.getOwnPropertyDescriptor;var Q=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,G=Object.prototype.hasOwnProperty;var J=(e,i)=>{for(var o in i)n(e,o,{get:i[o],enumerable:!0})},c=(e,i,o,t)=>{if(i&&typeof i=="object"||typeof i=="function")for(let r of Q(i))!G.call(e,r)&&r!==o&&n(e,r,{get:()=>i[r],enumerable:!(t=O(i,r))||t.enumerable});return e};var K=(e,i,o)=>(o=e!=null?B(F(e)):{},c(i||!e||!e.__esModule?n(o,"default",{value:e,enumerable:!0}):o,e)),U=e=>c(n({},"__esModule",{value:!0}),e);var X={};J(X,{default:()=>W});module.exports=U(X);var d=require("react/jsx-runtime"),y=K(require("react")),s=require("react-responsive"),m=require("../../components/index.js"),a=require("../../helpers/index.js");const p=y.default.forwardRef(({pcImage:e,desktopImage:i,laptopImage:o,padImage:t,mobileImage:r,className:f,videoClassName:M,imgClassName:v,muted:x=!0,loop:T=!0,playsInline:P=!0,autoPlay:w=!0,poster:h,videoRef:b,onVideoPlay:N,onVideoPause:R,onVideoEnded:q,...E},L)=>{const Y=(0,s.useMediaQuery)({query:"(max-width: 767px)"}),V=(0,s.useMediaQuery)({query:"(min-width: 768px) and (max-width: 1024px)"}),j=(0,s.useMediaQuery)({query:"(min-width: 1025px) and (max-width: 1439px)"}),H=(0,s.useMediaQuery)({query:"(min-width: 1440px) and (max-width: 1919px)"}),$=(0,s.useMediaQuery)({query:"(min-width: 1920px)"}),z=[e,i,o,t,r].some(A=>A?.mimeType==="video/mp4"),u=$?e:H?i:j?o:V?t:r,l=u||e||i||o||t||r,C=l?.mimeType==="video/mp4"?l.url:void 0,D=h||(l?.mimeType!=="video/mp4"?l?.url:void 0),S=[r?.url&&`${r.url} 768`,t?.url&&`${t.url} 1025`,o?.url&&`${o.url} 1440`,i?.url&&`${i.url} 1920`,e?.url].filter(Boolean).reverse().join(" , ");return(0,d.jsx)("div",{ref:L,className:(0,a.cn)("media-wrapper",f),...E,children:z?(0,d.jsx)("video",{ref:b,src:C,poster:D,className:(0,a.cn)("size-full object-cover",M),muted:x,loop:T,playsInline:P,autoPlay:w,"aria-label":u?.alt||"",onPlay:N,onPause:R,onEnded:q}):(0,d.jsx)(m.Picture,{className:"size-full",imgClassName:(0,a.cn)("size-full object-cover",v),alt:e?.alt||i?.alt||o?.alt||t?.alt||r?.alt||"",source:S})})});p.displayName="Media";var W=p;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Media/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport React from 'react'\nimport { useMediaQuery } from 'react-responsive'\nimport { Picture } from '../../components/index.js'\nimport type { Media as MediaType } from '../../types/props.js'\nimport { cn } from '../../helpers/index.js'\n\nexport interface MediaProps extends React.HTMLAttributes<HTMLDivElement> {\n /** PC\u7AEF\u5A92\u4F53\uFF08\u22651920px\uFF09 */\n pcImage?: MediaType\n /** \u5927\u684C\u9762\u5A92\u4F53\uFF08\u22651440px\uFF09 */\n desktopImage?: MediaType\n /** \u5C0F\u684C\u9762\u5A92\u4F53\uFF08\u22651025px\uFF09 */\n laptopImage?: MediaType\n /** \u5E73\u677F\u7AEF\u5A92\u4F53\uFF08\u2265768px\uFF09 */\n padImage?: MediaType\n /** \u79FB\u52A8\u7AEF\u5A92\u4F53\uFF08<768px\uFF09 */\n mobileImage?: MediaType\n /** \u89C6\u9891\u7C7B\u540D */\n videoClassName?: string\n /** \u56FE\u7247\u7C7B\u540D */\n imgClassName?: string\n /** \u662F\u5426\u9759\u97F3\u64AD\u653E\uFF08\u4EC5\u89C6\u9891\uFF09 */\n muted?: boolean\n /** \u662F\u5426\u5FAA\u73AF\u64AD\u653E\uFF08\u4EC5\u89C6\u9891\uFF09 */\n loop?: boolean\n /** \u662F\u5426\u5185\u8054\u64AD\u653E\uFF08\u4EC5\u89C6\u9891\uFF09 */\n playsInline?: boolean\n /** \u662F\u5426\u81EA\u52A8\u64AD\u653E\uFF08\u4EC5\u89C6\u9891\uFF09 */\n autoPlay?: boolean\n /** \u89C6\u9891\u9884\u89C8\u56FE */\n poster?: string\n /** \u89C6\u9891 ref\uFF08\u7528\u4E8E\u5916\u90E8\u63A7\u5236\u64AD\u653E/\u6682\u505C\uFF09 */\n videoRef?: React.RefObject<HTMLVideoElement>\n /** \u89C6\u9891\u64AD\u653E\u56DE\u8C03 */\n onVideoPlay?: () => void\n /** \u89C6\u9891\u6682\u505C\u56DE\u8C03 */\n onVideoPause?: () => void\n /** \u89C6\u9891\u7ED3\u675F\u56DE\u8C03 */\n onVideoEnded?: () => void\n}\n\n/**\n * Media - \u667A\u80FD\u5A92\u4F53\u7EC4\u4EF6\n *\n * @description \u6839\u636E\u5A92\u4F53\u7C7B\u578B\u81EA\u52A8\u9009\u62E9\u4F7F\u7528 video \u6807\u7B7E\u6216 Picture \u7EC4\u4EF6\n * \u652F\u6301\u54CD\u5E94\u5F0F\u5A92\u4F53\u6E90\uFF0C\u5982\u679C\u4EFB\u610F\u5A92\u4F53\u7C7B\u578B\u662F\u89C6\u9891\uFF0C\u5219\u4F7F\u7528 video \u6807\u7B7E\u6E32\u67D3\n */\nconst Media = React.forwardRef<HTMLDivElement, MediaProps>(\n (\n {\n pcImage,\n desktopImage,\n laptopImage,\n padImage,\n mobileImage,\n className,\n videoClassName,\n imgClassName,\n muted = true,\n loop = true,\n playsInline = true,\n autoPlay = true,\n poster,\n videoRef,\n onVideoPlay,\n onVideoPause,\n onVideoEnded,\n ...props\n },\n ref\n ) => {\n const isMobile = useMediaQuery({ query: '(max-width: 767px)' })\n const isPad = useMediaQuery({ query: '(min-width: 768px)' })\n const isLaptop = useMediaQuery({ query: '(min-width: 1025px)' })\n const isDesktop = useMediaQuery({ query: '(min-width: 1440px)' })\n const isPc = useMediaQuery({ query: '(min-width: 1920px)' })\n\n const allImages = [pcImage, desktopImage, laptopImage, padImage, mobileImage]\n const hasVideo = allImages.some(media => media?.mimeType === 'video/mp4')\n\n const currentMedia = isPc\n ? pcImage\n : isDesktop\n ? desktopImage\n : isLaptop\n ? laptopImage\n : isPad\n ? padImage\n : mobileImage\n\n const fallbackMedia = currentMedia || pcImage || desktopImage || laptopImage || padImage || mobileImage\n\n const videoSrc = fallbackMedia?.mimeType === 'video/mp4' ? fallbackMedia.url : undefined\n const imagePoster = poster || (fallbackMedia?.mimeType !== 'video/mp4' ? fallbackMedia?.url : undefined)\n\n const pictureSource = [\n mobileImage?.url && `${mobileImage.url} 768`,\n padImage?.url && `${padImage.url} 1025`,\n laptopImage?.url && `${laptopImage.url} 1440`,\n desktopImage?.url && `${desktopImage.url} 1920`,\n pcImage?.url,\n ]\n .filter(Boolean)\n .reverse()\n .join(' , ')\n\n return (\n <div ref={ref} className={cn('media-wrapper', className)} {...props}>\n {hasVideo ? (\n <video\n ref={videoRef}\n src={videoSrc}\n poster={imagePoster}\n className={cn('size-full object-cover', videoClassName)}\n muted={muted}\n loop={loop}\n playsInline={playsInline}\n autoPlay={autoPlay}\n aria-label={currentMedia?.alt || ''}\n onPlay={onVideoPlay}\n onPause={onVideoPause}\n onEnded={onVideoEnded}\n />\n ) : (\n <Picture\n className=\"size-full\"\n imgClassName={cn('size-full object-cover', imgClassName)}\n alt={pcImage?.alt || desktopImage?.alt || laptopImage?.alt || padImage?.alt || mobileImage?.alt || ''}\n source={pictureSource}\n />\n )}\n </div>\n )\n }\n)\n\nMedia.displayName = 'Media'\n\nexport default Media\n"],
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA+GU,IAAAI,EAAA,6BA7GVC,EAAkB,oBAClBC,EAA8B,4BAC9BC,EAAwB,qCAExBC,EAAmB,kCA2CnB,MAAMC,EAAQ,EAAAC,QAAM,WAClB,CACE,CACE,QAAAC,EACA,aAAAC,EACA,YAAAC,EACA,SAAAC,EACA,YAAAC,EACA,UAAAC,EACA,eAAAC,EACA,aAAAC,EACA,MAAAC,EAAQ,GACR,KAAAC,EAAO,GACP,YAAAC,EAAc,GACd,SAAAC,EAAW,GACX,OAAAC,EACA,SAAAC,EACA,YAAAC,EACA,aAAAC,EACA,aAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,MAAMC,KAAW,iBAAc,CAAE,MAAO,oBAAqB,CAAC,EACxDC,KAAQ,iBAAc,CAAE,MAAO,
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport React from 'react'\nimport { useMediaQuery } from 'react-responsive'\nimport { Picture } from '../../components/index.js'\nimport type { Media as MediaType } from '../../types/props.js'\nimport { cn } from '../../helpers/index.js'\n\nexport interface MediaProps extends React.HTMLAttributes<HTMLDivElement> {\n /** PC\u7AEF\u5A92\u4F53\uFF08\u22651920px\uFF09 */\n pcImage?: MediaType\n /** \u5927\u684C\u9762\u5A92\u4F53\uFF08\u22651440px\uFF09 */\n desktopImage?: MediaType\n /** \u5C0F\u684C\u9762\u5A92\u4F53\uFF08\u22651025px\uFF09 */\n laptopImage?: MediaType\n /** \u5E73\u677F\u7AEF\u5A92\u4F53\uFF08\u2265768px\uFF09 */\n padImage?: MediaType\n /** \u79FB\u52A8\u7AEF\u5A92\u4F53\uFF08<768px\uFF09 */\n mobileImage?: MediaType\n /** \u89C6\u9891\u7C7B\u540D */\n videoClassName?: string\n /** \u56FE\u7247\u7C7B\u540D */\n imgClassName?: string\n /** \u662F\u5426\u9759\u97F3\u64AD\u653E\uFF08\u4EC5\u89C6\u9891\uFF09 */\n muted?: boolean\n /** \u662F\u5426\u5FAA\u73AF\u64AD\u653E\uFF08\u4EC5\u89C6\u9891\uFF09 */\n loop?: boolean\n /** \u662F\u5426\u5185\u8054\u64AD\u653E\uFF08\u4EC5\u89C6\u9891\uFF09 */\n playsInline?: boolean\n /** \u662F\u5426\u81EA\u52A8\u64AD\u653E\uFF08\u4EC5\u89C6\u9891\uFF09 */\n autoPlay?: boolean\n /** \u89C6\u9891\u9884\u89C8\u56FE */\n poster?: string\n /** \u89C6\u9891 ref\uFF08\u7528\u4E8E\u5916\u90E8\u63A7\u5236\u64AD\u653E/\u6682\u505C\uFF09 */\n videoRef?: React.RefObject<HTMLVideoElement>\n /** \u89C6\u9891\u64AD\u653E\u56DE\u8C03 */\n onVideoPlay?: () => void\n /** \u89C6\u9891\u6682\u505C\u56DE\u8C03 */\n onVideoPause?: () => void\n /** \u89C6\u9891\u7ED3\u675F\u56DE\u8C03 */\n onVideoEnded?: () => void\n}\n\n/**\n * Media - \u667A\u80FD\u5A92\u4F53\u7EC4\u4EF6\n *\n * @description \u6839\u636E\u5A92\u4F53\u7C7B\u578B\u81EA\u52A8\u9009\u62E9\u4F7F\u7528 video \u6807\u7B7E\u6216 Picture \u7EC4\u4EF6\n * \u652F\u6301\u54CD\u5E94\u5F0F\u5A92\u4F53\u6E90\uFF0C\u5982\u679C\u4EFB\u610F\u5A92\u4F53\u7C7B\u578B\u662F\u89C6\u9891\uFF0C\u5219\u4F7F\u7528 video \u6807\u7B7E\u6E32\u67D3\n */\nconst Media = React.forwardRef<HTMLDivElement, MediaProps>(\n (\n {\n pcImage,\n desktopImage,\n laptopImage,\n padImage,\n mobileImage,\n className,\n videoClassName,\n imgClassName,\n muted = true,\n loop = true,\n playsInline = true,\n autoPlay = true,\n poster,\n videoRef,\n onVideoPlay,\n onVideoPause,\n onVideoEnded,\n ...props\n },\n ref\n ) => {\n const isMobile = useMediaQuery({ query: '(max-width: 767px)' })\n const isPad = useMediaQuery({ query: '(min-width: 768px) and (max-width: 1024px)' })\n const isLaptop = useMediaQuery({ query: '(min-width: 1025px) and (max-width: 1439px)' })\n const isDesktop = useMediaQuery({ query: '(min-width: 1440px) and (max-width: 1919px)' })\n const isPc = useMediaQuery({ query: '(min-width: 1920px)' })\n\n const allImages = [pcImage, desktopImage, laptopImage, padImage, mobileImage]\n const hasVideo = allImages.some(media => media?.mimeType === 'video/mp4')\n\n const currentMedia = isPc\n ? pcImage\n : isDesktop\n ? desktopImage\n : isLaptop\n ? laptopImage\n : isPad\n ? padImage\n : mobileImage\n\n const fallbackMedia = currentMedia || pcImage || desktopImage || laptopImage || padImage || mobileImage\n\n const videoSrc = fallbackMedia?.mimeType === 'video/mp4' ? fallbackMedia.url : undefined\n const imagePoster = poster || (fallbackMedia?.mimeType !== 'video/mp4' ? fallbackMedia?.url : undefined)\n\n const pictureSource = [\n mobileImage?.url && `${mobileImage.url} 768`,\n padImage?.url && `${padImage.url} 1025`,\n laptopImage?.url && `${laptopImage.url} 1440`,\n desktopImage?.url && `${desktopImage.url} 1920`,\n pcImage?.url,\n ]\n .filter(Boolean)\n .reverse()\n .join(' , ')\n\n return (\n <div ref={ref} className={cn('media-wrapper', className)} {...props}>\n {hasVideo ? (\n <video\n ref={videoRef}\n src={videoSrc}\n poster={imagePoster}\n className={cn('size-full object-cover', videoClassName)}\n muted={muted}\n loop={loop}\n playsInline={playsInline}\n autoPlay={autoPlay}\n aria-label={currentMedia?.alt || ''}\n onPlay={onVideoPlay}\n onPause={onVideoPause}\n onEnded={onVideoEnded}\n />\n ) : (\n <Picture\n className=\"size-full\"\n imgClassName={cn('size-full object-cover', imgClassName)}\n alt={pcImage?.alt || desktopImage?.alt || laptopImage?.alt || padImage?.alt || mobileImage?.alt || ''}\n source={pictureSource}\n />\n )}\n </div>\n )\n }\n)\n\nMedia.displayName = 'Media'\n\nexport default Media\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA+GU,IAAAI,EAAA,6BA7GVC,EAAkB,oBAClBC,EAA8B,4BAC9BC,EAAwB,qCAExBC,EAAmB,kCA2CnB,MAAMC,EAAQ,EAAAC,QAAM,WAClB,CACE,CACE,QAAAC,EACA,aAAAC,EACA,YAAAC,EACA,SAAAC,EACA,YAAAC,EACA,UAAAC,EACA,eAAAC,EACA,aAAAC,EACA,MAAAC,EAAQ,GACR,KAAAC,EAAO,GACP,YAAAC,EAAc,GACd,SAAAC,EAAW,GACX,OAAAC,EACA,SAAAC,EACA,YAAAC,EACA,aAAAC,EACA,aAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,MAAMC,KAAW,iBAAc,CAAE,MAAO,oBAAqB,CAAC,EACxDC,KAAQ,iBAAc,CAAE,MAAO,4CAA6C,CAAC,EAC7EC,KAAW,iBAAc,CAAE,MAAO,6CAA8C,CAAC,EACjFC,KAAY,iBAAc,CAAE,MAAO,6CAA8C,CAAC,EAClFC,KAAO,iBAAc,CAAE,MAAO,qBAAsB,CAAC,EAGrDC,EADY,CAACxB,EAASC,EAAcC,EAAaC,EAAUC,CAAW,EACjD,KAAKqB,GAASA,GAAO,WAAa,WAAW,EAElEC,EAAeH,EACjBvB,EACAsB,EACErB,EACAoB,EACEnB,EACAkB,EACEjB,EACAC,EAEJuB,EAAgBD,GAAgB1B,GAAWC,GAAgBC,GAAeC,GAAYC,EAEtFwB,EAAWD,GAAe,WAAa,YAAcA,EAAc,IAAM,OACzEE,EAAcjB,IAAWe,GAAe,WAAa,YAAcA,GAAe,IAAM,QAExFG,EAAgB,CACpB1B,GAAa,KAAO,GAAGA,EAAY,GAAG,OACtCD,GAAU,KAAO,GAAGA,EAAS,GAAG,QAChCD,GAAa,KAAO,GAAGA,EAAY,GAAG,QACtCD,GAAc,KAAO,GAAGA,EAAa,GAAG,QACxCD,GAAS,GACX,EACG,OAAO,OAAO,EACd,QAAQ,EACR,KAAK,KAAK,EAEb,SACE,OAAC,OAAI,IAAKkB,EAAK,aAAW,MAAG,gBAAiBb,CAAS,EAAI,GAAGY,EAC3D,SAAAO,KACC,OAAC,SACC,IAAKX,EACL,IAAKe,EACL,OAAQC,EACR,aAAW,MAAG,yBAA0BvB,CAAc,EACtD,MAAOE,EACP,KAAMC,EACN,YAAaC,EACb,SAAUC,EACV,aAAYe,GAAc,KAAO,GACjC,OAAQZ,EACR,QAASC,EACT,QAASC,EACX,KAEA,OAAC,WACC,UAAU,YACV,gBAAc,MAAG,yBAA0BT,CAAY,EACvD,IAAKP,GAAS,KAAOC,GAAc,KAAOC,GAAa,KAAOC,GAAU,KAAOC,GAAa,KAAO,GACnG,OAAQ0B,EACV,EAEJ,CAEJ,CACF,EAEAhC,EAAM,YAAc,QAEpB,IAAOP,EAAQO",
|
|
6
6
|
"names": ["Media_exports", "__export", "Media_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_react_responsive", "import_components", "import_helpers", "Media", "React", "pcImage", "desktopImage", "laptopImage", "padImage", "mobileImage", "className", "videoClassName", "imgClassName", "muted", "loop", "playsInline", "autoPlay", "poster", "videoRef", "onVideoPlay", "onVideoPause", "onVideoEnded", "props", "ref", "isMobile", "isPad", "isLaptop", "isDesktop", "isPc", "hasVideo", "media", "currentMedia", "fallbackMedia", "videoSrc", "imagePoster", "pictureSource"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { MediaTextOverlayProps } from './types.js';
|
|
3
|
+
import 'swiper/css';
|
|
4
|
+
import 'swiper/css/navigation';
|
|
5
|
+
declare const _default: React.ForwardRefExoticComponent<Omit<MediaTextOverlayProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../WheelLottery/index.js").ContainerProps & React.RefAttributes<unknown>> & {
|
|
6
|
+
readonly $$typeof: symbol;
|
|
7
|
+
};
|
|
8
|
+
export default _default;
|
|
9
|
+
export type { MediaTextOverlayProps };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var $=Object.create;var x=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var j=Object.getOwnPropertyNames;var A=Object.getPrototypeOf,D=Object.prototype.hasOwnProperty;var H=(t,o)=>{for(var l in o)x(t,l,{get:o[l],enumerable:!0})},C=(t,o,l,c)=>{if(o&&typeof o=="object"||typeof o=="function")for(let p of j(o))!D.call(t,p)&&p!==l&&x(t,p,{get:()=>o[p],enumerable:!(c=R(o,p))||c.enumerable});return t};var M=(t,o,l)=>(l=t!=null?$(A(t)):{},C(o||!t||!t.__esModule?x(l,"default",{value:t,enumerable:!0}):l,t)),W=t=>C(x({},"__esModule",{value:!0}),t);var U={};H(U,{default:()=>Q});module.exports=W(U);var e=require("react/jsx-runtime"),s=M(require("react")),I=require("../../shared/Styles.js"),u=require("../../helpers/utils.js"),E=require("../../hooks/useExposure.js"),T=require("../AiuiProvider/index.js"),O=M(require("../Media/index.js")),Y=require("swiper/css"),ee=require("swiper/css/navigation"),S=require("../../components/index.js"),b=require("swiper/react"),L=require("swiper/modules");const Z=({disabled:t})=>(0,e.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary lg-desktop:size-[56px] size-[40px]",children:[(0,e.jsx)("path",{d:"M0 28C0 43.464 12.536 56 28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28Z",fill:"currentColor",fillOpacity:t?"0.2":"0.6"}),(0,e.jsx)("path",{d:"M31 22L25 28L31 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),_=({disabled:t})=>(0,e.jsxs)("svg",{width:"40",height:"40",viewBox:"0 0 56 56",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:"text-info-primary lg-desktop:size-[56px] size-[40px]",children:[(0,e.jsx)("path",{d:"M0 28C0 12.536 12.536 0 28 0C43.464 0 56 12.536 56 28C56 43.464 43.464 56 28 56C12.536 56 0 43.464 0 28Z",fill:"currentColor",fillOpacity:t?"0.2":"0.6"}),(0,e.jsx)("path",{d:"M25 22L31 28L25 34",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})]}),F="video",q="media_text_overlay",G=()=>(0,e.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M8 5.14v13.72L19 12 8 5.14z",fill:"white"})}),J=()=>(0,e.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:[(0,e.jsx)("rect",{x:"6",y:"5",width:"4",height:"14",rx:"1",fill:"white"}),(0,e.jsx)("rect",{x:"14",y:"5",width:"4",height:"14",rx:"1",fill:"white"})]}),K=({data:t,configuration:o,jIndex:l,classNames:c={}})=>{const p=(0,s.useRef)(null),h=(0,s.useRef)(null),{content:r,media:n}=t,k=o?.theme||"light",P=o?.size||"lg",B=o?.onlyOne||!1,g=o?.isAutoPlay??!0,[y,d]=(0,s.useState)(!1);(0,E.useExposure)(p,{componentType:F,componentName:q,position:l,componentTitle:r,navigation:o?.activeTab});const m=(0,s.useMemo)(()=>[n.lgDesktop,n.desktop,n.laptop,n.pad,n.mobile].some(a=>a?.mimeType==="video/mp4"),[n]),N=(0,s.useCallback)(()=>{const a=h.current;a&&(a.paused?(a.play(),d(!0)):(a.pause(),d(!1)))},[]);return(0,s.useEffect)(()=>{const a=h.current;if(!a||!m||!g)return;const v=new IntersectionObserver(i=>{i.forEach(f=>{f.isIntersecting?a.play().catch(V=>{console.warn("Video autoplay failed:",V)}):a.pause()})},{threshold:.5});return v.observe(a),()=>{v.disconnect()}},[m,g]),(0,e.jsxs)("div",{className:(0,u.cn)("item-wrapper rounded-box group relative box-border w-full overflow-hidden",B?{lg:"h-[400px] laptop:h-[384px] desktop:h-[512px] lg-desktop:h-[640px]",sm:"h-[240px] laptop:h-[288px] desktop:h-[384px] lg-desktop:h-[480px]"}[P]:"desktop:h-[384px] lg-desktop:h-[480px] h-[360px]",{"aiui-dark":k==="dark"}),ref:p,children:[(0,e.jsx)("div",{className:"absolute inset-0",children:(0,e.jsx)(O.default,{pcImage:n.lgDesktop||n.desktop,desktopImage:n.desktop,laptopImage:n.laptop,padImage:n.pad,mobileImage:n.mobile,videoClassName:"absolute inset-0 size-full object-cover",imgClassName:"absolute inset-0 size-full object-cover",videoRef:h,muted:!0,loop:!0,playsInline:!0,autoPlay:g,onVideoPlay:()=>d(!0),onVideoPause:()=>d(!1),onVideoEnded:()=>d(!1)})}),m&&(0,e.jsx)("div",{className:"desktop:p-8 absolute bottom-0 right-0 z-30 p-6",children:(0,e.jsx)("button",{type:"button","aria-label":y?"Pause video":"Play video",onClick:N,className:(0,u.cn)("flex size-14 shrink-0 items-center justify-center rounded-full bg-white/20 transition-opacity hover:opacity-80",c.playButton),children:y?(0,e.jsx)(J,{}):(0,e.jsx)(G,{})})}),(0,e.jsx)("div",{className:(0,u.cn)("text-info-primary laptop:px-6 laptop:pb-6 laptop:pr-24 desktop:px-8 desktop:pb-8 desktop:pr-28 absolute inset-x-0 bottom-0 z-20 flex flex-col gap-4 px-4 pb-4 pr-20",c.overlay),children:(0,e.jsx)("div",{className:(0,u.cn)("flex items-end justify-between gap-4",c.content),children:(0,e.jsx)(S.Heading,{size:2,html:r,className:"line-clamp-3"})})})]})},z=s.default.forwardRef((t,o)=>{const{data:l,className:c,classNames:p={},...h}=t,{items:r=[],theme:n="dark",size:k="sm",isShowPagination:P=!0,isAutoPlay:B=!0}=l,{locale:g="us"}=(0,T.useAiuiContext)(),y=(0,s.useRef)(null),[d,m]=(0,s.useState)({isBeginning:!0,isEnd:!1}),N=(0,s.useMemo)(()=>{const i=r?.length||0;return{0:{spaceBetween:12,slidesPerView:i>1?1.2:1},768:{spaceBetween:12,slidesPerView:i>2?2.3:i>1?2:1},1024:{spaceBetween:16,slidesPerView:Math.min(i,3)},1440:{spaceBetween:16,slidesPerView:Math.min(i,4)},1920:{spaceBetween:16,slidesPerView:Math.min(i,4)}}},[r?.length]),w=s.default.useId().replace(/:/g,""),a=`${w}-custom-swiper-button-next`,v=`${w}-custom-swiper-button-prev`;return(0,e.jsx)("section",{"data-ui-component-id":"MediaTextOverlay",ref:o,...h,className:(0,u.cn)("mediaTextOverlayBlock text-info-primary",c,p.root),children:r&&r.length>0?(0,e.jsxs)("div",{className:"group relative",children:[(0,e.jsx)(b.Swiper,{className:"!overflow-visible",modules:[L.Navigation],navigation:{nextEl:`.${a}`,prevEl:`.${v}`},onSwiper:i=>{y.current=i,m({isBeginning:i.isBeginning,isEnd:i.isEnd})},onReachEnd:()=>{m(i=>({...i,isEnd:!0}))},onReachBeginning:()=>{m(i=>({...i,isBeginning:!0}))},onFromEdge:()=>{m({isBeginning:!1,isEnd:!1})},breakpoints:N,children:r.map((i,f)=>(0,e.jsx)(b.SwiperSlide,{className:"!flex !h-[unset]",children:(0,e.jsx)(K,{data:i,configuration:{theme:n,size:k,num:r.length,locale:g,onlyOne:r.length===1,index:f,isAutoPlay:B},jIndex:f})},`${w}-SwiperSlide-${f}`))}),P&&r.length>1&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("button",{className:`${v} absolute left-4 top-1/2 z-10 -translate-y-1/2 transition-opacity ${d.isBeginning?"pointer-events-none opacity-0":"opacity-100 hover:opacity-80"}`,"aria-label":"Previous slide",children:(0,e.jsx)(Z,{disabled:d.isBeginning})}),(0,e.jsx)("button",{className:`${a} absolute right-4 top-1/2 z-10 -translate-y-1/2 transition-opacity ${d.isEnd?"pointer-events-none opacity-0":"opacity-100 hover:opacity-80"}`,"aria-label":"Next slide",children:(0,e.jsx)(_,{disabled:d.isEnd})})]})]}):null})});z.displayName="MediaTextOverlay";var Q=(0,I.withLayout)(z);
|
|
2
|
+
//# sourceMappingURL=MediaTextOverlay.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/MediaTextOverlay/MediaTextOverlay.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport React, { useRef, useMemo, useState, useEffect, useCallback } from 'react'\nimport { withLayout } from '../../shared/Styles.js'\nimport { cn } from '../../helpers/utils.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport Media from '../Media/index.js'\nimport type { MediaTextOverlayProps, MediaTextOverlayItem } from './types.js'\nimport 'swiper/css'\nimport 'swiper/css/navigation'\nimport { Heading } from '../../components/index.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Navigation } from 'swiper/modules'\n\nconst PrevIcon = ({ disabled }: { disabled: boolean }) => (\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 56 56\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"text-info-primary lg-desktop:size-[56px] size-[40px]\"\n >\n <path\n d=\"M0 28C0 43.464 12.536 56 28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28Z\"\n fill=\"currentColor\"\n fillOpacity={disabled ? '0.2' : '0.6'}\n />\n <path d=\"M31 22L25 28L31 34\" stroke=\"white\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\nconst NextIcon = ({ disabled }: { disabled: boolean }) => (\n <svg\n width=\"40\"\n height=\"40\"\n viewBox=\"0 0 56 56\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"text-info-primary lg-desktop:size-[56px] size-[40px]\"\n >\n <path\n d=\"M0 28C0 12.536 12.536 0 28 0C43.464 0 56 12.536 56 28C56 43.464 43.464 56 28 56C12.536 56 0 43.464 0 28Z\"\n fill=\"currentColor\"\n fillOpacity={disabled ? '0.2' : '0.6'}\n />\n <path d=\"M25 22L31 28L25 34\" stroke=\"white\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n)\n\nconst componentType = 'video'\nconst componentName = 'media_text_overlay'\n\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n// Icons\n// \u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\n\nconst PlayIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M8 5.14v13.72L19 12 8 5.14z\" fill=\"white\" />\n </svg>\n)\n\nconst PauseIcon = () => (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <rect x=\"6\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" fill=\"white\" />\n <rect x=\"14\" y=\"5\" width=\"4\" height=\"14\" rx=\"1\" fill=\"white\" />\n </svg>\n)\n\ninterface ItemBlockProps {\n data: MediaTextOverlayItem\n configuration?: any\n jIndex?: number\n classNames?: any\n}\n\nconst ItemBlock = ({ data: item, configuration, jIndex, classNames = {} }: ItemBlockProps) => {\n const ref = useRef<HTMLDivElement>(null)\n const videoRef = useRef<HTMLVideoElement>(null)\n\n const { content, media } = item\n const theme = configuration?.theme || 'light'\n const size = configuration?.size || 'lg'\n const onlyOne = configuration?.onlyOne || false\n const isAutoPlay = configuration?.isAutoPlay ?? true\n\n const [isPlaying, setIsPlaying] = useState(false)\n\n useExposure(ref, {\n componentType,\n componentName,\n position: jIndex,\n componentTitle: content,\n navigation: configuration?.activeTab,\n })\n\n const hasVideo = useMemo(\n () =>\n [media.lgDesktop, media.desktop, media.laptop, media.pad, media.mobile].some(m => m?.mimeType === 'video/mp4'),\n [media]\n )\n\n const handlePlayButtonClick = useCallback(() => {\n const video = videoRef.current\n if (video) {\n if (video.paused) {\n video.play()\n setIsPlaying(true)\n } else {\n video.pause()\n setIsPlaying(false)\n }\n }\n }, [])\n\n useEffect(() => {\n const video = videoRef.current\n if (!video || !hasVideo || !isAutoPlay) return\n\n const observer = new IntersectionObserver(\n entries => {\n entries.forEach(entry => {\n if (entry.isIntersecting) {\n video.play().catch(error => {\n console.warn('Video autoplay failed:', error)\n })\n } else {\n video.pause()\n }\n })\n },\n { threshold: 0.5 }\n )\n\n observer.observe(video)\n\n return () => {\n observer.disconnect()\n }\n }, [hasVideo, isAutoPlay])\n\n const sizeClasses = {\n lg: 'h-[400px] laptop:h-[384px] desktop:h-[512px] lg-desktop:h-[640px]',\n sm: 'h-[240px] laptop:h-[288px] desktop:h-[384px] lg-desktop:h-[480px]',\n }\n\n return (\n <div\n className={cn(\n 'item-wrapper rounded-box group relative box-border w-full overflow-hidden',\n onlyOne ? sizeClasses[size as keyof typeof sizeClasses] : 'desktop:h-[384px] lg-desktop:h-[480px] h-[360px]',\n {\n 'aiui-dark': theme === 'dark',\n }\n )}\n ref={ref}\n >\n <div className=\"absolute inset-0\">\n <Media\n pcImage={media.lgDesktop || media.desktop}\n desktopImage={media.desktop}\n laptopImage={media.laptop}\n padImage={media.pad}\n mobileImage={media.mobile}\n videoClassName=\"absolute inset-0 size-full object-cover\"\n imgClassName=\"absolute inset-0 size-full object-cover\"\n videoRef={videoRef}\n muted={true}\n loop={true}\n playsInline={true}\n autoPlay={isAutoPlay}\n onVideoPlay={() => setIsPlaying(true)}\n onVideoPause={() => setIsPlaying(false)}\n onVideoEnded={() => setIsPlaying(false)}\n />\n </div>\n\n {hasVideo && (\n <div className=\"desktop:p-8 absolute bottom-0 right-0 z-30 p-6\">\n <button\n type=\"button\"\n aria-label={isPlaying ? 'Pause video' : 'Play video'}\n onClick={handlePlayButtonClick}\n className={cn(\n 'flex size-14 shrink-0 items-center justify-center rounded-full bg-white/20 transition-opacity hover:opacity-80',\n classNames.playButton\n )}\n >\n {isPlaying ? <PauseIcon /> : <PlayIcon />}\n </button>\n </div>\n )}\n\n <div\n className={cn(\n 'text-info-primary laptop:px-6 laptop:pb-6 laptop:pr-24 desktop:px-8 desktop:pb-8 desktop:pr-28 absolute inset-x-0 bottom-0 z-20 flex flex-col gap-4 px-4 pb-4 pr-20',\n classNames.overlay\n )}\n >\n <div className={cn('flex items-end justify-between gap-4', classNames.content)}>\n <Heading size={2} html={content} className=\"line-clamp-3\" />\n </div>\n </div>\n </div>\n )\n}\n\nconst MediaTextOverlay = React.forwardRef<HTMLDivElement, MediaTextOverlayProps>((props, ref) => {\n const { data, className, classNames = {}, ...rest } = props\n const { items = [], theme = 'dark', size = 'sm', isShowPagination = true, isAutoPlay = true } = data\n const { locale = 'us' } = useAiuiContext()\n const swiperRef = useRef<any>(null)\n const [swiperState, setSwiperState] = useState({\n isBeginning: true,\n isEnd: false,\n })\n\n const breakpoints = useMemo(() => {\n const len = items?.length || 0\n return {\n 0: {\n spaceBetween: 12,\n slidesPerView: len > 1 ? 1.2 : 1,\n },\n 768: {\n spaceBetween: 12,\n slidesPerView: len > 2 ? 2.3 : len > 1 ? 2 : 1,\n },\n 1024: {\n spaceBetween: 16,\n slidesPerView: Math.min(len, 3),\n },\n 1440: {\n spaceBetween: 16,\n slidesPerView: Math.min(len, 4),\n },\n 1920: {\n spaceBetween: 16,\n slidesPerView: Math.min(len, 4),\n },\n }\n }, [items?.length])\n\n // \u751F\u6210\u552F\u4E00 ID\uFF0C\u79FB\u9664\u7279\u6B8A\u5B57\u7B26\u4EE5\u786E\u4FDD\u53EF\u7528\u4E8E CSS \u9009\u62E9\u5668\n const id = React.useId().replace(/:/g, '')\n const nextButtonClass = `${id}-custom-swiper-button-next`\n const prevButtonClass = `${id}-custom-swiper-button-prev`\n\n return (\n <section\n data-ui-component-id=\"MediaTextOverlay\"\n ref={ref}\n {...rest}\n className={cn('mediaTextOverlayBlock text-info-primary', className, classNames.root)}\n >\n {items && items.length > 0 ? (\n <div className=\"group relative\">\n <Swiper\n className=\"!overflow-visible\"\n modules={[Navigation]}\n navigation={{\n nextEl: `.${nextButtonClass}`,\n prevEl: `.${prevButtonClass}`,\n }}\n onSwiper={swiper => {\n swiperRef.current = swiper\n setSwiperState({\n isBeginning: swiper.isBeginning,\n isEnd: swiper.isEnd,\n })\n }}\n onReachEnd={() => {\n setSwiperState(prev => ({ ...prev, isEnd: true }))\n }}\n onReachBeginning={() => {\n setSwiperState(prev => ({ ...prev, isBeginning: true }))\n }}\n onFromEdge={() => {\n setSwiperState({ isBeginning: false, isEnd: false })\n }}\n breakpoints={breakpoints}\n >\n {items.map((item, jIndex) => (\n <SwiperSlide key={`${id}-SwiperSlide-${jIndex}`} className=\"!flex !h-[unset]\">\n <ItemBlock\n data={item}\n configuration={{\n theme,\n size,\n num: items.length,\n locale,\n onlyOne: items.length === 1,\n index: jIndex,\n isAutoPlay,\n }}\n jIndex={jIndex}\n />\n </SwiperSlide>\n ))}\n </Swiper>\n\n {isShowPagination && items.length > 1 && (\n <>\n <button\n className={`${prevButtonClass} absolute left-4 top-1/2 z-10 -translate-y-1/2 transition-opacity ${swiperState.isBeginning ? 'pointer-events-none opacity-0' : 'opacity-100 hover:opacity-80'}`}\n aria-label=\"Previous slide\"\n >\n <PrevIcon disabled={swiperState.isBeginning} />\n </button>\n <button\n className={`${nextButtonClass} absolute right-4 top-1/2 z-10 -translate-y-1/2 transition-opacity ${swiperState.isEnd ? 'pointer-events-none opacity-0' : 'opacity-100 hover:opacity-80'}`}\n aria-label=\"Next slide\"\n >\n <NextIcon disabled={swiperState.isEnd} />\n </button>\n </>\n )}\n </div>\n ) : null}\n </section>\n )\n})\n\nMediaTextOverlay.displayName = 'MediaTextOverlay'\n\nexport default withLayout(MediaTextOverlay)\nexport type { MediaTextOverlayProps }\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgBE,IAAAI,EAAA,6BAdFC,EAAyE,oBACzEC,EAA2B,kCAC3BC,EAAmB,kCACnBC,EAA4B,sCAC5BC,EAA+B,oCAC/BC,EAAkB,gCAElBC,EAAO,sBACPC,GAAO,iCACPC,EAAwB,qCACxBR,EAAoC,wBACpCS,EAA2B,0BAE3B,MAAMC,EAAW,CAAC,CAAE,SAAAC,CAAS,OAC3B,QAAC,OACC,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OACL,MAAM,6BACN,UAAU,uDAEV,oBAAC,QACC,EAAE,2GACF,KAAK,eACL,YAAaA,EAAW,MAAQ,MAClC,KACA,OAAC,QAAK,EAAE,qBAAqB,OAAO,QAAQ,YAAY,IAAI,cAAc,QAAQ,eAAe,QAAQ,GAC3G,EAGIC,EAAW,CAAC,CAAE,SAAAD,CAAS,OAC3B,QAAC,OACC,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OACL,MAAM,6BACN,UAAU,uDAEV,oBAAC,QACC,EAAE,2GACF,KAAK,eACL,YAAaA,EAAW,MAAQ,MAClC,KACA,OAAC,QAAK,EAAE,qBAAqB,OAAO,QAAQ,YAAY,IAAI,cAAc,QAAQ,eAAe,QAAQ,GAC3G,EAGIE,EAAgB,QAChBC,EAAgB,qBAMhBC,EAA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toCommonJS", "import_jsx_runtime", "import_react", "import_Styles", "import_utils", "import_useExposure", "import_AiuiProvider", "import_Media", "import_css", "import_navigation", "import_components", "import_modules", "PrevIcon", "disabled", "NextIcon", "componentType", "componentName", "PlayIcon", "PauseIcon", "ItemBlock", "item", "configuration", "jIndex", "classNames", "ref", "videoRef", "content", "media", "theme", "size", "onlyOne", "isAutoPlay", "isPlaying", "setIsPlaying", "hasVideo", "m", "handlePlayButtonClick", "video", "observer", "entries", "entry", "error", "Media", "MediaTextOverlay", "React", "props", "data", "className", "rest", "items", "isShowPagination", "locale", "swiperRef", "swiperState", "setSwiperState", "breakpoints", "len", "id", "nextButtonClass", "prevButtonClass", "swiper", "prev"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var x=Object.create;var i=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,s=Object.prototype.hasOwnProperty;var v=(e,a)=>{for(var t in a)i(e,t,{get:a[t],enumerable:!0})},o=(e,a,t,d)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of l(a))!s.call(e,r)&&r!==t&&i(e,r,{get:()=>a[r],enumerable:!(d=y(a,r))||d.enumerable});return e};var M=(e,a,t)=>(t=e!=null?x(m(e)):{},o(a||!e||!e.__esModule?i(t,"default",{value:e,enumerable:!0}):t,e)),O=e=>o(i({},"__esModule",{value:!0}),e);var T={};v(T,{default:()=>p.default});module.exports=O(T);var p=M(require("./MediaTextOverlay.js"));
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/MediaTextOverlay/index.tsx"],
|
|
4
|
+
"sourcesContent": ["export { default } from './MediaTextOverlay.js'\nexport type {\n MediaTextOverlayProps,\n MediaTextOverlayData,\n MediaTextOverlayItem,\n MediaTextOverlaySemanticName,\n ResponsiveMedia,\n} from './types.js'\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wCAAAE,EAAAF,GAAA,IAAAG,EAAwB",
|
|
6
|
+
"names": ["MediaTextOverlay_exports", "__export", "__toCommonJS", "import_MediaTextOverlay"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { Media, Theme } from '../../types/props.js';
|
|
2
|
+
export type MediaTextOverlaySemanticName = 'root' | 'mediaContainer' | 'media' | 'overlay' | 'content' | 'playButton';
|
|
3
|
+
export interface ResponsiveMedia {
|
|
4
|
+
lgDesktop?: Media;
|
|
5
|
+
desktop?: Media;
|
|
6
|
+
laptop?: Media;
|
|
7
|
+
pad?: Media;
|
|
8
|
+
mobile?: Media;
|
|
9
|
+
}
|
|
10
|
+
export interface MediaTextOverlayItem {
|
|
11
|
+
content: string;
|
|
12
|
+
media: ResponsiveMedia;
|
|
13
|
+
}
|
|
14
|
+
export interface MediaTextOverlayData {
|
|
15
|
+
items: MediaTextOverlayItem[];
|
|
16
|
+
theme?: Theme;
|
|
17
|
+
size?: 'lg' | 'sm';
|
|
18
|
+
isShowPagination?: boolean;
|
|
19
|
+
isAutoPlay?: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface MediaTextOverlayProps extends React.HTMLAttributes<HTMLElement> {
|
|
22
|
+
data: MediaTextOverlayData;
|
|
23
|
+
classNames?: Partial<Record<MediaTextOverlaySemanticName, string>>;
|
|
24
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var n=Object.getOwnPropertyNames;var s=Object.prototype.hasOwnProperty;var p=(a,e,r,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of n(e))!s.call(a,t)&&t!==r&&o(a,t,{get:()=>e[t],enumerable:!(i=d(e,t))||i.enumerable});return a};var l=a=>p(o({},"__esModule",{value:!0}),a);var m={};module.exports=l(m);
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/MediaTextOverlay/types.ts"],
|
|
4
|
+
"sourcesContent": ["import type { Media, Theme } from '../../types/props.js'\n\nexport type MediaTextOverlaySemanticName = 'root' | 'mediaContainer' | 'media' | 'overlay' | 'content' | 'playButton'\n\nexport interface ResponsiveMedia {\n lgDesktop?: Media\n desktop?: Media\n laptop?: Media\n pad?: Media\n mobile?: Media\n}\n\nexport interface MediaTextOverlayItem {\n content: string\n media: ResponsiveMedia\n}\n\nexport interface MediaTextOverlayData {\n items: MediaTextOverlayItem[]\n theme?: Theme\n size?: 'lg' | 'sm'\n isShowPagination?: boolean\n isAutoPlay?: boolean\n}\n\nexport interface MediaTextOverlayProps extends React.HTMLAttributes<HTMLElement> {\n data: MediaTextOverlayData\n classNames?: Partial<Record<MediaTextOverlaySemanticName, string>>\n}\n"],
|
|
5
|
+
"mappings": "+WAAA,IAAAA,EAAA,kBAAAC,EAAAD",
|
|
6
|
+
"names": ["types_exports", "__toCommonJS"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var fe=Object.create;var T=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var ge=(t,
|
|
1
|
+
"use strict";"use client";var fe=Object.create;var T=Object.defineProperty;var pe=Object.getOwnPropertyDescriptor;var ue=Object.getOwnPropertyNames;var de=Object.getPrototypeOf,he=Object.prototype.hasOwnProperty;var ge=(t,s)=>{for(var i in s)T(t,i,{get:s[i],enumerable:!0})},A=(t,s,i,h)=>{if(s&&typeof s=="object"||typeof s=="function")for(let c of ue(s))!he.call(t,c)&&c!==i&&T(t,c,{get:()=>s[c],enumerable:!(h=pe(s,c))||h.enumerable});return t};var R=(t,s,i)=>(i=t!=null?fe(de(t)):{},A(s||!t||!t.__esModule?T(i,"default",{value:t,enumerable:!0}):i,t)),_e=t=>A(T({},"__esModule",{value:!0}),t);var ve={};ge(ve,{default:()=>Se});module.exports=_e(ve);var o=require("react/jsx-runtime"),n=R(require("react")),q=require("../../helpers/utils.js"),d=require("../../components/tabs.js"),O=R(require("../Title/index.js")),K=R(require("../SwiperBox/index.js")),Q=require("../../shared/Styles.js"),D=require("../../shared/track.js"),W=require("react-responsive"),Z=require("../../hooks/useRollout.js"),S=require("./shelfDisplayItem.js");const we="image",be="product_shelf",ye=t=>t==null?"default":String(t).replace(/[^a-zA-Z0-9_-]/g,"")||"default",Te=()=>`shelf-display-${Math.random().toString(36).slice(2,9)}`,$=n.default.forwardRef(({key:t,data:s,event:i,buildData:h,breakpoints:c,className:j="",recommendedData:p,target:F="_self",metafields:G,isDisplayGudgments:M=!1,isDisplayBackImage:J=!1,onAddCart:U,onBuyNow:X,onLearnMore:Y,...ee},te)=>{const{productsTab:m=[],productsCard:x=[],title:P,isShowTab:w=!0,tabShape:se="square",isShowTag:ne=!1,isShowOriginalPrice:ae=!0,isShowRecommendedCard:C=!1,...re}=s,[b,H]=(0,n.useState)(""),[f,v]=(0,n.useState)([]),L=(0,n.useRef)(!1),k=(0,n.useRef)(!1),V=(0,n.useRef)(null),ie=(0,n.useRef)(Te()),oe=(0,W.useMediaQuery)({query:"(max-width: 768px)"}),[le,B]=(0,Z.useRollout)({threshold:0}),y=f?.length<=1&&M,g=!oe&&f?.length<=2&&M,I=e=>{switch(e){case 1440:return g?f?.length:4;case 1024:return g?f?.length:3;default:return g?f?.length:2.3}},E=()=>{(0,D.gaTrack)({event:"ga4Event",event_name:"view_item_list",event_parameters:{page_group:"Home Page",item_list_name:"Home_Page_Bundle",items:p?.map((e,r)=>{const l=e?.variants?.find(a=>a?.sku===e?.sku)||e?.variants?.[0];return{item_id:e?.sku||l?.sku,item_name:e?.name,item_variant:l?.name,price:l?.price,index:r+1}})}})},_=(e,r)=>{if(r){const u=p?.map?.(l=>({...l,isShowRecommended:!0}));v(u?.length?u||[]:[])}else if(Array.isArray(e)){const l=e?.map?.(a=>{const z=h?.products?.find(me=>me?.handle===a?.handle);if(z)return{sku:a.sku,isShowRecommended:!1,custom_name:a.custom_name,custom_description:a.custom_description,custom_image:a.custom_image,custom_theme:a.custom_theme,custom_primary_link:a?.custom_primary_link||"",custom_secondary_link:a?.custom_secondary_link||"",custom_bg_image:a?.custom_bg_image||"",...z}})?.filter(a=>a);v(l?.length?l||[]:[])}else v([])};(0,n.useImperativeHandle)(te,()=>V.current),(0,n.useEffect)(()=>{B&&p?.length&&!L.current&&(L.current=!0,E())},[B,p]),(0,n.useEffect)(()=>{if(!k.current){if(!k.current&&p?.length&&(k.current=!0),w){const e=m?.find(r=>r?.tab===b)||m?.[0];H(e?.tab||""),_(e?.data||[],e?.isShowRecommendedTab);return}_(x,C)}},[p]),(0,n.useEffect)(()=>{if(w){const e=m?.find(r=>r?.tab===b)||m?.[0];_(e?.data||[],e?.isShowRecommendedTab);return}_(x,C)},[h]);const ce=ye(b),N=`${ie.current}-${ce}`;return(0,o.jsxs)("div",{ref:V,...ee,className:(0,q.cn)("shelf-display-wrap text-info-primary w-full",j,{"aiui-dark":s?.theme==="dark"}),children:[P&&(0,o.jsx)(O.default,{data:{title:P}}),w&&m?.length>0&&(0,o.jsx)(d.Tabs,{value:b,onValueChange:e=>{const r=m?.find(u=>u?.tab===e);if(r){if(H(e),_(r.data||[],r.isShowRecommendedTab),!r.isShowRecommendedTab){(0,D.gaTrack)({event:"ga4Event",event_name:"component_click",event_parameters:{page_group:"Home Page",component_type:we,component_name:be,component_title:s?.title,component_position:1,navigation:e}});return}E()}},shape:se==="rounded"?"rounded":"square",children:(0,o.jsx)(d.TabsList,{children:m.map(e=>(0,o.jsx)(d.TabsTrigger,{value:e?.tab,children:e?.tab||""},e?.id||e?.tab))})}),(0,o.jsx)("div",{ref:le,className:"tablet:min-h-[393px] laptop:min-h-[425px] desktop:min-h-[405px] lg-desktop:min-h-[409px]",children:(0,o.jsx)(K.default,{data:{list:f,configuration:{...re,event:i,isShowTag:ne,isShowOriginalPrice:ae,target:F,metafields:G,itemLength:f?.length,isDisplayBackImage:J,onAddCart:U,onBuyNow:X,onLearnMore:Y}},id:N,className:`${w?"mt-6":""} shelf-display-swiper-box !overflow-visible`,itemClassName:g?"flex-1":"",Slide:g?S.ShelfDisplayHorizontalItem:S.ShelfDisplayWrapItem,breakpoints:c||{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:y?1:1.2},768:{spaceBetween:y?0:16,freeMode:!1,slidesPerView:I()},1024:{spaceBetween:y?0:16,freeMode:!1,slidesPerView:I(1024)},1440:{spaceBetween:y?0:16,freeMode:!1,slidesPerView:I(1440)}}},N)})]})});$.displayName="ShelfDisplay";var Se=(0,Q.withLayout)($);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|