@anker-in/headless-ui 1.3.23 → 1.3.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +1 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js.map +3 -3
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +1 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/GiftSelection.js.map +3 -3
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js.map +3 -3
- package/dist/cjs/biz-components/BuyOneGetOneShelf/context.d.ts +1 -0
- package/dist/cjs/biz-components/BuyOneGetOneShelf/context.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/context.js.map +2 -2
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js.map +3 -3
- package/dist/cjs/biz-components/Faq/Faq.d.ts +2 -2
- package/dist/cjs/biz-components/Faq/Faq.js +10 -1
- package/dist/cjs/biz-components/Faq/Faq.js.map +3 -3
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.d.ts +1 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js.map +3 -3
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.d.ts +1 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/GiftSelection.js.map +3 -3
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js.map +3 -3
- package/dist/esm/biz-components/BuyOneGetOneShelf/context.d.ts +1 -0
- package/dist/esm/biz-components/BuyOneGetOneShelf/context.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/context.js.map +2 -2
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js.map +3 -3
- package/dist/esm/biz-components/Faq/Faq.d.ts +2 -2
- package/dist/esm/biz-components/Faq/Faq.js +10 -1
- package/dist/esm/biz-components/Faq/Faq.js.map +3 -3
- package/package.json +4 -3
- package/style.css +13 -6
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var h=Object.create;var d=Object.defineProperty;var f=Object.getOwnPropertyDescriptor;var v=Object.getOwnPropertyNames;var u=Object.getPrototypeOf,g=Object.prototype.hasOwnProperty;var k=(e,r)=>{for(var i in r)d(e,i,{get:r[i],enumerable:!0})},n=(e,r,i,l)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of v(r))!g.call(e,s)&&s!==i&&d(e,s,{get:()=>r[s],enumerable:!(l=f(r,s))||l.enumerable});return e};var p=(e,r,i)=>(i=e!=null?h(u(e)):{},n(r||!e||!e.__esModule?d(i,"default",{value:e,enumerable:!0}):i,e)),b=e=>n(d({},"__esModule",{value:!0}),e);var N={};k(N,{default:()=>F});module.exports=b(N);var t=require("react/jsx-runtime"),w=p(require("react")),o=require("../../helpers/index.js"),G=require("../../components/badge.js"),c=p(require("../../components/picture.js")),a=require("../../components/text.js");const y=({checked:e,theme:r})=>{const i=r==="dark";return e?(0,t.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[(0,t.jsx)("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",fill:i?"#F5F6F7":"#080A0F"}),(0,t.jsx)("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:i?"#F5F6F7":"#080A0F",strokeWidth:"1.6"}),(0,t.jsx)("path",{d:"M8 11.5833L10.9474 14.5L16 9.5",stroke:i?"#1E2024":"white",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]}):(0,t.jsx)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:(0,t.jsx)("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:i?"#B5B7BB":"#2A2C32",strokeWidth:"1.6"})})},x=w.forwardRef(({gift:e,onClick:r,className:i,giftType:l,theme:s},m)=>(0,t.jsx)("div",{ref:m,className:(0,o.cn)("bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all",l===2?"border-brand-0 bg-container-secondary-0 cursor-default":`cursor-pointer hover:shadow-sm ${e.selected?"border-brand-0 bg-container-secondary-0":"border-lines bg-secondary-0"}`,i),onClick:()=>{l===1&&r?.(e)},children:(0,t.jsxs)("div",{className:"flex size-full flex-col",children:[(0,t.jsx)("div",{className:"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end",children:e.tag&&(0,t.jsx)("div",{className:"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]",children:e.tag})}),(0,t.jsxs)("div",{className:(0,o.cn)("laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2"),children:[(0,t.jsx)("div",{className:"flex size-5 shrink-0 items-center justify-center",children:(0,t.jsx)(y,{checked:!!e.selected,theme:s})}),(0,t.jsx)("div",{className:(0,o.cn)("size-14 shrink-0","tablet:size-12"),children:(0,t.jsx)(c.default,{source:e.image,alt:e.name,className:"size-full rounded object-cover"})}),(0,t.jsxs)("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1",children:[(0,t.jsx)(a.Text,{size:2,html:e.name,className:(0,o.cn)("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1")}),(0,t.jsxs)("div",{className:"mt-auto flex items-center justify-between gap-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(a.Text,{size:2,className:(0,o.cn)("text-info-primary desktop:text-[16px] lg-desktop:text-[18px]"),children:e.currentPrice}),e.originalPrice&&e.originalPrice!==e.currentPrice&&(0,t.jsx)(a.Text,{size:2,className:(0,o.cn)("text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through"),children:e.originalPrice})]}),e.quantity>=1&&(0,t.jsxs)(a.Text,{size:4,className:(0,o.cn)("text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]"),children:["x",e.quantity]})]})]})]})]})}));x.displayName="FreeGiftItem";var F=x;
|
|
2
2
|
//# sourceMappingURL=FreeGiftItem.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/FreeGiftItem.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport Badge from '../../components/badge.js'\nimport Picture from '../../components/picture.js'\nimport { Text } from '../../components/text.js'\n\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nexport interface FreeGiftItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /** \u8D60\u54C1\u6570\u636E\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n gift: FreeGiftWithSelection\n /** \u70B9\u51FB\u56DE\u8C03 */\n onClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n}\n\n/**\n * FreeGiftItem - \u514D\u8D39\u8D60\u54C1\u9879\n */\nconst FreeGiftItem = React.forwardRef<HTMLDivElement, FreeGiftItemProps>(\n ({ gift, onClick, className, giftType }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all',\n\n // \u6837\u5F0F\u6839\u636E gift_type \u548C\u9009\u62E9\u72B6\u6001\u53D8\u5316\n giftType === 2\n ? 'border-brand-0 bg-container-secondary-0 cursor-default' // \u5168\u9009\u6A21\u5F0F\uFF1A\u59CB\u7EC8\u9009\u4E2D\uFF0C\u4E0D\u53EF\u70B9\u51FB\n : `cursor-pointer hover:shadow-sm ${gift.selected ? 'border-brand-0 bg-container-secondary-0' : 'border-lines bg-secondary-0'}`, // \u5355\u9009\u6A21\u5F0F\uFF1A\u53EF\u70B9\u51FB\uFF0C\u6839\u636E\u9009\u62E9\u72B6\u6001\u53D8\u5316\u8FB9\u6846\n className\n )}\n onClick={() => {\n // \u53EA\u6709\u5355\u9009\u6A21\u5F0F\u624D\u5141\u8BB8\u70B9\u51FB\n if (giftType === 1) {\n onClick?.(gift)\n }\n }}\n >\n <div className=\"flex size-full flex-col\">\n <div className=\"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end\">\n {gift.tag && (\n <div className=\"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]\">\n {gift.tag}\n </div>\n )}\n </div>\n <div className={cn('laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2')}>\n <div className={cn('size-14 shrink-0', 'tablet:size-12')}>\n <Picture source={gift.image} alt={gift.name} className=\"size-full rounded object-cover\" />\n </div>\n <div className=\"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1\">\n <Text\n size={2}\n html={gift.name}\n className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1')}\n />\n <div className=\"mt-auto flex items-center justify-between gap-2\">\n <div className=\"flex items-center gap-2\">\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px]')}>\n {gift.currentPrice}\n </Text>\n {gift.originalPrice && gift.originalPrice !== gift.currentPrice && (\n <Text\n size={2}\n className={cn('text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through')}\n >\n {gift.originalPrice}\n </Text>\n )}\n </div>\n {gift.quantity >= 1 && (\n <Text\n size={4}\n className={cn('text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]')}\n >\n x{gift.quantity}\n </Text>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n }\n)\n\nFreeGiftItem.displayName = 'FreeGiftItem'\n\nexport default FreeGiftItem\n"],
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["FreeGiftItem_exports", "__export", "FreeGiftItem_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_badge", "import_picture", "import_text", "FreeGiftItem", "gift", "onClick", "className", "giftType", "ref", "Picture"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport Badge from '../../components/badge.js'\nimport Picture from '../../components/picture.js'\nimport { Text } from '../../components/text.js'\n\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nconst GiftRadio = ({ checked, theme }: { checked: boolean; theme?: 'light' | 'dark' }) => {\n const isDark = theme === 'dark'\n return checked ? (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"2.8\" y=\"2.8\" width=\"18.4\" height=\"18.4\" rx=\"9.2\" fill={isDark ? '#F5F6F7' : '#080A0F'} />\n <rect\n x=\"2.8\"\n y=\"2.8\"\n width=\"18.4\"\n height=\"18.4\"\n rx=\"9.2\"\n stroke={isDark ? '#F5F6F7' : '#080A0F'}\n strokeWidth=\"1.6\"\n />\n <path\n d=\"M8 11.5833L10.9474 14.5L16 9.5\"\n stroke={isDark ? '#1E2024' : 'white'}\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n ) : (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect\n x=\"2.8\"\n y=\"2.8\"\n width=\"18.4\"\n height=\"18.4\"\n rx=\"9.2\"\n stroke={isDark ? '#B5B7BB' : '#2A2C32'}\n strokeWidth=\"1.6\"\n />\n </svg>\n )\n}\n\nexport interface FreeGiftItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /** \u8D60\u54C1\u6570\u636E\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n gift: FreeGiftWithSelection\n /** \u70B9\u51FB\u56DE\u8C03 */\n onClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n theme?: 'light' | 'dark'\n}\n\n/**\n * FreeGiftItem - \u514D\u8D39\u8D60\u54C1\u9879\n */\nconst FreeGiftItem = React.forwardRef<HTMLDivElement, FreeGiftItemProps>(\n ({ gift, onClick, className, giftType, theme }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all',\n\n // \u6837\u5F0F\u6839\u636E gift_type \u548C\u9009\u62E9\u72B6\u6001\u53D8\u5316\n giftType === 2\n ? 'border-brand-0 bg-container-secondary-0 cursor-default' // \u5168\u9009\u6A21\u5F0F\uFF1A\u59CB\u7EC8\u9009\u4E2D\uFF0C\u4E0D\u53EF\u70B9\u51FB\n : `cursor-pointer hover:shadow-sm ${gift.selected ? 'border-brand-0 bg-container-secondary-0' : 'border-lines bg-secondary-0'}`, // \u5355\u9009\u6A21\u5F0F\uFF1A\u53EF\u70B9\u51FB\uFF0C\u6839\u636E\u9009\u62E9\u72B6\u6001\u53D8\u5316\u8FB9\u6846\n className\n )}\n onClick={() => {\n // \u53EA\u6709\u5355\u9009\u6A21\u5F0F\u624D\u5141\u8BB8\u70B9\u51FB\n if (giftType === 1) {\n onClick?.(gift)\n }\n }}\n >\n <div className=\"flex size-full flex-col\">\n <div className=\"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end\">\n {gift.tag && (\n <div className=\"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]\">\n {gift.tag}\n </div>\n )}\n </div>\n <div className={cn('laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2')}>\n <div className=\"flex size-5 shrink-0 items-center justify-center\">\n <GiftRadio checked={!!gift.selected} theme={theme} />\n </div>\n <div className={cn('size-14 shrink-0', 'tablet:size-12')}>\n <Picture source={gift.image} alt={gift.name} className=\"size-full rounded object-cover\" />\n </div>\n <div className=\"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1\">\n <Text\n size={2}\n html={gift.name}\n className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1')}\n />\n <div className=\"mt-auto flex items-center justify-between gap-2\">\n <div className=\"flex items-center gap-2\">\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px]')}>\n {gift.currentPrice}\n </Text>\n {gift.originalPrice && gift.originalPrice !== gift.currentPrice && (\n <Text\n size={2}\n className={cn('text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through')}\n >\n {gift.originalPrice}\n </Text>\n )}\n </div>\n {gift.quantity >= 1 && (\n <Text\n size={4}\n className={cn('text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]')}\n >\n x{gift.quantity}\n </Text>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n }\n)\n\nFreeGiftItem.displayName = 'FreeGiftItem'\n\nexport default FreeGiftItem\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAaI,IAAAI,EAAA,6BAXJC,EAAuB,oBACvBC,EAAmB,kCACnBC,EAAkB,qCAClBC,EAAoB,0CACpBC,EAAqB,oCAIrB,MAAMC,EAAY,CAAC,CAAE,QAAAC,EAAS,MAAAC,CAAM,IAAsD,CACxF,MAAMC,EAASD,IAAU,OACzB,OAAOD,KACL,QAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAChE,oBAAC,QAAK,EAAE,MAAM,EAAE,MAAM,MAAM,OAAO,OAAO,OAAO,GAAG,MAAM,KAAME,EAAS,UAAY,UAAW,KAChG,OAAC,QACC,EAAE,MACF,EAAE,MACF,MAAM,OACN,OAAO,OACP,GAAG,MACH,OAAQA,EAAS,UAAY,UAC7B,YAAY,MACd,KACA,OAAC,QACC,EAAE,iCACF,OAAQA,EAAS,UAAY,QAC7B,YAAY,MACZ,cAAc,QACd,eAAe,QACjB,GACF,KAEA,OAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAChE,mBAAC,QACC,EAAE,MACF,EAAE,MACF,MAAM,OACN,OAAO,OACP,GAAG,MACH,OAAQA,EAAS,UAAY,UAC7B,YAAY,MACd,EACF,CAEJ,EAeMC,EAAeT,EAAM,WACzB,CAAC,CAAE,KAAAU,EAAM,QAAAC,EAAS,UAAAC,EAAW,SAAAC,EAAU,MAAAN,CAAM,EAAGO,OAE5C,OAAC,OACC,IAAKA,EACL,aAAW,MACT,6IAGAD,IAAa,EACT,yDACA,kCAAkCH,EAAK,SAAW,0CAA4C,6BAA6B,GAC/HE,CACF,EACA,QAAS,IAAM,CAETC,IAAa,GACfF,IAAUD,CAAI,CAElB,EAEA,oBAAC,OAAI,UAAU,0BACb,oBAAC,OAAI,UAAU,gEACZ,SAAAA,EAAK,QACJ,OAAC,OAAI,UAAU,2KACZ,SAAAA,EAAK,IACR,EAEJ,KACA,QAAC,OAAI,aAAW,MAAG,qEAAqE,EACtF,oBAAC,OAAI,UAAU,mDACb,mBAACL,EAAA,CAAU,QAAS,CAAC,CAACK,EAAK,SAAU,MAAOH,EAAO,EACrD,KACA,OAAC,OAAI,aAAW,MAAG,mBAAoB,gBAAgB,EACrD,mBAAC,EAAAQ,QAAA,CAAQ,OAAQL,EAAK,MAAO,IAAKA,EAAK,KAAM,UAAU,iCAAiC,EAC1F,KACA,QAAC,OAAI,UAAU,gEACb,oBAAC,QACC,KAAM,EACN,KAAMA,EAAK,KACX,aAAW,MAAG,2EAA2E,EAC3F,KACA,QAAC,OAAI,UAAU,kDACb,qBAAC,OAAI,UAAU,0BACb,oBAAC,QAAK,KAAM,EAAG,aAAW,MAAG,8DAA8D,EACxF,SAAAA,EAAK,aACR,EACCA,EAAK,eAAiBA,EAAK,gBAAkBA,EAAK,iBACjD,OAAC,QACC,KAAM,EACN,aAAW,MAAG,iFAAiF,EAE9F,SAAAA,EAAK,cACR,GAEJ,EACCA,EAAK,UAAY,MAChB,QAAC,QACC,KAAM,EACN,aAAW,MAAG,kFAAkF,EACjG,cACGA,EAAK,UACT,GAEJ,GACF,GACF,GACF,EACF,CAGN,EAEAD,EAAa,YAAc,eAE3B,IAAOZ,EAAQY",
|
|
6
|
+
"names": ["FreeGiftItem_exports", "__export", "FreeGiftItem_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_badge", "import_picture", "import_text", "GiftRadio", "checked", "theme", "isDark", "FreeGiftItem", "gift", "onClick", "className", "giftType", "ref", "Picture"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var v=Object.create;var r=Object.defineProperty;var u=Object.getOwnPropertyDescriptor;var k=Object.getOwnPropertyNames;var y=Object.getPrototypeOf,S=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var i in t)r(e,i,{get:t[i],enumerable:!0})},m=(e,t,i,o)=>{if(t&&typeof t=="object"||typeof t=="function")for(let l of k(t))!S.call(e,l)&&l!==i&&r(e,l,{get:()=>t[l],enumerable:!(o=u(t,l))||o.enumerable});return e};var n=(e,t,i)=>(i=e!=null?v(y(e)):{},m(t||!e||!e.__esModule?r(i,"default",{value:e,enumerable:!0}):i,e)),h=e=>m(r({},"__esModule",{value:!0}),e);var N={};T(N,{default:()=>F});module.exports=h(N);var f=require("react/jsx-runtime"),w=n(require("react")),p=require("../../helpers/index.js"),c=require("../../components/text.js"),d=n(require("./FreeGiftItem.js"));const s=w.forwardRef(({freeGiftLabel:e,freeGifts:t,onGiftClick:i,className:o,giftType:l,theme:x},g)=>!t||t.length===0?null:(0,f.jsxs)("div",{ref:g,className:(0,p.cn)("flex w-full flex-col gap-2",o),children:[e&&(0,f.jsx)(c.Text,{size:2,className:(0,p.cn)("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] w-full"),children:e}),(0,f.jsx)("div",{className:(0,p.cn)("tablet:flex-row laptop:flex-col flex flex-col gap-2"),children:t.map((a,G)=>(0,f.jsx)("div",{className:"min-w-0 flex-1",children:(0,f.jsx)(d.default,{gift:a,onClick:i,giftType:l,theme:x})},a.id||G))})]}));s.displayName="GiftSelection";var F=s;
|
|
2
2
|
//# sourceMappingURL=GiftSelection.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/GiftSelection.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text } from '../../components/text.js'\nimport FreeGiftItem from './FreeGiftItem.js'\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nexport interface GiftSelectionProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u8D60\u54C1\u6807\u7B7E\u6587\u672C */\n freeGiftLabel?: string\n /** \u8D60\u54C1\u5217\u8868\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n freeGifts?: FreeGiftWithSelection[]\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n selectedGiftSku?: string\n}\n\n/**\n * GiftSelection - \u8D60\u54C1\u9009\u62E9\u533A\u57DF\n */\nconst GiftSelection = React.forwardRef<HTMLDivElement, GiftSelectionProps>(\n ({ freeGiftLabel, freeGifts, onGiftClick, className, giftType }, ref) => {\n if (!freeGifts || freeGifts.length === 0) {\n return null\n }\n\n return (\n <div ref={ref} className={cn('flex w-full flex-col gap-2', className)}>\n {freeGiftLabel && (\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] w-full')}>\n {freeGiftLabel}\n </Text>\n )}\n <div className={cn('tablet:flex-row laptop:flex-col flex flex-col gap-2')}>\n {freeGifts.map((gift, index) => (\n <div key={gift.id || index} className=\"min-w-0 flex-1\">\n <FreeGiftItem gift={gift} onClick={onGiftClick} giftType={giftType} />\n </div>\n ))}\n </div>\n </div>\n )\n }\n)\n\nGiftSelection.displayName = 'GiftSelection'\n\nexport default GiftSelection\n"],
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["GiftSelection_exports", "__export", "GiftSelection_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_text", "import_FreeGiftItem", "GiftSelection", "freeGiftLabel", "freeGifts", "onGiftClick", "className", "giftType", "ref", "gift", "index", "FreeGiftItem"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text } from '../../components/text.js'\nimport FreeGiftItem from './FreeGiftItem.js'\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nexport interface GiftSelectionProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u8D60\u54C1\u6807\u7B7E\u6587\u672C */\n freeGiftLabel?: string\n /** \u8D60\u54C1\u5217\u8868\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n freeGifts?: FreeGiftWithSelection[]\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n selectedGiftSku?: string\n theme?: 'light' | 'dark'\n}\n\n/**\n * GiftSelection - \u8D60\u54C1\u9009\u62E9\u533A\u57DF\n */\nconst GiftSelection = React.forwardRef<HTMLDivElement, GiftSelectionProps>(\n ({ freeGiftLabel, freeGifts, onGiftClick, className, giftType, theme }, ref) => {\n if (!freeGifts || freeGifts.length === 0) {\n return null\n }\n\n return (\n <div ref={ref} className={cn('flex w-full flex-col gap-2', className)}>\n {freeGiftLabel && (\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] w-full')}>\n {freeGiftLabel}\n </Text>\n )}\n <div className={cn('tablet:flex-row laptop:flex-col flex flex-col gap-2')}>\n {freeGifts.map((gift, index) => (\n <div key={gift.id || index} className=\"min-w-0 flex-1\">\n <FreeGiftItem gift={gift} onClick={onGiftClick} giftType={giftType} theme={theme} />\n </div>\n ))}\n </div>\n </div>\n )\n }\n)\n\nGiftSelection.displayName = 'GiftSelection'\n\nexport default GiftSelection\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA+BM,IAAAI,EAAA,6BA7BNC,EAAuB,oBACvBC,EAAmB,kCACnBC,EAAqB,oCACrBC,EAAyB,gCAmBzB,MAAMC,EAAgBJ,EAAM,WAC1B,CAAC,CAAE,cAAAK,EAAe,UAAAC,EAAW,YAAAC,EAAa,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAClE,CAACL,GAAaA,EAAU,SAAW,EAC9B,QAIP,QAAC,OAAI,IAAKK,EAAK,aAAW,MAAG,6BAA8BH,CAAS,EACjE,UAAAH,MACC,OAAC,QAAK,KAAM,EAAG,aAAW,MAAG,qEAAqE,EAC/F,SAAAA,EACH,KAEF,OAAC,OAAI,aAAW,MAAG,qDAAqD,EACrE,SAAAC,EAAU,IAAI,CAACM,EAAMC,OACpB,OAAC,OAA2B,UAAU,iBACpC,mBAAC,EAAAC,QAAA,CAAa,KAAMF,EAAM,QAASL,EAAa,SAAUE,EAAU,MAAOC,EAAO,GAD1EE,EAAK,IAAMC,CAErB,CACD,EACH,GACF,CAGN,EAEAT,EAAc,YAAc,gBAE5B,IAAOP,EAAQO",
|
|
6
|
+
"names": ["GiftSelection_exports", "__export", "GiftSelection_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_text", "import_FreeGiftItem", "GiftSelection", "freeGiftLabel", "freeGifts", "onGiftClick", "className", "giftType", "theme", "ref", "gift", "index", "FreeGiftItem"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var Y=Object.create;var h=Object.defineProperty;var Z=Object.getOwnPropertyDescriptor;var D=Object.getOwnPropertyNames;var ee=Object.getPrototypeOf,te=Object.prototype.hasOwnProperty;var re=(e,t)=>{for(var o in t)h(e,o,{get:t[o],enumerable:!0})},F=(e,t,o,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of D(t))!te.call(e,a)&&a!==o&&h(e,a,{get:()=>t[a],enumerable:!(s=Z(t,a))||s.enumerable});return e};var c=(e,t,o)=>(o=e!=null?Y(ee(e)):{},F(t||!e||!e.__esModule?h(o,"default",{value:e,enumerable:!0}):o,e)),oe=e=>F(h({},"__esModule",{value:!0}),e);var ie={};re(ie,{default:()=>ne});module.exports=oe(ie);var i=require("react/jsx-runtime"),l=c(require("react")),P=require("../../helpers/index.js"),M=c(require("./ProductImage.js")),O=c(require("./ProductInfo.js")),I=c(require("./GiftSelection.js")),T=c(require("./PriceAndActions.js")),H=require("./context.js");const N=l.forwardRef(({productData:e,gifts:t=[],giftType:o=1,selectedGiftSku:s,sceneImages:a,tags:B,layout:R,className:j,onProductClick:x,onProductImageClick:b,onLearnMore:z,onShopNow:A,onGiftClick:C,onGiftSelectionChange:E,classNames:k,soldOutText:W,...V},_)=>{const{layout:$,theme:q}=l.useContext(H.BuyOneGetOneShelfContext),G=R??$,[J,y]=l.useState(!1),[K,w]=l.useState(!1),[v,f]=l.useState(()=>!t||t.length===0?[]:o===2?t.map(r=>r.id):[t[0].id]),u=l.useMemo(()=>t?t.map(r=>({...r,selected:v.includes(r.id)})):[],[t,v]);l.useEffect(()=>{if(!t||t.length===0){f([]);return}f(o===2?t.map(r=>r.id):r=>{const n=r[0];return n&&t.some(S=>S.id===n)?[n]:[t[0].id]})},[t,o]);const m=l.useMemo(()=>({...e,gifts:t,gift_type:o}),[e,t,o]),Q=r=>{if(o===2){const n=u.filter(d=>d.selected);C?.(r,n);return}f(()=>{const n=[r.id],d=t?.filter(S=>n.includes(S.id))||[];return C?.(r,d),E?.(d,m),n})},p=!!(b??x),L=`/products/${e.handle}`,g=()=>{(b??x)?.(m)},U=async()=>{const r=u.filter(n=>n.selected);y(!0);try{await z?.(m,r)}finally{y(!1)}},X=async()=>{const r=u.filter(n=>n.selected);w(!0);try{await A?.(m,r)}finally{w(!1)}};return(0,i.jsxs)("div",{ref:_,className:(0,P.cn)("bg-container-primary rounded-box flex items-stretch overflow-hidden",G==="horizontal"?["laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col","laptop:col-span-2"]:["flex-col justify-between"],j),...V,children:[(0,i.jsx)(M.default,{images:a,name:e.name,layout:G,tags:e.tags||B,onClick:p?g:void 0,href:p?void 0:L}),(0,i.jsx)("div",{className:(0,P.cn)("bg-container-primary desktop:p-6 flex flex-col justify-between p-4",G==="horizontal"?["rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none","laptop:basis-[39.1%]","desktop:basis-[42.1%]","lg-desktop:basis-[42.1%]","shrink-0"]:["rounded-b-box","w-full","grow"]),children:(0,i.jsxs)("div",{className:"flex flex-1 flex-col justify-between gap-6",children:[(0,i.jsx)(O.default,{name:e.name,onClick:p?g:void 0,href:p?void 0:L,description:e.description,classNames:k}),(0,i.jsx)(I.default,{freeGiftLabel:e.freeGiftLabel,freeGifts:u,onGiftClick:Q,giftType:o,selectedGiftSku:s,theme:q}),(0,i.jsx)(T.default,{currentPrice:e.currentPrice??"",originalPrice:e.originalPrice,priceLabel:e.priceLabel,learnMoreText:e.learnMoreText,shopNowText:e.shopNowText,soldOutText:W,onLearnMore:U,onShopNow:X,availableForSale:e.availableForSale,learnMoreLoading:J,shopNowLoading:K,trackingTitle:e.name,trackingDescription:e.description,trackingSku:e.sku,classNames:k})]})})]})});N.displayName="BuyOneGetOneShelf.ProductCard";var ne=N;
|
|
2
2
|
//# sourceMappingURL=ProductCard.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/ProductCard.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductImage from './ProductImage.js'\nimport ProductInfo from './ProductInfo.js'\nimport GiftSelection from './GiftSelection.js'\nimport PriceAndActions from './PriceAndActions.js'\nimport { BuyOneGetOneShelfContext } from './context.js'\nimport type {\n FreeGift,\n FreeGiftWithSelection,\n ProductCardData,\n PureProductData,\n ProductTag,\n BuyOneGetOneShelfProductCardSemanticName,\n} from './types.js'\n\nexport interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4EA7\u54C1\u6570\u636E\uFF08\u4E0D\u5305\u542B\u8D60\u54C1\u4FE1\u606F\uFF09 */\n productData: PureProductData\n /** \u8D60\u54C1\u5217\u8868 */\n gifts?: FreeGift[]\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u8D60\u9001\u5176\u4E2D\u4E00\u4E2A\u8D60\u54C1\uFF0C 2 -> \u8D60\u9001\u6240\u6709\u8D60\u54C1 */\n giftType?: 1 | 2\n /** \u573A\u666F\u56FE\u7247 */\n sceneImages: any\n /** \u4EA7\u54C1\u6807\u7B7E */\n tags?: ProductTag[]\n /** \u5F53\u524D\u9009\u4E2D\u7684\u8D60\u54C1SKU\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n selectedGiftSku?: string\n /** @deprecated Layout is now automatically inferred by Root based on children count. */\n layout?: 'horizontal' | 'vertical'\n classNames?: Partial<Record<BuyOneGetOneShelfProductCardSemanticName, string>>\n soldOutText?: string\n /** @deprecated Use `onProductImageClick` instead. */\n onProductClick?: (product: ProductCardData) => void\n /** \u4EA7\u54C1\u56FE\u7247\u70B9\u51FB\u56DE\u8C03 */\n onProductImageClick?: (product: ProductCardData) => void\n /** Learn More \u70B9\u51FB\u56DE\u8C03 */\n onLearnMore?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** Shop Now \u70B9\u51FB\u56DE\u8C03 */\n onShopNow?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u9009\u62E9\u53D8\u5316\u56DE\u8C03 */\n onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void\n /** \u9009\u4E2D\u8D60\u54C1SKU\u53D8\u5316\u56DE\u8C03\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n onSelectedGiftSkuChange?: (selectedSku: string | null) => void\n}\n\n/**\n * ProductCard - \u4E70\u8D60\u8D27\u67B6\u4EA7\u54C1\u5361\u7247\n *\n * @description \u7528\u4E8E\u4E70\u4E00\u8D60\u4E00\u6D3B\u52A8\u7684\u4EA7\u54C1\u5C55\u793A\u5361\u7247\uFF0C\u5DE6\u4FA7\u5C55\u793A\u4EA7\u54C1\u56FE\u7247\u548C\u6807\u7B7E\uFF0C\u53F3\u4FA7\u5C55\u793A\u4EA7\u54C1\u4FE1\u606F\u3001\u8D60\u54C1\u548C\u8D2D\u4E70\u6309\u94AE\n */\nconst ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(\n (\n {\n productData,\n gifts = [],\n giftType = 1,\n selectedGiftSku,\n sceneImages,\n tags,\n layout: layoutProp,\n className,\n onProductClick,\n onProductImageClick,\n onLearnMore,\n onShopNow,\n onGiftClick,\n onGiftSelectionChange,\n classNames,\n soldOutText,\n ...props\n },\n ref\n ) => {\n const { layout: contextLayout } = React.useContext(BuyOneGetOneShelfContext)\n const layout = layoutProp ?? contextLayout\n\n const [learnMoreLoading, setLearnMoreLoading] = React.useState(false)\n const [shopNowLoading, setShopNowLoading] = React.useState(false)\n\n // \u5185\u90E8\u72B6\u6001\u7BA1\u7406\u8D60\u54C1\u7684\u9009\u62E9\u72B6\u6001 - \u4F7F\u7528\u9009\u4E2D\u7684ID\u6570\u7EC4\u800C\u4E0D\u662F\u4FEE\u6539gift\u5BF9\u8C61\n const [selectedGiftIds, setSelectedGiftIds] = React.useState<string[]>(() => {\n if (!gifts || gifts.length === 0) return []\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n return gifts.map((gift: FreeGift) => gift.id)\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u8D60\u54C1\n return [gifts[0].id]\n }\n })\n\n // \u751F\u6210\u5E26\u6709\u9009\u62E9\u72B6\u6001\u7684\u8D60\u54C1\u5217\u8868\u7528\u4E8E\u6E32\u67D3\n const giftsWithSelection = React.useMemo(() => {\n if (!gifts) return []\n\n return gifts.map((gift: FreeGift) => ({\n ...gift,\n selected: selectedGiftIds.includes(gift.id),\n }))\n }, [gifts, selectedGiftIds])\n\n // \u5F53 gifts \u6216 giftType \u66F4\u65B0\u65F6\uFF0C\u540C\u6B65\u66F4\u65B0\u5185\u90E8\u72B6\u6001\n React.useEffect(() => {\n if (!gifts || gifts.length === 0) {\n setSelectedGiftIds([])\n return\n }\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n setSelectedGiftIds(gifts.map((gift: FreeGift) => gift.id))\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u667A\u80FD\u72B6\u6001\u7BA1\u7406\n setSelectedGiftIds(prevSelectedIds => {\n // \u68C0\u67E5\u5F53\u524D\u9009\u4E2D\u7684\u793C\u54C1\u662F\u5426\u4ECD\u7136\u5B58\u5728\u4E8E\u65B0\u7684 gifts \u5217\u8868\u4E2D\n const currentSelectedId = prevSelectedIds[0]\n const isCurrentSelectionValid =\n currentSelectedId && gifts.some((gift: FreeGift) => gift.id === currentSelectedId)\n\n // \u5982\u679C\u5F53\u524D\u9009\u4E2D\u72B6\u6001\u4ECD\u7136\u6709\u6548\uFF0C\u4FDD\u6301\u4E0D\u53D8\uFF1B\u5426\u5219\u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\n return isCurrentSelectionValid ? [currentSelectedId] : [gifts[0].id]\n })\n }\n }, [gifts, giftType])\n\n // \u6784\u9020\u5B8C\u6574\u7684\u4EA7\u54C1\u6570\u636E\u7528\u4E8E\u56DE\u8C03\n const fullProductData: ProductCardData = React.useMemo(\n () => ({\n ...productData,\n gifts,\n gift_type: giftType,\n }),\n [productData, gifts, giftType]\n )\n\n const handleGiftClick = (gift: FreeGift) => {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u4E0D\u5141\u8BB8\u53D6\u6D88\u9009\u62E9\uFF0C\u76F4\u63A5\u8FD4\u56DE\n if (giftType === 2) {\n // \u83B7\u53D6\u5F53\u524D\u6240\u6709\u9009\u4E2D\u7684gifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\n const currentSelectedGifts = giftsWithSelection.filter((g: FreeGiftWithSelection) => g.selected)\n onGiftClick?.(gift, currentSelectedGifts)\n return\n }\n\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F)\n setSelectedGiftIds(() => {\n const newSelectedIds = [gift.id] // \u5355\u9009\uFF1A\u59CB\u7EC8\u9009\u4E2D\u5F53\u524D\u9879\uFF0C\u70B9\u51FB\u5DF2\u9009\u4E2D\u9879\u4FDD\u6301\u72B6\u6001\uFF0C\u70B9\u51FB\u672A\u9009\u4E2D\u9879\u5207\u6362\u5230\u8BE5\u9879\n\n // \u8BA1\u7B97\u65B0\u7684\u9009\u4E2Dgifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\u4F20\u9012\u7ED9\u56DE\u8C03\n const newSelectedGifts = gifts?.filter((g: FreeGift) => newSelectedIds.includes(g.id)) || []\n\n // \u8C03\u7528\u56DE\u8C03\u51FD\u6570\uFF0C\u7B2C\u4E8C\u4E2A\u53C2\u6570\u662F\u5F53\u524D\u9009\u4E2D\u7684gifts\n onGiftClick?.(gift, newSelectedGifts)\n onGiftSelectionChange?.(newSelectedGifts, fullProductData)\n\n return newSelectedIds\n })\n }\n\n const hasClickHandler = !!(onProductImageClick ?? onProductClick)\n const productHref = `/products/${productData.handle}`\n\n const handleProductImageClick = () => {\n const callback = onProductImageClick ?? onProductClick\n callback?.(fullProductData)\n }\n\n const handleLearnMoreClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setLearnMoreLoading(true)\n try {\n await onLearnMore?.(fullProductData, selectedGifts)\n } finally {\n setLearnMoreLoading(false)\n }\n }\n\n const handleShopNowClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setShopNowLoading(true)\n try {\n await onShopNow?.(fullProductData, selectedGifts)\n } finally {\n setShopNowLoading(false)\n }\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary rounded-box flex items-stretch overflow-hidden',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5BB9\u5668\n layout === 'horizontal'\n ? [\n 'laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col',\n 'laptop:col-span-2',\n ]\n : ['flex-col justify-between'],\n className\n )}\n {...props}\n >\n {/* \u4EA7\u54C1\u56FE\u7247\u533A\u57DF */}\n <ProductImage\n images={sceneImages}\n name={productData.name}\n layout={layout}\n tags={productData.tags || tags}\n onClick={hasClickHandler ? handleProductImageClick : undefined}\n href={hasClickHandler ? undefined : productHref}\n />\n\n {/* \u4EA7\u54C1\u4FE1\u606F\u533A\u57DF */}\n <div\n className={cn(\n 'bg-container-primary desktop:p-6 flex flex-col justify-between p-4',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5706\u89D2\u548C\u5C3A\u5BF8\n layout === 'horizontal'\n ? [\n 'rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none',\n // \u4F7F\u7528 flex-basis \u8BBE\u7F6E\u5BBD\u5EA6\u6BD4\u4F8B\n 'laptop:basis-[39.1%]', // 360px / 921px \u2248 39.1%\n 'desktop:basis-[42.1%]', // 552px / 1312px \u2248 42.1%\n 'lg-desktop:basis-[42.1%]', // 700px / 1664px \u2248 42.1%\n 'shrink-0',\n ]\n : ['rounded-b-box', 'w-full', 'grow']\n )}\n >\n <div className=\"flex flex-1 flex-col justify-between gap-6\">\n {/* \u4EA7\u54C1\u6807\u9898\u548C\u63CF\u8FF0 */}\n <ProductInfo\n name={productData.name}\n onClick={hasClickHandler ? handleProductImageClick : undefined}\n href={hasClickHandler ? undefined : productHref}\n description={productData.description}\n classNames={classNames}\n />\n\n {/* \u514D\u8D39\u8D60\u54C1\u533A\u57DF */}\n <GiftSelection\n freeGiftLabel={productData.freeGiftLabel}\n freeGifts={giftsWithSelection}\n onGiftClick={handleGiftClick}\n giftType={giftType}\n selectedGiftSku={selectedGiftSku}\n />\n <PriceAndActions\n currentPrice={productData.currentPrice ?? ''}\n originalPrice={productData.originalPrice}\n priceLabel={productData.priceLabel}\n learnMoreText={productData.learnMoreText}\n shopNowText={productData.shopNowText}\n soldOutText={soldOutText}\n onLearnMore={handleLearnMoreClick}\n onShopNow={handleShopNowClick}\n availableForSale={productData.availableForSale}\n learnMoreLoading={learnMoreLoading}\n shopNowLoading={shopNowLoading}\n trackingTitle={productData.name}\n trackingDescription={productData.description}\n trackingSku={productData.sku}\n classNames={classNames}\n />\n </div>\n </div>\n </div>\n )\n }\n)\n\nProductCard.displayName = 'BuyOneGetOneShelf.ProductCard'\n\nexport default ProductCard\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["ProductCard_exports", "__export", "ProductCard_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_ProductImage", "import_ProductInfo", "import_GiftSelection", "import_PriceAndActions", "import_context", "ProductCard", "productData", "gifts", "giftType", "selectedGiftSku", "sceneImages", "tags", "layoutProp", "className", "onProductClick", "onProductImageClick", "onLearnMore", "onShopNow", "onGiftClick", "onGiftSelectionChange", "classNames", "soldOutText", "props", "ref", "contextLayout", "layout", "learnMoreLoading", "setLearnMoreLoading", "shopNowLoading", "setShopNowLoading", "selectedGiftIds", "setSelectedGiftIds", "gift", "giftsWithSelection", "prevSelectedIds", "currentSelectedId", "fullProductData", "handleGiftClick", "currentSelectedGifts", "g", "newSelectedIds", "newSelectedGifts", "hasClickHandler", "productHref", "handleProductImageClick", "handleLearnMoreClick", "selectedGifts", "handleShopNowClick", "ProductImage", "ProductInfo", "GiftSelection", "PriceAndActions"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductImage from './ProductImage.js'\nimport ProductInfo from './ProductInfo.js'\nimport GiftSelection from './GiftSelection.js'\nimport PriceAndActions from './PriceAndActions.js'\nimport { BuyOneGetOneShelfContext } from './context.js'\nimport type {\n FreeGift,\n FreeGiftWithSelection,\n ProductCardData,\n PureProductData,\n ProductTag,\n BuyOneGetOneShelfProductCardSemanticName,\n} from './types.js'\n\nexport interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4EA7\u54C1\u6570\u636E\uFF08\u4E0D\u5305\u542B\u8D60\u54C1\u4FE1\u606F\uFF09 */\n productData: PureProductData\n /** \u8D60\u54C1\u5217\u8868 */\n gifts?: FreeGift[]\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u8D60\u9001\u5176\u4E2D\u4E00\u4E2A\u8D60\u54C1\uFF0C 2 -> \u8D60\u9001\u6240\u6709\u8D60\u54C1 */\n giftType?: 1 | 2\n /** \u573A\u666F\u56FE\u7247 */\n sceneImages: any\n /** \u4EA7\u54C1\u6807\u7B7E */\n tags?: ProductTag[]\n /** \u5F53\u524D\u9009\u4E2D\u7684\u8D60\u54C1SKU\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n selectedGiftSku?: string\n /** @deprecated Layout is now automatically inferred by Root based on children count. */\n layout?: 'horizontal' | 'vertical'\n classNames?: Partial<Record<BuyOneGetOneShelfProductCardSemanticName, string>>\n soldOutText?: string\n /** @deprecated Use `onProductImageClick` instead. */\n onProductClick?: (product: ProductCardData) => void\n /** \u4EA7\u54C1\u56FE\u7247\u70B9\u51FB\u56DE\u8C03 */\n onProductImageClick?: (product: ProductCardData) => void\n /** Learn More \u70B9\u51FB\u56DE\u8C03 */\n onLearnMore?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** Shop Now \u70B9\u51FB\u56DE\u8C03 */\n onShopNow?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u9009\u62E9\u53D8\u5316\u56DE\u8C03 */\n onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void\n /** \u9009\u4E2D\u8D60\u54C1SKU\u53D8\u5316\u56DE\u8C03\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n onSelectedGiftSkuChange?: (selectedSku: string | null) => void\n}\n\n/**\n * ProductCard - \u4E70\u8D60\u8D27\u67B6\u4EA7\u54C1\u5361\u7247\n *\n * @description \u7528\u4E8E\u4E70\u4E00\u8D60\u4E00\u6D3B\u52A8\u7684\u4EA7\u54C1\u5C55\u793A\u5361\u7247\uFF0C\u5DE6\u4FA7\u5C55\u793A\u4EA7\u54C1\u56FE\u7247\u548C\u6807\u7B7E\uFF0C\u53F3\u4FA7\u5C55\u793A\u4EA7\u54C1\u4FE1\u606F\u3001\u8D60\u54C1\u548C\u8D2D\u4E70\u6309\u94AE\n */\nconst ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(\n (\n {\n productData,\n gifts = [],\n giftType = 1,\n selectedGiftSku,\n sceneImages,\n tags,\n layout: layoutProp,\n className,\n onProductClick,\n onProductImageClick,\n onLearnMore,\n onShopNow,\n onGiftClick,\n onGiftSelectionChange,\n classNames,\n soldOutText,\n ...props\n },\n ref\n ) => {\n const { layout: contextLayout, theme } = React.useContext(BuyOneGetOneShelfContext)\n const layout = layoutProp ?? contextLayout\n\n const [learnMoreLoading, setLearnMoreLoading] = React.useState(false)\n const [shopNowLoading, setShopNowLoading] = React.useState(false)\n\n // \u5185\u90E8\u72B6\u6001\u7BA1\u7406\u8D60\u54C1\u7684\u9009\u62E9\u72B6\u6001 - \u4F7F\u7528\u9009\u4E2D\u7684ID\u6570\u7EC4\u800C\u4E0D\u662F\u4FEE\u6539gift\u5BF9\u8C61\n const [selectedGiftIds, setSelectedGiftIds] = React.useState<string[]>(() => {\n if (!gifts || gifts.length === 0) return []\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n return gifts.map((gift: FreeGift) => gift.id)\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u8D60\u54C1\n return [gifts[0].id]\n }\n })\n\n // \u751F\u6210\u5E26\u6709\u9009\u62E9\u72B6\u6001\u7684\u8D60\u54C1\u5217\u8868\u7528\u4E8E\u6E32\u67D3\n const giftsWithSelection = React.useMemo(() => {\n if (!gifts) return []\n\n return gifts.map((gift: FreeGift) => ({\n ...gift,\n selected: selectedGiftIds.includes(gift.id),\n }))\n }, [gifts, selectedGiftIds])\n\n // \u5F53 gifts \u6216 giftType \u66F4\u65B0\u65F6\uFF0C\u540C\u6B65\u66F4\u65B0\u5185\u90E8\u72B6\u6001\n React.useEffect(() => {\n if (!gifts || gifts.length === 0) {\n setSelectedGiftIds([])\n return\n }\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n setSelectedGiftIds(gifts.map((gift: FreeGift) => gift.id))\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u667A\u80FD\u72B6\u6001\u7BA1\u7406\n setSelectedGiftIds(prevSelectedIds => {\n // \u68C0\u67E5\u5F53\u524D\u9009\u4E2D\u7684\u793C\u54C1\u662F\u5426\u4ECD\u7136\u5B58\u5728\u4E8E\u65B0\u7684 gifts \u5217\u8868\u4E2D\n const currentSelectedId = prevSelectedIds[0]\n const isCurrentSelectionValid =\n currentSelectedId && gifts.some((gift: FreeGift) => gift.id === currentSelectedId)\n\n // \u5982\u679C\u5F53\u524D\u9009\u4E2D\u72B6\u6001\u4ECD\u7136\u6709\u6548\uFF0C\u4FDD\u6301\u4E0D\u53D8\uFF1B\u5426\u5219\u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\n return isCurrentSelectionValid ? [currentSelectedId] : [gifts[0].id]\n })\n }\n }, [gifts, giftType])\n\n // \u6784\u9020\u5B8C\u6574\u7684\u4EA7\u54C1\u6570\u636E\u7528\u4E8E\u56DE\u8C03\n const fullProductData: ProductCardData = React.useMemo(\n () => ({\n ...productData,\n gifts,\n gift_type: giftType,\n }),\n [productData, gifts, giftType]\n )\n\n const handleGiftClick = (gift: FreeGift) => {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u4E0D\u5141\u8BB8\u53D6\u6D88\u9009\u62E9\uFF0C\u76F4\u63A5\u8FD4\u56DE\n if (giftType === 2) {\n // \u83B7\u53D6\u5F53\u524D\u6240\u6709\u9009\u4E2D\u7684gifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\n const currentSelectedGifts = giftsWithSelection.filter((g: FreeGiftWithSelection) => g.selected)\n onGiftClick?.(gift, currentSelectedGifts)\n return\n }\n\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F)\n setSelectedGiftIds(() => {\n const newSelectedIds = [gift.id] // \u5355\u9009\uFF1A\u59CB\u7EC8\u9009\u4E2D\u5F53\u524D\u9879\uFF0C\u70B9\u51FB\u5DF2\u9009\u4E2D\u9879\u4FDD\u6301\u72B6\u6001\uFF0C\u70B9\u51FB\u672A\u9009\u4E2D\u9879\u5207\u6362\u5230\u8BE5\u9879\n\n // \u8BA1\u7B97\u65B0\u7684\u9009\u4E2Dgifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\u4F20\u9012\u7ED9\u56DE\u8C03\n const newSelectedGifts = gifts?.filter((g: FreeGift) => newSelectedIds.includes(g.id)) || []\n\n // \u8C03\u7528\u56DE\u8C03\u51FD\u6570\uFF0C\u7B2C\u4E8C\u4E2A\u53C2\u6570\u662F\u5F53\u524D\u9009\u4E2D\u7684gifts\n onGiftClick?.(gift, newSelectedGifts)\n onGiftSelectionChange?.(newSelectedGifts, fullProductData)\n\n return newSelectedIds\n })\n }\n\n const hasClickHandler = !!(onProductImageClick ?? onProductClick)\n const productHref = `/products/${productData.handle}`\n\n const handleProductImageClick = () => {\n const callback = onProductImageClick ?? onProductClick\n callback?.(fullProductData)\n }\n\n const handleLearnMoreClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setLearnMoreLoading(true)\n try {\n await onLearnMore?.(fullProductData, selectedGifts)\n } finally {\n setLearnMoreLoading(false)\n }\n }\n\n const handleShopNowClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setShopNowLoading(true)\n try {\n await onShopNow?.(fullProductData, selectedGifts)\n } finally {\n setShopNowLoading(false)\n }\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary rounded-box flex items-stretch overflow-hidden',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5BB9\u5668\n layout === 'horizontal'\n ? [\n 'laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col',\n 'laptop:col-span-2',\n ]\n : ['flex-col justify-between'],\n className\n )}\n {...props}\n >\n {/* \u4EA7\u54C1\u56FE\u7247\u533A\u57DF */}\n <ProductImage\n images={sceneImages}\n name={productData.name}\n layout={layout}\n tags={productData.tags || tags}\n onClick={hasClickHandler ? handleProductImageClick : undefined}\n href={hasClickHandler ? undefined : productHref}\n />\n\n {/* \u4EA7\u54C1\u4FE1\u606F\u533A\u57DF */}\n <div\n className={cn(\n 'bg-container-primary desktop:p-6 flex flex-col justify-between p-4',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5706\u89D2\u548C\u5C3A\u5BF8\n layout === 'horizontal'\n ? [\n 'rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none',\n // \u4F7F\u7528 flex-basis \u8BBE\u7F6E\u5BBD\u5EA6\u6BD4\u4F8B\n 'laptop:basis-[39.1%]', // 360px / 921px \u2248 39.1%\n 'desktop:basis-[42.1%]', // 552px / 1312px \u2248 42.1%\n 'lg-desktop:basis-[42.1%]', // 700px / 1664px \u2248 42.1%\n 'shrink-0',\n ]\n : ['rounded-b-box', 'w-full', 'grow']\n )}\n >\n <div className=\"flex flex-1 flex-col justify-between gap-6\">\n {/* \u4EA7\u54C1\u6807\u9898\u548C\u63CF\u8FF0 */}\n <ProductInfo\n name={productData.name}\n onClick={hasClickHandler ? handleProductImageClick : undefined}\n href={hasClickHandler ? undefined : productHref}\n description={productData.description}\n classNames={classNames}\n />\n\n {/* \u514D\u8D39\u8D60\u54C1\u533A\u57DF */}\n <GiftSelection\n freeGiftLabel={productData.freeGiftLabel}\n freeGifts={giftsWithSelection}\n onGiftClick={handleGiftClick}\n giftType={giftType}\n selectedGiftSku={selectedGiftSku}\n theme={theme}\n />\n <PriceAndActions\n currentPrice={productData.currentPrice ?? ''}\n originalPrice={productData.originalPrice}\n priceLabel={productData.priceLabel}\n learnMoreText={productData.learnMoreText}\n shopNowText={productData.shopNowText}\n soldOutText={soldOutText}\n onLearnMore={handleLearnMoreClick}\n onShopNow={handleShopNowClick}\n availableForSale={productData.availableForSale}\n learnMoreLoading={learnMoreLoading}\n shopNowLoading={shopNowLoading}\n trackingTitle={productData.name}\n trackingDescription={productData.description}\n trackingSku={productData.sku}\n classNames={classNames}\n />\n </div>\n </div>\n </div>\n )\n }\n)\n\nProductCard.displayName = 'BuyOneGetOneShelf.ProductCard'\n\nexport default ProductCard\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["ProductCard_exports", "__export", "ProductCard_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_ProductImage", "import_ProductInfo", "import_GiftSelection", "import_PriceAndActions", "import_context", "ProductCard", "productData", "gifts", "giftType", "selectedGiftSku", "sceneImages", "tags", "layoutProp", "className", "onProductClick", "onProductImageClick", "onLearnMore", "onShopNow", "onGiftClick", "onGiftSelectionChange", "classNames", "soldOutText", "props", "ref", "contextLayout", "theme", "layout", "learnMoreLoading", "setLearnMoreLoading", "shopNowLoading", "setShopNowLoading", "selectedGiftIds", "setSelectedGiftIds", "gift", "giftsWithSelection", "prevSelectedIds", "currentSelectedId", "fullProductData", "handleGiftClick", "currentSelectedGifts", "g", "newSelectedIds", "newSelectedGifts", "hasClickHandler", "productHref", "handleProductImageClick", "handleLearnMoreClick", "selectedGifts", "handleShopNowClick", "ProductImage", "ProductInfo", "GiftSelection", "PriceAndActions"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var h=Object.create;var r=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var x=(t,e)=>{for(var o in e)r(t,o,{get:e[o],enumerable:!0})},n=(t,e,o,l)=>{if(e&&typeof e=="object"||typeof e=="function")for(let a of c(e))!u.call(t,a)&&a!==o&&r(t,a,{get:()=>e[a],enumerable:!(l=i(e,a))||l.enumerable});return t};var y=(t,e,o)=>(o=t!=null?h(m(t)):{},n(e||!t||!t.__esModule?r(o,"default",{value:t,enumerable:!0}):o,t)),f=t=>n(r({},"__esModule",{value:!0}),t);var z={};x(z,{BuyOneGetOneShelfContext:()=>s});module.exports=f(z);var p=y(require("react"));const s=p.createContext({layout:"horizontal"});
|
|
2
2
|
//# sourceMappingURL=context.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/context.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\n\nexport const BuyOneGetOneShelfContext = React.createContext<{\n layout: 'horizontal' | 'vertical'\n}>({\n layout: 'horizontal',\n})\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBAEhB,MAAMF,EAA2BE,EAAM,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\n\nexport const BuyOneGetOneShelfContext = React.createContext<{\n layout: 'horizontal' | 'vertical'\n theme?: 'light' | 'dark'\n}>({\n layout: 'horizontal',\n})\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,8BAAAE,IAAA,eAAAC,EAAAH,GAAA,IAAAI,EAAuB,oBAEhB,MAAMF,EAA2BE,EAAM,cAG3C,CACD,OAAQ,YACV,CAAC",
|
|
6
6
|
"names": ["context_exports", "__export", "BuyOneGetOneShelfContext", "__toCommonJS", "React"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var k=Object.create;var d=Object.defineProperty;var w=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var I=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var T=(e,t)=>{for(var o in t)d(e,o,{get:t[o],enumerable:!0})},O=(e,t,o,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of z(t))!L.call(e,n)&&n!==o&&d(e,n,{get:()=>t[n],enumerable:!(i=w(t,n))||i.enumerable});return e};var R=(e,t,o)=>(o=e!=null?k(I(e)):{},O(t||!e||!e.__esModule?d(o,"default",{value:e,enumerable:!0}):o,e)),M=e=>O(d({},"__esModule",{value:!0}),e);var A={};T(A,{default:()=>W});module.exports=M(A);var r=require("react/jsx-runtime"),a=R(require("react")),s=require("../../helpers/index.js"),C=R(require("./ProductCard.js")),u=require("../../components/index.js"),N=require("./context.js"),S=require("../../hooks/useExposure.js");const H="shelf",V="buy_one_get_one_shelf";function x(e){return a.Children.toArray(e).flatMap(t=>a.isValidElement(t)&&t.type===a.Fragment?x(t.props.children):[t])}function _(e){return a.isValidElement(e)?e.props.layout??"horizontal":"horizontal"}function j(e,t){let o=0,i=0;for(let n=0;n<t;n++){const p=_(e[n])==="horizontal"?2:1;p===2&&o>0&&(o=0),o+=p,o===2&&(i=n+1,o=0)}return e.slice(0,i)}const v=a.forwardRef(({className:e,classNames:t={},theme:o,title:i,subtitle:n,children:p,viewMoreThreshold:y=4,viewMoreText:B="View More",viewLessText:G="View Less",...P},b)=>{const f=a.useRef(null),[c,E]=a.useState(!1);(0,S.useExposure)(f,{componentType:H,componentName:V,componentTitle:i,componentDescription:n}),a.useImperativeHandle(b,()=>f.current);const m=x(p),h=m.length>y,D=(h&&!c?j(m,y):m).map(l=>{if(!a.isValidElement(l))return l;const g=l.props;return g.layout==="horizontal"?a.cloneElement(l,{className:(0,s.cn)(g.className,"laptop:col-span-2")}):l});return(0,r.jsx)(N.BuyOneGetOneShelfContext.Provider,{value:{layout:"horizontal",theme:o},children:(0,r.jsxs)("div",{ref:f,className:(0,s.cn)("bogo-shelf-root w-full py-0",{"aiui-dark":o==="dark"},e,t?.root),...P,children:[i&&(0,r.jsx)(u.Heading,{as:"h2",html:i,className:(0,s.cn)("bogo-shelf-title text-info-primary mb-4",t?.title)}),n&&(0,r.jsx)(u.Text,{size:3,as:"p",html:n,className:(0,s.cn)("bogo-shelf-description text-info-primary mb-6",t?.description)}),(0,r.jsx)("div",{className:(0,s.cn)("grid grid-cols-1 gap-6","laptop:grid-cols-2"),children:D}),h&&(0,r.jsx)("div",{className:"mt-6 flex justify-center",children:(0,r.jsxs)("button",{type:"button",onClick:()=>E(l=>!l),"aria-expanded":c,className:(0,s.cn)("hover:text-brand-0 lg-desktop:text-[16px] text-info-primary flex cursor-pointer items-center gap-2 border-none bg-transparent text-[14px] font-bold outline-none transition-colors",t?.viewMoreBtn),children:[c?G:B,(0,r.jsx)("svg",{className:(0,s.cn)("size-4 transition-transform",c&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})})]})})});v.displayName="BuyOneGetOneShelf.Root";const F={Root:v,ProductCard:C.default};var W=F;
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductCard from './ProductCard.js'\nimport { Heading, Text } from '../../components/index.js'\nimport type { BuyOneGetOneShelfProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nconst componentType = 'shelf'\nconst componentName = 'buy_one_get_one_shelf'\n\nfunction flattenChildren(children: React.ReactNode): React.ReactNode[] {\n return React.Children.toArray(children).flatMap(child => {\n if (React.isValidElement(child) && child.type === React.Fragment) {\n return flattenChildren((child.props as { children?: React.ReactNode }).children)\n }\n return [child]\n })\n}\n\nfunction getLayout(node: React.ReactNode): string {\n if (React.isValidElement(node)) {\n return (node.props as { layout?: string }).layout ?? 'horizontal'\n }\n return 'horizontal'\n}\n\nfunction sliceToCompleteRow(all: React.ReactNode[], threshold: number): React.ReactNode[] {\n let filledInRow = 0\n let lastCompleteIndex = 0\n for (let i = 0; i < threshold; i++) {\n const span = getLayout(all[i]) === 'horizontal' ? 2 : 1\n if (span === 2 && filledInRow > 0) filledInRow = 0\n filledInRow += span\n if (filledInRow === 2) {\n lastCompleteIndex = i + 1\n filledInRow = 0\n }\n }\n return all.slice(0, lastCompleteIndex)\n}\n\nconst BuyOneGetOneShelfRoot = React.forwardRef<HTMLDivElement, BuyOneGetOneShelfProps>(\n (\n {\n className,\n classNames = {},\n theme,\n title,\n subtitle,\n children,\n viewMoreThreshold = 4,\n viewMoreText = 'View More',\n viewLessText = 'View Less',\n ...props\n },\n ref\n ) => {\n const boxRef = React.useRef<HTMLDivElement>(null)\n const [isExpanded, setIsExpanded] = React.useState(false)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n React.useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n const childrenArray = flattenChildren(children)\n const needCollapse = childrenArray.length > viewMoreThreshold\n const displayedChildren =\n needCollapse && !isExpanded ? sliceToCompleteRow(childrenArray, viewMoreThreshold) : childrenArray\n\n const renderedChildren = displayedChildren.map(child => {\n if (!React.isValidElement(child)) return child\n const childProps = child.props as { layout?: string; className?: string }\n if (childProps.layout === 'horizontal') {\n return React.cloneElement(child as React.ReactElement<{ className?: string }>, {\n className: cn(childProps.className, 'laptop:col-span-2'),\n })\n }\n return child\n })\n\n return (\n <div\n
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["BuyOneGetOneShelf_exports", "__export", "BuyOneGetOneShelf_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_ProductCard", "import_components", "import_useExposure", "componentType", "componentName", "flattenChildren", "children", "child", "getLayout", "node", "sliceToCompleteRow", "all", "threshold", "filledInRow", "lastCompleteIndex", "i", "span", "BuyOneGetOneShelfRoot", "className", "classNames", "theme", "title", "subtitle", "viewMoreThreshold", "viewMoreText", "viewLessText", "props", "ref", "boxRef", "isExpanded", "setIsExpanded", "childrenArray", "needCollapse", "renderedChildren", "childProps", "prev", "BuyOneGetOneShelf", "ProductCard"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductCard from './ProductCard.js'\nimport { Heading, Text } from '../../components/index.js'\nimport { BuyOneGetOneShelfContext } from './context.js'\nimport type { BuyOneGetOneShelfProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nconst componentType = 'shelf'\nconst componentName = 'buy_one_get_one_shelf'\n\nfunction flattenChildren(children: React.ReactNode): React.ReactNode[] {\n return React.Children.toArray(children).flatMap(child => {\n if (React.isValidElement(child) && child.type === React.Fragment) {\n return flattenChildren((child.props as { children?: React.ReactNode }).children)\n }\n return [child]\n })\n}\n\nfunction getLayout(node: React.ReactNode): string {\n if (React.isValidElement(node)) {\n return (node.props as { layout?: string }).layout ?? 'horizontal'\n }\n return 'horizontal'\n}\n\nfunction sliceToCompleteRow(all: React.ReactNode[], threshold: number): React.ReactNode[] {\n let filledInRow = 0\n let lastCompleteIndex = 0\n for (let i = 0; i < threshold; i++) {\n const span = getLayout(all[i]) === 'horizontal' ? 2 : 1\n if (span === 2 && filledInRow > 0) filledInRow = 0\n filledInRow += span\n if (filledInRow === 2) {\n lastCompleteIndex = i + 1\n filledInRow = 0\n }\n }\n return all.slice(0, lastCompleteIndex)\n}\n\nconst BuyOneGetOneShelfRoot = React.forwardRef<HTMLDivElement, BuyOneGetOneShelfProps>(\n (\n {\n className,\n classNames = {},\n theme,\n title,\n subtitle,\n children,\n viewMoreThreshold = 4,\n viewMoreText = 'View More',\n viewLessText = 'View Less',\n ...props\n },\n ref\n ) => {\n const boxRef = React.useRef<HTMLDivElement>(null)\n const [isExpanded, setIsExpanded] = React.useState(false)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n React.useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n const childrenArray = flattenChildren(children)\n const needCollapse = childrenArray.length > viewMoreThreshold\n const displayedChildren =\n needCollapse && !isExpanded ? sliceToCompleteRow(childrenArray, viewMoreThreshold) : childrenArray\n\n const renderedChildren = displayedChildren.map(child => {\n if (!React.isValidElement(child)) return child\n const childProps = child.props as { layout?: string; className?: string }\n if (childProps.layout === 'horizontal') {\n return React.cloneElement(child as React.ReactElement<{ className?: string }>, {\n className: cn(childProps.className, 'laptop:col-span-2'),\n })\n }\n return child\n })\n\n return (\n <BuyOneGetOneShelfContext.Provider value={{ layout: 'horizontal', theme }}>\n <div\n ref={boxRef}\n className={cn(\n 'bogo-shelf-root w-full py-0',\n {\n 'aiui-dark': theme === 'dark',\n },\n className,\n classNames?.root\n )}\n {...props}\n >\n {title && (\n <Heading\n as=\"h2\"\n html={title}\n className={cn('bogo-shelf-title text-info-primary mb-4', classNames?.title)}\n />\n )}\n {subtitle && (\n <Text\n size={3}\n as=\"p\"\n html={subtitle}\n className={cn('bogo-shelf-description text-info-primary mb-6', classNames?.description)}\n />\n )}\n <div className={cn('grid grid-cols-1 gap-6', 'laptop:grid-cols-2')}>{renderedChildren}</div>\n {needCollapse && (\n <div className=\"mt-6 flex justify-center\">\n <button\n type=\"button\"\n onClick={() => setIsExpanded(prev => !prev)}\n aria-expanded={isExpanded}\n className={cn(\n 'hover:text-brand-0 lg-desktop:text-[16px] text-info-primary flex cursor-pointer items-center gap-2 border-none bg-transparent text-[14px] font-bold outline-none transition-colors',\n classNames?.viewMoreBtn\n )}\n >\n {isExpanded ? viewLessText : viewMoreText}\n <svg\n className={cn('size-4 transition-transform', isExpanded && 'rotate-180')}\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M19 9l-7 7-7-7\" />\n </svg>\n </button>\n </div>\n )}\n </div>\n </BuyOneGetOneShelfContext.Provider>\n )\n }\n)\n\nBuyOneGetOneShelfRoot.displayName = 'BuyOneGetOneShelf.Root'\n\n// \u521B\u5EFA\u547D\u540D\u7A7A\u95F4\u5BF9\u8C61\uFF0C\u5305\u542B Root \u548C ProductCard \u7EC4\u4EF6\nconst BuyOneGetOneShelf = {\n Root: BuyOneGetOneShelfRoot,\n ProductCard: ProductCard,\n}\n\nexport default BuyOneGetOneShelf\n\n// Re-export types for external use\nexport type {\n FreeGift,\n FreeGiftWithSelection,\n ProductTag,\n BuyOneGetOneShelfSemanticName,\n BuyOneGetOneShelfRootSemanticName,\n BuyOneGetOneShelfProductCardSemanticName,\n ResponsiveImage,\n ResponsiveImages,\n BaseProductData,\n PureProductData,\n WithGiftData,\n ProductData,\n ProductCardData,\n CopyConfig,\n BogoItem,\n BuyOneGetOneShelfData,\n BuyOneGetOneShelfProps,\n BuyOneGetOneShelfCardProps,\n} from './types.js'\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["BuyOneGetOneShelf_exports", "__export", "BuyOneGetOneShelf_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_ProductCard", "import_components", "import_context", "import_useExposure", "componentType", "componentName", "flattenChildren", "children", "child", "getLayout", "node", "sliceToCompleteRow", "all", "threshold", "filledInRow", "lastCompleteIndex", "i", "span", "BuyOneGetOneShelfRoot", "className", "classNames", "theme", "title", "subtitle", "viewMoreThreshold", "viewMoreText", "viewLessText", "props", "ref", "boxRef", "isExpanded", "setIsExpanded", "childrenArray", "needCollapse", "renderedChildren", "childProps", "prev", "BuyOneGetOneShelf", "ProductCard"]
|
|
7
7
|
}
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import type { FaqProps, FaqItem as ItemType, FaqSemanticName } from './types.js';
|
|
3
3
|
interface FaqItemProps {
|
|
4
4
|
data: ItemType;
|
|
5
|
-
|
|
5
|
+
index: number;
|
|
6
6
|
classNames?: Partial<Record<FaqSemanticName, string>>;
|
|
7
7
|
}
|
|
8
8
|
declare const FaqItem: {
|
|
9
|
-
({ data,
|
|
9
|
+
({ data, index, classNames }: FaqItemProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
12
12
|
declare const _default: React.ForwardRefExoticComponent<Omit<FaqProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../WheelLottery/index.js").ContainerProps & React.RefAttributes<unknown>> & {
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
"use strict";"use client";var
|
|
1
|
+
"use strict";"use client";var q=Object.create;var d=Object.defineProperty;var b=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var F=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var A=(e,o)=>{for(var t in o)d(e,t,{get:o[t],enumerable:!0})},u=(e,o,t,s)=>{if(o&&typeof o=="object"||typeof o=="function")for(let i of w(o))!N.call(e,i)&&i!==t&&d(e,i,{get:()=>o[i],enumerable:!(s=b(o,i))||s.enumerable});return e};var y=(e,o,t)=>(t=e!=null?q(F(e)):{},u(o||!e||!e.__esModule?d(t,"default",{value:e,enumerable:!0}):t,e)),I=e=>u(d({},"__esModule",{value:!0}),e);var k={};A(k,{FaqItem:()=>l,default:()=>C});module.exports=I(k);var a=require("react/jsx-runtime"),n=y(require("react")),m=y(require("@radix-ui/react-accordion")),c=require("../../components/index.js"),r=require("../../helpers/index.js"),x=require("../../shared/Styles.js");const h=n.default.forwardRef(({data:e,className:o,defaultOpenIndex:t,classNames:s={}},i)=>{const f=(0,n.useRef)(null);(0,n.useImperativeHandle)(i,()=>f.current);const v=(Array.isArray(t)?t:t!==void 0?[t]:e?.openFirst??!0?[0]:[]).map(p=>`item-${p}`);return(0,a.jsxs)("div",{ref:f,className:(0,r.cn)(o,s.root),children:[(0,a.jsx)("style",{children:`
|
|
2
|
+
@keyframes faq-slide-down {
|
|
3
|
+
from { height: 0; opacity: 0; }
|
|
4
|
+
to { height: var(--radix-accordion-content-height); opacity: 1; }
|
|
5
|
+
}
|
|
6
|
+
@keyframes faq-slide-up {
|
|
7
|
+
from { height: var(--radix-accordion-content-height); opacity: 1; }
|
|
8
|
+
to { height: 0; opacity: 0; }
|
|
9
|
+
}
|
|
10
|
+
`}),(0,a.jsx)(m.Root,{type:"multiple",defaultValue:v,children:e?.productData?.map((p,g)=>(0,a.jsx)(l,{data:p,index:g,classNames:s},g))})]})});h.displayName="Faq";const l=({data:e,index:o,classNames:t={}})=>(0,a.jsxs)(m.Item,{value:`item-${o}`,className:(0,r.cn)("tablet:py-6 border-b border-[#E4E5E6] py-4",t.item),children:[(0,a.jsx)(m.Header,{className:"flex",children:(0,a.jsxs)(m.Trigger,{className:(0,r.cn)("tablet:gap-[128px] group flex flex-1 !cursor-pointer items-center justify-between gap-4 text-left",t.itemHeader),children:[(0,a.jsx)(c.Heading,{as:"h3",html:e?.title,className:(0,r.cn)("desktop:text-base lg-desktop:text-lg text-info-primary text-sm font-bold leading-[1.4]",t.title)}),(0,a.jsx)("div",{className:(0,r.cn)("transition-transform duration-300 group-data-[state=open]:rotate-180",t.icon),children:(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-[20px]",width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",children:(0,a.jsx)("path",{d:"M14.4111 7.41107C14.7365 7.08563 15.264 7.08563 15.5895 7.41107C15.9149 7.73651 15.9149 8.26402 15.5895 8.58946L10.5895 13.5895C10.264 13.9149 9.73651 13.9149 9.41107 13.5895L4.41107 8.58946C4.08563 8.26402 4.08563 7.73651 4.41107 7.41107C4.73651 7.08563 5.26402 7.08563 5.58946 7.41107L10.0003 11.8219L14.4111 7.41107Z",fill:"#1D1D1F"})})})]})}),(0,a.jsx)(m.Content,{className:(0,r.cn)("overflow-hidden text-[#4A4C56]","data-[state=open]:animate-[faq-slide-down_300ms_ease-out]","data-[state=closed]:animate-[faq-slide-up_300ms_ease-out]",t.content),children:(0,a.jsx)("div",{className:"mt-2",children:(0,a.jsx)(c.Text,{html:e?.richDesc??e?.desc,className:(0,r.cn)("desktop:text-base lg-desktop:text-lg [&_a]:text-brand-0 text-sm font-bold leading-[1.4] [&_a]:underline",t.description)})})})]});l.displayName="FaqItem";var C=(0,x.withLayout)(h);
|
|
2
11
|
//# sourceMappingURL=Faq.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Faq/Faq.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef
|
|
5
|
-
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,
|
|
6
|
-
"names": ["Faq_exports", "__export", "FaqItem", "Faq_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_components", "import_helpers", "import_Styles", "Faq", "React", "data", "className", "defaultOpenIndex", "classNames", "ref", "innerRef", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport * as Accordion from '@radix-ui/react-accordion'\nimport type { FaqProps, FaqItem as ItemType, FaqSemanticName } from './types.js'\nimport { Text, Heading } from '../../components/index.js'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\n\nconst Faq = React.forwardRef<HTMLDivElement, FaqProps>(\n ({ data, className, defaultOpenIndex, classNames = {} }, ref) => {\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current!)\n\n const openIndexes = Array.isArray(defaultOpenIndex)\n ? defaultOpenIndex\n : defaultOpenIndex !== undefined\n ? [defaultOpenIndex]\n : (data?.openFirst ?? true)\n ? [0]\n : []\n\n const defaultValue = openIndexes.map(index => `item-${index}`)\n\n return (\n <div ref={innerRef} className={cn(className, classNames.root)}>\n <style>{`\n @keyframes faq-slide-down {\n from { height: 0; opacity: 0; }\n to { height: var(--radix-accordion-content-height); opacity: 1; }\n }\n @keyframes faq-slide-up {\n from { height: var(--radix-accordion-content-height); opacity: 1; }\n to { height: 0; opacity: 0; }\n }\n `}</style>\n <Accordion.Root type=\"multiple\" defaultValue={defaultValue}>\n {data?.productData?.map((item: any, index: number) => (\n <FaqItem key={index} data={item} index={index} classNames={classNames} />\n ))}\n </Accordion.Root>\n </div>\n )\n }\n)\n\nFaq.displayName = 'Faq'\n\ninterface FaqItemProps {\n data: ItemType\n index: number\n classNames?: Partial<Record<FaqSemanticName, string>>\n}\n\nconst FaqItem = ({ data, index, classNames = {} }: FaqItemProps) => {\n return (\n <Accordion.Item\n value={`item-${index}`}\n className={cn('tablet:py-6 border-b border-[#E4E5E6] py-4', classNames.item)}\n >\n <Accordion.Header className=\"flex\">\n <Accordion.Trigger\n className={cn(\n 'tablet:gap-[128px] group flex flex-1 !cursor-pointer items-center justify-between gap-4 text-left',\n classNames.itemHeader\n )}\n >\n <Heading\n as=\"h3\"\n html={data?.title}\n className={cn(\n 'desktop:text-base lg-desktop:text-lg text-info-primary text-sm font-bold leading-[1.4]',\n classNames.title\n )}\n />\n <div className={cn('transition-transform duration-300 group-data-[state=open]:rotate-180', classNames.icon)}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"w-[20px]\"\n width=\"20\"\n height=\"21\"\n viewBox=\"0 0 20 21\"\n fill=\"none\"\n >\n <path\n d=\"M14.4111 7.41107C14.7365 7.08563 15.264 7.08563 15.5895 7.41107C15.9149 7.73651 15.9149 8.26402 15.5895 8.58946L10.5895 13.5895C10.264 13.9149 9.73651 13.9149 9.41107 13.5895L4.41107 8.58946C4.08563 8.26402 4.08563 7.73651 4.41107 7.41107C4.73651 7.08563 5.26402 7.08563 5.58946 7.41107L10.0003 11.8219L14.4111 7.41107Z\"\n fill=\"#1D1D1F\"\n />\n </svg>\n </div>\n </Accordion.Trigger>\n </Accordion.Header>\n\n <Accordion.Content\n className={cn(\n 'overflow-hidden text-[#4A4C56]',\n 'data-[state=open]:animate-[faq-slide-down_300ms_ease-out]',\n 'data-[state=closed]:animate-[faq-slide-up_300ms_ease-out]',\n classNames.content\n )}\n >\n <div className=\"mt-2\">\n <Text\n html={data?.richDesc ?? data?.desc}\n className={cn(\n 'desktop:text-base lg-desktop:text-lg [&_a]:text-brand-0 text-sm font-bold leading-[1.4] [&_a]:underline',\n classNames.description\n )}\n />\n </div>\n </Accordion.Content>\n </Accordion.Item>\n )\n}\n\nFaqItem.displayName = 'FaqItem'\n\nexport default withLayout(Faq)\nexport { FaqItem }\n"],
|
|
5
|
+
"mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,EAAA,YAAAC,IAAA,eAAAC,EAAAJ,GAwBM,IAAAK,EAAA,6BAvBNC,EAAmD,oBACnDC,EAA2B,wCAE3BC,EAA8B,qCAC9BC,EAAmB,kCACnBC,EAA2B,kCAE3B,MAAMC,EAAM,EAAAC,QAAM,WAChB,CAAC,CAAE,KAAAC,EAAM,UAAAC,EAAW,iBAAAC,EAAkB,WAAAC,EAAa,CAAC,CAAE,EAAGC,IAAQ,CAC/D,MAAMC,KAAW,UAAuB,IAAI,KAC5C,uBAAoBD,EAAK,IAAMC,EAAS,OAAQ,EAUhD,MAAMC,GARc,MAAM,QAAQJ,CAAgB,EAC9CA,EACAA,IAAqB,OACnB,CAACA,CAAgB,EAChBF,GAAM,WAAa,GAClB,CAAC,CAAC,EACF,CAAC,GAEwB,IAAIO,GAAS,QAAQA,CAAK,EAAE,EAE7D,SACE,QAAC,OAAI,IAAKF,EAAU,aAAW,MAAGJ,EAAWE,EAAW,IAAI,EAC1D,oBAAC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UASN,KACF,OAACT,EAAU,KAAV,CAAe,KAAK,WAAW,aAAcY,EAC3C,SAAAN,GAAM,aAAa,IAAI,CAACQ,EAAWD,OAClC,OAAClB,EAAA,CAAoB,KAAMmB,EAAM,MAAOD,EAAO,WAAYJ,GAA7CI,CAAyD,CACxE,EACH,GACF,CAEJ,CACF,EAEAT,EAAI,YAAc,MAQlB,MAAMT,EAAU,CAAC,CAAE,KAAAW,EAAM,MAAAO,EAAO,WAAAJ,EAAa,CAAC,CAAE,OAE5C,QAACT,EAAU,KAAV,CACC,MAAO,QAAQa,CAAK,GACpB,aAAW,MAAG,6CAA8CJ,EAAW,IAAI,EAE3E,oBAACT,EAAU,OAAV,CAAiB,UAAU,OAC1B,oBAACA,EAAU,QAAV,CACC,aAAW,MACT,oGACAS,EAAW,UACb,EAEA,oBAAC,WACC,GAAG,KACH,KAAMH,GAAM,MACZ,aAAW,MACT,yFACAG,EAAW,KACb,EACF,KACA,OAAC,OAAI,aAAW,MAAG,uEAAwEA,EAAW,IAAI,EACxG,mBAAC,OACC,MAAM,6BACN,UAAU,WACV,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OAEL,mBAAC,QACC,EAAE,kUACF,KAAK,UACP,EACF,EACF,GACF,EACF,KAEA,OAACT,EAAU,QAAV,CACC,aAAW,MACT,iCACA,4DACA,4DACAS,EAAW,OACb,EAEA,mBAAC,OAAI,UAAU,OACb,mBAAC,QACC,KAAMH,GAAM,UAAYA,GAAM,KAC9B,aAAW,MACT,0GACAG,EAAW,WACb,EACF,EACF,EACF,GACF,EAIJd,EAAQ,YAAc,UAEtB,IAAOC,KAAQ,cAAWQ,CAAG",
|
|
6
|
+
"names": ["Faq_exports", "__export", "FaqItem", "Faq_default", "__toCommonJS", "import_jsx_runtime", "import_react", "Accordion", "import_components", "import_helpers", "import_Styles", "Faq", "React", "data", "className", "defaultOpenIndex", "classNames", "ref", "innerRef", "defaultValue", "index", "item"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import*as
|
|
1
|
+
"use client";import{jsx as t,jsxs as i}from"react/jsx-runtime";import*as x from"react";import{cn as r}from"../../helpers/index.js";import"../../components/badge.js";import c from"../../components/picture.js";import{Text as s}from"../../components/text.js";const m=({checked:e,theme:l})=>{const o=l==="dark";return e?i("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:[t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",fill:o?"#F5F6F7":"#080A0F"}),t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:o?"#F5F6F7":"#080A0F",strokeWidth:"1.6"}),t("path",{d:"M8 11.5833L10.9474 14.5L16 9.5",stroke:o?"#1E2024":"white",strokeWidth:"1.6",strokeLinecap:"round",strokeLinejoin:"round"})]}):t("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",children:t("rect",{x:"2.8",y:"2.8",width:"18.4",height:"18.4",rx:"9.2",stroke:o?"#B5B7BB":"#2A2C32",strokeWidth:"1.6"})})},d=x.forwardRef(({gift:e,onClick:l,className:o,giftType:a,theme:n},p)=>t("div",{ref:p,className:r("bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all",a===2?"border-brand-0 bg-container-secondary-0 cursor-default":`cursor-pointer hover:shadow-sm ${e.selected?"border-brand-0 bg-container-secondary-0":"border-lines bg-secondary-0"}`,o),onClick:()=>{a===1&&l?.(e)},children:i("div",{className:"flex size-full flex-col",children:[t("div",{className:"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end",children:e.tag&&t("div",{className:"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]",children:e.tag})}),i("div",{className:r("laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2"),children:[t("div",{className:"flex size-5 shrink-0 items-center justify-center",children:t(m,{checked:!!e.selected,theme:n})}),t("div",{className:r("size-14 shrink-0","tablet:size-12"),children:t(c,{source:e.image,alt:e.name,className:"size-full rounded object-cover"})}),i("div",{className:"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1",children:[t(s,{size:2,html:e.name,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1")}),i("div",{className:"mt-auto flex items-center justify-between gap-2",children:[i("div",{className:"flex items-center gap-2",children:[t(s,{size:2,className:r("text-info-primary desktop:text-[16px] lg-desktop:text-[18px]"),children:e.currentPrice}),e.originalPrice&&e.originalPrice!==e.currentPrice&&t(s,{size:2,className:r("text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through"),children:e.originalPrice})]}),e.quantity>=1&&i(s,{size:4,className:r("text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]"),children:["x",e.quantity]})]})]})]})]})}));d.displayName="FreeGiftItem";var k=d;export{k as default};
|
|
2
2
|
//# sourceMappingURL=FreeGiftItem.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/FreeGiftItem.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport Badge from '../../components/badge.js'\nimport Picture from '../../components/picture.js'\nimport { Text } from '../../components/text.js'\n\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nexport interface FreeGiftItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /** \u8D60\u54C1\u6570\u636E\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n gift: FreeGiftWithSelection\n /** \u70B9\u51FB\u56DE\u8C03 */\n onClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n}\n\n/**\n * FreeGiftItem - \u514D\u8D39\u8D60\u54C1\u9879\n */\nconst FreeGiftItem = React.forwardRef<HTMLDivElement, FreeGiftItemProps>(\n ({ gift, onClick, className, giftType }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all',\n\n // \u6837\u5F0F\u6839\u636E gift_type \u548C\u9009\u62E9\u72B6\u6001\u53D8\u5316\n giftType === 2\n ? 'border-brand-0 bg-container-secondary-0 cursor-default' // \u5168\u9009\u6A21\u5F0F\uFF1A\u59CB\u7EC8\u9009\u4E2D\uFF0C\u4E0D\u53EF\u70B9\u51FB\n : `cursor-pointer hover:shadow-sm ${gift.selected ? 'border-brand-0 bg-container-secondary-0' : 'border-lines bg-secondary-0'}`, // \u5355\u9009\u6A21\u5F0F\uFF1A\u53EF\u70B9\u51FB\uFF0C\u6839\u636E\u9009\u62E9\u72B6\u6001\u53D8\u5316\u8FB9\u6846\n className\n )}\n onClick={() => {\n // \u53EA\u6709\u5355\u9009\u6A21\u5F0F\u624D\u5141\u8BB8\u70B9\u51FB\n if (giftType === 1) {\n onClick?.(gift)\n }\n }}\n >\n <div className=\"flex size-full flex-col\">\n <div className=\"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end\">\n {gift.tag && (\n <div className=\"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]\">\n {gift.tag}\n </div>\n )}\n </div>\n <div className={cn('laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2')}>\n <div className={cn('size-14 shrink-0', 'tablet:size-12')}>\n <Picture source={gift.image} alt={gift.name} className=\"size-full rounded object-cover\" />\n </div>\n <div className=\"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1\">\n <Text\n size={2}\n html={gift.name}\n className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1')}\n />\n <div className=\"mt-auto flex items-center justify-between gap-2\">\n <div className=\"flex items-center gap-2\">\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px]')}>\n {gift.currentPrice}\n </Text>\n {gift.originalPrice && gift.originalPrice !== gift.currentPrice && (\n <Text\n size={2}\n className={cn('text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through')}\n >\n {gift.originalPrice}\n </Text>\n )}\n </div>\n {gift.quantity >= 1 && (\n <Text\n size={4}\n className={cn('text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]')}\n >\n x{gift.quantity}\n </Text>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n }\n)\n\nFreeGiftItem.displayName = 'FreeGiftItem'\n\nexport default FreeGiftItem\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "cn", "Picture", "Text", "FreeGiftItem", "gift", "onClick", "className", "giftType", "ref", "FreeGiftItem_default"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport Badge from '../../components/badge.js'\nimport Picture from '../../components/picture.js'\nimport { Text } from '../../components/text.js'\n\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nconst GiftRadio = ({ checked, theme }: { checked: boolean; theme?: 'light' | 'dark' }) => {\n const isDark = theme === 'dark'\n return checked ? (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect x=\"2.8\" y=\"2.8\" width=\"18.4\" height=\"18.4\" rx=\"9.2\" fill={isDark ? '#F5F6F7' : '#080A0F'} />\n <rect\n x=\"2.8\"\n y=\"2.8\"\n width=\"18.4\"\n height=\"18.4\"\n rx=\"9.2\"\n stroke={isDark ? '#F5F6F7' : '#080A0F'}\n strokeWidth=\"1.6\"\n />\n <path\n d=\"M8 11.5833L10.9474 14.5L16 9.5\"\n stroke={isDark ? '#1E2024' : 'white'}\n strokeWidth=\"1.6\"\n strokeLinecap=\"round\"\n strokeLinejoin=\"round\"\n />\n </svg>\n ) : (\n <svg width=\"24\" height=\"24\" viewBox=\"0 0 24 24\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <rect\n x=\"2.8\"\n y=\"2.8\"\n width=\"18.4\"\n height=\"18.4\"\n rx=\"9.2\"\n stroke={isDark ? '#B5B7BB' : '#2A2C32'}\n strokeWidth=\"1.6\"\n />\n </svg>\n )\n}\n\nexport interface FreeGiftItemProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onClick'> {\n /** \u8D60\u54C1\u6570\u636E\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n gift: FreeGiftWithSelection\n /** \u70B9\u51FB\u56DE\u8C03 */\n onClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n theme?: 'light' | 'dark'\n}\n\n/**\n * FreeGiftItem - \u514D\u8D39\u8D60\u54C1\u9879\n */\nconst FreeGiftItem = React.forwardRef<HTMLDivElement, FreeGiftItemProps>(\n ({ gift, onClick, className, giftType, theme }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary laptop:rounded-[8px] border-lines relative flex w-full flex-col overflow-hidden rounded-[6px] border-2 transition-all',\n\n // \u6837\u5F0F\u6839\u636E gift_type \u548C\u9009\u62E9\u72B6\u6001\u53D8\u5316\n giftType === 2\n ? 'border-brand-0 bg-container-secondary-0 cursor-default' // \u5168\u9009\u6A21\u5F0F\uFF1A\u59CB\u7EC8\u9009\u4E2D\uFF0C\u4E0D\u53EF\u70B9\u51FB\n : `cursor-pointer hover:shadow-sm ${gift.selected ? 'border-brand-0 bg-container-secondary-0' : 'border-lines bg-secondary-0'}`, // \u5355\u9009\u6A21\u5F0F\uFF1A\u53EF\u70B9\u51FB\uFF0C\u6839\u636E\u9009\u62E9\u72B6\u6001\u53D8\u5316\u8FB9\u6846\n className\n )}\n onClick={() => {\n // \u53EA\u6709\u5355\u9009\u6A21\u5F0F\u624D\u5141\u8BB8\u70B9\u51FB\n if (giftType === 1) {\n onClick?.(gift)\n }\n }}\n >\n <div className=\"flex size-full flex-col\">\n <div className=\"tablet:h-[24px] lg-desktop:h-[28px] flex h-[18px] justify-end\">\n {gift.tag && (\n <div className=\"bg-brand-0 lg-desktop:text-[16px] laptop:rounded-bl-[8px] text-badge-foreground absolute rounded-bl-[6px] px-[6px] pb-[4px] pt-[3px] text-[14px] font-bold leading-[1.2]\">\n {gift.tag}\n </div>\n )}\n </div>\n <div className={cn('laptop:pb-4 laptop:px-4 flex size-full items-center gap-4 px-2 pb-2')}>\n <div className=\"flex size-5 shrink-0 items-center justify-center\">\n <GiftRadio checked={!!gift.selected} theme={theme} />\n </div>\n <div className={cn('size-14 shrink-0', 'tablet:size-12')}>\n <Picture source={gift.image} alt={gift.name} className=\"size-full rounded object-cover\" />\n </div>\n <div className=\"flex h-full min-w-0 flex-1 flex-col justify-center gap-1 py-1\">\n <Text\n size={2}\n html={gift.name}\n className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] line-clamp-1')}\n />\n <div className=\"mt-auto flex items-center justify-between gap-2\">\n <div className=\"flex items-center gap-2\">\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px]')}>\n {gift.currentPrice}\n </Text>\n {gift.originalPrice && gift.originalPrice !== gift.currentPrice && (\n <Text\n size={2}\n className={cn('text-info-tertiary desktop:text-[16px] lg-desktop:text-[18px] pr-6 line-through')}\n >\n {gift.originalPrice}\n </Text>\n )}\n </div>\n {gift.quantity >= 1 && (\n <Text\n size={4}\n className={cn('text-info-primary laptop:text-[16px] lg-desktop:text-[18px] self-end text-[14px]')}\n >\n x{gift.quantity}\n </Text>\n )}\n </div>\n </div>\n </div>\n </div>\n </div>\n )\n }\n)\n\nFreeGiftItem.displayName = 'FreeGiftItem'\n\nexport default FreeGiftItem\n"],
|
|
5
|
+
"mappings": "aAaI,OACE,OAAAA,EADF,QAAAC,MAAA,oBAXJ,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,MAAkB,4BAClB,OAAOC,MAAa,8BACpB,OAAS,QAAAC,MAAY,2BAIrB,MAAMC,EAAY,CAAC,CAAE,QAAAC,EAAS,MAAAC,CAAM,IAAsD,CACxF,MAAMC,EAASD,IAAU,OACzB,OAAOD,EACLN,EAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAChE,UAAAD,EAAC,QAAK,EAAE,MAAM,EAAE,MAAM,MAAM,OAAO,OAAO,OAAO,GAAG,MAAM,KAAMS,EAAS,UAAY,UAAW,EAChGT,EAAC,QACC,EAAE,MACF,EAAE,MACF,MAAM,OACN,OAAO,OACP,GAAG,MACH,OAAQS,EAAS,UAAY,UAC7B,YAAY,MACd,EACAT,EAAC,QACC,EAAE,iCACF,OAAQS,EAAS,UAAY,QAC7B,YAAY,MACZ,cAAc,QACd,eAAe,QACjB,GACF,EAEAT,EAAC,OAAI,MAAM,KAAK,OAAO,KAAK,QAAQ,YAAY,KAAK,OAAO,MAAM,6BAChE,SAAAA,EAAC,QACC,EAAE,MACF,EAAE,MACF,MAAM,OACN,OAAO,OACP,GAAG,MACH,OAAQS,EAAS,UAAY,UAC7B,YAAY,MACd,EACF,CAEJ,EAeMC,EAAeR,EAAM,WACzB,CAAC,CAAE,KAAAS,EAAM,QAAAC,EAAS,UAAAC,EAAW,SAAAC,EAAU,MAAAN,CAAM,EAAGO,IAE5Cf,EAAC,OACC,IAAKe,EACL,UAAWZ,EACT,6IAGAW,IAAa,EACT,yDACA,kCAAkCH,EAAK,SAAW,0CAA4C,6BAA6B,GAC/HE,CACF,EACA,QAAS,IAAM,CAETC,IAAa,GACfF,IAAUD,CAAI,CAElB,EAEA,SAAAV,EAAC,OAAI,UAAU,0BACb,UAAAD,EAAC,OAAI,UAAU,gEACZ,SAAAW,EAAK,KACJX,EAAC,OAAI,UAAU,2KACZ,SAAAW,EAAK,IACR,EAEJ,EACAV,EAAC,OAAI,UAAWE,EAAG,qEAAqE,EACtF,UAAAH,EAAC,OAAI,UAAU,mDACb,SAAAA,EAACM,EAAA,CAAU,QAAS,CAAC,CAACK,EAAK,SAAU,MAAOH,EAAO,EACrD,EACAR,EAAC,OAAI,UAAWG,EAAG,mBAAoB,gBAAgB,EACrD,SAAAH,EAACI,EAAA,CAAQ,OAAQO,EAAK,MAAO,IAAKA,EAAK,KAAM,UAAU,iCAAiC,EAC1F,EACAV,EAAC,OAAI,UAAU,gEACb,UAAAD,EAACK,EAAA,CACC,KAAM,EACN,KAAMM,EAAK,KACX,UAAWR,EAAG,2EAA2E,EAC3F,EACAF,EAAC,OAAI,UAAU,kDACb,UAAAA,EAAC,OAAI,UAAU,0BACb,UAAAD,EAACK,EAAA,CAAK,KAAM,EAAG,UAAWF,EAAG,8DAA8D,EACxF,SAAAQ,EAAK,aACR,EACCA,EAAK,eAAiBA,EAAK,gBAAkBA,EAAK,cACjDX,EAACK,EAAA,CACC,KAAM,EACN,UAAWF,EAAG,iFAAiF,EAE9F,SAAAQ,EAAK,cACR,GAEJ,EACCA,EAAK,UAAY,GAChBV,EAACI,EAAA,CACC,KAAM,EACN,UAAWF,EAAG,kFAAkF,EACjG,cACGQ,EAAK,UACT,GAEJ,GACF,GACF,GACF,EACF,CAGN,EAEAD,EAAa,YAAc,eAE3B,IAAOM,EAAQN",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "Picture", "Text", "GiftRadio", "checked", "theme", "isDark", "FreeGiftItem", "gift", "onClick", "className", "giftType", "ref", "FreeGiftItem_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as e,jsxs as
|
|
1
|
+
"use client";import{jsx as e,jsxs as g}from"react/jsx-runtime";import*as c from"react";import{cn as i}from"../../helpers/index.js";import{Text as d}from"../../components/text.js";import x from"./FreeGiftItem.js";const o=c.forwardRef(({freeGiftLabel:l,freeGifts:t,onGiftClick:r,className:p,giftType:a,theme:m},n)=>!t||t.length===0?null:g("div",{ref:n,className:i("flex w-full flex-col gap-2",p),children:[l&&e(d,{size:2,className:i("text-info-primary desktop:text-[16px] lg-desktop:text-[18px] w-full"),children:l}),e("div",{className:i("tablet:flex-row laptop:flex-col flex flex-col gap-2"),children:t.map((f,s)=>e("div",{className:"min-w-0 flex-1",children:e(x,{gift:f,onClick:r,giftType:a,theme:m})},f.id||s))})]}));o.displayName="GiftSelection";var k=o;export{k as default};
|
|
2
2
|
//# sourceMappingURL=GiftSelection.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/GiftSelection.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text } from '../../components/text.js'\nimport FreeGiftItem from './FreeGiftItem.js'\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nexport interface GiftSelectionProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u8D60\u54C1\u6807\u7B7E\u6587\u672C */\n freeGiftLabel?: string\n /** \u8D60\u54C1\u5217\u8868\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n freeGifts?: FreeGiftWithSelection[]\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n selectedGiftSku?: string\n}\n\n/**\n * GiftSelection - \u8D60\u54C1\u9009\u62E9\u533A\u57DF\n */\nconst GiftSelection = React.forwardRef<HTMLDivElement, GiftSelectionProps>(\n ({ freeGiftLabel, freeGifts, onGiftClick, className, giftType }, ref) => {\n if (!freeGifts || freeGifts.length === 0) {\n return null\n }\n\n return (\n <div ref={ref} className={cn('flex w-full flex-col gap-2', className)}>\n {freeGiftLabel && (\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] w-full')}>\n {freeGiftLabel}\n </Text>\n )}\n <div className={cn('tablet:flex-row laptop:flex-col flex flex-col gap-2')}>\n {freeGifts.map((gift, index) => (\n <div key={gift.id || index} className=\"min-w-0 flex-1\">\n <FreeGiftItem gift={gift} onClick={onGiftClick} giftType={giftType} />\n </div>\n ))}\n </div>\n </div>\n )\n }\n)\n\nGiftSelection.displayName = 'GiftSelection'\n\nexport default GiftSelection\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "cn", "Text", "FreeGiftItem", "GiftSelection", "freeGiftLabel", "freeGifts", "onGiftClick", "className", "giftType", "ref", "gift", "index", "GiftSelection_default"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text } from '../../components/text.js'\nimport FreeGiftItem from './FreeGiftItem.js'\nimport type { FreeGift, FreeGiftWithSelection } from './types.js'\n\nexport interface GiftSelectionProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u8D60\u54C1\u6807\u7B7E\u6587\u672C */\n freeGiftLabel?: string\n /** \u8D60\u54C1\u5217\u8868\uFF08\u5305\u542B\u9009\u62E9\u72B6\u6001\uFF09 */\n freeGifts?: FreeGiftWithSelection[]\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift) => void\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u5355\u9009\u6A21\u5F0F\uFF0C 2 -> \u5168\u9009\u6A21\u5F0F */\n giftType?: 1 | 2\n selectedGiftSku?: string\n theme?: 'light' | 'dark'\n}\n\n/**\n * GiftSelection - \u8D60\u54C1\u9009\u62E9\u533A\u57DF\n */\nconst GiftSelection = React.forwardRef<HTMLDivElement, GiftSelectionProps>(\n ({ freeGiftLabel, freeGifts, onGiftClick, className, giftType, theme }, ref) => {\n if (!freeGifts || freeGifts.length === 0) {\n return null\n }\n\n return (\n <div ref={ref} className={cn('flex w-full flex-col gap-2', className)}>\n {freeGiftLabel && (\n <Text size={2} className={cn('text-info-primary desktop:text-[16px] lg-desktop:text-[18px] w-full')}>\n {freeGiftLabel}\n </Text>\n )}\n <div className={cn('tablet:flex-row laptop:flex-col flex flex-col gap-2')}>\n {freeGifts.map((gift, index) => (\n <div key={gift.id || index} className=\"min-w-0 flex-1\">\n <FreeGiftItem gift={gift} onClick={onGiftClick} giftType={giftType} theme={theme} />\n </div>\n ))}\n </div>\n </div>\n )\n }\n)\n\nGiftSelection.displayName = 'GiftSelection'\n\nexport default GiftSelection\n"],
|
|
5
|
+
"mappings": "aA+BM,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBA7BN,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAS,QAAAC,MAAY,2BACrB,OAAOC,MAAkB,oBAmBzB,MAAMC,EAAgBJ,EAAM,WAC1B,CAAC,CAAE,cAAAK,EAAe,UAAAC,EAAW,YAAAC,EAAa,UAAAC,EAAW,SAAAC,EAAU,MAAAC,CAAM,EAAGC,IAClE,CAACL,GAAaA,EAAU,SAAW,EAC9B,KAIPP,EAAC,OAAI,IAAKY,EAAK,UAAWV,EAAG,6BAA8BO,CAAS,EACjE,UAAAH,GACCP,EAACI,EAAA,CAAK,KAAM,EAAG,UAAWD,EAAG,qEAAqE,EAC/F,SAAAI,EACH,EAEFP,EAAC,OAAI,UAAWG,EAAG,qDAAqD,EACrE,SAAAK,EAAU,IAAI,CAACM,EAAMC,IACpBf,EAAC,OAA2B,UAAU,iBACpC,SAAAA,EAACK,EAAA,CAAa,KAAMS,EAAM,QAASL,EAAa,SAAUE,EAAU,MAAOC,EAAO,GAD1EE,EAAK,IAAMC,CAErB,CACD,EACH,GACF,CAGN,EAEAT,EAAc,YAAc,gBAE5B,IAAOU,EAAQV",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "Text", "FreeGiftItem", "GiftSelection", "freeGiftLabel", "freeGifts", "onGiftClick", "className", "giftType", "theme", "ref", "gift", "index", "GiftSelection_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as a,jsxs as v}from"react/jsx-runtime";import*as n from"react";import{cn as y}from"../../helpers/index.js";import
|
|
1
|
+
"use client";import{jsx as a,jsxs as v}from"react/jsx-runtime";import*as n from"react";import{cn as y}from"../../helpers/index.js";import $ from"./ProductImage.js";import q from"./ProductInfo.js";import J from"./GiftSelection.js";import K from"./PriceAndActions.js";import{BuyOneGetOneShelfContext as Q}from"./context.js";const w=n.forwardRef(({productData:e,gifts:r=[],giftType:i=1,selectedGiftSku:L,sceneImages:g,tags:F,layout:N,className:M,onProductClick:p,onProductImageClick:h,onLearnMore:O,onShopNow:I,onGiftClick:G,onGiftSelectionChange:T,classNames:S,soldOutText:H,...B},R)=>{const{layout:j,theme:z}=n.useContext(Q),u=N??j,[A,P]=n.useState(!1),[E,x]=n.useState(!1),[b,d]=n.useState(()=>!r||r.length===0?[]:i===2?r.map(t=>t.id):[r[0].id]),c=n.useMemo(()=>r?r.map(t=>({...t,selected:b.includes(t.id)})):[],[r,b]);n.useEffect(()=>{if(!r||r.length===0){d([]);return}d(i===2?r.map(t=>t.id):t=>{const o=t[0];return o&&r.some(m=>m.id===o)?[o]:[r[0].id]})},[r,i]);const s=n.useMemo(()=>({...e,gifts:r,gift_type:i}),[e,r,i]),W=t=>{if(i===2){const o=c.filter(l=>l.selected);G?.(t,o);return}d(()=>{const o=[t.id],l=r?.filter(m=>o.includes(m.id))||[];return G?.(t,l),T?.(l,s),o})},f=!!(h??p),C=`/products/${e.handle}`,k=()=>{(h??p)?.(s)},V=async()=>{const t=c.filter(o=>o.selected);P(!0);try{await O?.(s,t)}finally{P(!1)}},_=async()=>{const t=c.filter(o=>o.selected);x(!0);try{await I?.(s,t)}finally{x(!1)}};return v("div",{ref:R,className:y("bg-container-primary rounded-box flex items-stretch overflow-hidden",u==="horizontal"?["laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col","laptop:col-span-2"]:["flex-col justify-between"],M),...B,children:[a($,{images:g,name:e.name,layout:u,tags:e.tags||F,onClick:f?k:void 0,href:f?void 0:C}),a("div",{className:y("bg-container-primary desktop:p-6 flex flex-col justify-between p-4",u==="horizontal"?["rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none","laptop:basis-[39.1%]","desktop:basis-[42.1%]","lg-desktop:basis-[42.1%]","shrink-0"]:["rounded-b-box","w-full","grow"]),children:v("div",{className:"flex flex-1 flex-col justify-between gap-6",children:[a(q,{name:e.name,onClick:f?k:void 0,href:f?void 0:C,description:e.description,classNames:S}),a(J,{freeGiftLabel:e.freeGiftLabel,freeGifts:c,onGiftClick:W,giftType:i,selectedGiftSku:L,theme:z}),a(K,{currentPrice:e.currentPrice??"",originalPrice:e.originalPrice,priceLabel:e.priceLabel,learnMoreText:e.learnMoreText,shopNowText:e.shopNowText,soldOutText:H,onLearnMore:V,onShopNow:_,availableForSale:e.availableForSale,learnMoreLoading:A,shopNowLoading:E,trackingTitle:e.name,trackingDescription:e.description,trackingSku:e.sku,classNames:S})]})})]})});w.displayName="BuyOneGetOneShelf.ProductCard";var te=w;export{te as default};
|
|
2
2
|
//# sourceMappingURL=ProductCard.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/ProductCard.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductImage from './ProductImage.js'\nimport ProductInfo from './ProductInfo.js'\nimport GiftSelection from './GiftSelection.js'\nimport PriceAndActions from './PriceAndActions.js'\nimport { BuyOneGetOneShelfContext } from './context.js'\nimport type {\n FreeGift,\n FreeGiftWithSelection,\n ProductCardData,\n PureProductData,\n ProductTag,\n BuyOneGetOneShelfProductCardSemanticName,\n} from './types.js'\n\nexport interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4EA7\u54C1\u6570\u636E\uFF08\u4E0D\u5305\u542B\u8D60\u54C1\u4FE1\u606F\uFF09 */\n productData: PureProductData\n /** \u8D60\u54C1\u5217\u8868 */\n gifts?: FreeGift[]\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u8D60\u9001\u5176\u4E2D\u4E00\u4E2A\u8D60\u54C1\uFF0C 2 -> \u8D60\u9001\u6240\u6709\u8D60\u54C1 */\n giftType?: 1 | 2\n /** \u573A\u666F\u56FE\u7247 */\n sceneImages: any\n /** \u4EA7\u54C1\u6807\u7B7E */\n tags?: ProductTag[]\n /** \u5F53\u524D\u9009\u4E2D\u7684\u8D60\u54C1SKU\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n selectedGiftSku?: string\n /** @deprecated Layout is now automatically inferred by Root based on children count. */\n layout?: 'horizontal' | 'vertical'\n classNames?: Partial<Record<BuyOneGetOneShelfProductCardSemanticName, string>>\n soldOutText?: string\n /** @deprecated Use `onProductImageClick` instead. */\n onProductClick?: (product: ProductCardData) => void\n /** \u4EA7\u54C1\u56FE\u7247\u70B9\u51FB\u56DE\u8C03 */\n onProductImageClick?: (product: ProductCardData) => void\n /** Learn More \u70B9\u51FB\u56DE\u8C03 */\n onLearnMore?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** Shop Now \u70B9\u51FB\u56DE\u8C03 */\n onShopNow?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u9009\u62E9\u53D8\u5316\u56DE\u8C03 */\n onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void\n /** \u9009\u4E2D\u8D60\u54C1SKU\u53D8\u5316\u56DE\u8C03\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n onSelectedGiftSkuChange?: (selectedSku: string | null) => void\n}\n\n/**\n * ProductCard - \u4E70\u8D60\u8D27\u67B6\u4EA7\u54C1\u5361\u7247\n *\n * @description \u7528\u4E8E\u4E70\u4E00\u8D60\u4E00\u6D3B\u52A8\u7684\u4EA7\u54C1\u5C55\u793A\u5361\u7247\uFF0C\u5DE6\u4FA7\u5C55\u793A\u4EA7\u54C1\u56FE\u7247\u548C\u6807\u7B7E\uFF0C\u53F3\u4FA7\u5C55\u793A\u4EA7\u54C1\u4FE1\u606F\u3001\u8D60\u54C1\u548C\u8D2D\u4E70\u6309\u94AE\n */\nconst ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(\n (\n {\n productData,\n gifts = [],\n giftType = 1,\n selectedGiftSku,\n sceneImages,\n tags,\n layout: layoutProp,\n className,\n onProductClick,\n onProductImageClick,\n onLearnMore,\n onShopNow,\n onGiftClick,\n onGiftSelectionChange,\n classNames,\n soldOutText,\n ...props\n },\n ref\n ) => {\n const { layout: contextLayout } = React.useContext(BuyOneGetOneShelfContext)\n const layout = layoutProp ?? contextLayout\n\n const [learnMoreLoading, setLearnMoreLoading] = React.useState(false)\n const [shopNowLoading, setShopNowLoading] = React.useState(false)\n\n // \u5185\u90E8\u72B6\u6001\u7BA1\u7406\u8D60\u54C1\u7684\u9009\u62E9\u72B6\u6001 - \u4F7F\u7528\u9009\u4E2D\u7684ID\u6570\u7EC4\u800C\u4E0D\u662F\u4FEE\u6539gift\u5BF9\u8C61\n const [selectedGiftIds, setSelectedGiftIds] = React.useState<string[]>(() => {\n if (!gifts || gifts.length === 0) return []\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n return gifts.map((gift: FreeGift) => gift.id)\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u8D60\u54C1\n return [gifts[0].id]\n }\n })\n\n // \u751F\u6210\u5E26\u6709\u9009\u62E9\u72B6\u6001\u7684\u8D60\u54C1\u5217\u8868\u7528\u4E8E\u6E32\u67D3\n const giftsWithSelection = React.useMemo(() => {\n if (!gifts) return []\n\n return gifts.map((gift: FreeGift) => ({\n ...gift,\n selected: selectedGiftIds.includes(gift.id),\n }))\n }, [gifts, selectedGiftIds])\n\n // \u5F53 gifts \u6216 giftType \u66F4\u65B0\u65F6\uFF0C\u540C\u6B65\u66F4\u65B0\u5185\u90E8\u72B6\u6001\n React.useEffect(() => {\n if (!gifts || gifts.length === 0) {\n setSelectedGiftIds([])\n return\n }\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n setSelectedGiftIds(gifts.map((gift: FreeGift) => gift.id))\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u667A\u80FD\u72B6\u6001\u7BA1\u7406\n setSelectedGiftIds(prevSelectedIds => {\n // \u68C0\u67E5\u5F53\u524D\u9009\u4E2D\u7684\u793C\u54C1\u662F\u5426\u4ECD\u7136\u5B58\u5728\u4E8E\u65B0\u7684 gifts \u5217\u8868\u4E2D\n const currentSelectedId = prevSelectedIds[0]\n const isCurrentSelectionValid =\n currentSelectedId && gifts.some((gift: FreeGift) => gift.id === currentSelectedId)\n\n // \u5982\u679C\u5F53\u524D\u9009\u4E2D\u72B6\u6001\u4ECD\u7136\u6709\u6548\uFF0C\u4FDD\u6301\u4E0D\u53D8\uFF1B\u5426\u5219\u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\n return isCurrentSelectionValid ? [currentSelectedId] : [gifts[0].id]\n })\n }\n }, [gifts, giftType])\n\n // \u6784\u9020\u5B8C\u6574\u7684\u4EA7\u54C1\u6570\u636E\u7528\u4E8E\u56DE\u8C03\n const fullProductData: ProductCardData = React.useMemo(\n () => ({\n ...productData,\n gifts,\n gift_type: giftType,\n }),\n [productData, gifts, giftType]\n )\n\n const handleGiftClick = (gift: FreeGift) => {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u4E0D\u5141\u8BB8\u53D6\u6D88\u9009\u62E9\uFF0C\u76F4\u63A5\u8FD4\u56DE\n if (giftType === 2) {\n // \u83B7\u53D6\u5F53\u524D\u6240\u6709\u9009\u4E2D\u7684gifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\n const currentSelectedGifts = giftsWithSelection.filter((g: FreeGiftWithSelection) => g.selected)\n onGiftClick?.(gift, currentSelectedGifts)\n return\n }\n\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F)\n setSelectedGiftIds(() => {\n const newSelectedIds = [gift.id] // \u5355\u9009\uFF1A\u59CB\u7EC8\u9009\u4E2D\u5F53\u524D\u9879\uFF0C\u70B9\u51FB\u5DF2\u9009\u4E2D\u9879\u4FDD\u6301\u72B6\u6001\uFF0C\u70B9\u51FB\u672A\u9009\u4E2D\u9879\u5207\u6362\u5230\u8BE5\u9879\n\n // \u8BA1\u7B97\u65B0\u7684\u9009\u4E2Dgifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\u4F20\u9012\u7ED9\u56DE\u8C03\n const newSelectedGifts = gifts?.filter((g: FreeGift) => newSelectedIds.includes(g.id)) || []\n\n // \u8C03\u7528\u56DE\u8C03\u51FD\u6570\uFF0C\u7B2C\u4E8C\u4E2A\u53C2\u6570\u662F\u5F53\u524D\u9009\u4E2D\u7684gifts\n onGiftClick?.(gift, newSelectedGifts)\n onGiftSelectionChange?.(newSelectedGifts, fullProductData)\n\n return newSelectedIds\n })\n }\n\n const hasClickHandler = !!(onProductImageClick ?? onProductClick)\n const productHref = `/products/${productData.handle}`\n\n const handleProductImageClick = () => {\n const callback = onProductImageClick ?? onProductClick\n callback?.(fullProductData)\n }\n\n const handleLearnMoreClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setLearnMoreLoading(true)\n try {\n await onLearnMore?.(fullProductData, selectedGifts)\n } finally {\n setLearnMoreLoading(false)\n }\n }\n\n const handleShopNowClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setShopNowLoading(true)\n try {\n await onShopNow?.(fullProductData, selectedGifts)\n } finally {\n setShopNowLoading(false)\n }\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary rounded-box flex items-stretch overflow-hidden',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5BB9\u5668\n layout === 'horizontal'\n ? [\n 'laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col',\n 'laptop:col-span-2',\n ]\n : ['flex-col justify-between'],\n className\n )}\n {...props}\n >\n {/* \u4EA7\u54C1\u56FE\u7247\u533A\u57DF */}\n <ProductImage\n images={sceneImages}\n name={productData.name}\n layout={layout}\n tags={productData.tags || tags}\n onClick={hasClickHandler ? handleProductImageClick : undefined}\n href={hasClickHandler ? undefined : productHref}\n />\n\n {/* \u4EA7\u54C1\u4FE1\u606F\u533A\u57DF */}\n <div\n className={cn(\n 'bg-container-primary desktop:p-6 flex flex-col justify-between p-4',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5706\u89D2\u548C\u5C3A\u5BF8\n layout === 'horizontal'\n ? [\n 'rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none',\n // \u4F7F\u7528 flex-basis \u8BBE\u7F6E\u5BBD\u5EA6\u6BD4\u4F8B\n 'laptop:basis-[39.1%]', // 360px / 921px \u2248 39.1%\n 'desktop:basis-[42.1%]', // 552px / 1312px \u2248 42.1%\n 'lg-desktop:basis-[42.1%]', // 700px / 1664px \u2248 42.1%\n 'shrink-0',\n ]\n : ['rounded-b-box', 'w-full', 'grow']\n )}\n >\n <div className=\"flex flex-1 flex-col justify-between gap-6\">\n {/* \u4EA7\u54C1\u6807\u9898\u548C\u63CF\u8FF0 */}\n <ProductInfo\n name={productData.name}\n onClick={hasClickHandler ? handleProductImageClick : undefined}\n href={hasClickHandler ? undefined : productHref}\n description={productData.description}\n classNames={classNames}\n />\n\n {/* \u514D\u8D39\u8D60\u54C1\u533A\u57DF */}\n <GiftSelection\n freeGiftLabel={productData.freeGiftLabel}\n freeGifts={giftsWithSelection}\n onGiftClick={handleGiftClick}\n giftType={giftType}\n selectedGiftSku={selectedGiftSku}\n />\n <PriceAndActions\n currentPrice={productData.currentPrice ?? ''}\n originalPrice={productData.originalPrice}\n priceLabel={productData.priceLabel}\n learnMoreText={productData.learnMoreText}\n shopNowText={productData.shopNowText}\n soldOutText={soldOutText}\n onLearnMore={handleLearnMoreClick}\n onShopNow={handleShopNowClick}\n availableForSale={productData.availableForSale}\n learnMoreLoading={learnMoreLoading}\n shopNowLoading={shopNowLoading}\n trackingTitle={productData.name}\n trackingDescription={productData.description}\n trackingSku={productData.sku}\n classNames={classNames}\n />\n </div>\n </div>\n </div>\n )\n }\n)\n\nProductCard.displayName = 'BuyOneGetOneShelf.ProductCard'\n\nexport default ProductCard\n"],
|
|
5
|
-
"mappings": "aAmNQ,cAAAA,EA0BE,QAAAC,MA1BF,oBAjNR,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAOC,MAAkB,oBACzB,OAAOC,MAAiB,mBACxB,OAAOC,MAAmB,qBAC1B,OAAOC,MAAqB,uBAC5B,OAAS,4BAAAC,MAAgC,eAgDzC,MAAMC,EAAcP,EAAM,WACxB,CACE,CACE,YAAAQ,EACA,MAAAC,EAAQ,CAAC,EACT,SAAAC,EAAW,EACX,gBAAAC,EACA,YAAAC,EACA,KAAAC,EACA,OAAQC,EACR,UAAAC,EACA,eAAAC,EACA,oBAAAC,EACA,YAAAC,EACA,UAAAC,EACA,YAAAC,EACA,sBAAAC,EACA,WAAAC,EACA,YAAAC,EACA,GAAGC,CACL,EACAC,IACG,CACH,KAAM,CAAE,OAAQC,
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "cn", "ProductImage", "ProductInfo", "GiftSelection", "PriceAndActions", "BuyOneGetOneShelfContext", "ProductCard", "productData", "gifts", "giftType", "selectedGiftSku", "sceneImages", "tags", "layoutProp", "className", "onProductClick", "onProductImageClick", "onLearnMore", "onShopNow", "onGiftClick", "onGiftSelectionChange", "classNames", "soldOutText", "props", "ref", "contextLayout", "layout", "learnMoreLoading", "setLearnMoreLoading", "shopNowLoading", "setShopNowLoading", "selectedGiftIds", "setSelectedGiftIds", "gift", "giftsWithSelection", "prevSelectedIds", "currentSelectedId", "fullProductData", "handleGiftClick", "currentSelectedGifts", "g", "newSelectedIds", "newSelectedGifts", "hasClickHandler", "productHref", "handleProductImageClick", "handleLearnMoreClick", "selectedGifts", "handleShopNowClick", "ProductCard_default"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductImage from './ProductImage.js'\nimport ProductInfo from './ProductInfo.js'\nimport GiftSelection from './GiftSelection.js'\nimport PriceAndActions from './PriceAndActions.js'\nimport { BuyOneGetOneShelfContext } from './context.js'\nimport type {\n FreeGift,\n FreeGiftWithSelection,\n ProductCardData,\n PureProductData,\n ProductTag,\n BuyOneGetOneShelfProductCardSemanticName,\n} from './types.js'\n\nexport interface ProductCardProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4EA7\u54C1\u6570\u636E\uFF08\u4E0D\u5305\u542B\u8D60\u54C1\u4FE1\u606F\uFF09 */\n productData: PureProductData\n /** \u8D60\u54C1\u5217\u8868 */\n gifts?: FreeGift[]\n /** \u8D60\u54C1\u7C7B\u578B 1-> \u8D60\u9001\u5176\u4E2D\u4E00\u4E2A\u8D60\u54C1\uFF0C 2 -> \u8D60\u9001\u6240\u6709\u8D60\u54C1 */\n giftType?: 1 | 2\n /** \u573A\u666F\u56FE\u7247 */\n sceneImages: any\n /** \u4EA7\u54C1\u6807\u7B7E */\n tags?: ProductTag[]\n /** \u5F53\u524D\u9009\u4E2D\u7684\u8D60\u54C1SKU\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n selectedGiftSku?: string\n /** @deprecated Layout is now automatically inferred by Root based on children count. */\n layout?: 'horizontal' | 'vertical'\n classNames?: Partial<Record<BuyOneGetOneShelfProductCardSemanticName, string>>\n soldOutText?: string\n /** @deprecated Use `onProductImageClick` instead. */\n onProductClick?: (product: ProductCardData) => void\n /** \u4EA7\u54C1\u56FE\u7247\u70B9\u51FB\u56DE\u8C03 */\n onProductImageClick?: (product: ProductCardData) => void\n /** Learn More \u70B9\u51FB\u56DE\u8C03 */\n onLearnMore?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** Shop Now \u70B9\u51FB\u56DE\u8C03 */\n onShopNow?: (product: ProductCardData, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u70B9\u51FB\u56DE\u8C03 */\n onGiftClick?: (gift: FreeGift, selectedGifts: FreeGift[]) => void\n /** \u8D60\u54C1\u9009\u62E9\u53D8\u5316\u56DE\u8C03 */\n onGiftSelectionChange?: (selectedGifts: FreeGift[], product: ProductCardData) => void\n /** \u9009\u4E2D\u8D60\u54C1SKU\u53D8\u5316\u56DE\u8C03\uFF08\u53D7\u63A7\u7EC4\u4EF6\uFF09 */\n onSelectedGiftSkuChange?: (selectedSku: string | null) => void\n}\n\n/**\n * ProductCard - \u4E70\u8D60\u8D27\u67B6\u4EA7\u54C1\u5361\u7247\n *\n * @description \u7528\u4E8E\u4E70\u4E00\u8D60\u4E00\u6D3B\u52A8\u7684\u4EA7\u54C1\u5C55\u793A\u5361\u7247\uFF0C\u5DE6\u4FA7\u5C55\u793A\u4EA7\u54C1\u56FE\u7247\u548C\u6807\u7B7E\uFF0C\u53F3\u4FA7\u5C55\u793A\u4EA7\u54C1\u4FE1\u606F\u3001\u8D60\u54C1\u548C\u8D2D\u4E70\u6309\u94AE\n */\nconst ProductCard = React.forwardRef<HTMLDivElement, ProductCardProps>(\n (\n {\n productData,\n gifts = [],\n giftType = 1,\n selectedGiftSku,\n sceneImages,\n tags,\n layout: layoutProp,\n className,\n onProductClick,\n onProductImageClick,\n onLearnMore,\n onShopNow,\n onGiftClick,\n onGiftSelectionChange,\n classNames,\n soldOutText,\n ...props\n },\n ref\n ) => {\n const { layout: contextLayout, theme } = React.useContext(BuyOneGetOneShelfContext)\n const layout = layoutProp ?? contextLayout\n\n const [learnMoreLoading, setLearnMoreLoading] = React.useState(false)\n const [shopNowLoading, setShopNowLoading] = React.useState(false)\n\n // \u5185\u90E8\u72B6\u6001\u7BA1\u7406\u8D60\u54C1\u7684\u9009\u62E9\u72B6\u6001 - \u4F7F\u7528\u9009\u4E2D\u7684ID\u6570\u7EC4\u800C\u4E0D\u662F\u4FEE\u6539gift\u5BF9\u8C61\n const [selectedGiftIds, setSelectedGiftIds] = React.useState<string[]>(() => {\n if (!gifts || gifts.length === 0) return []\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n return gifts.map((gift: FreeGift) => gift.id)\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\u8D60\u54C1\n return [gifts[0].id]\n }\n })\n\n // \u751F\u6210\u5E26\u6709\u9009\u62E9\u72B6\u6001\u7684\u8D60\u54C1\u5217\u8868\u7528\u4E8E\u6E32\u67D3\n const giftsWithSelection = React.useMemo(() => {\n if (!gifts) return []\n\n return gifts.map((gift: FreeGift) => ({\n ...gift,\n selected: selectedGiftIds.includes(gift.id),\n }))\n }, [gifts, selectedGiftIds])\n\n // \u5F53 gifts \u6216 giftType \u66F4\u65B0\u65F6\uFF0C\u540C\u6B65\u66F4\u65B0\u5185\u90E8\u72B6\u6001\n React.useEffect(() => {\n if (!gifts || gifts.length === 0) {\n setSelectedGiftIds([])\n return\n }\n\n if (giftType === 2) {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u9009\u4E2D\u6240\u6709\u8D60\u54C1\n setSelectedGiftIds(gifts.map((gift: FreeGift) => gift.id))\n } else {\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F) - \u667A\u80FD\u72B6\u6001\u7BA1\u7406\n setSelectedGiftIds(prevSelectedIds => {\n // \u68C0\u67E5\u5F53\u524D\u9009\u4E2D\u7684\u793C\u54C1\u662F\u5426\u4ECD\u7136\u5B58\u5728\u4E8E\u65B0\u7684 gifts \u5217\u8868\u4E2D\n const currentSelectedId = prevSelectedIds[0]\n const isCurrentSelectionValid =\n currentSelectedId && gifts.some((gift: FreeGift) => gift.id === currentSelectedId)\n\n // \u5982\u679C\u5F53\u524D\u9009\u4E2D\u72B6\u6001\u4ECD\u7136\u6709\u6548\uFF0C\u4FDD\u6301\u4E0D\u53D8\uFF1B\u5426\u5219\u9ED8\u8BA4\u9009\u4E2D\u7B2C\u4E00\u4E2A\n return isCurrentSelectionValid ? [currentSelectedId] : [gifts[0].id]\n })\n }\n }, [gifts, giftType])\n\n // \u6784\u9020\u5B8C\u6574\u7684\u4EA7\u54C1\u6570\u636E\u7528\u4E8E\u56DE\u8C03\n const fullProductData: ProductCardData = React.useMemo(\n () => ({\n ...productData,\n gifts,\n gift_type: giftType,\n }),\n [productData, gifts, giftType]\n )\n\n const handleGiftClick = (gift: FreeGift) => {\n // gift_type 2 (\u5168\u9009\u6A21\u5F0F) - \u4E0D\u5141\u8BB8\u53D6\u6D88\u9009\u62E9\uFF0C\u76F4\u63A5\u8FD4\u56DE\n if (giftType === 2) {\n // \u83B7\u53D6\u5F53\u524D\u6240\u6709\u9009\u4E2D\u7684gifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\n const currentSelectedGifts = giftsWithSelection.filter((g: FreeGiftWithSelection) => g.selected)\n onGiftClick?.(gift, currentSelectedGifts)\n return\n }\n\n // gift_type 1 (\u5355\u9009\u6A21\u5F0F)\n setSelectedGiftIds(() => {\n const newSelectedIds = [gift.id] // \u5355\u9009\uFF1A\u59CB\u7EC8\u9009\u4E2D\u5F53\u524D\u9879\uFF0C\u70B9\u51FB\u5DF2\u9009\u4E2D\u9879\u4FDD\u6301\u72B6\u6001\uFF0C\u70B9\u51FB\u672A\u9009\u4E2D\u9879\u5207\u6362\u5230\u8BE5\u9879\n\n // \u8BA1\u7B97\u65B0\u7684\u9009\u4E2Dgifts\u4F5C\u4E3A\u7B2C\u4E8C\u4E2A\u53C2\u6570\u4F20\u9012\u7ED9\u56DE\u8C03\n const newSelectedGifts = gifts?.filter((g: FreeGift) => newSelectedIds.includes(g.id)) || []\n\n // \u8C03\u7528\u56DE\u8C03\u51FD\u6570\uFF0C\u7B2C\u4E8C\u4E2A\u53C2\u6570\u662F\u5F53\u524D\u9009\u4E2D\u7684gifts\n onGiftClick?.(gift, newSelectedGifts)\n onGiftSelectionChange?.(newSelectedGifts, fullProductData)\n\n return newSelectedIds\n })\n }\n\n const hasClickHandler = !!(onProductImageClick ?? onProductClick)\n const productHref = `/products/${productData.handle}`\n\n const handleProductImageClick = () => {\n const callback = onProductImageClick ?? onProductClick\n callback?.(fullProductData)\n }\n\n const handleLearnMoreClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setLearnMoreLoading(true)\n try {\n await onLearnMore?.(fullProductData, selectedGifts)\n } finally {\n setLearnMoreLoading(false)\n }\n }\n\n const handleShopNowClick = async () => {\n const selectedGifts = giftsWithSelection.filter(gift => gift.selected)\n setShopNowLoading(true)\n try {\n await onShopNow?.(fullProductData, selectedGifts)\n } finally {\n setShopNowLoading(false)\n }\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary rounded-box flex items-stretch overflow-hidden',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5BB9\u5668\n layout === 'horizontal'\n ? [\n 'laptop:flex-row lg-desktop:min-h-[560px] desktop:min-h-[448px] tablet:min-h-[526px] min-h-[610px] flex-col',\n 'laptop:col-span-2',\n ]\n : ['flex-col justify-between'],\n className\n )}\n {...props}\n >\n {/* \u4EA7\u54C1\u56FE\u7247\u533A\u57DF */}\n <ProductImage\n images={sceneImages}\n name={productData.name}\n layout={layout}\n tags={productData.tags || tags}\n onClick={hasClickHandler ? handleProductImageClick : undefined}\n href={hasClickHandler ? undefined : productHref}\n />\n\n {/* \u4EA7\u54C1\u4FE1\u606F\u533A\u57DF */}\n <div\n className={cn(\n 'bg-container-primary desktop:p-6 flex flex-col justify-between p-4',\n // \u6839\u636E\u5E03\u5C40\u6A21\u5F0F\u8C03\u6574\u5706\u89D2\u548C\u5C3A\u5BF8\n layout === 'horizontal'\n ? [\n 'rounded-r-box laptop:rounded-r-box tablet:rounded-b-box tablet:rounded-l-none',\n // \u4F7F\u7528 flex-basis \u8BBE\u7F6E\u5BBD\u5EA6\u6BD4\u4F8B\n 'laptop:basis-[39.1%]', // 360px / 921px \u2248 39.1%\n 'desktop:basis-[42.1%]', // 552px / 1312px \u2248 42.1%\n 'lg-desktop:basis-[42.1%]', // 700px / 1664px \u2248 42.1%\n 'shrink-0',\n ]\n : ['rounded-b-box', 'w-full', 'grow']\n )}\n >\n <div className=\"flex flex-1 flex-col justify-between gap-6\">\n {/* \u4EA7\u54C1\u6807\u9898\u548C\u63CF\u8FF0 */}\n <ProductInfo\n name={productData.name}\n onClick={hasClickHandler ? handleProductImageClick : undefined}\n href={hasClickHandler ? undefined : productHref}\n description={productData.description}\n classNames={classNames}\n />\n\n {/* \u514D\u8D39\u8D60\u54C1\u533A\u57DF */}\n <GiftSelection\n freeGiftLabel={productData.freeGiftLabel}\n freeGifts={giftsWithSelection}\n onGiftClick={handleGiftClick}\n giftType={giftType}\n selectedGiftSku={selectedGiftSku}\n theme={theme}\n />\n <PriceAndActions\n currentPrice={productData.currentPrice ?? ''}\n originalPrice={productData.originalPrice}\n priceLabel={productData.priceLabel}\n learnMoreText={productData.learnMoreText}\n shopNowText={productData.shopNowText}\n soldOutText={soldOutText}\n onLearnMore={handleLearnMoreClick}\n onShopNow={handleShopNowClick}\n availableForSale={productData.availableForSale}\n learnMoreLoading={learnMoreLoading}\n shopNowLoading={shopNowLoading}\n trackingTitle={productData.name}\n trackingDescription={productData.description}\n trackingSku={productData.sku}\n classNames={classNames}\n />\n </div>\n </div>\n </div>\n )\n }\n)\n\nProductCard.displayName = 'BuyOneGetOneShelf.ProductCard'\n\nexport default ProductCard\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "ProductImage", "ProductInfo", "GiftSelection", "PriceAndActions", "BuyOneGetOneShelfContext", "ProductCard", "productData", "gifts", "giftType", "selectedGiftSku", "sceneImages", "tags", "layoutProp", "className", "onProductClick", "onProductImageClick", "onLearnMore", "onShopNow", "onGiftClick", "onGiftSelectionChange", "classNames", "soldOutText", "props", "ref", "contextLayout", "theme", "layout", "learnMoreLoading", "setLearnMoreLoading", "shopNowLoading", "setShopNowLoading", "selectedGiftIds", "setSelectedGiftIds", "gift", "giftsWithSelection", "prevSelectedIds", "currentSelectedId", "fullProductData", "handleGiftClick", "currentSelectedGifts", "g", "newSelectedIds", "newSelectedGifts", "hasClickHandler", "productHref", "handleProductImageClick", "handleLearnMoreClick", "selectedGifts", "handleShopNowClick", "ProductCard_default"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import*as t from"react";const
|
|
1
|
+
import*as t from"react";const e=t.createContext({layout:"horizontal"});export{e as BuyOneGetOneShelfContext};
|
|
2
2
|
//# sourceMappingURL=context.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/context.tsx"],
|
|
4
|
-
"sourcesContent": ["import * as React from 'react'\n\nexport const BuyOneGetOneShelfContext = React.createContext<{\n layout: 'horizontal' | 'vertical'\n}>({\n layout: 'horizontal',\n})\n"],
|
|
5
|
-
"mappings": "AAAA,UAAYA,MAAW,QAEhB,MAAMC,EAA2BD,EAAM,
|
|
4
|
+
"sourcesContent": ["import * as React from 'react'\n\nexport const BuyOneGetOneShelfContext = React.createContext<{\n layout: 'horizontal' | 'vertical'\n theme?: 'light' | 'dark'\n}>({\n layout: 'horizontal',\n})\n"],
|
|
5
|
+
"mappings": "AAAA,UAAYA,MAAW,QAEhB,MAAMC,EAA2BD,EAAM,cAG3C,CACD,OAAQ,YACV,CAAC",
|
|
6
6
|
"names": ["React", "BuyOneGetOneShelfContext"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as s,jsxs as O}from"react/jsx-runtime";import*as t from"react";import{cn as i}from"../../helpers/index.js";import B from"./ProductCard.js";import{Heading as G,Text as P}from"../../components/index.js";import{BuyOneGetOneShelfContext as b}from"./context.js";import{useExposure as E}from"../../hooks/useExposure.js";const D="shelf",k="buy_one_get_one_shelf";function h(o){return t.Children.toArray(o).flatMap(e=>t.isValidElement(e)&&e.type===t.Fragment?h(e.props.children):[e])}function w(o){return t.isValidElement(o)?o.props.layout??"horizontal":"horizontal"}function z(o,e){let n=0,l=0;for(let r=0;r<e;r++){const p=w(o[r])==="horizontal"?2:1;p===2&&n>0&&(n=0),n+=p,n===2&&(l=r+1,n=0)}return o.slice(0,l)}const g=t.forwardRef(({className:o,classNames:e={},theme:n,title:l,subtitle:r,children:p,viewMoreThreshold:f=4,viewMoreText:R="View More",viewLessText:x="View Less",...v},C)=>{const d=t.useRef(null),[c,N]=t.useState(!1);E(d,{componentType:D,componentName:k,componentTitle:l,componentDescription:r}),t.useImperativeHandle(C,()=>d.current);const u=h(p),m=u.length>f,S=(m&&!c?z(u,f):u).map(a=>{if(!t.isValidElement(a))return a;const y=a.props;return y.layout==="horizontal"?t.cloneElement(a,{className:i(y.className,"laptop:col-span-2")}):a});return s(b.Provider,{value:{layout:"horizontal",theme:n},children:O("div",{ref:d,className:i("bogo-shelf-root w-full py-0",{"aiui-dark":n==="dark"},o,e?.root),...v,children:[l&&s(G,{as:"h2",html:l,className:i("bogo-shelf-title text-info-primary mb-4",e?.title)}),r&&s(P,{size:3,as:"p",html:r,className:i("bogo-shelf-description text-info-primary mb-6",e?.description)}),s("div",{className:i("grid grid-cols-1 gap-6","laptop:grid-cols-2"),children:S}),m&&s("div",{className:"mt-6 flex justify-center",children:O("button",{type:"button",onClick:()=>N(a=>!a),"aria-expanded":c,className:i("hover:text-brand-0 lg-desktop:text-[16px] text-info-primary flex cursor-pointer items-center gap-2 border-none bg-transparent text-[14px] font-bold outline-none transition-colors",e?.viewMoreBtn),children:[c?x:R,s("svg",{className:i("size-4 transition-transform",c&&"rotate-180"),fill:"none",stroke:"currentColor",viewBox:"0 0 24 24","aria-hidden":"true",children:s("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M19 9l-7 7-7-7"})})]})})]})})});g.displayName="BuyOneGetOneShelf.Root";const I={Root:g,ProductCard:B};var j=I;export{j as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/BuyOneGetOneShelf/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductCard from './ProductCard.js'\nimport { Heading, Text } from '../../components/index.js'\nimport type { BuyOneGetOneShelfProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nconst componentType = 'shelf'\nconst componentName = 'buy_one_get_one_shelf'\n\nfunction flattenChildren(children: React.ReactNode): React.ReactNode[] {\n return React.Children.toArray(children).flatMap(child => {\n if (React.isValidElement(child) && child.type === React.Fragment) {\n return flattenChildren((child.props as { children?: React.ReactNode }).children)\n }\n return [child]\n })\n}\n\nfunction getLayout(node: React.ReactNode): string {\n if (React.isValidElement(node)) {\n return (node.props as { layout?: string }).layout ?? 'horizontal'\n }\n return 'horizontal'\n}\n\nfunction sliceToCompleteRow(all: React.ReactNode[], threshold: number): React.ReactNode[] {\n let filledInRow = 0\n let lastCompleteIndex = 0\n for (let i = 0; i < threshold; i++) {\n const span = getLayout(all[i]) === 'horizontal' ? 2 : 1\n if (span === 2 && filledInRow > 0) filledInRow = 0\n filledInRow += span\n if (filledInRow === 2) {\n lastCompleteIndex = i + 1\n filledInRow = 0\n }\n }\n return all.slice(0, lastCompleteIndex)\n}\n\nconst BuyOneGetOneShelfRoot = React.forwardRef<HTMLDivElement, BuyOneGetOneShelfProps>(\n (\n {\n className,\n classNames = {},\n theme,\n title,\n subtitle,\n children,\n viewMoreThreshold = 4,\n viewMoreText = 'View More',\n viewLessText = 'View Less',\n ...props\n },\n ref\n ) => {\n const boxRef = React.useRef<HTMLDivElement>(null)\n const [isExpanded, setIsExpanded] = React.useState(false)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n React.useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n const childrenArray = flattenChildren(children)\n const needCollapse = childrenArray.length > viewMoreThreshold\n const displayedChildren =\n needCollapse && !isExpanded ? sliceToCompleteRow(childrenArray, viewMoreThreshold) : childrenArray\n\n const renderedChildren = displayedChildren.map(child => {\n if (!React.isValidElement(child)) return child\n const childProps = child.props as { layout?: string; className?: string }\n if (childProps.layout === 'horizontal') {\n return React.cloneElement(child as React.ReactElement<{ className?: string }>, {\n className: cn(childProps.className, 'laptop:col-span-2'),\n })\n }\n return child\n })\n\n return (\n <div\n
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "cn", "ProductCard", "Heading", "Text", "useExposure", "componentType", "componentName", "flattenChildren", "children", "child", "getLayout", "node", "sliceToCompleteRow", "all", "threshold", "filledInRow", "lastCompleteIndex", "i", "span", "BuyOneGetOneShelfRoot", "className", "classNames", "theme", "title", "subtitle", "viewMoreThreshold", "viewMoreText", "viewLessText", "props", "ref", "boxRef", "isExpanded", "setIsExpanded", "childrenArray", "needCollapse", "renderedChildren", "childProps", "prev", "BuyOneGetOneShelf", "BuyOneGetOneShelf_default"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport ProductCard from './ProductCard.js'\nimport { Heading, Text } from '../../components/index.js'\nimport { BuyOneGetOneShelfContext } from './context.js'\nimport type { BuyOneGetOneShelfProps } from './types.js'\nimport { useExposure } from '../../hooks/useExposure.js'\n\nconst componentType = 'shelf'\nconst componentName = 'buy_one_get_one_shelf'\n\nfunction flattenChildren(children: React.ReactNode): React.ReactNode[] {\n return React.Children.toArray(children).flatMap(child => {\n if (React.isValidElement(child) && child.type === React.Fragment) {\n return flattenChildren((child.props as { children?: React.ReactNode }).children)\n }\n return [child]\n })\n}\n\nfunction getLayout(node: React.ReactNode): string {\n if (React.isValidElement(node)) {\n return (node.props as { layout?: string }).layout ?? 'horizontal'\n }\n return 'horizontal'\n}\n\nfunction sliceToCompleteRow(all: React.ReactNode[], threshold: number): React.ReactNode[] {\n let filledInRow = 0\n let lastCompleteIndex = 0\n for (let i = 0; i < threshold; i++) {\n const span = getLayout(all[i]) === 'horizontal' ? 2 : 1\n if (span === 2 && filledInRow > 0) filledInRow = 0\n filledInRow += span\n if (filledInRow === 2) {\n lastCompleteIndex = i + 1\n filledInRow = 0\n }\n }\n return all.slice(0, lastCompleteIndex)\n}\n\nconst BuyOneGetOneShelfRoot = React.forwardRef<HTMLDivElement, BuyOneGetOneShelfProps>(\n (\n {\n className,\n classNames = {},\n theme,\n title,\n subtitle,\n children,\n viewMoreThreshold = 4,\n viewMoreText = 'View More',\n viewLessText = 'View Less',\n ...props\n },\n ref\n ) => {\n const boxRef = React.useRef<HTMLDivElement>(null)\n const [isExpanded, setIsExpanded] = React.useState(false)\n\n useExposure(boxRef, {\n componentType,\n componentName,\n componentTitle: title,\n componentDescription: subtitle,\n })\n\n React.useImperativeHandle(ref, () => boxRef.current as HTMLDivElement)\n\n const childrenArray = flattenChildren(children)\n const needCollapse = childrenArray.length > viewMoreThreshold\n const displayedChildren =\n needCollapse && !isExpanded ? sliceToCompleteRow(childrenArray, viewMoreThreshold) : childrenArray\n\n const renderedChildren = displayedChildren.map(child => {\n if (!React.isValidElement(child)) return child\n const childProps = child.props as { layout?: string; className?: string }\n if (childProps.layout === 'horizontal') {\n return React.cloneElement(child as React.ReactElement<{ className?: string }>, {\n className: cn(childProps.className, 'laptop:col-span-2'),\n })\n }\n return child\n })\n\n return (\n <BuyOneGetOneShelfContext.Provider value={{ layout: 'horizontal', theme }}>\n <div\n ref={boxRef}\n className={cn(\n 'bogo-shelf-root w-full py-0',\n {\n 'aiui-dark': theme === 'dark',\n },\n className,\n classNames?.root\n )}\n {...props}\n >\n {title && (\n <Heading\n as=\"h2\"\n html={title}\n className={cn('bogo-shelf-title text-info-primary mb-4', classNames?.title)}\n />\n )}\n {subtitle && (\n <Text\n size={3}\n as=\"p\"\n html={subtitle}\n className={cn('bogo-shelf-description text-info-primary mb-6', classNames?.description)}\n />\n )}\n <div className={cn('grid grid-cols-1 gap-6', 'laptop:grid-cols-2')}>{renderedChildren}</div>\n {needCollapse && (\n <div className=\"mt-6 flex justify-center\">\n <button\n type=\"button\"\n onClick={() => setIsExpanded(prev => !prev)}\n aria-expanded={isExpanded}\n className={cn(\n 'hover:text-brand-0 lg-desktop:text-[16px] text-info-primary flex cursor-pointer items-center gap-2 border-none bg-transparent text-[14px] font-bold outline-none transition-colors',\n classNames?.viewMoreBtn\n )}\n >\n {isExpanded ? viewLessText : viewMoreText}\n <svg\n className={cn('size-4 transition-transform', isExpanded && 'rotate-180')}\n fill=\"none\"\n stroke=\"currentColor\"\n viewBox=\"0 0 24 24\"\n aria-hidden=\"true\"\n >\n <path strokeLinecap=\"round\" strokeLinejoin=\"round\" strokeWidth={2} d=\"M19 9l-7 7-7-7\" />\n </svg>\n </button>\n </div>\n )}\n </div>\n </BuyOneGetOneShelfContext.Provider>\n )\n }\n)\n\nBuyOneGetOneShelfRoot.displayName = 'BuyOneGetOneShelf.Root'\n\n// \u521B\u5EFA\u547D\u540D\u7A7A\u95F4\u5BF9\u8C61\uFF0C\u5305\u542B Root \u548C ProductCard \u7EC4\u4EF6\nconst BuyOneGetOneShelf = {\n Root: BuyOneGetOneShelfRoot,\n ProductCard: ProductCard,\n}\n\nexport default BuyOneGetOneShelf\n\n// Re-export types for external use\nexport type {\n FreeGift,\n FreeGiftWithSelection,\n ProductTag,\n BuyOneGetOneShelfSemanticName,\n BuyOneGetOneShelfRootSemanticName,\n BuyOneGetOneShelfProductCardSemanticName,\n ResponsiveImage,\n ResponsiveImages,\n BaseProductData,\n PureProductData,\n WithGiftData,\n ProductData,\n ProductCardData,\n CopyConfig,\n BogoItem,\n BuyOneGetOneShelfData,\n BuyOneGetOneShelfProps,\n BuyOneGetOneShelfCardProps,\n} from './types.js'\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "ProductCard", "Heading", "Text", "BuyOneGetOneShelfContext", "useExposure", "componentType", "componentName", "flattenChildren", "children", "child", "getLayout", "node", "sliceToCompleteRow", "all", "threshold", "filledInRow", "lastCompleteIndex", "i", "span", "BuyOneGetOneShelfRoot", "className", "classNames", "theme", "title", "subtitle", "viewMoreThreshold", "viewMoreText", "viewLessText", "props", "ref", "boxRef", "isExpanded", "setIsExpanded", "childrenArray", "needCollapse", "renderedChildren", "childProps", "prev", "BuyOneGetOneShelf", "BuyOneGetOneShelf_default"]
|
|
7
7
|
}
|
|
@@ -2,11 +2,11 @@ import React from 'react';
|
|
|
2
2
|
import type { FaqProps, FaqItem as ItemType, FaqSemanticName } from './types.js';
|
|
3
3
|
interface FaqItemProps {
|
|
4
4
|
data: ItemType;
|
|
5
|
-
|
|
5
|
+
index: number;
|
|
6
6
|
classNames?: Partial<Record<FaqSemanticName, string>>;
|
|
7
7
|
}
|
|
8
8
|
declare const FaqItem: {
|
|
9
|
-
({ data,
|
|
9
|
+
({ data, index, classNames }: FaqItemProps): import("react/jsx-runtime").JSX.Element;
|
|
10
10
|
displayName: string;
|
|
11
11
|
};
|
|
12
12
|
declare const _default: React.ForwardRefExoticComponent<Omit<FaqProps & React.RefAttributes<HTMLDivElement>, "container" | keyof import("../../shared/Styles.js").StylesProps> & import("../../shared/Styles.js").StylesProps & import("../WheelLottery/index.js").ContainerProps & React.RefAttributes<unknown>> & {
|
|
@@ -1,2 +1,11 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as t,jsxs as m}from"react/jsx-runtime";import u,{useImperativeHandle as y,useRef as h}from"react";import*as r from"@radix-ui/react-accordion";import{Text as x,Heading as v}from"../../components/index.js";import{cn as a}from"../../helpers/index.js";import{withLayout as q}from"../../shared/Styles.js";const p=u.forwardRef(({data:o,className:i,defaultOpenIndex:e,classNames:d={}},f)=>{const l=h(null);y(f,()=>l.current);const g=(Array.isArray(e)?e:e!==void 0?[e]:o?.openFirst??!0?[0]:[]).map(n=>`item-${n}`);return m("div",{ref:l,className:a(i,d.root),children:[t("style",{children:`
|
|
2
|
+
@keyframes faq-slide-down {
|
|
3
|
+
from { height: 0; opacity: 0; }
|
|
4
|
+
to { height: var(--radix-accordion-content-height); opacity: 1; }
|
|
5
|
+
}
|
|
6
|
+
@keyframes faq-slide-up {
|
|
7
|
+
from { height: var(--radix-accordion-content-height); opacity: 1; }
|
|
8
|
+
to { height: 0; opacity: 0; }
|
|
9
|
+
}
|
|
10
|
+
`}),t(r.Root,{type:"multiple",defaultValue:g,children:o?.productData?.map((n,c)=>t(s,{data:n,index:c,classNames:d},c))})]})});p.displayName="Faq";const s=({data:o,index:i,classNames:e={}})=>m(r.Item,{value:`item-${i}`,className:a("tablet:py-6 border-b border-[#E4E5E6] py-4",e.item),children:[t(r.Header,{className:"flex",children:m(r.Trigger,{className:a("tablet:gap-[128px] group flex flex-1 !cursor-pointer items-center justify-between gap-4 text-left",e.itemHeader),children:[t(v,{as:"h3",html:o?.title,className:a("desktop:text-base lg-desktop:text-lg text-info-primary text-sm font-bold leading-[1.4]",e.title)}),t("div",{className:a("transition-transform duration-300 group-data-[state=open]:rotate-180",e.icon),children:t("svg",{xmlns:"http://www.w3.org/2000/svg",className:"w-[20px]",width:"20",height:"21",viewBox:"0 0 20 21",fill:"none",children:t("path",{d:"M14.4111 7.41107C14.7365 7.08563 15.264 7.08563 15.5895 7.41107C15.9149 7.73651 15.9149 8.26402 15.5895 8.58946L10.5895 13.5895C10.264 13.9149 9.73651 13.9149 9.41107 13.5895L4.41107 8.58946C4.08563 8.26402 4.08563 7.73651 4.41107 7.41107C4.73651 7.08563 5.26402 7.08563 5.58946 7.41107L10.0003 11.8219L14.4111 7.41107Z",fill:"#1D1D1F"})})})]})}),t(r.Content,{className:a("overflow-hidden text-[#4A4C56]","data-[state=open]:animate-[faq-slide-down_300ms_ease-out]","data-[state=closed]:animate-[faq-slide-up_300ms_ease-out]",e.content),children:t("div",{className:"mt-2",children:t(x,{html:o?.richDesc??o?.desc,className:a("desktop:text-base lg-desktop:text-lg [&_a]:text-brand-0 text-sm font-bold leading-[1.4] [&_a]:underline",e.description)})})})]});s.displayName="FaqItem";var I=q(p);export{s as FaqItem,I as default};
|
|
2
11
|
//# sourceMappingURL=Faq.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/Faq/Faq.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "useImperativeHandle", "useRef", "
|
|
4
|
+
"sourcesContent": ["'use client'\nimport React, { useImperativeHandle, useRef } from 'react'\nimport * as Accordion from '@radix-ui/react-accordion'\nimport type { FaqProps, FaqItem as ItemType, FaqSemanticName } from './types.js'\nimport { Text, Heading } from '../../components/index.js'\nimport { cn } from '../../helpers/index.js'\nimport { withLayout } from '../../shared/Styles.js'\n\nconst Faq = React.forwardRef<HTMLDivElement, FaqProps>(\n ({ data, className, defaultOpenIndex, classNames = {} }, ref) => {\n const innerRef = useRef<HTMLDivElement>(null)\n useImperativeHandle(ref, () => innerRef.current!)\n\n const openIndexes = Array.isArray(defaultOpenIndex)\n ? defaultOpenIndex\n : defaultOpenIndex !== undefined\n ? [defaultOpenIndex]\n : (data?.openFirst ?? true)\n ? [0]\n : []\n\n const defaultValue = openIndexes.map(index => `item-${index}`)\n\n return (\n <div ref={innerRef} className={cn(className, classNames.root)}>\n <style>{`\n @keyframes faq-slide-down {\n from { height: 0; opacity: 0; }\n to { height: var(--radix-accordion-content-height); opacity: 1; }\n }\n @keyframes faq-slide-up {\n from { height: var(--radix-accordion-content-height); opacity: 1; }\n to { height: 0; opacity: 0; }\n }\n `}</style>\n <Accordion.Root type=\"multiple\" defaultValue={defaultValue}>\n {data?.productData?.map((item: any, index: number) => (\n <FaqItem key={index} data={item} index={index} classNames={classNames} />\n ))}\n </Accordion.Root>\n </div>\n )\n }\n)\n\nFaq.displayName = 'Faq'\n\ninterface FaqItemProps {\n data: ItemType\n index: number\n classNames?: Partial<Record<FaqSemanticName, string>>\n}\n\nconst FaqItem = ({ data, index, classNames = {} }: FaqItemProps) => {\n return (\n <Accordion.Item\n value={`item-${index}`}\n className={cn('tablet:py-6 border-b border-[#E4E5E6] py-4', classNames.item)}\n >\n <Accordion.Header className=\"flex\">\n <Accordion.Trigger\n className={cn(\n 'tablet:gap-[128px] group flex flex-1 !cursor-pointer items-center justify-between gap-4 text-left',\n classNames.itemHeader\n )}\n >\n <Heading\n as=\"h3\"\n html={data?.title}\n className={cn(\n 'desktop:text-base lg-desktop:text-lg text-info-primary text-sm font-bold leading-[1.4]',\n classNames.title\n )}\n />\n <div className={cn('transition-transform duration-300 group-data-[state=open]:rotate-180', classNames.icon)}>\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n className=\"w-[20px]\"\n width=\"20\"\n height=\"21\"\n viewBox=\"0 0 20 21\"\n fill=\"none\"\n >\n <path\n d=\"M14.4111 7.41107C14.7365 7.08563 15.264 7.08563 15.5895 7.41107C15.9149 7.73651 15.9149 8.26402 15.5895 8.58946L10.5895 13.5895C10.264 13.9149 9.73651 13.9149 9.41107 13.5895L4.41107 8.58946C4.08563 8.26402 4.08563 7.73651 4.41107 7.41107C4.73651 7.08563 5.26402 7.08563 5.58946 7.41107L10.0003 11.8219L14.4111 7.41107Z\"\n fill=\"#1D1D1F\"\n />\n </svg>\n </div>\n </Accordion.Trigger>\n </Accordion.Header>\n\n <Accordion.Content\n className={cn(\n 'overflow-hidden text-[#4A4C56]',\n 'data-[state=open]:animate-[faq-slide-down_300ms_ease-out]',\n 'data-[state=closed]:animate-[faq-slide-up_300ms_ease-out]',\n classNames.content\n )}\n >\n <div className=\"mt-2\">\n <Text\n html={data?.richDesc ?? data?.desc}\n className={cn(\n 'desktop:text-base lg-desktop:text-lg [&_a]:text-brand-0 text-sm font-bold leading-[1.4] [&_a]:underline',\n classNames.description\n )}\n />\n </div>\n </Accordion.Content>\n </Accordion.Item>\n )\n}\n\nFaqItem.displayName = 'FaqItem'\n\nexport default withLayout(Faq)\nexport { FaqItem }\n"],
|
|
5
|
+
"mappings": "aAwBM,OACE,OAAAA,EADF,QAAAC,MAAA,oBAvBN,OAAOC,GAAS,uBAAAC,EAAqB,UAAAC,MAAc,QACnD,UAAYC,MAAe,4BAE3B,OAAS,QAAAC,EAAM,WAAAC,MAAe,4BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,cAAAC,MAAkB,yBAE3B,MAAMC,EAAMR,EAAM,WAChB,CAAC,CAAE,KAAAS,EAAM,UAAAC,EAAW,iBAAAC,EAAkB,WAAAC,EAAa,CAAC,CAAE,EAAGC,IAAQ,CAC/D,MAAMC,EAAWZ,EAAuB,IAAI,EAC5CD,EAAoBY,EAAK,IAAMC,EAAS,OAAQ,EAUhD,MAAMC,GARc,MAAM,QAAQJ,CAAgB,EAC9CA,EACAA,IAAqB,OACnB,CAACA,CAAgB,EAChBF,GAAM,WAAa,GAClB,CAAC,CAAC,EACF,CAAC,GAEwB,IAAIO,GAAS,QAAQA,CAAK,EAAE,EAE7D,OACEjB,EAAC,OAAI,IAAKe,EAAU,UAAWR,EAAGI,EAAWE,EAAW,IAAI,EAC1D,UAAAd,EAAC,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,UASN,EACFA,EAACK,EAAU,KAAV,CAAe,KAAK,WAAW,aAAcY,EAC3C,SAAAN,GAAM,aAAa,IAAI,CAACQ,EAAWD,IAClClB,EAACoB,EAAA,CAAoB,KAAMD,EAAM,MAAOD,EAAO,WAAYJ,GAA7CI,CAAyD,CACxE,EACH,GACF,CAEJ,CACF,EAEAR,EAAI,YAAc,MAQlB,MAAMU,EAAU,CAAC,CAAE,KAAAT,EAAM,MAAAO,EAAO,WAAAJ,EAAa,CAAC,CAAE,IAE5Cb,EAACI,EAAU,KAAV,CACC,MAAO,QAAQa,CAAK,GACpB,UAAWV,EAAG,6CAA8CM,EAAW,IAAI,EAE3E,UAAAd,EAACK,EAAU,OAAV,CAAiB,UAAU,OAC1B,SAAAJ,EAACI,EAAU,QAAV,CACC,UAAWG,EACT,oGACAM,EAAW,UACb,EAEA,UAAAd,EAACO,EAAA,CACC,GAAG,KACH,KAAMI,GAAM,MACZ,UAAWH,EACT,yFACAM,EAAW,KACb,EACF,EACAd,EAAC,OAAI,UAAWQ,EAAG,uEAAwEM,EAAW,IAAI,EACxG,SAAAd,EAAC,OACC,MAAM,6BACN,UAAU,WACV,MAAM,KACN,OAAO,KACP,QAAQ,YACR,KAAK,OAEL,SAAAA,EAAC,QACC,EAAE,kUACF,KAAK,UACP,EACF,EACF,GACF,EACF,EAEAA,EAACK,EAAU,QAAV,CACC,UAAWG,EACT,iCACA,4DACA,4DACAM,EAAW,OACb,EAEA,SAAAd,EAAC,OAAI,UAAU,OACb,SAAAA,EAACM,EAAA,CACC,KAAMK,GAAM,UAAYA,GAAM,KAC9B,UAAWH,EACT,0GACAM,EAAW,WACb,EACF,EACF,EACF,GACF,EAIJM,EAAQ,YAAc,UAEtB,IAAOC,EAAQZ,EAAWC,CAAG",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "useImperativeHandle", "useRef", "Accordion", "Text", "Heading", "cn", "withLayout", "Faq", "data", "className", "defaultOpenIndex", "classNames", "ref", "innerRef", "defaultValue", "index", "item", "FaqItem", "Faq_default"]
|
|
7
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@anker-in/headless-ui",
|
|
3
|
-
"version": "1.3.
|
|
3
|
+
"version": "1.3.24",
|
|
4
4
|
"type": "commonjs",
|
|
5
5
|
"main": "./dist/cjs/index.js",
|
|
6
6
|
"types": "./dist/cjs/index.d.ts",
|
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
"eslint-plugin-prettier": "^5.2.6",
|
|
84
84
|
"eslint-plugin-react-hooks": "^4.6.2",
|
|
85
85
|
"eslint-plugin-require-extensions": "^0.1.3",
|
|
86
|
+
"glob": "^13.0.0",
|
|
86
87
|
"jest": "^29.7.0",
|
|
87
88
|
"jest-coverage-badges": "^1.1.2",
|
|
88
89
|
"jest-environment-jsdom": "^29.7.0",
|
|
@@ -92,11 +93,11 @@
|
|
|
92
93
|
"postcss-prefix-selector": "^2.1.1",
|
|
93
94
|
"prettier": "^3.5.3",
|
|
94
95
|
"react-test-renderer": "^18.3.1",
|
|
95
|
-
"stylelint": "^16.6.0"
|
|
96
|
-
"glob": "^13.0.0"
|
|
96
|
+
"stylelint": "^16.6.0"
|
|
97
97
|
},
|
|
98
98
|
"dependencies": {
|
|
99
99
|
"@payloadcms/richtext-lexical": "^3.39.1",
|
|
100
|
+
"@radix-ui/react-accordion": "^1.2.14",
|
|
100
101
|
"@radix-ui/react-avatar": "^1.1.9",
|
|
101
102
|
"@radix-ui/react-checkbox": "^1.3.1",
|
|
102
103
|
"@radix-ui/react-dialog": "^1.1.13",
|
package/style.css
CHANGED
|
@@ -1574,9 +1574,6 @@ video {
|
|
|
1574
1574
|
.\!max-h-none {
|
|
1575
1575
|
max-height: none !important;
|
|
1576
1576
|
}
|
|
1577
|
-
.max-h-0 {
|
|
1578
|
-
max-height: 0px;
|
|
1579
|
-
}
|
|
1580
1577
|
.max-h-\[126px\] {
|
|
1581
1578
|
max-height: 126px;
|
|
1582
1579
|
}
|
|
@@ -1610,9 +1607,6 @@ video {
|
|
|
1610
1607
|
.max-h-\[40px\] {
|
|
1611
1608
|
max-height: 40px;
|
|
1612
1609
|
}
|
|
1613
|
-
.max-h-\[500px\] {
|
|
1614
|
-
max-height: 500px;
|
|
1615
|
-
}
|
|
1616
1610
|
.max-h-\[560px\] {
|
|
1617
1611
|
max-height: 560px;
|
|
1618
1612
|
}
|
|
@@ -2109,6 +2103,9 @@ video {
|
|
|
2109
2103
|
.\!cursor-default {
|
|
2110
2104
|
cursor: default !important;
|
|
2111
2105
|
}
|
|
2106
|
+
.\!cursor-pointer {
|
|
2107
|
+
cursor: pointer !important;
|
|
2108
|
+
}
|
|
2112
2109
|
.cursor-default {
|
|
2113
2110
|
cursor: default;
|
|
2114
2111
|
}
|
|
@@ -4737,6 +4734,12 @@ video {
|
|
|
4737
4734
|
.data-\[vaul-drawer-direction\=right\]\:max-w-sm[data-vaul-drawer-direction="right"] {
|
|
4738
4735
|
max-width: 24rem;
|
|
4739
4736
|
}
|
|
4737
|
+
.data-\[state\=closed\]\:animate-\[faq-slide-up_300ms_ease-out\][data-state="closed"] {
|
|
4738
|
+
animation: faq-slide-up 300ms ease-out;
|
|
4739
|
+
}
|
|
4740
|
+
.data-\[state\=open\]\:animate-\[faq-slide-down_300ms_ease-out\][data-state="open"] {
|
|
4741
|
+
animation: faq-slide-down 300ms ease-out;
|
|
4742
|
+
}
|
|
4740
4743
|
.data-\[vaul-drawer-direction\=bottom\]\:border-t[data-vaul-drawer-direction="bottom"] {
|
|
4741
4744
|
border-top-width: 1px;
|
|
4742
4745
|
}
|
|
@@ -4815,6 +4818,10 @@ video {
|
|
|
4815
4818
|
.group\/drawer-content[data-vaul-drawer-direction="bottom"] .group-data-\[vaul-drawer-direction\=bottom\]\/drawer-content\:block {
|
|
4816
4819
|
display: block;
|
|
4817
4820
|
}
|
|
4821
|
+
.group[data-state="open"] .group-data-\[state\=open\]\:rotate-180 {
|
|
4822
|
+
--tw-rotate: 180deg;
|
|
4823
|
+
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
4824
|
+
}
|
|
4818
4825
|
@media (min-width: 640px) {
|
|
4819
4826
|
.sm\:overflow-visible {
|
|
4820
4827
|
overflow: visible;
|