@anker-in/headless-ui 0.0.27-alpha.51 → 0.0.27-alpha.52
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/Category/SwiperCategory.d.ts +16 -0
- package/dist/cjs/biz-components/Category/SwiperCategory.js +2 -0
- package/dist/cjs/biz-components/Category/SwiperCategory.js.map +7 -0
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/Category/index.js.map +3 -3
- package/dist/esm/biz-components/Category/SwiperCategory.d.ts +16 -0
- package/dist/esm/biz-components/Category/SwiperCategory.js +2 -0
- package/dist/esm/biz-components/Category/SwiperCategory.js.map +7 -0
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/Category/index.js.map +3 -3
- package/package.json +1 -1
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SwiperBoxProps {
|
|
3
|
+
data: {
|
|
4
|
+
list: any[];
|
|
5
|
+
configuration?: any;
|
|
6
|
+
};
|
|
7
|
+
id: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
breakpoints?: Record<number, Object>;
|
|
10
|
+
Slide: React.ComponentType<{
|
|
11
|
+
data: any;
|
|
12
|
+
configuration?: any;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
declare const SwiperBox: React.ForwardRefExoticComponent<SwiperBoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default SwiperBox;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";"use client";var w=Object.create;var t=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var g=(e,i)=>{for(var r in i)t(e,r,{get:i[r],enumerable:!0})},l=(e,i,r,s)=>{if(i&&typeof i=="object"||typeof i=="function")for(let o of m(i))!S.call(e,o)&&o!==r&&t(e,o,{get:()=>i[o],enumerable:!(s=c(i,o))||s.enumerable});return e};var x=(e,i,r)=>(r=e!=null?w(u(e)):{},l(i||!e||!e.__esModule?t(r,"default",{value:e,enumerable:!0}):r,e)),y=e=>l(t({},"__esModule",{value:!0}),e);var M={};g(M,{default:()=>B});module.exports=y(M);var n=require("react/jsx-runtime"),d=x(require("react")),b=require("../../helpers/utils.js"),p=require("swiper/react"),a=require("swiper/modules");const f=d.default.forwardRef(({data:e,Slide:i,id:r})=>(0,n.jsx)(p.Swiper,{freeMode:!0,mousewheel:{forceToAxis:!0},className:"!overflow-visible",modules:[a.FreeMode,a.Mousewheel,a.Pagination],breakpoints:{0:{spaceBetween:16,slidesPerView:1,freeMode:!1},374:{spaceBetween:16,freeMode:!1,slidesPerView:1},768:{spaceBetween:16,freeMode:!1,slidesPerView:6}},children:e?.list?.map((s,o)=>(0,n.jsx)(p.SwiperSlide,{className:"!flex !h-[unset]",children:(0,n.jsx)(i,{data:s,configuration:e?.configuration})},r+"SwiperSlide"+o))}));f.displayName="SwiperBox";var B=f;
|
|
2
|
+
//# sourceMappingURL=SwiperCategory.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/Category/SwiperCategory.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Pagination, FreeMode, Mousewheel } from 'swiper/modules'\n\nexport interface SwiperBoxProps {\n data: {\n list: any[]\n configuration?: any\n }\n id: string\n className?: string\n breakpoints?: Record<number, Object>\n Slide: React.ComponentType<{ data: any; configuration?: any }>\n}\n\nconst SwiperBox = React.forwardRef<HTMLDivElement, SwiperBoxProps>(({ data, Slide, id }) => {\n return (\n <Swiper\n freeMode={true}\n mousewheel={{\n forceToAxis: true,\n }}\n className=\"!overflow-visible\"\n modules={[FreeMode, Mousewheel, Pagination]}\n breakpoints={{\n 0: {\n spaceBetween: 16,\n slidesPerView: 1,\n freeMode: false,\n },\n 374: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 1,\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 6,\n },\n }}\n >\n {data?.list?.map((item, jIndex) => (\n <SwiperSlide key={id + 'SwiperSlide' + jIndex} className=\"!flex !h-[unset]\">\n <Slide data={item} configuration={data?.configuration} />\n </SwiperSlide>\n ))}\n </Swiper>\n )\n})\n\nSwiperBox.displayName = 'SwiperBox'\n\nexport default SwiperBox\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA8CU,IAAAI,EAAA,6BA7CVC,EAAkB,oBAClBC,EAAmB,kCACnBD,EAAoC,wBACpCE,EAAiD,0BAajD,MAAMC,EAAY,EAAAC,QAAM,WAA2C,CAAC,CAAE,KAAAC,EAAM,MAAAC,EAAO,GAAAC,CAAG,OAElF,OAAC,UACC,SAAU,GACV,WAAY,CACV,YAAa,EACf,EACA,UAAU,oBACV,QAAS,CAAC,WAAU,aAAY,YAAU,EAC1C,YAAa,CACX,EAAG,CACD,aAAc,GACd,cAAe,EACf,SAAU,EACZ,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,CACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,CACjB,CACF,EAEC,SAAAF,GAAM,MAAM,IAAI,CAACG,EAAMC,OACtB,OAAC,eAA8C,UAAU,mBACvD,mBAACH,EAAA,CAAM,KAAME,EAAM,cAAeH,GAAM,cAAe,GADvCE,EAAK,cAAgBE,CAEvC,CACD,EACH,CAEH,EAEDN,EAAU,YAAc,YAExB,IAAON,EAAQM",
|
|
6
|
+
"names": ["SwiperCategory_exports", "__export", "SwiperCategory_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_modules", "SwiperBox", "React", "data", "Slide", "id", "item", "jIndex"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var f=Object.create;var i=Object.defineProperty;var g=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var v=(e,r)=>{for(var o in r)i(e,o,{get:r[o],enumerable:!0})},p=(e,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of x(r))!h.call(e,s)&&s!==o&&i(e,s,{get:()=>r[s],enumerable:!(a=g(r,s))||a.enumerable});return e};var c=(e,r,o)=>(o=e!=null?f(b(e)):{},p(r||!e||!e.__esModule?i(o,"default",{value:e,enumerable:!0}):o,e)),y=e=>p(i({},"__esModule",{value:!0}),e);var A={};v(A,{default:()=>E});module.exports=y(A);var t=require("react/jsx-runtime"),S=require("react"),l=require("../../helpers/utils.js"),n=c(require("../../components/picture.js")),m=require("../../shared/Styles.js"),u=c(require("../Title/index.js")),d=c(require("./SwiperCategory.js"));const F=(e,r)=>{const o=[];for(let a=0;a<e.length;a+=r)o.push(e.slice(a,a+r));return o},N=({data:e,configuration:r})=>(0,t.jsxs)("div",{className:(0,l.cn)("box-border flex w-full flex-col overflow-hidden bg-[#EAEAEC]","laptop:p-6 desktop:p-8 cursor-pointer p-4 hover:bg-[#FFFFFF]",r?.shape==="round"?"rounded-[16px]":"rounded-none"),children:[(0,t.jsx)(n.default,{className:"tablet:h-[146px] mb-2 flex h-[74px] w-full items-center object-cover",source:e?.image}),(0,t.jsx)("p",{className:"tablet:text-lg flex-1 text-center text-sm font-semibold",children:e?.name})]}),C=({data:e,configuration:r})=>(0,t.jsx)("div",{className:"grid grid-cols-2 gap-3",children:e?.map((o,a)=>(0,t.jsxs)("div",{className:(0,l.cn)("box-border max-h-[126px] w-full overflow-hidden bg-[#EAEAEC]","cursor-pointer px-3 py-4 hover:bg-[#FFFFFF]",r?.shape==="round"?"rounded-[16px]":"rounded-none"),children:[(0,t.jsx)(n.default,{className:"mb-2 flex h-[74px] w-full items-center object-cover",source:o?.image}),(0,t.jsx)("p",{className:"flex-1 truncate text-center text-sm font-semibold",children:o?.name})]},`${o?.name}${a}`))}),w=({data:e,configuration:r})=>(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"tablet:block hidden",children:(0,t.jsx)("div",{className:"mx-auto flex w-full gap-4",children:e?.map((o,a)=>(0,t.jsxs)("div",{className:(0,l.cn)("box-border flex w-[calc(20%-12px)] shrink-0 flex-col overflow-hidden bg-[#EAEAEC]","laptop:p-6 desktop:p-8 cursor-pointer p-4 hover:bg-[#FFFFFF]",r?.shape==="round"?"rounded-[16px]":"rounded-none"),children:[(0,t.jsx)(n.default,{className:"tablet:h-[146px] mb-2 flex h-[74px] w-full items-center object-cover",source:o?.image}),(0,t.jsx)("p",{className:"tablet:text-lg flex-1 text-center text-sm font-semibold",children:o?.name})]},a))})}),(0,t.jsx)("div",{className:"tablet:hidden block",children:(0,t.jsx)("div",{className:"grid grid-cols-2 gap-3",children:e?.map((o,a)=>(0,t.jsxs)("div",{className:(0,l.cn)("box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden bg-[#EAEAEC]","cursor-pointer p-4 hover:bg-[#FFFFFF]",a===0?"row-span-2":"",r?.shape==="round"?"rounded-[16px]":"rounded-none"),children:[(0,t.jsx)(n.default,{className:(0,l.cn)("mb-2 flex h-[74px] w-full items-center object-cover",a===0?"h-[140px]":"h-[74px]"),source:o?.image}),(0,t.jsx)("p",{className:"line-clamp-2 flex-1 text-center text-sm font-semibold",children:o?.name})]},a))})})]}),k=({data:e,buildData:r,className:o="",key:a})=>{const s=e?.products?.length<=5;return(0,t.jsxs)("div",{className:(0,l.cn)("w-full",o),children:[e?.title&&(0,t.jsx)(u.default,{data:{title:e?.title}}),s?(0,t.jsx)(w,{data:e?.products,configuration:{shape:e?.shape}}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("div",{className:"tablet:block hidden",children:(0,t.jsx)(d.default,{id:`Category${a}`,Slide:N,data:{list:e?.products,configuration:{shape:e?.shape}}})}),(0,t.jsx)("div",{className:"tablet:hidden block overflow-hidden",children:(0,t.jsx)(d.default,{id:`Category1${a}`,Slide:C,data:{list:F(e?.products,6),configuration:{shape:e?.shape}}})})]})]})};var E=(0,m.withStyles)(k);
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Category/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["Category_exports", "__export", "Category_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_picture", "import_Styles", "import_Title", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from './SwiperCategory.js'\n\nexport interface CategoryItem {\n /** \u4EA7\u54C1\u56FE\u7247*/\n image: string\n name: string\n}\n\nexport interface CategoryProps {\n className?: string\n /** \u4E3B\u9898\u8272*/\n theme?: 'light' | 'dark'\n data: {\n products: CategoryItem[]\n /** \u5361\u7247\u5F62\u72B6 */\n shape?: 'round' | 'square'\n title?: string\n }\n buildData?: {\n categories: any[]\n products: any[]\n }\n key?: string\n}\n\nconst chunkArray = (arr: any[], size: number) => {\n const chunks = []\n for (let i = 0; i < arr.length; i += size) {\n chunks.push(arr.slice(i, i + size))\n }\n return chunks\n}\n\nconst CategoryPcItem = ({ data, configuration }: { data: CategoryItem; configuration?: any }) => {\n return (\n <div\n className={cn(\n 'box-border flex w-full flex-col overflow-hidden bg-[#EAEAEC]',\n 'laptop:p-6 desktop:p-8 cursor-pointer p-4 hover:bg-[#FFFFFF]',\n configuration?.shape === 'round' ? 'rounded-[16px]' : 'rounded-none'\n )}\n >\n <Picture className=\"tablet:h-[146px] mb-2 flex h-[74px] w-full items-center object-cover\" source={data?.image} />\n <p className=\"tablet:text-lg flex-1 text-center text-sm font-semibold\">{data?.name}</p>\n </div>\n )\n}\n\nconst CategoryMobileItem = ({ data, configuration }: { data: CategoryItem[]; configuration?: any }) => {\n return (\n <div className=\"grid grid-cols-2 gap-3\">\n {data?.map((item, index) => {\n return (\n <div\n key={`${item?.name}${index}`}\n className={cn(\n 'box-border max-h-[126px] w-full overflow-hidden bg-[#EAEAEC]',\n 'cursor-pointer px-3 py-4 hover:bg-[#FFFFFF]',\n configuration?.shape === 'round' ? 'rounded-[16px]' : 'rounded-none'\n )}\n >\n <Picture className=\"mb-2 flex h-[74px] w-full items-center object-cover\" source={item?.image} />\n <p className=\"flex-1 truncate text-center text-sm font-semibold\">{item?.name}</p>\n </div>\n )\n })}\n </div>\n )\n}\n\nconst SoundCoreCategoryItem = ({ data, configuration }: { data: CategoryItem[]; configuration?: any }) => {\n return (\n <>\n <div className=\"tablet:block hidden\">\n <div className=\"mx-auto flex w-full gap-4\">\n {data?.map((item, index) => {\n return (\n <div\n key={index}\n className={cn(\n 'box-border flex w-[calc(20%-12px)] shrink-0 flex-col overflow-hidden bg-[#EAEAEC]',\n 'laptop:p-6 desktop:p-8 cursor-pointer p-4 hover:bg-[#FFFFFF]',\n configuration?.shape === 'round' ? 'rounded-[16px]' : 'rounded-none'\n )}\n >\n <Picture\n className=\"tablet:h-[146px] mb-2 flex h-[74px] w-full items-center object-cover\"\n source={item?.image}\n />\n <p className=\"tablet:text-lg flex-1 text-center text-sm font-semibold\">{item?.name}</p>\n </div>\n )\n })}\n </div>\n </div>\n <div className=\"tablet:hidden block\">\n <div className=\"grid grid-cols-2 gap-3\">\n {data?.map((item, index) => {\n return (\n <div\n key={index}\n className={cn(\n 'box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden bg-[#EAEAEC]',\n 'cursor-pointer p-4 hover:bg-[#FFFFFF]',\n index === 0 ? 'row-span-2' : '',\n configuration?.shape === 'round' ? 'rounded-[16px]' : 'rounded-none'\n )}\n >\n <Picture\n className={cn(\n 'mb-2 flex h-[74px] w-full items-center object-cover',\n index === 0 ? 'h-[140px]' : 'h-[74px]'\n )}\n source={item?.image}\n />\n <p className=\"line-clamp-2 flex-1 text-center text-sm font-semibold\">{item?.name}</p>\n </div>\n )\n })}\n </div>\n </div>\n </>\n )\n}\n\nconst Category: React.FC<CategoryProps> = ({ data, buildData, className = '', key }) => {\n // soundcore\u54C1\u724C\u54C1\u7C7B\u4E0D\u8D85\u8FC75\u4E2A\uFF0C\u5355\u72EC\u505A\u6837\u5F0F\u5904\u7406\n const isSoundCore = data?.products?.length <= 5\n return (\n <div className={cn('w-full', className)}>\n {data?.title && <Title data={{ title: data?.title }} />}\n {isSoundCore ? (\n <SoundCoreCategoryItem data={data?.products} configuration={{ shape: data?.shape }} />\n ) : (\n <>\n <div className=\"tablet:block hidden\">\n <SwiperBox\n id={`Category${key}`}\n Slide={CategoryPcItem}\n data={{ list: data?.products, configuration: { shape: data?.shape } }}\n />\n </div>\n <div className=\"tablet:hidden block overflow-hidden\">\n <SwiperBox\n id={`Category1${key}`}\n Slide={CategoryMobileItem}\n data={{ list: chunkArray(data?.products, 6), configuration: { shape: data?.shape } }}\n />\n </div>\n </>\n )}\n </div>\n )\n}\n\nexport default withStyles(Category)\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAyCI,IAAAI,EAAA,6BAxCJC,EAAkB,iBAClBC,EAAmB,kCACnBC,EAAoB,0CACpBC,EAA2B,kCAC3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OAAI,UAAU,sBACb,mBAAC,OAAI,UAAU,yBACZ,SAAAL,GAAM,IAAI,CAACI,EAAMC,OAEd,QAAC,OAEC,aAAW,MACT,oGACA,wCACAA,IAAU,EAAI,aAAe,GAC7BJ,GAAe,QAAU,QAAU,iBAAmB,cACxD,EAEA,oBAAC,EAAAC,QAAA,CACC,aAAW,MACT,sDACAG,IAAU,EAAI,YAAc,UAC9B,EACA,OAAQD,GAAM,MAChB,KACA,OAAC,KAAE,UAAU,wDAAyD,SAAAA,GAAM,KAAK,IAf5EC,CAgBP,CAEH,EACH,EACF,GACF,EAIEE,EAAoC,CAAC,CAAE,KAAAP,EAAM,UAAAQ,EAAW,UAAAC,EAAY,GAAI,IAAAC,CAAI,IAAM,CAEtF,MAAMC,EAAcX,GAAM,UAAU,QAAU,EAC9C,SACE,QAAC,OAAI,aAAW,MAAG,SAAUS,CAAS,EACnC,UAAAT,GAAM,UAAS,OAAC,EAAAY,QAAA,CAAM,KAAM,CAAE,MAAOZ,GAAM,KAAM,EAAG,EACpDW,KACC,OAACL,EAAA,CAAsB,KAAMN,GAAM,SAAU,cAAe,CAAE,MAAOA,GAAM,KAAM,EAAG,KAEpF,oBACE,oBAAC,OAAI,UAAU,sBACb,mBAAC,EAAAa,QAAA,CACC,GAAI,WAAWH,CAAG,GAClB,MAAOX,EACP,KAAM,CAAE,KAAMC,GAAM,SAAU,cAAe,CAAE,MAAOA,GAAM,KAAM,CAAE,EACtE,EACF,KACA,OAAC,OAAI,UAAU,sCACb,mBAAC,EAAAa,QAAA,CACC,GAAI,YAAYH,CAAG,GACnB,MAAOP,EACP,KAAM,CAAE,KAAMT,EAAWM,GAAM,SAAU,CAAC,EAAG,cAAe,CAAE,MAAOA,GAAM,KAAM,CAAE,EACrF,EACF,GACF,GAEJ,CAEJ,EAEA,IAAOf,KAAQ,cAAWsB,CAAQ",
|
|
6
|
+
"names": ["Category_exports", "__export", "Category_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_picture", "import_Styles", "import_Title", "import_SwiperCategory", "chunkArray", "arr", "size", "chunks", "i", "CategoryPcItem", "data", "configuration", "Picture", "CategoryMobileItem", "item", "index", "SoundCoreCategoryItem", "Category", "buildData", "className", "key", "isSoundCore", "Title", "SwiperBox"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
export interface SwiperBoxProps {
|
|
3
|
+
data: {
|
|
4
|
+
list: any[];
|
|
5
|
+
configuration?: any;
|
|
6
|
+
};
|
|
7
|
+
id: string;
|
|
8
|
+
className?: string;
|
|
9
|
+
breakpoints?: Record<number, Object>;
|
|
10
|
+
Slide: React.ComponentType<{
|
|
11
|
+
data: any;
|
|
12
|
+
configuration?: any;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
declare const SwiperBox: React.ForwardRefExoticComponent<SwiperBoxProps & React.RefAttributes<HTMLDivElement>>;
|
|
16
|
+
export default SwiperBox;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as e}from"react/jsx-runtime";import n from"react";import"../../helpers/utils.js";import{Swiper as p,SwiperSlide as l}from"swiper/react";import{Pagination as f,FreeMode as d,Mousewheel as w}from"swiper/modules";const r=n.forwardRef(({data:i,Slide:o,id:a})=>e(p,{freeMode:!0,mousewheel:{forceToAxis:!0},className:"!overflow-visible",modules:[d,w,f],breakpoints:{0:{spaceBetween:16,slidesPerView:1,freeMode:!1},374:{spaceBetween:16,freeMode:!1,slidesPerView:1},768:{spaceBetween:16,freeMode:!1,slidesPerView:6}},children:i?.list?.map((s,t)=>e(l,{className:"!flex !h-[unset]",children:e(o,{data:s,configuration:i?.configuration})},a+"SwiperSlide"+t))}));r.displayName="SwiperBox";var x=r;export{x as default};
|
|
2
|
+
//# sourceMappingURL=SwiperCategory.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/Category/SwiperCategory.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { Pagination, FreeMode, Mousewheel } from 'swiper/modules'\n\nexport interface SwiperBoxProps {\n data: {\n list: any[]\n configuration?: any\n }\n id: string\n className?: string\n breakpoints?: Record<number, Object>\n Slide: React.ComponentType<{ data: any; configuration?: any }>\n}\n\nconst SwiperBox = React.forwardRef<HTMLDivElement, SwiperBoxProps>(({ data, Slide, id }) => {\n return (\n <Swiper\n freeMode={true}\n mousewheel={{\n forceToAxis: true,\n }}\n className=\"!overflow-visible\"\n modules={[FreeMode, Mousewheel, Pagination]}\n breakpoints={{\n 0: {\n spaceBetween: 16,\n slidesPerView: 1,\n freeMode: false,\n },\n 374: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 1,\n },\n 768: {\n spaceBetween: 16,\n freeMode: false,\n slidesPerView: 6,\n },\n }}\n >\n {data?.list?.map((item, jIndex) => (\n <SwiperSlide key={id + 'SwiperSlide' + jIndex} className=\"!flex !h-[unset]\">\n <Slide data={item} configuration={data?.configuration} />\n </SwiperSlide>\n ))}\n </Swiper>\n )\n})\n\nSwiperBox.displayName = 'SwiperBox'\n\nexport default SwiperBox\n"],
|
|
5
|
+
"mappings": "aA8CU,cAAAA,MAAA,oBA7CV,OAAOC,MAAW,QAClB,MAAmB,yBACnB,OAAS,UAAAC,EAAQ,eAAAC,MAAmB,eACpC,OAAS,cAAAC,EAAY,YAAAC,EAAU,cAAAC,MAAkB,iBAajD,MAAMC,EAAYN,EAAM,WAA2C,CAAC,CAAE,KAAAO,EAAM,MAAAC,EAAO,GAAAC,CAAG,IAElFV,EAACE,EAAA,CACC,SAAU,GACV,WAAY,CACV,YAAa,EACf,EACA,UAAU,oBACV,QAAS,CAACG,EAAUC,EAAYF,CAAU,EAC1C,YAAa,CACX,EAAG,CACD,aAAc,GACd,cAAe,EACf,SAAU,EACZ,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,CACjB,EACA,IAAK,CACH,aAAc,GACd,SAAU,GACV,cAAe,CACjB,CACF,EAEC,SAAAI,GAAM,MAAM,IAAI,CAACG,EAAMC,IACtBZ,EAACG,EAAA,CAA8C,UAAU,mBACvD,SAAAH,EAACS,EAAA,CAAM,KAAME,EAAM,cAAeH,GAAM,cAAe,GADvCE,EAAK,cAAgBE,CAEvC,CACD,EACH,CAEH,EAEDL,EAAU,YAAc,YAExB,IAAOM,EAAQN",
|
|
6
|
+
"names": ["jsx", "React", "Swiper", "SwiperSlide", "Pagination", "FreeMode", "Mousewheel", "SwiperBox", "data", "Slide", "id", "item", "jIndex", "SwiperCategory_default"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as
|
|
1
|
+
"use client";import{Fragment as c,jsx as t,jsxs as s}from"react/jsx-runtime";import"react";import{cn as l}from"../../helpers/utils.js";import n from"../../components/picture.js";import{withStyles as p}from"../../shared/Styles.js";import m from"../Title/index.js";import i from"./SwiperCategory.js";const u=(e,a)=>{const r=[];for(let o=0;o<e.length;o+=a)r.push(e.slice(o,o+a));return r},f=({data:e,configuration:a})=>s("div",{className:l("box-border flex w-full flex-col overflow-hidden bg-[#EAEAEC]","laptop:p-6 desktop:p-8 cursor-pointer p-4 hover:bg-[#FFFFFF]",a?.shape==="round"?"rounded-[16px]":"rounded-none"),children:[t(n,{className:"tablet:h-[146px] mb-2 flex h-[74px] w-full items-center object-cover",source:e?.image}),t("p",{className:"tablet:text-lg flex-1 text-center text-sm font-semibold",children:e?.name})]}),g=({data:e,configuration:a})=>t("div",{className:"grid grid-cols-2 gap-3",children:e?.map((r,o)=>s("div",{className:l("box-border max-h-[126px] w-full overflow-hidden bg-[#EAEAEC]","cursor-pointer px-3 py-4 hover:bg-[#FFFFFF]",a?.shape==="round"?"rounded-[16px]":"rounded-none"),children:[t(n,{className:"mb-2 flex h-[74px] w-full items-center object-cover",source:r?.image}),t("p",{className:"flex-1 truncate text-center text-sm font-semibold",children:r?.name})]},`${r?.name}${o}`))}),x=({data:e,configuration:a})=>s(c,{children:[t("div",{className:"tablet:block hidden",children:t("div",{className:"mx-auto flex w-full gap-4",children:e?.map((r,o)=>s("div",{className:l("box-border flex w-[calc(20%-12px)] shrink-0 flex-col overflow-hidden bg-[#EAEAEC]","laptop:p-6 desktop:p-8 cursor-pointer p-4 hover:bg-[#FFFFFF]",a?.shape==="round"?"rounded-[16px]":"rounded-none"),children:[t(n,{className:"tablet:h-[146px] mb-2 flex h-[74px] w-full items-center object-cover",source:r?.image}),t("p",{className:"tablet:text-lg flex-1 text-center text-sm font-semibold",children:r?.name})]},o))})}),t("div",{className:"tablet:hidden block",children:t("div",{className:"grid grid-cols-2 gap-3",children:e?.map((r,o)=>s("div",{className:l("box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden bg-[#EAEAEC]","cursor-pointer p-4 hover:bg-[#FFFFFF]",o===0?"row-span-2":"",a?.shape==="round"?"rounded-[16px]":"rounded-none"),children:[t(n,{className:l("mb-2 flex h-[74px] w-full items-center object-cover",o===0?"h-[140px]":"h-[74px]"),source:r?.image}),t("p",{className:"line-clamp-2 flex-1 text-center text-sm font-semibold",children:r?.name})]},o))})})]}),b=({data:e,buildData:a,className:r="",key:o})=>{const d=e?.products?.length<=5;return s("div",{className:l("w-full",r),children:[e?.title&&t(m,{data:{title:e?.title}}),d?t(x,{data:e?.products,configuration:{shape:e?.shape}}):s(c,{children:[t("div",{className:"tablet:block hidden",children:t(i,{id:`Category${o}`,Slide:f,data:{list:e?.products,configuration:{shape:e?.shape}}})}),t("div",{className:"tablet:hidden block overflow-hidden",children:t(i,{id:`Category1${o}`,Slide:g,data:{list:u(e?.products,6),configuration:{shape:e?.shape}}})})]})]})};var k=p(b);export{k as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Category/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "cn", "Picture", "withStyles", "Title", "SwiperBox", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from './SwiperCategory.js'\n\nexport interface CategoryItem {\n /** \u4EA7\u54C1\u56FE\u7247*/\n image: string\n name: string\n}\n\nexport interface CategoryProps {\n className?: string\n /** \u4E3B\u9898\u8272*/\n theme?: 'light' | 'dark'\n data: {\n products: CategoryItem[]\n /** \u5361\u7247\u5F62\u72B6 */\n shape?: 'round' | 'square'\n title?: string\n }\n buildData?: {\n categories: any[]\n products: any[]\n }\n key?: string\n}\n\nconst chunkArray = (arr: any[], size: number) => {\n const chunks = []\n for (let i = 0; i < arr.length; i += size) {\n chunks.push(arr.slice(i, i + size))\n }\n return chunks\n}\n\nconst CategoryPcItem = ({ data, configuration }: { data: CategoryItem; configuration?: any }) => {\n return (\n <div\n className={cn(\n 'box-border flex w-full flex-col overflow-hidden bg-[#EAEAEC]',\n 'laptop:p-6 desktop:p-8 cursor-pointer p-4 hover:bg-[#FFFFFF]',\n configuration?.shape === 'round' ? 'rounded-[16px]' : 'rounded-none'\n )}\n >\n <Picture className=\"tablet:h-[146px] mb-2 flex h-[74px] w-full items-center object-cover\" source={data?.image} />\n <p className=\"tablet:text-lg flex-1 text-center text-sm font-semibold\">{data?.name}</p>\n </div>\n )\n}\n\nconst CategoryMobileItem = ({ data, configuration }: { data: CategoryItem[]; configuration?: any }) => {\n return (\n <div className=\"grid grid-cols-2 gap-3\">\n {data?.map((item, index) => {\n return (\n <div\n key={`${item?.name}${index}`}\n className={cn(\n 'box-border max-h-[126px] w-full overflow-hidden bg-[#EAEAEC]',\n 'cursor-pointer px-3 py-4 hover:bg-[#FFFFFF]',\n configuration?.shape === 'round' ? 'rounded-[16px]' : 'rounded-none'\n )}\n >\n <Picture className=\"mb-2 flex h-[74px] w-full items-center object-cover\" source={item?.image} />\n <p className=\"flex-1 truncate text-center text-sm font-semibold\">{item?.name}</p>\n </div>\n )\n })}\n </div>\n )\n}\n\nconst SoundCoreCategoryItem = ({ data, configuration }: { data: CategoryItem[]; configuration?: any }) => {\n return (\n <>\n <div className=\"tablet:block hidden\">\n <div className=\"mx-auto flex w-full gap-4\">\n {data?.map((item, index) => {\n return (\n <div\n key={index}\n className={cn(\n 'box-border flex w-[calc(20%-12px)] shrink-0 flex-col overflow-hidden bg-[#EAEAEC]',\n 'laptop:p-6 desktop:p-8 cursor-pointer p-4 hover:bg-[#FFFFFF]',\n configuration?.shape === 'round' ? 'rounded-[16px]' : 'rounded-none'\n )}\n >\n <Picture\n className=\"tablet:h-[146px] mb-2 flex h-[74px] w-full items-center object-cover\"\n source={item?.image}\n />\n <p className=\"tablet:text-lg flex-1 text-center text-sm font-semibold\">{item?.name}</p>\n </div>\n )\n })}\n </div>\n </div>\n <div className=\"tablet:hidden block\">\n <div className=\"grid grid-cols-2 gap-3\">\n {data?.map((item, index) => {\n return (\n <div\n key={index}\n className={cn(\n 'box-border flex w-full shrink-0 flex-col items-center justify-center overflow-hidden bg-[#EAEAEC]',\n 'cursor-pointer p-4 hover:bg-[#FFFFFF]',\n index === 0 ? 'row-span-2' : '',\n configuration?.shape === 'round' ? 'rounded-[16px]' : 'rounded-none'\n )}\n >\n <Picture\n className={cn(\n 'mb-2 flex h-[74px] w-full items-center object-cover',\n index === 0 ? 'h-[140px]' : 'h-[74px]'\n )}\n source={item?.image}\n />\n <p className=\"line-clamp-2 flex-1 text-center text-sm font-semibold\">{item?.name}</p>\n </div>\n )\n })}\n </div>\n </div>\n </>\n )\n}\n\nconst Category: React.FC<CategoryProps> = ({ data, buildData, className = '', key }) => {\n // soundcore\u54C1\u724C\u54C1\u7C7B\u4E0D\u8D85\u8FC75\u4E2A\uFF0C\u5355\u72EC\u505A\u6837\u5F0F\u5904\u7406\n const isSoundCore = data?.products?.length <= 5\n return (\n <div className={cn('w-full', className)}>\n {data?.title && <Title data={{ title: data?.title }} />}\n {isSoundCore ? (\n <SoundCoreCategoryItem data={data?.products} configuration={{ shape: data?.shape }} />\n ) : (\n <>\n <div className=\"tablet:block hidden\">\n <SwiperBox\n id={`Category${key}`}\n Slide={CategoryPcItem}\n data={{ list: data?.products, configuration: { shape: data?.shape } }}\n />\n </div>\n <div className=\"tablet:hidden block overflow-hidden\">\n <SwiperBox\n id={`Category1${key}`}\n Slide={CategoryMobileItem}\n data={{ list: chunkArray(data?.products, 6), configuration: { shape: data?.shape } }}\n />\n </div>\n </>\n )}\n </div>\n )\n}\n\nexport default withStyles(Category)\n"],
|
|
5
|
+
"mappings": "aAyCI,OAqCA,YAAAA,EA9BE,OAAAC,EAPF,QAAAC,MAAA,oBAxCJ,MAAkB,QAClB,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAa,8BACpB,OAAS,cAAAC,MAAkB,yBAC3B,OAAOC,MAAW,oBAClB,OAAOC,MAAe,sBAyBtB,MAAMC,EAAa,CAACC,EAAYC,IAAiB,CAC/C,MAAMC,EAAS,CAAC,EAChB,QAASC,EAAI,EAAGA,EAAIH,EAAI,OAAQG,GAAKF,EACnCC,EAAO,KAAKF,EAAI,MAAMG,EAAGA,EAAIF,CAAI,CAAC,EAEpC,OAAOC,CACT,EAEME,EAAiB,CAAC,CAAE,KAAAC,EAAM,cAAAC,CAAc,IAE1Cb,EAAC,OACC,UAAWC,EACT,+DACA,+DACAY,GAAe,QAAU,QAAU,iBAAmB,cACxD,EAEA,UAAAd,EAACG,EAAA,CAAQ,UAAU,uEAAuE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H,EACH,EACF,GACF,EAIEE,EAAoC,CAAC,CAAE,KAAAN,EAAM,UAAAO,EAAW,UAAAC,EAAY,GAAI,IAAAC,CAAI,IAAM,CAEtF,MAAMC,EAAcV,GAAM,UAAU,QAAU,EAC9C,OACEZ,EAAC,OAAI,UAAWC,EAAG,SAAUmB,CAAS,EACnC,UAAAR,GAAM,OAASb,EAACK,EAAA,CAAM,KAAM,CAAE,MAAOQ,GAAM,KAAM,EAAG,EACpDU,EACCvB,EAACkB,EAAA,CAAsB,KAAML,GAAM,SAAU,cAAe,CAAE,MAAOA,GAAM,KAAM,EAAG,EAEpFZ,EAAAF,EAAA,CACE,UAAAC,EAAC,OAAI,UAAU,sBACb,SAAAA,EAACM,EAAA,CACC,GAAI,WAAWgB,CAAG,GAClB,MAAOV,EACP,KAAM,CAAE,KAAMC,GAAM,SAAU,cAAe,CAAE,MAAOA,GAAM,KAAM,CAAE,EACtE,EACF,EACAb,EAAC,OAAI,UAAU,sCACb,SAAAA,EAACM,EAAA,CACC,GAAI,YAAYgB,CAAG,GACnB,MAAOP,EACP,KAAM,CAAE,KAAMR,EAAWM,GAAM,SAAU,CAAC,EAAG,cAAe,CAAE,MAAOA,GAAM,KAAM,CAAE,EACrF,EACF,GACF,GAEJ,CAEJ,EAEA,IAAOW,EAAQpB,EAAWe,CAAQ",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "cn", "Picture", "withStyles", "Title", "SwiperBox", "chunkArray", "arr", "size", "chunks", "i", "CategoryPcItem", "data", "configuration", "CategoryMobileItem", "item", "index", "SoundCoreCategoryItem", "Category", "buildData", "className", "key", "isSoundCore", "Category_default"]
|
|
7
7
|
}
|