@anker-in/headless-ui 0.0.27-alpha.34 → 0.0.27-alpha.37
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/ShelfDisplay/index.d.ts +6 -2
- package/dist/cjs/biz-components/ShelfDisplay/index.js +5 -5
- package/dist/cjs/biz-components/ShelfDisplay/index.js.map +3 -3
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.d.ts +23 -0
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.js +2 -0
- package/dist/cjs/biz-components/ShelfDisplay/shelfDisplay.js.map +7 -0
- package/dist/cjs/components/container.js +1 -1
- package/dist/cjs/components/container.js.map +2 -2
- package/dist/cjs/stories/shelfDisplay.stories.js +1 -1
- package/dist/cjs/stories/shelfDisplay.stories.js.map +2 -2
- package/dist/esm/biz-components/ShelfDisplay/index.d.ts +6 -2
- package/dist/esm/biz-components/ShelfDisplay/index.js +3 -3
- package/dist/esm/biz-components/ShelfDisplay/index.js.map +3 -3
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.d.ts +23 -0
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.js +2 -0
- package/dist/esm/biz-components/ShelfDisplay/shelfDisplay.js.map +7 -0
- package/dist/esm/components/container.js +1 -1
- package/dist/esm/components/container.js.map +2 -2
- package/dist/esm/stories/shelfDisplay.stories.js +1 -1
- package/dist/esm/stories/shelfDisplay.stories.js.map +2 -2
- package/package.json +1 -1
- package/style.css +6 -0
|
@@ -22,8 +22,8 @@ export interface ShelfDisplayProps {
|
|
|
22
22
|
title?: string;
|
|
23
23
|
isShowTab?: boolean;
|
|
24
24
|
align?: 'left' | 'center' | 'right';
|
|
25
|
-
productsTab?:
|
|
26
|
-
productsCard?:
|
|
25
|
+
productsTab?: any;
|
|
26
|
+
productsCard?: any;
|
|
27
27
|
/** 卡片形状 */
|
|
28
28
|
itemShape?: 'round' | 'square';
|
|
29
29
|
/** 按钮形状 */
|
|
@@ -35,6 +35,10 @@ export interface ShelfDisplayProps {
|
|
|
35
35
|
/** 副按钮配置 */
|
|
36
36
|
secondaryButton?: string;
|
|
37
37
|
};
|
|
38
|
+
buildData?: {
|
|
39
|
+
categories: any[];
|
|
40
|
+
products: any[];
|
|
41
|
+
};
|
|
38
42
|
/** 主题色*/
|
|
39
43
|
theme?: 'light' | 'dark';
|
|
40
44
|
className?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var V=Object.create;var b=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var M=Object.getOwnPropertyNames;var L=Object.getPrototypeOf,R=Object.prototype.hasOwnProperty;var U=(e,r)=>{for(var s in r)b(e,s,{get:r[s],enumerable:!0})},w=(e,r,s,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let a of M(r))!R.call(e,a)&&a!==s&&b(e,a,{get:()=>r[a],enumerable:!(l=q(r,a))||l.enumerable});return e};var f=(e,r,s)=>(s=e!=null?V(L(e)):{},w(r||!e||!e.__esModule?b(s,"default",{value:e,enumerable:!0}):s,e)),$=e=>w(b({},"__esModule",{value:!0}),e);var G={};U(G,{default:()=>_});module.exports=$(G);var t=require("react/jsx-runtime"),m=require("react"),y=require("../../helpers/utils.js"),B=f(require("../../components/picture.js")),d=require("../../components/tabs.js"),g=f(require("../../components/button.js")),N=f(require("../Title/index.js")),T=f(require("../SwiperBox/index.js")),C=require("../../shared/Styles.js"),I=require("./shelfDisplay.js");const j=({data:e,configuration:r})=>{const s=n=>{},l=n=>{},{price:a,basePrice:u}=(0,I.formatVariantPrice)({amount:e?.price.amount||0,baseAmount:e?.compareAtPrice?.amount||e?.price.amount||0,currencyCode:e?.price.currencyCode||"USD",locale:"us"}),k=()=>{const n=e?.sku,o=e?.variants;return o?.find(x=>x?.sku===n)?.image?.url||o?.[0]?.image?.url||""};return(0,t.jsxs)("div",{className:(0,y.cn)("desktop:pt-4 desktop:px-6 desktop:pb-6 flex size-full cursor-pointer flex-col overflow-hidden bg-[#EAEAEC] p-4",r?.itemShape==="round"?"rounded-2xl":"rounded-none"),children:[(0,t.jsx)("div",{className:(0,y.cn)("relative mb-2 inline-block h-[137px] overflow-hidden","desktop:mb-3 desktop:h-[195px]"),children:(0,t.jsx)(B.default,{source:k(),className:"flex h-full justify-center object-cover [&_img]:w-auto"})}),(0,t.jsx)("div",{className:"desktop:mb-2 mb-1 flex h-8 flex-wrap gap-1",children:e?.tags?.slice(0,1)?.map?.((n,o)=>(0,t.jsx)("div",{className:"desktop:text-base rounded-3xl border-2 border-[#00BEFA] px-2 py-1 text-sm font-bold text-[#00BEFA]",children:n},o))}),(0,t.jsx)("p",{title:e?.title||"",className:"desktop:text-2xl line-clamp-2 max-h-[48px] flex-1 text-xl font-bold leading-[1.2] tracking-[-0.04em] text-[#1D1D1F]",children:e?.title||""}),(0,t.jsx)("h3",{title:e?.description||"",className:"desktop:mt-2 desktop:mb-6 desktop:text-lg mb-5 mt-1 truncate text-sm font-semibold leading-[1.2] tracking-[-0.02em] text-[#1D1D1F]",children:e?.description||""}),(0,t.jsxs)("div",{className:"mb-2 flex items-center",children:[(0,t.jsx)("div",{className:"desktop:text-2xl text-xl font-bold text-[#1D1D1F]",children:a||""}),(0,t.jsx)("div",{className:"desktop:text-2xl ml-1 text-xl font-bold text-[#86868C]",children:u||""})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsx)(g.default,{variant:"primary",onClick:()=>s(e),className:`
|
|
2
2
|
laptop:text-sm desktop:text-base laptop:px-6 desktop:px-7 laptop:py-2.5 desktop:py-3 box-border flex-1 border
|
|
3
3
|
border-[#1D1D1F] bg-transparent px-4 py-2 text-xs tracking-[-0.04em] text-[#1D1D1F] hover:bg-transparent hover:text-black
|
|
4
|
-
${
|
|
5
|
-
`,children:
|
|
4
|
+
${r?.shape==="round"?"desktop:rounded-3xl rounded-[20px]":""}
|
|
5
|
+
`,children:r?.primaryButton||""}),(0,t.jsx)(g.default,{variant:"secondary",onClick:()=>l(e),className:`
|
|
6
6
|
laptop:text-sm desktop:text-base laptop:px-6 desktop:px-7 laptop:py-2.5 desktop:py-3 box-border flex-1 border
|
|
7
7
|
border-[#1D1D1F] bg-[#1D1D1F] px-4 py-2 text-xs tracking-[-0.04em] text-white
|
|
8
|
-
${
|
|
9
|
-
`,children:
|
|
8
|
+
${r?.shape==="round"?"desktop:rounded-3xl rounded-[20px]":""}
|
|
9
|
+
`,children:r?.secondaryButton||""})]})]},e?.id||e?.handle)},z=({data:e,buildData:r,className:s="",key:l})=>{const[a,u]=(0,m.useState)(""),[k,n]=(0,m.useState)([]),{productsTab:o=[],productsCard:v=[],title:x,align:P="left",isShowTab:D=!0,tabShape:F="square",...A}=e,h=i=>{const c=i?.map(p=>{const S=r?.products?.find(E=>E?.handle===p?.handle);if(S)return{sku:p.sku,...S}})?.filter(p=>p);n(c)};return(0,m.useEffect)(()=>{if(D){u(o?.[0]?.tab||""),h(o?.[0]?.data||[]);return}h(v)},[]),(0,t.jsxs)("div",{className:(0,y.cn)("w-full",s),children:[x&&(0,t.jsx)(N.default,{data:{title:x}}),D&&(0,t.jsx)(d.Tabs,{shape:F,align:P,value:a,onValueChange:i=>{u(i);const c=o?.find(p=>p?.tab===i);h(c?.data||[])},className:"mb-8",children:(0,t.jsx)(d.TabsList,{children:o?.map((i,c)=>(0,t.jsx)(d.TabsTrigger,{value:i?.tab||"",children:i?.tab},c))})}),(0,t.jsx)(T.default,{className:"!overflow-visible",id:"ShelfDisplay"+l,data:{list:k,configuration:{...A}},Slide:j,breakpoints:{0:{spaceBetween:"12px",freeMode:!1,slidesPerView:1},374:{spaceBetween:"12px",freeMode:!1,slidesPerView:1.3},768:{spaceBetween:"16px",freeMode:!1,slidesPerView:4}}})]})};var _=(0,C.withStyles)(z);
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/ShelfDisplay/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useState, useEffect } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { Tabs, TabsList, TabsTrigger } from '../../components/tabs.js'\nimport Button from '../../components/button.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport {
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["ShelfDisplay_exports", "__export", "ShelfDisplay_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_picture", "import_tabs", "import_button", "import_Title", "import_SwiperBox", "import_Styles", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useState, useEffect } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { Tabs, TabsList, TabsTrigger } from '../../components/tabs.js'\nimport Button from '../../components/button.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport { formatVariantPrice } from './shelfDisplay.js'\nexport interface ShelfDisplayItem {\n id?: string\n /** \u4EA7\u54C1\u56FE\u7247*/\n img?: {\n url: string\n }\n handle?: string\n sku?: string\n /** \u6298\u6263\u540E\u4EF7\u683C*/\n price?: string\n title?: string\n /** \u6298\u6263\u524D\u4EF7\u683C*/\n basePrice?: string\n subTitle?: string\n /** \u6807\u7B7E*/\n tagItems?: string[]\n tab?: string\n data?: ShelfDisplayItem[]\n}\n\nexport interface ShelfDisplayProps {\n data: {\n title?: string\n isShowTab?: boolean\n align?: 'left' | 'center' | 'right'\n productsTab?: any\n productsCard?: any\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u6807\u7B7E\u9875\u5F62\u72B6*/\n tabShape?: 'rounded' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n /** \u526F\u6309\u94AE\u914D\u7F6E */\n secondaryButton?: string\n }\n buildData?: {\n categories: any[]\n products: any[]\n }\n /** \u4E3B\u9898\u8272*/\n theme?: 'light' | 'dark'\n className?: string\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: {\n onClick: (v: any) => void\n }\n secondaryButton?: {\n onClick: (v: any) => void\n }\n }\n key?: string\n}\n\nconst ShelfDisplayItem = ({ data, configuration }: { data: any; configuration?: any }) => {\n const onPrimaryButton = (params: ShelfDisplayItem) => {\n // event?.primaryButton?.onClick?.(params)\n }\n\n const onSecondaryButton = (params: ShelfDisplayItem) => {\n // event?.secondaryButton?.onClick(params)\n }\n\n const { price, basePrice } = formatVariantPrice({\n amount: data?.price.amount || 0,\n baseAmount: data?.compareAtPrice?.amount || data?.price.amount || 0,\n currencyCode: data?.price.currencyCode || 'USD',\n locale: 'us',\n })\n\n const handleUrl = () => {\n const sku = data?.sku\n const skuArray = data?.variants\n const findSku = skuArray?.find((item: any) => item?.sku === sku)\n return findSku?.image?.url || skuArray?.[0]?.image?.url || ''\n }\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n 'desktop:pt-4 desktop:px-6 desktop:pb-6 flex size-full cursor-pointer flex-col overflow-hidden bg-[#EAEAEC] p-4',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <div className={cn('relative mb-2 inline-block h-[137px] overflow-hidden', 'desktop:mb-3 desktop:h-[195px]')}>\n <Picture source={handleUrl()} className=\"flex h-full justify-center object-cover [&_img]:w-auto\" />\n </div>\n <div className=\"desktop:mb-2 mb-1 flex h-8 flex-wrap gap-1\">\n {data?.tags?.slice(0, 1)?.map?.((item: any, index: number) => {\n return (\n <div\n key={index}\n className=\"desktop:text-base rounded-3xl border-2 border-[#00BEFA] px-2 py-1 text-sm font-bold text-[#00BEFA]\"\n >\n {item}\n </div>\n )\n })}\n </div>\n <p\n title={data?.title || ''}\n className=\"desktop:text-2xl line-clamp-2 max-h-[48px] flex-1 text-xl font-bold leading-[1.2] tracking-[-0.04em] text-[#1D1D1F]\"\n >\n {data?.title || ''}\n </p>\n <h3\n title={data?.description || ''}\n className=\"desktop:mt-2 desktop:mb-6 desktop:text-lg mb-5 mt-1 truncate text-sm font-semibold leading-[1.2] tracking-[-0.02em] text-[#1D1D1F]\"\n >\n {data?.description || ''}\n </h3>\n <div className=\"mb-2 flex items-center\">\n <div className=\"desktop:text-2xl text-xl font-bold text-[#1D1D1F]\">{price || ''}</div>\n <div className=\"desktop:text-2xl ml-1 text-xl font-bold text-[#86868C]\">{basePrice || ''}</div>\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"flex items-center gap-3\">\n <Button\n variant=\"primary\"\n onClick={() => onPrimaryButton(data)}\n className={`\n laptop:text-sm desktop:text-base laptop:px-6 desktop:px-7 laptop:py-2.5 desktop:py-3 box-border flex-1 border\n border-[#1D1D1F] bg-transparent px-4 py-2 text-xs tracking-[-0.04em] text-[#1D1D1F] hover:bg-transparent hover:text-black\n ${configuration?.shape === 'round' ? 'desktop:rounded-3xl rounded-[20px]' : ''}\n `}\n >\n {configuration?.primaryButton || ''}\n </Button>\n <Button\n variant=\"secondary\"\n onClick={() => onSecondaryButton(data)}\n className={`\n laptop:text-sm desktop:text-base laptop:px-6 desktop:px-7 laptop:py-2.5 desktop:py-3 box-border flex-1 border\n border-[#1D1D1F] bg-[#1D1D1F] px-4 py-2 text-xs tracking-[-0.04em] text-white\n ${configuration?.shape === 'round' ? 'desktop:rounded-3xl rounded-[20px]' : ''}\n `}\n >\n {configuration?.secondaryButton || ''}\n </Button>\n </div>\n </div>\n )\n}\n\nconst ShelfDisplay: React.FC<ShelfDisplayProps> = ({ data, buildData, className = '', key }) => {\n const [tabId, setTabId] = useState<string>('')\n const [currentItems, setCurrentItems] = useState<ShelfDisplayItem[]>([])\n\n const {\n productsTab = [],\n productsCard = [],\n title,\n align = 'left',\n isShowTab = true,\n tabShape = 'square',\n ...other\n } = data\n\n const handleCurrentTab = (currentData: ShelfDisplayItem[]) => {\n const newCurrentData = currentData\n ?.map(item => {\n const findData = buildData?.products?.find(params => params?.handle === item?.handle)\n if (findData) {\n return {\n sku: item.sku,\n ...findData,\n }\n }\n })\n ?.filter(item => item)\n setCurrentItems(newCurrentData)\n }\n\n useEffect(() => {\n if (isShowTab) {\n setTabId(productsTab?.[0]?.tab || '')\n handleCurrentTab(productsTab?.[0]?.data || [])\n return\n }\n handleCurrentTab(productsCard)\n }, [])\n\n return (\n <div className={cn('w-full', className)}>\n {title && <Title data={{ title: title }} />}\n {isShowTab && (\n <Tabs\n shape={tabShape}\n align={align}\n value={tabId}\n onValueChange={v => {\n setTabId(v)\n const findData = productsTab?.find((item: any) => item?.tab === v)\n handleCurrentTab(findData?.data || [])\n }}\n className=\"mb-8\"\n >\n <TabsList>\n {productsTab?.map((item: any, index: number) => {\n return (\n <TabsTrigger key={index} value={item?.tab || ''}>\n {item?.tab}\n </TabsTrigger>\n )\n })}\n </TabsList>\n </Tabs>\n )}\n <SwiperBox\n className=\"!overflow-visible\"\n id={'ShelfDisplay' + key}\n data={{ list: currentItems, configuration: { ...other } }}\n Slide={ShelfDisplayItem}\n breakpoints={{\n 0: {\n spaceBetween: '12px',\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: '12px',\n freeMode: false,\n slidesPerView: 1.3,\n },\n 768: {\n spaceBetween: '16px',\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n </div>\n )\n}\n\nexport default withStyles(ShelfDisplay)\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["ShelfDisplay_exports", "__export", "ShelfDisplay_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_picture", "import_tabs", "import_button", "import_Title", "import_SwiperBox", "import_Styles", "import_shelfDisplay", "ShelfDisplayItem", "data", "configuration", "onPrimaryButton", "params", "onSecondaryButton", "price", "basePrice", "handleUrl", "sku", "skuArray", "item", "Picture", "index", "Button", "ShelfDisplay", "buildData", "className", "key", "tabId", "setTabId", "currentItems", "setCurrentItems", "productsTab", "productsCard", "title", "align", "isShowTab", "tabShape", "other", "handleCurrentTab", "currentData", "newCurrentData", "findData", "Title", "v", "SwiperBox"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const PRICE_SYMBOL: any;
|
|
2
|
+
export declare const languageTerritory: (locale: string) => string;
|
|
3
|
+
export declare function formatPrice({ amount, currencyCode, locale, maximumFractionDigits, minimumFractionDigits, removeTrailingZeros, }: {
|
|
4
|
+
amount: number;
|
|
5
|
+
currencyCode: string;
|
|
6
|
+
locale: string;
|
|
7
|
+
maximumFractionDigits?: number;
|
|
8
|
+
minimumFractionDigits?: number;
|
|
9
|
+
removeTrailingZeros?: boolean;
|
|
10
|
+
}): string;
|
|
11
|
+
export declare function formatVariantPrice({ amount, baseAmount, currencyCode, locale, maximumFractionDigits, minimumFractionDigits, removeTrailingZeros, }: {
|
|
12
|
+
baseAmount: number;
|
|
13
|
+
amount: number;
|
|
14
|
+
currencyCode: string;
|
|
15
|
+
locale: string;
|
|
16
|
+
maximumFractionDigits?: number;
|
|
17
|
+
minimumFractionDigits?: number;
|
|
18
|
+
removeTrailingZeros?: boolean;
|
|
19
|
+
}): {
|
|
20
|
+
price: string;
|
|
21
|
+
basePrice: string | undefined;
|
|
22
|
+
discount: string | null;
|
|
23
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";var o=Object.defineProperty;var p=Object.getOwnPropertyDescriptor;var $=Object.getOwnPropertyNames;var y=Object.prototype.hasOwnProperty;var D=(r,e)=>{for(var t in e)o(r,t,{get:e[t],enumerable:!0})},F=(r,e,t,n)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of $(e))!y.call(r,i)&&i!==t&&o(r,i,{get:()=>e[i],enumerable:!(n=p(e,i))||n.enumerable});return r};var v=r=>F(o({},"__esModule",{value:!0}),r);var P={};D(P,{PRICE_SYMBOL:()=>c,formatPrice:()=>f,formatVariantPrice:()=>x,languageTerritory:()=>m});module.exports=v(P);const c={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED"},m=r=>({us:"en-us",uk:"en-gb",ca:"en-ca",au:"en-au",eu:"en",fr:"fr-fr",de:"de-de",vn:"vi-vn",sg:"en-sg","ae-en":"ae-en",plus:"en-us",cl:"es-cl"})[r]||"";function f({amount:r,currencyCode:e,locale:t,maximumFractionDigits:n,minimumFractionDigits:i,removeTrailingZeros:s=!1}){let u=new Intl.NumberFormat(m(t),{style:"currency",currency:e||"USD",minimumFractionDigits:n===0?0:i,maximumFractionDigits:n}).format(r);return["eu-de","eu-en","de","eu"].includes(t)&&(u=u?.toString()?.replace(/[\s]/g,"")),s&&(u=u.replace(/(\.\d*?[1-9])0+\b/,"$1").replace(/\.0+\b/,"").replace(/(\,\d*?[1-9])0+\b/,"$1").replace(/\,0+\b/,"")),u}function x({amount:r,baseAmount:e,currencyCode:t,locale:n,maximumFractionDigits:i,minimumFractionDigits:s,removeTrailingZeros:a}){if(typeof Intl>"u")return{price:`${c[n]}${r}`,basePrice:`${c[n]}${e}`,discount:`${c[n]}${e-r||0}`};const u=e>r,g=new Intl.NumberFormat(m(n),{style:"percent"}),d=u?g.format((e-r)/e):null,l=f({amount:r,currencyCode:t,locale:n,removeTrailingZeros:a}),b=u?f({amount:e,currencyCode:t,locale:n,maximumFractionDigits:i,minimumFractionDigits:s,removeTrailingZeros:a}):void 0;return{price:l,basePrice:b,discount:d}}
|
|
2
|
+
//# sourceMappingURL=shelfDisplay.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/ShelfDisplay/shelfDisplay.ts"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-useless-escape */\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n} as any\n\nexport const languageTerritory = (locale: string) =>\n // https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_territory_information.html\n ({\n us: 'en-us',\n uk: 'en-gb',\n ca: 'en-ca',\n au: 'en-au',\n eu: 'en',\n fr: 'fr-fr',\n de: 'de-de',\n vn: 'vi-vn',\n sg: 'en-sg',\n 'ae-en': 'ae-en',\n plus: 'en-us',\n cl: 'es-cl',\n })[locale] || ''\n\nexport function formatPrice({\n amount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros = false,\n}: {\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n const formatCurrency = new Intl.NumberFormat(languageTerritory(locale), {\n style: 'currency',\n currency: currencyCode || 'USD',\n minimumFractionDigits: maximumFractionDigits === 0 ? 0 : minimumFractionDigits,\n maximumFractionDigits,\n })\n\n let formattedValue = formatCurrency.format(amount)\n\n if (['eu-de', 'eu-en', 'de', 'eu'].includes(locale)) {\n formattedValue = formattedValue?.toString()?.replace(/[\\s]/g, '')\n }\n\n if (removeTrailingZeros) {\n // Adjust the regex to match comma as decimal separator\n formattedValue = formattedValue\n .replace(/(\\.\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\.0+\\b/, '')\n .replace(/(\\,\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\,0+\\b/, '')\n }\n\n return formattedValue\n}\n\nexport function formatVariantPrice({\n amount,\n baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n}: {\n baseAmount: number\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n if (typeof Intl === 'undefined') {\n return {\n price: `${PRICE_SYMBOL[locale]}${amount}`,\n basePrice: `${PRICE_SYMBOL[locale]}${baseAmount}`,\n discount: `${PRICE_SYMBOL[locale]}${baseAmount - amount || 0}`,\n }\n }\n\n const hasDiscount = baseAmount > amount\n const formatDiscount = new Intl.NumberFormat(languageTerritory(locale), {\n style: 'percent',\n })\n const discount = hasDiscount ? formatDiscount.format((baseAmount - amount) / baseAmount) : null\n\n const price = formatPrice({ amount, currencyCode, locale, removeTrailingZeros })\n const basePrice = hasDiscount\n ? formatPrice({\n amount: baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n })\n : undefined\n\n return { price, basePrice, discount }\n}\n"],
|
|
5
|
+
"mappings": "yaAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,kBAAAE,EAAA,gBAAAC,EAAA,uBAAAC,EAAA,sBAAAC,IAAA,eAAAC,EAAAN,GACO,MAAME,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,KACN,EAEaG,EAAqBE,IAE/B,CACC,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,KACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,QAAS,QACT,KAAM,QACN,GAAI,OACN,GAAGA,CAAM,GAAK,GAET,SAASJ,EAAY,CAC1B,OAAAK,EACA,aAAAC,EACA,OAAAF,EACA,sBAAAG,EACA,sBAAAC,EACA,oBAAAC,EAAsB,EACxB,EAOG,CAQD,IAAIC,EAPmB,IAAI,KAAK,aAAaR,EAAkBE,CAAM,EAAG,CACtE,MAAO,WACP,SAAUE,GAAgB,MAC1B,sBAAuBC,IAA0B,EAAI,EAAIC,EACzD,sBAAAD,CACF,CAAC,EAEmC,OAAOF,CAAM,EAEjD,MAAI,CAAC,QAAS,QAAS,KAAM,IAAI,EAAE,SAASD,CAAM,IAChDM,EAAiBA,GAAgB,SAAS,GAAG,QAAQ,QAAS,EAAE,GAG9DD,IAEFC,EAAiBA,EACd,QAAQ,oBAAqB,IAAI,EACjC,QAAQ,SAAU,EAAE,EACpB,QAAQ,oBAAqB,IAAI,EACjC,QAAQ,SAAU,EAAE,GAGlBA,CACT,CAEO,SAAST,EAAmB,CACjC,OAAAI,EACA,WAAAM,EACA,aAAAL,EACA,OAAAF,EACA,sBAAAG,EACA,sBAAAC,EACA,oBAAAC,CACF,EAQG,CACD,GAAI,OAAO,KAAS,IAClB,MAAO,CACL,MAAO,GAAGV,EAAaK,CAAM,CAAC,GAAGC,CAAM,GACvC,UAAW,GAAGN,EAAaK,CAAM,CAAC,GAAGO,CAAU,GAC/C,SAAU,GAAGZ,EAAaK,CAAM,CAAC,GAAGO,EAAaN,GAAU,CAAC,EAC9D,EAGF,MAAMO,EAAcD,EAAaN,EAC3BQ,EAAiB,IAAI,KAAK,aAAaX,EAAkBE,CAAM,EAAG,CACtE,MAAO,SACT,CAAC,EACKU,EAAWF,EAAcC,EAAe,QAAQF,EAAaN,GAAUM,CAAU,EAAI,KAErFI,EAAQf,EAAY,CAAE,OAAAK,EAAQ,aAAAC,EAAc,OAAAF,EAAQ,oBAAAK,CAAoB,CAAC,EACzEO,EAAYJ,EACdZ,EAAY,CACV,OAAQW,EACR,aAAAL,EACA,OAAAF,EACA,sBAAAG,EACA,sBAAAC,EACA,oBAAAC,CACF,CAAC,EACD,OAEJ,MAAO,CAAE,MAAAM,EAAO,UAAAC,EAAW,SAAAF,CAAS,CACtC",
|
|
6
|
+
"names": ["shelfDisplay_exports", "__export", "PRICE_SYMBOL", "formatPrice", "formatVariantPrice", "languageTerritory", "__toCommonJS", "locale", "amount", "currencyCode", "maximumFractionDigits", "minimumFractionDigits", "removeTrailingZeros", "formattedValue", "baseAmount", "hasDiscount", "formatDiscount", "discount", "price", "basePrice"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var f=Object.create;var a=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var
|
|
1
|
+
"use strict";"use client";var f=Object.create;var a=Object.defineProperty;var C=Object.getOwnPropertyDescriptor;var u=Object.getOwnPropertyNames;var b=Object.getPrototypeOf,h=Object.prototype.hasOwnProperty;var k=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},d=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let p of u(t))!h.call(e,p)&&p!==o&&a(e,p,{get:()=>t[p],enumerable:!(n=C(t,p))||n.enumerable});return e};var v=(e,t,o)=>(o=e!=null?f(b(e)):{},d(t||!e||!e.__esModule?a(o,"default",{value:e,enumerable:!0}):o,e)),w=e=>d(a({},"__esModule",{value:!0}),e);var N={};k(N,{Container:()=>s});module.exports=w(N);var r=require("react/jsx-runtime"),m=v(require("react")),l=require("../helpers/utils.js"),c=require("@radix-ui/react-slot");const s=m.default.forwardRef(({...e},t)=>{const{asChild:o,children:n,className:p,overflow:y,...x}=e,i=o?c.Slot:"div";return(0,m.useMemo)(()=>y==="hidden"?(0,r.jsx)("div",{className:(0,l.cn)("overflow-hidden","tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]",p),children:(0,r.jsx)(i,{className:(0,l.cn)("mx-auto box-border w-full max-w-[1772px]","tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-32 px-8"),...x,ref:t,children:n})}):(0,r.jsx)(i,{...x,ref:t,className:(0,l.cn)("mx-auto box-content w-full max-w-[1664px]","tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-32 px-8","tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]",p),children:n}),[e])});s.displayName="Container";
|
|
2
2
|
//# sourceMappingURL=container.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/container.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useMemo } from 'react'\nimport { cn } from '../helpers/utils.js'\nimport { Slot } from '@radix-ui/react-slot'\n\ntype ContainerElement = React.ElementRef<'div'>\ntype ContainerProps = {\n asChild?: boolean\n children?: React.ReactNode\n className?: string\n overflow?: 'hidden'\n} & React.ComponentPropsWithoutRef<'div'>\nconst Container = React.forwardRef<ContainerElement, ContainerProps>(({ ...props }, forwardedRef) => {\n const { asChild, children, className, overflow, ...containerProps } = props\n const Comp = asChild ? Slot : 'div'\n\n const content = useMemo(() => {\n if (overflow === 'hidden') {\n return (\n <div\n className={cn(\n 'overflow-hidden',\n 'tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]',\n className\n )}\n >\n <Comp\n className={cn(\n 'mx-auto box-
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GA0BU,IAAAI,EAAA,6BAzBVC,EAA+B,oBAC/BC,EAAmB,+BACnBC,EAAqB,gCASrB,MAAML,EAAY,EAAAM,QAAM,WAA6C,CAAC,CAAE,GAAGC,CAAM,EAAGC,IAAiB,CACnG,KAAM,CAAE,QAAAC,EAAS,SAAAC,EAAU,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAe,EAAIN,EAChEO,EAAOL,EAAU,OAAO,MAyC9B,SAvCgB,WAAQ,IAClBG,IAAa,YAEb,OAAC,OACC,aAAW,MACT,kBACA,uFACAD,CACF,EAEA,mBAACG,EAAA,CACC,aAAW,MACT,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useMemo } from 'react'\nimport { cn } from '../helpers/utils.js'\nimport { Slot } from '@radix-ui/react-slot'\n\ntype ContainerElement = React.ElementRef<'div'>\ntype ContainerProps = {\n asChild?: boolean\n children?: React.ReactNode\n className?: string\n overflow?: 'hidden'\n} & React.ComponentPropsWithoutRef<'div'>\nconst Container = React.forwardRef<ContainerElement, ContainerProps>(({ ...props }, forwardedRef) => {\n const { asChild, children, className, overflow, ...containerProps } = props\n const Comp = asChild ? Slot : 'div'\n\n const content = useMemo(() => {\n if (overflow === 'hidden') {\n return (\n <div\n className={cn(\n 'overflow-hidden',\n 'tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]',\n className\n )}\n >\n <Comp\n className={cn(\n 'mx-auto box-border w-full max-w-[1772px]',\n 'tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-32 px-8'\n )}\n {...containerProps}\n ref={forwardedRef}\n >\n {children}\n </Comp>\n </div>\n )\n }\n return (\n <Comp\n {...containerProps}\n ref={forwardedRef}\n className={cn(\n 'mx-auto box-content w-full max-w-[1664px]',\n 'tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-32 px-8',\n 'tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]',\n className\n )}\n >\n {children}\n </Comp>\n )\n }, [props])\n\n return content\n})\n\nContainer.displayName = 'Container'\n\nexport { Container }\nexport type { ContainerProps }\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,eAAAE,IAAA,eAAAC,EAAAH,GA0BU,IAAAI,EAAA,6BAzBVC,EAA+B,oBAC/BC,EAAmB,+BACnBC,EAAqB,gCASrB,MAAML,EAAY,EAAAM,QAAM,WAA6C,CAAC,CAAE,GAAGC,CAAM,EAAGC,IAAiB,CACnG,KAAM,CAAE,QAAAC,EAAS,SAAAC,EAAU,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAe,EAAIN,EAChEO,EAAOL,EAAU,OAAO,MAyC9B,SAvCgB,WAAQ,IAClBG,IAAa,YAEb,OAAC,OACC,aAAW,MACT,kBACA,uFACAD,CACF,EAEA,mBAACG,EAAA,CACC,aAAW,MACT,2CACA,8DACF,EACC,GAAGD,EACJ,IAAKL,EAEJ,SAAAE,EACH,EACF,KAIF,OAACI,EAAA,CACE,GAAGD,EACJ,IAAKL,EACL,aAAW,MACT,4CACA,+DACA,uFACAG,CACF,EAEC,SAAAD,EACH,EAED,CAACH,CAAK,CAAC,CAGZ,CAAC,EAEDP,EAAU,YAAc",
|
|
6
6
|
"names": ["container_exports", "__export", "Container", "__toCommonJS", "import_jsx_runtime", "import_react", "import_utils", "import_react_slot", "React", "props", "forwardedRef", "asChild", "children", "className", "overflow", "containerProps", "Comp"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var n=Object.create;var a=Object.defineProperty;var m=Object.getOwnPropertyDescriptor;var l=Object.getOwnPropertyNames;var f=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var y=(e,t)=>{for(var o in t)a(e,o,{get:t[o],enumerable:!0})},i=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of l(t))!u.call(e,r)&&r!==o&&a(e,r,{get:()=>t[r],enumerable:!(s=m(t,r))||s.enumerable});return e};var d=(e,t,o)=>(o=e!=null?n(f(e)):{},i(t||!e||!e.__esModule?a(o,"default",{value:e,enumerable:!0}):o,e)),b=e=>i(a({},"__esModule",{value:!0}),e);var B={};y(B,{Default:()=>S,Round:()=>P,default:()=>h});module.exports=b(B);var c=d(require("../biz-components/ShelfDisplay/index.js"));const g={title:"Biz-Components/ShelfDisplay",component:c.default,parameters:{layout:"fullscreen"},tags:["autodocs"]};var h=g;const p=[{price:"$1,999.00",basePrice:"$2,999.00",subTitle:"Fast Charging for 3 Devices",title:"Anker Prime 27,650mAh Power Bank (250W)",tagItems:["New","20% OFF"],img:{url:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554"}},{price:"$1,999.00",basePrice:"$2,999.00",subTitle:"Fast Charging for 3 Devices",title:"Anker Prime 27,650mAh Power Bank (250W)",tagItems:["New","20% OFF"],img:{url:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554"}}],S={args:{data:{productsCard:p,primaryButton:"Learn More",secondaryButton:"Shop Now"},className:"p-4"}},P={args:{data:{productsCard:p,shape:"round",itemShape:"round",primaryButton:"Learn More",secondaryButton:"Shop Now"},className:"p-4"}};
|
|
2
2
|
//# sourceMappingURL=shelfDisplay.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/stories/shelfDisplay.stories.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport ShelfDisplay from '../biz-components/ShelfDisplay/index.js'\n\nconst meta = {\n title: 'Biz-Components/ShelfDisplay',\n component: ShelfDisplay,\n parameters: {\n layout: 'fullscreen',\n },\n tags: ['autodocs'],\n} satisfies Meta<typeof ShelfDisplay>\n\nexport default meta\ntype Story = StoryObj<typeof meta>\n\nconst mockItems = [\n {\n price: '$1,999.00',\n basePrice: '$2,999.00',\n subTitle: 'Fast Charging for 3 Devices',\n title: 'Anker Prime 27,650mAh Power Bank (250W)',\n tagItems: ['New', '20% OFF'],\n img: {\n url: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',\n },\n },\n {\n price: '$1,999.00',\n basePrice: '$2,999.00',\n subTitle: 'Fast Charging for 3 Devices',\n title: 'Anker Prime 27,650mAh Power Bank (250W)',\n tagItems: ['New', '20% OFF'],\n img: {\n url: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',\n },\n },\n
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,UAAAC,EAAA,YAAAC,IAAA,eAAAC,EAAAL,GACA,IAAAM,EAAyB,sDAEzB,MAAMC,EAAO,CACX,MAAO,8BACP,UAAW,EAAAC,QACX,WAAY,CACV,OAAQ,YACV,EACA,KAAM,CAAC,UAAU,CACnB,EAEA,IAAOJ,EAAQG,EAGf,MAAME,EAAY,CAChB,CACE,MAAO,YACP,UAAW,YACX,SAAU,8BACV,MAAO,0CACP,SAAU,CAAC,MAAO,SAAS,EAC3B,IAAK,CACH,IAAK,8HACP,CACF,EACA,CACE,MAAO,YACP,UAAW,YACX,SAAU,8BACV,MAAO,0CACP,SAAU,CAAC,MAAO,SAAS,EAC3B,IAAK,CACH,IAAK,8HACP,CACF,
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport ShelfDisplay from '../biz-components/ShelfDisplay/index.js'\n\nconst meta = {\n title: 'Biz-Components/ShelfDisplay',\n component: ShelfDisplay,\n parameters: {\n layout: 'fullscreen',\n },\n tags: ['autodocs'],\n} satisfies Meta<typeof ShelfDisplay>\n\nexport default meta\ntype Story = StoryObj<typeof meta>\n\nconst mockItems = [\n {\n price: '$1,999.00',\n basePrice: '$2,999.00',\n subTitle: 'Fast Charging for 3 Devices',\n title: 'Anker Prime 27,650mAh Power Bank (250W)',\n tagItems: ['New', '20% OFF'],\n img: {\n url: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',\n },\n },\n {\n price: '$1,999.00',\n basePrice: '$2,999.00',\n subTitle: 'Fast Charging for 3 Devices',\n title: 'Anker Prime 27,650mAh Power Bank (250W)',\n tagItems: ['New', '20% OFF'],\n img: {\n url: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',\n },\n },\n]\n\nexport const Default: Story = {\n args: {\n data: {\n productsCard: mockItems,\n primaryButton: 'Learn More',\n secondaryButton: 'Shop Now',\n },\n className: 'p-4',\n },\n}\n\nexport const Round: Story = {\n args: {\n data: {\n productsCard: mockItems,\n shape: 'round',\n itemShape: 'round',\n primaryButton: 'Learn More',\n secondaryButton: 'Shop Now',\n },\n className: 'p-4',\n },\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,UAAAC,EAAA,YAAAC,IAAA,eAAAC,EAAAL,GACA,IAAAM,EAAyB,sDAEzB,MAAMC,EAAO,CACX,MAAO,8BACP,UAAW,EAAAC,QACX,WAAY,CACV,OAAQ,YACV,EACA,KAAM,CAAC,UAAU,CACnB,EAEA,IAAOJ,EAAQG,EAGf,MAAME,EAAY,CAChB,CACE,MAAO,YACP,UAAW,YACX,SAAU,8BACV,MAAO,0CACP,SAAU,CAAC,MAAO,SAAS,EAC3B,IAAK,CACH,IAAK,8HACP,CACF,EACA,CACE,MAAO,YACP,UAAW,YACX,SAAU,8BACV,MAAO,0CACP,SAAU,CAAC,MAAO,SAAS,EAC3B,IAAK,CACH,IAAK,8HACP,CACF,CACF,EAEaP,EAAiB,CAC5B,KAAM,CACJ,KAAM,CACJ,aAAcO,EACd,cAAe,aACf,gBAAiB,UACnB,EACA,UAAW,KACb,CACF,EAEaN,EAAe,CAC1B,KAAM,CACJ,KAAM,CACJ,aAAcM,EACd,MAAO,QACP,UAAW,QACX,cAAe,aACf,gBAAiB,UACnB,EACA,UAAW,KACb,CACF",
|
|
6
6
|
"names": ["shelfDisplay_stories_exports", "__export", "Default", "Round", "shelfDisplay_stories_default", "__toCommonJS", "import_ShelfDisplay", "meta", "ShelfDisplay", "mockItems"]
|
|
7
7
|
}
|
|
@@ -22,8 +22,8 @@ export interface ShelfDisplayProps {
|
|
|
22
22
|
title?: string;
|
|
23
23
|
isShowTab?: boolean;
|
|
24
24
|
align?: 'left' | 'center' | 'right';
|
|
25
|
-
productsTab?:
|
|
26
|
-
productsCard?:
|
|
25
|
+
productsTab?: any;
|
|
26
|
+
productsCard?: any;
|
|
27
27
|
/** 卡片形状 */
|
|
28
28
|
itemShape?: 'round' | 'square';
|
|
29
29
|
/** 按钮形状 */
|
|
@@ -35,6 +35,10 @@ export interface ShelfDisplayProps {
|
|
|
35
35
|
/** 副按钮配置 */
|
|
36
36
|
secondaryButton?: string;
|
|
37
37
|
};
|
|
38
|
+
buildData?: {
|
|
39
|
+
categories: any[];
|
|
40
|
+
products: any[];
|
|
41
|
+
};
|
|
38
42
|
/** 主题色*/
|
|
39
43
|
theme?: 'light' | 'dark';
|
|
40
44
|
className?: string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t,jsxs as d}from"react/jsx-runtime";import{useState as g,useEffect as N}from"react";import{cn as f}from"../../helpers/utils.js";import T from"../../components/picture.js";import{Tabs as C,TabsList as I,TabsTrigger as P}from"../../components/tabs.js";import v from"../../components/button.js";import F from"../Title/index.js";import A from"../SwiperBox/index.js";import{withStyles as E}from"../../shared/Styles.js";import{formatVariantPrice as V}from"./shelfDisplay.js";const q=({data:e,configuration:s})=>{const c=a=>{},m=a=>{},{price:u,basePrice:l}=V({amount:e?.price.amount||0,baseAmount:e?.compareAtPrice?.amount||e?.price.amount||0,currencyCode:e?.price.currencyCode||"USD",locale:"us"}),x=()=>{const a=e?.sku,r=e?.variants;return r?.find(p=>p?.sku===a)?.image?.url||r?.[0]?.image?.url||""};return d("div",{className:f("desktop:pt-4 desktop:px-6 desktop:pb-6 flex size-full cursor-pointer flex-col overflow-hidden bg-[#EAEAEC] p-4",s?.itemShape==="round"?"rounded-2xl":"rounded-none"),children:[t("div",{className:f("relative mb-2 inline-block h-[137px] overflow-hidden","desktop:mb-3 desktop:h-[195px]"),children:t(T,{source:x(),className:"flex h-full justify-center object-cover [&_img]:w-auto"})}),t("div",{className:"desktop:mb-2 mb-1 flex h-8 flex-wrap gap-1",children:e?.tags?.slice(0,1)?.map?.((a,r)=>t("div",{className:"desktop:text-base rounded-3xl border-2 border-[#00BEFA] px-2 py-1 text-sm font-bold text-[#00BEFA]",children:a},r))}),t("p",{title:e?.title||"",className:"desktop:text-2xl line-clamp-2 max-h-[48px] flex-1 text-xl font-bold leading-[1.2] tracking-[-0.04em] text-[#1D1D1F]",children:e?.title||""}),t("h3",{title:e?.description||"",className:"desktop:mt-2 desktop:mb-6 desktop:text-lg mb-5 mt-1 truncate text-sm font-semibold leading-[1.2] tracking-[-0.02em] text-[#1D1D1F]",children:e?.description||""}),d("div",{className:"mb-2 flex items-center",children:[t("div",{className:"desktop:text-2xl text-xl font-bold text-[#1D1D1F]",children:u||""}),t("div",{className:"desktop:text-2xl ml-1 text-xl font-bold text-[#86868C]",children:l||""})]}),d("div",{className:"flex items-center gap-3",children:[t(v,{variant:"primary",onClick:()=>c(e),className:`
|
|
2
2
|
laptop:text-sm desktop:text-base laptop:px-6 desktop:px-7 laptop:py-2.5 desktop:py-3 box-border flex-1 border
|
|
3
3
|
border-[#1D1D1F] bg-transparent px-4 py-2 text-xs tracking-[-0.04em] text-[#1D1D1F] hover:bg-transparent hover:text-black
|
|
4
4
|
${s?.shape==="round"?"desktop:rounded-3xl rounded-[20px]":""}
|
|
5
|
-
`,children:s?.primaryButton||""}),
|
|
5
|
+
`,children:s?.primaryButton||""}),t(v,{variant:"secondary",onClick:()=>m(e),className:`
|
|
6
6
|
laptop:text-sm desktop:text-base laptop:px-6 desktop:px-7 laptop:py-2.5 desktop:py-3 box-border flex-1 border
|
|
7
7
|
border-[#1D1D1F] bg-[#1D1D1F] px-4 py-2 text-xs tracking-[-0.04em] text-white
|
|
8
8
|
${s?.shape==="round"?"desktop:rounded-3xl rounded-[20px]":""}
|
|
9
|
-
`,children:s?.secondaryButton||""})]})]},
|
|
9
|
+
`,children:s?.secondaryButton||""})]})]},e?.id||e?.handle)},M=({data:e,buildData:s,className:c="",key:m})=>{const[u,l]=g(""),[x,a]=g([]),{productsTab:r=[],productsCard:y=[],title:p,align:D="left",isShowTab:k=!0,tabShape:S="square",...w}=e,b=o=>{const i=o?.map(n=>{const h=s?.products?.find(B=>B?.handle===n?.handle);if(h)return{sku:n.sku,...h}})?.filter(n=>n);a(i)};return N(()=>{if(k){l(r?.[0]?.tab||""),b(r?.[0]?.data||[]);return}b(y)},[]),d("div",{className:f("w-full",c),children:[p&&t(F,{data:{title:p}}),k&&t(C,{shape:S,align:D,value:u,onValueChange:o=>{l(o);const i=r?.find(n=>n?.tab===o);b(i?.data||[])},className:"mb-8",children:t(I,{children:r?.map((o,i)=>t(P,{value:o?.tab||"",children:o?.tab},i))})}),t(A,{className:"!overflow-visible",id:"ShelfDisplay"+m,data:{list:x,configuration:{...w}},Slide:q,breakpoints:{0:{spaceBetween:"12px",freeMode:!1,slidesPerView:1},374:{spaceBetween:"12px",freeMode:!1,slidesPerView:1.3},768:{spaceBetween:"16px",freeMode:!1,slidesPerView:4}}})]})};var K=E(M);export{K as default};
|
|
10
10
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/ShelfDisplay/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useState, useEffect } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { Tabs, TabsList, TabsTrigger } from '../../components/tabs.js'\nimport Button from '../../components/button.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport {
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "useState", "useEffect", "cn", "Picture", "Tabs", "TabsList", "TabsTrigger", "Button", "Title", "SwiperBox", "withStyles", "ShelfDisplayItem", "data", "configuration", "onPrimaryButton", "params", "onSecondaryButton", "item", "index", "ShelfDisplay", "className", "key", "tabId", "setTabId", "currentItems", "setCurrentItems", "productsTab", "productsCard", "title", "align", "isShowTab", "tabShape", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useState, useEffect } from 'react'\nimport { cn } from '../../helpers/utils.js'\nimport Picture from '../../components/picture.js'\nimport { Tabs, TabsList, TabsTrigger } from '../../components/tabs.js'\nimport Button from '../../components/button.js'\nimport Title from '../Title/index.js'\nimport SwiperBox from '../SwiperBox/index.js'\nimport { withStyles } from '../../shared/Styles.js'\nimport { formatVariantPrice } from './shelfDisplay.js'\nexport interface ShelfDisplayItem {\n id?: string\n /** \u4EA7\u54C1\u56FE\u7247*/\n img?: {\n url: string\n }\n handle?: string\n sku?: string\n /** \u6298\u6263\u540E\u4EF7\u683C*/\n price?: string\n title?: string\n /** \u6298\u6263\u524D\u4EF7\u683C*/\n basePrice?: string\n subTitle?: string\n /** \u6807\u7B7E*/\n tagItems?: string[]\n tab?: string\n data?: ShelfDisplayItem[]\n}\n\nexport interface ShelfDisplayProps {\n data: {\n title?: string\n isShowTab?: boolean\n align?: 'left' | 'center' | 'right'\n productsTab?: any\n productsCard?: any\n /** \u5361\u7247\u5F62\u72B6 */\n itemShape?: 'round' | 'square'\n /** \u6309\u94AE\u5F62\u72B6 */\n shape?: 'round' | 'square'\n /** \u6807\u7B7E\u9875\u5F62\u72B6*/\n tabShape?: 'rounded' | 'square'\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: string\n /** \u526F\u6309\u94AE\u914D\u7F6E */\n secondaryButton?: string\n }\n buildData?: {\n categories: any[]\n products: any[]\n }\n /** \u4E3B\u9898\u8272*/\n theme?: 'light' | 'dark'\n className?: string\n /** \u6309\u94AE\u4E8B\u4EF6*/\n event?: {\n primaryButton?: {\n onClick: (v: any) => void\n }\n secondaryButton?: {\n onClick: (v: any) => void\n }\n }\n key?: string\n}\n\nconst ShelfDisplayItem = ({ data, configuration }: { data: any; configuration?: any }) => {\n const onPrimaryButton = (params: ShelfDisplayItem) => {\n // event?.primaryButton?.onClick?.(params)\n }\n\n const onSecondaryButton = (params: ShelfDisplayItem) => {\n // event?.secondaryButton?.onClick(params)\n }\n\n const { price, basePrice } = formatVariantPrice({\n amount: data?.price.amount || 0,\n baseAmount: data?.compareAtPrice?.amount || data?.price.amount || 0,\n currencyCode: data?.price.currencyCode || 'USD',\n locale: 'us',\n })\n\n const handleUrl = () => {\n const sku = data?.sku\n const skuArray = data?.variants\n const findSku = skuArray?.find((item: any) => item?.sku === sku)\n return findSku?.image?.url || skuArray?.[0]?.image?.url || ''\n }\n\n return (\n <div\n key={data?.id || data?.handle}\n className={cn(\n 'desktop:pt-4 desktop:px-6 desktop:pb-6 flex size-full cursor-pointer flex-col overflow-hidden bg-[#EAEAEC] p-4',\n configuration?.itemShape === 'round' ? 'rounded-2xl' : 'rounded-none'\n )}\n >\n <div className={cn('relative mb-2 inline-block h-[137px] overflow-hidden', 'desktop:mb-3 desktop:h-[195px]')}>\n <Picture source={handleUrl()} className=\"flex h-full justify-center object-cover [&_img]:w-auto\" />\n </div>\n <div className=\"desktop:mb-2 mb-1 flex h-8 flex-wrap gap-1\">\n {data?.tags?.slice(0, 1)?.map?.((item: any, index: number) => {\n return (\n <div\n key={index}\n className=\"desktop:text-base rounded-3xl border-2 border-[#00BEFA] px-2 py-1 text-sm font-bold text-[#00BEFA]\"\n >\n {item}\n </div>\n )\n })}\n </div>\n <p\n title={data?.title || ''}\n className=\"desktop:text-2xl line-clamp-2 max-h-[48px] flex-1 text-xl font-bold leading-[1.2] tracking-[-0.04em] text-[#1D1D1F]\"\n >\n {data?.title || ''}\n </p>\n <h3\n title={data?.description || ''}\n className=\"desktop:mt-2 desktop:mb-6 desktop:text-lg mb-5 mt-1 truncate text-sm font-semibold leading-[1.2] tracking-[-0.02em] text-[#1D1D1F]\"\n >\n {data?.description || ''}\n </h3>\n <div className=\"mb-2 flex items-center\">\n <div className=\"desktop:text-2xl text-xl font-bold text-[#1D1D1F]\">{price || ''}</div>\n <div className=\"desktop:text-2xl ml-1 text-xl font-bold text-[#86868C]\">{basePrice || ''}</div>\n </div>\n {/* \u6309\u94AE\u7EC4 */}\n <div className=\"flex items-center gap-3\">\n <Button\n variant=\"primary\"\n onClick={() => onPrimaryButton(data)}\n className={`\n laptop:text-sm desktop:text-base laptop:px-6 desktop:px-7 laptop:py-2.5 desktop:py-3 box-border flex-1 border\n border-[#1D1D1F] bg-transparent px-4 py-2 text-xs tracking-[-0.04em] text-[#1D1D1F] hover:bg-transparent hover:text-black\n ${configuration?.shape === 'round' ? 'desktop:rounded-3xl rounded-[20px]' : ''}\n `}\n >\n {configuration?.primaryButton || ''}\n </Button>\n <Button\n variant=\"secondary\"\n onClick={() => onSecondaryButton(data)}\n className={`\n laptop:text-sm desktop:text-base laptop:px-6 desktop:px-7 laptop:py-2.5 desktop:py-3 box-border flex-1 border\n border-[#1D1D1F] bg-[#1D1D1F] px-4 py-2 text-xs tracking-[-0.04em] text-white\n ${configuration?.shape === 'round' ? 'desktop:rounded-3xl rounded-[20px]' : ''}\n `}\n >\n {configuration?.secondaryButton || ''}\n </Button>\n </div>\n </div>\n )\n}\n\nconst ShelfDisplay: React.FC<ShelfDisplayProps> = ({ data, buildData, className = '', key }) => {\n const [tabId, setTabId] = useState<string>('')\n const [currentItems, setCurrentItems] = useState<ShelfDisplayItem[]>([])\n\n const {\n productsTab = [],\n productsCard = [],\n title,\n align = 'left',\n isShowTab = true,\n tabShape = 'square',\n ...other\n } = data\n\n const handleCurrentTab = (currentData: ShelfDisplayItem[]) => {\n const newCurrentData = currentData\n ?.map(item => {\n const findData = buildData?.products?.find(params => params?.handle === item?.handle)\n if (findData) {\n return {\n sku: item.sku,\n ...findData,\n }\n }\n })\n ?.filter(item => item)\n setCurrentItems(newCurrentData)\n }\n\n useEffect(() => {\n if (isShowTab) {\n setTabId(productsTab?.[0]?.tab || '')\n handleCurrentTab(productsTab?.[0]?.data || [])\n return\n }\n handleCurrentTab(productsCard)\n }, [])\n\n return (\n <div className={cn('w-full', className)}>\n {title && <Title data={{ title: title }} />}\n {isShowTab && (\n <Tabs\n shape={tabShape}\n align={align}\n value={tabId}\n onValueChange={v => {\n setTabId(v)\n const findData = productsTab?.find((item: any) => item?.tab === v)\n handleCurrentTab(findData?.data || [])\n }}\n className=\"mb-8\"\n >\n <TabsList>\n {productsTab?.map((item: any, index: number) => {\n return (\n <TabsTrigger key={index} value={item?.tab || ''}>\n {item?.tab}\n </TabsTrigger>\n )\n })}\n </TabsList>\n </Tabs>\n )}\n <SwiperBox\n className=\"!overflow-visible\"\n id={'ShelfDisplay' + key}\n data={{ list: currentItems, configuration: { ...other } }}\n Slide={ShelfDisplayItem}\n breakpoints={{\n 0: {\n spaceBetween: '12px',\n freeMode: false,\n slidesPerView: 1,\n },\n 374: {\n spaceBetween: '12px',\n freeMode: false,\n slidesPerView: 1.3,\n },\n 768: {\n spaceBetween: '16px',\n freeMode: false,\n slidesPerView: 4,\n },\n }}\n />\n </div>\n )\n}\n\nexport default withStyles(ShelfDisplay)\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["jsx", "jsxs", "useState", "useEffect", "cn", "Picture", "Tabs", "TabsList", "TabsTrigger", "Button", "Title", "SwiperBox", "withStyles", "formatVariantPrice", "ShelfDisplayItem", "data", "configuration", "onPrimaryButton", "params", "onSecondaryButton", "price", "basePrice", "handleUrl", "sku", "skuArray", "item", "index", "ShelfDisplay", "buildData", "className", "key", "tabId", "setTabId", "currentItems", "setCurrentItems", "productsTab", "productsCard", "title", "align", "isShowTab", "tabShape", "other", "handleCurrentTab", "currentData", "newCurrentData", "findData", "v", "ShelfDisplay_default"]
|
|
7
7
|
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export declare const PRICE_SYMBOL: any;
|
|
2
|
+
export declare const languageTerritory: (locale: string) => string;
|
|
3
|
+
export declare function formatPrice({ amount, currencyCode, locale, maximumFractionDigits, minimumFractionDigits, removeTrailingZeros, }: {
|
|
4
|
+
amount: number;
|
|
5
|
+
currencyCode: string;
|
|
6
|
+
locale: string;
|
|
7
|
+
maximumFractionDigits?: number;
|
|
8
|
+
minimumFractionDigits?: number;
|
|
9
|
+
removeTrailingZeros?: boolean;
|
|
10
|
+
}): string;
|
|
11
|
+
export declare function formatVariantPrice({ amount, baseAmount, currencyCode, locale, maximumFractionDigits, minimumFractionDigits, removeTrailingZeros, }: {
|
|
12
|
+
baseAmount: number;
|
|
13
|
+
amount: number;
|
|
14
|
+
currencyCode: string;
|
|
15
|
+
locale: string;
|
|
16
|
+
maximumFractionDigits?: number;
|
|
17
|
+
minimumFractionDigits?: number;
|
|
18
|
+
removeTrailingZeros?: boolean;
|
|
19
|
+
}): {
|
|
20
|
+
price: string;
|
|
21
|
+
basePrice: string | undefined;
|
|
22
|
+
discount: string | null;
|
|
23
|
+
};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const a={us:"$",uk:"\xA3",ca:"$",eu:"\u20AC",fr:"\u20AC",de:"\u20AC",vn:"\u20AB",cl:"$",sg:"$",ae:"AED"},o=e=>({us:"en-us",uk:"en-gb",ca:"en-ca",au:"en-au",eu:"en",fr:"fr-fr",de:"de-de",vn:"vi-vn",sg:"en-sg","ae-en":"ae-en",plus:"en-us",cl:"es-cl"})[e]||"";function m({amount:e,currencyCode:n,locale:i,maximumFractionDigits:r,minimumFractionDigits:u,removeTrailingZeros:c=!1}){let t=new Intl.NumberFormat(o(i),{style:"currency",currency:n||"USD",minimumFractionDigits:r===0?0:u,maximumFractionDigits:r}).format(e);return["eu-de","eu-en","de","eu"].includes(i)&&(t=t?.toString()?.replace(/[\s]/g,"")),c&&(t=t.replace(/(\.\d*?[1-9])0+\b/,"$1").replace(/\.0+\b/,"").replace(/(\,\d*?[1-9])0+\b/,"$1").replace(/\,0+\b/,"")),t}function b({amount:e,baseAmount:n,currencyCode:i,locale:r,maximumFractionDigits:u,minimumFractionDigits:c,removeTrailingZeros:s}){if(typeof Intl>"u")return{price:`${a[r]}${e}`,basePrice:`${a[r]}${n}`,discount:`${a[r]}${n-e||0}`};const t=n>e,f=new Intl.NumberFormat(o(r),{style:"percent"}),g=t?f.format((n-e)/n):null,d=m({amount:e,currencyCode:i,locale:r,removeTrailingZeros:s}),l=t?m({amount:n,currencyCode:i,locale:r,maximumFractionDigits:u,minimumFractionDigits:c,removeTrailingZeros:s}):void 0;return{price:d,basePrice:l,discount:g}}export{a as PRICE_SYMBOL,m as formatPrice,b as formatVariantPrice,o as languageTerritory};
|
|
2
|
+
//# sourceMappingURL=shelfDisplay.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/ShelfDisplay/shelfDisplay.ts"],
|
|
4
|
+
"sourcesContent": ["/* eslint-disable no-useless-escape */\nexport const PRICE_SYMBOL = {\n us: '$',\n uk: '\u00A3',\n ca: '$',\n eu: '\u20AC',\n fr: '\u20AC',\n de: '\u20AC',\n vn: '\u20AB',\n cl: '$',\n sg: '$',\n ae: 'AED',\n} as any\n\nexport const languageTerritory = (locale: string) =>\n // https://unicode-org.github.io/cldr-staging/charts/37/supplemental/language_territory_information.html\n ({\n us: 'en-us',\n uk: 'en-gb',\n ca: 'en-ca',\n au: 'en-au',\n eu: 'en',\n fr: 'fr-fr',\n de: 'de-de',\n vn: 'vi-vn',\n sg: 'en-sg',\n 'ae-en': 'ae-en',\n plus: 'en-us',\n cl: 'es-cl',\n })[locale] || ''\n\nexport function formatPrice({\n amount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros = false,\n}: {\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n const formatCurrency = new Intl.NumberFormat(languageTerritory(locale), {\n style: 'currency',\n currency: currencyCode || 'USD',\n minimumFractionDigits: maximumFractionDigits === 0 ? 0 : minimumFractionDigits,\n maximumFractionDigits,\n })\n\n let formattedValue = formatCurrency.format(amount)\n\n if (['eu-de', 'eu-en', 'de', 'eu'].includes(locale)) {\n formattedValue = formattedValue?.toString()?.replace(/[\\s]/g, '')\n }\n\n if (removeTrailingZeros) {\n // Adjust the regex to match comma as decimal separator\n formattedValue = formattedValue\n .replace(/(\\.\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\.0+\\b/, '')\n .replace(/(\\,\\d*?[1-9])0+\\b/, '$1')\n .replace(/\\,0+\\b/, '')\n }\n\n return formattedValue\n}\n\nexport function formatVariantPrice({\n amount,\n baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n}: {\n baseAmount: number\n amount: number\n currencyCode: string\n locale: string\n maximumFractionDigits?: number\n minimumFractionDigits?: number\n removeTrailingZeros?: boolean\n}) {\n if (typeof Intl === 'undefined') {\n return {\n price: `${PRICE_SYMBOL[locale]}${amount}`,\n basePrice: `${PRICE_SYMBOL[locale]}${baseAmount}`,\n discount: `${PRICE_SYMBOL[locale]}${baseAmount - amount || 0}`,\n }\n }\n\n const hasDiscount = baseAmount > amount\n const formatDiscount = new Intl.NumberFormat(languageTerritory(locale), {\n style: 'percent',\n })\n const discount = hasDiscount ? formatDiscount.format((baseAmount - amount) / baseAmount) : null\n\n const price = formatPrice({ amount, currencyCode, locale, removeTrailingZeros })\n const basePrice = hasDiscount\n ? formatPrice({\n amount: baseAmount,\n currencyCode,\n locale,\n maximumFractionDigits,\n minimumFractionDigits,\n removeTrailingZeros,\n })\n : undefined\n\n return { price, basePrice, discount }\n}\n"],
|
|
5
|
+
"mappings": "AACO,MAAMA,EAAe,CAC1B,GAAI,IACJ,GAAI,OACJ,GAAI,IACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,SACJ,GAAI,IACJ,GAAI,IACJ,GAAI,KACN,EAEaC,EAAqBC,IAE/B,CACC,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,KACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,GAAI,QACJ,QAAS,QACT,KAAM,QACN,GAAI,OACN,GAAGA,CAAM,GAAK,GAET,SAASC,EAAY,CAC1B,OAAAC,EACA,aAAAC,EACA,OAAAH,EACA,sBAAAI,EACA,sBAAAC,EACA,oBAAAC,EAAsB,EACxB,EAOG,CAQD,IAAIC,EAPmB,IAAI,KAAK,aAAaR,EAAkBC,CAAM,EAAG,CACtE,MAAO,WACP,SAAUG,GAAgB,MAC1B,sBAAuBC,IAA0B,EAAI,EAAIC,EACzD,sBAAAD,CACF,CAAC,EAEmC,OAAOF,CAAM,EAEjD,MAAI,CAAC,QAAS,QAAS,KAAM,IAAI,EAAE,SAASF,CAAM,IAChDO,EAAiBA,GAAgB,SAAS,GAAG,QAAQ,QAAS,EAAE,GAG9DD,IAEFC,EAAiBA,EACd,QAAQ,oBAAqB,IAAI,EACjC,QAAQ,SAAU,EAAE,EACpB,QAAQ,oBAAqB,IAAI,EACjC,QAAQ,SAAU,EAAE,GAGlBA,CACT,CAEO,SAASC,EAAmB,CACjC,OAAAN,EACA,WAAAO,EACA,aAAAN,EACA,OAAAH,EACA,sBAAAI,EACA,sBAAAC,EACA,oBAAAC,CACF,EAQG,CACD,GAAI,OAAO,KAAS,IAClB,MAAO,CACL,MAAO,GAAGR,EAAaE,CAAM,CAAC,GAAGE,CAAM,GACvC,UAAW,GAAGJ,EAAaE,CAAM,CAAC,GAAGS,CAAU,GAC/C,SAAU,GAAGX,EAAaE,CAAM,CAAC,GAAGS,EAAaP,GAAU,CAAC,EAC9D,EAGF,MAAMQ,EAAcD,EAAaP,EAC3BS,EAAiB,IAAI,KAAK,aAAaZ,EAAkBC,CAAM,EAAG,CACtE,MAAO,SACT,CAAC,EACKY,EAAWF,EAAcC,EAAe,QAAQF,EAAaP,GAAUO,CAAU,EAAI,KAErFI,EAAQZ,EAAY,CAAE,OAAAC,EAAQ,aAAAC,EAAc,OAAAH,EAAQ,oBAAAM,CAAoB,CAAC,EACzEQ,EAAYJ,EACdT,EAAY,CACV,OAAQQ,EACR,aAAAN,EACA,OAAAH,EACA,sBAAAI,EACA,sBAAAC,EACA,oBAAAC,CACF,CAAC,EACD,OAEJ,MAAO,CAAE,MAAAO,EAAO,UAAAC,EAAW,SAAAF,CAAS,CACtC",
|
|
6
|
+
"names": ["PRICE_SYMBOL", "languageTerritory", "locale", "formatPrice", "amount", "currencyCode", "maximumFractionDigits", "minimumFractionDigits", "removeTrailingZeros", "formattedValue", "formatVariantPrice", "baseAmount", "hasDiscount", "formatDiscount", "discount", "price", "basePrice"]
|
|
7
|
+
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as t}from"react/jsx-runtime";import i,{useMemo as d}from"react";import{cn as e}from"../helpers/utils.js";import{Slot as c}from"@radix-ui/react-slot";const
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import i,{useMemo as d}from"react";import{cn as e}from"../helpers/utils.js";import{Slot as c}from"@radix-ui/react-slot";const m=i.forwardRef(({...o},p)=>{const{asChild:s,children:n,className:a,overflow:x,...l}=o,r=s?c:"div";return d(()=>x==="hidden"?t("div",{className:e("overflow-hidden","tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]",a),children:t(r,{className:e("mx-auto box-border w-full max-w-[1772px]","tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-32 px-8"),...l,ref:p,children:n})}):t(r,{...l,ref:p,className:e("mx-auto box-content w-full max-w-[1664px]","tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-32 px-8","tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]",a),children:n}),[o])});m.displayName="Container";export{m as Container};
|
|
2
2
|
//# sourceMappingURL=container.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/container.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useMemo } from 'react'\nimport { cn } from '../helpers/utils.js'\nimport { Slot } from '@radix-ui/react-slot'\n\ntype ContainerElement = React.ElementRef<'div'>\ntype ContainerProps = {\n asChild?: boolean\n children?: React.ReactNode\n className?: string\n overflow?: 'hidden'\n} & React.ComponentPropsWithoutRef<'div'>\nconst Container = React.forwardRef<ContainerElement, ContainerProps>(({ ...props }, forwardedRef) => {\n const { asChild, children, className, overflow, ...containerProps } = props\n const Comp = asChild ? Slot : 'div'\n\n const content = useMemo(() => {\n if (overflow === 'hidden') {\n return (\n <div\n className={cn(\n 'overflow-hidden',\n 'tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]',\n className\n )}\n >\n <Comp\n className={cn(\n 'mx-auto box-
|
|
5
|
-
"mappings": "aA0BU,cAAAA,MAAA,oBAzBV,OAAOC,GAAS,WAAAC,MAAe,QAC/B,OAAS,MAAAC,MAAU,sBACnB,OAAS,QAAAC,MAAY,uBASrB,MAAMC,EAAYJ,EAAM,WAA6C,CAAC,CAAE,GAAGK,CAAM,EAAGC,IAAiB,CACnG,KAAM,CAAE,QAAAC,EAAS,SAAAC,EAAU,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAe,EAAIN,EAChEO,EAAOL,EAAUJ,EAAO,MAyC9B,OAvCgBF,EAAQ,IAClBS,IAAa,SAEbX,EAAC,OACC,UAAWG,EACT,kBACA,uFACAO,CACF,EAEA,SAAAV,EAACa,EAAA,CACC,UAAWV,EACT,
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useMemo } from 'react'\nimport { cn } from '../helpers/utils.js'\nimport { Slot } from '@radix-ui/react-slot'\n\ntype ContainerElement = React.ElementRef<'div'>\ntype ContainerProps = {\n asChild?: boolean\n children?: React.ReactNode\n className?: string\n overflow?: 'hidden'\n} & React.ComponentPropsWithoutRef<'div'>\nconst Container = React.forwardRef<ContainerElement, ContainerProps>(({ ...props }, forwardedRef) => {\n const { asChild, children, className, overflow, ...containerProps } = props\n const Comp = asChild ? Slot : 'div'\n\n const content = useMemo(() => {\n if (overflow === 'hidden') {\n return (\n <div\n className={cn(\n 'overflow-hidden',\n 'tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]',\n className\n )}\n >\n <Comp\n className={cn(\n 'mx-auto box-border w-full max-w-[1772px]',\n 'tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-32 px-8'\n )}\n {...containerProps}\n ref={forwardedRef}\n >\n {children}\n </Comp>\n </div>\n )\n }\n return (\n <Comp\n {...containerProps}\n ref={forwardedRef}\n className={cn(\n 'mx-auto box-content w-full max-w-[1664px]',\n 'tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-32 px-8',\n 'tablet:my-[80px] laptop:my-[96px] desktop:my-[112px] lg-desktop:my-[128px] my-[64px]',\n className\n )}\n >\n {children}\n </Comp>\n )\n }, [props])\n\n return content\n})\n\nContainer.displayName = 'Container'\n\nexport { Container }\nexport type { ContainerProps }\n"],
|
|
5
|
+
"mappings": "aA0BU,cAAAA,MAAA,oBAzBV,OAAOC,GAAS,WAAAC,MAAe,QAC/B,OAAS,MAAAC,MAAU,sBACnB,OAAS,QAAAC,MAAY,uBASrB,MAAMC,EAAYJ,EAAM,WAA6C,CAAC,CAAE,GAAGK,CAAM,EAAGC,IAAiB,CACnG,KAAM,CAAE,QAAAC,EAAS,SAAAC,EAAU,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAe,EAAIN,EAChEO,EAAOL,EAAUJ,EAAO,MAyC9B,OAvCgBF,EAAQ,IAClBS,IAAa,SAEbX,EAAC,OACC,UAAWG,EACT,kBACA,uFACAO,CACF,EAEA,SAAAV,EAACa,EAAA,CACC,UAAWV,EACT,2CACA,8DACF,EACC,GAAGS,EACJ,IAAKL,EAEJ,SAAAE,EACH,EACF,EAIFT,EAACa,EAAA,CACE,GAAGD,EACJ,IAAKL,EACL,UAAWJ,EACT,4CACA,+DACA,uFACAO,CACF,EAEC,SAAAD,EACH,EAED,CAACH,CAAK,CAAC,CAGZ,CAAC,EAEDD,EAAU,YAAc",
|
|
6
6
|
"names": ["jsx", "React", "useMemo", "cn", "Slot", "Container", "props", "forwardedRef", "asChild", "children", "className", "overflow", "containerProps", "Comp"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import t from"../biz-components/ShelfDisplay/index.js";const
|
|
1
|
+
import t from"../biz-components/ShelfDisplay/index.js";const o={title:"Biz-Components/ShelfDisplay",component:t,parameters:{layout:"fullscreen"},tags:["autodocs"]};var a=o;const e=[{price:"$1,999.00",basePrice:"$2,999.00",subTitle:"Fast Charging for 3 Devices",title:"Anker Prime 27,650mAh Power Bank (250W)",tagItems:["New","20% OFF"],img:{url:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554"}},{price:"$1,999.00",basePrice:"$2,999.00",subTitle:"Fast Charging for 3 Devices",title:"Anker Prime 27,650mAh Power Bank (250W)",tagItems:["New","20% OFF"],img:{url:"https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554"}}],s={args:{data:{productsCard:e,primaryButton:"Learn More",secondaryButton:"Shop Now"},className:"p-4"}},i={args:{data:{productsCard:e,shape:"round",itemShape:"round",primaryButton:"Learn More",secondaryButton:"Shop Now"},className:"p-4"}};export{s as Default,i as Round,a as default};
|
|
2
2
|
//# sourceMappingURL=shelfDisplay.stories.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/stories/shelfDisplay.stories.tsx"],
|
|
4
|
-
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport ShelfDisplay from '../biz-components/ShelfDisplay/index.js'\n\nconst meta = {\n title: 'Biz-Components/ShelfDisplay',\n component: ShelfDisplay,\n parameters: {\n layout: 'fullscreen',\n },\n tags: ['autodocs'],\n} satisfies Meta<typeof ShelfDisplay>\n\nexport default meta\ntype Story = StoryObj<typeof meta>\n\nconst mockItems = [\n {\n price: '$1,999.00',\n basePrice: '$2,999.00',\n subTitle: 'Fast Charging for 3 Devices',\n title: 'Anker Prime 27,650mAh Power Bank (250W)',\n tagItems: ['New', '20% OFF'],\n img: {\n url: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',\n },\n },\n {\n price: '$1,999.00',\n basePrice: '$2,999.00',\n subTitle: 'Fast Charging for 3 Devices',\n title: 'Anker Prime 27,650mAh Power Bank (250W)',\n tagItems: ['New', '20% OFF'],\n img: {\n url: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',\n },\n },\n
|
|
5
|
-
"mappings": "AACA,OAAOA,MAAkB,0CAEzB,MAAMC,EAAO,CACX,MAAO,8BACP,UAAWD,EACX,WAAY,CACV,OAAQ,YACV,EACA,KAAM,CAAC,UAAU,CACnB,EAEA,IAAOE,EAAQD,EAGf,MAAME,EAAY,CAChB,CACE,MAAO,YACP,UAAW,YACX,SAAU,8BACV,MAAO,0CACP,SAAU,CAAC,MAAO,SAAS,EAC3B,IAAK,CACH,IAAK,8HACP,CACF,EACA,CACE,MAAO,YACP,UAAW,YACX,SAAU,8BACV,MAAO,0CACP,SAAU,CAAC,MAAO,SAAS,EAC3B,IAAK,CACH,IAAK,8HACP,CACF,
|
|
4
|
+
"sourcesContent": ["import type { Meta, StoryObj } from '@storybook/react'\nimport ShelfDisplay from '../biz-components/ShelfDisplay/index.js'\n\nconst meta = {\n title: 'Biz-Components/ShelfDisplay',\n component: ShelfDisplay,\n parameters: {\n layout: 'fullscreen',\n },\n tags: ['autodocs'],\n} satisfies Meta<typeof ShelfDisplay>\n\nexport default meta\ntype Story = StoryObj<typeof meta>\n\nconst mockItems = [\n {\n price: '$1,999.00',\n basePrice: '$2,999.00',\n subTitle: 'Fast Charging for 3 Devices',\n title: 'Anker Prime 27,650mAh Power Bank (250W)',\n tagItems: ['New', '20% OFF'],\n img: {\n url: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',\n },\n },\n {\n price: '$1,999.00',\n basePrice: '$2,999.00',\n subTitle: 'Fast Charging for 3 Devices',\n title: 'Anker Prime 27,650mAh Power Bank (250W)',\n tagItems: ['New', '20% OFF'],\n img: {\n url: 'https://cdn.shopify.com/s/files/1/0517/6767/3016/files/e7be0a68-29b9-431c-8c0f-21bf968b1545_Product_Image_2.png?v=1744274554',\n },\n },\n]\n\nexport const Default: Story = {\n args: {\n data: {\n productsCard: mockItems,\n primaryButton: 'Learn More',\n secondaryButton: 'Shop Now',\n },\n className: 'p-4',\n },\n}\n\nexport const Round: Story = {\n args: {\n data: {\n productsCard: mockItems,\n shape: 'round',\n itemShape: 'round',\n primaryButton: 'Learn More',\n secondaryButton: 'Shop Now',\n },\n className: 'p-4',\n },\n}\n"],
|
|
5
|
+
"mappings": "AACA,OAAOA,MAAkB,0CAEzB,MAAMC,EAAO,CACX,MAAO,8BACP,UAAWD,EACX,WAAY,CACV,OAAQ,YACV,EACA,KAAM,CAAC,UAAU,CACnB,EAEA,IAAOE,EAAQD,EAGf,MAAME,EAAY,CAChB,CACE,MAAO,YACP,UAAW,YACX,SAAU,8BACV,MAAO,0CACP,SAAU,CAAC,MAAO,SAAS,EAC3B,IAAK,CACH,IAAK,8HACP,CACF,EACA,CACE,MAAO,YACP,UAAW,YACX,SAAU,8BACV,MAAO,0CACP,SAAU,CAAC,MAAO,SAAS,EAC3B,IAAK,CACH,IAAK,8HACP,CACF,CACF,EAEaC,EAAiB,CAC5B,KAAM,CACJ,KAAM,CACJ,aAAcD,EACd,cAAe,aACf,gBAAiB,UACnB,EACA,UAAW,KACb,CACF,EAEaE,EAAe,CAC1B,KAAM,CACJ,KAAM,CACJ,aAAcF,EACd,MAAO,QACP,UAAW,QACX,cAAe,aACf,gBAAiB,UACnB,EACA,UAAW,KACb,CACF",
|
|
6
6
|
"names": ["ShelfDisplay", "meta", "shelfDisplay_stories_default", "mockItems", "Default", "Round"]
|
|
7
7
|
}
|
package/package.json
CHANGED
package/style.css
CHANGED
|
@@ -669,6 +669,9 @@ video {
|
|
|
669
669
|
.mt-auto {
|
|
670
670
|
margin-top: auto;
|
|
671
671
|
}
|
|
672
|
+
.box-border {
|
|
673
|
+
box-sizing: border-box;
|
|
674
|
+
}
|
|
672
675
|
.box-content {
|
|
673
676
|
box-sizing: content-box;
|
|
674
677
|
}
|
|
@@ -795,6 +798,9 @@ video {
|
|
|
795
798
|
.max-w-\[1664px\] {
|
|
796
799
|
max-width: 1664px;
|
|
797
800
|
}
|
|
801
|
+
.max-w-\[1772px\] {
|
|
802
|
+
max-width: 1772px;
|
|
803
|
+
}
|
|
798
804
|
.max-w-lg {
|
|
799
805
|
max-width: 32rem;
|
|
800
806
|
}
|