@anker-in/headless-ui 1.1.28 → 1.1.30
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/BrandCardLink/BrandCardLink.d.ts +6 -0
- package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js +2 -0
- package/dist/cjs/biz-components/BrandCardLink/BrandCardLink.js.map +7 -0
- package/dist/cjs/biz-components/BrandCardLink/index.d.ts +1 -0
- package/dist/cjs/biz-components/BrandCardLink/index.js +2 -0
- package/dist/cjs/biz-components/BrandCardLink/index.js.map +7 -0
- package/dist/cjs/biz-components/BrandCardLink/types.d.ts +19 -0
- package/dist/cjs/biz-components/BrandCardLink/types.js +2 -0
- package/dist/cjs/biz-components/BrandCardLink/types.js.map +7 -0
- package/dist/cjs/biz-components/Evaluate/index.js +1 -1
- package/dist/cjs/biz-components/Evaluate/index.js.map +2 -2
- package/dist/cjs/biz-components/Graphic/index.js +1 -1
- package/dist/cjs/biz-components/Graphic/index.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +25 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileMenuComponents.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileMulticolMenu.d.ts +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileMulticolMenu.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileMulticolMenu.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.d.ts +9 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.d.ts +9 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileSidebarMenu.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.d.ts +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/MobileSupportMenu.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.d.ts +15 -0
- package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/MulticolDropdown.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/NavProvider.d.ts +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/NavProvider.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/NavProvider.js.map +3 -3
- package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.d.ts +20 -0
- package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/ResourceItem.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.d.ts +9 -0
- package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/ResourceSidebarDropdown.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.d.ts +18 -0
- package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.d.ts +9 -0
- package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.js +2 -0
- package/dist/cjs/biz-components/HeaderNavigation/SupportsDropdown.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/index.js.map +3 -3
- package/dist/cjs/biz-components/HeaderNavigation/types.d.ts +2 -1
- package/dist/cjs/biz-components/HeaderNavigation/types.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/types.js.map +2 -2
- package/dist/cjs/biz-components/HeaderNavigation/withCategory.d.ts +1 -0
- package/dist/cjs/biz-components/HeaderNavigation/withCategory.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/withCategory.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 +4 -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/ImageTextFeature/types.d.ts +1 -0
- package/dist/cjs/biz-components/ImageTextFeature/types.js +1 -1
- package/dist/cjs/biz-components/ImageTextFeature/types.js.map +1 -1
- package/dist/cjs/biz-components/SearchPage/index.js +1 -1
- package/dist/cjs/biz-components/SearchPage/index.js.map +2 -2
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js +4 -4
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/cjs/biz-components/Tabs/Tabs.js +1 -1
- package/dist/cjs/biz-components/Tabs/Tabs.js.map +3 -3
- package/dist/cjs/biz-components/Tabs/types.d.ts +9 -0
- package/dist/cjs/biz-components/Tabs/types.js +1 -1
- package/dist/cjs/biz-components/Tabs/types.js.map +1 -1
- 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/BrandCardLink/BrandCardLink.d.ts +6 -0
- package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js +2 -0
- package/dist/esm/biz-components/BrandCardLink/BrandCardLink.js.map +7 -0
- package/dist/esm/biz-components/BrandCardLink/index.d.ts +1 -0
- package/dist/esm/biz-components/BrandCardLink/index.js +2 -0
- package/dist/esm/biz-components/BrandCardLink/index.js.map +7 -0
- package/dist/esm/biz-components/BrandCardLink/types.d.ts +19 -0
- package/dist/esm/biz-components/BrandCardLink/types.js +1 -0
- package/dist/esm/biz-components/BrandCardLink/types.js.map +7 -0
- package/dist/esm/biz-components/Evaluate/index.js +1 -1
- package/dist/esm/biz-components/Evaluate/index.js.map +2 -2
- package/dist/esm/biz-components/Graphic/index.js +1 -1
- package/dist/esm/biz-components/Graphic/index.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.d.ts +25 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileMenuComponents.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileMulticolMenu.d.ts +7 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileMulticolMenu.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileMulticolMenu.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.d.ts +9 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileResourceSidebarMenu.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.d.ts +9 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileSidebarMenu.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.d.ts +7 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/MobileSupportMenu.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.d.ts +15 -0
- package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/MulticolDropdown.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/NavProvider.d.ts +2 -0
- package/dist/esm/biz-components/HeaderNavigation/NavProvider.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/NavProvider.js.map +3 -3
- package/dist/esm/biz-components/HeaderNavigation/ResourceItem.d.ts +20 -0
- package/dist/esm/biz-components/HeaderNavigation/ResourceItem.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/ResourceItem.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.d.ts +9 -0
- package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/ResourceSidebarDropdown.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.d.ts +18 -0
- package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.d.ts +9 -0
- package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.js +2 -0
- package/dist/esm/biz-components/HeaderNavigation/SupportsDropdown.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/index.js.map +3 -3
- package/dist/esm/biz-components/HeaderNavigation/types.d.ts +2 -1
- package/dist/esm/biz-components/HeaderNavigation/types.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/types.js.map +2 -2
- package/dist/esm/biz-components/HeaderNavigation/withCategory.d.ts +1 -0
- package/dist/esm/biz-components/HeaderNavigation/withCategory.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/withCategory.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 +4 -0
- package/dist/esm/biz-components/ImageTextFeature/types.d.ts +1 -0
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/biz-components/SearchPage/index.js.map +2 -2
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js +5 -5
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplayItem.js.map +3 -3
- package/dist/esm/biz-components/Tabs/Tabs.js +1 -1
- package/dist/esm/biz-components/Tabs/Tabs.js.map +3 -3
- package/dist/esm/biz-components/Tabs/types.d.ts +9 -0
- 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
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { BrandCardLinkProps } from './types.js';
|
|
2
|
+
declare const _default: import("react").ForwardRefExoticComponent<Omit<Omit<BrandCardLinkProps & import("react").RefAttributes<HTMLDivElement>, keyof import("../../shared/Styles.js").StylesProps> & Partial<import("../../shared/Styles.js").StylesProps & import("../../shared/Styles.js").ContainerProps> & {
|
|
3
|
+
className?: string;
|
|
4
|
+
data?: Record<string, any>;
|
|
5
|
+
}, "ref"> & import("react").RefAttributes<any>>;
|
|
6
|
+
export default _default;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var T=Object.create;var m=Object.defineProperty;var A=Object.getOwnPropertyDescriptor;var E=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,P=Object.prototype.hasOwnProperty;var j=(e,i)=>{for(var r in i)m(e,r,{get:i[r],enumerable:!0})},g=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of E(i))!P.call(e,n)&&n!==r&&m(e,n,{get:()=>i[n],enumerable:!(s=A(i,n))||s.enumerable});return e};var h=(e,i,r)=>(r=e!=null?T(I(e)):{},g(i||!e||!e.__esModule?m(r,"default",{value:e,enumerable:!0}):r,e)),D=e=>g(m({},"__esModule",{value:!0}),e);var F={};j(F,{default:()=>z});module.exports=D(F);var t=require("react/jsx-runtime"),o=require("react"),a=require("../../helpers/utils.js"),b=h(require("../../components/picture.js")),y=require("../../shared/Styles.js"),N=require("react-responsive"),L=require("../../hooks/useExposure.js"),c=require("swiper/react"),l=require("swiper/modules"),W=require("../Title/index.js"),M=h(require("../../components/link.js"));const H="copy",q="store_benefits",R=(e,i)=>{const r=[];for(let s=0;s<e.length;s+=i)r.push(e.slice(s,s+i));return r},v=(0,o.forwardRef)(({data:{items:e=[],itemShape:i},className:r},s)=>{const[n,S]=(0,o.useState)(!1),f=(0,N.useMediaQuery)({query:"(max-width: 768px)"}),x=(0,o.useRef)(null),u=(0,o.useRef)(null);(0,o.useImperativeHandle)(s,()=>u.current),(0,L.useExposure)(u,{componentType:H,componentName:q}),(0,o.useEffect)(()=>{S(f)},[f]);const B=n?R(e,3):e;return(0,t.jsx)("div",{ref:u,className:(0,a.cn)("brand-equity-wrapper w-full",r),children:n?(0,t.jsxs)(c.Swiper,{className:(0,a.cn)(r),modules:[l.FreeMode,l.Mousewheel,l.Pagination],freeMode:!0,mousewheel:{forceToAxis:!0},pagination:{clickable:!0,el:x.current},breakpoints:{0:{spaceBetween:12}},children:[B?.map((p,d)=>(0,t.jsx)(c.SwiperSlide,{className:"!flex flex-col gap-3",children:Array.isArray(p)&&p?.map((C,k)=>(0,t.jsx)(w,{data:C,itemShape:i,index:k},k))},"SwiperSlide"+d)),(0,t.jsx)("div",{ref:x,className:"mt-3 flex justify-center"})]}):(0,t.jsx)("div",{className:(0,a.cn)("laptop:gap-4 tablet:grid-cols-2 laptop:grid-cols-4 grid grid-cols-1 gap-3"),children:e.map((p,d)=>(0,t.jsx)(w,{data:p,itemShape:i,index:d},d))})})}),w=({data:e,itemShape:i,index:r})=>(0,t.jsxs)("div",{className:(0,a.cn)("brand-equity-item","lg-desktop:p-8 desktop:p-6 p-4","laptop:h-[192px] lg-desktop:h-[240px] h-[160px]","box-border flex w-full flex-col justify-between overflow-hidden bg-[#DAE7F2]",i==="round"?"rounded-box":"rounded-none"),children:[(0,t.jsxs)("div",{className:"lg-desktop:h-[50px] flex h-10 items-center justify-between gap-3",children:[(0,t.jsx)("h3",{className:"link-item-title lg-desktop:text-[18px] desktop:text-[16px] line-clamp-2 flex-1 text-[14px] font-bold leading-[1.2] tracking-[-0.02em] text-[#080A0F]",children:e.title}),(0,t.jsx)("div",{className:"link-item-img lg-desktop:size-[36px] size-[30px] shrink-0",children:(0,t.jsx)(b.default,{className:"size-full object-cover",source:e.icon?.url,alt:e.icon?.alt,imgClassName:"w-full h-full object-cover"})})]}),(0,t.jsxs)("div",{className:"box-border overflow-hidden",children:[(0,t.jsx)("p",{title:e.description||"",className:"link-item-description lg-desktop:text-[24px] line-clamp-2 text-[20px] font-semibold leading-[1.2] tracking-[-0.04em] text-[#767880]",children:e.description||""}),(0,t.jsxs)(M.default,{href:e?.link,asChild:!e?.link,className:"desktop:mt-4 mt-2 flex items-center gap-0.5 no-underline hover:underline",children:[(0,t.jsx)("span",{className:"link-item-text laptop:text-base text-sm",children:e?.linkText}),(0,t.jsx)("div",{className:"size-6",children:(0,t.jsx)("svg",{width:"24",height:"24",className:"mb-[3px]",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",children:(0,t.jsx)("path",{className:"transition-all duration-[0.4s]",d:"M10.5 8L14.5 12L10.5 16",stroke:"#777",strokeWidth:"1.5",strokeLinecap:"round"})})})]})]})]});v.displayName="BrandCardLink";var z=(0,y.withLayout)(v);
|
|
2
|
+
//# sourceMappingURL=BrandCardLink.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/BrandCardLink/BrandCardLink.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\nimport { forwardRef, useEffect, useRef, useState, useImperativeHandle } from 'react'\n\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { BrandCardLinkProps, BrandCardLinkItemProps } from './types.js'\n\nimport type { Img } from '../../types/props.js'\nimport { useMediaQuery } from 'react-responsive'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Pagination, FreeMode, Mousewheel } from 'swiper/modules'\nimport Title from '../Title/index.js'\nimport Link from '../../components/link.js'\n\nconst componentType = 'copy'\nconst componentName = 'store_benefits'\n\nconst chunkArray = (arr: BrandCardLinkItemProps[], size: number) => {\n const chunks = []\n for (let i = 0; i < arr.length; i += size) {\n chunks.push(arr.slice(i, i + size))\n }\n return chunks\n}\n\nconst BrandCardLink = forwardRef<HTMLDivElement, BrandCardLinkProps>(\n ({ data: { items = [], itemShape }, className }, ref) => {\n const [isMobile, setIsMobile] = useState(false)\n const mediaQuery = useMediaQuery({ query: '(max-width: 768px)' })\n const paginationRef = useRef<HTMLDivElement>(null)\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n useExposure(innerRef, {\n componentType,\n componentName,\n })\n\n useEffect(() => {\n setIsMobile(mediaQuery)\n }, [mediaQuery])\n\n const itemsArray = isMobile ? chunkArray(items, 3) : items\n return (\n <div ref={innerRef} className={cn('brand-equity-wrapper w-full', className)}>\n {isMobile ? (\n <Swiper\n className={cn(className)}\n modules={[FreeMode, Mousewheel, Pagination]}\n freeMode={true}\n mousewheel={{\n forceToAxis: true,\n }}\n pagination={{\n clickable: true,\n el: paginationRef.current,\n }}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n },\n }}\n >\n {itemsArray?.map((item, jIndex) => (\n <SwiperSlide key={'SwiperSlide' + jIndex} className=\"!flex flex-col gap-3\">\n {Array.isArray(item) &&\n item?.map((item, index) => (\n <BrandCardLinkItem key={index} data={item} itemShape={itemShape} index={index} />\n ))}\n </SwiperSlide>\n ))}\n <div ref={paginationRef} className=\"mt-3 flex justify-center\"></div>\n </Swiper>\n ) : (\n <div className={cn('laptop:gap-4 tablet:grid-cols-2 laptop:grid-cols-4 grid grid-cols-1 gap-3')}>\n {items.map((item, index) => (\n <BrandCardLinkItem key={index} data={item} itemShape={itemShape} index={index} />\n ))}\n </div>\n )}\n </div>\n )\n }\n)\n\nconst BrandCardLinkItem = ({\n data,\n itemShape,\n index,\n}: {\n data: BrandCardLinkItemProps\n itemShape?: 'round' | 'square'\n index: number\n}) => {\n return (\n <div\n className={cn(\n 'brand-equity-item',\n 'lg-desktop:p-8 desktop:p-6 p-4',\n 'laptop:h-[192px] lg-desktop:h-[240px] h-[160px]',\n 'box-border flex w-full flex-col justify-between overflow-hidden bg-[#DAE7F2]',\n itemShape === 'round' ? 'rounded-box' : 'rounded-none'\n )}\n >\n <div className=\"lg-desktop:h-[50px] flex h-10 items-center justify-between gap-3\">\n <h3 className=\"link-item-title lg-desktop:text-[18px] desktop:text-[16px] line-clamp-2 flex-1 text-[14px] font-bold leading-[1.2] tracking-[-0.02em] text-[#080A0F]\">\n {data.title}\n </h3>\n <div className=\"link-item-img lg-desktop:size-[36px] size-[30px] shrink-0\">\n <Picture\n className=\"size-full object-cover\"\n source={data.icon?.url}\n alt={data.icon?.alt}\n imgClassName=\"w-full h-full object-cover\"\n />\n </div>\n </div>\n <div className=\"box-border overflow-hidden\">\n <p\n title={data.description || ''}\n className=\"link-item-description lg-desktop:text-[24px] line-clamp-2 text-[20px] font-semibold leading-[1.2] tracking-[-0.04em] text-[#767880]\"\n >\n {data.description || ''}\n </p>\n <Link\n href={data?.link}\n asChild={!data?.link}\n className=\"desktop:mt-4 mt-2 flex items-center gap-0.5 no-underline hover:underline\"\n >\n <span className=\"link-item-text laptop:text-base text-sm\">{data?.linkText}</span>\n <div className=\"size-6\">\n <svg\n width=\"24\"\n height=\"24\"\n className=\"mb-[3px]\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n >\n <path\n className=\"transition-all duration-[0.4s]\"\n d=\"M10.5 8L14.5 12L10.5 16\"\n stroke=\"#777\"\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n ></path>\n </svg>\n </div>\n </Link>\n </div>\n </div>\n )\n}\n\nBrandCardLink.displayName = 'BrandCardLink'\n\nexport default withLayout(BrandCardLink)\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgDU,IAAAI,EAAA,6BA/CVC,EAA6E,iBAE7EC,EAAmB,kCACnBC,EAAoB,0CACpBC,EAA2B,kCAI3BC,EAA8B,4BAC9BC,EAA4B,sCAE5BL,EAAoC,wBACpCM,EAAiD,0BACjDC,EAAkB,6BAClBC,EAAiB,uCAEjB,MAAMC,EAAgB,OAChBC,EAAgB,iBAEhBC,EAAa,CAACC,EAA+BC,IAAiB,CAClE,MAAMC,EAAS,CAAC,EAChB,QAASC,EAAI,EAAGA,EAAIH,EAAI,OAAQG,GAAKF,EACnCC,EAAO,KAAKF,EAAI,MAAMG,EAAGA,EAAIF,CAAI,CAAC,EAEpC,OAAOC,CACT,EAEME,KAAgB,cACpB,CAAC,CAAE,KAAM,CAAE,MAAAC,EAAQ,CAAC,EAAG,UAAAC,CAAU,EAAG,UAAAC,CAAU,EAAGC,IAAQ,CACvD,KAAM,CAACC,EAAUC,CAAW,KAAI,YAAS,EAAK,EACxCC,KAAa,iBAAc,CAAE,MAAO,oBAAqB,CAAC,EAC1DC,KAAgB,UAAuB,IAAI,EAC3CC,KAAW,UAAuB,IAAI,KAC5C,uBAAoBL,EAAK,IAAMK,EAAS,OAAyB,KACjE,eAAYA,EAAU,CACpB,cAAAhB,EACA,cAAAC,CACF,CAAC,KAED,aAAU,IAAM,CACdY,EAAYC,CAAU,CACxB,EAAG,CAACA,CAAU,CAAC,EAEf,MAAMG,EAAaL,EAAWV,EAAWM,EAAO,CAAC,EAAIA,EACrD,SACE,OAAC,OAAI,IAAKQ,EAAU,aAAW,MAAG,8BAA+BN,CAAS,EACvE,SAAAE,KACC,QAAC,UACC,aAAW,MAAGF,CAAS,EACvB,QAAS,CAAC,W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AC,OACC,MAAM,KACN,OAAO,KACP,UAAU,WACV,MAAM,6BACN,QAAQ,YACR,KAAK,OAEL,mBAAC,QACC,UAAU,iCACV,EAAE,0BACF,OAAO,OACP,YAAY,MACZ,cAAc,QACf,EACH,EACF,GACF,GACF,GACF,EAIJf,EAAc,YAAc,gBAE5B,IAAOnB,KAAQ,cAAWmB,CAAa",
|
|
6
|
+
"names": ["BrandCardLink_exports", "__export", "BrandCardLink_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_picture", "import_Styles", "import_react_responsive", "import_useExposure", "import_modules", "import_Title", "import_link", "componentType", "componentName", "chunkArray", "arr", "size", "chunks", "i", "BrandCardLink", "items", "itemShape", "className", "ref", "isMobile", "setIsMobile", "mediaQuery", "paginationRef", "innerRef", "itemsArray", "item", "jIndex", "index", "BrandCardLinkItem", "data", "Picture", "Link"]
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { default } from './BrandCardLink.js';
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var m=Object.create;var t=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var x=Object.getPrototypeOf,b=Object.prototype.hasOwnProperty;var c=(e,f)=>{for(var o in f)t(e,o,{get:f[o],enumerable:!0})},d=(e,f,o,a)=>{if(f&&typeof f=="object"||typeof f=="function")for(let r of u(f))!b.call(e,r)&&r!==o&&t(e,r,{get:()=>f[r],enumerable:!(a=p(f,r))||a.enumerable});return e};var g=(e,f,o)=>(o=e!=null?m(x(e)):{},d(f||!e||!e.__esModule?t(o,"default",{value:e,enumerable:!0}):o,e)),h=e=>d(t({},"__esModule",{value:!0}),e);var i={};c(i,{default:()=>l.default});module.exports=h(i);var l=g(require("./BrandCardLink.js"));
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/BrandCardLink/index.ts"],
|
|
4
|
+
"sourcesContent": ["export { default } from './BrandCardLink.js'\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wCAAAE,EAAAF,GAAA,IAAAG,EAAwB",
|
|
6
|
+
"names": ["BrandCardLink_exports", "__export", "__toCommonJS", "import_BrandCardLink"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { ComponentCommonProps, Img } from '../../types/props.js';
|
|
2
|
+
export interface BrandCardLinkItemProps {
|
|
3
|
+
icon?: Img;
|
|
4
|
+
type?: 'icon' | 'avatar';
|
|
5
|
+
title: string;
|
|
6
|
+
description: string;
|
|
7
|
+
avatarList?: {
|
|
8
|
+
avatar: Img;
|
|
9
|
+
}[];
|
|
10
|
+
link: string;
|
|
11
|
+
linkText: string;
|
|
12
|
+
}
|
|
13
|
+
export interface BrandCardLinkProps extends ComponentCommonProps {
|
|
14
|
+
data: {
|
|
15
|
+
items: BrandCardLinkItemProps[];
|
|
16
|
+
itemShape?: 'round' | 'square';
|
|
17
|
+
};
|
|
18
|
+
className?: string;
|
|
19
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var e=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var s=Object.getOwnPropertyNames;var p=Object.prototype.hasOwnProperty;var m=(t,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let n of s(r))!p.call(t,n)&&n!==o&&e(t,n,{get:()=>r[n],enumerable:!(a=i(r,n))||a.enumerable});return t};var d=t=>m(e({},"__esModule",{value:!0}),t);var g={};module.exports=d(g);
|
|
2
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/BrandCardLink/types.ts"],
|
|
4
|
+
"sourcesContent": ["import type { ComponentCommonProps, Img } from '../../types/props.js'\n\nexport interface BrandCardLinkItemProps {\n icon?: Img\n type?: 'icon' | 'avatar'\n title: string\n description: string\n avatarList?: {\n avatar: Img\n }[]\n link: string\n linkText: string\n}\n\nexport interface BrandCardLinkProps extends ComponentCommonProps {\n data: {\n items: BrandCardLinkItemProps[]\n itemShape?: 'round' | 'square'\n }\n className?: 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 T=Object.create;var m=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var z=(e,s)=>{for(var
|
|
1
|
+
"use strict";"use client";var T=Object.create;var m=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var P=Object.getOwnPropertyNames;var B=Object.getPrototypeOf,I=Object.prototype.hasOwnProperty;var z=(e,s)=>{for(var i in s)m(e,i,{get:s[i],enumerable:!0})},x=(e,s,i,o)=>{if(s&&typeof s=="object"||typeof s=="function")for(let r of P(s))!I.call(e,r)&&r!==i&&m(e,r,{get:()=>s[r],enumerable:!(o=M(s,r))||o.enumerable});return e};var d=(e,s,i)=>(i=e!=null?T(B(e)):{},x(s||!e||!e.__esModule?m(i,"default",{value:e,enumerable:!0}):i,e)),A=e=>x(m({},"__esModule",{value:!0}),e);var R={};z(R,{default:()=>$});module.exports=A(R);var t=require("react/jsx-runtime"),a=d(require("react")),h=d(require("../Title/index.js")),n=require("../../helpers/utils.js"),b=d(require("../../components/picture.js")),g=d(require("../SwiperBox/index.js")),k=require("../../shared/Styles.js"),p=require("../../components/avatar.js"),N=require("../../components/container.js"),y=require("../../components/text.js"),C=require("../../hooks/useExposure.js"),L=require("../../shared/trackUrlRef.js");const v="copy",u="product_review",F=({data:e,configuration:s})=>{const i=(0,a.useRef)(null),o=r=>{const l=Number(r),c=Number.isFinite(l)?Math.max(0,Math.floor(l)):0;return Array.from({length:c})||[]};return(0,C.useExposure)(i,{componentType:v,componentName:u,componentTitle:e?.title,componentDescription:e?.description,position:s?.index+1}),(0,t.jsx)("div",{ref:i,className:(0,n.cn)("bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full overflow-hidden duration-300",s?.shape==="round"?"rounded-2xl":"rounded-none","lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]","laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative","md-tablet:h-[360px]"),children:(0,t.jsxs)("div",{className:"desktop:p-6 absolute inset-0 box-border flex flex-col overflow-hidden p-4",children:[(0,t.jsxs)("div",{className:(0,n.cn)("lg-desktop:mb-16 desktop:mb-10 mb-8 flex w-full justify-between"),children:[(0,t.jsxs)("div",{className:"flex-1",children:[e?.title?(0,t.jsx)("h4",{className:"laptop:text-lg text-sm font-bold",children:e?.title}):null,(0,t.jsx)("div",{className:"mt-1 flex items-center",children:o(e?.rating)?.map?.((r,l)=>(0,t.jsx)("div",{className:"mr-1",children:(0,t.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,t.jsx)("path",{d:"M7.32745 1.36274C7.60256 0.805304 8.39744 0.805305 8.67255 1.36274L10.1766 4.41035C10.2859 4.63171 10.4971 4.78514 10.7413 4.82063L14.1046 5.30934C14.7197 5.39873 14.9654 6.15471 14.5202 6.58861L12.0866 8.96084C11.9098 9.13315 11.8292 9.3814 11.8709 9.62469L12.4454 12.9743C12.5505 13.587 11.9074 14.0542 11.3572 13.765L8.349 12.1835C8.13051 12.0686 7.86949 12.0686 7.65099 12.1835L4.64282 13.765C4.0926 14.0542 3.44953 13.587 3.55461 12.9743L4.12912 9.62469C4.17085 9.3814 4.09019 9.13315 3.91342 8.96084L1.47976 6.58861C1.03462 6.15471 1.28025 5.39873 1.89542 5.30934L5.25866 4.82063C5.50294 4.78514 5.71412 4.63171 5.82336 4.41035L7.32745 1.36274Z",fill:"#F77234"})})},l))})]}),(0,t.jsx)("div",{className:"desktop:size-12 size-10 overflow-hidden",children:e?.avatar?.url?(0,t.jsxs)(p.Avatar,{className:"size-full",isAdaptation:!e?.avatar?.url,children:[(0,t.jsx)(p.AvatarImage,{src:e?.avatar?.url}),(0,t.jsx)(p.AvatarFallback,{children:e?.title})]}):null})]}),(0,t.jsx)("div",{className:"flex-1",title:e?.description||"",children:(0,t.jsx)(y.Text,{className:(0,n.cn)("lg-desktop:text-2xl text-info-primary evaluate-description line-clamp-5 break-words text-xl font-bold leading-[1.2]"),children:e?.description||""})}),(0,t.jsx)("a",{href:(0,L.trackUrlRef)(e?.link,`${v}_${u}`),onClick:()=>{s?.event?.primaryButton(e,s?.index+1)},"data-headless-type-name":`${v}#${u}`,"data-headless-title-desc-button":`${e?.title}#${e?.description||e?.subTitle}`,"data-headless-nav-postion":`''#${s?.index+1}`,children:(0,t.jsxs)("div",{className:(0,n.cn)("mt-3 flex cursor-pointer items-center overflow-hidden bg-[#F7F8F9] p-3",s?.shape==="round"?"rounded-lg":"rounded-none"),children:[(0,t.jsx)("div",{className:"laptop:size-16 desktop:size-20 mr-3 flex size-12 items-center",children:(0,t.jsx)(b.default,{className:"w-full object-cover",source:e?.img?.url,alt:e?.img?.alt||""})}),(0,t.jsx)("p",{className:"lg-desktop:text-[18px] desktop-[16px] line-clamp-2 flex-1 text-[14px] font-bold tracking-[-0.04em]",children:e?.subTitle||""})]})})]})})},w=a.default.forwardRef(({className:e="",data:s,key:i},o)=>{const{products:r,title:l,theme:c,...E}=s,f=(0,a.useRef)(null);return(0,a.useImperativeHandle)(o,()=>f.current),(0,t.jsx)("div",{className:e,ref:f,children:(0,t.jsx)("div",{className:"evaluate-box relative z-10",children:(0,t.jsx)(N.Container,{...s?.containerProps||{},className:"overflow-hidden",children:(0,t.jsxs)("div",{ref:o,className:(0,n.cn)("w-full",e,{"aiui-dark":c==="dark"}),children:[l&&(0,t.jsx)(h.default,{data:{title:l}}),(0,t.jsx)(g.default,{className:"!overflow-visible",id:"Evaluate"+i,data:{list:r,configuration:{...E,title:l}},Slide:F,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:1.2},768:{spaceBetween:16,freeMode:!1,slidesPerView:2.3},1024:{spaceBetween:16,freeMode:!1,slidesPerView:3},1440:{spaceBetween:16,freeMode:!1,slidesPerView:4}}})]})})})})});w.displayName="Evaluate";var $=(0,k.withLayout)(w);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Evaluate/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport Title from '../Title/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Avatar, AvatarImage, AvatarFallback } from '../../components/avatar.js'\nimport { Container } from '../../components/container.js'\nimport { Text } from '../../components/text.js'\nimport type { ContainerProps, Theme } from '../../types/props.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\n\nconst componentType = 'copy'\nconst componentName = 'product_review'\n\nexport interface EvaluateItem {\n /** \u4EA7\u54C1\u56FE\u7247*/\n img: Img\n title: string\n subTitle: string\n description: string\n avatar?: {\n url: string\n }\n rating: number\n link?: string\n}\n\nexport interface EvaluateProps {\n className?: string\n data: {\n title?: string\n products: EvaluateItem[]\n /** \u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u4E3B\u9898\u8272*/\n theme?: Theme\n containerProps?: ContainerProps\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (_v: any, _index: number) => void\n }\n key?: string\n}\n\nconst EvaluateItem = ({ data, configuration }: { data: EvaluateItem; configuration?: any }) => {\n const ref = useRef<HTMLDivElement>(null)\n const handleRating = (num: number) => {\n const raw = Number(num)\n const count = Number.isFinite(raw) ? Math.max(0, Math.floor(raw)) : 0\n return Array.from({ length: count }) || []\n }\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.title,\n componentDescription: data?.description,\n position: configuration?.index + 1,\n })\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full overflow-hidden duration-300',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]',\n 'laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative',\n 'md-tablet:h-[360px]'\n )}\n >\n <div className=\"desktop:p-6 absolute inset-0 box-border flex flex-col overflow-hidden p-4\">\n <div className={cn('lg-desktop:mb-16 desktop:mb-10 mb-8 flex w-full justify-between')}>\n <div className=\"flex-1\">\n {data?.title ? <h4 className=\"laptop:text-lg text-sm font-bold\">{data?.title}</h4> : null}\n <div className=\"mt-1 flex items-center\">\n {handleRating(data?.rating)?.map?.((_, index) => {\n return (\n <div key={index} className=\"mr-1\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M7.32745 1.36274C7.60256 0.805304 8.39744 0.805305 8.67255 1.36274L10.1766 4.41035C10.2859 4.63171 10.4971 4.78514 10.7413 4.82063L14.1046 5.30934C14.7197 5.39873 14.9654 6.15471 14.5202 6.58861L12.0866 8.96084C11.9098 9.13315 11.8292 9.3814 11.8709 9.62469L12.4454 12.9743C12.5505 13.587 11.9074 14.0542 11.3572 13.765L8.349 12.1835C8.13051 12.0686 7.86949 12.0686 7.65099 12.1835L4.64282 13.765C4.0926 14.0542 3.44953 13.587 3.55461 12.9743L4.12912 9.62469C4.17085 9.3814 4.09019 9.13315 3.91342 8.96084L1.47976 6.58861C1.03462 6.15471 1.28025 5.39873 1.89542 5.30934L5.25866 4.82063C5.50294 4.78514 5.71412 4.63171 5.82336 4.41035L7.32745 1.36274Z\"\n fill=\"#F77234\"\n />\n </svg>\n </div>\n )\n })}\n </div>\n </div>\n <div className=\"desktop:size-12 size-10 overflow-hidden\">\n {data?.avatar?.url ? (\n <Avatar className=\"size-full\" isAdaptation={!data?.avatar?.url}>\n <AvatarImage src={data?.avatar?.url} />\n <AvatarFallback>{data?.title}</AvatarFallback>\n </Avatar>\n ) : null}\n </div>\n </div>\n <div className=\"flex-1\">\n <Text\n className={cn(\n 'lg-desktop:text-2xl text-info-primary evaluate-description line-clamp-5 break-words text-xl font-bold leading-[1.2]'\n )}\n >\n {data?.description || ''}\n </Text>\n </div>\n <a\n href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}\n onClick={() => {\n configuration?.event?.primaryButton(data, configuration?.index + 1)\n }}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}#${data?.description || data?.subTitle}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n >\n <div\n className={cn(\n 'mt-3 flex cursor-pointer items-center overflow-hidden bg-[#F7F8F9] p-3',\n configuration?.shape === 'round' ? 'rounded-lg' : 'rounded-none'\n )}\n >\n <div className=\"laptop:size-16 desktop:size-20 mr-3 flex size-12 items-center\">\n <Picture className=\"w-full object-cover\" source={data?.img?.url} alt={data?.img?.alt || ''} />\n </div>\n <p className=\"lg-desktop:text-[18px] desktop-[16px] line-clamp-2 flex-1 text-[14px] font-bold tracking-[-0.04em]\">\n {data?.subTitle || ''}\n </p>\n </div>\n </a>\n </div>\n </div>\n )\n}\n\nconst Evaluate = React.forwardRef<HTMLDivElement, EvaluateProps>(({ className = '', data, key }, ref) => {\n const { products, title, theme, ...ohter } = data\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n return (\n <div className={className} ref={innerRef}>\n <div className=\"evaluate-box relative z-10\">\n <Container {...(data?.containerProps || {})} className=\"overflow-hidden\">\n <div ref={ref} className={cn('w-full', className, { 'aiui-dark': theme === 'dark' })}>\n {title && <Title data={{ title: title }} />}\n <SwiperBox\n className=\"!overflow-visible\"\n id={'Evaluate' + key}\n data={{ list: products, configuration: { ...ohter, title: title } }}\n Slide={EvaluateItem}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1.2,\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 2.3,\n },\n 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 3,\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n </div>\n </Container>\n </div>\n </div>\n )\n})\n\nEvaluate.displayName = 'Evaluate'\n\nexport default withLayout(Evaluate)\n"],
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA8EU,IAAAI,EAAA,6BA7EVC,EAAmD,oBACnDC,EAAkB,gCAClBC,EAAmB,kCACnBC,EAAoB,0CACpBC,EAAsB,oCACtBC,EAA2B,kCAC3BC,EAAoD,sCACpDC,EAA0B,yCAC1BC,EAAqB,oCAErBC,EAA4B,sCAC5BC,EAA4B,uCAG5B,MAAMC,EAAgB,OAChBC,EAAgB,iBAiChBC,EAAe,CAAC,CAAE,KAAAC,EAAM,cAAAC,CAAc,IAAmD,CAC7F,MAAMC,KAAM,UAAuB,IAAI,EACjCC,EAAgBC,GAAgB,CACpC,MAAMC,EAAM,OAAOD,CAAG,EAChBE,EAAQ,OAAO,SAASD,CAAG,EAAI,KAAK,IAAI,EAAG,KAAK,MAAMA,CAAG,CAAC,EAAI,EACpE,OAAO,MAAM,KAAK,CAAE,OAAQC,CAAM,CAAC,GAAK,CAAC,CAC3C,EAEA,wBAAYJ,EAAK,CACf,cAAAL,EACA,cAAAC,EACA,eAAgBE,GAAM,MACtB,qBAAsBA,GAAM,YAC5B,SAAUC,GAAe,MAAQ,CACnC,CAAC,KAGC,OAAC,OACC,IAAKC,EACL,aAAW,MACT,qGACAD,GAAe,QAAU,QAAU,cAAgB,eACnD,oGACA,qFACA,qBACF,EAEA,oBAAC,OAAI,UAAU,4EACb,qBAAC,OAAI,aAAW,MAAG,iEAAiE,EAClF,qBAAC,OAAI,UAAU,SACZ,UAAAD,GAAM,SAAQ,OAAC,MAAG,UAAU,mCAAoC,SAAAA,GAAM,MAAM,EAAQ,QACrF,OAAC,OAAI,UAAU,yBACZ,SAAAG,EAAaH,GAAM,MAAM,GAAG,MAAM,CAACO,EAAGC,OAEnC,OAAC,OAAgB,UAAU,OACzB,mBAAC,OAAI,MAAM,6BAA6B,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OACtF,mBAAC,QACC,EAAE,6oBACF,KAAK,UACP,EACF,GANQA,CAOV,CAEH,EACH,GACF,KACA,OAAC,OAAI,UAAU,0CACZ,SAAAR,GAAM,QAAQ,OACb,QAAC,UAAO,UAAU,YAAY,aAAc,CAACA,GAAM,QAAQ,IACzD,oBAAC,eAAY,IAAKA,GAAM,QAAQ,IAAK,KACrC,OAAC,kBAAgB,SAAAA,GAAM,MAAM,GAC/B,EACE,KACN,GACF,KACA,OAAC,OAAI,UAAU,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport Title from '../Title/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport { Avatar, AvatarImage, AvatarFallback } from '../../components/avatar.js'\nimport { Container } from '../../components/container.js'\nimport { Text } from '../../components/text.js'\nimport type { ContainerProps, Theme } from '../../types/props.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport type { Img } from '../../types/props.js'\n\nconst componentType = 'copy'\nconst componentName = 'product_review'\n\nexport interface EvaluateItem {\n /** \u4EA7\u54C1\u56FE\u7247*/\n img: Img\n title: string\n subTitle: string\n description: string\n avatar?: {\n url: string\n }\n rating: number\n link?: string\n}\n\nexport interface EvaluateProps {\n className?: string\n data: {\n title?: string\n products: EvaluateItem[]\n /** \u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u4E3B\u9898\u8272*/\n theme?: Theme\n containerProps?: ContainerProps\n }\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: (_v: any, _index: number) => void\n }\n key?: string\n}\n\nconst EvaluateItem = ({ data, configuration }: { data: EvaluateItem; configuration?: any }) => {\n const ref = useRef<HTMLDivElement>(null)\n const handleRating = (num: number) => {\n const raw = Number(num)\n const count = Number.isFinite(raw) ? Math.max(0, Math.floor(raw)) : 0\n return Array.from({ length: count }) || []\n }\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.title,\n componentDescription: data?.description,\n position: configuration?.index + 1,\n })\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-secondary-1 tablet:hover:bg-info-white box-border w-full overflow-hidden duration-300',\n configuration?.shape === 'round' ? 'rounded-2xl' : 'rounded-none',\n 'lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480] desktop:aspect-w-[316] desktop:aspect-h-[384]',\n 'laptop:aspect-w-[288] laptop:aspect-h-[360] aspect-w-[296] aspect-h-[360] relative',\n 'md-tablet:h-[360px]'\n )}\n >\n <div className=\"desktop:p-6 absolute inset-0 box-border flex flex-col overflow-hidden p-4\">\n <div className={cn('lg-desktop:mb-16 desktop:mb-10 mb-8 flex w-full justify-between')}>\n <div className=\"flex-1\">\n {data?.title ? <h4 className=\"laptop:text-lg text-sm font-bold\">{data?.title}</h4> : null}\n <div className=\"mt-1 flex items-center\">\n {handleRating(data?.rating)?.map?.((_, index) => {\n return (\n <div key={index} className=\"mr-1\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"16\" height=\"16\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M7.32745 1.36274C7.60256 0.805304 8.39744 0.805305 8.67255 1.36274L10.1766 4.41035C10.2859 4.63171 10.4971 4.78514 10.7413 4.82063L14.1046 5.30934C14.7197 5.39873 14.9654 6.15471 14.5202 6.58861L12.0866 8.96084C11.9098 9.13315 11.8292 9.3814 11.8709 9.62469L12.4454 12.9743C12.5505 13.587 11.9074 14.0542 11.3572 13.765L8.349 12.1835C8.13051 12.0686 7.86949 12.0686 7.65099 12.1835L4.64282 13.765C4.0926 14.0542 3.44953 13.587 3.55461 12.9743L4.12912 9.62469C4.17085 9.3814 4.09019 9.13315 3.91342 8.96084L1.47976 6.58861C1.03462 6.15471 1.28025 5.39873 1.89542 5.30934L5.25866 4.82063C5.50294 4.78514 5.71412 4.63171 5.82336 4.41035L7.32745 1.36274Z\"\n fill=\"#F77234\"\n />\n </svg>\n </div>\n )\n })}\n </div>\n </div>\n <div className=\"desktop:size-12 size-10 overflow-hidden\">\n {data?.avatar?.url ? (\n <Avatar className=\"size-full\" isAdaptation={!data?.avatar?.url}>\n <AvatarImage src={data?.avatar?.url} />\n <AvatarFallback>{data?.title}</AvatarFallback>\n </Avatar>\n ) : null}\n </div>\n </div>\n <div className=\"flex-1\" title={data?.description || ''}>\n <Text\n className={cn(\n 'lg-desktop:text-2xl text-info-primary evaluate-description line-clamp-5 break-words text-xl font-bold leading-[1.2]'\n )}\n >\n {data?.description || ''}\n </Text>\n </div>\n <a\n href={trackUrlRef(data?.link, `${componentType}_${componentName}`)}\n onClick={() => {\n configuration?.event?.primaryButton(data, configuration?.index + 1)\n }}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}#${data?.description || data?.subTitle}`}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n >\n <div\n className={cn(\n 'mt-3 flex cursor-pointer items-center overflow-hidden bg-[#F7F8F9] p-3',\n configuration?.shape === 'round' ? 'rounded-lg' : 'rounded-none'\n )}\n >\n <div className=\"laptop:size-16 desktop:size-20 mr-3 flex size-12 items-center\">\n <Picture className=\"w-full object-cover\" source={data?.img?.url} alt={data?.img?.alt || ''} />\n </div>\n <p className=\"lg-desktop:text-[18px] desktop-[16px] line-clamp-2 flex-1 text-[14px] font-bold tracking-[-0.04em]\">\n {data?.subTitle || ''}\n </p>\n </div>\n </a>\n </div>\n </div>\n )\n}\n\nconst Evaluate = React.forwardRef<HTMLDivElement, EvaluateProps>(({ className = '', data, key }, ref) => {\n const { products, title, theme, ...ohter } = data\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n return (\n <div className={className} ref={innerRef}>\n <div className=\"evaluate-box relative z-10\">\n <Container {...(data?.containerProps || {})} className=\"overflow-hidden\">\n <div ref={ref} className={cn('w-full', className, { 'aiui-dark': theme === 'dark' })}>\n {title && <Title data={{ title: title }} />}\n <SwiperBox\n className=\"!overflow-visible\"\n id={'Evaluate' + key}\n data={{ list: products, configuration: { ...ohter, title: title } }}\n Slide={EvaluateItem}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1.2,\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 2.3,\n },\n 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 3,\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n </div>\n </Container>\n </div>\n </div>\n )\n})\n\nEvaluate.displayName = 'Evaluate'\n\nexport default withLayout(Evaluate)\n"],
|
|
5
|
+
"mappings": "ukBAAA,I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IAAKM,EAC9B,mBAAC,OAAI,UAAU,6BACb,mBAAC,aAAW,GAAIlB,GAAM,gBAAkB,CAAC,EAAI,UAAU,kBACrD,oBAAC,OAAI,IAAKE,EAAK,aAAW,MAAG,SAAUU,EAAW,CAAE,YAAaI,IAAU,MAAO,CAAC,EAChF,UAAAD,MAAS,OAAC,EAAAI,QAAA,CAAM,KAAM,CAAE,MAAOJ,CAAM,EAAG,KACzC,OAAC,EAAAK,QAAA,CACC,UAAU,oBACV,GAAI,WAAaP,EACjB,KAAM,CAAE,KAAMC,EAAU,cAAe,CAAE,GAAGG,EAAO,MAAOF,CAAM,CAAE,EAClE,MAAOhB,EACP,YAAa,CACX,EAAG,CACD,aAAc,GACd,SAAU,GACV,cAAe,CACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,GACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,GACjB,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAe,CACjB,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAe,CACjB,CACF,EACF,GACF,EACF,EACF,EACF,CAEJ,CAAC,EAEDW,EAAS,YAAc,WAEvB,IAAO3B,KAAQ,cAAW2B,CAAQ",
|
|
6
6
|
"names": ["Evaluate_exports", "__export", "Evaluate_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_Title", "import_utils", "import_picture", "import_SwiperBox", "import_Styles", "import_avatar", "import_container", "import_text", "import_useExposure", "import_trackUrlRef", "componentType", "componentName", "EvaluateItem", "data", "configuration", "ref", "handleRating", "num", "raw", "count", "_", "index", "Picture", "Evaluate", "React", "className", "key", "products", "title", "theme", "ohter", "innerRef", "Title", "SwiperBox"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var j=Object.create;var f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var A=(e,s)=>{for(var o in s)f(e,o,{get:s[o],enumerable:!0})},k=(e,s,o,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let
|
|
1
|
+
"use strict";"use client";var j=Object.create;var f=Object.defineProperty;var R=Object.getOwnPropertyDescriptor;var _=Object.getOwnPropertyNames;var q=Object.getPrototypeOf,Y=Object.prototype.hasOwnProperty;var A=(e,s)=>{for(var o in s)f(e,o,{get:s[o],enumerable:!0})},k=(e,s,o,c)=>{if(s&&typeof s=="object"||typeof s=="function")for(let i of _(s))!Y.call(e,i)&&i!==o&&f(e,i,{get:()=>s[i],enumerable:!(c=R(s,i))||c.enumerable});return e};var b=(e,s,o)=>(o=e!=null?j(q(e)):{},k(s||!e||!e.__esModule?f(o,"default",{value:e,enumerable:!0}):o,e)),Q=e=>k(f({},"__esModule",{value:!0}),e);var J={};A(J,{default:()=>F});module.exports=Q(J);var t=require("react/jsx-runtime"),M=require("react-responsive"),l=b(require("react")),h=require("../../helpers/utils.js"),C=require("../../shared/Styles.js"),V=b(require("../SwiperBox/index.js")),n=require("../../components/index.js"),$=b(require("../Title/index.js")),P=require("../VideoModal/index.js"),G=require("../TextModal/index.js"),g=require("../../hooks/useExposure.js"),x=require("../../shared/trackUrlRef.js");const a="image",m="graphic",N="descTitle lg-desktop:text-[32px] desktop:mt-2 desktop:text-[24px] text-lines-2 mt-1 line-clamp-3 flex-1 text-[24px] font-bold leading-[1.2]",Z=({data:e,configuration:s})=>{const o=(0,l.useRef)(null),c=()=>{switch(s.num){case 1:return"tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]";case 2:return"tablet:aspect-w-[346] tablet:aspect-h-[360] laptop:aspect-w-[440] laptop:aspect-h-[360] desktop:aspect-w-[648] desktop:aspect-h-[384] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480]";case 3:return"tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[427] desktop:aspect-h-[384] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[480]";default:return"tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[316] desktop:aspect-h-[384] lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480]"}};return(0,g.useExposure)(o,{componentType:a,componentName:m,componentTitle:e?.title,componentDescription:e?.description,position:s?.index+1}),(0,t.jsx)("div",{ref:o,className:(0,h.cn)(c(),"graphicItem","laptop:h-auto text-info-primary md-tablet:h-[360px] flex-1 shrink-0 md:basis-[296px]",{"aiui-dark":e.theme==="dark"}),children:(0,t.jsx)("div",{className:(0,h.cn)("absolute inset-0",{"rounded-xl overflow-hidden laptop:rounded-2xl":s?.itemShape==="round"}),children:(0,t.jsxs)("div",{className:`graphic-children relative block size-full overflow-hidden ${e?.href?"cursor-pointer":""}`,children:[e?.href?(0,t.jsx)("a",{"aria-label":e?.title??e?.description,href:(0,x.trackUrlRef)(e?.href||"",`${a}_${m}`),className:"block size-full overflow-hidden","data-headless-nav-postion":`''#${s?.index+1}`,"data-headless-type-name":`${a}#${m}`,"data-headless-title-desc-button":`${e?.title}#${e?.description}`,children:(0,t.jsx)(n.Picture,{className:"h-full",imgClassName:"h-full object-cover tablet:hover:scale-110 transition-all duration-300",source:e?.imgUrl?.url,alt:e?.imgUrl?.alt||""})}):(0,t.jsx)("div",{className:"block size-full overflow-hidden",children:(0,t.jsx)(n.Picture,{className:"h-full",imgClassName:"h-full object-cover tablet:hover:scale-110 transition-all duration-300",source:e?.imgUrl?.url,alt:e?.imgUrl?.alt||""})}),(0,t.jsxs)("div",{className:"laptop:p-6 absolute bottom-0 z-[1] box-border flex w-full flex-col p-4",children:[(0,t.jsxs)("div",{className:(0,h.cn)("flex items-end gap-1 overflow-hidden","graphic-bottom"),children:[(0,t.jsxs)("div",{className:"flex-1 overflow-hidden",children:[(0,t.jsx)(n.Text,{html:e?.title,style:{color:e?.textColor},className:"spanTitle graphic-title lg-desktop:text-lg desktop:text-base line-clamp-3 text-sm font-bold leading-[1.2]"}),e?.description&&(e?.title?(0,t.jsx)(n.Heading,{html:e?.description,style:{color:e?.textColor},as:"h3",title:e?.description||"",className:`${N} graphic-description`}):(0,t.jsx)("h3",{style:{color:e?.textColor},title:e?.description||"",dangerouslySetInnerHTML:{__html:e?.description||""},className:`${N} graphic-description-item`}))]}),!e?.isShowIcon&&(e?.video?.url||e?.youtubeId)&&(0,t.jsx)("button",{"aria-label":"Play Video",onClick:i=>{i.preventDefault(),i.stopPropagation(),s?.onVideoPlayBtnClick?.(s?.index||0,e)},className:"laptop:size-12 flex size-8 items-center justify-center rounded-full bg-white/20 hover:bg-black/75",children:(0,t.jsx)("svg",{width:"12",height:"14",viewBox:"0 0 12 14",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("path",{d:"M12 7L0 14L0 0L12 7Z",fill:"white"})})}),e?.isShowIcon&&e?.icon?.url&&(0,t.jsx)("button",{onClick:i=>{i.preventDefault(),i.stopPropagation(),s?.onIconClick?.(e,s)},className:"laptop:size-9 flex size-8 items-center justify-center overflow-hidden rounded-full bg-white/20 hover:bg-black/75",children:(0,t.jsx)(n.Picture,{className:"h-full",imgClassName:"h-full object-cover",source:e?.icon?.url,alt:e?.icon?.alt||""})})]}),e.buttonText&&(0,t.jsx)(n.Button,{as:"a","aria-label":e?.title??e?.description,variant:"secondary",className:"bgButton mt-[8px] self-start",href:(0,x.trackUrlRef)(e?.href,`${a}_${m}`),"data-headless-nav-postion":`''#${s?.index+1}`,"data-headless-type-name":`${a}#${m}`,"data-headless-title-desc-button":`${e?.title}#${e?.description}#${e?.buttonText}`,children:e.buttonText})]})]})})})},I=l.default.forwardRef(({data:e,className:s},o)=>{const c=(0,M.useMediaQuery)({query:"(max-width: 768px)"}),i=(0,l.useRef)(null),[S,v]=(0,l.useState)(!1),[w,B]=(0,l.useState)(""),[H,L]=(0,l.useState)(""),[D,E]=(0,l.useState)(""),[U,y]=(0,l.useState)(null),[z,T]=(0,l.useState)(!1),u=p=>{const r=e?.items?.length>3,d=e?.items?.length>2;switch(p){case 1440:return r?4:e?.items?.length;case 1024:return r?3:e?.items?.length;case 768:return e?.items?.length===1?1:r||d?2.3:2;default:return e?.items?.length===1?1:1.2}};return(0,l.useImperativeHandle)(o,()=>i.current),(0,g.useExposure)(i,{componentType:a,componentName:m,componentTitle:e?.title}),(0,l.useEffect)(()=>{const p=i.current?.querySelectorAll(".graphic-description");if(p&&p.length>0){let r=0;p.forEach(d=>{r=Math.max(r,d.offsetHeight)}),p.forEach(d=>{d.style.height=`${r}px`})}},[]),(0,t.jsxs)("div",{className:(0,h.cn)("graphicBlock",s),ref:i,children:[(0,t.jsxs)("div",{className:"graphic-box",children:[e?.title&&(0,t.jsx)($.default,{data:{title:e?.title}}),(0,t.jsx)(V.default,{id:"Graphic",className:(0,h.cn)("!overflow-visible"),data:{list:e?.items||[],configuration:{itemShape:e.itemShape,num:e?.items?.length||0,onVideoPlayBtnClick:(p,r)=>{v(!0),r?.isYouTube?L?.(r?.youtubeId||""):(B?.(r?.video?.url||""),E?.(r?.mobileVideo?.url||""))},onIconClick:p=>{T(!0),y(p)},title:e?.title}},Slide:Z,breakpoints:{0:{spaceBetween:12,freeMode:!1,slidesPerView:1},374:{spaceBetween:12,freeMode:!1,slidesPerView:u()},768:{spaceBetween:16,freeMode:!1,slidesPerView:u(768)},1024:{spaceBetween:16,freeMode:!1,slidesPerView:u(1024)},1440:{spaceBetween:16,freeMode:!1,slidesPerView:u(1440)}}})]}),(0,t.jsx)(P.VideoModal,{visible:S,youTubeId:H,onCloseModal:()=>v(!1),videoUrl:c&&D||w}),(0,t.jsx)(G.TextModal,{textVisible:z,extension:U?.extension,onCloseModal:()=>{T(!1),y(null)}})]})});I.displayName="Graphic";var F=(0,C.withLayout)(I);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Graphic/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport { useMediaQuery } from 'react-responsive'\nimport React, { useEffect, useImperativeHandle, useRef, useState } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport Title from '../Title/index.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport { TextModal } from '../TextModal/index.js'\nimport type { ComponentCommonProps, Video, Img, Theme } from '../../types/props.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\n\nconst componentType = 'image'\nconst componentName = 'graphic'\n\ntype GraphicType = {\n imgUrl: Img\n title: string\n description?: string\n textColor?: string\n href?: string\n video?: Video\n mobileVideo?: Video\n youtubeId?: string\n isYouTube?: boolean\n isShowIcon?: boolean\n buttonText?: string\n icon?: Img\n theme?: Theme\n extension?: {\n text: string\n textDesc: string\n textTitle: string\n textPcImg: Img\n textMobileImg: Img\n }\n}\n\nconst descriptionClass =\n 'descTitle lg-desktop:text-[32px] desktop:mt-2 desktop:text-[24px] text-lines-2 mt-1 line-clamp-3 flex-1 text-[24px] font-bold leading-[1.2]'\nexport interface GraphicProps extends ComponentCommonProps {\n className?: string\n data: {\n title?: string\n items?: GraphicType[]\n itemShape?: 'round' | 'square'\n itemTheme?: Theme\n }\n}\n\nconst Item = ({ data, configuration }: { data: GraphicType; configuration?: any }) => {\n const ref = useRef<HTMLDivElement>(null)\n const handleAspect = () => {\n switch (configuration.num) {\n case 1:\n return 'tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]'\n case 2:\n return 'tablet:aspect-w-[346] tablet:aspect-h-[360] laptop:aspect-w-[440] laptop:aspect-h-[360] desktop:aspect-w-[648] desktop:aspect-h-[384] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480]'\n case 3:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[427] desktop:aspect-h-[384] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[480]'\n default:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[316] desktop:aspect-h-[384] lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480]'\n }\n }\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.title,\n componentDescription: data?.description,\n position: configuration?.index + 1,\n })\n\n return (\n <div\n ref={ref}\n className={cn(\n handleAspect(),\n 'graphicItem',\n 'laptop:h-auto text-info-primary md-tablet:h-[360px] flex-1 shrink-0 md:basis-[296px]',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n <div\n className={cn('absolute inset-0', {\n ['rounded-xl overflow-hidden laptop:rounded-2xl']: configuration?.itemShape === 'round',\n })}\n >\n <div\n className={`graphic-children relative block size-full overflow-hidden ${data?.href ? 'cursor-pointer' : ''}`}\n >\n {data?.href ? (\n <a\n aria-label={data?.title ?? data?.description}\n href={trackUrlRef(data?.href || '', `${componentType}_${componentName}`)}\n className=\"block size-full overflow-hidden\"\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}#${data?.description}`}\n >\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover tablet:hover:scale-110 transition-all duration-300\"\n source={data?.imgUrl?.url}\n alt={data?.imgUrl?.alt || ''}\n />\n </a>\n ) : (\n <div className=\"block size-full overflow-hidden\">\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover tablet:hover:scale-110 transition-all duration-300\"\n source={data?.imgUrl?.url}\n alt={data?.imgUrl?.alt || ''}\n />\n </div>\n )}\n <div className=\"laptop:p-6 absolute bottom-0 z-[1] box-border flex w-full flex-col p-4\">\n <div className={cn('flex items-end gap-1 overflow-hidden', 'graphic-bottom')}>\n <div className=\"flex-1 overflow-hidden\">\n <Text\n html={data?.title}\n style={{ color: data?.textColor }}\n className=\"spanTitle graphic-title lg-desktop:text-lg desktop:text-base line-clamp-3 text-sm font-bold leading-[1.2]\"\n />\n {data?.description &&\n (data?.title ? (\n <Heading\n html={data?.description}\n style={{\n color: data?.textColor,\n }}\n as=\"h3\"\n className={`${descriptionClass} graphic-description`}\n />\n ) : (\n <h3\n style={{\n color: data?.textColor,\n }}\n dangerouslySetInnerHTML={{ __html: data?.description || '' }}\n className={`${descriptionClass} graphic-description-item`}\n />\n ))}\n </div>\n {!data?.isShowIcon && (data?.video?.url || data?.youtubeId) && (\n <button\n aria-label=\"Play Video\"\n onClick={(e: any) => {\n e.preventDefault()\n e.stopPropagation()\n configuration?.onVideoPlayBtnClick?.(configuration?.index || 0, data)\n }}\n className=\"laptop:size-12 flex size-8 items-center justify-center rounded-full bg-white/20 hover:bg-black/75\"\n >\n <svg width=\"12\" height=\"14\" viewBox=\"0 0 12 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 7L0 14L0 0L12 7Z\" fill=\"white\" />\n </svg>\n </button>\n )}\n {data?.isShowIcon && data?.icon?.url && (\n <button\n onClick={(e: any) => {\n e.preventDefault()\n e.stopPropagation()\n configuration?.onIconClick?.(data, configuration)\n }}\n className=\"laptop:size-9 flex size-8 items-center justify-center overflow-hidden rounded-full bg-white/20 hover:bg-black/75\"\n >\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover\"\n source={data?.icon?.url}\n alt={data?.icon?.alt || ''}\n />\n </button>\n )}\n </div>\n {data.buttonText && (\n <Button\n as=\"a\"\n aria-label={data?.title ?? data?.description}\n variant=\"secondary\"\n className=\"bgButton mt-[8px] self-start\"\n href={trackUrlRef(data?.href, `${componentType}_${componentName}`)}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}#${data?.description}#${data?.buttonText}`}\n >\n {data.buttonText}\n </Button>\n )}\n </div>\n </div>\n </div>\n </div>\n )\n}\n\nconst Graphic = React.forwardRef<HTMLDivElement, GraphicProps>(({ data, className }, ref) => {\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const innerRef = useRef<HTMLDivElement>(null)\n const [visible, setVisible] = useState<boolean>(false)\n const [videoUrl, setVideoUrl] = useState<string>('')\n const [youTubeId, setYouTubeId] = useState<string>('')\n const [mobileVideoUrl, setMobileVideoUrl] = useState<string>('')\n const [currentItem, setCurrentItem] = useState<GraphicType | null>(null)\n const [textVisible, setTextVisible] = useState<boolean>(false)\n\n const handleSwiperShow = (width?: number) => {\n const isShow = (data?.items as GraphicType[])?.length > 3\n const isMobile = (data?.items as GraphicType[])?.length > 2\n switch (width) {\n case 1440:\n return isShow ? 4 : data?.items?.length\n case 1024:\n return isShow ? 3 : data?.items?.length\n case 768:\n if ((data?.items as GraphicType[])?.length === 1) return 1 // \u2705 \u65B0\u589E\uFF1A\u53EA\u6709\u4E00\u4E2A item \u65F6\uFF0C\u5C55\u793A 1 \u4E2A\n return isShow ? 2.3 : isMobile ? 2.3 : 2\n default:\n if ((data?.items as GraphicType[])?.length === 1) return 1 // \u2705 \u65B0\u589E\uFF1A\u53EA\u6709\u4E00\u4E2A item \u65F6\uFF0C\u5C55\u793A 1 \u4E2A\n return 1.2\n }\n }\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n useEffect(() => {\n const descriptions = innerRef.current?.querySelectorAll<HTMLDivElement>('.graphic-description')\n if (descriptions && descriptions.length > 0) {\n let maxHeight = 0\n descriptions.forEach((el: HTMLDivElement) => {\n maxHeight = Math.max(maxHeight, el.offsetHeight)\n })\n descriptions.forEach((el: HTMLDivElement) => {\n el.style.height = `${maxHeight}px`\n })\n }\n }, [])\n\n return (\n <div className={cn('graphicBlock', className)} ref={innerRef}>\n <div className=\"graphic-box\">\n {data?.title && <Title data={{ title: data?.title }} />}\n <SwiperBox\n id=\"Graphic\"\n className={cn('!overflow-visible')}\n data={{\n list: data?.items || [],\n configuration: {\n itemShape: data.itemShape,\n num: data?.items?.length || 0,\n onVideoPlayBtnClick: (_: number, data: GraphicType) => {\n setVisible(true)\n if (data?.isYouTube) {\n setYouTubeId?.(data?.youtubeId || '')\n } else {\n setVideoUrl?.(data?.video?.url || '')\n setMobileVideoUrl?.(data?.mobileVideo?.url || '')\n }\n },\n onIconClick: (data: GraphicType) => {\n setTextVisible(true)\n setCurrentItem(data)\n },\n title: data?.title,\n },\n }}\n Slide={Item}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: handleSwiperShow(),\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(768),\n },\n 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(1024),\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(1440),\n },\n }}\n />\n </div>\n <VideoModal\n visible={visible}\n youTubeId={youTubeId}\n onCloseModal={() => setVisible(false)}\n videoUrl={isMobile ? mobileVideoUrl || videoUrl : videoUrl}\n />\n <TextModal\n textVisible={textVisible}\n extension={currentItem?.extension}\n onCloseModal={() => {\n setTextVisible(false)\n setCurrentItem(null)\n }}\n />\n </div>\n )\n})\n\nGraphic.displayName = 'Graphic'\n\nexport default withLayout(Graphic)\n"],
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAA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IAAI,CACtC,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAeA,EAAiB,IAAI,CACtC,CACF,EACF,GACF,KACA,OAAC,cACC,QAASZ,EACT,UAAWI,EACX,aAAc,IAAMH,EAAW,EAAK,EACpC,SAAUH,GAAWQ,GAAkBJ,EACzC,KACA,OAAC,aACC,YAAaQ,EACb,UAAWF,GAAa,UACxB,aAAc,IAAM,CAClBG,EAAe,EAAK,EACpBF,EAAe,IAAI,CACrB,EACF,GACF,CAEJ,CAAC,EAEDd,EAAQ,YAAc,UAEtB,IAAOvB,KAAQ,cAAWuB,CAAO",
|
|
4
|
+
"sourcesContent": ["'use client'\nimport { useMediaQuery } from 'react-responsive'\nimport React, { useEffect, useImperativeHandle, useRef, useState } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { Button, Heading, Picture, Text } from '../../components/index.js'\nimport Title from '../Title/index.js'\nimport { VideoModal } from '../VideoModal/index.js'\nimport { TextModal } from '../TextModal/index.js'\nimport type { ComponentCommonProps, Video, Img, Theme } from '../../types/props.js'\nimport { useExposure } from '../../hooks/useExposure.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\n\nconst componentType = 'image'\nconst componentName = 'graphic'\n\ntype GraphicType = {\n imgUrl: Img\n title: string\n description?: string\n textColor?: string\n href?: string\n video?: Video\n mobileVideo?: Video\n youtubeId?: string\n isYouTube?: boolean\n isShowIcon?: boolean\n buttonText?: string\n icon?: Img\n theme?: Theme\n extension?: {\n text: string\n textDesc: string\n textTitle: string\n textPcImg: Img\n textMobileImg: Img\n }\n}\n\nconst descriptionClass =\n 'descTitle lg-desktop:text-[32px] desktop:mt-2 desktop:text-[24px] text-lines-2 mt-1 line-clamp-3 flex-1 text-[24px] font-bold leading-[1.2]'\nexport interface GraphicProps extends ComponentCommonProps {\n className?: string\n data: {\n title?: string\n items?: GraphicType[]\n itemShape?: 'round' | 'square'\n itemTheme?: Theme\n }\n}\n\nconst Item = ({ data, configuration }: { data: GraphicType; configuration?: any }) => {\n const ref = useRef<HTMLDivElement>(null)\n const handleAspect = () => {\n switch (configuration.num) {\n case 1:\n return 'tablet:aspect-w-[704] tablet:aspect-h-[400] laptop:aspect-w-[896] laptop:aspect-h-[384] desktop:aspect-w-[1312] desktop:aspect-h-[512] lg-desktop:aspect-w-[1664] lg-desktop:aspect-h-[640]'\n case 2:\n return 'tablet:aspect-w-[346] tablet:aspect-h-[360] laptop:aspect-w-[440] laptop:aspect-h-[360] desktop:aspect-w-[648] desktop:aspect-h-[384] lg-desktop:aspect-w-[824] lg-desktop:aspect-h-[480]'\n case 3:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[427] desktop:aspect-h-[384] lg-desktop:aspect-w-[544] lg-desktop:aspect-h-[480]'\n default:\n return 'tablet:aspect-w-[296] tablet:aspect-h-[360] laptop:aspect-w-[288] laptop:aspect-h-[360] desktop:aspect-w-[316] desktop:aspect-h-[384] lg-desktop:aspect-w-[404] lg-desktop:aspect-h-[480]'\n }\n }\n\n useExposure(ref, {\n componentType,\n componentName,\n componentTitle: data?.title,\n componentDescription: data?.description,\n position: configuration?.index + 1,\n })\n\n return (\n <div\n ref={ref}\n className={cn(\n handleAspect(),\n 'graphicItem',\n 'laptop:h-auto text-info-primary md-tablet:h-[360px] flex-1 shrink-0 md:basis-[296px]',\n {\n 'aiui-dark': data.theme === 'dark',\n }\n )}\n >\n <div\n className={cn('absolute inset-0', {\n ['rounded-xl overflow-hidden laptop:rounded-2xl']: configuration?.itemShape === 'round',\n })}\n >\n <div\n className={`graphic-children relative block size-full overflow-hidden ${data?.href ? 'cursor-pointer' : ''}`}\n >\n {data?.href ? (\n <a\n aria-label={data?.title ?? data?.description}\n href={trackUrlRef(data?.href || '', `${componentType}_${componentName}`)}\n className=\"block size-full overflow-hidden\"\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}#${data?.description}`}\n >\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover tablet:hover:scale-110 transition-all duration-300\"\n source={data?.imgUrl?.url}\n alt={data?.imgUrl?.alt || ''}\n />\n </a>\n ) : (\n <div className=\"block size-full overflow-hidden\">\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover tablet:hover:scale-110 transition-all duration-300\"\n source={data?.imgUrl?.url}\n alt={data?.imgUrl?.alt || ''}\n />\n </div>\n )}\n <div className=\"laptop:p-6 absolute bottom-0 z-[1] box-border flex w-full flex-col p-4\">\n <div className={cn('flex items-end gap-1 overflow-hidden', 'graphic-bottom')}>\n <div className=\"flex-1 overflow-hidden\">\n <Text\n html={data?.title}\n style={{ color: data?.textColor }}\n className=\"spanTitle graphic-title lg-desktop:text-lg desktop:text-base line-clamp-3 text-sm font-bold leading-[1.2]\"\n />\n {data?.description &&\n (data?.title ? (\n <Heading\n html={data?.description}\n style={{\n color: data?.textColor,\n }}\n as=\"h3\"\n title={data?.description || ''}\n className={`${descriptionClass} graphic-description`}\n />\n ) : (\n <h3\n style={{\n color: data?.textColor,\n }}\n title={data?.description || ''}\n dangerouslySetInnerHTML={{ __html: data?.description || '' }}\n className={`${descriptionClass} graphic-description-item`}\n />\n ))}\n </div>\n {!data?.isShowIcon && (data?.video?.url || data?.youtubeId) && (\n <button\n aria-label=\"Play Video\"\n onClick={(e: any) => {\n e.preventDefault()\n e.stopPropagation()\n configuration?.onVideoPlayBtnClick?.(configuration?.index || 0, data)\n }}\n className=\"laptop:size-12 flex size-8 items-center justify-center rounded-full bg-white/20 hover:bg-black/75\"\n >\n <svg width=\"12\" height=\"14\" viewBox=\"0 0 12 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M12 7L0 14L0 0L12 7Z\" fill=\"white\" />\n </svg>\n </button>\n )}\n {data?.isShowIcon && data?.icon?.url && (\n <button\n onClick={(e: any) => {\n e.preventDefault()\n e.stopPropagation()\n configuration?.onIconClick?.(data, configuration)\n }}\n className=\"laptop:size-9 flex size-8 items-center justify-center overflow-hidden rounded-full bg-white/20 hover:bg-black/75\"\n >\n <Picture\n className=\"h-full\"\n imgClassName=\"h-full object-cover\"\n source={data?.icon?.url}\n alt={data?.icon?.alt || ''}\n />\n </button>\n )}\n </div>\n {data.buttonText && (\n <Button\n as=\"a\"\n aria-label={data?.title ?? data?.description}\n variant=\"secondary\"\n className=\"bgButton mt-[8px] self-start\"\n href={trackUrlRef(data?.href, `${componentType}_${componentName}`)}\n data-headless-nav-postion={`''#${configuration?.index + 1}`}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${data?.title}#${data?.description}#${data?.buttonText}`}\n >\n {data.buttonText}\n </Button>\n )}\n </div>\n </div>\n </div>\n </div>\n )\n}\n\nconst Graphic = React.forwardRef<HTMLDivElement, GraphicProps>(({ data, className }, ref) => {\n const isMobile = useMediaQuery({ query: '(max-width: 768px)' })\n const innerRef = useRef<HTMLDivElement>(null)\n const [visible, setVisible] = useState<boolean>(false)\n const [videoUrl, setVideoUrl] = useState<string>('')\n const [youTubeId, setYouTubeId] = useState<string>('')\n const [mobileVideoUrl, setMobileVideoUrl] = useState<string>('')\n const [currentItem, setCurrentItem] = useState<GraphicType | null>(null)\n const [textVisible, setTextVisible] = useState<boolean>(false)\n\n const handleSwiperShow = (width?: number) => {\n const isShow = (data?.items as GraphicType[])?.length > 3\n const isMobile = (data?.items as GraphicType[])?.length > 2\n switch (width) {\n case 1440:\n return isShow ? 4 : data?.items?.length\n case 1024:\n return isShow ? 3 : data?.items?.length\n case 768:\n if ((data?.items as GraphicType[])?.length === 1) return 1 // \u2705 \u65B0\u589E\uFF1A\u53EA\u6709\u4E00\u4E2A item \u65F6\uFF0C\u5C55\u793A 1 \u4E2A\n return isShow ? 2.3 : isMobile ? 2.3 : 2\n default:\n if ((data?.items as GraphicType[])?.length === 1) return 1 // \u2705 \u65B0\u589E\uFF1A\u53EA\u6709\u4E00\u4E2A item \u65F6\uFF0C\u5C55\u793A 1 \u4E2A\n return 1.2\n }\n }\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n useExposure(innerRef, {\n componentType,\n componentName,\n componentTitle: data?.title,\n })\n\n useEffect(() => {\n const descriptions = innerRef.current?.querySelectorAll<HTMLDivElement>('.graphic-description')\n if (descriptions && descriptions.length > 0) {\n let maxHeight = 0\n descriptions.forEach((el: HTMLDivElement) => {\n maxHeight = Math.max(maxHeight, el.offsetHeight)\n })\n descriptions.forEach((el: HTMLDivElement) => {\n el.style.height = `${maxHeight}px`\n })\n }\n }, [])\n\n return (\n <div className={cn('graphicBlock', className)} ref={innerRef}>\n <div className=\"graphic-box\">\n {data?.title && <Title data={{ title: data?.title }} />}\n <SwiperBox\n id=\"Graphic\"\n className={cn('!overflow-visible')}\n data={{\n list: data?.items || [],\n configuration: {\n itemShape: data.itemShape,\n num: data?.items?.length || 0,\n onVideoPlayBtnClick: (_: number, data: GraphicType) => {\n setVisible(true)\n if (data?.isYouTube) {\n setYouTubeId?.(data?.youtubeId || '')\n } else {\n setVideoUrl?.(data?.video?.url || '')\n setMobileVideoUrl?.(data?.mobileVideo?.url || '')\n }\n },\n onIconClick: (data: GraphicType) => {\n setTextVisible(true)\n setCurrentItem(data)\n },\n title: data?.title,\n },\n }}\n Slide={Item}\n breakpoints={{\n 0: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: 12,\n freeMode: false,\n slidesPerView: handleSwiperShow(),\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(768),\n },\n 1024: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(1024),\n },\n 1440: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: handleSwiperShow(1440),\n },\n }}\n />\n </div>\n <VideoModal\n visible={visible}\n youTubeId={youTubeId}\n onCloseModal={() => setVisible(false)}\n videoUrl={isMobile ? mobileVideoUrl || videoUrl : videoUrl}\n />\n <TextModal\n textVisible={textVisible}\n extension={currentItem?.extension}\n onCloseModal={() => {\n setTextVisible(false)\n setCurrentItem(null)\n }}\n />\n </div>\n )\n})\n\nGraphic.displayName = 'Graphic'\n\nexport default withLayout(Graphic)\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAwGc,IAAAI,EAAA,6BAvGdC,EAA8B,4BAC9BC,EAAwE,oBACxEC,EAAmB,kCACnBC,EAA2B,kCAC3BC,EAAsB,oCACtBC,EAA+C,qCAC/CC,EAAkB,gCAClBC,EAA2B,kCAC3BC,EAA0B,iCAE1BC,EAA4B,sCAC5BC,EAA4B,uCAE5B,MAAMC,EAAgB,QAChBC,EAAgB,UAyBhBC,EACJ,8IAWIC,EAAO,CAAC,CAAE,KAAAC,EAAM,cAAAC,CAAc,IAAkD,CACpF,MAAMC,KAAM,UAAuB,IAAI,EACjCC,EAAe,IAAM,CACzB,OAAQF,EAAc,IAAK,CACzB,IAAK,GACH,MAAO,8LACT,IAAK,GACH,MAAO,4LACT,IAAK,GACH,MAAO,4LACT,QACE,MAAO,2LACX,CACF,EAEA,wBAAYC,EAAK,CACf,cAAAN,EACA,cAAAC,EACA,eAAgBG,GAAM,MACtB,qBAAsBA,GAAM,YAC5B,SAAUC,GAAe,MAAQ,CACnC,CAAC,KAGC,OAAC,OACC,IAAKC,EACL,aAAW,MACTC,EAAa,EACb,cACA,uFACA,CACE,YAAaH,EAAK,QAAU,MAC9B,CACF,EAEA,mBAAC,OACC,aAAW,MAAG,mBAAoB,CAC/B,gDAAkDC,GAAe,YAAc,OAClF,CAAC,EAED,oBAAC,OACC,UAAW,6DAA6DD,GAAM,KAAO,iBAAmB,EAAE,GAEzG,UAAAA,GAAM,QACL,OAAC,KACC,aAAYA,GAAM,OAASA,GAAM,Y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YAAcA,GAAsB,CAClCqB,EAAe,EAAI,EACnBF,EAAenB,CAAI,CACrB,EACA,MAAOA,GAAM,KACf,CACF,EACA,MAAOD,EACP,YAAa,CACX,EAAG,CACD,aAAc,GACd,SAAU,GACV,cAAe,CACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAeuB,EAAiB,CAClC,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAeA,EAAiB,GAAG,CACrC,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAeA,EAAiB,IAAI,CACtC,EACA,KAAM,CACJ,aAAc,GACd,SAAU,GACV,cAAeA,EAAiB,IAAI,CACtC,CACF,EACF,GACF,KACA,OAAC,cACC,QAASZ,EACT,UAAWI,EACX,aAAc,IAAMH,EAAW,EAAK,EACpC,SAAUH,GAAWQ,GAAkBJ,EACzC,KACA,OAAC,aACC,YAAaQ,EACb,UAAWF,GAAa,UACxB,aAAc,IAAM,CAClBG,EAAe,EAAK,EACpBF,EAAe,IAAI,CACrB,EACF,GACF,CAEJ,CAAC,EAEDd,EAAQ,YAAc,UAEtB,IAAOvB,KAAQ,cAAWuB,CAAO",
|
|
6
6
|
"names": ["Graphic_exports", "__export", "Graphic_default", "__toCommonJS", "import_jsx_runtime", "import_react_responsive", "import_react", "import_utils", "import_Styles", "import_SwiperBox", "import_components", "import_Title", "import_VideoModal", "import_TextModal", "import_useExposure", "import_trackUrlRef", "componentType", "componentName", "descriptionClass", "Item", "data", "configuration", "ref", "handleAspect", "e", "Graphic", "React", "className", "isMobile", "innerRef", "visible", "setVisible", "videoUrl", "setVideoUrl", "youTubeId", "setYouTubeId", "mobileVideoUrl", "setMobileVideoUrl", "currentItem", "setCurrentItem", "textVisible", "setTextVisible", "handleSwiperShow", "width", "isShow", "descriptions", "maxHeight", "el", "Title", "SwiperBox", "_"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 移动端菜单项
|
|
3
|
+
*/
|
|
4
|
+
export declare const MenuItem: ({ label, href, onClick, active, icon, className, }: {
|
|
5
|
+
label: string;
|
|
6
|
+
href?: string;
|
|
7
|
+
onClick?: () => void;
|
|
8
|
+
active?: boolean;
|
|
9
|
+
icon?: string;
|
|
10
|
+
className?: string;
|
|
11
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
/**
|
|
13
|
+
* 移动端子分类标题组件
|
|
14
|
+
*/
|
|
15
|
+
export declare const SubSubCategoryItemComp: ({ matchSeriesMetadata, onSubSubCategoryItemClick, expanded, }: {
|
|
16
|
+
matchSeriesMetadata: any;
|
|
17
|
+
onSubSubCategoryItemClick?: () => void;
|
|
18
|
+
expanded?: boolean;
|
|
19
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
20
|
+
/**
|
|
21
|
+
* 移动端子分类内容组件
|
|
22
|
+
*/
|
|
23
|
+
export declare const SubSubCategoryContentComp: ({ matchSeriesMetadata }: {
|
|
24
|
+
matchSeriesMetadata: any;
|
|
25
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var a=Object.defineProperty;var d=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var f=Object.prototype.hasOwnProperty;var g=(t,n)=>{for(var l in n)a(t,l,{get:n[l],enumerable:!0})},x=(t,n,l,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of u(n))!f.call(t,r)&&r!==l&&a(t,r,{get:()=>n[r],enumerable:!(s=d(n,r))||s.enumerable});return t};var v=t=>x(a({},"__esModule",{value:!0}),t);var k={};g(k,{MenuItem:()=>h,SubSubCategoryContentComp:()=>y,SubSubCategoryItemComp:()=>N});module.exports=v(k);var e=require("react/jsx-runtime"),C=require("react"),o=require("../../components/index.js"),i=require("../../helpers/utils.js"),p=require("./icons/index.js"),c=require("./SidebarDropdown.js");const h=({label:t,href:n,onClick:l,active:s,icon:r,className:m})=>{const b=(0,e.jsxs)(e.Fragment,{children:[(0,e.jsxs)("div",{className:"flex items-center gap-4",children:[(0,e.jsx)(o.Text,{html:t,className:(0,i.cn)("text-sm font-bold leading-[1.4]",{underline:r})}),r&&(0,e.jsx)(o.Text,{html:r,"aria-hidden":"true"})]}),(0,e.jsx)("svg",{className:`size-5 ${s?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M9 5L16 12L9 19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]});return n?(0,e.jsx)(o.Link,{href:n,className:(0,i.cn)("flex cursor-pointer items-center justify-between py-4 no-underline",m),onClick:l,children:b}):(0,e.jsx)("button",{onClick:l,className:(0,i.cn)("flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",m),"aria-expanded":s,children:b})},N=({matchSeriesMetadata:t,onSubSubCategoryItemClick:n,expanded:l})=>{const s=(0,e.jsxs)(e.Fragment,{children:[t?.label&&(0,e.jsx)(o.Text,{html:t?.label,className:"text-sm font-bold leading-[1.4]"}),n&&(0,e.jsx)(p.DownArrow,{"aria-hidden":"true",className:(0,i.cn)("size-5",{"rotate-180":l})})]});return n?(0,e.jsx)("button",{className:"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:n,"aria-expanded":l,children:s}):(0,e.jsx)("div",{className:"tablet:pt-0 flex items-center justify-between py-4",children:s})},y=({matchSeriesMetadata:t})=>(0,e.jsx)("div",{className:"laptop:gap-3 flex flex-col gap-2",children:!!t?.series?.length&&t?.series?.map((n,l)=>(0,e.jsxs)("div",{children:[n.label&&(0,e.jsx)(o.Text,{html:n.label,as:"p",className:"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]"}),(0,e.jsxs)("div",{className:"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2",children:[!!t?.banner&&(0,e.jsx)(o.Link,{asChild:!t?.banner?.href,href:t?.banner?.href,children:(0,e.jsxs)("div",{className:"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(o.Picture,{source:t?.banner?.imageUrl,className:"laptop:h-[120px] h-[114px]",imgClassName:"object-cover h-full"}),(0,e.jsxs)("div",{className:"absolute inset-x-0 bottom-0 p-4",children:[(0,e.jsx)(o.Heading,{size:2,html:t?.banner?.title||"Buy in Guide",className:(0,i.cn)("font-bold text-white",{"text-black":t?.banner?.theme==="dark"})}),(0,e.jsx)(o.Text,{html:t?.banner?.desc||"20.000mAh",className:(0,i.cn)("text-sm font-bold text-white",{"text-black":t?.banner?.theme==="dark"})})]})]})}),n.products?.map((s,r)=>(0,e.jsx)(c.SeriesProductItem,{position:r,product:s,seriesLabel:t?.label,isCollection:t?.isCollection},`seriesProductItem-${l}-${r}`))]})]},`seriesItem-${l}`))});
|
|
2
|
+
//# sourceMappingURL=MobileMenuComponents.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/HeaderNavigation/MobileMenuComponents.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react'\nimport { Text, Link, Heading, Picture } from '../../components/index.js'\nimport { cn } from '../../helpers/utils.js'\nimport { DownArrow } from './icons/index.js'\nimport { SeriesProductItem } from './SidebarDropdown.js'\n\n/**\n * \u79FB\u52A8\u7AEF\u83DC\u5355\u9879\n */\nexport const MenuItem = ({\n label,\n href,\n onClick,\n active,\n icon,\n className,\n}: {\n label: string\n href?: string\n onClick?: () => void\n active?: boolean\n icon?: string\n className?: string\n}) => {\n const content = (\n <>\n <div className=\"flex items-center gap-4\">\n <Text html={label} className={cn('text-sm font-bold leading-[1.4]', { underline: icon })} />\n {icon && <Text html={icon} aria-hidden=\"true\" />}\n </div>\n <svg\n className={`size-5 ${active ? 'rotate-90' : ''}`}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n >\n <path d=\"M9 5L16 12L9 19\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </>\n )\n\n return href ? (\n <Link\n href={href}\n className={cn('flex cursor-pointer items-center justify-between py-4 no-underline', className)}\n onClick={onClick}\n >\n {content}\n </Link>\n ) : (\n <button\n onClick={onClick}\n className={cn(\n 'flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left',\n className\n )}\n aria-expanded={active}\n >\n {content}\n </button>\n )\n}\n\n/**\n * \u79FB\u52A8\u7AEF\u5B50\u5206\u7C7B\u6807\u9898\u7EC4\u4EF6\n */\nexport const SubSubCategoryItemComp = ({\n matchSeriesMetadata,\n onSubSubCategoryItemClick,\n expanded,\n}: {\n matchSeriesMetadata: any\n onSubSubCategoryItemClick?: () => void\n expanded?: boolean\n}) => {\n const content = (\n <>\n {matchSeriesMetadata?.label && (\n <Text html={matchSeriesMetadata?.label} className=\"text-sm font-bold leading-[1.4]\" />\n )}\n {onSubSubCategoryItemClick && (\n <DownArrow\n aria-hidden=\"true\"\n className={cn('size-5', {\n ['rotate-180']: expanded,\n })}\n />\n )}\n </>\n )\n\n return onSubSubCategoryItemClick ? (\n <button\n className=\"tablet:pt-0 flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left\"\n onClick={onSubSubCategoryItemClick}\n aria-expanded={expanded}\n >\n {content}\n </button>\n ) : (\n <div className=\"tablet:pt-0 flex items-center justify-between py-4\">{content}</div>\n )\n}\n\n/**\n * \u79FB\u52A8\u7AEF\u5B50\u5206\u7C7B\u5185\u5BB9\u7EC4\u4EF6\n */\nexport const SubSubCategoryContentComp = ({ matchSeriesMetadata }: { matchSeriesMetadata: any }) => {\n return (\n <div className=\"laptop:gap-3 flex flex-col gap-2\">\n {!!matchSeriesMetadata?.series?.length &&\n matchSeriesMetadata?.series?.map((seriesItem: any, pIndex: number) => (\n <div key={`seriesItem-${pIndex}`}>\n {seriesItem.label && (\n <Text html={seriesItem.label} as=\"p\" className=\"mb-2 text-sm font-bold leading-[1.4] text-[#3D3D3F]\" />\n )}\n <div className=\"laptop:grid-cols-3 laptop:gap-4 tablet:grid tablet:grid-cols-2 tablet:gap-3 flex flex-col gap-2\">\n {!!matchSeriesMetadata?.banner && (\n <Link asChild={!matchSeriesMetadata?.banner?.href} href={matchSeriesMetadata?.banner?.href}>\n <div className=\"relative [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500\">\n <Picture\n source={matchSeriesMetadata?.banner?.imageUrl}\n className=\"laptop:h-[120px] h-[114px]\"\n imgClassName=\"object-cover h-full\"\n />\n <div className=\"absolute inset-x-0 bottom-0 p-4\">\n <Heading\n size={2}\n html={matchSeriesMetadata?.banner?.title || 'Buy in Guide'}\n className={cn('font-bold text-white', {\n 'text-black': matchSeriesMetadata?.banner?.theme === 'dark',\n })}\n />\n <Text\n html={matchSeriesMetadata?.banner?.desc || '20.000mAh'}\n className={cn('text-sm font-bold text-white', {\n 'text-black': matchSeriesMetadata?.banner?.theme === 'dark',\n })}\n />\n </div>\n </div>\n </Link>\n )}\n {seriesItem.products?.map((product: any, index: number) => (\n <SeriesProductItem\n position={index}\n key={`seriesProductItem-${pIndex}-${index}`}\n product={product}\n seriesLabel={matchSeriesMetadata?.label}\n isCollection={matchSeriesMetadata?.isCollection}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,cAAAE,EAAA,8BAAAC,EAAA,2BAAAC,IAAA,eAAAC,EAAAL,GAyBI,IAAAM,EAAA,6BAzBJC,EAAkB,iBAClBC,EAA6C,qCAC7CC,EAAmB,kCACnBC,EAA0B,4BAC1BC,EAAkC,gCAK3B,MAAMT,EAAW,CAAC,CACvB,MAAAU,EACA,KAAAC,EACA,QAAAC,E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AsD,KAEvG,QAAC,OAAI,UAAU,kGACZ,WAAC,CAACH,GAAqB,WACtB,OAAC,QAAK,QAAS,CAACA,GAAqB,QAAQ,KAAM,KAAMA,GAAqB,QAAQ,KACpF,oBAAC,OAAI,UAAU,2FACb,oBAAC,WACC,OAAQA,GAAqB,QAAQ,SACrC,UAAU,6BACV,aAAa,sBACf,KACA,QAAC,OAAI,UAAU,kCACb,oBAAC,WACC,KAAM,EACN,KAAMA,GAAqB,QAAQ,OAAS,eAC5C,aAAW,MAAG,uBAAwB,CACpC,aAAcA,GAAqB,QAAQ,QAAU,MACvD,CAAC,EACH,KACA,OAAC,QACC,KAAMA,GAAqB,QAAQ,MAAQ,YAC3C,aAAW,MAAG,+BAAgC,CAC5C,aAAcA,GAAqB,QAAQ,QAAU,MACvD,CAAC,EACH,GACF,GACF,EACF,EAEDG,EAAW,UAAU,IAAI,CAACE,EAAcC,OACvC,OAAC,qBACC,SAAUA,EAEV,QAASD,EACT,YAAaL,GAAqB,MAClC,aAAcA,GAAqB,cAH9B,qBAAqBI,CAAM,IAAIE,CAAK,EAI3C,CACD,GACH,IAxCQ,cAAcF,CAAM,EAyC9B,CACD,EACL",
|
|
6
|
+
"names": ["MobileMenuComponents_exports", "__export", "MenuItem", "SubSubCategoryContentComp", "SubSubCategoryItemComp", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_utils", "import_icons", "import_SidebarDropdown", "label", "href", "onClick", "active", "icon", "className", "content", "matchSeriesMetadata", "onSubSubCategoryItemClick", "expanded", "seriesItem", "pIndex", "product", "index"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var r=Object.defineProperty;var n=Object.getOwnPropertyDescriptor;var b=Object.getOwnPropertyNames;var u=Object.prototype.hasOwnProperty;var s=(t,l)=>{for(var e in l)r(t,e,{get:l[e],enumerable:!0})},g=(t,l,e,a)=>{if(l&&typeof l=="object"||typeof l=="function")for(let o of b(l))!u.call(t,o)&&o!==e&&r(t,o,{get:()=>l[o],enumerable:!(a=n(l,o))||a.enumerable});return t};var d=t=>g(r({},"__esModule",{value:!0}),t);var y={};s(y,{MobileMulticolMenu:()=>f});module.exports=d(y);var p=require("react/jsx-runtime"),i=require("react"),m=require("../../helpers/utils.js"),c=require("./MulticolDropdown.js");const f=({multicolMetadata:t})=>{const l=(0,i.useMemo)(()=>!t?.some(e=>!!e.columns),[t]);return(0,p.jsx)("div",{className:(0,m.cn)("tablet:py-4 tablet:px-8 laptop:px-16 tablet:gap-6 flex flex-col gap-4 p-4",{"tablet:grid tablet:grid-cols-2 tablet:gap-3 laptop:gap-4":l}),children:t?.map((e,a)=>(0,p.jsx)("div",{children:(0,p.jsx)(c.MulticolItem,{item:e,allPicture:l})},`multicolItem-${e?.label}-${a}`))})};
|
|
2
|
+
//# sourceMappingURL=MobileMulticolMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/HeaderNavigation/MobileMulticolMenu.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useMemo } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { MulticolItem } from './MulticolDropdown.js'\n\n/**\n * \u79FB\u52A8\u7AEFmulticol\u83DC\u5355\n * @param multicolMetadata multicol\u83DC\u5355\u5143\u6570\u636E\n */\nexport const MobileMulticolMenu = ({ multicolMetadata }: { multicolMetadata: any }) => {\n // \u662F\u5426\u5168\u90E8\u662F\u56FE\u7247\n const allPicture = useMemo(() => {\n return !multicolMetadata?.some((item: any) => !!item.columns)\n }, [multicolMetadata])\n\n return (\n <div\n className={cn('tablet:py-4 tablet:px-8 laptop:px-16 tablet:gap-6 flex flex-col gap-4 p-4', {\n ['tablet:grid tablet:grid-cols-2 tablet:gap-3 laptop:gap-4']: allPicture,\n })}\n >\n {multicolMetadata?.map((item: any, index: number) => (\n <div key={`multicolItem-${item?.label}-${index}`}>\n <MulticolItem item={item} allPicture={allPicture} />\n </div>\n ))}\n </div>\n )\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,wBAAAE,IAAA,eAAAC,EAAAH,GAsBU,IAAAI,EAAA,6BAtBVC,EAA+B,iBAC/BC,EAAmB,kCACnBC,EAA6B,iCAMtB,MAAML,EAAqB,CAAC,CAAE,iBAAAM,CAAiB,IAAiC,CAErF,MAAMC,KAAa,WAAQ,IAClB,CAACD,GAAkB,KAAME,GAAc,CAAC,CAACA,EAAK,OAAO,EAC3D,CAACF,CAAgB,CAAC,EAErB,SACE,OAAC,OACC,aAAW,MAAG,4EAA6E,CACxF,2DAA6DC,CAChE,CAAC,EAEA,SAAAD,GAAkB,IAAI,CAACE,EAAWC,OACjC,OAAC,OACC,mBAAC,gBAAa,KAAMD,EAAM,WAAYD,EAAY,GAD1C,gBAAgBC,GAAM,KAAK,IAAIC,CAAK,EAE9C,CACD,EACH,CAEJ",
|
|
6
|
+
"names": ["MobileMulticolMenu_exports", "__export", "MobileMulticolMenu", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_MulticolDropdown", "multicolMetadata", "allPicture", "item", "index"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 移动端资源位侧边栏下拉
|
|
3
|
+
* @param resourceCategoriesMetadata 资源位分类元数据
|
|
4
|
+
* @param resourcesMetadata 资源位元数据
|
|
5
|
+
*/
|
|
6
|
+
export declare const MobileResourceSidebarMenu: ({ resourceCategoriesMetadata, resourcesMetadata, }: {
|
|
7
|
+
resourceCategoriesMetadata: any;
|
|
8
|
+
resourcesMetadata: any;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var g=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var L=Object.getOwnPropertyNames;var $=Object.prototype.hasOwnProperty;var B=(t,a)=>{for(var r in a)g(t,r,{get:a[r],enumerable:!0})},j=(t,a,r,i)=>{if(a&&typeof a=="object"||typeof a=="function")for(let l of L(a))!$.call(t,l)&&l!==r&&g(t,l,{get:()=>a[l],enumerable:!(i=M(a,l))||i.enumerable});return t};var z=t=>j(g({},"__esModule",{value:!0}),t);var I={};B(I,{MobileResourceSidebarMenu:()=>_});module.exports=z(I);var e=require("react/jsx-runtime"),s=require("react"),x=require("../../components/index.js"),d=require("./types.js"),R=require("./NavProvider.js"),c=require("./ResourceItem.js");const E=({label:t,onClick:a,active:r})=>(0,e.jsxs)("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left",onClick:a,"aria-expanded":r,children:[(0,e.jsx)("div",{className:"flex items-center gap-4",children:(0,e.jsx)("span",{className:"text-sm font-bold leading-[1.4]",children:t})}),(0,e.jsx)("svg",{className:`size-5 ${r?"rotate-90":""}`,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg","aria-hidden":"true",children:(0,e.jsx)("path",{d:"M9 5L16 12L9 19",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})]}),_=({resourceCategoriesMetadata:t,resourcesMetadata:a})=>{const{currentMenu:r,setCurrentMenu:i,subSubCategory:l,setSubSubCategory:h,onSidebarNavClick:m,currentResourceMetadata:p,setCurrentResourceMetadata:f}=(0,R.useNavContext)(),[S,k]=(0,s.useState)([]),[y,w]=(0,s.useState)([]);(0,s.useEffect)(()=>{t?.subcategories?.length&&k(t?.subcategories?.map((o,n)=>({index:n,open:!1})))},[t]),(0,s.useEffect)(()=>{l?.subSubCategories?.length&&w(l?.subSubCategories?.map((o,n)=>({index:n,open:n===0})))},[l]);const C=(0,s.useCallback)(o=>{h?.(o);const n=a?.find(b=>o?.label?.toLowerCase()===b.label?.toLowerCase())||{};i&&i(d.HeaderNavigationMenu.Third),f&&f(n)},[a,i,h,f]);return(0,s.useMemo)(()=>{switch(r){case d.HeaderNavigationMenu.Secondary:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 tablet:justify-start tablet:gap-16 flex h-full flex-col justify-between p-4",children:[(0,e.jsx)("div",{children:t?.subcategories?.map((o,n)=>(0,e.jsx)("div",{children:(0,e.jsx)(E,{label:o?.label,active:S.find(b=>b.index===n)?.open,onClick:()=>{C(o),m?.(o,n)}})},`${o.label}-${n}`))}),(0,e.jsxs)("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[t?.primary&&(0,e.jsx)(x.Button,{as:"a",href:`${t?.primary?.url}?ref=${t?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:t?.primary?.label}),t?.secondary&&(0,e.jsx)(x.Button,{as:"a",href:t?.secondary?.url,variant:"link",size:"lg",className:"tablet:w-auto tablet:px-0 w-full py-0 text-base",children:t?.secondary?.label})]})]});case d.HeaderNavigationMenu.Third:return(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:l?.subSubCategories?l?.subSubCategories?.map((o,n)=>{const b=a?.find(u=>u.label.toLowerCase()===o?.label?.toLowerCase())||{};return(0,e.jsxs)("div",{children:[Reflect.ownKeys(o).length>0&&(0,e.jsx)(c.ResourceSubSubCategoryItemComp,{matchResourcesMetadata:b,onSubSubCategoryItemClick:()=>{m?.(o,n),w(u=>u.map((v,N)=>({...v,open:N===n?!v.open:v.open})))},expanded:!!y?.find(u=>u.index===n)?.open}),y?.find(u=>u.index===n)?.open&&(0,e.jsx)(c.ResourceSubSubCategoryContentComp,{matchResourcesMetadata:b})]},`${o.label}-${n}`)}):(0,e.jsxs)(e.Fragment,{children:[Reflect.ownKeys(p).length>0&&(0,e.jsx)(c.ResourceSubSubCategoryItemComp,{matchResourcesMetadata:p}),(0,e.jsx)(c.ResourceSubSubCategoryContentComp,{matchResourcesMetadata:p})]})});default:return null}},[r,t,a,S,y,l,p,C,m])};
|
|
2
|
+
//# sourceMappingURL=MobileResourceSidebarMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/HeaderNavigation/MobileResourceSidebarMenu.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { Button } from '../../components/index.js'\nimport { HeaderNavigationMenu } from './types.js'\nimport { useNavContext } from './NavProvider.js'\nimport { ResourceSubSubCategoryItemComp, ResourceSubSubCategoryContentComp } from './ResourceItem.js'\n\ninterface MenuItem {\n label: string\n href?: string\n onClick?: () => void\n active?: boolean\n icon?: string\n className?: string\n}\n\nconst MenuItem = ({ label, onClick, active }: MenuItem) => {\n return (\n <button\n className=\"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent py-4 text-left\"\n onClick={onClick}\n aria-expanded={active}\n >\n <div className=\"flex items-center gap-4\">\n <span className=\"text-sm font-bold leading-[1.4]\">{label}</span>\n </div>\n <svg\n className={`size-5 ${active ? 'rotate-90' : ''}`}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n xmlns=\"http://www.w3.org/2000/svg\"\n aria-hidden=\"true\"\n >\n <path d=\"M9 5L16 12L9 19\" stroke=\"currentColor\" strokeWidth=\"2\" strokeLinecap=\"round\" strokeLinejoin=\"round\" />\n </svg>\n </button>\n )\n}\n\n/**\n * \u79FB\u52A8\u7AEF\u8D44\u6E90\u4F4D\u4FA7\u8FB9\u680F\u4E0B\u62C9\n * @param resourceCategoriesMetadata \u8D44\u6E90\u4F4D\u5206\u7C7B\u5143\u6570\u636E\n * @param resourcesMetadata \u8D44\u6E90\u4F4D\u5143\u6570\u636E\n */\nexport const MobileResourceSidebarMenu = ({\n resourceCategoriesMetadata,\n resourcesMetadata,\n}: {\n resourceCategoriesMetadata: any\n resourcesMetadata: any\n}) => {\n const {\n currentMenu,\n setCurrentMenu,\n subSubCategory,\n setSubSubCategory,\n onSidebarNavClick,\n currentResourceMetadata,\n setCurrentResourceMetadata,\n } = useNavContext()\n const [expandedSubcategory, setExpandedSubcategory] = useState<{ index: number; open: boolean }[]>([])\n const [expandedResourceCategories, setExpandedResourceCategories] = useState<{ index: number; open: boolean }[]>([])\n\n useEffect(() => {\n if (resourceCategoriesMetadata?.subcategories?.length) {\n setExpandedSubcategory(\n resourceCategoriesMetadata?.subcategories?.map((_: any, index: number) => ({\n index,\n open: false,\n }))\n )\n }\n }, [resourceCategoriesMetadata])\n\n useEffect(() => {\n if (subSubCategory?.subSubCategories?.length) {\n setExpandedResourceCategories(\n subSubCategory?.subSubCategories?.map((_: any, index: number) => ({\n index,\n open: index === 0,\n }))\n )\n }\n }, [subSubCategory])\n\n const handleSubSubCategoryClick = useCallback(\n (item: any) => {\n setSubSubCategory?.(item)\n const curResourcesMetadata =\n resourcesMetadata?.find(\n (resourceItem: any) => item?.label?.toLowerCase() === resourceItem.label?.toLowerCase()\n ) || {}\n setCurrentMenu && setCurrentMenu(HeaderNavigationMenu.Third)\n setCurrentResourceMetadata && setCurrentResourceMetadata(curResourcesMetadata)\n },\n [resourcesMetadata, setCurrentMenu, setSubSubCategory, setCurrentResourceMetadata]\n )\n\n const MobileResourceSidebarMenuComp = useMemo(() => {\n switch (currentMenu) {\n case HeaderNavigationMenu.Secondary:\n return (\n // \u4E8C\u7EA7\u83DC\u5355\n <div className=\"tablet:px-8 laptop:px-16 tablet:justify-start tablet:gap-16 flex h-full flex-col justify-between p-4\">\n <div>\n {resourceCategoriesMetadata?.subcategories?.map((item: any, index: number) => {\n return (\n <div key={`${item.label}-${index}`}>\n <MenuItem\n label={item?.label}\n active={expandedSubcategory.find(item => item.index === index)?.open}\n onClick={() => {\n handleSubSubCategoryClick(item)\n onSidebarNavClick?.(item, index)\n }}\n />\n </div>\n )\n })}\n </div>\n <div className=\"tablet:items-start flex flex-col items-center gap-4\">\n {resourceCategoriesMetadata?.primary && (\n <Button\n as=\"a\"\n href={`${resourceCategoriesMetadata?.primary?.url}?ref=${resourceCategoriesMetadata?.primary?.label}_shopall`}\n variant=\"primary\"\n size=\"lg\"\n className=\"tablet:w-auto w-full text-base\"\n >\n {resourceCategoriesMetadata?.primary?.label}\n </Button>\n )}\n {resourceCategoriesMetadata?.secondary && (\n <Button\n as=\"a\"\n href={resourceCategoriesMetadata?.secondary?.url}\n variant=\"link\"\n size=\"lg\"\n className=\"tablet:w-auto tablet:px-0 w-full py-0 text-base\"\n >\n {resourceCategoriesMetadata?.secondary?.label}\n </Button>\n )}\n </div>\n </div>\n )\n case HeaderNavigationMenu.Third:\n return (\n // \u4E09\u7EA7\u83DC\u5355\n <div className=\"tablet:px-8 laptop:px-16 p-4\">\n {subSubCategory?.subSubCategories ? (\n subSubCategory?.subSubCategories?.map((subSubCategoryItem: any, index: number) => {\n const curResourcesMetadata =\n resourcesMetadata?.find(\n (item: any) => item.label.toLowerCase() === subSubCategoryItem?.label?.toLowerCase()\n ) || {}\n return (\n <div key={`${subSubCategoryItem.label}-${index}`}>\n {Reflect.ownKeys(subSubCategoryItem).length > 0 && (\n <ResourceSubSubCategoryItemComp\n matchResourcesMetadata={curResourcesMetadata}\n onSubSubCategoryItemClick={() => {\n onSidebarNavClick?.(subSubCategoryItem, index)\n setExpandedResourceCategories(prev =>\n prev.map((item, i) => ({ ...item, open: i === index ? !item.open : item.open }))\n )\n }}\n expanded={!!expandedResourceCategories?.find(item => item.index === index)?.open}\n />\n )}\n {expandedResourceCategories?.find(item => item.index === index)?.open && (\n <ResourceSubSubCategoryContentComp matchResourcesMetadata={curResourcesMetadata} />\n )}\n </div>\n )\n })\n ) : (\n <>\n {Reflect.ownKeys(currentResourceMetadata).length > 0 && (\n <ResourceSubSubCategoryItemComp matchResourcesMetadata={currentResourceMetadata} />\n )}\n <ResourceSubSubCategoryContentComp matchResourcesMetadata={currentResourceMetadata} />\n </>\n )}\n </div>\n )\n default:\n return null\n }\n }, [\n currentMenu,\n resourceCategoriesMetadata,\n resourcesMetadata,\n expandedSubcategory,\n expandedResourceCategories,\n subSubCategory,\n currentResourceMetadata,\n handleSubSubCategoryClick,\n onSidebarNavClick,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YAAY,IAAMG,GAAoB,OAAO,YAAY,CACrF,GAAK,CAAC,EACR,SACE,QAAC,OACE,kBAAQ,QAAQA,CAAkB,EAAE,OAAS,MAC5C,OAAC,kCACC,uBAAwBF,EACxB,0BAA2B,IAAM,CAC/BX,IAAoBa,EAAoBL,CAAK,EAC7CF,EAA8BQ,GAC5BA,EAAK,IAAI,CAACJ,EAAMK,KAAO,CAAE,GAAGL,EAAM,KAAMK,IAAMP,EAAQ,CAACE,EAAK,KAAOA,EAAK,IAAK,EAAE,CACjF,CACF,EACA,SAAU,CAAC,CAACL,GAA4B,KAAKK,GAAQA,EAAK,QAAUF,CAAK,GAAG,KAC9E,EAEDH,GAA4B,KAAKK,GAAQA,EAAK,QAAUF,CAAK,GAAG,SAC/D,OAAC,qCAAkC,uBAAwBG,EAAsB,IAd3E,GAAGE,EAAmB,KAAK,IAAIL,CAAK,EAgB9C,CAEJ,CAAC,KAED,oBACG,kBAAQ,QAAQP,CAAuB,EAAE,OAAS,MACjD,OAAC,kCAA+B,uBAAwBA,EAAyB,KAEnF,OAAC,qCAAkC,uBAAwBA,EAAyB,GACtF,EAEJ,EAEJ,QACE,OAAO,IACX,CACF,EAAG,CACDL,EACAF,EACAC,EACAQ,EACAE,EACAP,EACAG,EACAQ,EACAT,CACF,CAAC,CAGH",
|
|
6
|
+
"names": ["MobileResourceSidebarMenu_exports", "__export", "MobileResourceSidebarMenu", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_types", "import_NavProvider", "import_ResourceItem", "MenuItem", "label", "onClick", "active", "resourceCategoriesMetadata", "resourcesMetadata", "currentMenu", "setCurrentMenu", "subSubCategory", "setSubSubCategory", "onSidebarNavClick", "currentResourceMetadata", "setCurrentResourceMetadata", "expandedSubcategory", "setExpandedSubcategory", "expandedResourceCategories", "setExpandedResourceCategories", "_", "index", "handleSubSubCategoryClick", "item", "curResourcesMetadata", "resourceItem", "subSubCategoryItem", "prev", "i"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 移动端侧边栏下拉
|
|
3
|
+
* @param sidebarCategoriesMetadata 侧边栏分类元数据
|
|
4
|
+
* @param seriesMetadata 侧边栏系列元数据
|
|
5
|
+
*/
|
|
6
|
+
export declare const MobileSidebarMenu: ({ sidebarCategoriesMetadata, seriesMetadata, }: {
|
|
7
|
+
sidebarCategoriesMetadata: any;
|
|
8
|
+
seriesMetadata: any;
|
|
9
|
+
}) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var x=Object.defineProperty;var B=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var D=Object.prototype.hasOwnProperty;var _=(l,r)=>{for(var d in r)x(l,d,{get:r[d],enumerable:!0})},E=(l,r,d,m)=>{if(r&&typeof r=="object"||typeof r=="function")for(let i of z(r))!D.call(l,i)&&i!==d&&x(l,i,{get:()=>r[i],enumerable:!(m=B(r,i))||m.enumerable});return l};var R=l=>E(x({},"__esModule",{value:!0}),l);var F={};_(F,{MobileSidebarMenu:()=>T});module.exports=R(F);var e=require("react/jsx-runtime"),c=require("react"),u=require("../../components/index.js"),f=require("./types.js"),L=require("./NavProvider.js"),p=require("./MobileMenuComponents.js");const T=({sidebarCategoriesMetadata:l,seriesMetadata:r})=>{const{currentMenu:d,setCurrentMenu:m,subSubCategory:i,setSubSubCategory:C,setCurrentSeriesMetadata:g,currentSeriesMetadata:s,buildProps:y,onSidebarNavClick:S}=(0,L.useNavContext)(),[N,$]=(0,c.useState)([]),[v,w]=(0,c.useState)([]);(0,c.useEffect)(()=>{l?.subcategories?.length&&$(l?.subcategories?.map((a,t)=>({index:t,open:!1})))},[l]),(0,c.useEffect)(()=>{i?.subSubCategories?.length&&w(i?.subSubCategories?.map((a,t)=>({index:t,open:t===0})))},[i]);const k=(0,c.useCallback)((a,t)=>{m&&m(f.HeaderNavigationMenu.Third),C?.(a);const o=r?.find(n=>t!==void 0?a?.subSubCategories?.[t]?.label?.toLowerCase()===n.label?.toLowerCase():a?.label?.toLowerCase()===n.label?.toLowerCase())||{};if(a?.collections){const n=y?.categories?.[a?.collections]||{};g?.({label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,guide:o?.guide,series:[{products:n?.products}]})}else g?.(o)},[r,m,C,g,y?.categories]),K=(0,c.useMemo)(()=>r?.find(a=>!!a?.guide)?.guide,[r]);return(0,c.useMemo)(()=>{switch(d){case f.HeaderNavigationMenu.Secondary:return(0,e.jsxs)("div",{className:"tablet:px-8 laptop:px-16 tablet:justify-start tablet:gap-16 flex h-full flex-col justify-between p-4",children:[(0,e.jsx)("div",{children:l?.subcategories?.map((a,t)=>(0,e.jsx)("div",{children:(0,e.jsx)(p.MenuItem,{label:a?.label,active:N.find(o=>o.index===t)?.open,onClick:()=>{k(a),S?.(a,t)}})},`${a.label}-${t}`))}),(0,e.jsxs)("div",{className:"tablet:items-start flex flex-col items-center gap-4",children:[l?.primary&&(0,e.jsx)(u.Button,{as:"a",href:`${l?.primary?.url}?ref=${l?.primary?.label}_shopall`,variant:"primary",size:"lg",className:"tablet:w-auto w-full text-base",children:l?.primary?.label}),l?.secondary&&(0,e.jsx)(u.Button,{as:"a",href:l?.secondary?.url,variant:"link",size:"lg",className:"tablet:w-auto tablet:px-0 w-full py-0 text-base",children:l?.secondary?.label})]})]});case f.HeaderNavigationMenu.Third:return(0,e.jsx)("div",{className:"tablet:px-8 laptop:px-16 p-4",children:i?.subSubCategories?i?.subSubCategories?.map((a,t)=>{const o=r?.find(b=>b.label.toLowerCase()===a?.label?.toLowerCase())||{};let n={};if(a?.collections){const b=y?.categories?.[a?.collections]||{};n={label:o?.label,isCollection:!0,banner:o?.banner,primary:o?.primary,guide:o?.guide,series:[{products:b?.products}]}}else n=o;return(0,e.jsxs)("div",{children:[Reflect.ownKeys(a).length>0&&(0,e.jsx)(p.SubSubCategoryItemComp,{matchSeriesMetadata:n,onSubSubCategoryItemClick:()=>{S?.(a,t),w(b=>b.map((h,M)=>({...h,open:M===t?!h.open:h.open})))},expanded:!!v?.find(b=>b.index===t)?.open}),v?.find(b=>b.index===t)?.open&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(p.SubSubCategoryContentComp,{matchSeriesMetadata:n}),n?.primary&&(0,e.jsx)("div",{className:"my-4 text-center",children:(0,e.jsx)(u.Button,{as:"a",href:n?.primary?.url,className:"text-base leading-[1.2] no-underline",variant:"secondary",size:"base",children:n?.primary?.label})})]}),n?.guide?.label&&(0,e.jsx)(u.Link,{href:n?.guide?.url,children:(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(u.Text,{html:n?.guide?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]},`${a.label}-${t}`)}):(0,e.jsxs)(e.Fragment,{children:[Reflect.ownKeys(s).length>0&&(0,e.jsx)(p.SubSubCategoryItemComp,{matchSeriesMetadata:s}),(0,e.jsx)(p.SubSubCategoryContentComp,{matchSeriesMetadata:s}),s?.primary&&(0,e.jsx)("div",{className:"my-4 text-center ",children:(0,e.jsx)(u.Button,{as:"a",href:`${s?.primary?.url}?ref=${s?.label}_viewmore`,variant:"secondary",size:"base",className:"text-base leading-[1.2] no-underline",children:s?.primary?.label})}),s?.guide?.label&&(0,e.jsx)(u.Link,{href:s?.guide?.url,children:(0,e.jsx)("div",{className:"mt-4",children:(0,e.jsx)(u.Text,{html:s?.guide?.label,className:"text-sm font-bold leading-[1.2] text-[#6D6D6F]"})})})]})});default:return null}},[d,l,r,N,v,i,s,y?.categories,k,S])};
|
|
2
|
+
//# sourceMappingURL=MobileSidebarMenu.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/HeaderNavigation/MobileSidebarMenu.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useEffect, useMemo, useState } from 'react'\nimport { Button, Text, Link } from '../../components/index.js'\nimport { HeaderNavigationMenu } from './types.js'\nimport { useNavContext } from './NavProvider.js'\nimport { MenuItem, SubSubCategoryItemComp, SubSubCategoryContentComp } from './MobileMenuComponents.js'\n\n/**\n * \u79FB\u52A8\u7AEF\u4FA7\u8FB9\u680F\u4E0B\u62C9\n * @param sidebarCategoriesMetadata \u4FA7\u8FB9\u680F\u5206\u7C7B\u5143\u6570\u636E\n * @param seriesMetadata \u4FA7\u8FB9\u680F\u7CFB\u5217\u5143\u6570\u636E\n */\nexport const MobileSidebarMenu = ({\n sidebarCategoriesMetadata,\n seriesMetadata,\n}: {\n sidebarCategoriesMetadata: any\n seriesMetadata: any\n}) => {\n const {\n currentMenu,\n setCurrentMenu,\n subSubCategory,\n setSubSubCategory,\n setCurrentSeriesMetadata,\n currentSeriesMetadata,\n buildProps,\n onSidebarNavClick,\n } = useNavContext()\n const [expandedSubcategory, setExpandedSubcategory] = useState<{ index: number; open: boolean }[]>([])\n const [expandedSeriesCategories, setExpandedSeriesCategories] = useState<{ index: number; open: boolean }[]>([])\n\n useEffect(() => {\n if (sidebarCategoriesMetadata?.subcategories?.length) {\n setExpandedSubcategory(\n sidebarCategoriesMetadata?.subcategories?.map((_: any, index: number) => ({\n index,\n open: false,\n }))\n )\n }\n }, [sidebarCategoriesMetadata])\n\n useEffect(() => {\n if (subSubCategory?.subSubCategories?.length) {\n setExpandedSeriesCategories(\n subSubCategory?.subSubCategories?.map((_: any, index: number) => ({\n index,\n open: index === 0,\n }))\n )\n }\n }, [subSubCategory])\n\n const handleSubSubCategoryClick = useCallback(\n (item: any, subIndex?: number) => {\n setCurrentMenu && setCurrentMenu(HeaderNavigationMenu.Third)\n setSubSubCategory?.(item)\n const curSeriesMetadata =\n seriesMetadata?.find((seriesItem: any) =>\n subIndex !== undefined\n ? item?.subSubCategories?.[subIndex]?.label?.toLowerCase() === seriesItem.label?.toLowerCase()\n : item?.label?.toLowerCase() === seriesItem.label?.toLowerCase()\n ) || {}\n // \u901A\u8FC7categoriesMetadata\u7684subSubCategories\u7684label\u4E0Eseries\u7684label\u5339\u914D\n if (item?.collections) {\n const category = buildProps?.categories?.[item?.collections] || {}\n setCurrentSeriesMetadata?.({\n label: curSeriesMetadata?.label,\n isCollection: true,\n banner: curSeriesMetadata?.banner,\n primary: curSeriesMetadata?.primary,\n guide: curSeriesMetadata?.guide,\n series: [\n {\n products: category?.products,\n },\n ],\n })\n } else {\n setCurrentSeriesMetadata?.(curSeriesMetadata)\n }\n },\n [seriesMetadata, setCurrentMenu, setSubSubCategory, setCurrentSeriesMetadata, buildProps?.categories]\n )\n\n const defaultGuide = useMemo(() => {\n return seriesMetadata?.find((item: any) => !!item?.guide)?.guide\n }, [seriesMetadata])\n\n const MobileSidebarMenuComp = useMemo(() => {\n switch (currentMenu) {\n case HeaderNavigationMenu.Secondary:\n return (\n // \u4E8C\u7EA7\u83DC\u5355\n <div className=\"tablet:px-8 laptop:px-16 tablet:justify-start tablet:gap-16 flex h-full flex-col justify-between p-4\">\n <div>\n {sidebarCategoriesMetadata?.subcategories?.map((item: any, index: number) => {\n return (\n <div key={`${item.label}-${index}`}>\n <MenuItem\n label={item?.label}\n active={expandedSubcategory.find(item => item.index === index)?.open}\n onClick={() => {\n handleSubSubCategoryClick(item)\n onSidebarNavClick?.(item, index)\n }}\n />\n </div>\n )\n })}\n </div>\n <div className=\"tablet:items-start flex flex-col items-center gap-4\">\n {sidebarCategoriesMetadata?.primary && (\n <Button\n as=\"a\"\n href={`${sidebarCategoriesMetadata?.primary?.url}?ref=${sidebarCategoriesMetadata?.primary?.label}_shopall`}\n variant=\"primary\"\n size=\"lg\"\n className=\"tablet:w-auto w-full text-base\"\n >\n {sidebarCategoriesMetadata?.primary?.label}\n </Button>\n )}\n {sidebarCategoriesMetadata?.secondary && (\n <Button\n as=\"a\"\n href={sidebarCategoriesMetadata?.secondary?.url}\n variant=\"link\"\n size=\"lg\"\n className=\"tablet:w-auto tablet:px-0 w-full py-0 text-base\"\n >\n {sidebarCategoriesMetadata?.secondary?.label}\n </Button>\n )}\n </div>\n </div>\n )\n case HeaderNavigationMenu.Third:\n return (\n // \u4E09\u7EA7\u83DC\u5355\n <div className=\"tablet:px-8 laptop:px-16 p-4\">\n {subSubCategory?.subSubCategories ? (\n subSubCategory?.subSubCategories?.map((subSubCategoryItem: any, index: number) => {\n const curSeriesMetadata =\n seriesMetadata?.find(\n (item: any) => item.label.toLowerCase() === subSubCategoryItem?.label?.toLowerCase()\n ) || {}\n let matchSeriesMetadata = {} as any\n if (subSubCategoryItem?.collections) {\n const category = buildProps?.categories?.[subSubCategoryItem?.collections] || {}\n matchSeriesMetadata = {\n label: curSeriesMetadata?.label,\n isCollection: true,\n banner: curSeriesMetadata?.banner,\n primary: curSeriesMetadata?.primary,\n guide: curSeriesMetadata?.guide,\n series: [\n {\n products: category?.products,\n },\n ],\n }\n } else {\n matchSeriesMetadata = curSeriesMetadata\n }\n return (\n <div key={`${subSubCategoryItem.label}-${index}`}>\n {Reflect.ownKeys(subSubCategoryItem).length > 0 && (\n <SubSubCategoryItemComp\n matchSeriesMetadata={matchSeriesMetadata}\n onSubSubCategoryItemClick={() => {\n onSidebarNavClick?.(subSubCategoryItem, index)\n setExpandedSeriesCategories(prev =>\n prev.map((item, i) => ({ ...item, open: i === index ? !item.open : item.open }))\n )\n }}\n expanded={!!expandedSeriesCategories?.find(item => item.index === index)?.open}\n />\n )}\n {expandedSeriesCategories?.find(item => item.index === index)?.open && (\n <>\n <SubSubCategoryContentComp matchSeriesMetadata={matchSeriesMetadata} />\n {matchSeriesMetadata?.primary && (\n <div className=\"my-4 text-center\">\n <Button\n as=\"a\"\n href={matchSeriesMetadata?.primary?.url}\n className=\"text-base leading-[1.2] no-underline\"\n variant=\"secondary\"\n size=\"base\"\n >\n {matchSeriesMetadata?.primary?.label}\n </Button>\n </div>\n )}\n </>\n )}\n {matchSeriesMetadata?.guide?.label && (\n <Link href={matchSeriesMetadata?.guide?.url}>\n <div className=\"mt-4\">\n <Text\n html={matchSeriesMetadata?.guide?.label}\n className=\"text-sm font-bold leading-[1.2] text-[#6D6D6F]\"\n />\n </div>\n </Link>\n )}\n </div>\n )\n })\n ) : (\n <>\n {Reflect.ownKeys(currentSeriesMetadata).length > 0 && (\n <SubSubCategoryItemComp matchSeriesMetadata={currentSeriesMetadata} />\n )}\n <SubSubCategoryContentComp matchSeriesMetadata={currentSeriesMetadata} />\n {currentSeriesMetadata?.primary && (\n <div className=\"my-4 text-center \">\n <Button\n as=\"a\"\n href={`${currentSeriesMetadata?.primary?.url}?ref=${currentSeriesMetadata?.label}_viewmore`}\n variant=\"secondary\"\n size=\"base\"\n className=\"text-base leading-[1.2] no-underline\"\n >\n {currentSeriesMetadata?.primary?.label}\n </Button>\n </div>\n )}\n {currentSeriesMetadata?.guide?.label && (\n <Link href={currentSeriesMetadata?.guide?.url}>\n <div className=\"mt-4\">\n <Text\n html={currentSeriesMetadata?.guide?.label}\n className=\"text-sm font-bold leading-[1.2] text-[#6D6D6F]\"\n />\n </div>\n </Link>\n )}\n </>\n )}\n </div>\n )\n default:\n return null\n }\n }, [\n currentMenu,\n sidebarCategoriesMetadata,\n seriesMetadata,\n expandedSubcategory,\n expandedSeriesCategories,\n subSubCategory,\n currentSeriesMetadata,\n buildProps?.categories,\n handleSubSubCategoryClick,\n onSidebarNavClick,\n ])\n\n return MobileSidebarMenuComp\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,uBAAAE,IAAA,eAAAC,EAAAH,GAmGoB,IAAAI,EAAA,6BAnGpBC,EAAiE,iBACjEC,EAAmC,qCACnCC,EAAqC,sBACrCC,EAA8B,4BAC9BC,EAA4E,qCAOrE,MAAMP,EAAoB,CAAC,CAChC,0BAAAQ,EACA,eAAAC,CACF,IAGM,CACJ,KAAM,CACJ,YAAAC,EACA,eAAAC,EACA,eAAAC,EACA,kBAAAC,EACA,yBAAAC,EACA,sBAAAC,EACA,WAAAC,EACA,kBAAAC,CACF,KAAI,iBAAc,EACZ,CAACC,EA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OACb,mBAAC,QACC,KAAMA,GAAuB,OAAO,MACpC,UAAU,iDACZ,EACF,EACF,GAEJ,EAEJ,EAEJ,QACE,OAAO,IACX,CACF,EAAG,CACDL,EACAF,EACAC,EACAS,EACAE,EACAR,EACAG,EACAC,GAAY,WACZQ,EACAP,CACF,CAAC,CAGH",
|
|
6
|
+
"names": ["MobileSidebarMenu_exports", "__export", "MobileSidebarMenu", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_types", "import_NavProvider", "import_MobileMenuComponents", "sidebarCategoriesMetadata", "seriesMetadata", "currentMenu", "setCurrentMenu", "subSubCategory", "setSubSubCategory", "setCurrentSeriesMetadata", "currentSeriesMetadata", "buildProps", "onSidebarNavClick", "expandedSubcategory", "setExpandedSubcategory", "expandedSeriesCategories", "setExpandedSeriesCategories", "_", "index", "handleSubSubCategoryClick", "item", "subIndex", "curSeriesMetadata", "seriesItem", "category", "defaultGuide", "subSubCategoryItem", "matchSeriesMetadata", "prev", "i"]
|
|
7
|
+
}
|