@anker-in/headless-ui 1.3.35 → 1.3.36-alpha.1784264610364
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/SearchPage/index.js +1 -1
- package/dist/cjs/biz-components/SearchPage/index.js.map +3 -3
- package/dist/cjs/components/tabs.js +1 -1
- package/dist/cjs/components/tabs.js.map +3 -3
- package/dist/cjs/helpers/index.d.ts +1 -1
- package/dist/cjs/helpers/index.js +1 -1
- package/dist/cjs/helpers/index.js.map +2 -2
- package/dist/cjs/helpers/utils.d.ts +17 -0
- package/dist/cjs/helpers/utils.js +1 -1
- package/dist/cjs/helpers/utils.js.map +3 -3
- package/dist/esm/biz-components/SearchPage/index.js +1 -1
- package/dist/esm/biz-components/SearchPage/index.js.map +3 -3
- package/dist/esm/components/tabs.js +1 -1
- package/dist/esm/components/tabs.js.map +3 -3
- package/dist/esm/helpers/index.d.ts +1 -1
- package/dist/esm/helpers/index.js +1 -1
- package/dist/esm/helpers/index.js.map +3 -3
- package/dist/esm/helpers/utils.d.ts +17 -0
- package/dist/esm/helpers/utils.js +1 -1
- package/dist/esm/helpers/utils.js.map +3 -3
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var B=Object.defineProperty;var K=Object.getOwnPropertyDescriptor;var W=Object.getOwnPropertyNames;var F=Object.prototype.hasOwnProperty;var U=(t,l)=>{for(var i in l)B(t,i,{get:l[i],enumerable:!0})},H=(t,l,i,n)=>{if(l&&typeof l=="object"||typeof l=="function")for(let d of W(l))!F.call(t,d)&&d!==i&&B(t,d,{get:()=>l[d],enumerable:!(n=K(l,d))||n.enumerable});return t};var q=t=>H(B({},"__esModule",{value:!0}),t);var Z={};U(Z,{default:()=>Y});module.exports=q(Z);var e=require("react/jsx-runtime"),a=require("../../components/index.js"),j=require("../HeaderNavigation/icons/index.js"),c=require("react"),p=require("../../helpers/utils.js"),S=require("../AiuiProvider/index.js"),R=require("../ShelfDisplay/shelfDisplay.js"),b=require("./types.js"),T=require("../../helpers/utils.js"),$=require("../Listing/utils/textFormat.js");const O=({product:t,onSecondaryButton:l,onPrimaryButton:i,searchValue:n,variantData:d,shopNowLoadingProductId:k,badgeVariant:x})=>{const o=(0,c.useMemo)(()=>d||t?.variants?.[0],[t,d]),{locale:v="us",copyWriting:u,currencyCode:f}=(0,S.useAiuiContext)(),h=k===t?.id,w=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/products/${t?.handle}?variant=${(0,p.atobID)(o?.id)}?ref=search_result_${n?.toLowerCase()}`,v),[t?.handle,o?.id,n,v]),_=o?.coupons?.[0],{price:N,basePrice:r}=(0,R.formatVariantPrice)({locale:f==="CAD"?"us":v||"us",amount:_?_.variant_price4wscode:o?.price?.amount??o?.price,baseAmount:_?o?.price?.amount??o?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),C=(0,c.useMemo)(()=>t?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return(0,e.jsx)("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?(0,e.jsxs)(a.Link,{href:(0,T.getLocalizedPath)(t?.advertisingLink,v),className:"h-full",children:[(0,e.jsx)(a.Picture,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),(0,e.jsxs)("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(a.Text,{html:t?.advertisingTitle,className:(0,p.cn)("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&(0,e.jsx)(a.Heading,{size:3,html:t?.advertisingSubtitle,className:(0,p.cn)("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):(0,e.jsxs)("a",{href:w,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[(0,e.jsx)("div",{className:"ipc_search_product_item_image",children:(0,e.jsx)(a.Picture,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:o?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),(0,e.jsxs)("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:C?.map((m,L)=>(0,e.jsx)(a.Badge,{size:"lg",variant:x,children:m},L))}),(0,e.jsx)(a.Text,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:(0,p.highlightSearchWord)(t?.title||"",n||"")}),(0,e.jsx)(a.Text,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:(0,p.highlightSearchWord)(t?.description,n||"")})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"mb-2 flex items-center",children:o?.availableForSale?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:o?.availableForSale&&N||""}),(0,e.jsx)("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:o?.availableForSale&&r||""})]}):(0,e.jsx)("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:u?.soldOutText||"Sold Out"})}),(0,e.jsxs)("div",{className:(0,p.cn)("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[u?.learnMoreText&&(0,e.jsx)(a.Button,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:m=>{m.preventDefault(),m.stopPropagation(),l?.()},children:u?.learnMoreText}),u?.shopNowText&&(0,e.jsx)(a.Button,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,loading:h,onClick:m=>{m.preventDefault(),m.stopPropagation(),i?.()},children:u?.shopNowText})]})]})]})]})})},J=({blog:t,searchValue:l})=>{const{copyWriting:i,locale:n="us"}=(0,S.useAiuiContext)(),d=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,n),[t,n]);return(0,e.jsx)("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:(0,e.jsxs)("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[(0,e.jsx)("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),(0,e.jsxs)("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,p.highlightSearchWord)(t?.title,l)}),(0,e.jsx)(a.Text,{html:(0,p.highlightSearchWord)(t?.content,l),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"desktop:mt-6 mt-4",children:(0,e.jsx)(a.Button,{as:"a",href:d,variant:"secondary",size:"lg",children:i?.learnMoreText||"Learn More"})})]})]})})},Q=({searchValue:t,page:l})=>{const{copyWriting:i,locale:n="us"}=(0,S.useAiuiContext)(),d=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/${l?.handle}`,n),[l,n]);return(0,e.jsxs)("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,p.highlightSearchWord)(l?.name,t)}),(0,e.jsx)(a.Text,{as:"p",html:(0,p.highlightSearchWord)(l?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),(0,e.jsx)(a.Button,{as:"a",href:d,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:i?.learnMoreText||"Learn More"})]})},I=({url:t,label:l})=>(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),(0,e.jsx)(a.Text,{html:l,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),D=({products:t,title:l,buildProps:i,onSecondaryButton:n,onPrimaryButton:d,badgeVariant:k})=>{const{products:x}=i||{};return console.log(x,"buildProducts"),(0,e.jsxs)("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:l}),(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((o,v)=>{const u=x?.find(h=>h.handle===o.handle);if(!u)return null;const f=u?.variants?.find(h=>h.sku===o.sku);return(0,e.jsx)(O,{product:u,variantData:f,badgeVariant:k,onSecondaryButton:()=>n?.(),onPrimaryButton:()=>d?.()},o.sku+v)})})]})},X=({searchResult:t,searchValue:l,data:i,onSecondaryButton:n,onPrimaryButton:d,onChangeSort:k,loading:x,shopNowLoadingProductId:o,searchResultCount:v,onChangeTab:u,buildProps:f,componentOverrides:h,className:w,..._})=>{const N=h?.badge?.variant,[r,C]=(0,c.useState)(i?.tabs?.[0]),[m,L]=(0,c.useState)(!1),[z,E]=(0,c.useState)({[b.SearchPageTabType.PRODUCTS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PRODUCTS)?.sortKeys?.[0],[b.SearchPageTabType.BLOGS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.BLOGS)?.sortKeys?.[0],[b.SearchPageTabType.PAGES]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PAGES)?.sortKeys?.[0]}),P=(0,c.useMemo)(()=>t?.products||[],[t]),A=(0,c.useMemo)(()=>t?.blogs||[],[t]),M=(0,c.useMemo)(()=>t?.pages||[],[t]),V=(0,c.useMemo)(()=>Object.values(v||{}).reduce((s,g)=>s+g,0),[v]),G=(0,c.useMemo)(()=>{const s={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const y=[...P||[]];return y.length>=8?y.splice(7,0,s):y.length>0&&y.push(s),y}else return P},[r,P]);return(0,e.jsxs)("div",{..._,className:(0,p.cn)("ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",w),children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:(0,$.replaceTemplate)(i?.title,{totalCount:V?.toString(),inputValue:`"${l}"`})}),(0,e.jsx)("div",{className:"mt-6",children:(0,e.jsxs)(a.Tabs,{className:"ipc_search_page_tabs",defaultValue:"products",children:[(0,e.jsxs)("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[(0,e.jsx)(a.TabsList,{children:i?.tabs?.map(s=>(0,e.jsxs)(a.TabsTrigger,{onClick:()=>{C(s);const g=s?.sortKeys?.[0];g&&(E(y=>({...y,[s?.tabType]:g})),k?.(s?.tabType,g)),u?.(s?.tabType)},defaultValue:"products",value:s.tabType,children:[s.label," (",v?.[s.tabType],")"]},s.id))}),(0,e.jsxs)(a.DropdownMenu,{onOpenChange:L,children:[(0,e.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,e.jsxs)("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",z?.[r?.tabType]?.label," ",(0,e.jsx)(j.DownArrow,{className:(0,p.cn)("inline-block size-4",{"rotate-180":m})})]})}),(0,e.jsx)(a.DropdownMenuContent,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(s=>(0,e.jsx)(a.DropdownMenuItem,{className:(0,p.cn)("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":z?.[r?.tabType]?.value===s.value}),onClick:()=>{k?.(r?.tabType,s),E(g=>({...g,[r?.tabType]:s}))},children:s.label},s.id))})]})]}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:G?.map((s,g)=>(0,e.jsx)(O,{searchValue:l,product:s,shopNowLoadingProductId:o,badgeVariant:N,onSecondaryButton:()=>n?.(s),onPrimaryButton:()=>d?.(s)},(s.id||"")+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex w-full justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!P?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]}),(0,e.jsx)(a.TabsContent,{value:b.SearchPageTabType.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:(0,e.jsxs)("div",{children:[A?.map(s=>(0,e.jsx)(J,{blog:s,searchValue:l},s.id)),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!A?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,badgeVariant:N})]})]})}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PAGES,className:"ipc_search_page_tabs_pages_content",children:[(0,e.jsx)("div",{children:M?.map((s,g)=>(0,e.jsx)(Q,{page:s,searchValue:l},(s.global_id||s.id)+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!M?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]})]})})]})};var Y=X;
|
|
1
|
+
"use strict";var B=Object.defineProperty;var G=Object.getOwnPropertyDescriptor;var K=Object.getOwnPropertyNames;var W=Object.prototype.hasOwnProperty;var F=(t,l)=>{for(var i in l)B(t,i,{get:l[i],enumerable:!0})},U=(t,l,i,d)=>{if(l&&typeof l=="object"||typeof l=="function")for(let p of K(l))!W.call(t,p)&&p!==i&&B(t,p,{get:()=>l[p],enumerable:!(d=G(l,p))||d.enumerable});return t};var H=t=>U(B({},"__esModule",{value:!0}),t);var Y={};F(Y,{default:()=>X});module.exports=H(Y);var e=require("react/jsx-runtime"),a=require("../../components/index.js"),j=require("../HeaderNavigation/icons/index.js"),c=require("react"),n=require("../../helpers/utils.js"),S=require("../AiuiProvider/index.js"),R=require("../ShelfDisplay/shelfDisplay.js"),b=require("./types.js"),T=require("../../helpers/utils.js");const O=({product:t,onSecondaryButton:l,onPrimaryButton:i,searchValue:d,variantData:p,shopNowLoadingProductId:k,badgeVariant:x})=>{const o=(0,c.useMemo)(()=>p||t?.variants?.[0],[t,p]),{locale:v="us",copyWriting:u,currencyCode:f}=(0,S.useAiuiContext)(),h=k===t?.id,w=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/products/${t?.handle}?variant=${(0,n.atobID)(o?.id)}?ref=search_result_${d?.toLowerCase()}`,v),[t?.handle,o?.id,d,v]),_=o?.coupons?.[0],{price:N,basePrice:r}=(0,R.formatVariantPrice)({locale:f==="CAD"?"us":v||"us",amount:_?_.variant_price4wscode:o?.price?.amount??o?.price,baseAmount:_?o?.price?.amount??o?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),C=(0,c.useMemo)(()=>t?.tags?.filter?.(m=>m?.startsWith?.("CLtag"))?.map?.(m=>m?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return(0,e.jsx)("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?(0,e.jsxs)(a.Link,{href:(0,T.getLocalizedPath)(t?.advertisingLink,v),className:"h-full",children:[(0,e.jsx)(a.Picture,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),(0,e.jsxs)("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[(0,e.jsx)(a.Text,{html:t?.advertisingTitle,className:(0,n.cn)("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&(0,e.jsx)(a.Heading,{size:3,html:t?.advertisingSubtitle,className:(0,n.cn)("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):(0,e.jsxs)("a",{href:w,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[(0,e.jsx)("div",{className:"ipc_search_product_item_image",children:(0,e.jsx)(a.Picture,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:o?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),(0,e.jsxs)("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[(0,e.jsxs)("div",{className:"flex-1",children:[(0,e.jsx)("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:C?.map((m,L)=>(0,e.jsx)(a.Badge,{size:"lg",variant:x,children:m},L))}),(0,e.jsx)(a.Text,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:(0,n.highlightSearchWord)(t?.title||"",d||"")}),(0,e.jsx)(a.Text,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:(0,n.highlightSearchWord)(t?.description,d||"")})]}),(0,e.jsxs)("div",{children:[(0,e.jsx)("div",{className:"mb-2 flex items-center",children:o?.availableForSale?(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:o?.availableForSale&&N||""}),(0,e.jsx)("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:o?.availableForSale&&r||""})]}):(0,e.jsx)("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:u?.soldOutText||"Sold Out"})}),(0,e.jsxs)("div",{className:(0,n.cn)("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[u?.learnMoreText&&(0,e.jsx)(a.Button,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:m=>{m.preventDefault(),m.stopPropagation(),l?.()},children:u?.learnMoreText}),u?.shopNowText&&(0,e.jsx)(a.Button,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!o?.availableForSale,loading:h,onClick:m=>{m.preventDefault(),m.stopPropagation(),i?.()},children:u?.shopNowText})]})]})]})]})})},q=({blog:t,searchValue:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),p=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,d),[t,d]);return(0,e.jsx)("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:(0,e.jsxs)("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[(0,e.jsx)("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:(0,e.jsx)(a.Picture,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),(0,e.jsxs)("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(t?.title,l)}),(0,e.jsx)(a.Text,{html:(0,n.highlightSearchWord)(t?.content,l),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),(0,e.jsx)("div",{className:"desktop:mt-6 mt-4",children:(0,e.jsx)(a.Button,{as:"a",href:p,variant:"secondary",size:"lg",children:i?.learnMoreText||"Learn More"})})]})]})})},J=({searchValue:t,page:l})=>{const{copyWriting:i,locale:d="us"}=(0,S.useAiuiContext)(),p=(0,c.useMemo)(()=>(0,T.getLocalizedPath)(`/${l?.handle}`,d),[l,d]);return(0,e.jsxs)("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[(0,e.jsx)(a.Heading,{size:3,html:(0,n.highlightSearchWord)(l?.name,t)}),(0,e.jsx)(a.Text,{as:"p",html:(0,n.highlightSearchWord)(l?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),(0,e.jsx)(a.Button,{as:"a",href:p,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:i?.learnMoreText||"Learn More"})]})},I=({url:t,label:l})=>(0,e.jsxs)("div",{className:"flex flex-col items-center justify-center gap-4",children:[(0,e.jsx)(a.Picture,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),(0,e.jsx)(a.Text,{html:l,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),D=({products:t,title:l,buildProps:i,onSecondaryButton:d,onPrimaryButton:p,badgeVariant:k})=>{const{products:x}=i||{};return console.log(x,"buildProducts"),(0,e.jsxs)("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:l}),(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((o,v)=>{const u=x?.find(h=>h.handle===o.handle);if(!u)return null;const f=u?.variants?.find(h=>h.sku===o.sku);return(0,e.jsx)(O,{product:u,variantData:f,badgeVariant:k,onSecondaryButton:()=>d?.(),onPrimaryButton:()=>p?.()},o.sku+v)})})]})},Q=({searchResult:t,searchValue:l,data:i,onSecondaryButton:d,onPrimaryButton:p,onChangeSort:k,loading:x,shopNowLoadingProductId:o,searchResultCount:v,onChangeTab:u,buildProps:f,componentOverrides:h,className:w,..._})=>{const N=h?.badge?.variant,[r,C]=(0,c.useState)(i?.tabs?.[0]),[m,L]=(0,c.useState)(!1),[z,E]=(0,c.useState)({[b.SearchPageTabType.PRODUCTS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PRODUCTS)?.sortKeys?.[0],[b.SearchPageTabType.BLOGS]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.BLOGS)?.sortKeys?.[0],[b.SearchPageTabType.PAGES]:i?.tabs?.find(s=>s.tabType===b.SearchPageTabType.PAGES)?.sortKeys?.[0]}),P=(0,c.useMemo)(()=>t?.products||[],[t]),A=(0,c.useMemo)(()=>t?.blogs||[],[t]),M=(0,c.useMemo)(()=>t?.pages||[],[t]),$=(0,c.useMemo)(()=>Object.values(v||{}).reduce((s,g)=>s+g,0),[v]),V=(0,c.useMemo)(()=>{const s={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const y=[...P||[]];return y.length>=8?y.splice(7,0,s):y.length>0&&y.push(s),y}else return P},[r,P]);return(0,e.jsxs)("div",{..._,className:(0,n.cn)("ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",w),children:[(0,e.jsx)(a.Heading,{size:4,weight:"bold",html:(0,n.replaceTemplate)(i?.title,{totalCount:$?.toString(),inputValue:`"${l}"`})}),(0,e.jsx)("div",{className:"mt-6",children:(0,e.jsxs)(a.Tabs,{className:"ipc_search_page_tabs",defaultValue:"products",children:[(0,e.jsxs)("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[(0,e.jsx)(a.TabsList,{children:i?.tabs?.map(s=>(0,e.jsxs)(a.TabsTrigger,{onClick:()=>{C(s);const g=s?.sortKeys?.[0];g&&(E(y=>({...y,[s?.tabType]:g})),k?.(s?.tabType,g)),u?.(s?.tabType)},defaultValue:"products",value:s.tabType,children:[s.label," (",v?.[s.tabType],")"]},s.id))}),(0,e.jsxs)(a.DropdownMenu,{onOpenChange:L,children:[(0,e.jsx)(a.DropdownMenuTrigger,{asChild:!0,children:(0,e.jsxs)("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",z?.[r?.tabType]?.label," ",(0,e.jsx)(j.DownArrow,{className:(0,n.cn)("inline-block size-4",{"rotate-180":m})})]})}),(0,e.jsx)(a.DropdownMenuContent,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(s=>(0,e.jsx)(a.DropdownMenuItem,{className:(0,n.cn)("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":z?.[r?.tabType]?.value===s.value}),onClick:()=>{k?.(r?.tabType,s),E(g=>({...g,[r?.tabType]:s}))},children:s.label},s.id))})]})]}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[(0,e.jsx)("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:V?.map((s,g)=>(0,e.jsx)(O,{searchValue:l,product:s,shopNowLoadingProductId:o,badgeVariant:N,onSecondaryButton:()=>d?.(s),onPrimaryButton:()=>p?.(s)},(s.id||"")+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex w-full justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!P?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]}),(0,e.jsx)(a.TabsContent,{value:b.SearchPageTabType.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:(0,e.jsxs)("div",{children:[A?.map(s=>(0,e.jsx)(q,{blog:s,searchValue:l},s.id)),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!A?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,badgeVariant:N})]})]})}),(0,e.jsxs)(a.TabsContent,{value:b.SearchPageTabType.PAGES,className:"ipc_search_page_tabs_pages_content",children:[(0,e.jsx)("div",{children:M?.map((s,g)=>(0,e.jsx)(J,{page:s,searchValue:l},(s.global_id||s.id)+g))}),x?(0,e.jsx)("div",{className:"mt-6 flex justify-center",children:(0,e.jsx)(a.LoadingDots,{})}):!M?.length&&(0,e.jsxs)(e.Fragment,{children:[(0,e.jsx)(I,{url:i?.noResultImage?.url,label:i?.noResultLabel}),(0,e.jsx)(D,{products:i?.recommendProducts||[],buildProps:f,title:i?.recommendProductsTitle,shopNowLoadingProductId:o,badgeVariant:N})]})]})]})})]})};var X=Q;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/SearchPage/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n Heading,\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n Text,\n Picture,\n Link,\n Button,\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n LoadingDots,\n Badge,\n} from '../../components/index.js'\nimport { DownArrow } from '../HeaderNavigation/icons/index.js'\nimport { useMemo, useState } from 'react'\nimport { cn, atobID, highlightSearchWord } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport type {\n SearchPageProps,\n SortKey,\n SearchProductItemProps,\n SearchBlogItemProps,\n SearchPageItemProps,\n SearchRecommendProductsProps,\n} from './types'\nimport { SearchPageTabType } from './types.js'\nimport { getLocalizedPath } from '../../helpers/utils.js'\nimport { replaceTemplate } from '../Listing/utils/textFormat.js'\n\n/**\n * \u641C\u7D22\u5546\u54C1\n */\nconst SearchProductItem = ({\n product,\n onSecondaryButton,\n onPrimaryButton,\n searchValue,\n variantData,\n shopNowLoadingProductId,\n badgeVariant,\n}: SearchProductItemProps & { badgeVariant?: 'outline' | 'fill' }) => {\n const variant = useMemo(() => variantData || product?.variants?.[0], [product, variantData])\n const { locale = 'us', copyWriting, currencyCode } = useAiuiContext()\n\n // \u5224\u65AD\u5F53\u524D\u4EA7\u54C1\u662F\u5426\u5728\u52A0\u8F7D\u4E2D\n const isCurrentProductLoading = shopNowLoadingProductId === product?.id\n\n const listingLink = useMemo(() => {\n return getLocalizedPath(\n `/products/${product?.handle}?variant=${atobID(variant?.id as string)}?ref=search_result_${searchValue?.toLowerCase()}`,\n locale\n )\n }, [product?.handle, variant?.id, searchValue, locale])\n\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n amount: coupon ? coupon.variant_price4wscode : (variant?.price?.amount ?? variant?.price),\n baseAmount: coupon ? (variant?.price?.amount ?? variant?.price) : 0,\n currencyCode: product?.price?.currencyCode || 'USD',\n })\n\n const tags = useMemo(() => {\n return product?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n }, [product?.tags])\n\n return (\n <div className=\"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden\">\n {product?.type === 'advertising' && product?.advertisingLink ? (\n <Link href={getLocalizedPath(product?.advertisingLink, locale)} className=\"h-full\">\n <Picture\n source={`${product?.advertisingBgImg}`}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n />\n <div className=\"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500\">\n <Text\n html={product?.advertisingTitle}\n className={cn('desktop:text-base text-sm font-bold leading-[1.2]', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n {product?.advertisingSubtitle && (\n <Heading\n size={3}\n html={product?.advertisingSubtitle}\n className={cn('laptop:line-clamp-3 mt-2 line-clamp-4 font-bold', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n )}\n </div>\n </Link>\n ) : (\n <a\n href={listingLink}\n className=\"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300\"\n >\n <div className=\"ipc_search_product_item_image\">\n <Picture\n className=\"lg-desktop:size-[196px] mx-auto size-[138px]\"\n source={variant?.image?.url || product?.images?.[0]?.url}\n alt={product?.title}\n imgClassName=\"object-cover size-full\"\n />\n </div>\n <div className=\"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4\">\n <div className=\"flex-1\">\n <div className=\"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2\">\n {tags?.map((tag: string, index: number) => (\n <Badge key={index} size=\"lg\" variant={badgeVariant}>\n {tag}\n </Badge>\n ))}\n </div>\n <Text\n className=\"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]\"\n weight=\"bold\"\n html={highlightSearchWord(product?.title || '', searchValue || '')}\n />\n <Text\n as=\"p\"\n className=\"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold\"\n html={highlightSearchWord(product?.description, searchValue || '')}\n />\n </div>\n <div>\n <div className=\"mb-2 flex items-center\">\n {!variant?.availableForSale ? (\n <div className=\"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {copyWriting?.soldOutText || 'Sold Out'}\n </div>\n ) : (\n <>\n <div className=\"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n <div\n className={cn(\n 'ipc_search_product_item_button_group',\n 'lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2'\n )}\n >\n {copyWriting?.learnMoreText && (\n <Button\n variant=\"secondary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onSecondaryButton?.()\n }}\n >\n {copyWriting?.learnMoreText}\n </Button>\n )}\n {copyWriting?.shopNowText && (\n <Button\n variant=\"primary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n disabled={!variant?.availableForSale}\n loading={isCurrentProductLoading}\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onPrimaryButton?.()\n }}\n >\n {copyWriting?.shopNowText}\n </Button>\n )}\n </div>\n </div>\n </div>\n </a>\n )}\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u6587\u7AE0\n */\nconst SearchBlogItem = ({ blog, searchValue }: SearchBlogItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n\n const articleLink = useMemo(\n () => getLocalizedPath(`/blogs/${blog?.blog?.handle}/${blog?.handle.replace('storefront-', '')}`, locale),\n [blog, locale]\n )\n\n return (\n <div className=\"ipc_search_blog_item border-b border-[#E4E5E6] py-6\">\n <div className=\"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4\">\n <div className=\"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden\">\n <Picture\n source={blog?.image?.url}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n alt={blog?.title}\n />\n </div>\n <div className=\"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center\">\n <Heading size={3} html={highlightSearchWord(blog?.title, searchValue)} />\n <Text\n html={highlightSearchWord(blog?.content, searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]\"\n />\n <div className=\"desktop:mt-6 mt-4\">\n <Button as=\"a\" href={articleLink} variant=\"secondary\" size=\"lg\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPageItem = ({ searchValue, page }: SearchPageItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n const pageLink = useMemo(() => getLocalizedPath(`/${page?.handle}`, locale), [page, locale])\n return (\n <div className=\"ipc_search_page_items border-b border-[#E4E5E6] py-6\">\n <Heading size={3} html={highlightSearchWord(page?.name, searchValue)} />\n <Text\n as=\"p\"\n html={highlightSearchWord(page?.bodySummary || '', searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]\"\n />\n <Button as=\"a\" href={pageLink} variant=\"secondary\" size=\"lg\" className=\"desktop:mt-6 mt-4\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u7ED3\u679C\u4E3A\u7A7A\n */\nconst SearchPageNoResult = ({ url, label }: { url: string; label: string }) => {\n return (\n <div className=\"flex flex-col items-center justify-center gap-4\">\n <Picture source={url} className=\"h-[180px] w-[240px]\" imgClassName=\"object-cover\" />\n <Text html={label} className=\"desktop:text-[18px] text-sm font-bold leading-[1.4]\" />\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u63A8\u8350\u5546\u54C1\n */\nconst SearchRecommendProducts = ({\n products,\n title,\n buildProps,\n onSecondaryButton,\n onPrimaryButton,\n badgeVariant,\n}: SearchRecommendProductsProps & { badgeVariant?: 'outline' | 'fill' }) => {\n const { products: buildProducts } = buildProps || {}\n console.log(buildProducts, 'buildProducts')\n return (\n <div className=\"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]\">\n <Heading size={4} weight=\"bold\" html={title} />\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4\">\n {products?.map((product: any, index: number) => {\n const buildProduct = buildProducts?.find((buildProduct: any) => buildProduct.handle === product.handle)\n if (!buildProduct) return null\n const variant = buildProduct?.variants?.find((variant: any) => variant.sku === product.sku)\n return (\n <SearchProductItem\n product={buildProduct}\n variantData={variant}\n key={product.sku + index}\n badgeVariant={badgeVariant}\n onSecondaryButton={() => onSecondaryButton?.()}\n onPrimaryButton={() => onPrimaryButton?.()}\n />\n )\n })}\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPage = ({\n searchResult,\n searchValue,\n data,\n onSecondaryButton,\n onPrimaryButton,\n // loadMore,\n onChangeSort,\n loading,\n shopNowLoadingProductId,\n searchResultCount,\n onChangeTab,\n buildProps,\n componentOverrides,\n className,\n ...rest\n}: SearchPageProps) => {\n const badgeVariant = componentOverrides?.badge?.variant\n const [currentTab, setCurrentTab] = useState<any>(data?.tabs?.[0])\n const [isOpenSort, setIsOpenSort] = useState(false)\n const [currentSortKey, setCurrentSortKey] = useState<any>({\n [SearchPageTabType.PRODUCTS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PRODUCTS)\n ?.sortKeys?.[0],\n [SearchPageTabType.BLOGS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.BLOGS)?.sortKeys?.[0],\n [SearchPageTabType.PAGES]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PAGES)?.sortKeys?.[0],\n })\n\n const searchProductsResult = useMemo(() => {\n return searchResult?.products || []\n }, [searchResult])\n\n const searchBlogsResult = useMemo(() => {\n return searchResult?.blogs || []\n }, [searchResult])\n\n const searchPagesResult = useMemo(() => {\n return searchResult?.pages || []\n }, [searchResult])\n\n const totalCount = useMemo(() => {\n return Object.values(searchResultCount || {}).reduce((acc, curr) => acc + curr, 0)\n }, [searchResultCount])\n\n const searchProductsResultWithAdvertising = useMemo(() => {\n const advertisingData = {\n advertisingBgImg: `${currentTab?.advertisingBgImg?.url}, ${currentTab?.advertisingMobBgImg?.url} 768`,\n advertisingTitle: currentTab?.advertisingTitle,\n advertisingSubtitle: currentTab?.advertisingSubtitle,\n advertisingLink: currentTab?.advertisingLink,\n advertisingTheme: currentTab?.advertisingTheme,\n type: 'advertising',\n }\n // \u5E7F\u544A\u4F4D\u6838\u5FC3\u5B57\u6BB5\u5168\u4E3A\u7A7A\u65F6\uFF0C\u4E0D\u63D2\u5165\u5E7F\u544A\u6570\u636E\n const hasAdvertisingData =\n !!currentTab?.advertisingBgImg?.url || !!currentTab?.advertisingTitle || !!currentTab?.advertisingLink\n\n if (hasAdvertisingData) {\n const result = [...(searchProductsResult || [])]\n if (result.length >= 8) {\n result.splice(7, 0, advertisingData)\n } else if (result.length > 0) {\n result.push(advertisingData)\n }\n return result\n } else {\n return searchProductsResult\n }\n }, [currentTab, searchProductsResult])\n\n return (\n <div\n {...rest}\n className={cn(\n 'ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16',\n className\n )}\n >\n <Heading\n size={4}\n weight=\"bold\"\n html={replaceTemplate(data?.title, {\n totalCount: totalCount?.toString(),\n inputValue: `\"${searchValue}\"`,\n })}\n />\n <div className=\"mt-6\">\n <Tabs className=\"ipc_search_page_tabs\" defaultValue=\"products\">\n <div className=\" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between\">\n <TabsList>\n {data?.tabs?.map((tab: any) => (\n <TabsTrigger\n onClick={() => {\n setCurrentTab(tab)\n // \u5207\u6362tab\u65F6\uFF0C\u91CD\u7F6E\u8BE5tab\u7684\u6392\u5E8F\u503C\u4E3A\u9ED8\u8BA4\u503C\uFF08\u7B2C\u4E00\u4E2AsortKey\uFF09\n const defaultSortKey = tab?.sortKeys?.[0]\n if (defaultSortKey) {\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [tab?.tabType]: defaultSortKey,\n }))\n onChangeSort?.(tab?.tabType, defaultSortKey)\n }\n onChangeTab?.(tab?.tabType)\n }}\n key={tab.id}\n defaultValue=\"products\"\n value={tab.tabType}\n >\n {tab.label} ({searchResultCount?.[tab.tabType as keyof typeof searchResultCount]})\n </TabsTrigger>\n ))}\n </TabsList>\n <DropdownMenu onOpenChange={setIsOpenSort}>\n <DropdownMenuTrigger asChild>\n <button className=\"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none\">\n {currentTab?.sortLabel} {currentSortKey?.[currentTab?.tabType]?.label}{' '}\n <DownArrow\n className={cn('inline-block size-4', {\n 'rotate-180': isOpenSort,\n })}\n />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align=\"start\"\n sideOffset={8}\n className=\"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none\"\n >\n {currentTab?.sortKeys?.map((sortKey: SortKey) => {\n return (\n <DropdownMenuItem\n className={cn(\n 'laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none',\n {\n 'bg-[#EAEAEC]': currentSortKey?.[currentTab?.tabType]?.value === sortKey.value,\n }\n )}\n onClick={() => {\n onChangeSort?.(currentTab?.tabType, sortKey)\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [currentTab?.tabType]: sortKey,\n }))\n }}\n key={sortKey.id}\n >\n {sortKey.label}\n </DropdownMenuItem>\n )\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n <TabsContent value={SearchPageTabType.PRODUCTS} className=\"ipc_search_page_tabs_products_content mt-6\">\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4\">\n {searchProductsResultWithAdvertising?.map((product: any, index: number) => (\n <SearchProductItem\n searchValue={searchValue}\n key={(product.id || '') + index}\n product={product}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n onSecondaryButton={() => onSecondaryButton?.(product)}\n onPrimaryButton={() => onPrimaryButton?.(product)}\n />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex w-full justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchProductsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </TabsContent>\n <TabsContent value={SearchPageTabType.BLOGS} className=\"ipc_search_page_tabs_blogs_content\">\n <div>\n {searchBlogsResult?.map((blog: any) => (\n <SearchBlogItem key={blog.id} blog={blog} searchValue={searchValue} />\n ))}\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchBlogsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </div>\n </TabsContent>\n <TabsContent value={SearchPageTabType.PAGES} className=\"ipc_search_page_tabs_pages_content\">\n <div>\n {searchPagesResult?.map((page: any, index: number) => (\n <SearchPageItem key={(page.global_id || page.id) + index} page={page} searchValue={searchValue} />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchPagesResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </TabsContent>\n </Tabs>\n </div>\n </div>\n )\n}\n\nexport default SearchPage\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["SearchPage_exports", "__export", "SearchPage_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_icons", "import_react", "import_utils", "import_AiuiProvider", "import_shelfDisplay", "import_types", "
|
|
4
|
+
"sourcesContent": ["import {\n Heading,\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n Text,\n Picture,\n Link,\n Button,\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n LoadingDots,\n Badge,\n} from '../../components/index.js'\nimport { DownArrow } from '../HeaderNavigation/icons/index.js'\nimport { useMemo, useState } from 'react'\nimport { cn, atobID, highlightSearchWord, replaceTemplate } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport type {\n SearchPageProps,\n SortKey,\n SearchProductItemProps,\n SearchBlogItemProps,\n SearchPageItemProps,\n SearchRecommendProductsProps,\n} from './types'\nimport { SearchPageTabType } from './types.js'\nimport { getLocalizedPath } from '../../helpers/utils.js'\n\n/**\n * \u641C\u7D22\u5546\u54C1\n */\nconst SearchProductItem = ({\n product,\n onSecondaryButton,\n onPrimaryButton,\n searchValue,\n variantData,\n shopNowLoadingProductId,\n badgeVariant,\n}: SearchProductItemProps & { badgeVariant?: 'outline' | 'fill' }) => {\n const variant = useMemo(() => variantData || product?.variants?.[0], [product, variantData])\n const { locale = 'us', copyWriting, currencyCode } = useAiuiContext()\n\n // \u5224\u65AD\u5F53\u524D\u4EA7\u54C1\u662F\u5426\u5728\u52A0\u8F7D\u4E2D\n const isCurrentProductLoading = shopNowLoadingProductId === product?.id\n\n const listingLink = useMemo(() => {\n return getLocalizedPath(\n `/products/${product?.handle}?variant=${atobID(variant?.id as string)}?ref=search_result_${searchValue?.toLowerCase()}`,\n locale\n )\n }, [product?.handle, variant?.id, searchValue, locale])\n\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n amount: coupon ? coupon.variant_price4wscode : (variant?.price?.amount ?? variant?.price),\n baseAmount: coupon ? (variant?.price?.amount ?? variant?.price) : 0,\n currencyCode: product?.price?.currencyCode || 'USD',\n })\n\n const tags = useMemo(() => {\n return product?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n }, [product?.tags])\n\n return (\n <div className=\"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden\">\n {product?.type === 'advertising' && product?.advertisingLink ? (\n <Link href={getLocalizedPath(product?.advertisingLink, locale)} className=\"h-full\">\n <Picture\n source={`${product?.advertisingBgImg}`}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n />\n <div className=\"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500\">\n <Text\n html={product?.advertisingTitle}\n className={cn('desktop:text-base text-sm font-bold leading-[1.2]', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n {product?.advertisingSubtitle && (\n <Heading\n size={3}\n html={product?.advertisingSubtitle}\n className={cn('laptop:line-clamp-3 mt-2 line-clamp-4 font-bold', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n )}\n </div>\n </Link>\n ) : (\n <a\n href={listingLink}\n className=\"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300\"\n >\n <div className=\"ipc_search_product_item_image\">\n <Picture\n className=\"lg-desktop:size-[196px] mx-auto size-[138px]\"\n source={variant?.image?.url || product?.images?.[0]?.url}\n alt={product?.title}\n imgClassName=\"object-cover size-full\"\n />\n </div>\n <div className=\"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4\">\n <div className=\"flex-1\">\n <div className=\"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2\">\n {tags?.map((tag: string, index: number) => (\n <Badge key={index} size=\"lg\" variant={badgeVariant}>\n {tag}\n </Badge>\n ))}\n </div>\n <Text\n className=\"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]\"\n weight=\"bold\"\n html={highlightSearchWord(product?.title || '', searchValue || '')}\n />\n <Text\n as=\"p\"\n className=\"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold\"\n html={highlightSearchWord(product?.description, searchValue || '')}\n />\n </div>\n <div>\n <div className=\"mb-2 flex items-center\">\n {!variant?.availableForSale ? (\n <div className=\"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {copyWriting?.soldOutText || 'Sold Out'}\n </div>\n ) : (\n <>\n <div className=\"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n <div\n className={cn(\n 'ipc_search_product_item_button_group',\n 'lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2'\n )}\n >\n {copyWriting?.learnMoreText && (\n <Button\n variant=\"secondary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onSecondaryButton?.()\n }}\n >\n {copyWriting?.learnMoreText}\n </Button>\n )}\n {copyWriting?.shopNowText && (\n <Button\n variant=\"primary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n disabled={!variant?.availableForSale}\n loading={isCurrentProductLoading}\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onPrimaryButton?.()\n }}\n >\n {copyWriting?.shopNowText}\n </Button>\n )}\n </div>\n </div>\n </div>\n </a>\n )}\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u6587\u7AE0\n */\nconst SearchBlogItem = ({ blog, searchValue }: SearchBlogItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n\n const articleLink = useMemo(\n () => getLocalizedPath(`/blogs/${blog?.blog?.handle}/${blog?.handle.replace('storefront-', '')}`, locale),\n [blog, locale]\n )\n\n return (\n <div className=\"ipc_search_blog_item border-b border-[#E4E5E6] py-6\">\n <div className=\"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4\">\n <div className=\"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden\">\n <Picture\n source={blog?.image?.url}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n alt={blog?.title}\n />\n </div>\n <div className=\"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center\">\n <Heading size={3} html={highlightSearchWord(blog?.title, searchValue)} />\n <Text\n html={highlightSearchWord(blog?.content, searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]\"\n />\n <div className=\"desktop:mt-6 mt-4\">\n <Button as=\"a\" href={articleLink} variant=\"secondary\" size=\"lg\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPageItem = ({ searchValue, page }: SearchPageItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n const pageLink = useMemo(() => getLocalizedPath(`/${page?.handle}`, locale), [page, locale])\n return (\n <div className=\"ipc_search_page_items border-b border-[#E4E5E6] py-6\">\n <Heading size={3} html={highlightSearchWord(page?.name, searchValue)} />\n <Text\n as=\"p\"\n html={highlightSearchWord(page?.bodySummary || '', searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]\"\n />\n <Button as=\"a\" href={pageLink} variant=\"secondary\" size=\"lg\" className=\"desktop:mt-6 mt-4\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u7ED3\u679C\u4E3A\u7A7A\n */\nconst SearchPageNoResult = ({ url, label }: { url: string; label: string }) => {\n return (\n <div className=\"flex flex-col items-center justify-center gap-4\">\n <Picture source={url} className=\"h-[180px] w-[240px]\" imgClassName=\"object-cover\" />\n <Text html={label} className=\"desktop:text-[18px] text-sm font-bold leading-[1.4]\" />\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u63A8\u8350\u5546\u54C1\n */\nconst SearchRecommendProducts = ({\n products,\n title,\n buildProps,\n onSecondaryButton,\n onPrimaryButton,\n badgeVariant,\n}: SearchRecommendProductsProps & { badgeVariant?: 'outline' | 'fill' }) => {\n const { products: buildProducts } = buildProps || {}\n console.log(buildProducts, 'buildProducts')\n return (\n <div className=\"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]\">\n <Heading size={4} weight=\"bold\" html={title} />\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4\">\n {products?.map((product: any, index: number) => {\n const buildProduct = buildProducts?.find((buildProduct: any) => buildProduct.handle === product.handle)\n if (!buildProduct) return null\n const variant = buildProduct?.variants?.find((variant: any) => variant.sku === product.sku)\n return (\n <SearchProductItem\n product={buildProduct}\n variantData={variant}\n key={product.sku + index}\n badgeVariant={badgeVariant}\n onSecondaryButton={() => onSecondaryButton?.()}\n onPrimaryButton={() => onPrimaryButton?.()}\n />\n )\n })}\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPage = ({\n searchResult,\n searchValue,\n data,\n onSecondaryButton,\n onPrimaryButton,\n // loadMore,\n onChangeSort,\n loading,\n shopNowLoadingProductId,\n searchResultCount,\n onChangeTab,\n buildProps,\n componentOverrides,\n className,\n ...rest\n}: SearchPageProps) => {\n const badgeVariant = componentOverrides?.badge?.variant\n const [currentTab, setCurrentTab] = useState<any>(data?.tabs?.[0])\n const [isOpenSort, setIsOpenSort] = useState(false)\n const [currentSortKey, setCurrentSortKey] = useState<any>({\n [SearchPageTabType.PRODUCTS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PRODUCTS)\n ?.sortKeys?.[0],\n [SearchPageTabType.BLOGS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.BLOGS)?.sortKeys?.[0],\n [SearchPageTabType.PAGES]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PAGES)?.sortKeys?.[0],\n })\n\n const searchProductsResult = useMemo(() => {\n return searchResult?.products || []\n }, [searchResult])\n\n const searchBlogsResult = useMemo(() => {\n return searchResult?.blogs || []\n }, [searchResult])\n\n const searchPagesResult = useMemo(() => {\n return searchResult?.pages || []\n }, [searchResult])\n\n const totalCount = useMemo(() => {\n return Object.values(searchResultCount || {}).reduce((acc, curr) => acc + curr, 0)\n }, [searchResultCount])\n\n const searchProductsResultWithAdvertising = useMemo(() => {\n const advertisingData = {\n advertisingBgImg: `${currentTab?.advertisingBgImg?.url}, ${currentTab?.advertisingMobBgImg?.url} 768`,\n advertisingTitle: currentTab?.advertisingTitle,\n advertisingSubtitle: currentTab?.advertisingSubtitle,\n advertisingLink: currentTab?.advertisingLink,\n advertisingTheme: currentTab?.advertisingTheme,\n type: 'advertising',\n }\n // \u5E7F\u544A\u4F4D\u6838\u5FC3\u5B57\u6BB5\u5168\u4E3A\u7A7A\u65F6\uFF0C\u4E0D\u63D2\u5165\u5E7F\u544A\u6570\u636E\n const hasAdvertisingData =\n !!currentTab?.advertisingBgImg?.url || !!currentTab?.advertisingTitle || !!currentTab?.advertisingLink\n\n if (hasAdvertisingData) {\n const result = [...(searchProductsResult || [])]\n if (result.length >= 8) {\n result.splice(7, 0, advertisingData)\n } else if (result.length > 0) {\n result.push(advertisingData)\n }\n return result\n } else {\n return searchProductsResult\n }\n }, [currentTab, searchProductsResult])\n\n return (\n <div\n {...rest}\n className={cn(\n 'ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16',\n className\n )}\n >\n <Heading\n size={4}\n weight=\"bold\"\n html={replaceTemplate(data?.title, {\n totalCount: totalCount?.toString(),\n inputValue: `\"${searchValue}\"`,\n })}\n />\n <div className=\"mt-6\">\n <Tabs className=\"ipc_search_page_tabs\" defaultValue=\"products\">\n <div className=\" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between\">\n <TabsList>\n {data?.tabs?.map((tab: any) => (\n <TabsTrigger\n onClick={() => {\n setCurrentTab(tab)\n // \u5207\u6362tab\u65F6\uFF0C\u91CD\u7F6E\u8BE5tab\u7684\u6392\u5E8F\u503C\u4E3A\u9ED8\u8BA4\u503C\uFF08\u7B2C\u4E00\u4E2AsortKey\uFF09\n const defaultSortKey = tab?.sortKeys?.[0]\n if (defaultSortKey) {\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [tab?.tabType]: defaultSortKey,\n }))\n onChangeSort?.(tab?.tabType, defaultSortKey)\n }\n onChangeTab?.(tab?.tabType)\n }}\n key={tab.id}\n defaultValue=\"products\"\n value={tab.tabType}\n >\n {tab.label} ({searchResultCount?.[tab.tabType as keyof typeof searchResultCount]})\n </TabsTrigger>\n ))}\n </TabsList>\n <DropdownMenu onOpenChange={setIsOpenSort}>\n <DropdownMenuTrigger asChild>\n <button className=\"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none\">\n {currentTab?.sortLabel} {currentSortKey?.[currentTab?.tabType]?.label}{' '}\n <DownArrow\n className={cn('inline-block size-4', {\n 'rotate-180': isOpenSort,\n })}\n />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align=\"start\"\n sideOffset={8}\n className=\"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none\"\n >\n {currentTab?.sortKeys?.map((sortKey: SortKey) => {\n return (\n <DropdownMenuItem\n className={cn(\n 'laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none',\n {\n 'bg-[#EAEAEC]': currentSortKey?.[currentTab?.tabType]?.value === sortKey.value,\n }\n )}\n onClick={() => {\n onChangeSort?.(currentTab?.tabType, sortKey)\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [currentTab?.tabType]: sortKey,\n }))\n }}\n key={sortKey.id}\n >\n {sortKey.label}\n </DropdownMenuItem>\n )\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n <TabsContent value={SearchPageTabType.PRODUCTS} className=\"ipc_search_page_tabs_products_content mt-6\">\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4\">\n {searchProductsResultWithAdvertising?.map((product: any, index: number) => (\n <SearchProductItem\n searchValue={searchValue}\n key={(product.id || '') + index}\n product={product}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n onSecondaryButton={() => onSecondaryButton?.(product)}\n onPrimaryButton={() => onPrimaryButton?.(product)}\n />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex w-full justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchProductsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </TabsContent>\n <TabsContent value={SearchPageTabType.BLOGS} className=\"ipc_search_page_tabs_blogs_content\">\n <div>\n {searchBlogsResult?.map((blog: any) => (\n <SearchBlogItem key={blog.id} blog={blog} searchValue={searchValue} />\n ))}\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchBlogsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </div>\n </TabsContent>\n <TabsContent value={SearchPageTabType.PAGES} className=\"ipc_search_page_tabs_pages_content\">\n <div>\n {searchPagesResult?.map((page: any, index: number) => (\n <SearchPageItem key={(page.global_id || page.id) + index} page={page} searchValue={searchValue} />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchPagesResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </TabsContent>\n </Tabs>\n </div>\n </div>\n )\n}\n\nexport default SearchPage\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA8EU,IAAAI,EAAA,6BA9EVC,EAgBO,qCACPC,EAA0B,8CAC1BC,EAAkC,iBAClCC,EAAiE,kCACjEC,EAA+B,oCAC/BC,EAAmC,2CASnCC,EAAkC,sBAClCH,EAAiC,kCAKjC,MAAMI,EAAoB,CAAC,CACzB,QAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,YAAAC,EACA,YAAAC,EACA,wBAAAC,EACA,aAAAC,CACF,IAAsE,CACpE,MAAMC,KAAU,WAAQ,IAAMH,GAAeJ,GAAS,WAAW,CAAC,EAAG,CAACA,EAASI,CAAW,CAAC,EACrF,CAAE,OAAAI,EAAS,KAAM,YAAAC,EAAa,aAAAC,CAAa,KAAI,kBAAe,EAG9DC,EAA0BN,IAA4BL,GAAS,GAE/DY,KAAc,WAAQ,OACnB,oBACL,aAAaZ,GAAS,MAAM,eAAY,UAAOO,GAAS,EAAY,CAAC,sBAAsBJ,GAAa,YAAY,CAAC,GACrHK,CACF,EACC,CAACR,GAAS,OAAQO,GAAS,GAAIJ,EAAaK,CAAM,CAAC,EAEhDK,EAASN,GAAS,UAAU,CAAC,EAE7B,CAAE,MAAAO,EAAO,UAAAC,CAAU,KAAI,sBAAmB,CAC9C,OAAQL,IAAiB,MAAQ,KAAOF,GAAU,KAClD,OAAQK,EAASA,EAAO,qBAAwBN,GAAS,OAAO,QAAUA,GAAS,MACnF,WAAYM,EAAUN,GAAS,OAAO,QAAUA,GAAS,MAAS,EAClE,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AAYL,EACZ,MAAOK,GAAM,uBACb,wBAAyBjC,EACzB,aAAcC,EAChB,GACF,GAGN,GACF,EACF,GACF,CAEJ,EAEA,IAAOjB,EAAQ+C",
|
|
6
|
+
"names": ["SearchPage_exports", "__export", "SearchPage_default", "__toCommonJS", "import_jsx_runtime", "import_components", "import_icons", "import_react", "import_utils", "import_AiuiProvider", "import_shelfDisplay", "import_types", "SearchProductItem", "product", "onSecondaryButton", "onPrimaryButton", "searchValue", "variantData", "shopNowLoadingProductId", "badgeVariant", "variant", "locale", "copyWriting", "currencyCode", "isCurrentProductLoading", "listingLink", "coupon", "price", "basePrice", "tags", "item", "tag", "index", "e", "SearchBlogItem", "blog", "articleLink", "SearchPageItem", "page", "pageLink", "SearchPageNoResult", "url", "label", "SearchRecommendProducts", "products", "title", "buildProps", "buildProducts", "buildProduct", "SearchPage", "searchResult", "data", "onChangeSort", "loading", "searchResultCount", "onChangeTab", "componentOverrides", "className", "rest", "currentTab", "setCurrentTab", "isOpenSort", "setIsOpenSort", "currentSortKey", "setCurrentSortKey", "tab", "searchProductsResult", "searchBlogsResult", "searchPagesResult", "totalCount", "acc", "curr", "searchProductsResultWithAdvertising", "advertisingData", "result", "defaultSortKey", "prev", "sortKey"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var W=Object.create;var f=Object.defineProperty;var E=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var S=Object.getPrototypeOf,V=Object.prototype.hasOwnProperty;var A=(t,e)=>{for(var a in e)f(t,a,{get:e[a],enumerable:!0})},y=(t,e,a,s)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of k(e))!V.call(t,o)&&o!==a&&f(t,o,{get:()=>e[o],enumerable:!(s=E(e,o))||s.enumerable});return t};var x=(t,e,a)=>(a=t!=null?W(S(t)):{},y(e||!t||!t.__esModule?f(a,"default",{value:t,enumerable:!0}):a,t)),F=t=>y(f({},"__esModule",{value:!0}),t);var M={};A(M,{Tabs:()=>h,TabsContent:()=>R,TabsList:()=>T,TabsTrigger:()=>v});module.exports=F(M);var i=require("react/jsx-runtime"),r=x(require("react")),d=require("../helpers/index.js"),n=x(require("@radix-ui/react-tabs")),g=require("class-variance-authority");function P(t){return t.trim().replace(/\s+/g,"-")}const b=r.createContext({align:"left",shape:"square"}),h=r.forwardRef(({children:t,align:e="left",shape:a="default",...s},o)=>(0,i.jsx)(n.Root,{ref:o,...s,children:(0,i.jsx)(b.Provider,{value:{align:e,shape:a},children:t})}));h.displayName="Tabs";const q=(0,g.cva)("rounded-tabs",{variants:{shape:{default:"",rounded:"rounded-[28px]",square:"rounded-none"}},defaultVariants:{shape:"default"}}),j=(0,g.cva)("rounded-tabs",{variants:{shape:{default:"",rounded:"rounded-[28px]",square:"rounded-none"}},defaultVariants:{shape:"default"}}),T=r.forwardRef(({className:t,...e},a)=>{const{align:s,shape:o}=r.useContext(b),l=s==="center"?"flex w-full justify-center":s==="right"?"flex w-full justify-end":null,p=(0,i.jsx)(n.List,{ref:a,className:(0,d.cn)("bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1",q({shape:o}),t),style:{scrollbarWidth:"none",msOverflowStyle:"none"},...e});return l?(0,i.jsx)("div",{className:l,children:p}):p});T.displayName=n.List.displayName;const v=r.forwardRef(({className:t,onClick:e,value:a,...s},o)=>{const{shape:l}=r.useContext(b),p=c=>{e?.(c);const m=c?.currentTarget,u=c?.currentTarget?.parentElement;if(m&&u){const C=m.offsetLeft,w=m.offsetWidth,L=u.offsetWidth,N=C-L/2+w/2;u.scrollTo({left:N,behavior:"smooth"})}};return(0,i.jsx)(n.Trigger,{ref:o,className:(0,d.cn)("text-info-primary lg-desktop:text-base disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-5 pb-2.5 pt-[11px] text-sm font-bold data-[state=active]:bg-white data-[state=active]:text-[#080A0F]",t,j({shape:l})),onClick:p,value:P(a),...s})});v.displayName=n.Trigger.displayName;const R=r.forwardRef(({className:t,value:e,...a},s)=>(0,i.jsx)(n.Content,{ref:s,className:(0,d.cn)(t),value:P(e),...a}));R.displayName=n.Content.displayName;
|
|
2
2
|
//# sourceMappingURL=tabs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/tabs.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\n\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport { cva } from 'class-variance-authority'\nimport type { Align, Shape } from '../types/props.js'\n\ntype tabShape = Shape | 'default'\n\nconst TabListContext = React.createContext<{\n align?: Align\n shape: tabShape\n}>({\n align: 'left',\n shape: 'square',\n})\n\nconst Tabs = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {\n align?: Align\n shape?: tabShape\n }\n>(({ children, align = 'left', shape = 'default', ...props }, ref) => (\n <TabsPrimitive.Root ref={ref} {...props}>\n <TabListContext.Provider value={{ align, shape }}>{children}</TabListContext.Provider>\n </TabsPrimitive.Root>\n))\nTabs.displayName = 'Tabs'\n\nconst tabsListVariants = cva('rounded-tabs', {\n variants: {\n shape: {\n default: '',\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'default',\n },\n})\n\nconst tabsTriggerVariants = cva('rounded-tabs', {\n variants: {\n shape: {\n default: '',\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'default',\n },\n})\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => {\n const { align: alignFromParent, shape: shapeFromParent } = React.useContext(TabListContext)\n\n const wrapperClass =\n alignFromParent === 'center'\n ? 'flex w-full justify-center'\n : alignFromParent === 'right'\n ? 'flex w-full justify-end'\n : null\n\n const list = (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n 'bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1',\n tabsListVariants({ shape: shapeFromParent }),\n className\n )}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n {...props}\n />\n )\n\n return wrapperClass ? <div className={wrapperClass}>{list}</div> : list\n})\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, onClick, ...props }, ref) => {\n const { shape: shapeFromParent } = React.useContext(TabListContext)\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(e)\n const tabElement = e?.currentTarget\n const container = e?.currentTarget?.parentElement\n if (tabElement && container) {\n const tabLeft = tabElement.offsetLeft\n const tabWidth = tabElement.offsetWidth\n const containerWidth = container.offsetWidth\n const scrollTo = tabLeft - containerWidth / 2 + tabWidth / 2\n container.scrollTo({\n left: scrollTo,\n behavior: 'smooth',\n })\n }\n }\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n 'text-info-primary lg-desktop:text-base disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-5 pb-2.5 pt-[11px] text-sm font-bold data-[state=active]:bg-white data-[state=active]:text-[#080A0F]',\n className,\n tabsTriggerVariants({\n shape: shapeFromParent,\n })\n )}\n onClick={handleClick}\n {...props}\n />\n )\n})\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => <TabsPrimitive.Content ref={ref} className={cn(className)} {...props}
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,gBAAAC,EAAA,aAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAN,
|
|
6
|
-
"names": ["tabs_exports", "__export", "Tabs", "TabsContent", "TabsList", "TabsTrigger", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "TabsPrimitive", "import_class_variance_authority", "TabListContext", "children", "align", "shape", "props", "ref", "tabsListVariants", "tabsTriggerVariants", "className", "alignFromParent", "shapeFromParent", "wrapperClass", "list", "onClick", "handleClick", "e", "tabElement", "container", "tabLeft", "tabWidth", "containerWidth", "scrollTo"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\n\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport { cva } from 'class-variance-authority'\nimport type { Align, Shape } from '../types/props.js'\n\ntype tabShape = Shape | 'default'\n\n/**\n * Sanitize a tab value so it is safe to use as part of an HTML id attribute.\n *\n * HTML ids must not contain whitespace characters. Radix UI uses the value\n * directly in generated ids (e.g. `radix-:r0:-trigger-{value}`), so an\n * unsanitized value like \"best seller\" would produce an invalid id.\n *\n * This function replaces any sequence of whitespace with a single hyphen and\n * trims leading/trailing whitespace, leaving all other characters intact.\n */\nfunction sanitizeTabValue(value: string): string {\n return value.trim().replace(/\\s+/g, '-')\n}\n\nconst TabListContext = React.createContext<{\n align?: Align\n shape: tabShape\n}>({\n align: 'left',\n shape: 'square',\n})\n\nconst Tabs = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {\n align?: Align\n shape?: tabShape\n }\n>(({ children, align = 'left', shape = 'default', ...props }, ref) => (\n <TabsPrimitive.Root ref={ref} {...props}>\n <TabListContext.Provider value={{ align, shape }}>{children}</TabListContext.Provider>\n </TabsPrimitive.Root>\n))\nTabs.displayName = 'Tabs'\n\nconst tabsListVariants = cva('rounded-tabs', {\n variants: {\n shape: {\n default: '',\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'default',\n },\n})\n\nconst tabsTriggerVariants = cva('rounded-tabs', {\n variants: {\n shape: {\n default: '',\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'default',\n },\n})\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => {\n const { align: alignFromParent, shape: shapeFromParent } = React.useContext(TabListContext)\n\n const wrapperClass =\n alignFromParent === 'center'\n ? 'flex w-full justify-center'\n : alignFromParent === 'right'\n ? 'flex w-full justify-end'\n : null\n\n const list = (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n 'bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1',\n tabsListVariants({ shape: shapeFromParent }),\n className\n )}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n {...props}\n />\n )\n\n return wrapperClass ? <div className={wrapperClass}>{list}</div> : list\n})\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, onClick, value, ...props }, ref) => {\n const { shape: shapeFromParent } = React.useContext(TabListContext)\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(e)\n const tabElement = e?.currentTarget\n const container = e?.currentTarget?.parentElement\n if (tabElement && container) {\n const tabLeft = tabElement.offsetLeft\n const tabWidth = tabElement.offsetWidth\n const containerWidth = container.offsetWidth\n const scrollTo = tabLeft - containerWidth / 2 + tabWidth / 2\n container.scrollTo({\n left: scrollTo,\n behavior: 'smooth',\n })\n }\n }\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n 'text-info-primary lg-desktop:text-base disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-5 pb-2.5 pt-[11px] text-sm font-bold data-[state=active]:bg-white data-[state=active]:text-[#080A0F]',\n className,\n tabsTriggerVariants({\n shape: shapeFromParent,\n })\n )}\n onClick={handleClick}\n value={sanitizeTabValue(value)}\n {...props}\n />\n )\n})\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, value, ...props }, ref) => (\n <TabsPrimitive.Content ref={ref} className={cn(className)} value={sanitizeTabValue(value)} {...props} />\n))\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, TabsContent }\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,UAAAE,EAAA,gBAAAC,EAAA,aAAAC,EAAA,gBAAAC,IAAA,eAAAC,EAAAN,GAyCI,IAAAO,EAAA,6BAvCJC,EAAuB,oBACvBC,EAAmB,+BAEnBC,EAA+B,mCAC/BC,EAAoB,oCAepB,SAASC,EAAiBC,EAAuB,CAC/C,OAAOA,EAAM,KAAK,EAAE,QAAQ,OAAQ,GAAG,CACzC,CAEA,MAAMC,EAAiBN,EAAM,cAG1B,CACD,MAAO,OACP,MAAO,QACT,CAAC,EAEKN,EAAOM,EAAM,WAMjB,CAAC,CAAE,SAAAO,EAAU,MAAAC,EAAQ,OAAQ,MAAAC,EAAQ,UAAW,GAAGC,CAAM,EAAGC,OAC5D,OAACT,EAAc,KAAd,CAAmB,IAAKS,EAAM,GAAGD,EAChC,mBAACJ,EAAe,SAAf,CAAwB,MAAO,CAAE,MAAAE,EAAO,MAAAC,CAAM,EAAI,SAAAF,EAAS,EAC9D,CACD,EACDb,EAAK,YAAc,OAEnB,MAAMkB,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F,EACA,SACE,OAACzB,EAAc,QAAd,CACC,IAAKS,EACL,aAAW,MACT,8PACAG,EACAD,EAAoB,CAClB,MAAOG,CACT,CAAC,CACH,EACA,QAASI,EACT,MAAOhB,EAAiBC,CAAK,EAC5B,GAAGK,EACN,CAEJ,CAAC,EACDb,EAAY,YAAcK,EAAc,QAAQ,YAEhD,MAAMP,EAAcK,EAAM,WAGxB,CAAC,CAAE,UAAAc,EAAW,MAAAT,EAAO,GAAGK,CAAM,EAAGC,OACjC,OAACT,EAAc,QAAd,CAAsB,IAAKS,EAAK,aAAW,MAAGG,CAAS,EAAG,MAAOV,EAAiBC,CAAK,EAAI,GAAGK,EAAO,CACvG,EACDf,EAAY,YAAcO,EAAc,QAAQ",
|
|
6
|
+
"names": ["tabs_exports", "__export", "Tabs", "TabsContent", "TabsList", "TabsTrigger", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "TabsPrimitive", "import_class_variance_authority", "sanitizeTabValue", "value", "TabListContext", "children", "align", "shape", "props", "ref", "tabsListVariants", "tabsTriggerVariants", "className", "alignFromParent", "shapeFromParent", "wrapperClass", "list", "onClick", "handleClick", "e", "tabElement", "container", "tabLeft", "tabWidth", "containerWidth", "scrollTo"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { cn, getLocalizedPath } from './utils.js';
|
|
1
|
+
export { cn, getLocalizedPath, replaceTemplate } from './utils.js';
|
|
2
2
|
export { noop } from './utils.js';
|
|
3
3
|
export { formatPrice, languageTerritory, PRICE_SYMBOL, extendLocaleMap } from './priceFormatting.js';
|
|
4
4
|
export { isLexicalEmpty } from './isLexicalEmpty.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var m=Object.defineProperty;var
|
|
1
|
+
"use strict";var m=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var i=Object.getOwnPropertyNames;var n=Object.prototype.hasOwnProperty;var L=(r,e)=>{for(var p in e)m(r,p,{get:e[p],enumerable:!0})},g=(r,e,p,c)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of i(e))!n.call(r,a)&&a!==p&&m(r,a,{get:()=>e[a],enumerable:!(c=f(e,a))||c.enumerable});return r};var P=r=>g(m({},"__esModule",{value:!0}),r);var d={};L(d,{PRICE_SYMBOL:()=>o.PRICE_SYMBOL,cn:()=>t.cn,extendLocaleMap:()=>o.extendLocaleMap,formatPrice:()=>o.formatPrice,getLocalizedPath:()=>t.getLocalizedPath,isLexicalEmpty:()=>x.isLexicalEmpty,languageTerritory:()=>o.languageTerritory,noop:()=>l.noop,replaceTemplate:()=>t.replaceTemplate});module.exports=P(d);var t=require("./utils.js"),l=require("./utils.js"),o=require("./priceFormatting.js"),x=require("./isLexicalEmpty.js");
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { cn, getLocalizedPath } from './utils.js'\nexport { noop } from './utils.js'\nexport { formatPrice, languageTerritory, PRICE_SYMBOL, extendLocaleMap } from './priceFormatting.js'\nexport { isLexicalEmpty } from './isLexicalEmpty.js'\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,
|
|
4
|
+
"sourcesContent": ["export { cn, getLocalizedPath, replaceTemplate } from './utils.js'\nexport { noop } from './utils.js'\nexport { formatPrice, languageTerritory, PRICE_SYMBOL, extendLocaleMap } from './priceFormatting.js'\nexport { isLexicalEmpty } from './isLexicalEmpty.js'\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8SAAAE,EAAAF,GAAA,IAAAG,EAAsD,sBACtDA,EAAqB,sBACrBC,EAA8E,gCAC9EC,EAA+B",
|
|
6
6
|
"names": ["helpers_exports", "__export", "__toCommonJS", "import_utils", "import_priceFormatting", "import_isLexicalEmpty"]
|
|
7
7
|
}
|
|
@@ -3,6 +3,23 @@ export declare function cn(...inputs: ClassValue[]): string;
|
|
|
3
3
|
export declare function noop(): any;
|
|
4
4
|
export declare function atobID(id: string): string | undefined;
|
|
5
5
|
export declare const spaceToHyphen: (str: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* 字符串模板替换 - 将模板中的 {key} 占位符替换为对应值
|
|
8
|
+
*
|
|
9
|
+
* @param template - 模板字符串(如 "共 {total} 条结果")
|
|
10
|
+
* @param replacements - 替换键值对(如 { total: "5" })
|
|
11
|
+
* @param beginSeg - 占位符开始符号,默认 "{",支持自定义如 "{{"、"${"
|
|
12
|
+
* @param endSeg - 占位符结束符号,默认 "}",支持自定义如 "}}"、空字符串
|
|
13
|
+
* @returns 替换后的字符串
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* replaceTemplate("Hello {name}!", { name: "World" })
|
|
17
|
+
* // => "Hello World!"
|
|
18
|
+
*
|
|
19
|
+
* replaceTemplate("共 {total} 条,搜索 {keyword}", { total: "5", keyword: "test" })
|
|
20
|
+
* // => "共 5 条,搜索 test"
|
|
21
|
+
*/
|
|
22
|
+
export declare const replaceTemplate: (template: string, replacements: Record<string, string>, beginSeg?: string, endSeg?: string) => string;
|
|
6
23
|
/**
|
|
7
24
|
* 高亮搜索关键词
|
|
8
25
|
* @param text 原始文本
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var g=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var h=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var a=(t,e)=>{for(var r in e)g(t,r,{get:e[r],enumerable:!0})},b=(t,e,r,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of h(e))!d.call(t,i)&&i!==r&&g(t,i,{get:()=>e[i],enumerable:!(n=$(e,i))||n.enumerable});return t};var y=t=>b(g({},"__esModule",{value:!0}),t);var T={};a(T,{atobID:()=>W,cn:()=>w,getLocalizedPath:()=>z,highlightSearchWord:()=>j,noop:()=>R,replaceTemplate:()=>S,spaceToHyphen:()=>E});module.exports=y(T);var u=require("clsx"),f=require("tailwind-merge");const p=(0,f.extendTailwindMerge)({extend:{theme:{borderRadius:["btn"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function w(...t){return p((0,u.clsx)(t))}function R(){}function W(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}const E=t=>t?.replace(/\s+/g,"-"),c=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),S=(t,e,r="{",n="}")=>{if(!t||!e||Object.keys(e).length===0)return t;const i=c(r),o=c(n),s=new RegExp(`${i}([a-zA-Z0-9_-]+)${o}`,"g");return t.replace(s,(l,x)=>e[x]!==void 0?e[x]:l)},j=(t,e)=>{try{if(!t||!e)return t;const r=c(e),n=new RegExp(r,"gi");return t.replace(n,i=>`<span class='text-brand-0 font-bold'>${i}</span>`)}catch(r){return console.error("highlightSearchWord error:",r),t}},z=(t,e,r)=>{if(!t)return t;if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("#"))return r?t.includes("?")?`${t}&${r}`:`${t}?${r}`:t;const n=t.split("/").filter(Boolean);if(n.length===0){const s=e==="us"?"/":`/${e}`;return r?`${s}?${r}`:s}if(n[0]===e){const s=`/${n.join("/")}`;return r?`${s}?${r}`:s}const o=`${e==="us"?"":`/${e}`}/${n.join("/")}`;return r?`${o}?${r}`:o};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { clsx, type ClassValue } from 'clsx'\nimport { extendTailwindMerge } from 'tailwind-merge'\n\nconst twMerge = extendTailwindMerge({\n extend: {\n theme: {\n borderRadius: ['btn'],\n },\n classGroups: {\n 'font-size': [\n 'text-heading-1',\n 'text-heading-2',\n 'text-heading-3',\n 'text-heading-4',\n 'text-heading-5',\n 'text-text-3',\n 'text-text-2',\n 'text-text-1',\n ],\n 'text-color': [\n 'text-info-primary',\n 'text-info-secondary',\n 'text-info-tertiary',\n 'text-info-quaternary',\n 'text-info-white',\n ],\n leading: ['leading-tight', 'leading-normal', 'leading-loose'],\n },\n },\n})\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function noop(): any {}\n\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\nexport const spaceToHyphen = (str: string) => str?.replace(/\\s+/g, '-')\n\n/**\n * \u8F6C\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n * @param str \u9700\u8981\u8F6C\u4E49\u7684\u5B57\u7B26\u4E32\n * @returns \u8F6C\u4E49\u540E\u7684\u5B57\u7B26\u4E32\n */\nconst escapeRegExp = (str: string): string => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * \u9AD8\u4EAE\u641C\u7D22\u5173\u952E\u8BCD\n * @param text \u539F\u59CB\u6587\u672C\n * @param searchText \u641C\u7D22\u5173\u952E\u8BCD\n * @returns \u9AD8\u4EAE\u540E\u7684 HTML \u5B57\u7B26\u4E32\n */\nexport const highlightSearchWord = (text: string, searchText: string) => {\n try {\n if (!text || !searchText) {\n return text\n }\n\n // \u8F6C\u4E49\u641C\u7D22\u6587\u672C\u4E2D\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n const escapedSearchText = escapeRegExp(searchText)\n const regex = new RegExp(escapedSearchText, 'gi')\n\n // \u4F7F\u7528\u6B63\u5219\u8868\u8FBE\u5F0F\u7684\u5339\u914D\u7ED3\u679C\u6765\u4FDD\u6301\u539F\u59CB\u5927\u5C0F\u5199\n return text.replace(regex, match => `<span class='text-brand-0 font-bold'>${match}</span>`)\n } catch (e) {\n console.error('highlightSearchWord error:', e)\n return text\n }\n}\n\n/**\n * \u83B7\u53D6\u672C\u5730\u5316\u8DEF\u5F84\n *\n * \u6839\u636E\u8BED\u8A00\u6807\u8BC6\u4E3A\u8DEF\u5F84\u6DFB\u52A0\u5BF9\u5E94\u7684 locale \u524D\u7F00\u3002\n * - 'us' \u4E3A\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u4E0D\u6DFB\u52A0\u524D\u7F00\n * - \u5176\u4ED6\u8BED\u8A00\u4F1A\u6DFB\u52A0 `/{locale}` \u524D\u7F00\n * - \u5B8C\u6574 URL\uFF08http/https\uFF09\u4E0D\u505A\u5904\u7406\n * - \u81EA\u52A8\u5904\u7406\u8DEF\u5F84\u683C\u5F0F\uFF08\u8865\u5145\u524D\u5BFC\u659C\u6760\u3001\u79FB\u9664\u5C3E\u90E8\u659C\u6760\uFF09\n *\n * @param path - \u539F\u59CB\u8DEF\u5F84\n * @param locale - \u8BED\u8A00\u6807\u8BC6\uFF08\u5982 'us', 'uk', 'de', 'jp' \u7B49\uFF09\n * @returns \u672C\u5730\u5316\u540E\u7684\u8DEF\u5F84\n *\n * @example\n * // \u57FA\u672C\u7528\u6CD5 - \u9ED8\u8BA4\u8BED\u8A00 'us' \u4E0D\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'us') // => '/products'\n * getLocalizedPath('/about', 'us') // => '/about'\n *\n * @example\n * // \u5176\u4ED6\u8BED\u8A00\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'uk') // => '/uk/products'\n * getLocalizedPath('/about/team', 'de') // => '/de/about/team'\n * getLocalizedPath('/contact', 'jp') // => '/jp/contact'\n *\n * @example\n * // \u6839\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('/', 'us') // => '/'\n * getLocalizedPath('/', 'uk') // => '/uk'\n *\n * @example\n * // \u81EA\u52A8\u683C\u5F0F\u5316\u8DEF\u5F84\n * getLocalizedPath('products', 'uk') // => '/uk/products' (\u8865\u5145\u524D\u5BFC\u659C\u6760)\n * getLocalizedPath('/products/', 'uk') // => '/uk/products' (\u79FB\u9664\u5C3E\u90E8\u659C\u6760)\n * getLocalizedPath('//products//detail/', 'uk') // => '/uk/products/detail' (\u79FB\u9664\u591A\u4F59\u659C\u6760)\n *\n * @example\n * // \u5DF2\u5305\u542B locale \u7684\u8DEF\u5F84\u4E0D\u91CD\u590D\u6DFB\u52A0\n * getLocalizedPath('/uk/products', 'uk') // => '/uk/products'\n *\n * @example\n * // \u5B8C\u6574 URL \u4E0D\u5904\u7406\n * getLocalizedPath('https://example.com/page', 'uk') // => 'https://example.com/page'\n * getLocalizedPath('http://example.com', 'de') // => 'http://example.com'\n *\n * @example\n * // \u7A7A\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('', 'uk') // => ''\n *\n * @example\n * // appendParams \u4F1A\u81EA\u52A8\u5224\u65AD\u7528 ? \u8FD8\u662F &\n * getLocalizedPath('/products', 'us', 'ref=footer') // => '/products?ref=footer'\n * getLocalizedPath('https://example.com/page', 'us', 'ref=footer') // => 'https://example.com/page?ref=footer'\n * getLocalizedPath('https://example.com/page?app=foo', 'us', 'ref=footer') // => 'https://example.com/page?app=foo&ref=footer'\n */\nexport const getLocalizedPath = (path: string, locale: string, appendParams?: string): string => {\n if (!path) return path\n\n // \u5982\u679C\u662F\u5B8C\u6574 URL\uFF08http:// \u6216 https://\uFF09\u6216\u951A\u70B9\u94FE\u63A5\uFF08#\uFF09\uFF0C\u4E0D\u5904\u7406 locale\uFF0C\u4F46\u9700\u5904\u7406 appendParams\n if (path.startsWith('http://') || path.startsWith('https://') || path.startsWith('#')) {\n if (!appendParams) return path\n return path.includes('?') ? `${path}&${appendParams}` : `${path}?${appendParams}`\n }\n\n // \u5206\u5272\u8DEF\u5F84\u5E76\u8FC7\u6EE4\u7A7A\u6BB5\uFF08\u5904\u7406\u591A\u4E2A\u8FDE\u7EED\u659C\u6760\u7684\u60C5\u51B5\uFF09\n const pathSegments = path.split('/').filter(Boolean)\n\n // \u5982\u679C\u6CA1\u6709\u6709\u6548\u8DEF\u5F84\u6BB5\uFF0C\u8FD4\u56DE locale \u524D\u7F00\u6216 '/'\n if (pathSegments.length === 0) {\n const base = locale === 'us' ? '/' : `/${locale}`\n return appendParams ? `${base}?${appendParams}` : base\n }\n\n // \u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u5DF2\u7ECF\u5305\u542B locale\n if (pathSegments[0] === locale) {\n const base = `/${pathSegments.join('/')}`\n return appendParams ? `${base}?${appendParams}` : base\n }\n\n // \u83B7\u53D6 locale \u524D\u7F00\u5E76\u62FC\u63A5\n const localePrefix = locale === 'us' ? '' : `/${locale}`\n const base = `${localePrefix}/${pathSegments.join('/')}`\n return appendParams ? `${base}?${appendParams}` : base\n}\n"],
|
|
5
|
-
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,OAAAC,EAAA,qBAAAC,EAAA,wBAAAC,EAAA,SAAAC,EAAA,kBAAAC,IAAA,eAAAC,
|
|
6
|
-
"names": ["utils_exports", "__export", "atobID", "cn", "getLocalizedPath", "highlightSearchWord", "noop", "spaceToHyphen", "__toCommonJS", "import_clsx", "import_tailwind_merge", "twMerge", "inputs", "id", "str", "escapeRegExp", "
|
|
4
|
+
"sourcesContent": ["import { clsx, type ClassValue } from 'clsx'\nimport { extendTailwindMerge } from 'tailwind-merge'\n\nconst twMerge = extendTailwindMerge({\n extend: {\n theme: {\n borderRadius: ['btn'],\n },\n classGroups: {\n 'font-size': [\n 'text-heading-1',\n 'text-heading-2',\n 'text-heading-3',\n 'text-heading-4',\n 'text-heading-5',\n 'text-text-3',\n 'text-text-2',\n 'text-text-1',\n ],\n 'text-color': [\n 'text-info-primary',\n 'text-info-secondary',\n 'text-info-tertiary',\n 'text-info-quaternary',\n 'text-info-white',\n ],\n leading: ['leading-tight', 'leading-normal', 'leading-loose'],\n },\n },\n})\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function noop(): any {}\n\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\nexport const spaceToHyphen = (str: string) => str?.replace(/\\s+/g, '-')\n\n/**\n * \u8F6C\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n * @param str \u9700\u8981\u8F6C\u4E49\u7684\u5B57\u7B26\u4E32\n * @returns \u8F6C\u4E49\u540E\u7684\u5B57\u7B26\u4E32\n */\nconst escapeRegExp = (str: string): string => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * \u5B57\u7B26\u4E32\u6A21\u677F\u66FF\u6362 - \u5C06\u6A21\u677F\u4E2D\u7684 {key} \u5360\u4F4D\u7B26\u66FF\u6362\u4E3A\u5BF9\u5E94\u503C\n *\n * @param template - \u6A21\u677F\u5B57\u7B26\u4E32\uFF08\u5982 \"\u5171 {total} \u6761\u7ED3\u679C\"\uFF09\n * @param replacements - \u66FF\u6362\u952E\u503C\u5BF9\uFF08\u5982 { total: \"5\" }\uFF09\n * @param beginSeg - \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u9ED8\u8BA4 \"{\"\uFF0C\u652F\u6301\u81EA\u5B9A\u4E49\u5982 \"{{\"\u3001\"${\"\n * @param endSeg - \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u9ED8\u8BA4 \"}\"\uFF0C\u652F\u6301\u81EA\u5B9A\u4E49\u5982 \"}}\"\u3001\u7A7A\u5B57\u7B26\u4E32\n * @returns \u66FF\u6362\u540E\u7684\u5B57\u7B26\u4E32\n *\n * @example\n * replaceTemplate(\"Hello {name}!\", { name: \"World\" })\n * // => \"Hello World!\"\n *\n * replaceTemplate(\"\u5171 {total} \u6761\uFF0C\u641C\u7D22 {keyword}\", { total: \"5\", keyword: \"test\" })\n * // => \"\u5171 5 \u6761\uFF0C\u641C\u7D22 test\"\n */\nexport const replaceTemplate = (\n template: string,\n replacements: Record<string, string>,\n beginSeg: string = '{',\n endSeg: string = '}'\n): string => {\n if (!template) return template\n if (!replacements || Object.keys(replacements).length === 0) return template\n\n const escapedBegin = escapeRegExp(beginSeg)\n const escapedEnd = escapeRegExp(endSeg)\n const regex = new RegExp(`${escapedBegin}([a-zA-Z0-9_-]+)${escapedEnd}`, 'g')\n\n return template.replace(regex, (match, key) => {\n return replacements[key] !== undefined ? replacements[key] : match\n })\n}\n\n/**\n * \u9AD8\u4EAE\u641C\u7D22\u5173\u952E\u8BCD\n * @param text \u539F\u59CB\u6587\u672C\n * @param searchText \u641C\u7D22\u5173\u952E\u8BCD\n * @returns \u9AD8\u4EAE\u540E\u7684 HTML \u5B57\u7B26\u4E32\n */\nexport const highlightSearchWord = (text: string, searchText: string) => {\n try {\n if (!text || !searchText) {\n return text\n }\n\n // \u8F6C\u4E49\u641C\u7D22\u6587\u672C\u4E2D\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n const escapedSearchText = escapeRegExp(searchText)\n const regex = new RegExp(escapedSearchText, 'gi')\n\n // \u4F7F\u7528\u6B63\u5219\u8868\u8FBE\u5F0F\u7684\u5339\u914D\u7ED3\u679C\u6765\u4FDD\u6301\u539F\u59CB\u5927\u5C0F\u5199\n return text.replace(regex, match => `<span class='text-brand-0 font-bold'>${match}</span>`)\n } catch (e) {\n console.error('highlightSearchWord error:', e)\n return text\n }\n}\n\n/**\n * \u83B7\u53D6\u672C\u5730\u5316\u8DEF\u5F84\n *\n * \u6839\u636E\u8BED\u8A00\u6807\u8BC6\u4E3A\u8DEF\u5F84\u6DFB\u52A0\u5BF9\u5E94\u7684 locale \u524D\u7F00\u3002\n * - 'us' \u4E3A\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u4E0D\u6DFB\u52A0\u524D\u7F00\n * - \u5176\u4ED6\u8BED\u8A00\u4F1A\u6DFB\u52A0 `/{locale}` \u524D\u7F00\n * - \u5B8C\u6574 URL\uFF08http/https\uFF09\u4E0D\u505A\u5904\u7406\n * - \u81EA\u52A8\u5904\u7406\u8DEF\u5F84\u683C\u5F0F\uFF08\u8865\u5145\u524D\u5BFC\u659C\u6760\u3001\u79FB\u9664\u5C3E\u90E8\u659C\u6760\uFF09\n *\n * @param path - \u539F\u59CB\u8DEF\u5F84\n * @param locale - \u8BED\u8A00\u6807\u8BC6\uFF08\u5982 'us', 'uk', 'de', 'jp' \u7B49\uFF09\n * @returns \u672C\u5730\u5316\u540E\u7684\u8DEF\u5F84\n *\n * @example\n * // \u57FA\u672C\u7528\u6CD5 - \u9ED8\u8BA4\u8BED\u8A00 'us' \u4E0D\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'us') // => '/products'\n * getLocalizedPath('/about', 'us') // => '/about'\n *\n * @example\n * // \u5176\u4ED6\u8BED\u8A00\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'uk') // => '/uk/products'\n * getLocalizedPath('/about/team', 'de') // => '/de/about/team'\n * getLocalizedPath('/contact', 'jp') // => '/jp/contact'\n *\n * @example\n * // \u6839\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('/', 'us') // => '/'\n * getLocalizedPath('/', 'uk') // => '/uk'\n *\n * @example\n * // \u81EA\u52A8\u683C\u5F0F\u5316\u8DEF\u5F84\n * getLocalizedPath('products', 'uk') // => '/uk/products' (\u8865\u5145\u524D\u5BFC\u659C\u6760)\n * getLocalizedPath('/products/', 'uk') // => '/uk/products' (\u79FB\u9664\u5C3E\u90E8\u659C\u6760)\n * getLocalizedPath('//products//detail/', 'uk') // => '/uk/products/detail' (\u79FB\u9664\u591A\u4F59\u659C\u6760)\n *\n * @example\n * // \u5DF2\u5305\u542B locale \u7684\u8DEF\u5F84\u4E0D\u91CD\u590D\u6DFB\u52A0\n * getLocalizedPath('/uk/products', 'uk') // => '/uk/products'\n *\n * @example\n * // \u5B8C\u6574 URL \u4E0D\u5904\u7406\n * getLocalizedPath('https://example.com/page', 'uk') // => 'https://example.com/page'\n * getLocalizedPath('http://example.com', 'de') // => 'http://example.com'\n *\n * @example\n * // \u7A7A\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('', 'uk') // => ''\n *\n * @example\n * // appendParams \u4F1A\u81EA\u52A8\u5224\u65AD\u7528 ? \u8FD8\u662F &\n * getLocalizedPath('/products', 'us', 'ref=footer') // => '/products?ref=footer'\n * getLocalizedPath('https://example.com/page', 'us', 'ref=footer') // => 'https://example.com/page?ref=footer'\n * getLocalizedPath('https://example.com/page?app=foo', 'us', 'ref=footer') // => 'https://example.com/page?app=foo&ref=footer'\n */\nexport const getLocalizedPath = (path: string, locale: string, appendParams?: string): string => {\n if (!path) return path\n\n // \u5982\u679C\u662F\u5B8C\u6574 URL\uFF08http:// \u6216 https://\uFF09\u6216\u951A\u70B9\u94FE\u63A5\uFF08#\uFF09\uFF0C\u4E0D\u5904\u7406 locale\uFF0C\u4F46\u9700\u5904\u7406 appendParams\n if (path.startsWith('http://') || path.startsWith('https://') || path.startsWith('#')) {\n if (!appendParams) return path\n return path.includes('?') ? `${path}&${appendParams}` : `${path}?${appendParams}`\n }\n\n // \u5206\u5272\u8DEF\u5F84\u5E76\u8FC7\u6EE4\u7A7A\u6BB5\uFF08\u5904\u7406\u591A\u4E2A\u8FDE\u7EED\u659C\u6760\u7684\u60C5\u51B5\uFF09\n const pathSegments = path.split('/').filter(Boolean)\n\n // \u5982\u679C\u6CA1\u6709\u6709\u6548\u8DEF\u5F84\u6BB5\uFF0C\u8FD4\u56DE locale \u524D\u7F00\u6216 '/'\n if (pathSegments.length === 0) {\n const base = locale === 'us' ? '/' : `/${locale}`\n return appendParams ? `${base}?${appendParams}` : base\n }\n\n // \u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u5DF2\u7ECF\u5305\u542B locale\n if (pathSegments[0] === locale) {\n const base = `/${pathSegments.join('/')}`\n return appendParams ? `${base}?${appendParams}` : base\n }\n\n // \u83B7\u53D6 locale \u524D\u7F00\u5E76\u62FC\u63A5\n const localePrefix = locale === 'us' ? '' : `/${locale}`\n const base = `${localePrefix}/${pathSegments.join('/')}`\n return appendParams ? `${base}?${appendParams}` : base\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,YAAAE,EAAA,OAAAC,EAAA,qBAAAC,EAAA,wBAAAC,EAAA,SAAAC,EAAA,oBAAAC,EAAA,kBAAAC,IAAA,eAAAC,EAAAT,GAAA,IAAAU,EAAsC,gBACtCC,EAAoC,0BAEpC,MAAMC,KAAU,uBAAoB,CAClC,OAAQ,CACN,MAAO,CACL,aAAc,CAAC,KAAK,CACtB,EACA,YAAa,CACX,YAAa,CACX,iBACA,iBACA,iBACA,iBACA,iBACA,cACA,cACA,aACF,EACA,aAAc,CACZ,oBACA,sBACA,qBACA,uBACA,iBACF,EACA,QAAS,CAAC,gBAAiB,iBAAkB,eAAe,CAC9D,CACF,CACF,CAAC,EAEM,SAAST,KAAMU,EAAsB,CAC1C,OAAOD,KAAQ,QAAKC,CAAM,CAAC,CAC7B,CAEO,SAASP,GAAY,CAAC,CAEtB,SAASJ,EAAOY,EAAY,CACjC,OAAIA,GAAM,OAAOA,GAAO,UAAYA,EAAG,SAAS,GAAG,EAC1CA,EAAG,MAAM,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,GAAG,MAAM,EAEvCA,CAEX,CACO,MAAMN,EAAiBO,GAAgBA,GAAK,QAAQ,OAAQ,GAAG,EAOhEC,EAAgBD,GACbA,EAAI,QAAQ,sBAAuB,MAAM,EAmBrCR,EAAkB,CAC7BU,EACAC,EACAC,EAAmB,IACnBC,EAAiB,MACN,CAEX,GADI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,CACpD,CAIA,MAAMA,EAAO,GADQH,IAAW,KAAO,GAAK,IAAIA,CAAM,EAC1B,IAAIE,EAAa,KAAK,GAAG,CAAC,GACtD,OAAOD,EAAe,GAAGE,CAAI,IAAIF,CAAY,GAAKE,CACpD",
|
|
6
|
+
"names": ["utils_exports", "__export", "atobID", "cn", "getLocalizedPath", "highlightSearchWord", "noop", "replaceTemplate", "spaceToHyphen", "__toCommonJS", "import_clsx", "import_tailwind_merge", "twMerge", "inputs", "id", "str", "escapeRegExp", "template", "replacements", "beginSeg", "endSeg", "escapedBegin", "escapedEnd", "regex", "match", "key", "text", "searchText", "escapedSearchText", "e", "path", "locale", "appendParams", "pathSegments", "base"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as I,jsx as e,jsxs as i}from"react/jsx-runtime";import{Heading as S,Tabs as q,TabsList as J,TabsTrigger as Q,TabsContent as A,Text as N,Picture as C,Link as X,Button as L,DropdownMenu as Y,DropdownMenuTrigger as Z,DropdownMenuContent as ee,DropdownMenuItem as te,LoadingDots as M,Badge as ae}from"../../components/index.js";import{DownArrow as se}from"../HeaderNavigation/icons/index.js";import{useMemo as u,useState as O}from"react";import{cn as _,atobID as ie,highlightSearchWord as T}from"../../helpers/utils.js";import{useAiuiContext as j}from"../AiuiProvider/index.js";import{formatVariantPrice as le}from"../ShelfDisplay/shelfDisplay.js";import{SearchPageTabType as v}from"./types.js";import{getLocalizedPath as B}from"../../helpers/utils.js";import{replaceTemplate as oe}from"../Listing/utils/textFormat.js";const F=({product:t,onSecondaryButton:o,onPrimaryButton:s,searchValue:n,variantData:m,shopNowLoadingProductId:y,badgeVariant:b})=>{const l=u(()=>m||t?.variants?.[0],[t,m]),{locale:g="us",copyWriting:c,currencyCode:x}=j(),f=y===t?.id,D=u(()=>B(`/products/${t?.handle}?variant=${ie(l?.id)}?ref=search_result_${n?.toLowerCase()}`,g),[t?.handle,l?.id,n,g]),P=l?.coupons?.[0],{price:k,basePrice:r}=le({locale:x==="CAD"?"us":g||"us",amount:P?P.variant_price4wscode:l?.price?.amount??l?.price,baseAmount:P?l?.price?.amount??l?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),z=u(()=>t?.tags?.filter?.(d=>d?.startsWith?.("CLtag"))?.map?.(d=>d?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return e("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?i(X,{href:B(t?.advertisingLink,g),className:"h-full",children:[e(C,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),i("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(N,{html:t?.advertisingTitle,className:_("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&e(S,{size:3,html:t?.advertisingSubtitle,className:_("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):i("a",{href:D,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[e("div",{className:"ipc_search_product_item_image",children:e(C,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:l?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),i("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[i("div",{className:"flex-1",children:[e("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:z?.map((d,E)=>e(ae,{size:"lg",variant:b,children:d},E))}),e(N,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:T(t?.title||"",n||"")}),e(N,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:T(t?.description,n||"")})]}),i("div",{children:[e("div",{className:"mb-2 flex items-center",children:l?.availableForSale?i(I,{children:[e("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:l?.availableForSale&&k||""}),e("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:l?.availableForSale&&r||""})]}):e("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:c?.soldOutText||"Sold Out"})}),i("div",{className:_("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[c?.learnMoreText&&e(L,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:d=>{d.preventDefault(),d.stopPropagation(),o?.()},children:c?.learnMoreText}),c?.shopNowText&&e(L,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!l?.availableForSale,loading:f,onClick:d=>{d.preventDefault(),d.stopPropagation(),s?.()},children:c?.shopNowText})]})]})]})]})})},re=({blog:t,searchValue:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,n),[t,n]);return e("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:i("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[e("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:e(C,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),i("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[e(S,{size:3,html:T(t?.title,o)}),e(N,{html:T(t?.content,o),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),e("div",{className:"desktop:mt-6 mt-4",children:e(L,{as:"a",href:m,variant:"secondary",size:"lg",children:s?.learnMoreText||"Learn More"})})]})]})})},ne=({searchValue:t,page:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/${o?.handle}`,n),[o,n]);return i("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[e(S,{size:3,html:T(o?.name,t)}),e(N,{as:"p",html:T(o?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),e(L,{as:"a",href:m,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:s?.learnMoreText||"Learn More"})]})},R=({url:t,label:o})=>i("div",{className:"flex flex-col items-center justify-center gap-4",children:[e(C,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),e(N,{html:o,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),$=({products:t,title:o,buildProps:s,onSecondaryButton:n,onPrimaryButton:m,badgeVariant:y})=>{const{products:b}=s||{};return console.log(b,"buildProducts"),i("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[e(S,{size:4,weight:"bold",html:o}),e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((l,g)=>{const c=b?.find(f=>f.handle===l.handle);if(!c)return null;const x=c?.variants?.find(f=>f.sku===l.sku);return e(F,{product:c,variantData:x,badgeVariant:y,onSecondaryButton:()=>n?.(),onPrimaryButton:()=>m?.()},l.sku+g)})})]})},de=({searchResult:t,searchValue:o,data:s,onSecondaryButton:n,onPrimaryButton:m,onChangeSort:y,loading:b,shopNowLoadingProductId:l,searchResultCount:g,onChangeTab:c,buildProps:x,componentOverrides:f,className:D,...P})=>{const k=f?.badge?.variant,[r,z]=O(s?.tabs?.[0]),[d,E]=O(!1),[V,G]=O({[v.PRODUCTS]:s?.tabs?.find(a=>a.tabType===v.PRODUCTS)?.sortKeys?.[0],[v.BLOGS]:s?.tabs?.find(a=>a.tabType===v.BLOGS)?.sortKeys?.[0],[v.PAGES]:s?.tabs?.find(a=>a.tabType===v.PAGES)?.sortKeys?.[0]}),w=u(()=>t?.products||[],[t]),K=u(()=>t?.blogs||[],[t]),W=u(()=>t?.pages||[],[t]),U=u(()=>Object.values(g||{}).reduce((a,p)=>a+p,0),[g]),H=u(()=>{const a={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const h=[...w||[]];return h.length>=8?h.splice(7,0,a):h.length>0&&h.push(a),h}else return w},[r,w]);return i("div",{...P,className:_("ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",D),children:[e(S,{size:4,weight:"bold",html:oe(s?.title,{totalCount:U?.toString(),inputValue:`"${o}"`})}),e("div",{className:"mt-6",children:i(q,{className:"ipc_search_page_tabs",defaultValue:"products",children:[i("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[e(J,{children:s?.tabs?.map(a=>i(Q,{onClick:()=>{z(a);const p=a?.sortKeys?.[0];p&&(G(h=>({...h,[a?.tabType]:p})),y?.(a?.tabType,p)),c?.(a?.tabType)},defaultValue:"products",value:a.tabType,children:[a.label," (",g?.[a.tabType],")"]},a.id))}),i(Y,{onOpenChange:E,children:[e(Z,{asChild:!0,children:i("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",V?.[r?.tabType]?.label," ",e(se,{className:_("inline-block size-4",{"rotate-180":d})})]})}),e(ee,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(a=>e(te,{className:_("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":V?.[r?.tabType]?.value===a.value}),onClick:()=>{y?.(r?.tabType,a),G(p=>({...p,[r?.tabType]:a}))},children:a.label},a.id))})]})]}),i(A,{value:v.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:H?.map((a,p)=>e(F,{searchValue:o,product:a,shopNowLoadingProductId:l,badgeVariant:k,onSecondaryButton:()=>n?.(a),onPrimaryButton:()=>m?.(a)},(a.id||"")+p))}),b?e("div",{className:"mt-6 flex w-full justify-center",children:e(M,{})}):!w?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]}),e(A,{value:v.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:i("div",{children:[K?.map(a=>e(re,{blog:a,searchValue:o},a.id)),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!K?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,badgeVariant:k})]})]})}),i(A,{value:v.PAGES,className:"ipc_search_page_tabs_pages_content",children:[e("div",{children:W?.map((a,p)=>e(ne,{page:a,searchValue:o},(a.global_id||a.id)+p))}),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!W?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]})]})})]})};var he=de;export{he as default};
|
|
1
|
+
import{Fragment as I,jsx as e,jsxs as i}from"react/jsx-runtime";import{Heading as S,Tabs as q,TabsList as J,TabsTrigger as Q,TabsContent as A,Text as N,Picture as C,Link as X,Button as L,DropdownMenu as Y,DropdownMenuTrigger as Z,DropdownMenuContent as ee,DropdownMenuItem as te,LoadingDots as M,Badge as ae}from"../../components/index.js";import{DownArrow as se}from"../HeaderNavigation/icons/index.js";import{useMemo as u,useState as O}from"react";import{cn as _,atobID as ie,highlightSearchWord as T,replaceTemplate as le}from"../../helpers/utils.js";import{useAiuiContext as j}from"../AiuiProvider/index.js";import{formatVariantPrice as oe}from"../ShelfDisplay/shelfDisplay.js";import{SearchPageTabType as v}from"./types.js";import{getLocalizedPath as B}from"../../helpers/utils.js";const F=({product:t,onSecondaryButton:o,onPrimaryButton:s,searchValue:n,variantData:m,shopNowLoadingProductId:y,badgeVariant:b})=>{const l=u(()=>m||t?.variants?.[0],[t,m]),{locale:g="us",copyWriting:c,currencyCode:x}=j(),f=y===t?.id,D=u(()=>B(`/products/${t?.handle}?variant=${ie(l?.id)}?ref=search_result_${n?.toLowerCase()}`,g),[t?.handle,l?.id,n,g]),P=l?.coupons?.[0],{price:k,basePrice:r}=oe({locale:x==="CAD"?"us":g||"us",amount:P?P.variant_price4wscode:l?.price?.amount??l?.price,baseAmount:P?l?.price?.amount??l?.price:0,currencyCode:t?.price?.currencyCode||"USD"}),z=u(()=>t?.tags?.filter?.(d=>d?.startsWith?.("CLtag"))?.map?.(d=>d?.replace?.("CLtag:",""))?.slice?.(0,2),[t?.tags]);return e("div",{className:"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden",children:t?.type==="advertising"&&t?.advertisingLink?i(X,{href:B(t?.advertisingLink,g),className:"h-full",children:[e(C,{source:`${t?.advertisingBgImg}`,className:"size-full",imgClassName:"size-full object-cover"}),i("div",{className:"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500",children:[e(N,{html:t?.advertisingTitle,className:_("desktop:text-base text-sm font-bold leading-[1.2]",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})}),t?.advertisingSubtitle&&e(S,{size:3,html:t?.advertisingSubtitle,className:_("laptop:line-clamp-3 mt-2 line-clamp-4 font-bold",{"text-white":t?.advertisingTheme==="light","text-info-primary":t?.advertisingTheme==="dark"})})]})]}):i("a",{href:D,className:"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300",children:[e("div",{className:"ipc_search_product_item_image",children:e(C,{className:"lg-desktop:size-[196px] mx-auto size-[138px]",source:l?.image?.url||t?.images?.[0]?.url,alt:t?.title,imgClassName:"object-cover size-full"})}),i("div",{className:"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4",children:[i("div",{className:"flex-1",children:[e("div",{className:"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2",children:z?.map((d,E)=>e(ae,{size:"lg",variant:b,children:d},E))}),e(N,{className:"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]",weight:"bold",html:T(t?.title||"",n||"")}),e(N,{as:"p",className:"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold",html:T(t?.description,n||"")})]}),i("div",{children:[e("div",{className:"mb-2 flex items-center",children:l?.availableForSale?i(I,{children:[e("div",{className:"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:l?.availableForSale&&k||""}),e("div",{className:"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through",children:l?.availableForSale&&r||""})]}):e("div",{className:"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold",children:c?.soldOutText||"Sold Out"})}),i("div",{className:_("ipc_search_product_item_button_group","lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2"),children:[c?.learnMoreText&&e(L,{variant:"secondary",className:"laptop:w-auto w-full",size:"lg",onClick:d=>{d.preventDefault(),d.stopPropagation(),o?.()},children:c?.learnMoreText}),c?.shopNowText&&e(L,{variant:"primary",className:"laptop:w-auto w-full",size:"lg",disabled:!l?.availableForSale,loading:f,onClick:d=>{d.preventDefault(),d.stopPropagation(),s?.()},children:c?.shopNowText})]})]})]})]})})},re=({blog:t,searchValue:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/blogs/${t?.blog?.handle}/${t?.handle.replace("storefront-","")}`,n),[t,n]);return e("div",{className:"ipc_search_blog_item border-b border-[#E4E5E6] py-6",children:i("div",{className:"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4",children:[e("div",{className:"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden",children:e(C,{source:t?.image?.url,className:"size-full",imgClassName:"size-full object-cover",alt:t?.title})}),i("div",{className:"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center",children:[e(S,{size:3,html:T(t?.title,o)}),e(N,{html:T(t?.content,o),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]"}),e("div",{className:"desktop:mt-6 mt-4",children:e(L,{as:"a",href:m,variant:"secondary",size:"lg",children:s?.learnMoreText||"Learn More"})})]})]})})},ne=({searchValue:t,page:o})=>{const{copyWriting:s,locale:n="us"}=j(),m=u(()=>B(`/${o?.handle}`,n),[o,n]);return i("div",{className:"ipc_search_page_items border-b border-[#E4E5E6] py-6",children:[e(S,{size:3,html:T(o?.name,t)}),e(N,{as:"p",html:T(o?.bodySummary||"",t),className:"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]"}),e(L,{as:"a",href:m,variant:"secondary",size:"lg",className:"desktop:mt-6 mt-4",children:s?.learnMoreText||"Learn More"})]})},R=({url:t,label:o})=>i("div",{className:"flex flex-col items-center justify-center gap-4",children:[e(C,{source:t,className:"h-[180px] w-[240px]",imgClassName:"object-cover"}),e(N,{html:o,className:"desktop:text-[18px] text-sm font-bold leading-[1.4]"})]}),$=({products:t,title:o,buildProps:s,onSecondaryButton:n,onPrimaryButton:m,badgeVariant:y})=>{const{products:b}=s||{};return console.log(b,"buildProducts"),i("div",{className:"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]",children:[e(S,{size:4,weight:"bold",html:o}),e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4",children:t?.map((l,g)=>{const c=b?.find(f=>f.handle===l.handle);if(!c)return null;const x=c?.variants?.find(f=>f.sku===l.sku);return e(F,{product:c,variantData:x,badgeVariant:y,onSecondaryButton:()=>n?.(),onPrimaryButton:()=>m?.()},l.sku+g)})})]})},de=({searchResult:t,searchValue:o,data:s,onSecondaryButton:n,onPrimaryButton:m,onChangeSort:y,loading:b,shopNowLoadingProductId:l,searchResultCount:g,onChangeTab:c,buildProps:x,componentOverrides:f,className:D,...P})=>{const k=f?.badge?.variant,[r,z]=O(s?.tabs?.[0]),[d,E]=O(!1),[V,G]=O({[v.PRODUCTS]:s?.tabs?.find(a=>a.tabType===v.PRODUCTS)?.sortKeys?.[0],[v.BLOGS]:s?.tabs?.find(a=>a.tabType===v.BLOGS)?.sortKeys?.[0],[v.PAGES]:s?.tabs?.find(a=>a.tabType===v.PAGES)?.sortKeys?.[0]}),w=u(()=>t?.products||[],[t]),K=u(()=>t?.blogs||[],[t]),W=u(()=>t?.pages||[],[t]),U=u(()=>Object.values(g||{}).reduce((a,p)=>a+p,0),[g]),H=u(()=>{const a={advertisingBgImg:`${r?.advertisingBgImg?.url}, ${r?.advertisingMobBgImg?.url} 768`,advertisingTitle:r?.advertisingTitle,advertisingSubtitle:r?.advertisingSubtitle,advertisingLink:r?.advertisingLink,advertisingTheme:r?.advertisingTheme,type:"advertising"};if(!!r?.advertisingBgImg?.url||!!r?.advertisingTitle||!!r?.advertisingLink){const h=[...w||[]];return h.length>=8?h.splice(7,0,a):h.length>0&&h.push(a),h}else return w},[r,w]);return i("div",{...P,className:_("ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16",D),children:[e(S,{size:4,weight:"bold",html:le(s?.title,{totalCount:U?.toString(),inputValue:`"${o}"`})}),e("div",{className:"mt-6",children:i(q,{className:"ipc_search_page_tabs",defaultValue:"products",children:[i("div",{className:" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between",children:[e(J,{children:s?.tabs?.map(a=>i(Q,{onClick:()=>{z(a);const p=a?.sortKeys?.[0];p&&(G(h=>({...h,[a?.tabType]:p})),y?.(a?.tabType,p)),c?.(a?.tabType)},defaultValue:"products",value:a.tabType,children:[a.label," (",g?.[a.tabType],")"]},a.id))}),i(Y,{onOpenChange:E,children:[e(Z,{asChild:!0,children:i("button",{className:"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none",children:[r?.sortLabel," ",V?.[r?.tabType]?.label," ",e(se,{className:_("inline-block size-4",{"rotate-180":d})})]})}),e(ee,{align:"start",sideOffset:8,className:"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none",children:r?.sortKeys?.map(a=>e(te,{className:_("laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none",{"bg-[#EAEAEC]":V?.[r?.tabType]?.value===a.value}),onClick:()=>{y?.(r?.tabType,a),G(p=>({...p,[r?.tabType]:a}))},children:a.label},a.id))})]})]}),i(A,{value:v.PRODUCTS,className:"ipc_search_page_tabs_products_content mt-6",children:[e("div",{className:" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4",children:H?.map((a,p)=>e(F,{searchValue:o,product:a,shopNowLoadingProductId:l,badgeVariant:k,onSecondaryButton:()=>n?.(a),onPrimaryButton:()=>m?.(a)},(a.id||"")+p))}),b?e("div",{className:"mt-6 flex w-full justify-center",children:e(M,{})}):!w?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]}),e(A,{value:v.BLOGS,className:"ipc_search_page_tabs_blogs_content",children:i("div",{children:[K?.map(a=>e(re,{blog:a,searchValue:o},a.id)),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!K?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,badgeVariant:k})]})]})}),i(A,{value:v.PAGES,className:"ipc_search_page_tabs_pages_content",children:[e("div",{children:W?.map((a,p)=>e(ne,{page:a,searchValue:o},(a.global_id||a.id)+p))}),b?e("div",{className:"mt-6 flex justify-center",children:e(M,{})}):!W?.length&&i(I,{children:[e(R,{url:s?.noResultImage?.url,label:s?.noResultLabel}),e($,{products:s?.recommendProducts||[],buildProps:x,title:s?.recommendProductsTitle,shopNowLoadingProductId:l,badgeVariant:k})]})]})]})})]})};var fe=de;export{fe as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/SearchPage/index.tsx"],
|
|
4
|
-
"sourcesContent": ["import {\n Heading,\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n Text,\n Picture,\n Link,\n Button,\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n LoadingDots,\n Badge,\n} from '../../components/index.js'\nimport { DownArrow } from '../HeaderNavigation/icons/index.js'\nimport { useMemo, useState } from 'react'\nimport { cn, atobID, highlightSearchWord } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport type {\n SearchPageProps,\n SortKey,\n SearchProductItemProps,\n SearchBlogItemProps,\n SearchPageItemProps,\n SearchRecommendProductsProps,\n} from './types'\nimport { SearchPageTabType } from './types.js'\nimport { getLocalizedPath } from '../../helpers/utils.js'\nimport { replaceTemplate } from '../Listing/utils/textFormat.js'\n\n/**\n * \u641C\u7D22\u5546\u54C1\n */\nconst SearchProductItem = ({\n product,\n onSecondaryButton,\n onPrimaryButton,\n searchValue,\n variantData,\n shopNowLoadingProductId,\n badgeVariant,\n}: SearchProductItemProps & { badgeVariant?: 'outline' | 'fill' }) => {\n const variant = useMemo(() => variantData || product?.variants?.[0], [product, variantData])\n const { locale = 'us', copyWriting, currencyCode } = useAiuiContext()\n\n // \u5224\u65AD\u5F53\u524D\u4EA7\u54C1\u662F\u5426\u5728\u52A0\u8F7D\u4E2D\n const isCurrentProductLoading = shopNowLoadingProductId === product?.id\n\n const listingLink = useMemo(() => {\n return getLocalizedPath(\n `/products/${product?.handle}?variant=${atobID(variant?.id as string)}?ref=search_result_${searchValue?.toLowerCase()}`,\n locale\n )\n }, [product?.handle, variant?.id, searchValue, locale])\n\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n amount: coupon ? coupon.variant_price4wscode : (variant?.price?.amount ?? variant?.price),\n baseAmount: coupon ? (variant?.price?.amount ?? variant?.price) : 0,\n currencyCode: product?.price?.currencyCode || 'USD',\n })\n\n const tags = useMemo(() => {\n return product?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n }, [product?.tags])\n\n return (\n <div className=\"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden\">\n {product?.type === 'advertising' && product?.advertisingLink ? (\n <Link href={getLocalizedPath(product?.advertisingLink, locale)} className=\"h-full\">\n <Picture\n source={`${product?.advertisingBgImg}`}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n />\n <div className=\"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500\">\n <Text\n html={product?.advertisingTitle}\n className={cn('desktop:text-base text-sm font-bold leading-[1.2]', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n {product?.advertisingSubtitle && (\n <Heading\n size={3}\n html={product?.advertisingSubtitle}\n className={cn('laptop:line-clamp-3 mt-2 line-clamp-4 font-bold', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n )}\n </div>\n </Link>\n ) : (\n <a\n href={listingLink}\n className=\"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300\"\n >\n <div className=\"ipc_search_product_item_image\">\n <Picture\n className=\"lg-desktop:size-[196px] mx-auto size-[138px]\"\n source={variant?.image?.url || product?.images?.[0]?.url}\n alt={product?.title}\n imgClassName=\"object-cover size-full\"\n />\n </div>\n <div className=\"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4\">\n <div className=\"flex-1\">\n <div className=\"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2\">\n {tags?.map((tag: string, index: number) => (\n <Badge key={index} size=\"lg\" variant={badgeVariant}>\n {tag}\n </Badge>\n ))}\n </div>\n <Text\n className=\"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]\"\n weight=\"bold\"\n html={highlightSearchWord(product?.title || '', searchValue || '')}\n />\n <Text\n as=\"p\"\n className=\"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold\"\n html={highlightSearchWord(product?.description, searchValue || '')}\n />\n </div>\n <div>\n <div className=\"mb-2 flex items-center\">\n {!variant?.availableForSale ? (\n <div className=\"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {copyWriting?.soldOutText || 'Sold Out'}\n </div>\n ) : (\n <>\n <div className=\"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n <div\n className={cn(\n 'ipc_search_product_item_button_group',\n 'lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2'\n )}\n >\n {copyWriting?.learnMoreText && (\n <Button\n variant=\"secondary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onSecondaryButton?.()\n }}\n >\n {copyWriting?.learnMoreText}\n </Button>\n )}\n {copyWriting?.shopNowText && (\n <Button\n variant=\"primary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n disabled={!variant?.availableForSale}\n loading={isCurrentProductLoading}\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onPrimaryButton?.()\n }}\n >\n {copyWriting?.shopNowText}\n </Button>\n )}\n </div>\n </div>\n </div>\n </a>\n )}\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u6587\u7AE0\n */\nconst SearchBlogItem = ({ blog, searchValue }: SearchBlogItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n\n const articleLink = useMemo(\n () => getLocalizedPath(`/blogs/${blog?.blog?.handle}/${blog?.handle.replace('storefront-', '')}`, locale),\n [blog, locale]\n )\n\n return (\n <div className=\"ipc_search_blog_item border-b border-[#E4E5E6] py-6\">\n <div className=\"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4\">\n <div className=\"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden\">\n <Picture\n source={blog?.image?.url}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n alt={blog?.title}\n />\n </div>\n <div className=\"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center\">\n <Heading size={3} html={highlightSearchWord(blog?.title, searchValue)} />\n <Text\n html={highlightSearchWord(blog?.content, searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]\"\n />\n <div className=\"desktop:mt-6 mt-4\">\n <Button as=\"a\" href={articleLink} variant=\"secondary\" size=\"lg\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPageItem = ({ searchValue, page }: SearchPageItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n const pageLink = useMemo(() => getLocalizedPath(`/${page?.handle}`, locale), [page, locale])\n return (\n <div className=\"ipc_search_page_items border-b border-[#E4E5E6] py-6\">\n <Heading size={3} html={highlightSearchWord(page?.name, searchValue)} />\n <Text\n as=\"p\"\n html={highlightSearchWord(page?.bodySummary || '', searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]\"\n />\n <Button as=\"a\" href={pageLink} variant=\"secondary\" size=\"lg\" className=\"desktop:mt-6 mt-4\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u7ED3\u679C\u4E3A\u7A7A\n */\nconst SearchPageNoResult = ({ url, label }: { url: string; label: string }) => {\n return (\n <div className=\"flex flex-col items-center justify-center gap-4\">\n <Picture source={url} className=\"h-[180px] w-[240px]\" imgClassName=\"object-cover\" />\n <Text html={label} className=\"desktop:text-[18px] text-sm font-bold leading-[1.4]\" />\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u63A8\u8350\u5546\u54C1\n */\nconst SearchRecommendProducts = ({\n products,\n title,\n buildProps,\n onSecondaryButton,\n onPrimaryButton,\n badgeVariant,\n}: SearchRecommendProductsProps & { badgeVariant?: 'outline' | 'fill' }) => {\n const { products: buildProducts } = buildProps || {}\n console.log(buildProducts, 'buildProducts')\n return (\n <div className=\"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]\">\n <Heading size={4} weight=\"bold\" html={title} />\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4\">\n {products?.map((product: any, index: number) => {\n const buildProduct = buildProducts?.find((buildProduct: any) => buildProduct.handle === product.handle)\n if (!buildProduct) return null\n const variant = buildProduct?.variants?.find((variant: any) => variant.sku === product.sku)\n return (\n <SearchProductItem\n product={buildProduct}\n variantData={variant}\n key={product.sku + index}\n badgeVariant={badgeVariant}\n onSecondaryButton={() => onSecondaryButton?.()}\n onPrimaryButton={() => onPrimaryButton?.()}\n />\n )\n })}\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPage = ({\n searchResult,\n searchValue,\n data,\n onSecondaryButton,\n onPrimaryButton,\n // loadMore,\n onChangeSort,\n loading,\n shopNowLoadingProductId,\n searchResultCount,\n onChangeTab,\n buildProps,\n componentOverrides,\n className,\n ...rest\n}: SearchPageProps) => {\n const badgeVariant = componentOverrides?.badge?.variant\n const [currentTab, setCurrentTab] = useState<any>(data?.tabs?.[0])\n const [isOpenSort, setIsOpenSort] = useState(false)\n const [currentSortKey, setCurrentSortKey] = useState<any>({\n [SearchPageTabType.PRODUCTS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PRODUCTS)\n ?.sortKeys?.[0],\n [SearchPageTabType.BLOGS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.BLOGS)?.sortKeys?.[0],\n [SearchPageTabType.PAGES]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PAGES)?.sortKeys?.[0],\n })\n\n const searchProductsResult = useMemo(() => {\n return searchResult?.products || []\n }, [searchResult])\n\n const searchBlogsResult = useMemo(() => {\n return searchResult?.blogs || []\n }, [searchResult])\n\n const searchPagesResult = useMemo(() => {\n return searchResult?.pages || []\n }, [searchResult])\n\n const totalCount = useMemo(() => {\n return Object.values(searchResultCount || {}).reduce((acc, curr) => acc + curr, 0)\n }, [searchResultCount])\n\n const searchProductsResultWithAdvertising = useMemo(() => {\n const advertisingData = {\n advertisingBgImg: `${currentTab?.advertisingBgImg?.url}, ${currentTab?.advertisingMobBgImg?.url} 768`,\n advertisingTitle: currentTab?.advertisingTitle,\n advertisingSubtitle: currentTab?.advertisingSubtitle,\n advertisingLink: currentTab?.advertisingLink,\n advertisingTheme: currentTab?.advertisingTheme,\n type: 'advertising',\n }\n // \u5E7F\u544A\u4F4D\u6838\u5FC3\u5B57\u6BB5\u5168\u4E3A\u7A7A\u65F6\uFF0C\u4E0D\u63D2\u5165\u5E7F\u544A\u6570\u636E\n const hasAdvertisingData =\n !!currentTab?.advertisingBgImg?.url || !!currentTab?.advertisingTitle || !!currentTab?.advertisingLink\n\n if (hasAdvertisingData) {\n const result = [...(searchProductsResult || [])]\n if (result.length >= 8) {\n result.splice(7, 0, advertisingData)\n } else if (result.length > 0) {\n result.push(advertisingData)\n }\n return result\n } else {\n return searchProductsResult\n }\n }, [currentTab, searchProductsResult])\n\n return (\n <div\n {...rest}\n className={cn(\n 'ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16',\n className\n )}\n >\n <Heading\n size={4}\n weight=\"bold\"\n html={replaceTemplate(data?.title, {\n totalCount: totalCount?.toString(),\n inputValue: `\"${searchValue}\"`,\n })}\n />\n <div className=\"mt-6\">\n <Tabs className=\"ipc_search_page_tabs\" defaultValue=\"products\">\n <div className=\" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between\">\n <TabsList>\n {data?.tabs?.map((tab: any) => (\n <TabsTrigger\n onClick={() => {\n setCurrentTab(tab)\n // \u5207\u6362tab\u65F6\uFF0C\u91CD\u7F6E\u8BE5tab\u7684\u6392\u5E8F\u503C\u4E3A\u9ED8\u8BA4\u503C\uFF08\u7B2C\u4E00\u4E2AsortKey\uFF09\n const defaultSortKey = tab?.sortKeys?.[0]\n if (defaultSortKey) {\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [tab?.tabType]: defaultSortKey,\n }))\n onChangeSort?.(tab?.tabType, defaultSortKey)\n }\n onChangeTab?.(tab?.tabType)\n }}\n key={tab.id}\n defaultValue=\"products\"\n value={tab.tabType}\n >\n {tab.label} ({searchResultCount?.[tab.tabType as keyof typeof searchResultCount]})\n </TabsTrigger>\n ))}\n </TabsList>\n <DropdownMenu onOpenChange={setIsOpenSort}>\n <DropdownMenuTrigger asChild>\n <button className=\"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none\">\n {currentTab?.sortLabel} {currentSortKey?.[currentTab?.tabType]?.label}{' '}\n <DownArrow\n className={cn('inline-block size-4', {\n 'rotate-180': isOpenSort,\n })}\n />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align=\"start\"\n sideOffset={8}\n className=\"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none\"\n >\n {currentTab?.sortKeys?.map((sortKey: SortKey) => {\n return (\n <DropdownMenuItem\n className={cn(\n 'laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none',\n {\n 'bg-[#EAEAEC]': currentSortKey?.[currentTab?.tabType]?.value === sortKey.value,\n }\n )}\n onClick={() => {\n onChangeSort?.(currentTab?.tabType, sortKey)\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [currentTab?.tabType]: sortKey,\n }))\n }}\n key={sortKey.id}\n >\n {sortKey.label}\n </DropdownMenuItem>\n )\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n <TabsContent value={SearchPageTabType.PRODUCTS} className=\"ipc_search_page_tabs_products_content mt-6\">\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4\">\n {searchProductsResultWithAdvertising?.map((product: any, index: number) => (\n <SearchProductItem\n searchValue={searchValue}\n key={(product.id || '') + index}\n product={product}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n onSecondaryButton={() => onSecondaryButton?.(product)}\n onPrimaryButton={() => onPrimaryButton?.(product)}\n />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex w-full justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchProductsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </TabsContent>\n <TabsContent value={SearchPageTabType.BLOGS} className=\"ipc_search_page_tabs_blogs_content\">\n <div>\n {searchBlogsResult?.map((blog: any) => (\n <SearchBlogItem key={blog.id} blog={blog} searchValue={searchValue} />\n ))}\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchBlogsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </div>\n </TabsContent>\n <TabsContent value={SearchPageTabType.PAGES} className=\"ipc_search_page_tabs_pages_content\">\n <div>\n {searchPagesResult?.map((page: any, index: number) => (\n <SearchPageItem key={(page.global_id || page.id) + index} page={page} searchValue={searchValue} />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchPagesResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </TabsContent>\n </Tabs>\n </div>\n </div>\n )\n}\n\nexport default SearchPage\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "Heading", "Tabs", "TabsList", "TabsTrigger", "TabsContent", "Text", "Picture", "Link", "Button", "DropdownMenu", "DropdownMenuTrigger", "DropdownMenuContent", "DropdownMenuItem", "LoadingDots", "Badge", "DownArrow", "useMemo", "useState", "cn", "atobID", "highlightSearchWord", "useAiuiContext", "formatVariantPrice", "SearchPageTabType", "getLocalizedPath", "
|
|
4
|
+
"sourcesContent": ["import {\n Heading,\n Tabs,\n TabsList,\n TabsTrigger,\n TabsContent,\n Text,\n Picture,\n Link,\n Button,\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n LoadingDots,\n Badge,\n} from '../../components/index.js'\nimport { DownArrow } from '../HeaderNavigation/icons/index.js'\nimport { useMemo, useState } from 'react'\nimport { cn, atobID, highlightSearchWord, replaceTemplate } from '../../helpers/utils.js'\nimport { useAiuiContext } from '../AiuiProvider/index.js'\nimport { formatVariantPrice } from '../ShelfDisplay/shelfDisplay.js'\nimport type {\n SearchPageProps,\n SortKey,\n SearchProductItemProps,\n SearchBlogItemProps,\n SearchPageItemProps,\n SearchRecommendProductsProps,\n} from './types'\nimport { SearchPageTabType } from './types.js'\nimport { getLocalizedPath } from '../../helpers/utils.js'\n\n/**\n * \u641C\u7D22\u5546\u54C1\n */\nconst SearchProductItem = ({\n product,\n onSecondaryButton,\n onPrimaryButton,\n searchValue,\n variantData,\n shopNowLoadingProductId,\n badgeVariant,\n}: SearchProductItemProps & { badgeVariant?: 'outline' | 'fill' }) => {\n const variant = useMemo(() => variantData || product?.variants?.[0], [product, variantData])\n const { locale = 'us', copyWriting, currencyCode } = useAiuiContext()\n\n // \u5224\u65AD\u5F53\u524D\u4EA7\u54C1\u662F\u5426\u5728\u52A0\u8F7D\u4E2D\n const isCurrentProductLoading = shopNowLoadingProductId === product?.id\n\n const listingLink = useMemo(() => {\n return getLocalizedPath(\n `/products/${product?.handle}?variant=${atobID(variant?.id as string)}?ref=search_result_${searchValue?.toLowerCase()}`,\n locale\n )\n }, [product?.handle, variant?.id, searchValue, locale])\n\n const coupon = variant?.coupons?.[0]\n\n const { price, basePrice } = formatVariantPrice({\n locale: currencyCode === 'CAD' ? 'us' : locale || 'us',\n amount: coupon ? coupon.variant_price4wscode : (variant?.price?.amount ?? variant?.price),\n baseAmount: coupon ? (variant?.price?.amount ?? variant?.price) : 0,\n currencyCode: product?.price?.currencyCode || 'USD',\n })\n\n const tags = useMemo(() => {\n return product?.tags\n ?.filter?.((item: any) => item?.startsWith?.('CLtag'))\n ?.map?.((item: any) => item?.replace?.('CLtag:', ''))\n ?.slice?.(0, 2)\n }, [product?.tags])\n\n return (\n <div className=\"rounded-image-text ipc_search_product_item lg-desktop:h-[480px] desktop:h-[384px] laptop:h-[360px] relative h-auto overflow-hidden\">\n {product?.type === 'advertising' && product?.advertisingLink ? (\n <Link href={getLocalizedPath(product?.advertisingLink, locale)} className=\"h-full\">\n <Picture\n source={`${product?.advertisingBgImg}`}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n />\n <div className=\"desktop:p-6 absolute inset-0 z-[2] p-4 [&_img]:hover:scale-110 [&_img]:hover:transition-all [&_img]:hover:duration-500\">\n <Text\n html={product?.advertisingTitle}\n className={cn('desktop:text-base text-sm font-bold leading-[1.2]', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n {product?.advertisingSubtitle && (\n <Heading\n size={3}\n html={product?.advertisingSubtitle}\n className={cn('laptop:line-clamp-3 mt-2 line-clamp-4 font-bold', {\n 'text-white': product?.advertisingTheme === 'light',\n 'text-info-primary': product?.advertisingTheme === 'dark',\n })}\n />\n )}\n </div>\n </Link>\n ) : (\n <a\n href={listingLink}\n className=\"tablet:hover:bg-info-white desktop:p-6 desktop:pt-4 tablet:p-4 flex h-full flex-col bg-[#EAEAEC] px-2 py-4 no-underline duration-300\"\n >\n <div className=\"ipc_search_product_item_image\">\n <Picture\n className=\"lg-desktop:size-[196px] mx-auto size-[138px]\"\n source={variant?.image?.url || product?.images?.[0]?.url}\n alt={product?.title}\n imgClassName=\"object-cover size-full\"\n />\n </div>\n <div className=\"ipc_search_product_item_content desktop:mt-2 lg-desktop:mt-3 desktop:gap-6 mt-1 flex flex-1 flex-col justify-between gap-4\">\n <div className=\"flex-1\">\n <div className=\"lg-desktop:h-[28px] mb-2 flex h-[24px] gap-2\">\n {tags?.map((tag: string, index: number) => (\n <Badge key={index} size=\"lg\" variant={badgeVariant}>\n {tag}\n </Badge>\n ))}\n </div>\n <Text\n className=\"lg-desktop:text-2xl tablet:line-clamp-2 line-clamp-3 text-xl font-bold !leading-[1.2]\"\n weight=\"bold\"\n html={highlightSearchWord(product?.title || '', searchValue || '')}\n />\n <Text\n as=\"p\"\n className=\"lg-desktop:text-[18px] tablet:line-clamp-1 mt-1 line-clamp-2 text-sm font-bold\"\n html={highlightSearchWord(product?.description, searchValue || '')}\n />\n </div>\n <div>\n <div className=\"mb-2 flex items-center\">\n {!variant?.availableForSale ? (\n <div className=\"text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {copyWriting?.soldOutText || 'Sold Out'}\n </div>\n ) : (\n <>\n <div className=\"final-price text-info-primary tablet:text-xl lg-desktop:text-2xl text-[18px] font-bold\">\n {variant?.availableForSale ? price || '' : ''}\n </div>\n <div className=\"origin-price tablet:text-xl lg-desktop:text-2xl text-info-secondary ml-1 text-[18px] font-bold line-through\">\n {variant?.availableForSale ? basePrice || '' : ''}\n </div>\n </>\n )}\n </div>\n <div\n className={cn(\n 'ipc_search_product_item_button_group',\n 'lg-desktop:gap-3 laptop:flex-row flex flex-col items-center gap-2'\n )}\n >\n {copyWriting?.learnMoreText && (\n <Button\n variant=\"secondary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onSecondaryButton?.()\n }}\n >\n {copyWriting?.learnMoreText}\n </Button>\n )}\n {copyWriting?.shopNowText && (\n <Button\n variant=\"primary\"\n className=\"laptop:w-auto w-full\"\n size=\"lg\"\n disabled={!variant?.availableForSale}\n loading={isCurrentProductLoading}\n onClick={e => {\n e.preventDefault()\n e.stopPropagation()\n onPrimaryButton?.()\n }}\n >\n {copyWriting?.shopNowText}\n </Button>\n )}\n </div>\n </div>\n </div>\n </a>\n )}\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u6587\u7AE0\n */\nconst SearchBlogItem = ({ blog, searchValue }: SearchBlogItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n\n const articleLink = useMemo(\n () => getLocalizedPath(`/blogs/${blog?.blog?.handle}/${blog?.handle.replace('storefront-', '')}`, locale),\n [blog, locale]\n )\n\n return (\n <div className=\"ipc_search_blog_item border-b border-[#E4E5E6] py-6\">\n <div className=\"ipc_search_blog_item_content laptop:flex-row-reverse laptop:gap-8 desktop:gap-16 flex flex-col gap-4\">\n <div className=\"rounded-image-text laptop:flex-[440] desktop:flex-[540] desktop:h-[280px] h-[240px] overflow-hidden\">\n <Picture\n source={blog?.image?.url}\n className=\"size-full\"\n imgClassName=\"size-full object-cover\"\n alt={blog?.title}\n />\n </div>\n <div className=\"laptop:flex-[424] desktop:flex-[704] lg-desktop:flex-[1056] flex flex-col justify-center\">\n <Heading size={3} html={highlightSearchWord(blog?.title, searchValue)} />\n <Text\n html={highlightSearchWord(blog?.content, searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 line-clamp-2 text-sm font-bold leading-[1.4]\"\n />\n <div className=\"desktop:mt-6 mt-4\">\n <Button as=\"a\" href={articleLink} variant=\"secondary\" size=\"lg\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPageItem = ({ searchValue, page }: SearchPageItemProps) => {\n const { copyWriting, locale = 'us' } = useAiuiContext()\n const pageLink = useMemo(() => getLocalizedPath(`/${page?.handle}`, locale), [page, locale])\n return (\n <div className=\"ipc_search_page_items border-b border-[#E4E5E6] py-6\">\n <Heading size={3} html={highlightSearchWord(page?.name, searchValue)} />\n <Text\n as=\"p\"\n html={highlightSearchWord(page?.bodySummary || '', searchValue)}\n className=\"lg-desktop:text-[18px] desktop:text-[16px] mt-1 text-sm font-bold leading-[1.4]\"\n />\n <Button as=\"a\" href={pageLink} variant=\"secondary\" size=\"lg\" className=\"desktop:mt-6 mt-4\">\n {copyWriting?.learnMoreText || 'Learn More'}\n </Button>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u7ED3\u679C\u4E3A\u7A7A\n */\nconst SearchPageNoResult = ({ url, label }: { url: string; label: string }) => {\n return (\n <div className=\"flex flex-col items-center justify-center gap-4\">\n <Picture source={url} className=\"h-[180px] w-[240px]\" imgClassName=\"object-cover\" />\n <Text html={label} className=\"desktop:text-[18px] text-sm font-bold leading-[1.4]\" />\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u63A8\u8350\u5546\u54C1\n */\nconst SearchRecommendProducts = ({\n products,\n title,\n buildProps,\n onSecondaryButton,\n onPrimaryButton,\n badgeVariant,\n}: SearchRecommendProductsProps & { badgeVariant?: 'outline' | 'fill' }) => {\n const { products: buildProducts } = buildProps || {}\n console.log(buildProducts, 'buildProducts')\n return (\n <div className=\"ipc_search_recommend_product tablet:pt-[80px] laptop:pt-[96px] desktop:pt-[112px] lg-desktop:pt-[128px] pt-[64px]\">\n <Heading size={4} weight=\"bold\" html={title} />\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 mt-6 grid grid-cols-2 gap-x-3 gap-y-4\">\n {products?.map((product: any, index: number) => {\n const buildProduct = buildProducts?.find((buildProduct: any) => buildProduct.handle === product.handle)\n if (!buildProduct) return null\n const variant = buildProduct?.variants?.find((variant: any) => variant.sku === product.sku)\n return (\n <SearchProductItem\n product={buildProduct}\n variantData={variant}\n key={product.sku + index}\n badgeVariant={badgeVariant}\n onSecondaryButton={() => onSecondaryButton?.()}\n onPrimaryButton={() => onPrimaryButton?.()}\n />\n )\n })}\n </div>\n </div>\n )\n}\n\n/**\n * \u641C\u7D22\u9875\u9762\n */\nconst SearchPage = ({\n searchResult,\n searchValue,\n data,\n onSecondaryButton,\n onPrimaryButton,\n // loadMore,\n onChangeSort,\n loading,\n shopNowLoadingProductId,\n searchResultCount,\n onChangeTab,\n buildProps,\n componentOverrides,\n className,\n ...rest\n}: SearchPageProps) => {\n const badgeVariant = componentOverrides?.badge?.variant\n const [currentTab, setCurrentTab] = useState<any>(data?.tabs?.[0])\n const [isOpenSort, setIsOpenSort] = useState(false)\n const [currentSortKey, setCurrentSortKey] = useState<any>({\n [SearchPageTabType.PRODUCTS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PRODUCTS)\n ?.sortKeys?.[0],\n [SearchPageTabType.BLOGS]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.BLOGS)?.sortKeys?.[0],\n [SearchPageTabType.PAGES]: data?.tabs?.find((tab: any) => tab.tabType === SearchPageTabType.PAGES)?.sortKeys?.[0],\n })\n\n const searchProductsResult = useMemo(() => {\n return searchResult?.products || []\n }, [searchResult])\n\n const searchBlogsResult = useMemo(() => {\n return searchResult?.blogs || []\n }, [searchResult])\n\n const searchPagesResult = useMemo(() => {\n return searchResult?.pages || []\n }, [searchResult])\n\n const totalCount = useMemo(() => {\n return Object.values(searchResultCount || {}).reduce((acc, curr) => acc + curr, 0)\n }, [searchResultCount])\n\n const searchProductsResultWithAdvertising = useMemo(() => {\n const advertisingData = {\n advertisingBgImg: `${currentTab?.advertisingBgImg?.url}, ${currentTab?.advertisingMobBgImg?.url} 768`,\n advertisingTitle: currentTab?.advertisingTitle,\n advertisingSubtitle: currentTab?.advertisingSubtitle,\n advertisingLink: currentTab?.advertisingLink,\n advertisingTheme: currentTab?.advertisingTheme,\n type: 'advertising',\n }\n // \u5E7F\u544A\u4F4D\u6838\u5FC3\u5B57\u6BB5\u5168\u4E3A\u7A7A\u65F6\uFF0C\u4E0D\u63D2\u5165\u5E7F\u544A\u6570\u636E\n const hasAdvertisingData =\n !!currentTab?.advertisingBgImg?.url || !!currentTab?.advertisingTitle || !!currentTab?.advertisingLink\n\n if (hasAdvertisingData) {\n const result = [...(searchProductsResult || [])]\n if (result.length >= 8) {\n result.splice(7, 0, advertisingData)\n } else if (result.length > 0) {\n result.push(advertisingData)\n }\n return result\n } else {\n return searchProductsResult\n }\n }, [currentTab, searchProductsResult])\n\n return (\n <div\n {...rest}\n className={cn(\n 'ipc_search_page desktop:py-[128px] tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] px-4 py-16',\n className\n )}\n >\n <Heading\n size={4}\n weight=\"bold\"\n html={replaceTemplate(data?.title, {\n totalCount: totalCount?.toString(),\n inputValue: `\"${searchValue}\"`,\n })}\n />\n <div className=\"mt-6\">\n <Tabs className=\"ipc_search_page_tabs\" defaultValue=\"products\">\n <div className=\" desktop:flex desktop:items-center desktop:flex-row desktop:gap-6 desktop:justify-between\">\n <TabsList>\n {data?.tabs?.map((tab: any) => (\n <TabsTrigger\n onClick={() => {\n setCurrentTab(tab)\n // \u5207\u6362tab\u65F6\uFF0C\u91CD\u7F6E\u8BE5tab\u7684\u6392\u5E8F\u503C\u4E3A\u9ED8\u8BA4\u503C\uFF08\u7B2C\u4E00\u4E2AsortKey\uFF09\n const defaultSortKey = tab?.sortKeys?.[0]\n if (defaultSortKey) {\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [tab?.tabType]: defaultSortKey,\n }))\n onChangeSort?.(tab?.tabType, defaultSortKey)\n }\n onChangeTab?.(tab?.tabType)\n }}\n key={tab.id}\n defaultValue=\"products\"\n value={tab.tabType}\n >\n {tab.label} ({searchResultCount?.[tab.tabType as keyof typeof searchResultCount]})\n </TabsTrigger>\n ))}\n </TabsList>\n <DropdownMenu onOpenChange={setIsOpenSort}>\n <DropdownMenuTrigger asChild>\n <button className=\"desktop:mt-0 mt-6 flex items-center text-base font-bold leading-[1.2] focus-visible:!outline-none\">\n {currentTab?.sortLabel} {currentSortKey?.[currentTab?.tabType]?.label}{' '}\n <DownArrow\n className={cn('inline-block size-4', {\n 'rotate-180': isOpenSort,\n })}\n />\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align=\"start\"\n sideOffset={8}\n className=\"rounded-sidebar-shelf bg-white !px-0 py-2 focus-visible:!outline-none\"\n >\n {currentTab?.sortKeys?.map((sortKey: SortKey) => {\n return (\n <DropdownMenuItem\n className={cn(\n 'laptop:px-4 laptop:text-base px-3 py-4 text-sm font-bold hover:bg-[#EAEAEC] hover:text-current hover:!outline-none',\n {\n 'bg-[#EAEAEC]': currentSortKey?.[currentTab?.tabType]?.value === sortKey.value,\n }\n )}\n onClick={() => {\n onChangeSort?.(currentTab?.tabType, sortKey)\n setCurrentSortKey((prev: any) => ({\n ...prev,\n [currentTab?.tabType]: sortKey,\n }))\n }}\n key={sortKey.id}\n >\n {sortKey.label}\n </DropdownMenuItem>\n )\n })}\n </DropdownMenuContent>\n </DropdownMenu>\n </div>\n <TabsContent value={SearchPageTabType.PRODUCTS} className=\"ipc_search_page_tabs_products_content mt-6\">\n <div className=\" tablet:grid-cols-3 desktop:grid-cols-4 desktop:gap-4 grid grid-cols-2 gap-x-3 gap-y-4\">\n {searchProductsResultWithAdvertising?.map((product: any, index: number) => (\n <SearchProductItem\n searchValue={searchValue}\n key={(product.id || '') + index}\n product={product}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n onSecondaryButton={() => onSecondaryButton?.(product)}\n onPrimaryButton={() => onPrimaryButton?.(product)}\n />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex w-full justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchProductsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </TabsContent>\n <TabsContent value={SearchPageTabType.BLOGS} className=\"ipc_search_page_tabs_blogs_content\">\n <div>\n {searchBlogsResult?.map((blog: any) => (\n <SearchBlogItem key={blog.id} blog={blog} searchValue={searchValue} />\n ))}\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchBlogsResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </div>\n </TabsContent>\n <TabsContent value={SearchPageTabType.PAGES} className=\"ipc_search_page_tabs_pages_content\">\n <div>\n {searchPagesResult?.map((page: any, index: number) => (\n <SearchPageItem key={(page.global_id || page.id) + index} page={page} searchValue={searchValue} />\n ))}\n </div>\n {loading ? (\n <div className=\"mt-6 flex justify-center\">\n <LoadingDots />\n </div>\n ) : (\n !searchPagesResult?.length && (\n <>\n <SearchPageNoResult url={data?.noResultImage?.url} label={data?.noResultLabel} />\n <SearchRecommendProducts\n products={data?.recommendProducts || []}\n buildProps={buildProps}\n title={data?.recommendProductsTitle}\n shopNowLoadingProductId={shopNowLoadingProductId}\n badgeVariant={badgeVariant}\n />\n </>\n )\n )}\n </TabsContent>\n </Tabs>\n </div>\n </div>\n )\n}\n\nexport default SearchPage\n"],
|
|
5
|
+
"mappings": "AA8EU,OAiEQ,YAAAA,EAjER,OAAAC,EAKA,QAAAC,MALA,oBA9EV,OACE,WAAAC,EACA,QAAAC,EACA,YAAAC,EACA,eAAAC,EACA,eAAAC,EACA,QAAAC,EACA,WAAAC,EACA,QAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,uBAAAC,EACA,uBAAAC,GACA,oBAAAC,GACA,eAAAC,EACA,SAAAC,OACK,4BACP,OAAS,aAAAC,OAAiB,qCAC1B,OAAS,WAAAC,EAAS,YAAAC,MAAgB,QAClC,OAAS,MAAAC,EAAI,UAAAC,GAAQ,uBAAAC,EAAqB,mBAAAC,OAAuB,yBACjE,OAAS,kBAAAC,MAAsB,2BAC/B,OAAS,sBAAAC,OAA0B,kCASnC,OAAS,qBAAAC,MAAyB,aAClC,OAAS,oBAAAC,MAAwB,yBAKjC,MAAMC,EAAoB,CAAC,CACzB,QAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,YAAAC,EACA,YAAAC,EACA,wBAAAC,EACA,aAAAC,CACF,IAAsE,CACpE,MAAMC,EAAUlB,EAAQ,IAAMe,GAAeJ,GAAS,WAAW,CAAC,EAAG,CAACA,EAASI,CA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AAOK,GAAM,uBACb,wBAAyBjC,EACzB,aAAcC,EAChB,GACF,GAGN,GACF,EACF,GACF,CAEJ,EAEA,IAAO2D,GAAQ7B",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "Heading", "Tabs", "TabsList", "TabsTrigger", "TabsContent", "Text", "Picture", "Link", "Button", "DropdownMenu", "DropdownMenuTrigger", "DropdownMenuContent", "DropdownMenuItem", "LoadingDots", "Badge", "DownArrow", "useMemo", "useState", "cn", "atobID", "highlightSearchWord", "replaceTemplate", "useAiuiContext", "formatVariantPrice", "SearchPageTabType", "getLocalizedPath", "SearchProductItem", "product", "onSecondaryButton", "onPrimaryButton", "searchValue", "variantData", "shopNowLoadingProductId", "badgeVariant", "variant", "locale", "copyWriting", "currencyCode", "isCurrentProductLoading", "listingLink", "coupon", "price", "basePrice", "tags", "item", "tag", "index", "e", "SearchBlogItem", "blog", "articleLink", "SearchPageItem", "page", "pageLink", "SearchPageNoResult", "url", "label", "SearchRecommendProducts", "products", "title", "buildProps", "buildProducts", "buildProduct", "SearchPage", "searchResult", "data", "onChangeSort", "loading", "searchResultCount", "onChangeTab", "componentOverrides", "className", "rest", "currentTab", "setCurrentTab", "isOpenSort", "setIsOpenSort", "currentSortKey", "setCurrentSortKey", "tab", "searchProductsResult", "searchBlogsResult", "searchPagesResult", "totalCount", "acc", "curr", "searchProductsResultWithAdvertising", "advertisingData", "result", "defaultSortKey", "prev", "sortKey", "SearchPage_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as n}from"react/jsx-runtime";import*as o from"react";import{cn as m}from"../helpers/index.js";import*as r from"@radix-ui/react-tabs";import{cva as b}from"class-variance-authority";function g(t){return t.trim().replace(/\s+/g,"-")}const u=o.createContext({align:"left",shape:"square"}),h=o.forwardRef(({children:t,align:a="left",shape:s="default",...e},i)=>n(r.Root,{ref:i,...e,children:n(u.Provider,{value:{align:a,shape:s},children:t})}));h.displayName="Tabs";const w=b("rounded-tabs",{variants:{shape:{default:"",rounded:"rounded-[28px]",square:"rounded-none"}},defaultVariants:{shape:"default"}}),L=b("rounded-tabs",{variants:{shape:{default:"",rounded:"rounded-[28px]",square:"rounded-none"}},defaultVariants:{shape:"default"}}),T=o.forwardRef(({className:t,...a},s)=>{const{align:e,shape:i}=o.useContext(u),l=e==="center"?"flex w-full justify-center":e==="right"?"flex w-full justify-end":null,p=n(r.List,{ref:s,className:m("bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1",w({shape:i}),t),style:{scrollbarWidth:"none",msOverflowStyle:"none"},...a});return l?n("div",{className:l,children:p}):p});T.displayName=r.List.displayName;const v=o.forwardRef(({className:t,onClick:a,value:s,...e},i)=>{const{shape:l}=o.useContext(u),p=f=>{a?.(f);const d=f?.currentTarget,c=f?.currentTarget?.parentElement;if(d&&c){const y=d.offsetLeft,x=d.offsetWidth,P=c.offsetWidth,C=y-P/2+x/2;c.scrollTo({left:C,behavior:"smooth"})}};return n(r.Trigger,{ref:i,className:m("text-info-primary lg-desktop:text-base disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-5 pb-2.5 pt-[11px] text-sm font-bold data-[state=active]:bg-white data-[state=active]:text-[#080A0F]",t,L({shape:l})),onClick:p,value:g(s),...e})});v.displayName=r.Trigger.displayName;const R=o.forwardRef(({className:t,value:a,...s},e)=>n(r.Content,{ref:e,className:m(t),value:g(a),...s}));R.displayName=r.Content.displayName;export{h as Tabs,R as TabsContent,T as TabsList,v as TabsTrigger};
|
|
2
2
|
//# sourceMappingURL=tabs.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/tabs.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\n\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport { cva } from 'class-variance-authority'\nimport type { Align, Shape } from '../types/props.js'\n\ntype tabShape = Shape | 'default'\n\nconst TabListContext = React.createContext<{\n align?: Align\n shape: tabShape\n}>({\n align: 'left',\n shape: 'square',\n})\n\nconst Tabs = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {\n align?: Align\n shape?: tabShape\n }\n>(({ children, align = 'left', shape = 'default', ...props }, ref) => (\n <TabsPrimitive.Root ref={ref} {...props}>\n <TabListContext.Provider value={{ align, shape }}>{children}</TabListContext.Provider>\n </TabsPrimitive.Root>\n))\nTabs.displayName = 'Tabs'\n\nconst tabsListVariants = cva('rounded-tabs', {\n variants: {\n shape: {\n default: '',\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'default',\n },\n})\n\nconst tabsTriggerVariants = cva('rounded-tabs', {\n variants: {\n shape: {\n default: '',\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'default',\n },\n})\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => {\n const { align: alignFromParent, shape: shapeFromParent } = React.useContext(TabListContext)\n\n const wrapperClass =\n alignFromParent === 'center'\n ? 'flex w-full justify-center'\n : alignFromParent === 'right'\n ? 'flex w-full justify-end'\n : null\n\n const list = (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n 'bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1',\n tabsListVariants({ shape: shapeFromParent }),\n className\n )}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n {...props}\n />\n )\n\n return wrapperClass ? <div className={wrapperClass}>{list}</div> : list\n})\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, onClick, ...props }, ref) => {\n const { shape: shapeFromParent } = React.useContext(TabListContext)\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(e)\n const tabElement = e?.currentTarget\n const container = e?.currentTarget?.parentElement\n if (tabElement && container) {\n const tabLeft = tabElement.offsetLeft\n const tabWidth = tabElement.offsetWidth\n const containerWidth = container.offsetWidth\n const scrollTo = tabLeft - containerWidth / 2 + tabWidth / 2\n container.scrollTo({\n left: scrollTo,\n behavior: 'smooth',\n })\n }\n }\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n 'text-info-primary lg-desktop:text-base disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-5 pb-2.5 pt-[11px] text-sm font-bold data-[state=active]:bg-white data-[state=active]:text-[#080A0F]',\n className,\n tabsTriggerVariants({\n shape: shapeFromParent,\n })\n )}\n onClick={handleClick}\n {...props}\n />\n )\n})\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, ...props }, ref) => <TabsPrimitive.Content ref={ref} className={cn(className)} {...props}
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "React", "cn", "TabsPrimitive", "cva", "TabListContext", "Tabs", "children", "align", "shape", "props", "ref", "tabsListVariants", "tabsTriggerVariants", "TabsList", "className", "alignFromParent", "shapeFromParent", "wrapperClass", "list", "TabsTrigger", "onClick", "handleClick", "e", "tabElement", "container", "tabLeft", "tabWidth", "containerWidth", "scrollTo", "TabsContent"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../helpers/index.js'\n\nimport * as TabsPrimitive from '@radix-ui/react-tabs'\nimport { cva } from 'class-variance-authority'\nimport type { Align, Shape } from '../types/props.js'\n\ntype tabShape = Shape | 'default'\n\n/**\n * Sanitize a tab value so it is safe to use as part of an HTML id attribute.\n *\n * HTML ids must not contain whitespace characters. Radix UI uses the value\n * directly in generated ids (e.g. `radix-:r0:-trigger-{value}`), so an\n * unsanitized value like \"best seller\" would produce an invalid id.\n *\n * This function replaces any sequence of whitespace with a single hyphen and\n * trims leading/trailing whitespace, leaving all other characters intact.\n */\nfunction sanitizeTabValue(value: string): string {\n return value.trim().replace(/\\s+/g, '-')\n}\n\nconst TabListContext = React.createContext<{\n align?: Align\n shape: tabShape\n}>({\n align: 'left',\n shape: 'square',\n})\n\nconst Tabs = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Root>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Root> & {\n align?: Align\n shape?: tabShape\n }\n>(({ children, align = 'left', shape = 'default', ...props }, ref) => (\n <TabsPrimitive.Root ref={ref} {...props}>\n <TabListContext.Provider value={{ align, shape }}>{children}</TabListContext.Provider>\n </TabsPrimitive.Root>\n))\nTabs.displayName = 'Tabs'\n\nconst tabsListVariants = cva('rounded-tabs', {\n variants: {\n shape: {\n default: '',\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'default',\n },\n})\n\nconst tabsTriggerVariants = cva('rounded-tabs', {\n variants: {\n shape: {\n default: '',\n rounded: 'rounded-[28px]',\n square: 'rounded-none',\n },\n },\n defaultVariants: {\n shape: 'default',\n },\n})\nconst TabsList = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.List>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.List>\n>(({ className, ...props }, ref) => {\n const { align: alignFromParent, shape: shapeFromParent } = React.useContext(TabListContext)\n\n const wrapperClass =\n alignFromParent === 'center'\n ? 'flex w-full justify-center'\n : alignFromParent === 'right'\n ? 'flex w-full justify-end'\n : null\n\n const list = (\n <TabsPrimitive.List\n ref={ref}\n className={cn(\n 'bg-tabs-list-bg flex w-fit max-w-full overflow-x-auto p-1',\n tabsListVariants({ shape: shapeFromParent }),\n className\n )}\n style={{\n scrollbarWidth: 'none',\n msOverflowStyle: 'none',\n }}\n {...props}\n />\n )\n\n return wrapperClass ? <div className={wrapperClass}>{list}</div> : list\n})\nTabsList.displayName = TabsPrimitive.List.displayName\n\nconst TabsTrigger = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Trigger>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Trigger>\n>(({ className, onClick, value, ...props }, ref) => {\n const { shape: shapeFromParent } = React.useContext(TabListContext)\n const handleClick = (e: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(e)\n const tabElement = e?.currentTarget\n const container = e?.currentTarget?.parentElement\n if (tabElement && container) {\n const tabLeft = tabElement.offsetLeft\n const tabWidth = tabElement.offsetWidth\n const containerWidth = container.offsetWidth\n const scrollTo = tabLeft - containerWidth / 2 + tabWidth / 2\n container.scrollTo({\n left: scrollTo,\n behavior: 'smooth',\n })\n }\n }\n return (\n <TabsPrimitive.Trigger\n ref={ref}\n className={cn(\n 'text-info-primary lg-desktop:text-base disabled:text-btn-secondary-disabled lg-desktop:px-[28px] lg-desktop:pt-[15px] lg-desktop:pb-[14px] shrink-0 px-5 pb-2.5 pt-[11px] text-sm font-bold data-[state=active]:bg-white data-[state=active]:text-[#080A0F]',\n className,\n tabsTriggerVariants({\n shape: shapeFromParent,\n })\n )}\n onClick={handleClick}\n value={sanitizeTabValue(value)}\n {...props}\n />\n )\n})\nTabsTrigger.displayName = TabsPrimitive.Trigger.displayName\n\nconst TabsContent = React.forwardRef<\n React.ElementRef<typeof TabsPrimitive.Content>,\n React.ComponentPropsWithoutRef<typeof TabsPrimitive.Content>\n>(({ className, value, ...props }, ref) => (\n <TabsPrimitive.Content ref={ref} className={cn(className)} value={sanitizeTabValue(value)} {...props} />\n))\nTabsContent.displayName = TabsPrimitive.Content.displayName\n\nexport { Tabs, TabsList, TabsTrigger, T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,OAChB,gBAAiB,MACnB,EACC,GAAGL,EACN,EAGF,OAAOQ,EAAepB,EAAC,OAAI,UAAWoB,EAAe,SAAAC,EAAK,EAASA,CACrE,CAAC,EACDL,EAAS,YAAcb,EAAc,KAAK,YAE1C,MAAMmB,EAAcrB,EAAM,WAGxB,CAAC,CAAE,UAAAgB,EAAW,QAAAM,EAAS,MAAAjB,EAAO,GAAGM,CAAM,EAAGC,IAAQ,CAClD,KAAM,CAAE,MAAOM,CAAgB,EAAIlB,EAAM,WAAWM,CAAc,EAC5DiB,EAAeC,GAA2C,CAC9DF,IAAUE,CAAC,EACX,MAAMC,EAAaD,GAAG,cAChBE,EAAYF,GAAG,eAAe,cACpC,GAAIC,GAAcC,EAAW,CAC3B,MAAMC,EAAUF,EAAW,WACrBG,EAAWH,EAAW,YACtBI,EAAiBH,EAAU,YAC3BI,EAAWH,EAAUE,EAAiB,EAAID,EAAW,EAC3DF,EAAU,SAAS,CACjB,KAAMI,EACN,SAAU,QACZ,CAAC,CACH,CACF,EACA,OACE/B,EAACG,EAAc,QAAd,CACC,IAAKU,EACL,UAAWX,EACT,8PACAe,EACAF,EAAoB,CAClB,MAAOI,CACT,CAAC,CACH,EACA,QAASK,EACT,MAAOnB,EAAiBC,CAAK,EAC5B,GAAGM,EACN,CAEJ,CAAC,EACDU,EAAY,YAAcnB,EAAc,QAAQ,YAEhD,MAAM6B,EAAc/B,EAAM,WAGxB,CAAC,CAAE,UAAAgB,EAAW,MAAAX,EAAO,GAAGM,CAAM,EAAGC,IACjCb,EAACG,EAAc,QAAd,CAAsB,IAAKU,EAAK,UAAWX,EAAGe,CAAS,EAAG,MAAOZ,EAAiBC,CAAK,EAAI,GAAGM,EAAO,CACvG,EACDoB,EAAY,YAAc7B,EAAc,QAAQ",
|
|
6
|
+
"names": ["jsx", "React", "cn", "TabsPrimitive", "cva", "sanitizeTabValue", "value", "TabListContext", "Tabs", "children", "align", "shape", "props", "ref", "tabsListVariants", "tabsTriggerVariants", "TabsList", "className", "alignFromParent", "shapeFromParent", "wrapperClass", "list", "TabsTrigger", "onClick", "handleClick", "e", "tabElement", "container", "tabLeft", "tabWidth", "containerWidth", "scrollTo", "TabsContent"]
|
|
7
7
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { cn, getLocalizedPath } from './utils.js';
|
|
1
|
+
export { cn, getLocalizedPath, replaceTemplate } from './utils.js';
|
|
2
2
|
export { noop } from './utils.js';
|
|
3
3
|
export { formatPrice, languageTerritory, PRICE_SYMBOL, extendLocaleMap } from './priceFormatting.js';
|
|
4
4
|
export { isLexicalEmpty } from './isLexicalEmpty.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{cn as r,getLocalizedPath as t}from"./utils.js";import{noop as
|
|
1
|
+
import{cn as r,getLocalizedPath as t,replaceTemplate as a}from"./utils.js";import{noop as m}from"./utils.js";import{formatPrice as l,languageTerritory as x,PRICE_SYMBOL as f,extendLocaleMap as i}from"./priceFormatting.js";import{isLexicalEmpty as L}from"./isLexicalEmpty.js";export{f as PRICE_SYMBOL,r as cn,i as extendLocaleMap,l as formatPrice,t as getLocalizedPath,L as isLexicalEmpty,x as languageTerritory,m as noop,a as replaceTemplate};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { cn, getLocalizedPath } from './utils.js'\nexport { noop } from './utils.js'\nexport { formatPrice, languageTerritory, PRICE_SYMBOL, extendLocaleMap } from './priceFormatting.js'\nexport { isLexicalEmpty } from './isLexicalEmpty.js'\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,MAAAA,EAAI,oBAAAC,
|
|
6
|
-
"names": ["cn", "getLocalizedPath", "noop", "formatPrice", "languageTerritory", "PRICE_SYMBOL", "extendLocaleMap", "isLexicalEmpty"]
|
|
4
|
+
"sourcesContent": ["export { cn, getLocalizedPath, replaceTemplate } from './utils.js'\nexport { noop } from './utils.js'\nexport { formatPrice, languageTerritory, PRICE_SYMBOL, extendLocaleMap } from './priceFormatting.js'\nexport { isLexicalEmpty } from './isLexicalEmpty.js'\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,MAAAA,EAAI,oBAAAC,EAAkB,mBAAAC,MAAuB,aACtD,OAAS,QAAAC,MAAY,aACrB,OAAS,eAAAC,EAAa,qBAAAC,EAAmB,gBAAAC,EAAc,mBAAAC,MAAuB,uBAC9E,OAAS,kBAAAC,MAAsB",
|
|
6
|
+
"names": ["cn", "getLocalizedPath", "replaceTemplate", "noop", "formatPrice", "languageTerritory", "PRICE_SYMBOL", "extendLocaleMap", "isLexicalEmpty"]
|
|
7
7
|
}
|
|
@@ -3,6 +3,23 @@ export declare function cn(...inputs: ClassValue[]): string;
|
|
|
3
3
|
export declare function noop(): any;
|
|
4
4
|
export declare function atobID(id: string): string | undefined;
|
|
5
5
|
export declare const spaceToHyphen: (str: string) => string;
|
|
6
|
+
/**
|
|
7
|
+
* 字符串模板替换 - 将模板中的 {key} 占位符替换为对应值
|
|
8
|
+
*
|
|
9
|
+
* @param template - 模板字符串(如 "共 {total} 条结果")
|
|
10
|
+
* @param replacements - 替换键值对(如 { total: "5" })
|
|
11
|
+
* @param beginSeg - 占位符开始符号,默认 "{",支持自定义如 "{{"、"${"
|
|
12
|
+
* @param endSeg - 占位符结束符号,默认 "}",支持自定义如 "}}"、空字符串
|
|
13
|
+
* @returns 替换后的字符串
|
|
14
|
+
*
|
|
15
|
+
* @example
|
|
16
|
+
* replaceTemplate("Hello {name}!", { name: "World" })
|
|
17
|
+
* // => "Hello World!"
|
|
18
|
+
*
|
|
19
|
+
* replaceTemplate("共 {total} 条,搜索 {keyword}", { total: "5", keyword: "test" })
|
|
20
|
+
* // => "共 5 条,搜索 test"
|
|
21
|
+
*/
|
|
22
|
+
export declare const replaceTemplate: (template: string, replacements: Record<string, string>, beginSeg?: string, endSeg?: string) => string;
|
|
6
23
|
/**
|
|
7
24
|
* 高亮搜索关键词
|
|
8
25
|
* @param text 原始文本
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{clsx as
|
|
1
|
+
import{clsx as u}from"clsx";import{extendTailwindMerge as f}from"tailwind-merge";const l=f({extend:{theme:{borderRadius:["btn"]},classGroups:{"font-size":["text-heading-1","text-heading-2","text-heading-3","text-heading-4","text-heading-5","text-text-3","text-text-2","text-text-1"],"text-color":["text-info-primary","text-info-secondary","text-info-tertiary","text-info-quaternary","text-info-white"],leading:["leading-tight","leading-normal","leading-loose"]}}});function d(...t){return l(u(t))}function a(){}function b(t){return t&&typeof t=="string"&&t.includes("/")?t.split("/").pop()?.split("?")?.shift():t}const y=t=>t?.replace(/\s+/g,"-"),g=t=>t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),p=(t,r,e="{",n="}")=>{if(!t||!r||Object.keys(r).length===0)return t;const s=g(e),o=g(n),i=new RegExp(`${s}([a-zA-Z0-9_-]+)${o}`,"g");return t.replace(i,(x,c)=>r[c]!==void 0?r[c]:x)},w=(t,r)=>{try{if(!t||!r)return t;const e=g(r),n=new RegExp(e,"gi");return t.replace(n,s=>`<span class='text-brand-0 font-bold'>${s}</span>`)}catch(e){return console.error("highlightSearchWord error:",e),t}},R=(t,r,e)=>{if(!t)return t;if(t.startsWith("http://")||t.startsWith("https://")||t.startsWith("#"))return e?t.includes("?")?`${t}&${e}`:`${t}?${e}`:t;const n=t.split("/").filter(Boolean);if(n.length===0){const i=r==="us"?"/":`/${r}`;return e?`${i}?${e}`:i}if(n[0]===r){const i=`/${n.join("/")}`;return e?`${i}?${e}`:i}const o=`${r==="us"?"":`/${r}`}/${n.join("/")}`;return e?`${o}?${e}`:o};export{b as atobID,d as cn,R as getLocalizedPath,w as highlightSearchWord,a as noop,p as replaceTemplate,y as spaceToHyphen};
|
|
2
2
|
//# sourceMappingURL=utils.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/helpers/utils.ts"],
|
|
4
|
-
"sourcesContent": ["import { clsx, type ClassValue } from 'clsx'\nimport { extendTailwindMerge } from 'tailwind-merge'\n\nconst twMerge = extendTailwindMerge({\n extend: {\n theme: {\n borderRadius: ['btn'],\n },\n classGroups: {\n 'font-size': [\n 'text-heading-1',\n 'text-heading-2',\n 'text-heading-3',\n 'text-heading-4',\n 'text-heading-5',\n 'text-text-3',\n 'text-text-2',\n 'text-text-1',\n ],\n 'text-color': [\n 'text-info-primary',\n 'text-info-secondary',\n 'text-info-tertiary',\n 'text-info-quaternary',\n 'text-info-white',\n ],\n leading: ['leading-tight', 'leading-normal', 'leading-loose'],\n },\n },\n})\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function noop(): any {}\n\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\nexport const spaceToHyphen = (str: string) => str?.replace(/\\s+/g, '-')\n\n/**\n * \u8F6C\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n * @param str \u9700\u8981\u8F6C\u4E49\u7684\u5B57\u7B26\u4E32\n * @returns \u8F6C\u4E49\u540E\u7684\u5B57\u7B26\u4E32\n */\nconst escapeRegExp = (str: string): string => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * \u9AD8\u4EAE\u641C\u7D22\u5173\u952E\u8BCD\n * @param text \u539F\u59CB\u6587\u672C\n * @param searchText \u641C\u7D22\u5173\u952E\u8BCD\n * @returns \u9AD8\u4EAE\u540E\u7684 HTML \u5B57\u7B26\u4E32\n */\nexport const highlightSearchWord = (text: string, searchText: string) => {\n try {\n if (!text || !searchText) {\n return text\n }\n\n // \u8F6C\u4E49\u641C\u7D22\u6587\u672C\u4E2D\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n const escapedSearchText = escapeRegExp(searchText)\n const regex = new RegExp(escapedSearchText, 'gi')\n\n // \u4F7F\u7528\u6B63\u5219\u8868\u8FBE\u5F0F\u7684\u5339\u914D\u7ED3\u679C\u6765\u4FDD\u6301\u539F\u59CB\u5927\u5C0F\u5199\n return text.replace(regex, match => `<span class='text-brand-0 font-bold'>${match}</span>`)\n } catch (e) {\n console.error('highlightSearchWord error:', e)\n return text\n }\n}\n\n/**\n * \u83B7\u53D6\u672C\u5730\u5316\u8DEF\u5F84\n *\n * \u6839\u636E\u8BED\u8A00\u6807\u8BC6\u4E3A\u8DEF\u5F84\u6DFB\u52A0\u5BF9\u5E94\u7684 locale \u524D\u7F00\u3002\n * - 'us' \u4E3A\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u4E0D\u6DFB\u52A0\u524D\u7F00\n * - \u5176\u4ED6\u8BED\u8A00\u4F1A\u6DFB\u52A0 `/{locale}` \u524D\u7F00\n * - \u5B8C\u6574 URL\uFF08http/https\uFF09\u4E0D\u505A\u5904\u7406\n * - \u81EA\u52A8\u5904\u7406\u8DEF\u5F84\u683C\u5F0F\uFF08\u8865\u5145\u524D\u5BFC\u659C\u6760\u3001\u79FB\u9664\u5C3E\u90E8\u659C\u6760\uFF09\n *\n * @param path - \u539F\u59CB\u8DEF\u5F84\n * @param locale - \u8BED\u8A00\u6807\u8BC6\uFF08\u5982 'us', 'uk', 'de', 'jp' \u7B49\uFF09\n * @returns \u672C\u5730\u5316\u540E\u7684\u8DEF\u5F84\n *\n * @example\n * // \u57FA\u672C\u7528\u6CD5 - \u9ED8\u8BA4\u8BED\u8A00 'us' \u4E0D\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'us') // => '/products'\n * getLocalizedPath('/about', 'us') // => '/about'\n *\n * @example\n * // \u5176\u4ED6\u8BED\u8A00\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'uk') // => '/uk/products'\n * getLocalizedPath('/about/team', 'de') // => '/de/about/team'\n * getLocalizedPath('/contact', 'jp') // => '/jp/contact'\n *\n * @example\n * // \u6839\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('/', 'us') // => '/'\n * getLocalizedPath('/', 'uk') // => '/uk'\n *\n * @example\n * // \u81EA\u52A8\u683C\u5F0F\u5316\u8DEF\u5F84\n * getLocalizedPath('products', 'uk') // => '/uk/products' (\u8865\u5145\u524D\u5BFC\u659C\u6760)\n * getLocalizedPath('/products/', 'uk') // => '/uk/products' (\u79FB\u9664\u5C3E\u90E8\u659C\u6760)\n * getLocalizedPath('//products//detail/', 'uk') // => '/uk/products/detail' (\u79FB\u9664\u591A\u4F59\u659C\u6760)\n *\n * @example\n * // \u5DF2\u5305\u542B locale \u7684\u8DEF\u5F84\u4E0D\u91CD\u590D\u6DFB\u52A0\n * getLocalizedPath('/uk/products', 'uk') // => '/uk/products'\n *\n * @example\n * // \u5B8C\u6574 URL \u4E0D\u5904\u7406\n * getLocalizedPath('https://example.com/page', 'uk') // => 'https://example.com/page'\n * getLocalizedPath('http://example.com', 'de') // => 'http://example.com'\n *\n * @example\n * // \u7A7A\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('', 'uk') // => ''\n *\n * @example\n * // appendParams \u4F1A\u81EA\u52A8\u5224\u65AD\u7528 ? \u8FD8\u662F &\n * getLocalizedPath('/products', 'us', 'ref=footer') // => '/products?ref=footer'\n * getLocalizedPath('https://example.com/page', 'us', 'ref=footer') // => 'https://example.com/page?ref=footer'\n * getLocalizedPath('https://example.com/page?app=foo', 'us', 'ref=footer') // => 'https://example.com/page?app=foo&ref=footer'\n */\nexport const getLocalizedPath = (path: string, locale: string, appendParams?: string): string => {\n if (!path) return path\n\n // \u5982\u679C\u662F\u5B8C\u6574 URL\uFF08http:// \u6216 https://\uFF09\u6216\u951A\u70B9\u94FE\u63A5\uFF08#\uFF09\uFF0C\u4E0D\u5904\u7406 locale\uFF0C\u4F46\u9700\u5904\u7406 appendParams\n if (path.startsWith('http://') || path.startsWith('https://') || path.startsWith('#')) {\n if (!appendParams) return path\n return path.includes('?') ? `${path}&${appendParams}` : `${path}?${appendParams}`\n }\n\n // \u5206\u5272\u8DEF\u5F84\u5E76\u8FC7\u6EE4\u7A7A\u6BB5\uFF08\u5904\u7406\u591A\u4E2A\u8FDE\u7EED\u659C\u6760\u7684\u60C5\u51B5\uFF09\n const pathSegments = path.split('/').filter(Boolean)\n\n // \u5982\u679C\u6CA1\u6709\u6709\u6548\u8DEF\u5F84\u6BB5\uFF0C\u8FD4\u56DE locale \u524D\u7F00\u6216 '/'\n if (pathSegments.length === 0) {\n const base = locale === 'us' ? '/' : `/${locale}`\n return appendParams ? `${base}?${appendParams}` : base\n }\n\n // \u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u5DF2\u7ECF\u5305\u542B locale\n if (pathSegments[0] === locale) {\n const base = `/${pathSegments.join('/')}`\n return appendParams ? `${base}?${appendParams}` : base\n }\n\n // \u83B7\u53D6 locale \u524D\u7F00\u5E76\u62FC\u63A5\n const localePrefix = locale === 'us' ? '' : `/${locale}`\n const base = `${localePrefix}/${pathSegments.join('/')}`\n return appendParams ? `${base}?${appendParams}` : base\n}\n"],
|
|
5
|
-
"mappings": "AAAA,OAAS,QAAAA,MAA6B,OACtC,OAAS,uBAAAC,MAA2B,iBAEpC,MAAMC,EAAUD,EAAoB,CAClC,OAAQ,CACN,MAAO,CACL,aAAc,CAAC,KAAK,CACtB,EACA,YAAa,CACX,YAAa,CACX,iBACA,iBACA,iBACA,iBACA,iBACA,cACA,cACA,aACF,EACA,aAAc,CACZ,oBACA,sBACA,qBACA,uBACA,iBACF,EACA,QAAS,CAAC,gBAAiB,iBAAkB,eAAe,CAC9D,CACF,CACF,CAAC,EAEM,SAASE,KAAMC,EAAsB,CAC1C,OAAOF,EAAQF,EAAKI,CAAM,CAAC,CAC7B,CAEO,SAASC,GAAY,CAAC,CAEtB,SAASC,EAAOC,EAAY,CACjC,OAAIA,GAAM,OAAOA,GAAO,UAAYA,EAAG,SAAS,GAAG,EAC1CA,EAAG,MAAM,GAAG,EAAE,IAAI,GAAG,MAAM,GAAG,GAAG,MAAM,EAEvCA,CAEX,CACO,MAAMC,EAAiBC,GAAgBA,GAAK,QAAQ,OAAQ,GAAG,EAOhEC,EAAgBD,GACbA,EAAI,QAAQ,sBAAuB,MAAM,
|
|
6
|
-
"names": ["clsx", "extendTailwindMerge", "twMerge", "cn", "inputs", "noop", "atobID", "id", "spaceToHyphen", "str", "escapeRegExp", "
|
|
4
|
+
"sourcesContent": ["import { clsx, type ClassValue } from 'clsx'\nimport { extendTailwindMerge } from 'tailwind-merge'\n\nconst twMerge = extendTailwindMerge({\n extend: {\n theme: {\n borderRadius: ['btn'],\n },\n classGroups: {\n 'font-size': [\n 'text-heading-1',\n 'text-heading-2',\n 'text-heading-3',\n 'text-heading-4',\n 'text-heading-5',\n 'text-text-3',\n 'text-text-2',\n 'text-text-1',\n ],\n 'text-color': [\n 'text-info-primary',\n 'text-info-secondary',\n 'text-info-tertiary',\n 'text-info-quaternary',\n 'text-info-white',\n ],\n leading: ['leading-tight', 'leading-normal', 'leading-loose'],\n },\n },\n})\n\nexport function cn(...inputs: ClassValue[]) {\n return twMerge(clsx(inputs))\n}\n\nexport function noop(): any {}\n\nexport function atobID(id: string) {\n if (id && typeof id === 'string' && id.includes('/')) {\n return id.split('/').pop()?.split('?')?.shift()\n } else {\n return id\n }\n}\nexport const spaceToHyphen = (str: string) => str?.replace(/\\s+/g, '-')\n\n/**\n * \u8F6C\u4E49\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n * @param str \u9700\u8981\u8F6C\u4E49\u7684\u5B57\u7B26\u4E32\n * @returns \u8F6C\u4E49\u540E\u7684\u5B57\u7B26\u4E32\n */\nconst escapeRegExp = (str: string): string => {\n return str.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\$&')\n}\n\n/**\n * \u5B57\u7B26\u4E32\u6A21\u677F\u66FF\u6362 - \u5C06\u6A21\u677F\u4E2D\u7684 {key} \u5360\u4F4D\u7B26\u66FF\u6362\u4E3A\u5BF9\u5E94\u503C\n *\n * @param template - \u6A21\u677F\u5B57\u7B26\u4E32\uFF08\u5982 \"\u5171 {total} \u6761\u7ED3\u679C\"\uFF09\n * @param replacements - \u66FF\u6362\u952E\u503C\u5BF9\uFF08\u5982 { total: \"5\" }\uFF09\n * @param beginSeg - \u5360\u4F4D\u7B26\u5F00\u59CB\u7B26\u53F7\uFF0C\u9ED8\u8BA4 \"{\"\uFF0C\u652F\u6301\u81EA\u5B9A\u4E49\u5982 \"{{\"\u3001\"${\"\n * @param endSeg - \u5360\u4F4D\u7B26\u7ED3\u675F\u7B26\u53F7\uFF0C\u9ED8\u8BA4 \"}\"\uFF0C\u652F\u6301\u81EA\u5B9A\u4E49\u5982 \"}}\"\u3001\u7A7A\u5B57\u7B26\u4E32\n * @returns \u66FF\u6362\u540E\u7684\u5B57\u7B26\u4E32\n *\n * @example\n * replaceTemplate(\"Hello {name}!\", { name: \"World\" })\n * // => \"Hello World!\"\n *\n * replaceTemplate(\"\u5171 {total} \u6761\uFF0C\u641C\u7D22 {keyword}\", { total: \"5\", keyword: \"test\" })\n * // => \"\u5171 5 \u6761\uFF0C\u641C\u7D22 test\"\n */\nexport const replaceTemplate = (\n template: string,\n replacements: Record<string, string>,\n beginSeg: string = '{',\n endSeg: string = '}'\n): string => {\n if (!template) return template\n if (!replacements || Object.keys(replacements).length === 0) return template\n\n const escapedBegin = escapeRegExp(beginSeg)\n const escapedEnd = escapeRegExp(endSeg)\n const regex = new RegExp(`${escapedBegin}([a-zA-Z0-9_-]+)${escapedEnd}`, 'g')\n\n return template.replace(regex, (match, key) => {\n return replacements[key] !== undefined ? replacements[key] : match\n })\n}\n\n/**\n * \u9AD8\u4EAE\u641C\u7D22\u5173\u952E\u8BCD\n * @param text \u539F\u59CB\u6587\u672C\n * @param searchText \u641C\u7D22\u5173\u952E\u8BCD\n * @returns \u9AD8\u4EAE\u540E\u7684 HTML \u5B57\u7B26\u4E32\n */\nexport const highlightSearchWord = (text: string, searchText: string) => {\n try {\n if (!text || !searchText) {\n return text\n }\n\n // \u8F6C\u4E49\u641C\u7D22\u6587\u672C\u4E2D\u7684\u6B63\u5219\u8868\u8FBE\u5F0F\u7279\u6B8A\u5B57\u7B26\n const escapedSearchText = escapeRegExp(searchText)\n const regex = new RegExp(escapedSearchText, 'gi')\n\n // \u4F7F\u7528\u6B63\u5219\u8868\u8FBE\u5F0F\u7684\u5339\u914D\u7ED3\u679C\u6765\u4FDD\u6301\u539F\u59CB\u5927\u5C0F\u5199\n return text.replace(regex, match => `<span class='text-brand-0 font-bold'>${match}</span>`)\n } catch (e) {\n console.error('highlightSearchWord error:', e)\n return text\n }\n}\n\n/**\n * \u83B7\u53D6\u672C\u5730\u5316\u8DEF\u5F84\n *\n * \u6839\u636E\u8BED\u8A00\u6807\u8BC6\u4E3A\u8DEF\u5F84\u6DFB\u52A0\u5BF9\u5E94\u7684 locale \u524D\u7F00\u3002\n * - 'us' \u4E3A\u9ED8\u8BA4\u8BED\u8A00\uFF0C\u4E0D\u6DFB\u52A0\u524D\u7F00\n * - \u5176\u4ED6\u8BED\u8A00\u4F1A\u6DFB\u52A0 `/{locale}` \u524D\u7F00\n * - \u5B8C\u6574 URL\uFF08http/https\uFF09\u4E0D\u505A\u5904\u7406\n * - \u81EA\u52A8\u5904\u7406\u8DEF\u5F84\u683C\u5F0F\uFF08\u8865\u5145\u524D\u5BFC\u659C\u6760\u3001\u79FB\u9664\u5C3E\u90E8\u659C\u6760\uFF09\n *\n * @param path - \u539F\u59CB\u8DEF\u5F84\n * @param locale - \u8BED\u8A00\u6807\u8BC6\uFF08\u5982 'us', 'uk', 'de', 'jp' \u7B49\uFF09\n * @returns \u672C\u5730\u5316\u540E\u7684\u8DEF\u5F84\n *\n * @example\n * // \u57FA\u672C\u7528\u6CD5 - \u9ED8\u8BA4\u8BED\u8A00 'us' \u4E0D\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'us') // => '/products'\n * getLocalizedPath('/about', 'us') // => '/about'\n *\n * @example\n * // \u5176\u4ED6\u8BED\u8A00\u6DFB\u52A0\u524D\u7F00\n * getLocalizedPath('/products', 'uk') // => '/uk/products'\n * getLocalizedPath('/about/team', 'de') // => '/de/about/team'\n * getLocalizedPath('/contact', 'jp') // => '/jp/contact'\n *\n * @example\n * // \u6839\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('/', 'us') // => '/'\n * getLocalizedPath('/', 'uk') // => '/uk'\n *\n * @example\n * // \u81EA\u52A8\u683C\u5F0F\u5316\u8DEF\u5F84\n * getLocalizedPath('products', 'uk') // => '/uk/products' (\u8865\u5145\u524D\u5BFC\u659C\u6760)\n * getLocalizedPath('/products/', 'uk') // => '/uk/products' (\u79FB\u9664\u5C3E\u90E8\u659C\u6760)\n * getLocalizedPath('//products//detail/', 'uk') // => '/uk/products/detail' (\u79FB\u9664\u591A\u4F59\u659C\u6760)\n *\n * @example\n * // \u5DF2\u5305\u542B locale \u7684\u8DEF\u5F84\u4E0D\u91CD\u590D\u6DFB\u52A0\n * getLocalizedPath('/uk/products', 'uk') // => '/uk/products'\n *\n * @example\n * // \u5B8C\u6574 URL \u4E0D\u5904\u7406\n * getLocalizedPath('https://example.com/page', 'uk') // => 'https://example.com/page'\n * getLocalizedPath('http://example.com', 'de') // => 'http://example.com'\n *\n * @example\n * // \u7A7A\u8DEF\u5F84\u5904\u7406\n * getLocalizedPath('', 'uk') // => ''\n *\n * @example\n * // appendParams \u4F1A\u81EA\u52A8\u5224\u65AD\u7528 ? \u8FD8\u662F &\n * getLocalizedPath('/products', 'us', 'ref=footer') // => '/products?ref=footer'\n * getLocalizedPath('https://example.com/page', 'us', 'ref=footer') // => 'https://example.com/page?ref=footer'\n * getLocalizedPath('https://example.com/page?app=foo', 'us', 'ref=footer') // => 'https://example.com/page?app=foo&ref=footer'\n */\nexport const getLocalizedPath = (path: string, locale: string, appendParams?: string): string => {\n if (!path) return path\n\n // \u5982\u679C\u662F\u5B8C\u6574 URL\uFF08http:// \u6216 https://\uFF09\u6216\u951A\u70B9\u94FE\u63A5\uFF08#\uFF09\uFF0C\u4E0D\u5904\u7406 locale\uFF0C\u4F46\u9700\u5904\u7406 appendParams\n if (path.startsWith('http://') || path.startsWith('https://') || path.startsWith('#')) {\n if (!appendParams) return path\n return path.includes('?') ? `${path}&${appendParams}` : `${path}?${appendParams}`\n }\n\n // \u5206\u5272\u8DEF\u5F84\u5E76\u8FC7\u6EE4\u7A7A\u6BB5\uFF08\u5904\u7406\u591A\u4E2A\u8FDE\u7EED\u659C\u6760\u7684\u60C5\u51B5\uFF09\n const pathSegments = path.split('/').filter(Boolean)\n\n // \u5982\u679C\u6CA1\u6709\u6709\u6548\u8DEF\u5F84\u6BB5\uFF0C\u8FD4\u56DE locale \u524D\u7F00\u6216 '/'\n if (pathSegments.length === 0) {\n const base = locale === 'us' ? '/' : `/${locale}`\n return appendParams ? `${base}?${appendParams}` : base\n }\n\n // \u68C0\u67E5\u8DEF\u5F84\u662F\u5426\u5DF2\u7ECF\u5305\u542B locale\n if (pathSegments[0] === locale) {\n const base = `/${pathSegments.join('/')}`\n return appendParams ? `${base}?${appendParams}` : base\n }\n\n // \u83B7\u53D6 locale \u524D\u7F00\u5E76\u62FC\u63A5\n const localePrefix = locale === 'us' ? '' : `/${locale}`\n const base = `${localePrefix}/${pathSegments.join('/')}`\n return appendParams ? `${base}?${appendParams}` : base\n}\n"],
|
|
5
|
+
"mappings": "AAAA,OAAS,QAAAA,MAA6B,OACtC,OAAS,uBAAAC,MAA2B,iBAEpC,MAAMC,EAAUD,EAAoB,CAClC,OAAQ,CACN,MAAO,CACL,aAAc,CAAC,KAAK,CACtB,EACA,YAAa,CACX,YAAa,CACX,iBACA,iBACA,iBACA,iBACA,iBACA,cACA,cACA,aACF,EACA,aAAc,CACZ,oBACA,sBACA,qBACA,uBACA,iBACF,EACA,QAAS,C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AAW,UAAU,GAAKA,EAAK,WAAW,GAAG,EAClF,OAAKE,EACEF,EAAK,SAAS,GAAG,EAAI,GAAGA,CAAI,IAAIE,CAAY,GAAK,GAAGF,CAAI,IAAIE,CAAY,GADrDF,EAK5B,MAAMG,EAAeH,EAAK,MAAM,GAAG,EAAE,OAAO,OAAO,EAGnD,GAAIG,EAAa,SAAW,EAAG,CAC7B,MAAMC,EAAOH,IAAW,KAAO,IAAM,IAAIA,CAAM,GAC/C,OAAOC,EAAe,GAAGE,CAAI,IAAIF,CAAY,GAAKE,CACpD,CAGA,GAAID,EAAa,CAAC,IAAMF,EAAQ,CAC9B,MAAMG,EAAO,IAAID,EAAa,KAAK,GAAG,CAAC,GACvC,OAAOD,EAAe,GAAGE,CAAI,IAAIF,CAAY,GAAKE,CACpD,CAIA,MAAMA,EAAO,GADQH,IAAW,KAAO,GAAK,IAAIA,CAAM,EAC1B,IAAIE,EAAa,KAAK,GAAG,CAAC,GACtD,OAAOD,EAAe,GAAGE,CAAI,IAAIF,CAAY,GAAKE,CACpD",
|
|
6
|
+
"names": ["clsx", "extendTailwindMerge", "twMerge", "cn", "inputs", "noop", "atobID", "id", "spaceToHyphen", "str", "escapeRegExp", "replaceTemplate", "template", "replacements", "beginSeg", "endSeg", "escapedBegin", "escapedEnd", "regex", "match", "key", "highlightSearchWord", "text", "searchText", "escapedSearchText", "getLocalizedPath", "path", "locale", "appendParams", "pathSegments", "base"]
|
|
7
7
|
}
|