@anker-in/headless-ui 1.1.67 → 1.1.68
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/BuyOneGetOneShelf/index.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js.map +2 -2
- package/dist/cjs/biz-components/FeaturedBlogPosts/index.d.ts +56 -0
- package/dist/cjs/biz-components/FeaturedBlogPosts/index.js +2 -0
- package/dist/cjs/biz-components/FeaturedBlogPosts/index.js.map +7 -0
- package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/SidebarDropdown.js.map +3 -3
- package/dist/cjs/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/cjs/biz-components/HeaderNavigation/index.js.map +2 -2
- 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/Listing/utils/index.js +1 -1
- package/dist/cjs/biz-components/Listing/utils/index.js.map +3 -3
- package/dist/cjs/biz-components/MediaEndorsement/index.d.ts +11 -0
- package/dist/cjs/biz-components/MediaEndorsement/index.js +23 -0
- package/dist/cjs/biz-components/MediaEndorsement/index.js.map +7 -0
- package/dist/cjs/biz-components/MediaEndorsement/types.d.ts +44 -0
- package/dist/cjs/biz-components/MediaEndorsement/types.js +2 -0
- package/dist/cjs/biz-components/MediaEndorsement/types.js.map +7 -0
- package/dist/cjs/biz-components/MediaSceneSwitcherV2/index.d.ts +59 -0
- package/dist/cjs/biz-components/MediaSceneSwitcherV2/index.js +2 -0
- package/dist/cjs/biz-components/MediaSceneSwitcherV2/index.js.map +7 -0
- package/dist/cjs/biz-components/MediaShelf/ProductCard.d.ts +2 -0
- package/dist/cjs/biz-components/MediaShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/MediaShelf/ProductCard.js.map +3 -3
- package/dist/cjs/biz-components/MediaShelf/index.js +1 -1
- package/dist/cjs/biz-components/MediaShelf/index.js.map +3 -3
- package/dist/cjs/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/index.js.map +3 -3
- package/dist/cjs/biz-components/index.d.ts +7 -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/BuyOneGetOneShelf/index.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js.map +2 -2
- package/dist/esm/biz-components/FeaturedBlogPosts/index.d.ts +56 -0
- package/dist/esm/biz-components/FeaturedBlogPosts/index.js +2 -0
- package/dist/esm/biz-components/FeaturedBlogPosts/index.js.map +7 -0
- package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/SidebarDropdown.js.map +3 -3
- package/dist/esm/biz-components/HeaderNavigation/index.js +1 -1
- package/dist/esm/biz-components/HeaderNavigation/index.js.map +2 -2
- 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/Listing/utils/index.js +1 -1
- package/dist/esm/biz-components/Listing/utils/index.js.map +3 -3
- package/dist/esm/biz-components/MediaEndorsement/index.d.ts +11 -0
- package/dist/esm/biz-components/MediaEndorsement/index.js +23 -0
- package/dist/esm/biz-components/MediaEndorsement/index.js.map +7 -0
- package/dist/esm/biz-components/MediaEndorsement/types.d.ts +44 -0
- package/dist/esm/biz-components/MediaEndorsement/types.js +1 -0
- package/dist/esm/biz-components/MediaEndorsement/types.js.map +7 -0
- package/dist/esm/biz-components/MediaSceneSwitcherV2/index.d.ts +59 -0
- package/dist/esm/biz-components/MediaSceneSwitcherV2/index.js +2 -0
- package/dist/esm/biz-components/MediaSceneSwitcherV2/index.js.map +7 -0
- package/dist/esm/biz-components/MediaShelf/ProductCard.d.ts +2 -0
- package/dist/esm/biz-components/MediaShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/MediaShelf/ProductCard.js.map +3 -3
- package/dist/esm/biz-components/MediaShelf/index.js +1 -1
- package/dist/esm/biz-components/MediaShelf/index.js.map +3 -3
- package/dist/esm/biz-components/ShelfDisplay/index.js +1 -1
- package/dist/esm/biz-components/ShelfDisplay/index.js.map +3 -3
- package/dist/esm/biz-components/index.d.ts +7 -0
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +2 -2
- package/package.json +1 -1
- package/dist/cjs/biz-components/ShelfDisplay/tabSwitch.d.ts +0 -9
- package/dist/cjs/biz-components/ShelfDisplay/tabSwitch.js +0 -2
- package/dist/cjs/biz-components/ShelfDisplay/tabSwitch.js.map +0 -7
- package/dist/esm/biz-components/ShelfDisplay/tabSwitch.d.ts +0 -9
- package/dist/esm/biz-components/ShelfDisplay/tabSwitch.js +0 -2
- package/dist/esm/biz-components/ShelfDisplay/tabSwitch.js.map +0 -7
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/HeaderNavigation/SidebarDropdown.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { Button, Container, Text, Link, Heading, Picture } from '../../components/index.js'\nimport { cn, atobID, getLocalizedPath } from '../../helpers/utils.js'\nimport { DownArrow } from './icons/index.js'\nimport { useNavContext } from './NavProvider.js'\nimport type { Product, ProductVariant } from '../../cpn-components/CpnProductCard/types.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\n\n/**\n * \u4FA7\u8FB9\u680F\u4E0B\u62C9\n * @param categoriesItem \u5206\u7C7B\u9879\n */\nexport const SidebarDropdown = React.memo(\n ({ sidebarCategoriesMetadata, seriesMetadata }: { sidebarCategoriesMetadata: any; seriesMetadata: any }) => {\n const { buildProps, onSidebarNavClick } = useNavContext()\n const { locale = 'us' } = useAiuiContext()\n const [expandedSubcategory, setExpandedSubcategory] = useState<{ index: number; open: boolean }[]>([])\n const [activeSubSubcategoryIndex, setActiveSubSubcategoryIndex] = useState(-1)\n const sidebarDropdownRef = useRef<HTMLDivElement>(null)\n\n const initExpandedSubcategory = useCallback(() => {\n const subcategories = sidebarCategoriesMetadata?.subcategories\n if (!subcategories?.length) return\n\n const withSubSubCategoriesIndex = subcategories.findIndex((item: any) => !!item?.subSubCategories)\n const withoutSubSubCategoriesIndex = subcategories.findIndex((item: any) => !item?.subSubCategories)\n\n // \u521B\u5EFA\u5C55\u5F00\u72B6\u6001\u6570\u7EC4\n const expandedStates = subcategories.map((_: any, index: number) => ({\n index,\n open: withSubSubCategoriesIndex === index || withoutSubSubCategoriesIndex === index,\n }))\n\n setExpandedSubcategory(expandedStates)\n }, [sidebarCategoriesMetadata])\n\n useEffect(() => {\n initExpandedSubcategory()\n }, [initExpandedSubcategory])\n\n // \u901A\u8FC7categoriesMetadata\u7684subSubCategories\u7684label\u4E0Eseries\u7684label\u5339\u914D\n const matchSeriesMetadata = useMemo(() => {\n const subCategory =\n sidebarCategoriesMetadata?.subcategories?.[expandedSubcategory?.find(item => item.open)?.index || 0]\n const currentSeriesMetadata =\n seriesMetadata?.find((item: any) => item?.label?.toLowerCase() === subCategory?.label?.toLowerCase()) || {}\n if (subCategory?.collections) {\n const category = buildProps?.categories?.[subCategory?.collections] || {}\n return {\n label: currentSeriesMetadata?.label,\n isCollection: true,\n banner: currentSeriesMetadata?.banner,\n primary: currentSeriesMetadata?.primary,\n series: [\n {\n products: category?.products,\n },\n ],\n }\n } else {\n if (subCategory?.subSubCategories) {\n const activeSubSubcategory = subCategory?.subSubCategories?.[activeSubSubcategoryIndex]\n const currentActiveSeriesMetadata =\n seriesMetadata?.find(\n (item: any) => item?.label?.toLowerCase() === activeSubSubcategory?.label?.toLowerCase()\n ) || {}\n if (activeSubSubcategory?.collections) {\n const category = buildProps?.categories?.[activeSubSubcategory?.collections] || {}\n return {\n label: currentActiveSeriesMetadata?.label,\n isCollection: true,\n banner: currentActiveSeriesMetadata?.banner,\n primary: currentActiveSeriesMetadata?.primary,\n series: [\n {\n products: category?.products,\n },\n ],\n }\n } else {\n return currentActiveSeriesMetadata\n }\n } else {\n return currentSeriesMetadata\n }\n }\n }, [sidebarCategoriesMetadata, expandedSubcategory, activeSubSubcategoryIndex, seriesMetadata, buildProps])\n\n const handleSubcategoryOpen = useCallback((index: number, subcategoryItem: any) => {\n const hasSubSubCategories = subcategoryItem?.subSubCategories?.length > 0\n hasSubSubCategories ? setActiveSubSubcategoryIndex(0) : setActiveSubSubcategoryIndex(-1)\n\n setExpandedSubcategory(prev =>\n prev.map((item, i) => ({\n ...item,\n open: i === index ? !item.open : hasSubSubCategories ? false : item.open,\n }))\n )\n }, [])\n\n const handleSubSubcategoryOpen = (index: number, subSubindex: number) => {\n setExpandedSubcategory(prev =>\n prev.map(item => (item.index === index ? { ...item, open: true } : { ...item, open: false }))\n )\n setActiveSubSubcategoryIndex(subSubindex)\n }\n\n return (\n <Container childClassName=\"lg-desktop:gap-12 flex bg-white gap-8\">\n <div\n className=\"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4\"\n style={{\n userSelect: 'none',\n }}\n ref={sidebarDropdownRef}\n >\n <div\n className=\"desktop:h-[416px] flex flex-col overflow-y-auto\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n {sidebarCategoriesMetadata?.subcategories?.map((subItem: any, index: number) => {\n const hasSubSubCategory =\n Array.isArray(subItem?.subSubCategories) && subItem?.subSubCategories?.length > 0\n const isExpanded = expandedSubcategory?.find(item => item.index === index)?.open\n return (\n <div key={`${subItem?.label || ''}subcategoryItem-${index}`}>\n <button\n className={cn(\n 'rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left',\n {\n 'bg-[#F5F5F7]': !hasSubSubCategory && isExpanded,\n }\n )}\n onClick={() => {\n handleSubcategoryOpen(index, subItem)\n onSidebarNavClick?.(subItem, index)\n }}\n aria-expanded={hasSubSubCategory ? isExpanded : undefined}\n aria-haspopup={hasSubSubCategory ? 'true' : undefined}\n >\n <Text html={subItem.label} className=\"p-4 text-sm font-bold leading-[1.4]\" />\n {hasSubSubCategory && (\n <DownArrow\n aria-hidden=\"true\"\n className={cn('size-4', {\n ['rotate-180']: isExpanded,\n })}\n />\n )}\n </button>\n {isExpanded && (\n <div className=\"flex flex-col\" role=\"menu\">\n {subItem.subSubCategories?.map((subSubItem: any, subSubindex: number) => (\n <button\n onClick={() => {\n handleSubSubcategoryOpen(index, subSubindex)\n onSidebarNavClick?.(subSubItem, subSubindex)\n }}\n key={`subSubItem-${index}-${subSubindex}`}\n className={cn(\n 'rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]',\n {\n 'bg-[#F5F5F7]': activeSubSubcategoryIndex === subSubindex,\n }\n )}\n role=\"menuitem\"\n aria-label={subSubItem.label}\n >\n <Text html={subSubItem.label} className=\"text-sm font-bold leading-[1.4] text-[#4A4C56]\" />\n </button>\n ))}\n </div>\n )}\n </div>\n )\n })}\n </div>\n {sidebarCategoriesMetadata && (\n <div className=\"flex\">\n <div className=\"flex flex-col gap-4\">\n {sidebarCategoriesMetadata?.primary && (\n <Button\n as=\"a\"\n href={`${getLocalizedPath(sidebarCategoriesMetadata?.primary?.url, locale)}?ref=${sidebarCategoriesMetadata?.primary?.label}_shopall`}\n variant=\"primary\"\n size=\"lg\"\n className=\"lg-desktop:text-base text-sm\"\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 iconClassName=\"size-4\"\n className=\"lg-desktop:text-base justify-start !p-0 text-sm\"\n >\n {sidebarCategoriesMetadata?.secondary?.label}\n </Button>\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"flex-1 py-4\">\n {Reflect.ownKeys(matchSeriesMetadata).length > 0 && (\n <div className=\"mb-4 flex items-center justify-between\">\n {(() => {\n const labelContent = (\n <>\n <Text\n html={matchSeriesMetadata?.label}\n className=\"lg-desktop:text-2xl text-xl font-bold leading-[1.4]\"\n />\n {matchSeriesMetadata?.primary && !matchSeriesMetadata?.primary?.hide && (\n <Text\n className=\"lg-desktop:text-base text-sm font-bold leading-[1.2]\"\n html={matchSeriesMetadata?.primary?.label}\n />\n )}\n </>\n )\n\n return matchSeriesMetadata?.primary?.url ? (\n <Button\n as=\"a\"\n href={`${getLocalizedPath(matchSeriesMetadata?.primary?.url, locale)}?ref=${matchSeriesMetadata?.label}_viewmore`}\n variant=\"link\"\n size=\"lg\"\n iconClassName=\"size-4\"\n className=\"flex items-center justify-start gap-2 !p-0 no-underline\"\n >\n {labelContent}\n </Button>\n ) : (\n <div className=\"flex items-center gap-2\">{labelContent}</div>\n )\n })()}\n {sidebarCategoriesMetadata?.guide?.label && (\n <Link\n href={getLocalizedPath(sidebarCategoriesMetadata?.guide?.url, locale)}\n className=\"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]\"\n >\n {sidebarCategoriesMetadata?.guide?.label}\n </Link>\n )}\n </div>\n )}\n <div\n className=\"flex h-[426px] flex-col gap-4 overflow-y-auto\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n {matchSeriesMetadata?.series?.map((seriesItem: any, seriesIndex: number) => (\n <div key={`seriesItem-${seriesItem?.label || ''}-${seriesIndex}`}>\n {seriesItem.label && (\n <Text\n html={seriesItem.label}\n as=\"p\"\n className=\"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]\"\n />\n )}\n <div className=\"grid grid-cols-3 gap-4\">\n {!!matchSeriesMetadata?.banner && (\n <Link\n asChild={!matchSeriesMetadata?.banner?.href}\n href={getLocalizedPath(matchSeriesMetadata?.banner?.href, locale)}\n >\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 seriesLabel={matchSeriesMetadata?.label}\n key={`seriesProductItem-${seriesItem?.label || ''}-${seriesIndex}-${index}`}\n product={product}\n isCollection={matchSeriesMetadata?.isCollection}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n </Container>\n )\n }\n)\n\nSidebarDropdown.displayName = 'SidebarDropdown'\n\n/**\n * \u7CFB\u5217\u4EA7\u54C1\u9879\u7EC4\u4EF6\n */\nexport const SeriesProductItem = ({\n product,\n isCollection,\n position,\n seriesLabel,\n}: {\n product: any\n isCollection?: boolean\n position?: number\n seriesLabel?: string\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { buildProps, onSeriesProductClick } = useNavContext()\n let productData = isCollection\n ? product\n : buildProps?.products?.find((item: Product) => item.handle === product.handle)\n const variant =\n productData?.variants?.find((item: ProductVariant) => item.sku === product.sku) || productData?.variants?.[0]\n\n const listingLink = useMemo(() => {\n return `${getLocalizedPath(`/products/${productData?.handle}`, locale)}?variant=${atobID(variant?.id as string)}`\n }, [productData?.handle, variant?.id, locale])\n\n const tags = useMemo(() => {\n return productData?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n }, [productData?.tags])\n\n if (!variant?.availableForSale) return null\n\n return (\n <Link\n href={listingLink}\n onClick={e => {\n e.preventDefault()\n window.open(listingLink, '_self')\n onSeriesProductClick?.(productData, position || 0, seriesLabel)\n }}\n className=\"no-underline hover:text-current\"\n >\n <div className=\"rounded-sidebar-shelf flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110 [&_img]:hover:duration-500\">\n <div className=\"shrink-0\">\n <img\n src={`${variant?.image?.url || product?.images?.[0]?.url}&width=200`}\n loading=\"lazy\"\n alt={productData?.title || product?.name}\n width={90}\n height={90}\n className=\"size-[96px] object-contain\"\n />\n </div>\n <div className=\"relative\">\n <div className=\"flex gap-1\">\n {Array.isArray(tags) &&\n tags?.map((tag: string, index: number) => (\n <Text\n key={index}\n as=\"p\"\n html={tag}\n className=\"text-brand-0 mb-1 inline-block h-[24px] whitespace-nowrap rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-xs font-bold !leading-[22px]\"\n />\n ))}\n </div>\n <Text\n className=\"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]\"\n html={product?.custom_name || variant?.metafields?.infos?.page_short_title || productData?.title}\n />\n {product?.desc && (\n <Text\n as=\"p\"\n html={product?.desc}\n className=\"lg-desktop:text-sm mt-1 line-clamp-1 text-xs font-bold leading-[1.4] text-[#6D6D6F]\"\n />\n )}\n </div>\n </div>\n </Link>\n )\n}\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "Button", "Container", "Text", "Link", "Heading", "Picture", "cn", "atobID", "getLocalizedPath", "DownArrow", "useNavContext", "useAiuiContext", "SidebarDropdown", "sidebarCategoriesMetadata", "seriesMetadata", "buildProps", "onSidebarNavClick", "locale", "expandedSubcategory", "setExpandedSubcategory", "activeSubSubcategoryIndex", "setActiveSubSubcategoryIndex", "sidebarDropdownRef", "initExpandedSubcategory", "subcategories", "withSubSubCategoriesIndex", "item", "withoutSubSubCategoriesIndex", "expandedStates", "_", "index", "matchSeriesMetadata", "subCategory", "currentSeriesMetadata", "category", "activeSubSubcategory", "currentActiveSeriesMetadata", "handleSubcategoryOpen", "subcategoryItem", "hasSubSubCategories", "prev", "i", "handleSubSubcategoryOpen", "subSubindex", "subItem", "hasSubSubCategory", "isExpanded", "subSubItem", "labelContent", "seriesItem", "seriesIndex", "product", "SeriesProductItem", "isCollection", "position", "seriesLabel", "onSeriesProductClick", "productData", "variant", "listingLink", "tags", "tag"]
|
|
4
|
+
"sourcesContent": ["import React, { useCallback, useEffect, useMemo, useRef, useState } from 'react'\nimport { Button, Container, Text, Link, Heading, Picture } from '../../components/index.js'\nimport { cn, atobID, getLocalizedPath } from '../../helpers/utils.js'\nimport { DownArrow } from './icons/index.js'\nimport { useNavContext } from './NavProvider.js'\nimport type { Product, ProductVariant } from '../../cpn-components/CpnProductCard/types.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\n\n/**\n * \u4FA7\u8FB9\u680F\u4E0B\u62C9\n * @param categoriesItem \u5206\u7C7B\u9879\n */\nexport const SidebarDropdown = React.memo(\n ({ sidebarCategoriesMetadata, seriesMetadata }: { sidebarCategoriesMetadata: any; seriesMetadata: any }) => {\n const { buildProps, onSidebarNavClick } = useNavContext()\n const { locale = 'us' } = useAiuiContext()\n const [expandedSubcategory, setExpandedSubcategory] = useState<{ index: number; open: boolean }[]>([])\n const [activeSubSubcategoryIndex, setActiveSubSubcategoryIndex] = useState(-1)\n const sidebarDropdownRef = useRef<HTMLDivElement>(null)\n const lastClickRef = useRef<{ index: number; hasSubSubCategories: boolean } | null>(null)\n\n const initExpandedSubcategory = useCallback(() => {\n const subcategories = sidebarCategoriesMetadata?.subcategories\n if (!subcategories?.length) return\n\n const withSubSubCategoriesIndex = subcategories.findIndex((item: any) => !!item?.subSubCategories)\n const withoutSubSubCategoriesIndex = subcategories.findIndex((item: any) => !item?.subSubCategories)\n\n // \u521B\u5EFA\u5C55\u5F00\u72B6\u6001\u6570\u7EC4\n const expandedStates = subcategories.map((_: any, index: number) => ({\n index,\n open: withSubSubCategoriesIndex === index || withoutSubSubCategoriesIndex === index,\n }))\n\n setExpandedSubcategory(expandedStates)\n }, [sidebarCategoriesMetadata])\n\n useEffect(() => {\n initExpandedSubcategory()\n }, [initExpandedSubcategory])\n\n // \u901A\u8FC7categoriesMetadata\u7684subSubCategories\u7684label\u4E0Eseries\u7684label\u5339\u914D\n const matchSeriesMetadata = useMemo(() => {\n const subCategory =\n sidebarCategoriesMetadata?.subcategories?.[expandedSubcategory?.find(item => item.open)?.index || 0]\n const currentSeriesMetadata =\n seriesMetadata?.find((item: any) => item?.label?.toLowerCase() === subCategory?.label?.toLowerCase()) || {}\n if (subCategory?.collections) {\n const category = buildProps?.categories?.[subCategory?.collections] || {}\n return {\n label: currentSeriesMetadata?.label,\n isCollection: true,\n banner: currentSeriesMetadata?.banner,\n primary: currentSeriesMetadata?.primary,\n series: [\n {\n products: category?.products,\n },\n ],\n }\n } else {\n if (subCategory?.subSubCategories) {\n const activeSubSubcategory = subCategory?.subSubCategories?.[activeSubSubcategoryIndex]\n const currentActiveSeriesMetadata =\n seriesMetadata?.find(\n (item: any) => item?.label?.toLowerCase() === activeSubSubcategory?.label?.toLowerCase()\n ) || {}\n if (activeSubSubcategory?.collections) {\n const category = buildProps?.categories?.[activeSubSubcategory?.collections] || {}\n return {\n label: currentActiveSeriesMetadata?.label,\n isCollection: true,\n banner: currentActiveSeriesMetadata?.banner,\n primary: currentActiveSeriesMetadata?.primary,\n series: [\n {\n products: category?.products,\n },\n ],\n }\n } else {\n return currentActiveSeriesMetadata\n }\n } else {\n return currentSeriesMetadata\n }\n }\n }, [sidebarCategoriesMetadata, expandedSubcategory, activeSubSubcategoryIndex, seriesMetadata, buildProps])\n\n const handleSubcategoryOpen = useCallback(\n (index: number, subcategoryItem: any) => {\n const hasSubSubCategories = subcategoryItem?.subSubCategories?.length > 0\n hasSubSubCategories ? setActiveSubSubcategoryIndex(0) : setActiveSubSubcategoryIndex(-1)\n\n const lastClick = lastClickRef.current\n\n setExpandedSubcategory(prev =>\n prev.map((item, i) => {\n if (i === index) {\n return { ...item, open: !item.open }\n }\n // \u5982\u679C\u5F53\u524D\u70B9\u51FB\u7684\u9879\u6709\u5B50\u5B50\u5206\u7C7B\uFF0C\u5173\u95ED\u5176\u4ED6\u6240\u6709\u9879\n if (hasSubSubCategories) {\n return { ...item, open: false }\n }\n if (!lastClick && activeSubSubcategoryIndex === -1) {\n return { ...item, open: false }\n }\n if (\n lastClick &&\n !lastClick.hasSubSubCategories &&\n !hasSubSubCategories &&\n activeSubSubcategoryIndex === -1\n ) {\n // \u5982\u679C\u4E0A\u4E00\u6B21\u70B9\u51FB\u7684\u9879\u6CA1\u6709\u5B50\u5B50\u5206\u7C7B\uFF0C\u4E14\u8FD9\u6B21\u70B9\u51FB\u7684\u4E5F\u6CA1\u6709\u5B50\u5B50\u5206\u7C7B\uFF0C\u5E76\u4E14\u6CA1\u6709\u70B9\u51FB\u4E0A\u4E00\u6B21\u6CA1\u6709subSubCategories\u7684item \u5173\u95ED\u4E0A\u4E00\u6B21\u7684\u9879\n return { ...item, open: false }\n }\n return item\n })\n )\n\n // \u66F4\u65B0\u4E0A\u4E00\u6B21\u70B9\u51FB\u7684\u72B6\u6001\n lastClickRef.current = { index, hasSubSubCategories }\n },\n [activeSubSubcategoryIndex]\n )\n\n const handleSubSubcategoryOpen = (index: number, subSubindex: number) => {\n setExpandedSubcategory(prev =>\n prev.map(item => (item.index === index ? { ...item, open: true } : { ...item, open: false }))\n )\n setActiveSubSubcategoryIndex(subSubindex)\n }\n\n return (\n <Container childClassName=\"lg-desktop:gap-12 flex bg-white gap-8\">\n <div\n className=\"lg-desktop:basis-[356px] flex basis-[284px] flex-col gap-4 py-4\"\n style={{\n userSelect: 'none',\n }}\n ref={sidebarDropdownRef}\n >\n <div\n className=\"desktop:h-[416px] flex flex-col overflow-y-auto\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n {sidebarCategoriesMetadata?.subcategories?.map((subItem: any, index: number) => {\n const hasSubSubCategory =\n Array.isArray(subItem?.subSubCategories) && subItem?.subSubCategories?.length > 0\n const isExpanded = expandedSubcategory?.find(item => item.index === index)?.open\n return (\n <div key={`${subItem?.label || ''}subcategoryItem-${index}`}>\n <button\n className={cn(\n 'rounded-sidebar-shelf flex w-full cursor-pointer items-center justify-between border-0 bg-transparent text-left',\n {\n 'bg-[#F5F5F7]': !hasSubSubCategory && isExpanded,\n }\n )}\n onClick={() => {\n handleSubcategoryOpen(index, subItem)\n onSidebarNavClick?.(subItem, index)\n }}\n aria-expanded={hasSubSubCategory ? isExpanded : undefined}\n aria-haspopup={hasSubSubCategory ? 'true' : undefined}\n >\n <Text html={subItem.label} className=\"p-4 text-sm font-bold leading-[1.4]\" />\n {hasSubSubCategory && (\n <DownArrow\n aria-hidden=\"true\"\n className={cn('size-4', {\n ['rotate-180']: isExpanded,\n })}\n />\n )}\n </button>\n {isExpanded && (\n <div className=\"flex flex-col\" role=\"menu\">\n {subItem.subSubCategories?.map((subSubItem: any, subSubindex: number) => (\n <button\n onClick={() => {\n handleSubSubcategoryOpen(index, subSubindex)\n onSidebarNavClick?.(subSubItem, subSubindex)\n }}\n key={`subSubItem-${index}-${subSubindex}`}\n className={cn(\n 'rounded-sidebar-shelf w-full cursor-pointer border-0 bg-transparent px-6 py-4 text-left leading-none hover:bg-[#F5F5F7]',\n {\n 'bg-[#F5F5F7]': activeSubSubcategoryIndex === subSubindex,\n }\n )}\n role=\"menuitem\"\n aria-label={subSubItem.label}\n >\n <Text html={subSubItem.label} className=\"text-sm font-bold leading-[1.4] text-[#4A4C56]\" />\n </button>\n ))}\n </div>\n )}\n </div>\n )\n })}\n </div>\n {sidebarCategoriesMetadata && (\n <div className=\"flex\">\n <div className=\"flex flex-col gap-4\">\n {sidebarCategoriesMetadata?.primary && (\n <Button\n as=\"a\"\n href={`${getLocalizedPath(sidebarCategoriesMetadata?.primary?.url, locale)}?ref=${sidebarCategoriesMetadata?.primary?.label}_shopall`}\n variant=\"primary\"\n size=\"lg\"\n className=\"lg-desktop:text-base text-sm\"\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 iconClassName=\"size-4\"\n className=\"lg-desktop:text-base justify-start !p-0 text-sm\"\n >\n {sidebarCategoriesMetadata?.secondary?.label}\n </Button>\n )}\n </div>\n </div>\n )}\n </div>\n <div className=\"flex-1 py-4\">\n {Reflect.ownKeys(matchSeriesMetadata).length > 0 && (\n <div className=\"mb-4 flex items-center justify-between\">\n {(() => {\n const labelContent = (\n <>\n <Text\n html={matchSeriesMetadata?.label}\n className=\"lg-desktop:text-2xl text-xl font-bold leading-[1.4]\"\n />\n {matchSeriesMetadata?.primary && !matchSeriesMetadata?.primary?.hide && (\n <Text\n className=\"lg-desktop:text-base text-sm font-bold leading-[1.2]\"\n html={matchSeriesMetadata?.primary?.label}\n />\n )}\n </>\n )\n\n return matchSeriesMetadata?.primary?.url ? (\n <Button\n as=\"a\"\n href={`${getLocalizedPath(matchSeriesMetadata?.primary?.url, locale)}?ref=${matchSeriesMetadata?.label}_viewmore`}\n variant=\"link\"\n size=\"lg\"\n iconClassName=\"size-4\"\n className=\"flex items-center justify-start gap-2 !p-0 no-underline\"\n >\n {labelContent}\n </Button>\n ) : (\n <div className=\"flex items-center gap-2\">{labelContent}</div>\n )\n })()}\n {sidebarCategoriesMetadata?.guide?.label && (\n <Link\n href={getLocalizedPath(sidebarCategoriesMetadata?.guide?.url, locale)}\n className=\"lg-desktop:text-base text-sm leading-[1.2] text-[#6D6D6F]\"\n >\n {sidebarCategoriesMetadata?.guide?.label}\n </Link>\n )}\n </div>\n )}\n <div\n className=\"flex h-[426px] flex-col gap-4 overflow-y-auto\"\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n >\n {matchSeriesMetadata?.series?.map((seriesItem: any, seriesIndex: number) => (\n <div key={`seriesItem-${seriesItem?.label || ''}-${seriesIndex}`}>\n {seriesItem.label && (\n <Text\n html={seriesItem.label}\n as=\"p\"\n className=\"mb-2 text-sm font-bold leading-[1.4] text-[#6D6D6F]\"\n />\n )}\n <div className=\"grid grid-cols-3 gap-4\">\n {!!matchSeriesMetadata?.banner && (\n <Link\n asChild={!matchSeriesMetadata?.banner?.href}\n href={getLocalizedPath(matchSeriesMetadata?.banner?.href, locale)}\n >\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 seriesLabel={matchSeriesMetadata?.label}\n key={`seriesProductItem-${seriesItem?.label || ''}-${seriesIndex}-${index}`}\n product={product}\n isCollection={matchSeriesMetadata?.isCollection}\n />\n ))}\n </div>\n </div>\n ))}\n </div>\n </div>\n </Container>\n )\n }\n)\n\nSidebarDropdown.displayName = 'SidebarDropdown'\n\n/**\n * \u7CFB\u5217\u4EA7\u54C1\u9879\u7EC4\u4EF6\n */\nexport const SeriesProductItem = ({\n product,\n isCollection,\n position,\n seriesLabel,\n}: {\n product: any\n isCollection?: boolean\n position?: number\n seriesLabel?: string\n}) => {\n const { locale = 'us' } = useAiuiContext()\n const { buildProps, onSeriesProductClick } = useNavContext()\n let productData = isCollection\n ? product\n : buildProps?.products?.find((item: Product) => item.handle === product.handle)\n const variant =\n productData?.variants?.find((item: ProductVariant) => item.sku === product.sku) || productData?.variants?.[0]\n\n const listingLink = useMemo(() => {\n return `${getLocalizedPath(`/products/${productData?.handle}`, locale)}?variant=${atobID(variant?.id as string)}`\n }, [productData?.handle, variant?.id, locale])\n\n const tags = useMemo(() => {\n return productData?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n }, [productData?.tags])\n\n if (!variant?.availableForSale) return null\n\n return (\n <Link\n href={listingLink}\n onClick={e => {\n e.preventDefault()\n window.open(listingLink, '_self')\n onSeriesProductClick?.(productData, position || 0, seriesLabel)\n }}\n className=\"no-underline hover:text-current\"\n >\n <div className=\"rounded-sidebar-shelf flex shrink-0 items-center gap-4 bg-[#F5F5F7] px-4 py-3 [&_img]:hover:scale-110 [&_img]:hover:duration-500\">\n <div className=\"shrink-0\">\n <img\n src={`${variant?.image?.url || product?.images?.[0]?.url}&width=200`}\n loading=\"lazy\"\n alt={productData?.title || product?.name}\n width={90}\n height={90}\n className=\"size-[96px] object-contain\"\n />\n </div>\n <div className=\"relative\">\n <div className=\"flex gap-1\">\n {Array.isArray(tags) &&\n tags?.map((tag: string, index: number) => (\n <Text\n key={index}\n as=\"p\"\n html={tag}\n className=\"text-brand-0 mb-1 inline-block h-[24px] whitespace-nowrap rounded-full border-[1.6px] border-[#00BEFA] px-[6px] text-xs font-bold !leading-[22px]\"\n />\n ))}\n </div>\n <Text\n className=\"lg-desktop:h-[44px] lg-desktop:text-base line-clamp-2 h-[40px] text-sm font-bold leading-[1.4]\"\n html={product?.custom_name || variant?.metafields?.infos?.page_short_title || productData?.title}\n />\n {product?.desc && (\n <Text\n as=\"p\"\n html={product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AC,EAEtB,OAAKC,GAAS,iBAGZpE,EAACW,EAAA,CACC,KAAM0D,EACN,QAASE,GAAK,CACZA,EAAE,eAAe,EACjB,OAAO,KAAKF,EAAa,OAAO,EAChCH,IAAuBC,EAAaH,GAAY,EAAGC,CAAW,CAChE,EACA,UAAU,kCAEV,SAAAhE,EAAC,OAAI,UAAU,mIACb,UAAAD,EAAC,OAAI,UAAU,WACb,SAAAA,EAAC,OACC,IAAK,GAAGoE,GAAS,OAAO,KAAOP,GAAS,SAAS,CAAC,GAAG,GAAG,aACxD,QAAQ,OACR,IAAKM,GAAa,OAASN,GAAS,KACpC,MAAO,GACP,OAAQ,GACR,UAAU,6BACZ,EACF,EACA5D,EAAC,OAAI,UAAU,WACb,UAAAD,EAAC,OAAI,UAAU,aACZ,eAAM,QAAQsE,CAAI,GACjBA,GAAM,IAAI,CAACE,EAAajC,IACtBvC,EAACU,EAAA,CAEC,GAAG,IACH,KAAM8D,EACN,UAAU,qJAHLjC,CAIP,CACD,EACL,EACAvC,EAACU,EAAA,CACC,UAAU,iGACV,KAAMmD,GAAS,aAAeO,GAAS,YAAY,OAAO,kBAAoBD,GAAa,MAC7F,EACCN,GAAS,MACR7D,EAACU,EAAA,CACC,GAAG,IACH,KAAMmD,GAAS,KACf,UAAU,sFACZ,GAEJ,GACF,EACF,EAhDqC,IAkDzC",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "React", "useCallback", "useEffect", "useMemo", "useRef", "useState", "Button", "Container", "Text", "Link", "Heading", "Picture", "cn", "atobID", "getLocalizedPath", "DownArrow", "useNavContext", "useAiuiContext", "SidebarDropdown", "sidebarCategoriesMetadata", "seriesMetadata", "buildProps", "onSidebarNavClick", "locale", "expandedSubcategory", "setExpandedSubcategory", "activeSubSubcategoryIndex", "setActiveSubSubcategoryIndex", "sidebarDropdownRef", "lastClickRef", "initExpandedSubcategory", "subcategories", "withSubSubCategoriesIndex", "item", "withoutSubSubCategoriesIndex", "expandedStates", "_", "index", "matchSeriesMetadata", "subCategory", "currentSeriesMetadata", "category", "activeSubSubcategory", "currentActiveSeriesMetadata", "handleSubcategoryOpen", "subcategoryItem", "hasSubSubCategories", "lastClick", "prev", "i", "handleSubSubcategoryOpen", "subSubindex", "subItem", "hasSubSubCategory", "isExpanded", "subSubItem", "labelContent", "seriesItem", "seriesIndex", "product", "SeriesProductItem", "isCollection", "position", "seriesLabel", "onSeriesProductClick", "productData", "variant", "listingLink", "tags", "e", "tag"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{Fragment as Se,jsx as e,jsxs as o}from"react/jsx-runtime";import{forwardRef as te,useCallback as ae,useEffect as $,useImperativeHandle as De,useMemo as C,useRef as K,useState as w}from"react";import{Picture as me,Text as N,Button as oe,Container as pe,BrandStrip as Ee}from"../../components/index.js";import{withLayout as Te}from"../../shared/Styles.js";import{cn as M,getLocalizedPath as re}from"../../helpers/utils.js";import He,{useNavContext as ee}from"./NavProvider.js";import{HeaderNavigationMenu as z,HeaderNavigationBlockType as S,HeaderNavigationActionBlockType as k}from"./types.js";import Le from"jump.js";import{useGSAP as ie}from"@gsap/react";import{gsap as le}from"gsap";import{WithSidebar as fe,WithSupports as be,WithMulticol as ve,WithGroupCategory as ge,WithResource as he}from"./withCategory.js";import{Menu as Be,Close as ye,User as Re,LeftArrow as ze,DownArrow as Ne,Polygon as Ie}from"./icons/index.js";import Ae from"../NavigationSearch/index.js";import{ResourceSidebarDropdown as Oe}from"./ResourceSidebarDropdown.js";import{MobileResourceSidebarMenu as je}from"./MobileResourceSidebarMenu.js";import{SidebarDropdown as We}from"./SidebarDropdown.js";import{useScrollLock as se}from"./useScrollLock.js";import{MulticolDropdown as _e}from"./MulticolDropdown.js";import{SupportsDropdown as $e}from"./SupportsDropdown.js";import{MobileSidebarMenu as Ke}from"./MobileSidebarMenu.js";import{MobileSupportMenu as Fe}from"./MobileSupportMenu.js";import{MobileMulticolMenu as Ue}from"./MobileMulticolMenu.js";import{MenuItem as ce}from"./MobileMenuComponents.js";import{useAiuiContext as ue}from"../AiuiProvider/index.js";import Ge from"../../shared/throttle.js";const ke=te((a,u)=>{const{data:{header:i}={},buildProps:d,event:v,profile:f,theme:n="light",isTop:p=!1,searchResult:D,onSearch:l,isSearching:g,keywords:W,onPrimaryNavClick:h,onSeriesProductClick:m,onSidebarNavClick:q,headerId:L,cartCount:I,menuData:B}=a,[E,P]=w(!1),[F,A]=w(!1),[R,s]=w(!1),[U,Q]=w(!1),T=K(null),c=K(null),_=()=>{const y=document?.querySelector("body")?.offsetWidth||0;Q(y<=1440)};$(()=>(_(),window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_)}),[]),De(u,()=>c.current),$(()=>{c.current&&p&&Le(c.current,{duration:0,offset:c.current?.getBoundingClientRect()?.bottom||0})},[p]),$(()=>{let y=0,G=0,V=0;const J=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,H=J();y=H,A(H>300),s(H>30);const Y=Ge(()=>{const t=J(),r=t-y;s(t>30),r>0?(G=0,V+=r,V>=300&&t>300&&A(!0)):r<0&&(V=0,G+=Math.abs(r),G>=300&&(A(!1),G=0)),y=t},100);return window.addEventListener("scroll",Y,{passive:!0}),()=>window.removeEventListener("scroll",Y)},[]),$(()=>{v&&(v.search=()=>P(!0))},[v]),ie(()=>{T?.current&&E&&le.fromTo(T.current,{height:0},{height:"auto",duration:.3})},[E]),se(E);const O=C(()=>i?.bar?.actions?.find(y=>y?.blockType===k.Search)?.searchBar?.[0]||{},[i]);return e(He,{buildProps:d,profile:f,isMobile:U,event:v,payloadData:i,onSidebarNavClick:q,onSeriesProductClick:m,cartCount:I,children:e("header",{id:L||"header","data-ui-component-id":"HeaderNavigation",className:M("sticky top-0 z-[100] transition-transform duration-500 ease-in-out",{"translate-y-[-100%]":F}),ref:c,children:o("div",{className:M("hover:bg-white hover:text-black",n==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":R},{"hover:!text-black":n==="dark","!text-black":R}),onClick:()=>s(!0),children:[e(xe,{data:i,className:"desktop:block hidden !bg-white",theme:n,onNavItemClick:()=>s(!0),onPrimaryNavClick:h}),e(Ce,{menuData:B,data:i,className:"desktop:hidden block !bg-white",onPrimaryNavClick:h}),E&&o("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${c?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[e("div",{ref:T,className:M("overflow-y-auto",{}),children:e(Ae,{data:O,keywords:W,isSearching:g,searchResult:D,onSearch:y=>{l?.(y)},onClose:()=>{l?.(),P(!1)}})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>P(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:y=>{(y.key==="Enter"||y.key===" "||y.key==="Escape")&&(y.preventDefault(),P(!1))}})]})]})})})}),xe=te((a,u)=>{const{data:i,onNavItemClick:d,className:v,theme:f,onPrimaryNavClick:n}=a,{event:p,profile:D}=ee(),[l,g]=w(!1),{locale:W="us"}=ue(),h=C(()=>ge(i?.categories?.filter(t=>t?.pcShow)),[i]),[m,q]=w(null),[L,I]=w([]),B=K(null),[E,P]=w(!1),F=K(null),A=K(null),R=K(h.map(t=>Array(t?.length||0).fill(null)));$(()=>{h?.length&&I(h?.map((t,r)=>t?.map((b,x)=>({groupIndex:r,index:x,open:!1}))))},[h]);const s=C(()=>{let t=null;for(const r of L){for(const b of r)if(b.open){t=b;break}if(t)break}return t},[L]);se(!!s?.open||E);const U=(t,r,b)=>{P(!1);const x=h[r][b];if(x?.components?.[0]?.blockType===S.Links)x?.components?.[0]?.url&&window.open(x?.components?.[0]?.url);else{const X=h?.flat()||[],j=X?.findIndex(ne=>ne?.id===h[r][b]?.id);t.stopPropagation(),d?.(),n?.(X[j],j),q(x),I(ne=>ne.map(Pe=>Pe.map(Z=>Z.groupIndex===r&&Z.index===b?{...Z,open:!Z.open}:{...Z,open:!1})))}},Q=(t,r,b)=>{t.key==="Enter"||t.key===" "?(t.preventDefault(),U(t,r,b)):t.key==="Escape"&&s?.groupIndex===r&&s?.index===b&&(t.preventDefault(),T())},T=()=>{I(t=>t.map(r=>r.map(b=>({...b,open:!1}))))},c=C(()=>{if(m)return m?.components?.[0]?.blockType},[m]),_=fe(We,m),O=he(Oe,m),y=ve(_e,m),G=be($e,{categoriesItem:m,currentNavItemRef:R.current?.[s?.groupIndex||0]?.[s?.index||0]}),V=C(()=>{switch(c){case S.Sidebar:return e(_,{});case S.Resource:return e(O,{});case S.Supports:return e(G,{});case S.Multicol:return e(y,{});default:return null}},[c,m]),J=C(()=>i?.bar?.actions?.filter(t=>t?.pcShow),[i]),H=C(()=>J?.find(t=>t?.blockType===k.Profile),[J]),Y=ae(()=>{P(t=>!t)},[]);return $(()=>{if(B?.current){const t=B.current;return t.addEventListener("click",Y),()=>{t.removeEventListener("click",Y)}}},[Y]),ie(()=>{s?.open&&le.fromTo(A?.current,{height:0},{height:"auto"})},[s?.open]),o(pe,{className:M("relative h-[96px]",v),children:[o("div",{ref:F,onClick:T,className:"flex h-full flex-col justify-end gap-4",children:[o("div",{className:"flex items-center justify-between",children:[e(we,{}),e(de,{ref:B,actions:J,activeStatus:E})]}),e("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:h?.map((t,r)=>e("div",{className:"flex gap-3",children:t?.map((b,x)=>{const X=s?.groupIndex===r&&s?.index===x;return e("div",{ref:j=>{R.current[r][x]=j},className:"group",children:o("div",{className:"relative",children:[o("button",{className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4",onClick:j=>U(j,r,x),onKeyDown:j=>Q(j,r,x),"aria-expanded":X,"aria-haspopup":"true","aria-label":b.text,children:[e(N,{html:b.text,className:"text-sm font-bold leading-[1.4]"}),e(Ne,{className:M("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":s?.groupIndex===r&&s?.index===x,"opacity-100":l&&s?.groupIndex===r&&s?.index===x,invisible:!b?.components?.length||b?.components?.[0]?.blockType===S.Links})})]}),e("div",{className:M("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":X},f==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},b.id)})},`groupCategory-${r}`))})]}),o("div",{role:"menu","aria-hidden":!(s?.open&&m),className:M("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(s?.open&&m)}),onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),style:{height:`calc(100dvh - ${F?.current?.getBoundingClientRect()?.bottom}px)`},children:[e("div",{ref:A,className:M("relative z-50",{"overflow-hidden":c!==S.Supports}),children:V}),e("div",{className:"flex-1 bg-transparent",onClick:T,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:t=>{(t.key==="Enter"||t.key===" "||t.key==="Escape")&&(t.preventDefault(),T())}})]}),E&&o("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",role:"dialog","aria-modal":"true","aria-label":"User profile menu",children:[e("div",{className:"rounded-box absolute w-[272px] overflow-hidden bg-white p-4",style:{right:`calc(100% - ${B?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:D?.email?o(Se,{children:[e(N,{html:D?.nick_name||H?.welcome,className:"text-sm font-bold"}),e("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),e("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:H?.profiles?.map(t=>e(ce,{className:"py-2",label:t?.title,href:re(t?.url,W)},t.id))})]}):o(Se,{children:[e(Ie,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),e(N,{html:H?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:H?.benefits?.map(t=>o("div",{className:"flex items-center gap-[6px]",children:[e(me,{source:t.benefitIcon?.url,className:"size-4",alt:t.benefit,width:16,height:16}),e(N,{html:t.benefit,className:"text-sm font-bold leading-[1.4]"})]},t.id))}),o("div",{className:"mt-4 flex items-center gap-2",children:[e(oe,{variant:"secondary",size:"lg",onClick:()=>p?.join?.(),children:e(N,{html:H?.primaryButton||"Join Now",className:"font-bold"})}),e(oe,{variant:"primary",size:"lg",onClick:()=>p?.login?.(),children:e(N,{html:H?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>P(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:t=>{(t.key==="Enter"||t.key===" "||t.key==="Escape")&&(t.preventDefault(),P(!1))}})]})]})}),Ce=te(({data:a,menuData:u,className:i,onPrimaryNavClick:d},v)=>{const f=C(()=>ge(a?.categories?.filter(c=>c?.mobileShow)),[a]),{currentMenu:n,setCurrentMenu:p,subSubCategory:D}=ee(),[l,g]=w(!1),[W,h]=w(0),[m,q]=w(null),L=K(null);$(()=>{if(L?.current&&l){const c=L?.current?.getBoundingClientRect();h(window?.innerHeight-(c?.bottom||0))}},[l]),ie(()=>{le.fromTo(L.current,{height:0},{height:W,duration:.3})},[W]),se(l);const I=C(()=>m?.components?.[0]?.blockType,[m]),B=be(Fe,{categoriesItem:m}),E=fe(Ke,m),P=he(je,m),F=ve(Ue,m),A=C(()=>{switch(I){case S.Sidebar:return e(E,{});case S.Resource:return e(P,{});case S.Supports:return e(B,{});case S.Multicol:return e(F,{});default:return null}},[I,m,B]),R=ae(()=>{g(!1),h(0),p&&p(z.Primary)},[g,h,p]),s=C(()=>a?.bar?.actions?.filter(c=>c?.mobileShow&&c?.blockType!==k.Profile),[a]),U=C(()=>a?.bar?.actions?.find(c=>c?.mobileShow&&c?.blockType===k.Profile)||{},[a]),Q=C(()=>{switch(n){case z.Primary:return e(qe,{actions:s,menuOpen:l,onMenuOpenClose:()=>{g(!1),h(0)},onMenuOpenClick:()=>g(!0)});case z.Secondary:return e(Me,{title:m?.text,onMenuOpenClose:R,onMenuBackClick:()=>p?.(z.Primary)});case z.Third:return e(Me,{title:D?.label,onMenuOpenClose:R,onMenuBackClick:()=>p?.(z.Secondary)});default:return null}},[l,n,p,m,s,D,R]),T=ae((c,_)=>{const O=Array.isArray(f)?Array.isArray(f[c])?f[c][_]:{}:{};q(O),O?.components?.[0]?.blockType===S.Links?O?.components?.[0]?.url&&window.open(O?.components?.[0]?.url):p?.(z.Secondary)},[f,p]);return o(pe,{className:M("relative h-[52px]",i),children:[Q,l&&o("nav",{ref:L,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:W},role:"navigation","aria-label":"Mobile navigation menu",children:[n===z.Primary&&u?e("div",{className:"pt-4",children:e(Ee,{data:u})}):null,n===z.Primary?e(Je,{categories:f,onPrimaryMenuClick:T,onPrimaryNavClick:d,profileAction:U}):A]})]})}),Je=({categories:a,onPrimaryMenuClick:u,profileAction:i,onPrimaryNavClick:d})=>o("div",{className:"flex h-full flex-col justify-between",children:[e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:a?.map((v,f)=>o("div",{className:"",children:[e("div",{className:M("my-2 h-px w-full bg-[#E5E5E7]")}),v?.map((n,p)=>e(ce,{label:n.text,onClick:()=>{const l=(a?.flat()||[])?.findIndex(g=>g?.id===a[f][p]?.id);u(f,p),d?.(n,l)},icon:n.components?.[0]?.icon},n.id))]},`groupCategory-${f}`))}),e(Ye,{profileAction:i})]}),Ye=({profileAction:a})=>{const[u,i]=w(!1),{profile:d,event:v}=ee(),{locale:f="us"}=ue();return o("div",{className:M("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":u}),children:[o("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>i(!u),"aria-expanded":u,"aria-label":d?.nick_name||a?.welcome,children:[o("div",{className:"flex items-center gap-[14px]",children:[e("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:e(Re,{"aria-hidden":"true"})}),e(N,{html:d?.nick_name||a?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!d?.email&&e(Ne,{"aria-hidden":"true",className:M("laptop:size-4 size-5",{"rotate-180":u})})]}),d?.email&&e("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:a?.profiles?.map(n=>e(ce,{label:n?.title,href:re(n?.url,f)},n.id))}),u&&!d?.email&&o("div",{className:"mt-4",children:[e(N,{html:a?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:a?.benefits?.map(n=>o("div",{className:"flex items-center gap-[6px]",children:[e(me,{source:n.benefitIcon?.url,className:"size-4",alt:n.benefit,width:16,height:16}),e(N,{html:n.benefit,className:"text-sm font-bold leading-[1.4]"})]},n.id))})]}),!d?.email&&o("div",{className:"mt-4 flex items-center gap-3",children:[e(oe,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>v?.join?.(),children:e(N,{html:a?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),e(oe,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>v?.login?.(),children:e(N,{html:a?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},qe=({menuOpen:a,onMenuOpenClose:u,onMenuOpenClick:i,actions:d})=>o("div",{className:"flex h-full items-center justify-between gap-4",children:[e(we,{}),o("div",{className:"desktop:gap-6 flex items-center gap-4",children:[e(de,{actions:d}),a?e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>u(),"aria-label":"Close menu","aria-expanded":"true",children:e(ye,{className:"size-5","aria-hidden":"true"})}):e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:e(Be,{className:"size-5","aria-hidden":"true"})})]})]}),we=()=>{const{payloadData:a,isMobile:u}=ee(),{locale:i="us"}=ue();return e("a",{href:re("/",i),className:"hover:text-brand-0 [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:u?a?.bar?.mobileLogo:a?.bar?.desktopLogo}})},de=te(({actions:a,activeStatus:u=!1},i)=>{const{event:d,cartCount:v}=ee(),[f,n]=w(null),p=l=>{switch(l){case k.Search:return"Search";case k.Cart:return`Shopping cart${v>0?` (${v} items)`:""}`;case k.Profile:return"User profile";case k.Livestream:return"Livestream";default:return"Action"}},D=ae((l,g)=>{switch(n(g),l?.blockType){case k.Search:d?.search?.();break;case k.Cart:d?.cart?.();break;case k.Profile:d?.profile?.();break;case k.Livestream:d?.livestream?.();break;default:return()=>{}}},[d]);return e("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(a)&&a?.map((l,g)=>o("button",{className:"relative cursor-pointer border-0 bg-transparent p-0",ref:l.blockType===k.Profile?i:null,onClick:()=>D(l,g),"aria-label":p(l.blockType),"aria-pressed":u&&f===g,children:[e(N,{html:l.icon,className:M("size-5",{"text-brand-0":u&&f===g}),"aria-hidden":"true"}),l.blockType===k.Cart&&v>0&&e("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]","aria-hidden":"true",children:e(N,{html:v?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},l.id))})}),Me=({title:a,onMenuOpenClose:u,onMenuBackClick:i})=>o("div",{className:"flex h-full items-center gap-3",children:[e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>i(),"aria-label":"Back to previous menu",children:e(ze,{className:"size-5","aria-hidden":"true"})}),e(N,{html:a,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>u(),"aria-label":"Close menu",children:e(ye,{className:"size-5","aria-hidden":"true"})})]});Ce.displayName="MobileNavigation",de.displayName="Actions",ke.displayName="HeaderNavigation",xe.displayName="DesktopNavigation";var kt=Te(ke);export{kt as default};
|
|
1
|
+
"use client";import{Fragment as Se,jsx as e,jsxs as n}from"react/jsx-runtime";import{forwardRef as te,useCallback as ae,useEffect as $,useImperativeHandle as De,useMemo as C,useRef as K,useState as w}from"react";import{Picture as me,Text as N,Button as ne,Container as pe,BrandStrip as Ee}from"../../components/index.js";import{withLayout as Te}from"../../shared/Styles.js";import{cn as M,getLocalizedPath as re}from"../../helpers/utils.js";import He,{useNavContext as ee}from"./NavProvider.js";import{HeaderNavigationMenu as I,HeaderNavigationBlockType as S,HeaderNavigationActionBlockType as k}from"./types.js";import Le from"jump.js";import{useGSAP as ie}from"@gsap/react";import{gsap as le}from"gsap";import{WithSidebar as fe,WithSupports as be,WithMulticol as ve,WithGroupCategory as ge,WithResource as he}from"./withCategory.js";import{Menu as ze,Close as ye,User as Be,LeftArrow as Re,DownArrow as Ne,Polygon as Ie}from"./icons/index.js";import Ae from"../NavigationSearch/index.js";import{ResourceSidebarDropdown as Oe}from"./ResourceSidebarDropdown.js";import{MobileResourceSidebarMenu as je}from"./MobileResourceSidebarMenu.js";import{SidebarDropdown as We}from"./SidebarDropdown.js";import{useScrollLock as se}from"./useScrollLock.js";import{MulticolDropdown as _e}from"./MulticolDropdown.js";import{SupportsDropdown as $e}from"./SupportsDropdown.js";import{MobileSidebarMenu as Ke}from"./MobileSidebarMenu.js";import{MobileSupportMenu as Fe}from"./MobileSupportMenu.js";import{MobileMulticolMenu as Ue}from"./MobileMulticolMenu.js";import{MenuItem as ce}from"./MobileMenuComponents.js";import{useAiuiContext as ue}from"../AiuiProvider/index.js";import Ge from"../../shared/throttle.js";const ke=te((a,d)=>{const{data:{header:l}={},buildProps:m,event:v,profile:f,theme:o="light",isTop:r=!1,searchResult:D,onSearch:s,isSearching:g,keywords:W,onPrimaryNavClick:h,onSeriesProductClick:p,onSidebarNavClick:q,headerId:L,cartCount:A,menuData:z}=a,[E,P]=w(!1),[F,B]=w(!1),[R,c]=w(!1),[U,Q]=w(!1),T=K(null),u=K(null),_=()=>{const y=document?.querySelector("body")?.offsetWidth||0;Q(y<=1440)};$(()=>(_(),window.addEventListener("resize",_),()=>{window.removeEventListener("resize",_)}),[]),De(d,()=>u.current),$(()=>{u.current&&r&&Le(u.current,{duration:0,offset:u.current?.getBoundingClientRect()?.bottom||0})},[r]),$(()=>{if(r){B(!1),c(!1);return}let y=0,G=0,V=0;const J=()=>document?.documentElement?.scrollTop||document?.body?.scrollTop||0,H=J();y=H,B(H>300),c(H>30);const Y=Ge(()=>{const t=J(),i=t-y;c(t>30),i>0?(G=0,V+=i,V>=300&&t>300&&B(!0)):i<0&&(V=0,G+=Math.abs(i),G>=300&&(B(!1),G=0)),y=t},100);return window.addEventListener("scroll",Y,{passive:!0}),()=>window.removeEventListener("scroll",Y)},[r]),$(()=>{v&&(v.search=()=>P(!0))},[v]),ie(()=>{T?.current&&E&&le.fromTo(T.current,{height:0},{height:"auto",duration:.3})},[E]),se(E);const O=C(()=>l?.bar?.actions?.find(y=>y?.blockType===k.Search)?.searchBar?.[0]||{},[l]);return e(He,{buildProps:m,profile:f,isMobile:U,event:v,payloadData:l,onSidebarNavClick:q,onSeriesProductClick:p,cartCount:A,children:e("header",{id:L||"header","data-ui-component-id":"HeaderNavigation",className:r?"relative z-[100] bg-white":M("sticky top-0 z-[100] transition-transform duration-500 ease-in-out",{"translate-y-[-100%]":F}),ref:u,children:n("div",{className:M("hover:bg-white hover:text-black",o==="light"?"text-black":"text-white",{"!bg-white transition-all duration-500 ease-in-out":!r&&R},{"hover:!text-black":o==="dark","!text-black":!r&&R}),onClick:()=>!r&&c(!0),children:[e(xe,{data:l,className:"desktop:block hidden !bg-white",theme:o,onNavItemClick:()=>!r&&c(!0),onPrimaryNavClick:h}),e(Ce,{menuData:z,data:l,className:"desktop:hidden block !bg-white",onPrimaryNavClick:h}),E&&n("div",{className:"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70",style:{height:`calc(100dvh - ${u?.current?.getBoundingClientRect()?.top}px)`},role:"dialog","aria-modal":"true","aria-label":"Search",children:[e("div",{ref:T,className:M("overflow-y-auto",{}),children:e(Ae,{data:O,keywords:W,isSearching:g,searchResult:D,onSearch:y=>{s?.(y)},onClose:()=>{s?.(),P(!1)}})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>P(!1),role:"button",tabIndex:0,"aria-label":"Close search",onKeyDown:y=>{(y.key==="Enter"||y.key===" "||y.key==="Escape")&&(y.preventDefault(),P(!1))}})]})]})})})}),xe=te((a,d)=>{const{data:l,onNavItemClick:m,className:v,theme:f,onPrimaryNavClick:o}=a,{event:r,profile:D}=ee(),[s,g]=w(!1),{locale:W="us"}=ue(),h=C(()=>ge(l?.categories?.filter(t=>t?.pcShow)),[l]),[p,q]=w(null),[L,A]=w([]),z=K(null),[E,P]=w(!1),F=K(null),B=K(null),R=K(h.map(t=>Array(t?.length||0).fill(null)));$(()=>{h?.length&&A(h?.map((t,i)=>t?.map((b,x)=>({groupIndex:i,index:x,open:!1}))))},[h]);const c=C(()=>{let t=null;for(const i of L){for(const b of i)if(b.open){t=b;break}if(t)break}return t},[L]);se(!!c?.open||E);const U=(t,i,b)=>{P(!1);const x=h[i][b];if(x?.components?.[0]?.blockType===S.Links)x?.components?.[0]?.url&&window.open(x?.components?.[0]?.url);else{const X=h?.flat()||[],j=X?.findIndex(oe=>oe?.id===h[i][b]?.id);t.stopPropagation(),m?.(),o?.(X[j],j),q(x),A(oe=>oe.map(Pe=>Pe.map(Z=>Z.groupIndex===i&&Z.index===b?{...Z,open:!Z.open}:{...Z,open:!1})))}},Q=(t,i,b)=>{t.key==="Enter"||t.key===" "?(t.preventDefault(),U(t,i,b)):t.key==="Escape"&&c?.groupIndex===i&&c?.index===b&&(t.preventDefault(),T())},T=()=>{A(t=>t.map(i=>i.map(b=>({...b,open:!1}))))},u=C(()=>{if(p)return p?.components?.[0]?.blockType},[p]),_=fe(We,p),O=he(Oe,p),y=ve(_e,p),G=be($e,{categoriesItem:p,currentNavItemRef:R.current?.[c?.groupIndex||0]?.[c?.index||0]}),V=C(()=>{switch(u){case S.Sidebar:return e(_,{});case S.Resource:return e(O,{});case S.Supports:return e(G,{});case S.Multicol:return e(y,{});default:return null}},[u,p]),J=C(()=>l?.bar?.actions?.filter(t=>t?.pcShow),[l]),H=C(()=>J?.find(t=>t?.blockType===k.Profile),[J]),Y=ae(()=>{P(t=>!t)},[]);return $(()=>{if(z?.current){const t=z.current;return t.addEventListener("click",Y),()=>{t.removeEventListener("click",Y)}}},[Y]),ie(()=>{c?.open&&le.fromTo(B?.current,{height:0},{height:"auto"})},[c?.open]),n(pe,{className:M("relative h-[96px]",v),children:[n("div",{ref:F,onClick:T,className:"flex h-full flex-col justify-end gap-4",children:[n("div",{className:"flex items-center justify-between",children:[e(we,{}),e(de,{ref:z,actions:J,activeStatus:E})]}),e("nav",{className:"flex justify-between",role:"navigation","aria-label":"Primary navigation",children:h?.map((t,i)=>e("div",{className:"flex gap-3",children:t?.map((b,x)=>{const X=c?.groupIndex===i&&c?.index===x;return e("div",{ref:j=>{R.current[i][x]=j},className:"group",children:n("div",{className:"relative",children:[n("button",{className:"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4",onClick:j=>U(j,i,x),onKeyDown:j=>Q(j,i,x),"aria-expanded":X,"aria-haspopup":"true","aria-label":b.text,children:[e(N,{html:b.text,className:"text-sm font-bold leading-[1.4]"}),e(Ne,{className:M("size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100",{"rotate-180":c?.groupIndex===i&&c?.index===x,"opacity-100":s&&c?.groupIndex===i&&c?.index===x,invisible:!b?.components?.length||b?.components?.[0]?.blockType===S.Links})})]}),e("div",{className:M("absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500",{"w-[calc(100%-20px)]":X},f==="dark"?"bg-white":"bg-[#080A0F]"),"aria-hidden":"true"})]})},b.id)})},`groupCategory-${i}`))})]}),n("div",{role:"menu","aria-hidden":!(c?.open&&p),className:M("absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black",{hidden:!(c?.open&&p)}),onMouseEnter:()=>g(!0),onMouseLeave:()=>g(!1),style:{height:`calc(100dvh - ${F?.current?.getBoundingClientRect()?.bottom}px)`},children:[e("div",{ref:B,className:M("relative z-50",{"overflow-hidden":u!==S.Supports}),children:V}),e("div",{className:"flex-1 bg-transparent",onClick:T,role:"button",tabIndex:0,"aria-label":"Close menu",onKeyDown:t=>{(t.key==="Enter"||t.key===" "||t.key==="Escape")&&(t.preventDefault(),T())}})]}),E&&n("div",{className:"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70",role:"dialog","aria-modal":"true","aria-label":"User profile menu",children:[e("div",{className:"rounded-box absolute w-[272px] overflow-hidden bg-white p-4",style:{right:`calc(100% - ${z?.current?.getBoundingClientRect()?.right}px)`,top:"-36px"},children:D?.email?n(Se,{children:[e(N,{html:D?.nick_name||H?.welcome,className:"text-sm font-bold"}),e("div",{className:"mt-2 h-px bg-[#D9D9D9]","aria-hidden":"true"}),e("nav",{className:"mt-2",role:"navigation","aria-label":"Profile navigation",children:H?.profiles?.map(t=>e(ce,{className:"py-2",label:t?.title,href:re(t?.url,W)},t.id))})]}):n(Se,{children:[e(Ie,{className:"absolute -top-2 right-[46px] z-30 text-white","aria-hidden":"true"}),e(N,{html:H?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:H?.benefits?.map(t=>n("div",{className:"flex items-center gap-[6px]",children:[e(me,{source:t.benefitIcon?.url,className:"size-4",alt:t.benefit,width:16,height:16}),e(N,{html:t.benefit,className:"text-sm font-bold leading-[1.4]"})]},t.id))}),n("div",{className:"mt-4 flex items-center gap-2",children:[e(ne,{variant:"secondary",size:"lg",onClick:()=>r?.join?.(),children:e(N,{html:H?.primaryButton||"Join Now",className:"font-bold"})}),e(ne,{variant:"primary",size:"lg",onClick:()=>r?.login?.(),children:e(N,{html:H?.secondaryButton||"Log In",className:"font-bold"})})]})]})}),e("div",{className:"flex-1 bg-transparent",onClick:()=>P(!1),role:"button",tabIndex:0,"aria-label":"Close profile menu",onKeyDown:t=>{(t.key==="Enter"||t.key===" "||t.key==="Escape")&&(t.preventDefault(),P(!1))}})]})]})}),Ce=te(({data:a,menuData:d,className:l,onPrimaryNavClick:m},v)=>{const f=C(()=>ge(a?.categories?.filter(u=>u?.mobileShow)),[a]),{currentMenu:o,setCurrentMenu:r,subSubCategory:D}=ee(),[s,g]=w(!1),[W,h]=w(0),[p,q]=w(null),L=K(null);$(()=>{if(L?.current&&s){const u=L?.current?.getBoundingClientRect();h(window?.innerHeight-(u?.bottom||0))}},[s]),ie(()=>{le.fromTo(L.current,{height:0},{height:W,duration:.3})},[W]),se(s);const A=C(()=>p?.components?.[0]?.blockType,[p]),z=be(Fe,{categoriesItem:p}),E=fe(Ke,p),P=he(je,p),F=ve(Ue,p),B=C(()=>{switch(A){case S.Sidebar:return e(E,{});case S.Resource:return e(P,{});case S.Supports:return e(z,{});case S.Multicol:return e(F,{});default:return null}},[A,p,z]),R=ae(()=>{g(!1),h(0),r&&r(I.Primary)},[g,h,r]),c=C(()=>a?.bar?.actions?.filter(u=>u?.mobileShow&&u?.blockType!==k.Profile),[a]),U=C(()=>a?.bar?.actions?.find(u=>u?.mobileShow&&u?.blockType===k.Profile)||{},[a]),Q=C(()=>{switch(o){case I.Primary:return e(qe,{actions:c,menuOpen:s,onMenuOpenClose:()=>{g(!1),h(0)},onMenuOpenClick:()=>g(!0)});case I.Secondary:return e(Me,{title:p?.text,onMenuOpenClose:R,onMenuBackClick:()=>r?.(I.Primary)});case I.Third:return e(Me,{title:D?.label,onMenuOpenClose:R,onMenuBackClick:()=>r?.(I.Secondary)});default:return null}},[s,o,r,p,c,D,R]),T=ae((u,_)=>{const O=Array.isArray(f)?Array.isArray(f[u])?f[u][_]:{}:{};q(O),O?.components?.[0]?.blockType===S.Links?O?.components?.[0]?.url&&window.open(O?.components?.[0]?.url):r?.(I.Secondary)},[f,r]);return n(pe,{className:M("relative h-[52px]",l),children:[Q,s&&n("nav",{ref:L,className:"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black",style:{height:W},role:"navigation","aria-label":"Mobile navigation menu",children:[o===I.Primary&&d?e("div",{className:"pt-4",children:e(Ee,{data:d})}):null,o===I.Primary?e(Je,{categories:f,onPrimaryMenuClick:T,onPrimaryNavClick:m,profileAction:U}):B]})]})}),Je=({categories:a,onPrimaryMenuClick:d,profileAction:l,onPrimaryNavClick:m})=>n("div",{className:"flex h-full flex-col justify-between",children:[e("div",{className:"tablet:px-8 laptop:px-16 p-4",children:a?.map((v,f)=>n("div",{className:"",children:[e("div",{className:M("my-2 h-px w-full bg-[#E5E5E7]")}),v?.map((o,r)=>e(ce,{label:o.text,onClick:()=>{const s=(a?.flat()||[])?.findIndex(g=>g?.id===a[f][r]?.id);d(f,r),m?.(o,s)},icon:o.components?.[0]?.icon},o.id))]},`groupCategory-${f}`))}),e(Ye,{profileAction:l})]}),Ye=({profileAction:a})=>{const[d,l]=w(!1),{profile:m,event:v}=ee(),{locale:f="us"}=ue();return n("div",{className:M("tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6",{"p-4":d}),children:[n("button",{className:"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent",onClick:()=>l(!d),"aria-expanded":d,"aria-label":m?.nick_name||a?.welcome,children:[n("div",{className:"flex items-center gap-[14px]",children:[e("div",{className:"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white",children:e(Be,{"aria-hidden":"true"})}),e(N,{html:m?.nick_name||a?.welcome,className:"text-base font-bold leading-[1.4]"})]}),!m?.email&&e(Ne,{"aria-hidden":"true",className:M("laptop:size-4 size-5",{"rotate-180":d})})]}),m?.email&&e("nav",{className:"mt-4",role:"navigation","aria-label":"Profile menu",children:a?.profiles?.map(o=>e(ce,{label:o?.title,href:re(o?.url,f)},o.id))}),d&&!m?.email&&n("div",{className:"mt-4",children:[e(N,{html:a?.benefits_title,className:"text-sm font-bold leading-[1.4]"}),e("div",{className:"mt-2 flex flex-col gap-1",children:a?.benefits?.map(o=>n("div",{className:"flex items-center gap-[6px]",children:[e(me,{source:o.benefitIcon?.url,className:"size-4",alt:o.benefit,width:16,height:16}),e(N,{html:o.benefit,className:"text-sm font-bold leading-[1.4]"})]},o.id))})]}),!m?.email&&n("div",{className:"mt-4 flex items-center gap-3",children:[e(ne,{className:"tablet:flex-none flex-1",variant:"secondary",size:"base",onClick:()=>v?.join?.(),children:e(N,{html:a?.primaryButton||"Join Now",className:"text-sm font-bold leading-[1.4]"})}),e(ne,{className:"tablet:flex-none flex-1",variant:"primary",size:"base",onClick:()=>v?.login?.(),children:e(N,{html:a?.secondaryButton||"Log In",className:"text-sm font-bold leading-[1.4]"})})]})]})},qe=({menuOpen:a,onMenuOpenClose:d,onMenuOpenClick:l,actions:m})=>n("div",{className:"flex h-full items-center justify-between gap-4",children:[e(we,{}),n("div",{className:"desktop:gap-6 flex items-center gap-4",children:[e(de,{actions:m}),a?e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>d(),"aria-label":"Close menu","aria-expanded":"true",children:e(ye,{className:"size-5","aria-hidden":"true"})}):e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>l(),"aria-label":"Open menu","aria-expanded":"false","aria-haspopup":"true",children:e(ze,{className:"size-5","aria-hidden":"true"})})]})]}),we=()=>{const{payloadData:a,isMobile:d}=ee(),{locale:l="us"}=ue();return e("a",{href:re("/",l),className:"hover:text-brand-0 [&>svg]:w-full","aria-label":"Home",dangerouslySetInnerHTML:{__html:d?a?.bar?.mobileLogo:a?.bar?.desktopLogo}})},de=te(({actions:a,activeStatus:d=!1},l)=>{const{event:m,cartCount:v}=ee(),[f,o]=w(null),r=s=>{switch(s){case k.Search:return"Search";case k.Cart:return`Shopping cart${v>0?` (${v} items)`:""}`;case k.Profile:return"User profile";case k.Livestream:return"Livestream";default:return"Action"}},D=ae((s,g)=>{switch(o(g),s?.blockType){case k.Search:m?.search?.();break;case k.Cart:m?.cart?.();break;case k.Profile:m?.profile?.();break;case k.Livestream:m?.livestream?.();break;default:return()=>{}}},[m]);return e("div",{className:"desktop:gap-6 flex items-center gap-4",children:Array.isArray(a)&&a?.map((s,g)=>n("button",{className:"relative cursor-pointer border-0 bg-transparent p-0",ref:s.blockType===k.Profile?l:null,onClick:()=>D(s,g),"aria-label":r(s.blockType),"aria-pressed":d&&f===g,children:[e(N,{html:s.icon,className:M("size-5",{"text-brand-0":d&&f===g}),"aria-hidden":"true"}),s.blockType===k.Cart&&v>0&&e("div",{className:"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]","aria-hidden":"true",children:e(N,{html:v?.toString(),className:"text-sm font-bold leading-[1.2] text-white"})})]},s.id))})}),Me=({title:a,onMenuOpenClose:d,onMenuBackClick:l})=>n("div",{className:"flex h-full items-center gap-3",children:[e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>l(),"aria-label":"Back to previous menu",children:e(Re,{className:"size-5","aria-hidden":"true"})}),e(N,{html:a,className:"flex-1 text-center text-base font-bold leading-[1.4]"}),e("button",{className:"cursor-pointer border-0 bg-transparent p-0",onClick:()=>d(),"aria-label":"Close menu",children:e(ye,{className:"size-5","aria-hidden":"true"})})]});Ce.displayName="MobileNavigation",de.displayName="Actions",ke.displayName="HeaderNavigation",xe.displayName="DesktopNavigation";var kt=Te(ke);export{kt as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/HeaderNavigation/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\n\nimport { Picture, Text, Button, Container, BrandStrip } from '../../components/index.js'\n\nimport { withLayout } from '../../shared/Styles.js'\n\nimport { cn, getLocalizedPath } from '../../helpers/utils.js'\n\nimport type {\n MobilePrimaryNavigationData,\n MobileSecondaryNavigationData,\n MobileNavigationProps,\n DesktopNavigationProps,\n HeaderNavigationProps,\n} from './types.js'\nimport NavProvider, { useNavContext } from './NavProvider.js'\n\nimport { HeaderNavigationMenu, HeaderNavigationBlockType, HeaderNavigationActionBlockType } from './types.js'\n\nimport jump from 'jump.js'\n\nimport { useGSAP } from '@gsap/react'\nimport { gsap } from 'gsap'\n\nimport { WithSidebar, WithSupports, WithMulticol, WithGroupCategory, WithResource } from './withCategory.js'\n\nimport { Menu, Close, User, LeftArrow, DownArrow, Polygon } from './icons/index.js'\n\nimport NavigationSearch from '../NavigationSearch/index.js'\nimport { ResourceSidebarDropdown } from './ResourceSidebarDropdown.js'\nimport { MobileResourceSidebarMenu } from './MobileResourceSidebarMenu.js'\nimport { SidebarDropdown } from './SidebarDropdown.js'\nimport { useScrollLock } from './useScrollLock.js'\nimport { MulticolDropdown } from './MulticolDropdown.js'\nimport { SupportsDropdown } from './SupportsDropdown.js'\nimport { MobileSidebarMenu } from './MobileSidebarMenu.js'\nimport { MobileSupportMenu } from './MobileSupportMenu.js'\nimport { MobileMulticolMenu } from './MobileMulticolMenu.js'\nimport { MenuItem } from './MobileMenuComponents.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport throttle from '../../shared/throttle.js'\n\nconst HeaderNavigation = forwardRef<HTMLDivElement, HeaderNavigationProps>((props, ref) => {\n const {\n data: { header } = {},\n buildProps,\n event,\n profile,\n theme = 'light',\n isTop = false,\n searchResult,\n onSearch,\n isSearching,\n keywords,\n onPrimaryNavClick,\n onSeriesProductClick,\n onSidebarNavClick,\n headerId,\n cartCount,\n menuData,\n } = props\n\n const [searchOpen, setSearchOpen] = useState(false)\n const [headerHidden, setHeaderHidden] = useState(false)\n const [changeHeaderBackground, setChangeHeaderBackground] = useState(false)\n const [isMobile, setIsMobile] = useState(false)\n const searchRef = useRef<HTMLDivElement>(null)\n\n const headerRef = useRef<HTMLDivElement>(null)\n\n const resizeWindow = () => {\n const offsetWidth = document?.querySelector('body')?.offsetWidth || 0\n setIsMobile(offsetWidth <= 1440)\n }\n\n useEffect(() => {\n resizeWindow()\n window.addEventListener('resize', resizeWindow)\n return () => {\n window.removeEventListener('resize', resizeWindow)\n }\n }, [])\n\n useImperativeHandle(ref, () => headerRef.current as HTMLDivElement)\n\n useEffect(() => {\n if (headerRef.current && isTop) {\n jump(headerRef.current, { duration: 0, offset: headerRef.current?.getBoundingClientRect()?.bottom || 0 })\n }\n }, [isTop])\n\n useEffect(() => {\n let lastScrollY = 0\n let upwardDistance = 0\n let downwardDistance = 0\n\n const getScrollTop = () => {\n return document?.documentElement?.scrollTop || document?.body?.scrollTop || 0\n }\n\n // \u521D\u59CB\u5316\u72B6\u6001\n const initialScrollTop = getScrollTop()\n lastScrollY = initialScrollTop\n setHeaderHidden(initialScrollTop > 300)\n setChangeHeaderBackground(initialScrollTop > 30)\n\n const handleScroll = throttle(() => {\n const currentScrollY = getScrollTop()\n const delta = currentScrollY - lastScrollY\n\n // \u66F4\u65B0\u80CC\u666F\u72B6\u6001\n setChangeHeaderBackground(currentScrollY > 30)\n\n if (delta > 0) {\n // \u5411\u4E0B\u6EDA\u52A8\n upwardDistance = 0 // \u91CD\u7F6E\u5411\u4E0A\u7D2F\u8BA1\n downwardDistance += delta\n\n if (downwardDistance >= 300 && currentScrollY > 300) {\n setHeaderHidden(true)\n }\n } else if (delta < 0) {\n // \u5411\u4E0A\u6EDA\u52A8\n downwardDistance = 0 // \u91CD\u7F6E\u5411\u4E0B\u7D2F\u8BA1\n upwardDistance += Math.abs(delta)\n\n if (upwardDistance >= 300) {\n setHeaderHidden(false)\n upwardDistance = 0\n }\n }\n\n lastScrollY = currentScrollY\n }, 100)\n\n window.addEventListener('scroll', handleScroll, { passive: true })\n return () => window.removeEventListener('scroll', handleScroll)\n }, [])\n\n useEffect(() => {\n if (event) {\n event.search = () => setSearchOpen(true)\n }\n }, [event])\n\n useGSAP(() => {\n if (searchRef?.current && searchOpen) {\n gsap.fromTo(\n searchRef.current,\n {\n height: 0,\n },\n {\n height: 'auto',\n duration: 0.3,\n }\n )\n }\n }, [searchOpen])\n\n useScrollLock(searchOpen)\n\n const searchPage = useMemo(() => {\n return (\n header?.bar?.actions?.find((item: any) => item?.blockType === HeaderNavigationActionBlockType.Search)\n ?.searchBar?.[0] || {}\n )\n }, [header])\n\n return (\n <NavProvider\n buildProps={buildProps}\n profile={profile}\n isMobile={isMobile}\n event={event}\n payloadData={header}\n onSidebarNavClick={onSidebarNavClick}\n onSeriesProductClick={onSeriesProductClick}\n cartCount={cartCount}\n >\n <header\n id={headerId || 'header'}\n data-ui-component-id=\"HeaderNavigation\"\n className={cn('sticky top-0 z-[100] transition-transform duration-500 ease-in-out', {\n ['translate-y-[-100%]']: headerHidden,\n })}\n // className=\"relative z-[100] bg-white\"\n ref={headerRef}\n >\n <div\n className={cn(\n 'hover:bg-white hover:text-black',\n theme === 'light' ? 'text-black' : 'text-white',\n {\n ['!bg-white transition-all duration-500 ease-in-out']: changeHeaderBackground,\n },\n {\n ['hover:!text-black']: theme === 'dark',\n ['!text-black']: changeHeaderBackground,\n }\n )}\n onClick={() => setChangeHeaderBackground(true)}\n >\n <DesktopNavigation\n data={header}\n className=\"desktop:block hidden !bg-white\"\n theme={theme}\n onNavItemClick={() => setChangeHeaderBackground(true)}\n onPrimaryNavClick={onPrimaryNavClick}\n />\n <MobileNavigation\n menuData={menuData}\n data={header}\n className=\"desktop:hidden block !bg-white\"\n onPrimaryNavClick={onPrimaryNavClick}\n />\n {searchOpen && (\n <div\n className=\"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70\"\n style={{ height: `calc(100dvh - ${headerRef?.current?.getBoundingClientRect()?.top}px)` }}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Search\"\n >\n <div ref={searchRef} className={cn('overflow-y-auto', {})}>\n <NavigationSearch\n data={searchPage}\n keywords={keywords}\n isSearching={isSearching}\n searchResult={searchResult}\n onSearch={(value: string) => {\n onSearch?.(value)\n }}\n onClose={() => {\n onSearch?.()\n setSearchOpen(false)\n }}\n />\n </div>\n <div\n className=\"flex-1 bg-transparent\"\n onClick={() => setSearchOpen(false)}\n role=\"button\"\n tabIndex={0}\n aria-label=\"Close search\"\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ' || e.key === 'Escape') {\n e.preventDefault()\n setSearchOpen(false)\n }\n }}\n />\n </div>\n )}\n </div>\n </header>\n </NavProvider>\n )\n})\n\nconst DesktopNavigation = forwardRef<HTMLDivElement, DesktopNavigationProps>((props, ref) => {\n const { data, onNavItemClick, className, theme, onPrimaryNavClick } = props\n const { event, profile } = useNavContext()\n const [downdownHover, setDowndownHover] = useState(false)\n const { locale = 'us' } = useAiuiContext()\n\n const groupCategories = useMemo(() => {\n return WithGroupCategory(data?.categories?.filter((item: any) => item?.pcShow)) as any[][]\n }, [data])\n\n const [categoriesItem, setCategoriesItem] = useState<any>(null)\n const [navStatusArray, setNavStatusArray] = useState<{ index: number; groupIndex: number; open: boolean }[][]>([])\n const profileRef = useRef<HTMLButtonElement>(null)\n const [userProfileOpen, setUserProfileOpen] = useState(false)\n const headerRef = useRef<HTMLDivElement>(null)\n const dropdownRef = useRef<HTMLDivElement>(null)\n const navItemRefs = useRef<HTMLDivElement[][]>(\n groupCategories.map((categories: any) => Array(categories?.length || 0).fill(null))\n )\n\n useEffect(() => {\n if (groupCategories?.length) {\n setNavStatusArray(\n groupCategories?.map((groupItem: any, groupIndex: number) => {\n return groupItem?.map((_: any, index: number) => ({ groupIndex, index, open: false }))\n })\n )\n }\n }, [groupCategories])\n\n const currentNavItem = useMemo(() => {\n let currentNavItem: { index: number; groupIndex: number; open: boolean } | null = null\n for (const groupItem of navStatusArray) {\n for (const item of groupItem) {\n if (item.open) {\n currentNavItem = item\n break\n }\n }\n if (currentNavItem) break\n }\n return currentNavItem\n }, [navStatusArray])\n\n useScrollLock(!!currentNavItem?.open || userProfileOpen)\n\n const handleNavItemClick = (e: any, groupIndex: number, index: number) => {\n setUserProfileOpen(false)\n // if (categoriesItem?.components?.[0]?.blockType === HeaderNavigationBlockType.Links) {\n const currentCategoriesItem = groupCategories[groupIndex][index]\n if (currentCategoriesItem?.components?.[0]?.blockType === HeaderNavigationBlockType.Links) {\n // link\u6A21\u5757\u7279\u6B8A\u5904\u7406\n // categoriesItem?.components?.[0]?.url && window.open(categoriesItem?.components?.[0]?.url)\n currentCategoriesItem?.components?.[0]?.url && window.open(currentCategoriesItem?.components?.[0]?.url)\n } else {\n const categories = groupCategories?.flat() || []\n const position = categories?.findIndex(item => item?.id === groupCategories[groupIndex][index]?.id)\n e.stopPropagation()\n onNavItemClick?.()\n onPrimaryNavClick?.(categories[position], position)\n // setCategoriesItem(groupCategories[groupIndex][index])\n setCategoriesItem(currentCategoriesItem)\n setNavStatusArray(prev =>\n prev.map(groupItem =>\n groupItem.map(item =>\n item.groupIndex === groupIndex && item.index === index\n ? { ...item, open: !item.open }\n : { ...item, open: false }\n )\n )\n )\n }\n }\n\n const handleNavItemKeyDown = (e: React.KeyboardEvent, groupIndex: number, index: number) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleNavItemClick(e, groupIndex, index)\n } else if (e.key === 'Escape' && currentNavItem?.groupIndex === groupIndex && currentNavItem?.index === index) {\n e.preventDefault()\n handleNavMenuClose()\n }\n }\n\n const handleNavMenuClose = () => {\n setNavStatusArray(prev => prev.map(groupItem => groupItem.map(item => ({ ...item, open: false }))))\n }\n\n const currentBlockTypeCategories = useMemo(() => {\n if (categoriesItem) return categoriesItem?.components?.[0]?.blockType\n }, [categoriesItem])\n\n const SidebarDropdownComp = WithSidebar(SidebarDropdown, categoriesItem)\n const ResourceSidebarDropdownComp = WithResource(ResourceSidebarDropdown, categoriesItem)\n const MulticolDropdownComp = WithMulticol(MulticolDropdown, categoriesItem)\n const SupportsDropdownComp = WithSupports(SupportsDropdown, {\n categoriesItem,\n currentNavItemRef: navItemRefs.current?.[currentNavItem?.groupIndex || 0]?.[currentNavItem?.index || 0],\n })\n\n const DropdownComp = useMemo(() => {\n switch (currentBlockTypeCategories) {\n case HeaderNavigationBlockType.Sidebar:\n return <SidebarDropdownComp />\n case HeaderNavigationBlockType.Resource:\n return <ResourceSidebarDropdownComp />\n case HeaderNavigationBlockType.Supports:\n return <SupportsDropdownComp />\n case HeaderNavigationBlockType.Multicol:\n return <MulticolDropdownComp />\n default:\n return null\n }\n }, [currentBlockTypeCategories, categoriesItem])\n\n const actions = useMemo(() => {\n return data?.bar?.actions?.filter((item: any) => item?.pcShow)\n }, [data])\n\n const profileAction = useMemo(() => {\n return actions?.find((item: any) => item?.blockType === HeaderNavigationActionBlockType.Profile)\n }, [actions])\n\n const handleProfileClick = useCallback(() => {\n setUserProfileOpen(prev => !prev)\n }, [])\n\n useEffect(() => {\n if (profileRef?.current) {\n const profileRefElement = profileRef.current as HTMLButtonElement\n profileRefElement.addEventListener('click', handleProfileClick)\n\n return () => {\n profileRefElement.removeEventListener('click', handleProfileClick)\n }\n }\n }, [handleProfileClick])\n\n useGSAP(() => {\n if (currentNavItem?.open) {\n gsap.fromTo(\n dropdownRef?.current,\n {\n height: 0,\n },\n {\n height: 'auto',\n }\n )\n }\n }, [currentNavItem?.open])\n\n return (\n <Container className={cn('relative h-[96px]', className)}>\n <div ref={headerRef} onClick={handleNavMenuClose} className=\"flex h-full flex-col justify-end gap-4\">\n <div className=\"flex items-center justify-between\">\n <Logo />\n <Actions ref={profileRef} actions={actions} activeStatus={userProfileOpen} />\n </div>\n <nav className=\"flex justify-between\" role=\"navigation\" aria-label=\"Primary navigation\">\n {groupCategories?.map((groupItem: any, groupIndex: number) => {\n return (\n <div key={`groupCategory-${groupIndex}`} className=\"flex gap-3\">\n {groupItem?.map((item: any, index: number) => {\n const isExpanded = currentNavItem?.groupIndex === groupIndex && currentNavItem?.index === index\n return (\n <div\n key={item.id}\n ref={(el: HTMLDivElement) => {\n navItemRefs.current[groupIndex][index] = el\n }}\n className=\"group\"\n >\n <div className=\"relative\">\n <button\n className=\"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4\"\n onClick={e => handleNavItemClick(e, groupIndex, index)}\n onKeyDown={e => handleNavItemKeyDown(e, groupIndex, index)}\n aria-expanded={isExpanded}\n aria-haspopup=\"true\"\n aria-label={item.text}\n >\n <Text html={item.text} className=\"text-sm font-bold leading-[1.4]\" />\n {/* <DownArrow\n aria-hidden=\"true\"\n className={cn('size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100', {\n ['rotate-180']: isExpanded,\n ['opacity-100']: downdownHover && isExpanded,\n })}\n /> */}\n <DownArrow\n className={cn('size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100', {\n ['rotate-180']:\n currentNavItem?.groupIndex === groupIndex && currentNavItem?.index === index,\n ['opacity-100']:\n downdownHover &&\n currentNavItem?.groupIndex === groupIndex &&\n currentNavItem?.index === index,\n ['invisible']:\n !item?.components?.length ||\n item?.components?.[0]?.blockType === HeaderNavigationBlockType.Links,\n })}\n />\n </button>\n <div\n className={cn(\n 'absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500',\n {\n 'w-[calc(100%-20px)]': isExpanded,\n },\n theme === 'dark' ? 'bg-white' : 'bg-[#080A0F]'\n )}\n aria-hidden=\"true\"\n />\n </div>\n </div>\n )\n })}\n </div>\n )\n })}\n </nav>\n </div>\n <div\n role=\"menu\"\n aria-hidden={!(currentNavItem?.open && categoriesItem)}\n className={cn(\n 'absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black',\n {\n hidden: !(currentNavItem?.open && categoriesItem),\n }\n )}\n onMouseEnter={() => setDowndownHover(true)}\n onMouseLeave={() => setDowndownHover(false)}\n style={{ height: `calc(100dvh - ${headerRef?.current?.getBoundingClientRect()?.bottom}px)` }}\n >\n <div\n ref={dropdownRef}\n className={cn('relative z-50', {\n 'overflow-hidden': currentBlockTypeCategories !== HeaderNavigationBlockType.Supports,\n })}\n >\n {DropdownComp}\n </div>\n <div\n className=\"flex-1 bg-transparent\"\n onClick={handleNavMenuClose}\n role=\"button\"\n tabIndex={0}\n aria-label=\"Close menu\"\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ' || e.key === 'Escape') {\n e.preventDefault()\n handleNavMenuClose()\n }\n }}\n />\n </div>\n {userProfileOpen && (\n <div\n className=\"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"User profile menu\"\n // style={{\n // height: `calc(100dvh - ${profileRef?.current?.getBoundingClientRect()?.bottom}px)`,\n // top: `calc(96px)`,\n // }}\n >\n <div\n className=\"rounded-box absolute w-[272px] overflow-hidden bg-white p-4\"\n style={{\n right: `calc(100% - ${profileRef?.current?.getBoundingClientRect()?.right}px)`,\n top: '-36px',\n }}\n >\n {profile?.email ? (\n <>\n <Text html={profile?.nick_name || profileAction?.welcome} className=\"text-sm font-bold\" />\n <div className=\"mt-2 h-px bg-[#D9D9D9]\" aria-hidden=\"true\" />\n <nav className=\"mt-2\" role=\"navigation\" aria-label=\"Profile navigation\">\n {profileAction?.profiles?.map((item: any) => (\n <MenuItem\n className=\"py-2\"\n key={item.id}\n label={item?.title}\n href={getLocalizedPath(item?.url, locale)}\n />\n ))}\n </nav>\n </>\n ) : (\n <>\n <Polygon className=\"absolute -top-2 right-[46px] z-30 text-white\" aria-hidden=\"true\" />\n <Text html={profileAction?.benefits_title} className=\"text-sm font-bold leading-[1.4]\" />\n <div className=\"mt-2 flex flex-col gap-1\">\n {profileAction?.benefits?.map((item: any) => (\n <div key={item.id} className=\"flex items-center gap-[6px]\">\n <Picture\n source={item.benefitIcon?.url}\n className=\"size-4\"\n alt={item.benefit}\n width={16}\n height={16}\n />\n <Text html={item.benefit} className=\"text-sm font-bold leading-[1.4]\" />\n </div>\n ))}\n </div>\n <div className=\"mt-4 flex items-center gap-2\">\n <Button variant=\"secondary\" size=\"lg\" onClick={() => event?.join?.()}>\n <Text html={profileAction?.primaryButton || 'Join Now'} className=\"font-bold\" />\n </Button>\n <Button variant=\"primary\" size=\"lg\" onClick={() => event?.login?.()}>\n <Text html={profileAction?.secondaryButton || 'Log In'} className=\"font-bold\" />\n </Button>\n </div>\n </>\n )}\n </div>\n <div\n className=\"flex-1 bg-transparent\"\n onClick={() => setUserProfileOpen(false)}\n role=\"button\"\n tabIndex={0}\n aria-label=\"Close profile menu\"\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ' || e.key === 'Escape') {\n e.preventDefault()\n setUserProfileOpen(false)\n }\n }}\n />\n </div>\n )}\n </Container>\n )\n})\n\nconst MobileNavigation = forwardRef<HTMLDivElement, MobileNavigationProps>(\n ({ data, menuData, className, onPrimaryNavClick }, ref) => {\n const groupCategories = useMemo(() => {\n return WithGroupCategory(data?.categories?.filter((item: any) => item?.mobileShow))\n }, [data])\n\n const { currentMenu, setCurrentMenu, subSubCategory } = useNavContext()\n const [mobileMenuOpen, setMobileMenuOpen] = useState(false)\n const [menuInnerHeight, setMenuInnerHeight] = useState(0)\n const [categoriesItem, setCategoriesItem] = useState<any>(null)\n\n const mobileMenuRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (mobileMenuRef?.current && mobileMenuOpen) {\n const rect = mobileMenuRef?.current?.getBoundingClientRect()\n setMenuInnerHeight(window?.innerHeight - (rect?.bottom || 0))\n }\n }, [mobileMenuOpen])\n\n useGSAP(() => {\n gsap.fromTo(\n mobileMenuRef.current,\n {\n height: 0,\n },\n {\n height: menuInnerHeight,\n duration: 0.3,\n }\n )\n }, [menuInnerHeight])\n\n useScrollLock(mobileMenuOpen)\n\n const currentBlockTypeCategories = useMemo(() => {\n return categoriesItem?.components?.[0]?.blockType\n }, [categoriesItem])\n\n const MobileSupportMenuComp = WithSupports(MobileSupportMenu, {\n categoriesItem,\n })\n\n const MobileSidebarMenuComp = WithSidebar(MobileSidebarMenu, categoriesItem)\n const MobileResourceSidebarMenuComp = WithResource(MobileResourceSidebarMenu, categoriesItem)\n const MobileMulticolMenuComp = WithMulticol(MobileMulticolMenu, categoriesItem)\n\n const MobileCategoriesMenuComp = useMemo(() => {\n switch (currentBlockTypeCategories) {\n case HeaderNavigationBlockType.Sidebar:\n return <MobileSidebarMenuComp />\n case HeaderNavigationBlockType.Resource:\n return <MobileResourceSidebarMenuComp />\n case HeaderNavigationBlockType.Supports:\n return <MobileSupportMenuComp />\n case HeaderNavigationBlockType.Multicol:\n return <MobileMulticolMenuComp />\n default:\n return null\n }\n }, [currentBlockTypeCategories, categoriesItem, MobileSupportMenuComp])\n\n const handleSecondaryMenuClose = useCallback(() => {\n setMobileMenuOpen(false)\n setMenuInnerHeight(0)\n setCurrentMenu && setCurrentMenu(HeaderNavigationMenu.Primary)\n }, [setMobileMenuOpen, setMenuInnerHeight, setCurrentMenu])\n\n const menuActions = useMemo(() => {\n return data?.bar?.actions?.filter(\n (item: any) => item?.mobileShow && item?.blockType !== HeaderNavigationActionBlockType.Profile // \u79FB\u52A8\u7AEF\u4E0D\u663E\u793Aprofile\u6309\u94AE\n )\n }, [data])\n\n const profileAction = useMemo(() => {\n return (\n data?.bar?.actions?.find(\n (item: any) => item?.mobileShow && item?.blockType === HeaderNavigationActionBlockType.Profile\n ) || {}\n )\n }, [data])\n\n const MobileCategoriesHeaderComp = useMemo(() => {\n switch (currentMenu) {\n case HeaderNavigationMenu.Primary:\n return (\n <PrimaryHeader\n actions={menuActions}\n menuOpen={mobileMenuOpen}\n onMenuOpenClose={() => {\n setMobileMenuOpen(false)\n setMenuInnerHeight(0)\n }}\n onMenuOpenClick={() => setMobileMenuOpen(true)}\n />\n )\n case HeaderNavigationMenu.Secondary:\n return (\n <SecondaryHeader\n title={categoriesItem?.text}\n onMenuOpenClose={handleSecondaryMenuClose}\n onMenuBackClick={() => setCurrentMenu?.(HeaderNavigationMenu.Primary)}\n />\n )\n case HeaderNavigationMenu.Third:\n return (\n <SecondaryHeader\n title={subSubCategory?.label}\n onMenuOpenClose={handleSecondaryMenuClose}\n onMenuBackClick={() => setCurrentMenu?.(HeaderNavigationMenu.Secondary)}\n />\n )\n default:\n return null\n }\n }, [\n mobileMenuOpen,\n currentMenu,\n setCurrentMenu,\n categoriesItem,\n menuActions,\n subSubCategory,\n handleSecondaryMenuClose,\n ])\n\n const handlePrimaryMenuClick = useCallback(\n (groupIndex: number, index: number) => {\n const categoriesItem = Array.isArray(groupCategories)\n ? Array.isArray(groupCategories[groupIndex])\n ? // @ts-ignore\n groupCategories[groupIndex][index]\n : {}\n : {}\n setCategoriesItem(categoriesItem)\n if (categoriesItem?.components?.[0]?.blockType === HeaderNavigationBlockType.Links) {\n // link\u6A21\u5757\u7279\u6B8A\u5904\u7406\n categoriesItem?.components?.[0]?.url && window.open(categoriesItem?.components?.[0]?.url)\n } else {\n setCurrentMenu?.(HeaderNavigationMenu.Secondary)\n }\n },\n [groupCategories, setCurrentMenu]\n )\n\n return (\n <Container className={cn('relative h-[52px]', className)}>\n {/* \u79FB\u52A8\u7AEF\u5206\u7C7B\u83DC\u5355 */}\n {MobileCategoriesHeaderComp}\n {mobileMenuOpen && (\n <nav\n ref={mobileMenuRef}\n className=\"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black\"\n style={{ height: menuInnerHeight }}\n role=\"navigation\"\n aria-label=\"Mobile navigation menu\"\n >\n {currentMenu === HeaderNavigationMenu.Primary && menuData ? (\n <div className=\"pt-4\">\n <BrandStrip data={menuData} />\n </div>\n ) : null}\n {currentMenu === HeaderNavigationMenu.Primary ? (\n <MobilePrimaryMenu\n categories={groupCategories}\n onPrimaryMenuClick={handlePrimaryMenuClick}\n onPrimaryNavClick={onPrimaryNavClick}\n profileAction={profileAction}\n />\n ) : (\n MobileCategoriesMenuComp\n )}\n </nav>\n )}\n </Container>\n )\n }\n)\n\n/**\n * \u79FB\u52A8\u7AEF\u4E00\u7EA7\u83DC\u5355\n * @param categories \u5206\u7C7B\n * @param onPrimaryMenuClick \u4E00\u7EA7\u83DC\u5355\u70B9\u51FB\n */\nconst MobilePrimaryMenu = ({\n categories,\n onPrimaryMenuClick,\n profileAction,\n onPrimaryNavClick,\n}: {\n categories: any\n onPrimaryMenuClick: (groupIndex: number, index: number) => void\n profileAction: any\n onPrimaryNavClick?: (category: any, position: number) => void\n}) => {\n return (\n <div className=\"flex h-full flex-col justify-between\">\n <div className=\"tablet:px-8 laptop:px-16 p-4\">\n {categories?.map((groupItem: any, groupIndex: number) => (\n <div key={`groupCategory-${groupIndex}`} className=\"\">\n <div className={cn('my-2 h-px w-full bg-[#E5E5E7]')} />\n {groupItem?.map((item: any, index: number) => (\n <MenuItem\n key={item.id}\n label={item.text}\n onClick={() => {\n const flatCategories = categories?.flat() || []\n const position = flatCategories?.findIndex(\n (item: any) => item?.id === categories[groupIndex][index]?.id\n )\n onPrimaryMenuClick(groupIndex, index)\n onPrimaryNavClick?.(item, position)\n }}\n icon={item.components?.[0]?.icon}\n />\n ))}\n </div>\n ))}\n </div>\n <ProfileComp profileAction={profileAction} />\n </div>\n )\n}\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 */\nconst ProfileComp = ({ profileAction }: { profileAction: any }) => {\n const [profileOpen, setProfileOpen] = useState(false)\n const { profile, event } = useNavContext()\n const { locale = 'us' } = useAiuiContext()\n return (\n <div\n className={cn('tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6', {\n 'p-4': profileOpen,\n })}\n >\n <button\n className=\"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent\"\n onClick={() => setProfileOpen(!profileOpen)}\n aria-expanded={profileOpen}\n aria-label={profile?.nick_name || profileAction?.welcome}\n >\n <div className=\"flex items-center gap-[14px]\">\n <div className=\"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white\">\n <User aria-hidden=\"true\" />\n </div>\n <Text html={profile?.nick_name || profileAction?.welcome} className=\"text-base font-bold leading-[1.4]\" />\n </div>\n {!profile?.email && (\n <DownArrow aria-hidden=\"true\" className={cn('laptop:size-4 size-5', { 'rotate-180': profileOpen })} />\n )}\n </button>\n {profile?.email && (\n <nav className=\"mt-4\" role=\"navigation\" aria-label=\"Profile menu\">\n {profileAction?.profiles?.map((item: any) => (\n <MenuItem key={item.id} label={item?.title} href={getLocalizedPath(item?.url, locale)} />\n ))}\n </nav>\n )}\n {profileOpen && !profile?.email && (\n <div className=\"mt-4\">\n <Text html={profileAction?.benefits_title} className=\"text-sm font-bold leading-[1.4]\" />\n <div className=\"mt-2 flex flex-col gap-1\">\n {profileAction?.benefits?.map((item: any) => (\n <div key={item.id} className=\"flex items-center gap-[6px]\">\n <Picture source={item.benefitIcon?.url} className=\"size-4\" alt={item.benefit} width={16} height={16} />\n <Text html={item.benefit} className=\"text-sm font-bold leading-[1.4]\" />\n </div>\n ))}\n </div>\n </div>\n )}\n {!profile?.email && (\n <div className=\"mt-4 flex items-center gap-3\">\n <Button className=\"tablet:flex-none flex-1\" variant=\"secondary\" size=\"base\" onClick={() => event?.join?.()}>\n <Text html={profileAction?.primaryButton || 'Join Now'} className=\"text-sm font-bold leading-[1.4]\" />\n </Button>\n <Button className=\"tablet:flex-none flex-1\" variant=\"primary\" size=\"base\" onClick={() => event?.login?.()}>\n <Text html={profileAction?.secondaryButton || 'Log In'} className=\"text-sm font-bold leading-[1.4]\" />\n </Button>\n </div>\n )}\n </div>\n )\n}\n\nconst PrimaryHeader = ({ menuOpen, onMenuOpenClose, onMenuOpenClick, actions }: MobilePrimaryNavigationData) => {\n return (\n <div className=\"flex h-full items-center justify-between gap-4\">\n <Logo />\n <div className=\"desktop:gap-6 flex items-center gap-4\">\n <Actions actions={actions} />\n {menuOpen ? (\n <button\n className=\"cursor-pointer border-0 bg-transparent p-0\"\n onClick={() => onMenuOpenClose()}\n aria-label=\"Close menu\"\n aria-expanded=\"true\"\n >\n <Close className=\"size-5\" aria-hidden=\"true\" />\n </button>\n ) : (\n <button\n className=\"cursor-pointer border-0 bg-transparent p-0\"\n onClick={() => onMenuOpenClick()}\n aria-label=\"Open menu\"\n aria-expanded=\"false\"\n aria-haspopup=\"true\"\n >\n <Menu className=\"size-5\" aria-hidden=\"true\" />\n </button>\n )}\n </div>\n </div>\n )\n}\n\nconst Logo = () => {\n const { payloadData, isMobile } = useNavContext()\n const { locale = 'us' } = useAiuiContext()\n return (\n <a\n href={getLocalizedPath('/', locale)}\n className=\"hover:text-brand-0 [&>svg]:w-full\"\n aria-label=\"Home\"\n dangerouslySetInnerHTML={{\n __html: isMobile ? payloadData?.bar?.mobileLogo : payloadData?.bar?.desktopLogo,\n }}\n />\n )\n}\n\nconst Actions = forwardRef<HTMLButtonElement, { actions: any; activeStatus?: boolean }>(\n ({ actions, activeStatus = false }, ref) => {\n const { event, cartCount } = useNavContext()\n const [activeAction, setActiveAction] = useState<any>(null)\n\n const getActionLabel = (blockType: string) => {\n switch (blockType) {\n case HeaderNavigationActionBlockType.Search:\n return 'Search'\n case HeaderNavigationActionBlockType.Cart:\n return `Shopping cart${cartCount > 0 ? ` (${cartCount} items)` : ''}`\n case HeaderNavigationActionBlockType.Profile:\n return 'User profile'\n case HeaderNavigationActionBlockType.Livestream:\n return 'Livestream'\n default:\n return 'Action'\n }\n }\n\n const handleActionClick = useCallback(\n (action: any, index: number) => {\n setActiveAction(index)\n switch (action?.blockType) {\n case HeaderNavigationActionBlockType.Search:\n event?.search?.()\n break\n case HeaderNavigationActionBlockType.Cart:\n event?.cart?.()\n break\n case HeaderNavigationActionBlockType.Profile:\n event?.profile?.()\n break\n case HeaderNavigationActionBlockType.Livestream:\n event?.livestream?.()\n break\n default:\n return () => {}\n }\n },\n [event]\n )\n\n return (\n <div className=\"desktop:gap-6 flex items-center gap-4\">\n {Array.isArray(actions) &&\n actions?.map((action: any, index: number) => (\n <button\n className=\"relative cursor-pointer border-0 bg-transparent p-0\"\n key={action.id}\n ref={action.blockType === HeaderNavigationActionBlockType.Profile ? ref : null}\n onClick={() => handleActionClick(action, index)}\n aria-label={getActionLabel(action.blockType)}\n aria-pressed={activeStatus && activeAction === index}\n >\n <Text\n html={action.icon}\n className={cn('size-5', { 'text-brand-0': activeStatus && activeAction === index })}\n aria-hidden=\"true\"\n />\n {action.blockType === HeaderNavigationActionBlockType.Cart && cartCount > 0 && (\n <div\n className=\"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]\"\n aria-hidden=\"true\"\n >\n <Text html={cartCount?.toString()} className=\"text-sm font-bold leading-[1.2] text-white\" />\n </div>\n )}\n </button>\n ))}\n </div>\n )\n }\n)\n\nconst SecondaryHeader = ({ title, onMenuOpenClose, onMenuBackClick }: MobileSecondaryNavigationData) => {\n return (\n <div className=\"flex h-full items-center gap-3\">\n <button\n className=\"cursor-pointer border-0 bg-transparent p-0\"\n onClick={() => onMenuBackClick()}\n aria-label=\"Back to previous menu\"\n >\n <LeftArrow className=\"size-5\" aria-hidden=\"true\" />\n </button>\n <Text html={title} className=\"flex-1 text-center text-base font-bold leading-[1.4]\" />\n <button\n className=\"cursor-pointer border-0 bg-transparent p-0\"\n onClick={() => onMenuOpenClose()}\n aria-label=\"Close menu\"\n >\n <Close className=\"size-5\" aria-hidden=\"true\" />\n </button>\n </div>\n )\n}\n\nMobileNavigation.displayName = 'MobileNavigation'\nActions.displayName = 'Actions'\nHeaderNavigation.displayName = 'HeaderNavigation'\nDesktopNavigation.displayName = 'DesktopNavigation'\n\nexport default withLayout(HeaderNavigation)\n"],
|
|
5
|
-
"mappings": "aA4MU,OA8UI,YAAAA,GA9UJ,OAAAC,EAcE,QAAAC,MAdF,oBA3MV,OAAgB,cAAAC,GAAY,eAAAC,GAAa,aAAAC,EAAW,uBAAAC,GAAqB,WAAAC,EAAS,UAAAC,EAAQ,YAAAC,MAAgB,QAE1G,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ACD,EACL,CAEJ,CACF,EAEMjB,GAAkB,CAAC,CAAE,MAAAkB,EAAO,gBAAAV,EAAiB,gBAAAW,CAAgB,IAE/D5K,EAAC,OAAI,UAAU,iCACb,UAAAD,EAAC,UACC,UAAU,6CACV,QAAS,IAAM6K,EAAgB,EAC/B,aAAW,wBAEX,SAAA7K,EAACiC,GAAA,CAAU,UAAU,SAAS,cAAY,OAAO,EACnD,EACAjC,EAACU,EAAA,CAAK,KAAMkK,EAAO,UAAU,uDAAuD,EACpF5K,EAAC,UACC,UAAU,6CACV,QAAS,IAAMkK,EAAgB,EAC/B,aAAW,aAEX,SAAAlK,EAAC+B,GAAA,CAAM,UAAU,SAAS,cAAY,OAAO,EAC/C,GACF,EAIJ4D,GAAiB,YAAc,mBAC/B0C,GAAQ,YAAc,UACtBpF,GAAiB,YAAc,mBAC/ByC,GAAkB,YAAc,oBAEhC,IAAOoF,GAAQhK,GAAWmC,EAAgB",
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react'\n\nimport { Picture, Text, Button, Container, BrandStrip } from '../../components/index.js'\n\nimport { withLayout } from '../../shared/Styles.js'\n\nimport { cn, getLocalizedPath } from '../../helpers/utils.js'\n\nimport type {\n MobilePrimaryNavigationData,\n MobileSecondaryNavigationData,\n MobileNavigationProps,\n DesktopNavigationProps,\n HeaderNavigationProps,\n} from './types.js'\nimport NavProvider, { useNavContext } from './NavProvider.js'\n\nimport { HeaderNavigationMenu, HeaderNavigationBlockType, HeaderNavigationActionBlockType } from './types.js'\n\nimport jump from 'jump.js'\n\nimport { useGSAP } from '@gsap/react'\nimport { gsap } from 'gsap'\n\nimport { WithSidebar, WithSupports, WithMulticol, WithGroupCategory, WithResource } from './withCategory.js'\n\nimport { Menu, Close, User, LeftArrow, DownArrow, Polygon } from './icons/index.js'\n\nimport NavigationSearch from '../NavigationSearch/index.js'\nimport { ResourceSidebarDropdown } from './ResourceSidebarDropdown.js'\nimport { MobileResourceSidebarMenu } from './MobileResourceSidebarMenu.js'\nimport { SidebarDropdown } from './SidebarDropdown.js'\nimport { useScrollLock } from './useScrollLock.js'\nimport { MulticolDropdown } from './MulticolDropdown.js'\nimport { SupportsDropdown } from './SupportsDropdown.js'\nimport { MobileSidebarMenu } from './MobileSidebarMenu.js'\nimport { MobileSupportMenu } from './MobileSupportMenu.js'\nimport { MobileMulticolMenu } from './MobileMulticolMenu.js'\nimport { MenuItem } from './MobileMenuComponents.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport throttle from '../../shared/throttle.js'\n\nconst HeaderNavigation = forwardRef<HTMLDivElement, HeaderNavigationProps>((props, ref) => {\n const {\n data: { header } = {},\n buildProps,\n event,\n profile,\n theme = 'light',\n isTop = false,\n searchResult,\n onSearch,\n isSearching,\n keywords,\n onPrimaryNavClick,\n onSeriesProductClick,\n onSidebarNavClick,\n headerId,\n cartCount,\n menuData,\n } = props\n\n const [searchOpen, setSearchOpen] = useState(false)\n const [headerHidden, setHeaderHidden] = useState(false)\n const [changeHeaderBackground, setChangeHeaderBackground] = useState(false)\n const [isMobile, setIsMobile] = useState(false)\n const searchRef = useRef<HTMLDivElement>(null)\n\n const headerRef = useRef<HTMLDivElement>(null)\n\n const resizeWindow = () => {\n const offsetWidth = document?.querySelector('body')?.offsetWidth || 0\n setIsMobile(offsetWidth <= 1440)\n }\n\n useEffect(() => {\n resizeWindow()\n window.addEventListener('resize', resizeWindow)\n return () => {\n window.removeEventListener('resize', resizeWindow)\n }\n }, [])\n\n useImperativeHandle(ref, () => headerRef.current as HTMLDivElement)\n\n useEffect(() => {\n if (headerRef.current && isTop) {\n jump(headerRef.current, { duration: 0, offset: headerRef.current?.getBoundingClientRect()?.bottom || 0 })\n }\n }, [isTop])\n\n useEffect(() => {\n // \u5982\u679C isTop \u4E3A true\uFF0C\u4E0D\u9700\u8981\u6EDA\u52A8\u76D1\u542C\u548C\u52A8\u6548\n if (isTop) {\n setHeaderHidden(false)\n setChangeHeaderBackground(false)\n return\n }\n\n let lastScrollY = 0\n let upwardDistance = 0\n let downwardDistance = 0\n\n const getScrollTop = () => {\n return document?.documentElement?.scrollTop || document?.body?.scrollTop || 0\n }\n\n // \u521D\u59CB\u5316\u72B6\u6001\n const initialScrollTop = getScrollTop()\n lastScrollY = initialScrollTop\n setHeaderHidden(initialScrollTop > 300)\n setChangeHeaderBackground(initialScrollTop > 30)\n\n const handleScroll = throttle(() => {\n const currentScrollY = getScrollTop()\n const delta = currentScrollY - lastScrollY\n\n // \u66F4\u65B0\u80CC\u666F\u72B6\u6001\n setChangeHeaderBackground(currentScrollY > 30)\n\n if (delta > 0) {\n // \u5411\u4E0B\u6EDA\u52A8\n upwardDistance = 0 // \u91CD\u7F6E\u5411\u4E0A\u7D2F\u8BA1\n downwardDistance += delta\n\n if (downwardDistance >= 300 && currentScrollY > 300) {\n setHeaderHidden(true)\n }\n } else if (delta < 0) {\n // \u5411\u4E0A\u6EDA\u52A8\n downwardDistance = 0 // \u91CD\u7F6E\u5411\u4E0B\u7D2F\u8BA1\n upwardDistance += Math.abs(delta)\n\n if (upwardDistance >= 300) {\n setHeaderHidden(false)\n upwardDistance = 0\n }\n }\n\n lastScrollY = currentScrollY\n }, 100)\n\n window.addEventListener('scroll', handleScroll, { passive: true })\n return () => window.removeEventListener('scroll', handleScroll)\n }, [isTop])\n\n useEffect(() => {\n if (event) {\n event.search = () => setSearchOpen(true)\n }\n }, [event])\n\n useGSAP(() => {\n if (searchRef?.current && searchOpen) {\n gsap.fromTo(\n searchRef.current,\n {\n height: 0,\n },\n {\n height: 'auto',\n duration: 0.3,\n }\n )\n }\n }, [searchOpen])\n\n useScrollLock(searchOpen)\n\n const searchPage = useMemo(() => {\n return (\n header?.bar?.actions?.find((item: any) => item?.blockType === HeaderNavigationActionBlockType.Search)\n ?.searchBar?.[0] || {}\n )\n }, [header])\n\n return (\n <NavProvider\n buildProps={buildProps}\n profile={profile}\n isMobile={isMobile}\n event={event}\n payloadData={header}\n onSidebarNavClick={onSidebarNavClick}\n onSeriesProductClick={onSeriesProductClick}\n cartCount={cartCount}\n >\n <header\n id={headerId || 'header'}\n data-ui-component-id=\"HeaderNavigation\"\n className={\n isTop\n ? 'relative z-[100] bg-white'\n : cn('sticky top-0 z-[100] transition-transform duration-500 ease-in-out', {\n ['translate-y-[-100%]']: headerHidden,\n })\n }\n // className=\"relative z-[100] bg-white\"\n ref={headerRef}\n >\n <div\n className={cn(\n 'hover:bg-white hover:text-black',\n theme === 'light' ? 'text-black' : 'text-white',\n {\n ['!bg-white transition-all duration-500 ease-in-out']: !isTop && changeHeaderBackground,\n },\n {\n ['hover:!text-black']: theme === 'dark',\n ['!text-black']: !isTop && changeHeaderBackground,\n }\n )}\n onClick={() => !isTop && setChangeHeaderBackground(true)}\n >\n <DesktopNavigation\n data={header}\n className=\"desktop:block hidden !bg-white\"\n theme={theme}\n onNavItemClick={() => !isTop && setChangeHeaderBackground(true)}\n onPrimaryNavClick={onPrimaryNavClick}\n />\n <MobileNavigation\n menuData={menuData}\n data={header}\n className=\"desktop:hidden block !bg-white\"\n onPrimaryNavClick={onPrimaryNavClick}\n />\n {searchOpen && (\n <div\n className=\"absolute left-0 top-0 z-[60] flex w-full flex-col bg-black/70\"\n style={{ height: `calc(100dvh - ${headerRef?.current?.getBoundingClientRect()?.top}px)` }}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"Search\"\n >\n <div ref={searchRef} className={cn('overflow-y-auto', {})}>\n <NavigationSearch\n data={searchPage}\n keywords={keywords}\n isSearching={isSearching}\n searchResult={searchResult}\n onSearch={(value: string) => {\n onSearch?.(value)\n }}\n onClose={() => {\n onSearch?.()\n setSearchOpen(false)\n }}\n />\n </div>\n <div\n className=\"flex-1 bg-transparent\"\n onClick={() => setSearchOpen(false)}\n role=\"button\"\n tabIndex={0}\n aria-label=\"Close search\"\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ' || e.key === 'Escape') {\n e.preventDefault()\n setSearchOpen(false)\n }\n }}\n />\n </div>\n )}\n </div>\n </header>\n </NavProvider>\n )\n})\n\nconst DesktopNavigation = forwardRef<HTMLDivElement, DesktopNavigationProps>((props, ref) => {\n const { data, onNavItemClick, className, theme, onPrimaryNavClick } = props\n const { event, profile } = useNavContext()\n const [downdownHover, setDowndownHover] = useState(false)\n const { locale = 'us' } = useAiuiContext()\n\n const groupCategories = useMemo(() => {\n return WithGroupCategory(data?.categories?.filter((item: any) => item?.pcShow)) as any[][]\n }, [data])\n\n const [categoriesItem, setCategoriesItem] = useState<any>(null)\n const [navStatusArray, setNavStatusArray] = useState<{ index: number; groupIndex: number; open: boolean }[][]>([])\n const profileRef = useRef<HTMLButtonElement>(null)\n const [userProfileOpen, setUserProfileOpen] = useState(false)\n const headerRef = useRef<HTMLDivElement>(null)\n const dropdownRef = useRef<HTMLDivElement>(null)\n const navItemRefs = useRef<HTMLDivElement[][]>(\n groupCategories.map((categories: any) => Array(categories?.length || 0).fill(null))\n )\n\n useEffect(() => {\n if (groupCategories?.length) {\n setNavStatusArray(\n groupCategories?.map((groupItem: any, groupIndex: number) => {\n return groupItem?.map((_: any, index: number) => ({ groupIndex, index, open: false }))\n })\n )\n }\n }, [groupCategories])\n\n const currentNavItem = useMemo(() => {\n let currentNavItem: { index: number; groupIndex: number; open: boolean } | null = null\n for (const groupItem of navStatusArray) {\n for (const item of groupItem) {\n if (item.open) {\n currentNavItem = item\n break\n }\n }\n if (currentNavItem) break\n }\n return currentNavItem\n }, [navStatusArray])\n\n useScrollLock(!!currentNavItem?.open || userProfileOpen)\n\n const handleNavItemClick = (e: any, groupIndex: number, index: number) => {\n setUserProfileOpen(false)\n // if (categoriesItem?.components?.[0]?.blockType === HeaderNavigationBlockType.Links) {\n const currentCategoriesItem = groupCategories[groupIndex][index]\n if (currentCategoriesItem?.components?.[0]?.blockType === HeaderNavigationBlockType.Links) {\n // link\u6A21\u5757\u7279\u6B8A\u5904\u7406\n // categoriesItem?.components?.[0]?.url && window.open(categoriesItem?.components?.[0]?.url)\n currentCategoriesItem?.components?.[0]?.url && window.open(currentCategoriesItem?.components?.[0]?.url)\n } else {\n const categories = groupCategories?.flat() || []\n const position = categories?.findIndex(item => item?.id === groupCategories[groupIndex][index]?.id)\n e.stopPropagation()\n onNavItemClick?.()\n onPrimaryNavClick?.(categories[position], position)\n // setCategoriesItem(groupCategories[groupIndex][index])\n setCategoriesItem(currentCategoriesItem)\n setNavStatusArray(prev =>\n prev.map(groupItem =>\n groupItem.map(item =>\n item.groupIndex === groupIndex && item.index === index\n ? { ...item, open: !item.open }\n : { ...item, open: false }\n )\n )\n )\n }\n }\n\n const handleNavItemKeyDown = (e: React.KeyboardEvent, groupIndex: number, index: number) => {\n if (e.key === 'Enter' || e.key === ' ') {\n e.preventDefault()\n handleNavItemClick(e, groupIndex, index)\n } else if (e.key === 'Escape' && currentNavItem?.groupIndex === groupIndex && currentNavItem?.index === index) {\n e.preventDefault()\n handleNavMenuClose()\n }\n }\n\n const handleNavMenuClose = () => {\n setNavStatusArray(prev => prev.map(groupItem => groupItem.map(item => ({ ...item, open: false }))))\n }\n\n const currentBlockTypeCategories = useMemo(() => {\n if (categoriesItem) return categoriesItem?.components?.[0]?.blockType\n }, [categoriesItem])\n\n const SidebarDropdownComp = WithSidebar(SidebarDropdown, categoriesItem)\n const ResourceSidebarDropdownComp = WithResource(ResourceSidebarDropdown, categoriesItem)\n const MulticolDropdownComp = WithMulticol(MulticolDropdown, categoriesItem)\n const SupportsDropdownComp = WithSupports(SupportsDropdown, {\n categoriesItem,\n currentNavItemRef: navItemRefs.current?.[currentNavItem?.groupIndex || 0]?.[currentNavItem?.index || 0],\n })\n\n const DropdownComp = useMemo(() => {\n switch (currentBlockTypeCategories) {\n case HeaderNavigationBlockType.Sidebar:\n return <SidebarDropdownComp />\n case HeaderNavigationBlockType.Resource:\n return <ResourceSidebarDropdownComp />\n case HeaderNavigationBlockType.Supports:\n return <SupportsDropdownComp />\n case HeaderNavigationBlockType.Multicol:\n return <MulticolDropdownComp />\n default:\n return null\n }\n }, [currentBlockTypeCategories, categoriesItem])\n\n const actions = useMemo(() => {\n return data?.bar?.actions?.filter((item: any) => item?.pcShow)\n }, [data])\n\n const profileAction = useMemo(() => {\n return actions?.find((item: any) => item?.blockType === HeaderNavigationActionBlockType.Profile)\n }, [actions])\n\n const handleProfileClick = useCallback(() => {\n setUserProfileOpen(prev => !prev)\n }, [])\n\n useEffect(() => {\n if (profileRef?.current) {\n const profileRefElement = profileRef.current as HTMLButtonElement\n profileRefElement.addEventListener('click', handleProfileClick)\n\n return () => {\n profileRefElement.removeEventListener('click', handleProfileClick)\n }\n }\n }, [handleProfileClick])\n\n useGSAP(() => {\n if (currentNavItem?.open) {\n gsap.fromTo(\n dropdownRef?.current,\n {\n height: 0,\n },\n {\n height: 'auto',\n }\n )\n }\n }, [currentNavItem?.open])\n\n return (\n <Container className={cn('relative h-[96px]', className)}>\n <div ref={headerRef} onClick={handleNavMenuClose} className=\"flex h-full flex-col justify-end gap-4\">\n <div className=\"flex items-center justify-between\">\n <Logo />\n <Actions ref={profileRef} actions={actions} activeStatus={userProfileOpen} />\n </div>\n <nav className=\"flex justify-between\" role=\"navigation\" aria-label=\"Primary navigation\">\n {groupCategories?.map((groupItem: any, groupIndex: number) => {\n return (\n <div key={`groupCategory-${groupIndex}`} className=\"flex gap-3\">\n {groupItem?.map((item: any, index: number) => {\n const isExpanded = currentNavItem?.groupIndex === groupIndex && currentNavItem?.index === index\n return (\n <div\n key={item.id}\n ref={(el: HTMLDivElement) => {\n navItemRefs.current[groupIndex][index] = el\n }}\n className=\"group\"\n >\n <div className=\"relative\">\n <button\n className=\"flex cursor-pointer items-center gap-1 border-0 bg-transparent pb-4\"\n onClick={e => handleNavItemClick(e, groupIndex, index)}\n onKeyDown={e => handleNavItemKeyDown(e, groupIndex, index)}\n aria-expanded={isExpanded}\n aria-haspopup=\"true\"\n aria-label={item.text}\n >\n <Text html={item.text} className=\"text-sm font-bold leading-[1.4]\" />\n {/* <DownArrow\n aria-hidden=\"true\"\n className={cn('size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100', {\n ['rotate-180']: isExpanded,\n ['opacity-100']: downdownHover && isExpanded,\n })}\n /> */}\n <DownArrow\n className={cn('size-4 opacity-0 transition-opacity duration-500 group-hover:opacity-100', {\n ['rotate-180']:\n currentNavItem?.groupIndex === groupIndex && currentNavItem?.index === index,\n ['opacity-100']:\n downdownHover &&\n currentNavItem?.groupIndex === groupIndex &&\n currentNavItem?.index === index,\n ['invisible']:\n !item?.components?.length ||\n item?.components?.[0]?.blockType === HeaderNavigationBlockType.Links,\n })}\n />\n </button>\n <div\n className={cn(\n 'absolute bottom-0 left-0 h-[2px] w-0 transition-all duration-500',\n {\n 'w-[calc(100%-20px)]': isExpanded,\n },\n theme === 'dark' ? 'bg-white' : 'bg-[#080A0F]'\n )}\n aria-hidden=\"true\"\n />\n </div>\n </div>\n )\n })}\n </div>\n )\n })}\n </nav>\n </div>\n <div\n role=\"menu\"\n aria-hidden={!(currentNavItem?.open && categoriesItem)}\n className={cn(\n 'absolute left-0 top-full z-[999] flex w-full flex-col overflow-hidden border-t border-b-[#E4E5E6] bg-black/70 text-black',\n {\n hidden: !(currentNavItem?.open && categoriesItem),\n }\n )}\n onMouseEnter={() => setDowndownHover(true)}\n onMouseLeave={() => setDowndownHover(false)}\n style={{ height: `calc(100dvh - ${headerRef?.current?.getBoundingClientRect()?.bottom}px)` }}\n >\n <div\n ref={dropdownRef}\n className={cn('relative z-50', {\n 'overflow-hidden': currentBlockTypeCategories !== HeaderNavigationBlockType.Supports,\n })}\n >\n {DropdownComp}\n </div>\n <div\n className=\"flex-1 bg-transparent\"\n onClick={handleNavMenuClose}\n role=\"button\"\n tabIndex={0}\n aria-label=\"Close menu\"\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ' || e.key === 'Escape') {\n e.preventDefault()\n handleNavMenuClose()\n }\n }}\n />\n </div>\n {userProfileOpen && (\n <div\n className=\"absolute left-0 top-full z-[999] flex h-dvh w-full bg-black/70\"\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label=\"User profile menu\"\n // style={{\n // height: `calc(100dvh - ${profileRef?.current?.getBoundingClientRect()?.bottom}px)`,\n // top: `calc(96px)`,\n // }}\n >\n <div\n className=\"rounded-box absolute w-[272px] overflow-hidden bg-white p-4\"\n style={{\n right: `calc(100% - ${profileRef?.current?.getBoundingClientRect()?.right}px)`,\n top: '-36px',\n }}\n >\n {profile?.email ? (\n <>\n <Text html={profile?.nick_name || profileAction?.welcome} className=\"text-sm font-bold\" />\n <div className=\"mt-2 h-px bg-[#D9D9D9]\" aria-hidden=\"true\" />\n <nav className=\"mt-2\" role=\"navigation\" aria-label=\"Profile navigation\">\n {profileAction?.profiles?.map((item: any) => (\n <MenuItem\n className=\"py-2\"\n key={item.id}\n label={item?.title}\n href={getLocalizedPath(item?.url, locale)}\n />\n ))}\n </nav>\n </>\n ) : (\n <>\n <Polygon className=\"absolute -top-2 right-[46px] z-30 text-white\" aria-hidden=\"true\" />\n <Text html={profileAction?.benefits_title} className=\"text-sm font-bold leading-[1.4]\" />\n <div className=\"mt-2 flex flex-col gap-1\">\n {profileAction?.benefits?.map((item: any) => (\n <div key={item.id} className=\"flex items-center gap-[6px]\">\n <Picture\n source={item.benefitIcon?.url}\n className=\"size-4\"\n alt={item.benefit}\n width={16}\n height={16}\n />\n <Text html={item.benefit} className=\"text-sm font-bold leading-[1.4]\" />\n </div>\n ))}\n </div>\n <div className=\"mt-4 flex items-center gap-2\">\n <Button variant=\"secondary\" size=\"lg\" onClick={() => event?.join?.()}>\n <Text html={profileAction?.primaryButton || 'Join Now'} className=\"font-bold\" />\n </Button>\n <Button variant=\"primary\" size=\"lg\" onClick={() => event?.login?.()}>\n <Text html={profileAction?.secondaryButton || 'Log In'} className=\"font-bold\" />\n </Button>\n </div>\n </>\n )}\n </div>\n <div\n className=\"flex-1 bg-transparent\"\n onClick={() => setUserProfileOpen(false)}\n role=\"button\"\n tabIndex={0}\n aria-label=\"Close profile menu\"\n onKeyDown={e => {\n if (e.key === 'Enter' || e.key === ' ' || e.key === 'Escape') {\n e.preventDefault()\n setUserProfileOpen(false)\n }\n }}\n />\n </div>\n )}\n </Container>\n )\n})\n\nconst MobileNavigation = forwardRef<HTMLDivElement, MobileNavigationProps>(\n ({ data, menuData, className, onPrimaryNavClick }, ref) => {\n const groupCategories = useMemo(() => {\n return WithGroupCategory(data?.categories?.filter((item: any) => item?.mobileShow))\n }, [data])\n\n const { currentMenu, setCurrentMenu, subSubCategory } = useNavContext()\n const [mobileMenuOpen, setMobileMenuOpen] = useState(false)\n const [menuInnerHeight, setMenuInnerHeight] = useState(0)\n const [categoriesItem, setCategoriesItem] = useState<any>(null)\n\n const mobileMenuRef = useRef<HTMLDivElement>(null)\n\n useEffect(() => {\n if (mobileMenuRef?.current && mobileMenuOpen) {\n const rect = mobileMenuRef?.current?.getBoundingClientRect()\n setMenuInnerHeight(window?.innerHeight - (rect?.bottom || 0))\n }\n }, [mobileMenuOpen])\n\n useGSAP(() => {\n gsap.fromTo(\n mobileMenuRef.current,\n {\n height: 0,\n },\n {\n height: menuInnerHeight,\n duration: 0.3,\n }\n )\n }, [menuInnerHeight])\n\n useScrollLock(mobileMenuOpen)\n\n const currentBlockTypeCategories = useMemo(() => {\n return categoriesItem?.components?.[0]?.blockType\n }, [categoriesItem])\n\n const MobileSupportMenuComp = WithSupports(MobileSupportMenu, {\n categoriesItem,\n })\n\n const MobileSidebarMenuComp = WithSidebar(MobileSidebarMenu, categoriesItem)\n const MobileResourceSidebarMenuComp = WithResource(MobileResourceSidebarMenu, categoriesItem)\n const MobileMulticolMenuComp = WithMulticol(MobileMulticolMenu, categoriesItem)\n\n const MobileCategoriesMenuComp = useMemo(() => {\n switch (currentBlockTypeCategories) {\n case HeaderNavigationBlockType.Sidebar:\n return <MobileSidebarMenuComp />\n case HeaderNavigationBlockType.Resource:\n return <MobileResourceSidebarMenuComp />\n case HeaderNavigationBlockType.Supports:\n return <MobileSupportMenuComp />\n case HeaderNavigationBlockType.Multicol:\n return <MobileMulticolMenuComp />\n default:\n return null\n }\n }, [currentBlockTypeCategories, categoriesItem, MobileSupportMenuComp])\n\n const handleSecondaryMenuClose = useCallback(() => {\n setMobileMenuOpen(false)\n setMenuInnerHeight(0)\n setCurrentMenu && setCurrentMenu(HeaderNavigationMenu.Primary)\n }, [setMobileMenuOpen, setMenuInnerHeight, setCurrentMenu])\n\n const menuActions = useMemo(() => {\n return data?.bar?.actions?.filter(\n (item: any) => item?.mobileShow && item?.blockType !== HeaderNavigationActionBlockType.Profile // \u79FB\u52A8\u7AEF\u4E0D\u663E\u793Aprofile\u6309\u94AE\n )\n }, [data])\n\n const profileAction = useMemo(() => {\n return (\n data?.bar?.actions?.find(\n (item: any) => item?.mobileShow && item?.blockType === HeaderNavigationActionBlockType.Profile\n ) || {}\n )\n }, [data])\n\n const MobileCategoriesHeaderComp = useMemo(() => {\n switch (currentMenu) {\n case HeaderNavigationMenu.Primary:\n return (\n <PrimaryHeader\n actions={menuActions}\n menuOpen={mobileMenuOpen}\n onMenuOpenClose={() => {\n setMobileMenuOpen(false)\n setMenuInnerHeight(0)\n }}\n onMenuOpenClick={() => setMobileMenuOpen(true)}\n />\n )\n case HeaderNavigationMenu.Secondary:\n return (\n <SecondaryHeader\n title={categoriesItem?.text}\n onMenuOpenClose={handleSecondaryMenuClose}\n onMenuBackClick={() => setCurrentMenu?.(HeaderNavigationMenu.Primary)}\n />\n )\n case HeaderNavigationMenu.Third:\n return (\n <SecondaryHeader\n title={subSubCategory?.label}\n onMenuOpenClose={handleSecondaryMenuClose}\n onMenuBackClick={() => setCurrentMenu?.(HeaderNavigationMenu.Secondary)}\n />\n )\n default:\n return null\n }\n }, [\n mobileMenuOpen,\n currentMenu,\n setCurrentMenu,\n categoriesItem,\n menuActions,\n subSubCategory,\n handleSecondaryMenuClose,\n ])\n\n const handlePrimaryMenuClick = useCallback(\n (groupIndex: number, index: number) => {\n const categoriesItem = Array.isArray(groupCategories)\n ? Array.isArray(groupCategories[groupIndex])\n ? // @ts-ignore\n groupCategories[groupIndex][index]\n : {}\n : {}\n setCategoriesItem(categoriesItem)\n if (categoriesItem?.components?.[0]?.blockType === HeaderNavigationBlockType.Links) {\n // link\u6A21\u5757\u7279\u6B8A\u5904\u7406\n categoriesItem?.components?.[0]?.url && window.open(categoriesItem?.components?.[0]?.url)\n } else {\n setCurrentMenu?.(HeaderNavigationMenu.Secondary)\n }\n },\n [groupCategories, setCurrentMenu]\n )\n\n return (\n <Container className={cn('relative h-[52px]', className)}>\n {/* \u79FB\u52A8\u7AEF\u5206\u7C7B\u83DC\u5355 */}\n {MobileCategoriesHeaderComp}\n {mobileMenuOpen && (\n <nav\n ref={mobileMenuRef}\n className=\"absolute left-0 top-full z-[999] w-full overflow-y-auto border-t border-[#E4E5E6] bg-white text-black\"\n style={{ height: menuInnerHeight }}\n role=\"navigation\"\n aria-label=\"Mobile navigation menu\"\n >\n {currentMenu === HeaderNavigationMenu.Primary && menuData ? (\n <div className=\"pt-4\">\n <BrandStrip data={menuData} />\n </div>\n ) : null}\n {currentMenu === HeaderNavigationMenu.Primary ? (\n <MobilePrimaryMenu\n categories={groupCategories}\n onPrimaryMenuClick={handlePrimaryMenuClick}\n onPrimaryNavClick={onPrimaryNavClick}\n profileAction={profileAction}\n />\n ) : (\n MobileCategoriesMenuComp\n )}\n </nav>\n )}\n </Container>\n )\n }\n)\n\n/**\n * \u79FB\u52A8\u7AEF\u4E00\u7EA7\u83DC\u5355\n * @param categories \u5206\u7C7B\n * @param onPrimaryMenuClick \u4E00\u7EA7\u83DC\u5355\u70B9\u51FB\n */\nconst MobilePrimaryMenu = ({\n categories,\n onPrimaryMenuClick,\n profileAction,\n onPrimaryNavClick,\n}: {\n categories: any\n onPrimaryMenuClick: (groupIndex: number, index: number) => void\n profileAction: any\n onPrimaryNavClick?: (category: any, position: number) => void\n}) => {\n return (\n <div className=\"flex h-full flex-col justify-between\">\n <div className=\"tablet:px-8 laptop:px-16 p-4\">\n {categories?.map((groupItem: any, groupIndex: number) => (\n <div key={`groupCategory-${groupIndex}`} className=\"\">\n <div className={cn('my-2 h-px w-full bg-[#E5E5E7]')} />\n {groupItem?.map((item: any, index: number) => (\n <MenuItem\n key={item.id}\n label={item.text}\n onClick={() => {\n const flatCategories = categories?.flat() || []\n const position = flatCategories?.findIndex(\n (item: any) => item?.id === categories[groupIndex][index]?.id\n )\n onPrimaryMenuClick(groupIndex, index)\n onPrimaryNavClick?.(item, position)\n }}\n icon={item.components?.[0]?.icon}\n />\n ))}\n </div>\n ))}\n </div>\n <ProfileComp profileAction={profileAction} />\n </div>\n )\n}\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 */\nconst ProfileComp = ({ profileAction }: { profileAction: any }) => {\n const [profileOpen, setProfileOpen] = useState(false)\n const { profile, event } = useNavContext()\n const { locale = 'us' } = useAiuiContext()\n return (\n <div\n className={cn('tablet:px-8 laptop:px-16 bg-[#F5F5F7] px-4 py-6', {\n 'p-4': profileOpen,\n })}\n >\n <button\n className=\"flex w-full cursor-pointer items-center justify-between border-0 bg-transparent\"\n onClick={() => setProfileOpen(!profileOpen)}\n aria-expanded={profileOpen}\n aria-label={profile?.nick_name || profileAction?.welcome}\n >\n <div className=\"flex items-center gap-[14px]\">\n <div className=\"flex size-[40px] shrink-0 items-center justify-center rounded-full bg-white\">\n <User aria-hidden=\"true\" />\n </div>\n <Text html={profile?.nick_name || profileAction?.welcome} className=\"text-base font-bold leading-[1.4]\" />\n </div>\n {!profile?.email && (\n <DownArrow aria-hidden=\"true\" className={cn('laptop:size-4 size-5', { 'rotate-180': profileOpen })} />\n )}\n </button>\n {profile?.email && (\n <nav className=\"mt-4\" role=\"navigation\" aria-label=\"Profile menu\">\n {profileAction?.profiles?.map((item: any) => (\n <MenuItem key={item.id} label={item?.title} href={getLocalizedPath(item?.url, locale)} />\n ))}\n </nav>\n )}\n {profileOpen && !profile?.email && (\n <div className=\"mt-4\">\n <Text html={profileAction?.benefits_title} className=\"text-sm font-bold leading-[1.4]\" />\n <div className=\"mt-2 flex flex-col gap-1\">\n {profileAction?.benefits?.map((item: any) => (\n <div key={item.id} className=\"flex items-center gap-[6px]\">\n <Picture source={item.benefitIcon?.url} className=\"size-4\" alt={item.benefit} width={16} height={16} />\n <Text html={item.benefit} className=\"text-sm font-bold leading-[1.4]\" />\n </div>\n ))}\n </div>\n </div>\n )}\n {!profile?.email && (\n <div className=\"mt-4 flex items-center gap-3\">\n <Button className=\"tablet:flex-none flex-1\" variant=\"secondary\" size=\"base\" onClick={() => event?.join?.()}>\n <Text html={profileAction?.primaryButton || 'Join Now'} className=\"text-sm font-bold leading-[1.4]\" />\n </Button>\n <Button className=\"tablet:flex-none flex-1\" variant=\"primary\" size=\"base\" onClick={() => event?.login?.()}>\n <Text html={profileAction?.secondaryButton || 'Log In'} className=\"text-sm font-bold leading-[1.4]\" />\n </Button>\n </div>\n )}\n </div>\n )\n}\n\nconst PrimaryHeader = ({ menuOpen, onMenuOpenClose, onMenuOpenClick, actions }: MobilePrimaryNavigationData) => {\n return (\n <div className=\"flex h-full items-center justify-between gap-4\">\n <Logo />\n <div className=\"desktop:gap-6 flex items-center gap-4\">\n <Actions actions={actions} />\n {menuOpen ? (\n <button\n className=\"cursor-pointer border-0 bg-transparent p-0\"\n onClick={() => onMenuOpenClose()}\n aria-label=\"Close menu\"\n aria-expanded=\"true\"\n >\n <Close className=\"size-5\" aria-hidden=\"true\" />\n </button>\n ) : (\n <button\n className=\"cursor-pointer border-0 bg-transparent p-0\"\n onClick={() => onMenuOpenClick()}\n aria-label=\"Open menu\"\n aria-expanded=\"false\"\n aria-haspopup=\"true\"\n >\n <Menu className=\"size-5\" aria-hidden=\"true\" />\n </button>\n )}\n </div>\n </div>\n )\n}\n\nconst Logo = () => {\n const { payloadData, isMobile } = useNavContext()\n const { locale = 'us' } = useAiuiContext()\n return (\n <a\n href={getLocalizedPath('/', locale)}\n className=\"hover:text-brand-0 [&>svg]:w-full\"\n aria-label=\"Home\"\n dangerouslySetInnerHTML={{\n __html: isMobile ? payloadData?.bar?.mobileLogo : payloadData?.bar?.desktopLogo,\n }}\n />\n )\n}\n\nconst Actions = forwardRef<HTMLButtonElement, { actions: any; activeStatus?: boolean }>(\n ({ actions, activeStatus = false }, ref) => {\n const { event, cartCount } = useNavContext()\n const [activeAction, setActiveAction] = useState<any>(null)\n\n const getActionLabel = (blockType: string) => {\n switch (blockType) {\n case HeaderNavigationActionBlockType.Search:\n return 'Search'\n case HeaderNavigationActionBlockType.Cart:\n return `Shopping cart${cartCount > 0 ? ` (${cartCount} items)` : ''}`\n case HeaderNavigationActionBlockType.Profile:\n return 'User profile'\n case HeaderNavigationActionBlockType.Livestream:\n return 'Livestream'\n default:\n return 'Action'\n }\n }\n\n const handleActionClick = useCallback(\n (action: any, index: number) => {\n setActiveAction(index)\n switch (action?.blockType) {\n case HeaderNavigationActionBlockType.Search:\n event?.search?.()\n break\n case HeaderNavigationActionBlockType.Cart:\n event?.cart?.()\n break\n case HeaderNavigationActionBlockType.Profile:\n event?.profile?.()\n break\n case HeaderNavigationActionBlockType.Livestream:\n event?.livestream?.()\n break\n default:\n return () => {}\n }\n },\n [event]\n )\n\n return (\n <div className=\"desktop:gap-6 flex items-center gap-4\">\n {Array.isArray(actions) &&\n actions?.map((action: any, index: number) => (\n <button\n className=\"relative cursor-pointer border-0 bg-transparent p-0\"\n key={action.id}\n ref={action.blockType === HeaderNavigationActionBlockType.Profile ? ref : null}\n onClick={() => handleActionClick(action, index)}\n aria-label={getActionLabel(action.blockType)}\n aria-pressed={activeStatus && activeAction === index}\n >\n <Text\n html={action.icon}\n className={cn('size-5', { 'text-brand-0': activeStatus && activeAction === index })}\n aria-hidden=\"true\"\n />\n {action.blockType === HeaderNavigationActionBlockType.Cart && cartCount > 0 && (\n <div\n className=\"bg-brand-0 absolute right-[-12px] top-[calc(100%-16px)] z-[1] flex min-h-5 min-w-5 items-center justify-center rounded-full px-[2px]\"\n aria-hidden=\"true\"\n >\n <Text html={cartCount?.toString()} className=\"text-sm font-bold leading-[1.2] text-white\" />\n </div>\n )}\n </button>\n ))}\n </div>\n )\n }\n)\n\nconst SecondaryHeader = ({ title, onMenuOpenClose, onMenuBackClick }: MobileSecondaryNavigationData) => {\n return (\n <div className=\"flex h-full items-center gap-3\">\n <button\n className=\"cursor-pointer border-0 bg-transparent p-0\"\n onClick={() => onMenuBackClick()}\n aria-label=\"Back to previous menu\"\n >\n <LeftArrow className=\"size-5\" aria-hidden=\"true\" />\n </button>\n <Text html={title} className=\"flex-1 text-center text-base font-bold leading-[1.4]\" />\n <button\n className=\"cursor-pointer border-0 bg-transparent p-0\"\n onClick={() => onMenuOpenClose()}\n aria-label=\"Close menu\"\n >\n <Close className=\"size-5\" aria-hidden=\"true\" />\n </button>\n </div>\n )\n}\n\nMobileNavigation.displayName = 'MobileNavigation'\nActions.displayName = 'Actions'\nHeaderNavigation.displayName = 'HeaderNavigation'\nDesktopNavigation.displayName = 'DesktopNavigation'\n\nexport default withLayout(HeaderNavigation)\n"],
|
|
5
|
+
"mappings": "aAuNU,OA8UI,YAAAA,GA9UJ,OAAAC,EAcE,QAAAC,MAdF,oBAtNV,OAAgB,cAAAC,GAAY,eAAAC,GAAa,aAAAC,EAAW,uBAAAC,GAAqB,WAAAC,EAAS,UAAAC,EAAQ,YAAAC,MAAgB,QAE1G,OAAS,WAAAC,GAAS,QAAAC,EAAM,UAAAC,GAAQ,aAAAC,GAAW,cAAAC,OAAkB,4BAE7D,OAAS,cAAAC,OAAkB,yBAE3B,OAAS,MAAAC,EAAI,oBAAAC,OAAwB,yBASrC,OAAOC,IAAe,iBAAAC,OAAqB,mBAE3C,OAAS,wBAAAC,EAAsB,6BAAA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AAW,CAAgB,IAE/D5K,EAAC,OAAI,UAAU,iCACb,UAAAD,EAAC,UACC,UAAU,6CACV,QAAS,IAAM6K,EAAgB,EAC/B,aAAW,wBAEX,SAAA7K,EAACiC,GAAA,CAAU,UAAU,SAAS,cAAY,OAAO,EACnD,EACAjC,EAACU,EAAA,CAAK,KAAMkK,EAAO,UAAU,uDAAuD,EACpF5K,EAAC,UACC,UAAU,6CACV,QAAS,IAAMkK,EAAgB,EAC/B,aAAW,aAEX,SAAAlK,EAAC+B,GAAA,CAAM,UAAU,SAAS,cAAY,OAAO,EAC/C,GACF,EAIJ4D,GAAiB,YAAc,mBAC/B0C,GAAQ,YAAc,UACtBpF,GAAiB,YAAc,mBAC/ByC,GAAkB,YAAc,oBAEhC,IAAOoF,GAAQhK,GAAWmC,EAAgB",
|
|
6
6
|
"names": ["Fragment", "jsx", "jsxs", "forwardRef", "useCallback", "useEffect", "useImperativeHandle", "useMemo", "useRef", "useState", "Picture", "Text", "Button", "Container", "BrandStrip", "withLayout", "cn", "getLocalizedPath", "NavProvider", "useNavContext", "HeaderNavigationMenu", "HeaderNavigationBlockType", "HeaderNavigationActionBlockType", "jump", "useGSAP", "gsap", "WithSidebar", "WithSupports", "WithMulticol", "WithGroupCategory", "WithResource", "Menu", "Close", "User", "LeftArrow", "DownArrow", "Polygon", "NavigationSearch", "ResourceSidebarDropdown", "MobileResourceSidebarMenu", "SidebarDropdown", "useScrollLock", "MulticolDropdown", "SupportsDropdown", "MobileSidebarMenu", "MobileSupportMenu", "MobileMulticolMenu", "MenuItem", "useAiuiContext", "throttle", "HeaderNavigation", "props", "ref", "header", "buildProps", "event", "profile", "theme", "isTop", "searchResult", "onSearch", "isSearching", "keywords", "onPrimaryNavClick", "onSeriesProductClick", "onSidebarNavClick", "headerId", "cartCount", "menuData", "searchOpen", "setSearchOpen", "headerHidden", "setHeaderHidden", "changeHeaderBackground", "setChangeHeaderBackground", "isMobile", "setIsMobile", "searchRef", "headerRef", "resizeWindow", "offsetWidth", "lastScrollY", "upwardDistance", "downwardDistance", "getScrollTop", "initialScrollTop", "handleScroll", "currentScrollY", "delta", "searchPage", "item", "DesktopNavigation", "MobileNavigation", "value", "e", "data", "onNavItemClick", "className", "downdownHover", "setDowndownHover", "locale", "groupCategories", "categoriesItem", "setCategoriesItem", "navStatusArray", "setNavStatusArray", "profileRef", "userProfileOpen", "setUserProfileOpen", "dropdownRef", "navItemRefs", "categories", "groupItem", "groupIndex", "_", "index", "currentNavItem", "handleNavItemClick", "currentCategoriesItem", "position", "prev", "handleNavItemKeyDown", "handleNavMenuClose", "currentBlockTypeCategories", "SidebarDropdownComp", "ResourceSidebarDropdownComp", "MulticolDropdownComp", "SupportsDropdownComp", "DropdownComp", "actions", "profileAction", "handleProfileClick", "profileRefElement", "Logo", "Actions", "isExpanded", "el", "currentMenu", "setCurrentMenu", "subSubCategory", "mobileMenuOpen", "setMobileMenuOpen", "menuInnerHeight", "setMenuInnerHeight", "mobileMenuRef", "rect", "MobileSupportMenuComp", "MobileSidebarMenuComp", "MobileResourceSidebarMenuComp", "MobileMulticolMenuComp", "MobileCategoriesMenuComp", "handleSecondaryMenuClose", "menuActions", "MobileCategoriesHeaderComp", "PrimaryHeader", "SecondaryHeader", "handlePrimaryMenuClick", "MobilePrimaryMenu", "onPrimaryMenuClick", "ProfileComp", "profileOpen", "setProfileOpen", "menuOpen", "onMenuOpenClose", "onMenuOpenClick", "payloadData", "activeStatus", "activeAction", "setActiveAction", "getActionLabel", "blockType", "handleActionClick", "action", "title", "onMenuBackClick", "HeaderNavigation_default"]
|
|
7
7
|
}
|