@anker-in/headless-ui 1.1.56 → 1.1.57
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/ActiveShelf/ProductCard.d.ts +1 -1
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/ProductCard.js.map +2 -2
- package/dist/cjs/biz-components/ActiveShelf/index.js +1 -1
- package/dist/cjs/biz-components/ActiveShelf/index.js.map +2 -2
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/FreeGiftItem.js.map +2 -2
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/ProductCard.js.map +2 -2
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/cjs/biz-components/BuyOneGetOneShelf/index.js.map +2 -2
- package/dist/cjs/biz-components/Category/SwiperCategory.d.ts +2 -0
- package/dist/cjs/biz-components/Category/SwiperCategory.js +1 -1
- package/dist/cjs/biz-components/Category/SwiperCategory.js.map +3 -3
- package/dist/cjs/biz-components/Category/index.js +1 -1
- package/dist/cjs/biz-components/Category/index.js.map +3 -3
- package/dist/cjs/biz-components/CreditsShelf/ProductCard.d.ts +41 -0
- package/dist/cjs/biz-components/CreditsShelf/ProductCard.js +2 -0
- package/dist/cjs/biz-components/CreditsShelf/ProductCard.js.map +7 -0
- package/dist/cjs/biz-components/CreditsShelf/ProductsList.d.ts +20 -0
- package/dist/cjs/biz-components/CreditsShelf/ProductsList.js +2 -0
- package/dist/cjs/biz-components/CreditsShelf/ProductsList.js.map +7 -0
- package/dist/cjs/biz-components/CreditsShelf/Root.d.ts +43 -0
- package/dist/cjs/biz-components/CreditsShelf/Root.js +2 -0
- package/dist/cjs/biz-components/CreditsShelf/Root.js.map +7 -0
- package/dist/cjs/biz-components/CreditsShelf/context.d.ts +40 -0
- package/dist/cjs/biz-components/CreditsShelf/context.js +2 -0
- package/dist/cjs/biz-components/CreditsShelf/context.js.map +7 -0
- package/dist/cjs/biz-components/CreditsShelf/index.d.ts +15 -0
- package/dist/cjs/biz-components/CreditsShelf/index.js +2 -0
- package/dist/cjs/biz-components/CreditsShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/CreditsShelf/types.d.ts +73 -0
- package/dist/cjs/biz-components/CreditsShelf/types.js +2 -0
- package/dist/cjs/biz-components/CreditsShelf/types.js.map +7 -0
- package/dist/cjs/biz-components/ImageOverlayShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/ImageOverlayShelf/ProductCard.js.map +2 -2
- package/dist/cjs/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/cjs/biz-components/MediaPlayerBase/index.js.map +2 -2
- package/dist/cjs/biz-components/MediaShelf/ProductCard.js +1 -1
- package/dist/cjs/biz-components/MediaShelf/ProductCard.js.map +2 -2
- package/dist/cjs/biz-components/MiniCart/CircleProgress.d.ts +38 -0
- package/dist/cjs/biz-components/MiniCart/CircleProgress.js +2 -0
- package/dist/cjs/biz-components/MiniCart/CircleProgress.js.map +7 -0
- package/dist/cjs/biz-components/MiniCart/MiniCartDialog.js +1 -1
- package/dist/cjs/biz-components/MiniCart/MiniCartDialog.js.map +1 -1
- package/dist/cjs/biz-components/MiniCart/index.d.ts +31 -1
- package/dist/cjs/biz-components/MiniCart/index.js +1 -1
- package/dist/cjs/biz-components/MiniCart/index.js.map +3 -3
- package/dist/cjs/biz-components/SceneShelf/Footer.d.ts +21 -0
- package/dist/cjs/biz-components/SceneShelf/Footer.js +2 -0
- package/dist/cjs/biz-components/SceneShelf/Footer.js.map +7 -0
- package/dist/cjs/biz-components/SceneShelf/ProductCard.d.ts +23 -0
- package/dist/cjs/biz-components/SceneShelf/ProductCard.js +2 -0
- package/dist/cjs/biz-components/SceneShelf/ProductCard.js.map +7 -0
- package/dist/cjs/biz-components/SceneShelf/ProductsPanel.d.ts +26 -0
- package/dist/cjs/biz-components/SceneShelf/ProductsPanel.js +2 -0
- package/dist/cjs/biz-components/SceneShelf/ProductsPanel.js.map +7 -0
- package/dist/cjs/biz-components/SceneShelf/Root.d.ts +20 -0
- package/dist/cjs/biz-components/SceneShelf/Root.js +2 -0
- package/dist/cjs/biz-components/SceneShelf/Root.js.map +7 -0
- package/dist/cjs/biz-components/SceneShelf/Scene.d.ts +38 -0
- package/dist/cjs/biz-components/SceneShelf/Scene.js +2 -0
- package/dist/cjs/biz-components/SceneShelf/Scene.js.map +7 -0
- package/dist/cjs/biz-components/SceneShelf/SceneImage.d.ts +14 -0
- package/dist/cjs/biz-components/SceneShelf/SceneImage.js +2 -0
- package/dist/cjs/biz-components/SceneShelf/SceneImage.js.map +7 -0
- package/dist/cjs/biz-components/SceneShelf/context.d.ts +40 -0
- package/dist/cjs/biz-components/SceneShelf/context.js +2 -0
- package/dist/cjs/biz-components/SceneShelf/context.js.map +7 -0
- package/dist/cjs/biz-components/SceneShelf/index.d.ts +21 -0
- package/dist/cjs/biz-components/SceneShelf/index.js +2 -0
- package/dist/cjs/biz-components/SceneShelf/index.js.map +7 -0
- package/dist/cjs/biz-components/SceneShelf/types.d.ts +51 -0
- package/dist/cjs/biz-components/SceneShelf/types.js +2 -0
- package/dist/cjs/biz-components/SceneShelf/types.js.map +7 -0
- package/dist/cjs/biz-components/SecondaryBanner/index.d.ts +25 -0
- package/dist/cjs/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/cjs/biz-components/SecondaryBanner/index.js.map +3 -3
- package/dist/cjs/biz-components/index.d.ts +7 -1
- package/dist/cjs/biz-components/index.js +1 -1
- package/dist/cjs/biz-components/index.js.map +3 -3
- package/dist/cjs/components/Countdown.js +1 -1
- package/dist/cjs/components/Countdown.js.map +2 -2
- package/dist/cjs/components/button.js +1 -1
- package/dist/cjs/components/button.js.map +2 -2
- package/dist/cjs/components/checkbox.js +1 -1
- package/dist/cjs/components/checkbox.js.map +2 -2
- package/dist/cjs/components/text.js +1 -1
- package/dist/cjs/components/text.js.map +2 -2
- package/dist/esm/biz-components/ActiveShelf/ProductCard.d.ts +1 -1
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/ProductCard.js.map +2 -2
- package/dist/esm/biz-components/ActiveShelf/index.js +1 -1
- package/dist/esm/biz-components/ActiveShelf/index.js.map +2 -2
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/FreeGiftItem.js.map +2 -2
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/ProductCard.js.map +2 -2
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js +1 -1
- package/dist/esm/biz-components/BuyOneGetOneShelf/index.js.map +2 -2
- package/dist/esm/biz-components/Category/SwiperCategory.d.ts +2 -0
- package/dist/esm/biz-components/Category/SwiperCategory.js +1 -1
- package/dist/esm/biz-components/Category/SwiperCategory.js.map +3 -3
- package/dist/esm/biz-components/Category/index.js +1 -1
- package/dist/esm/biz-components/Category/index.js.map +3 -3
- package/dist/esm/biz-components/CreditsShelf/ProductCard.d.ts +41 -0
- package/dist/esm/biz-components/CreditsShelf/ProductCard.js +2 -0
- package/dist/esm/biz-components/CreditsShelf/ProductCard.js.map +7 -0
- package/dist/esm/biz-components/CreditsShelf/ProductsList.d.ts +20 -0
- package/dist/esm/biz-components/CreditsShelf/ProductsList.js +2 -0
- package/dist/esm/biz-components/CreditsShelf/ProductsList.js.map +7 -0
- package/dist/esm/biz-components/CreditsShelf/Root.d.ts +43 -0
- package/dist/esm/biz-components/CreditsShelf/Root.js +2 -0
- package/dist/esm/biz-components/CreditsShelf/Root.js.map +7 -0
- package/dist/esm/biz-components/CreditsShelf/context.d.ts +40 -0
- package/dist/esm/biz-components/CreditsShelf/context.js +2 -0
- package/dist/esm/biz-components/CreditsShelf/context.js.map +7 -0
- package/dist/esm/biz-components/CreditsShelf/index.d.ts +15 -0
- package/dist/esm/biz-components/CreditsShelf/index.js +2 -0
- package/dist/esm/biz-components/CreditsShelf/index.js.map +7 -0
- package/dist/esm/biz-components/CreditsShelf/types.d.ts +73 -0
- package/dist/esm/biz-components/CreditsShelf/types.js +2 -0
- package/dist/esm/biz-components/CreditsShelf/types.js.map +7 -0
- package/dist/esm/biz-components/ImageOverlayShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/ImageOverlayShelf/ProductCard.js.map +2 -2
- package/dist/esm/biz-components/MediaPlayerBase/index.js +1 -1
- package/dist/esm/biz-components/MediaPlayerBase/index.js.map +2 -2
- package/dist/esm/biz-components/MediaShelf/ProductCard.js +1 -1
- package/dist/esm/biz-components/MediaShelf/ProductCard.js.map +2 -2
- package/dist/esm/biz-components/MiniCart/CircleProgress.d.ts +38 -0
- package/dist/esm/biz-components/MiniCart/CircleProgress.js +2 -0
- package/dist/esm/biz-components/MiniCart/CircleProgress.js.map +7 -0
- package/dist/esm/biz-components/MiniCart/MiniCartDialog.js +1 -1
- package/dist/esm/biz-components/MiniCart/MiniCartDialog.js.map +1 -1
- package/dist/esm/biz-components/MiniCart/index.d.ts +31 -1
- package/dist/esm/biz-components/MiniCart/index.js +1 -1
- package/dist/esm/biz-components/MiniCart/index.js.map +3 -3
- package/dist/esm/biz-components/SceneShelf/Footer.d.ts +21 -0
- package/dist/esm/biz-components/SceneShelf/Footer.js +2 -0
- package/dist/esm/biz-components/SceneShelf/Footer.js.map +7 -0
- package/dist/esm/biz-components/SceneShelf/ProductCard.d.ts +23 -0
- package/dist/esm/biz-components/SceneShelf/ProductCard.js +2 -0
- package/dist/esm/biz-components/SceneShelf/ProductCard.js.map +7 -0
- package/dist/esm/biz-components/SceneShelf/ProductsPanel.d.ts +26 -0
- package/dist/esm/biz-components/SceneShelf/ProductsPanel.js +2 -0
- package/dist/esm/biz-components/SceneShelf/ProductsPanel.js.map +7 -0
- package/dist/esm/biz-components/SceneShelf/Root.d.ts +20 -0
- package/dist/esm/biz-components/SceneShelf/Root.js +2 -0
- package/dist/esm/biz-components/SceneShelf/Root.js.map +7 -0
- package/dist/esm/biz-components/SceneShelf/Scene.d.ts +38 -0
- package/dist/esm/biz-components/SceneShelf/Scene.js +2 -0
- package/dist/esm/biz-components/SceneShelf/Scene.js.map +7 -0
- package/dist/esm/biz-components/SceneShelf/SceneImage.d.ts +14 -0
- package/dist/esm/biz-components/SceneShelf/SceneImage.js +2 -0
- package/dist/esm/biz-components/SceneShelf/SceneImage.js.map +7 -0
- package/dist/esm/biz-components/SceneShelf/context.d.ts +40 -0
- package/dist/esm/biz-components/SceneShelf/context.js +2 -0
- package/dist/esm/biz-components/SceneShelf/context.js.map +7 -0
- package/dist/esm/biz-components/SceneShelf/index.d.ts +21 -0
- package/dist/esm/biz-components/SceneShelf/index.js +2 -0
- package/dist/esm/biz-components/SceneShelf/index.js.map +7 -0
- package/dist/esm/biz-components/SceneShelf/types.d.ts +51 -0
- package/dist/esm/biz-components/SceneShelf/types.js +2 -0
- package/dist/esm/biz-components/SceneShelf/types.js.map +7 -0
- package/dist/esm/biz-components/SecondaryBanner/index.d.ts +25 -0
- package/dist/esm/biz-components/SecondaryBanner/index.js +1 -1
- package/dist/esm/biz-components/SecondaryBanner/index.js.map +3 -3
- package/dist/esm/biz-components/index.d.ts +7 -1
- package/dist/esm/biz-components/index.js +1 -1
- package/dist/esm/biz-components/index.js.map +3 -3
- package/dist/esm/components/Countdown.js +1 -1
- package/dist/esm/components/Countdown.js.map +2 -2
- package/dist/esm/components/button.js +1 -1
- package/dist/esm/components/button.js.map +2 -2
- package/dist/esm/components/checkbox.js +1 -1
- package/dist/esm/components/checkbox.js.map +2 -2
- package/dist/esm/components/text.js +1 -1
- package/dist/esm/components/text.js.map +2 -2
- package/dist/tokens/anker.css +1 -0
- package/dist/tokens/base.css +1 -0
- package/dist/tokens/eufy.css +1 -0
- package/dist/tokens/eufyMake.css +1 -0
- package/dist/tokens/solix.css +1 -0
- package/dist/tokens/soundcore.css +1 -0
- package/package.json +1 -1
- package/style.css +20 -3
- package/tailwind.config.js +1 -0
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { PriceData } from './types.js';
|
|
3
|
+
import 'swiper/css';
|
|
4
|
+
export interface SceneShelfProductsPanelProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** 标题 */
|
|
6
|
+
title?: string;
|
|
7
|
+
/** 总价标签 */
|
|
8
|
+
totalPriceLabel?: string;
|
|
9
|
+
/** 当前总价 */
|
|
10
|
+
totalCurrentPrice?: PriceData;
|
|
11
|
+
/** 原总价 */
|
|
12
|
+
totalOriginalPrice?: PriceData;
|
|
13
|
+
/** 添加到购物车按钮文本 */
|
|
14
|
+
addToCartButtonText?: string;
|
|
15
|
+
/** 立即购买按钮文本 */
|
|
16
|
+
shopNowButtonText?: string;
|
|
17
|
+
/** 子组件(ProductCard 或自定义卡片) */
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* SceneShelf ProductsPanel 组件
|
|
22
|
+
*
|
|
23
|
+
* @description 产品面板组件,包含产品列表(Swiper)和底部操作区域(总价 + 按钮)
|
|
24
|
+
*/
|
|
25
|
+
declare const SceneShelfProductsPanel: React.ForwardRefExoticComponent<SceneShelfProductsPanelProps & React.RefAttributes<HTMLDivElement>>;
|
|
26
|
+
export { SceneShelfProductsPanel };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as t,jsxs as n}from"react/jsx-runtime";import*as s from"react";import{Swiper as j,SwiperSlide as E}from"swiper/react";import{FreeMode as q,Mousewheel as F}from"swiper/modules";import{cn as a}from"../../helpers/index.js";import{Heading as G,Button as f,Text as c}from"../../components/index.js";import{useSceneShelfContext as V}from"./context.js";import"swiper/css";const u=s.forwardRef(({title:d,totalPriceLabel:h,totalCurrentPrice:P,totalOriginalPrice:w,addToCartButtonText:g,shopNowButtonText:T,className:N,children:S,...y},C)=>{const e=V(),o=e?.classNames,p=h??e?.totalPriceLabel??"Total Price:",r=P??e?.totalCurrentPrice,l=w??e?.totalOriginalPrice,b=g??e?.addToCartButtonText??"Add to Cart",v=T??e?.shopNowButtonText??"Shop Now",i=e?.selectedProducts??[],B=e?.onAddToCart,k=e?.onShopNow,L=e?.showOriginalPrice??!0,[A,x]=s.useState(!1),[M,m]=s.useState(!1),O=s.Children.toArray(S),D=async()=>{x(!0);try{await B?.(i)}finally{x(!1)}},R=async()=>{m(!0);try{await k?.(i)}finally{m(!1)}};return n("div",{ref:C,className:a("bg-container-primary laptop:p-6 lg-desktop:p-8 flex min-w-0 flex-1 flex-col justify-between overflow-hidden p-4",N,o?.content),...y,children:[d&&t(G,{as:"h2",size:3,className:a("text-info-primary flex-0 mb-[16px] line-clamp-1 shrink-0",o?.title),html:d}),t("div",{className:a("lg-desktop:mb-[24px] mb-[16px] flex-1 ",o?.productList),children:t(j,{modules:[q,F],freeMode:!0,mousewheel:{forceToAxis:!0},slidesPerView:"auto",spaceBetween:10,breakpoints:{768:{spaceBetween:16}},children:O.map((z,H)=>t(E,{className:"lg-desktop:!w-[342px] h-fit !w-[248px] shrink-0",children:z},H))})}),n("div",{className:a("tablet:items-end tablet:flex-row flex-0 flex flex-col items-start justify-between gap-2",o?.footer),children:[n("div",{className:a("flex flex-wrap items-center gap-1",o?.totalPrice),children:[p&&t(c,{as:"span",size:2,className:"text-info-primary lg-desktop:text-[24px] text-[20px]",children:p}),r&&t(c,{as:"span",size:2,className:a("text-info-primary lg-desktop:text-[24px] text-[20px]",o?.currentTotalPrice),children:r.formatted}),L&&l&&r&&l.value>r.value&&t(c,{as:"span",size:2,className:a("text-info-quaternary lg-desktop:text-[24px] text-[20px] line-through",o?.originalTotalPrice),children:l.formatted})]}),n("div",{className:a("flex gap-3",o?.buttonGroup),children:[t(f,{variant:"secondary",onClick:D,disabled:i.length===0,loading:A,children:b}),t(f,{variant:"primary",onClick:R,disabled:i.length===0,loading:M,children:v})]})]})]})});u.displayName="SceneShelf.ProductsPanel";export{u as SceneShelfProductsPanel};
|
|
2
|
+
//# sourceMappingURL=ProductsPanel.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/SceneShelf/ProductsPanel.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport { FreeMode, Mousewheel } from 'swiper/modules'\nimport { cn } from '../../helpers/index.js'\nimport { Heading, Button, Text } from '../../components/index.js'\nimport { useSceneShelfContext } from './context.js'\nimport type { PriceData } from './types.js'\nimport 'swiper/css'\n\nexport interface SceneShelfProductsPanelProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u6807\u9898 */\n title?: string\n /** \u603B\u4EF7\u6807\u7B7E */\n totalPriceLabel?: string\n /** \u5F53\u524D\u603B\u4EF7 */\n totalCurrentPrice?: PriceData\n /** \u539F\u603B\u4EF7 */\n totalOriginalPrice?: PriceData\n /** \u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\u6309\u94AE\u6587\u672C */\n addToCartButtonText?: string\n /** \u7ACB\u5373\u8D2D\u4E70\u6309\u94AE\u6587\u672C */\n shopNowButtonText?: string\n /** \u5B50\u7EC4\u4EF6\uFF08ProductCard \u6216\u81EA\u5B9A\u4E49\u5361\u7247\uFF09 */\n children: React.ReactNode\n}\n\n/**\n * SceneShelf ProductsPanel \u7EC4\u4EF6\n *\n * @description \u4EA7\u54C1\u9762\u677F\u7EC4\u4EF6\uFF0C\u5305\u542B\u4EA7\u54C1\u5217\u8868\uFF08Swiper\uFF09\u548C\u5E95\u90E8\u64CD\u4F5C\u533A\u57DF\uFF08\u603B\u4EF7 + \u6309\u94AE\uFF09\n */\nconst SceneShelfProductsPanel = React.forwardRef<HTMLDivElement, SceneShelfProductsPanelProps>(\n (\n {\n title,\n totalPriceLabel: totalPriceLabelProp,\n totalCurrentPrice: totalCurrentPriceProp,\n totalOriginalPrice: totalOriginalPriceProp,\n addToCartButtonText: addToCartButtonTextProp,\n shopNowButtonText: shopNowButtonTextProp,\n className,\n children,\n ...props\n },\n ref\n ) => {\n const context = useSceneShelfContext()\n const classNames = context?.classNames\n\n // Props \u4F18\u5148\u7EA7\u9AD8\u4E8E Context\n const totalPriceLabel = totalPriceLabelProp ?? context?.totalPriceLabel ?? 'Total Price:'\n const totalCurrentPrice = totalCurrentPriceProp ?? context?.totalCurrentPrice\n const totalOriginalPrice = totalOriginalPriceProp ?? context?.totalOriginalPrice\n const addToCartButtonText = addToCartButtonTextProp ?? context?.addToCartButtonText ?? 'Add to Cart'\n const shopNowButtonText = shopNowButtonTextProp ?? context?.shopNowButtonText ?? 'Shop Now'\n\n const selectedProducts = context?.selectedProducts ?? []\n const onAddToCart = context?.onAddToCart\n const onShopNow = context?.onShopNow\n const showOriginalPrice = context?.showOriginalPrice ?? true\n\n // \u6309\u94AE loading \u72B6\u6001\n const [addToCartLoading, setAddToCartLoading] = React.useState(false)\n const [shopNowLoading, setShopNowLoading] = React.useState(false)\n\n // \u5C06 children \u8F6C\u6362\u4E3A\u6570\u7EC4\n const childrenArray = React.Children.toArray(children)\n\n // \u5904\u7406\u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\n const handleAddToCart = async () => {\n setAddToCartLoading(true)\n try {\n await onAddToCart?.(selectedProducts)\n } finally {\n setAddToCartLoading(false)\n }\n }\n\n // \u5904\u7406\u7ACB\u5373\u8D2D\u4E70\n const handleShopNow = async () => {\n setShopNowLoading(true)\n try {\n await onShopNow?.(selectedProducts)\n } finally {\n setShopNowLoading(false)\n }\n }\n\n return (\n <div\n ref={ref}\n className={cn(\n 'bg-container-primary laptop:p-6 lg-desktop:p-8 flex min-w-0 flex-1 flex-col justify-between overflow-hidden p-4',\n className,\n classNames?.content\n )}\n {...props}\n >\n {/* \u6807\u9898 */}\n {title && (\n <Heading\n as=\"h2\"\n size={3}\n className={cn('text-info-primary flex-0 mb-[16px] line-clamp-1 shrink-0', classNames?.title)}\n html={title}\n />\n )}\n\n {/* \u4EA7\u54C1\u5217\u8868 - Swiper \u5BB9\u5668 */}\n <div className={cn('lg-desktop:mb-[24px] mb-[16px] flex-1 ', classNames?.productList)}>\n <Swiper\n modules={[FreeMode, Mousewheel]}\n freeMode={true}\n mousewheel={{\n forceToAxis: true,\n }}\n slidesPerView=\"auto\"\n spaceBetween={10}\n breakpoints={{\n 768: {\n spaceBetween: 16,\n },\n }}\n >\n {childrenArray.map((child, index) => (\n <SwiperSlide key={index} className=\"lg-desktop:!w-[342px] h-fit !w-[248px] shrink-0\">\n {child}\n </SwiperSlide>\n ))}\n </Swiper>\n </div>\n\n {/* \u5E95\u90E8\u533A\u57DF - \u603B\u4EF7 + \u6309\u94AE */}\n <div\n className={cn(\n 'tablet:items-end tablet:flex-row flex-0 flex flex-col items-start justify-between gap-2',\n classNames?.footer\n )}\n >\n {/* \u603B\u4EF7 */}\n <div className={cn('flex flex-wrap items-center gap-1', classNames?.totalPrice)}>\n {totalPriceLabel && (\n <Text as=\"span\" size={2} className=\"text-info-primary lg-desktop:text-[24px] text-[20px]\">\n {totalPriceLabel}\n </Text>\n )}\n {totalCurrentPrice && (\n <Text\n as=\"span\"\n size={2}\n className={cn('text-info-primary lg-desktop:text-[24px] text-[20px]', classNames?.currentTotalPrice)}\n >\n {totalCurrentPrice.formatted}\n </Text>\n )}\n {showOriginalPrice &&\n totalOriginalPrice &&\n totalCurrentPrice &&\n totalOriginalPrice.value > totalCurrentPrice.value && (\n <Text\n as=\"span\"\n size={2}\n className={cn(\n 'text-info-quaternary lg-desktop:text-[24px] text-[20px] line-through',\n classNames?.originalTotalPrice\n )}\n >\n {totalOriginalPrice.formatted}\n </Text>\n )}\n </div>\n\n {/* \u6309\u94AE\u7EC4 */}\n <div className={cn('flex gap-3', classNames?.buttonGroup)}>\n <Button\n variant=\"secondary\"\n onClick={handleAddToCart}\n disabled={selectedProducts.length === 0}\n loading={addToCartLoading}\n >\n {addToCartButtonText}\n </Button>\n <Button\n variant=\"primary\"\n onClick={handleShopNow}\n disabled={selectedProducts.length === 0}\n loading={shopNowLoading}\n >\n {shopNowButtonText}\n </Button>\n </div>\n </div>\n </div>\n )\n }\n)\n\nSceneShelfProductsPanel.displayName = 'SceneShelf.ProductsPanel'\n\nexport { SceneShelfProductsPanel }\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "Swiper", "SwiperSlide", "FreeMode", "Mousewheel", "cn", "Heading", "Button", "Text", "useSceneShelfContext", "SceneShelfProductsPanel", "title", "totalPriceLabelProp", "totalCurrentPriceProp", "totalOriginalPriceProp", "addToCartButtonTextProp", "shopNowButtonTextProp", "className", "children", "props", "ref", "context", "classNames", "totalPriceLabel", "totalCurrentPrice", "totalOriginalPrice", "addToCartButtonText", "shopNowButtonText", "selectedProducts", "onAddToCart", "onShopNow", "showOriginalPrice", "addToCartLoading", "setAddToCartLoading", "shopNowLoading", "setShopNowLoading", "childrenArray", "handleAddToCart", "handleShopNow", "child", "index"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SceneShelfSemanticName } from './types.js';
|
|
3
|
+
export interface SceneShelfRootProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
4
|
+
/** 主标题 */
|
|
5
|
+
title?: string;
|
|
6
|
+
/** 副标题 */
|
|
7
|
+
subtitle?: string;
|
|
8
|
+
theme?: 'light' | 'dark';
|
|
9
|
+
/** 语义化类名 */
|
|
10
|
+
classNames?: Partial<Record<SceneShelfSemanticName, string>>;
|
|
11
|
+
/** 子组件(多个 Scene) */
|
|
12
|
+
children: React.ReactNode;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* SceneShelf Root 组件
|
|
16
|
+
*
|
|
17
|
+
* @description 最外层容器,包含标题和多个场景
|
|
18
|
+
*/
|
|
19
|
+
declare const SceneShelfRoot: React.ForwardRefExoticComponent<SceneShelfRootProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export { SceneShelfRoot };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as a,jsxs as m}from"react/jsx-runtime";import*as f from"react";import{cn as t}from"../../helpers/index.js";import{Heading as p,Text as h}from"../../components/index.js";const o=f.forwardRef(({title:i,subtitle:r,theme:n="light",classNames:e,className:c,children:l,...s},d)=>m("div",{ref:d,className:t("text-info-primary w-full",{"aiui-dark":n==="dark"},c,e?.root),...s,children:[(i||r)&&m("div",{className:t("mb-6",e?.header),children:[i&&a(p,{as:"h2",size:4,className:t("text-info-primary mb-2",e?.title),html:i}),r&&a(h,{as:"p",size:3,className:t("",e?.subtitle),html:r})]}),a("div",{className:t("space-y-6",e?.sceneList),children:l})]}));o.displayName="SceneShelf.Root";export{o as SceneShelfRoot};
|
|
2
|
+
//# sourceMappingURL=Root.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/SceneShelf/Root.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Heading, Text } from '../../components/index.js'\nimport type { SceneShelfSemanticName } from './types.js'\n\nexport interface SceneShelfRootProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E3B\u6807\u9898 */\n title?: string\n /** \u526F\u6807\u9898 */\n subtitle?: string\n theme?: 'light' | 'dark'\n /** \u8BED\u4E49\u5316\u7C7B\u540D */\n classNames?: Partial<Record<SceneShelfSemanticName, string>>\n /** \u5B50\u7EC4\u4EF6\uFF08\u591A\u4E2A Scene\uFF09 */\n children: React.ReactNode\n}\n\n/**\n * SceneShelf Root \u7EC4\u4EF6\n *\n * @description \u6700\u5916\u5C42\u5BB9\u5668\uFF0C\u5305\u542B\u6807\u9898\u548C\u591A\u4E2A\u573A\u666F\n */\nconst SceneShelfRoot = React.forwardRef<HTMLDivElement, SceneShelfRootProps>(\n ({ title, subtitle, theme = 'light', classNames, className, children, ...props }, ref) => {\n return (\n <div\n ref={ref}\n className={cn(\n 'text-info-primary w-full',\n {\n 'aiui-dark': theme === 'dark',\n },\n className,\n classNames?.root\n )}\n {...props}\n >\n {/* \u6807\u9898\u533A\u57DF */}\n {(title || subtitle) && (\n <div className={cn('mb-6', classNames?.header)}>\n {title && (\n <Heading as=\"h2\" size={4} className={cn('text-info-primary mb-2', classNames?.title)} html={title} />\n )}\n {subtitle && <Text as=\"p\" size={3} className={cn('', classNames?.subtitle)} html={subtitle} />}\n </div>\n )}\n\n {/* \u573A\u666F\u5217\u8868 */}\n <div className={cn('space-y-6', classNames?.sceneList)}>{children}</div>\n </div>\n )\n }\n)\n\nSceneShelfRoot.displayName = 'SceneShelf.Root'\n\nexport { SceneShelfRoot }\n"],
|
|
5
|
+
"mappings": "aAyCU,OAEI,OAAAA,EAFJ,QAAAC,MAAA,oBAvCV,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,EAAS,QAAAC,MAAY,4BAoB9B,MAAMC,EAAiBJ,EAAM,WAC3B,CAAC,CAAE,MAAAK,EAAO,SAAAC,EAAU,MAAAC,EAAQ,QAAS,WAAAC,EAAY,UAAAC,EAAW,SAAAC,EAAU,GAAGC,CAAM,EAAGC,IAE9Eb,EAAC,OACC,IAAKa,EACL,UAAWX,EACT,2BACA,CACE,YAAaM,IAAU,MACzB,EACAE,EACAD,GAAY,IACd,EACC,GAAGG,EAGF,WAAAN,GAASC,IACTP,EAAC,OAAI,UAAWE,EAAG,OAAQO,GAAY,MAAM,EAC1C,UAAAH,GACCP,EAACI,EAAA,CAAQ,GAAG,KAAK,KAAM,EAAG,UAAWD,EAAG,yBAA0BO,GAAY,KAAK,EAAG,KAAMH,EAAO,EAEpGC,GAAYR,EAACK,EAAA,CAAK,GAAG,IAAI,KAAM,EAAG,UAAWF,EAAG,GAAIO,GAAY,QAAQ,EAAG,KAAMF,EAAU,GAC9F,EAIFR,EAAC,OAAI,UAAWG,EAAG,YAAaO,GAAY,SAAS,EAAI,SAAAE,EAAS,GACpE,CAGN,EAEAN,EAAe,YAAc",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cn", "Heading", "Text", "SceneShelfRoot", "title", "subtitle", "theme", "classNames", "className", "children", "props", "ref"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { type SceneShelfContextValue } from './context.js';
|
|
3
|
+
import type { SceneProductCardData, PriceData } from './types.js';
|
|
4
|
+
export interface SceneShelfSceneProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
/** 是否展示标签 */
|
|
6
|
+
showTags?: boolean;
|
|
7
|
+
/** 是否展示原价 */
|
|
8
|
+
showOriginalPrice?: boolean;
|
|
9
|
+
/** 语义化类名 */
|
|
10
|
+
classNames?: SceneShelfContextValue['classNames'];
|
|
11
|
+
/** 产品选中状态变化回调 */
|
|
12
|
+
onSelectionChange?: (selectedProducts: SceneProductCardData[]) => void;
|
|
13
|
+
/** 点击添加到购物车回调 */
|
|
14
|
+
onAddToCart?: (selectedProducts: SceneProductCardData[]) => void | Promise<void>;
|
|
15
|
+
/** 点击立即购买回调 */
|
|
16
|
+
onShopNow?: (selectedProducts: SceneProductCardData[]) => void | Promise<void>;
|
|
17
|
+
/** 添加到购物车按钮文本 */
|
|
18
|
+
addToCartButtonText?: string;
|
|
19
|
+
/** 立即购买按钮文本 */
|
|
20
|
+
shopNowButtonText?: string;
|
|
21
|
+
/** 总价标签 */
|
|
22
|
+
totalPriceLabel?: string;
|
|
23
|
+
/** 当前总价 */
|
|
24
|
+
totalCurrentPrice?: PriceData;
|
|
25
|
+
/** 原总价 */
|
|
26
|
+
totalOriginalPrice?: PriceData;
|
|
27
|
+
/** 初始选中的产品列表(通过 defaultSelected 标记) */
|
|
28
|
+
products?: SceneProductCardData[];
|
|
29
|
+
/** 子组件 */
|
|
30
|
+
children: React.ReactNode;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* SceneShelf Scene 组件
|
|
34
|
+
*
|
|
35
|
+
* @description 单个场景容器,提供 Context 配置和选择状态管理
|
|
36
|
+
*/
|
|
37
|
+
declare const SceneShelfScene: React.ForwardRefExoticComponent<SceneShelfSceneProps & React.RefAttributes<HTMLDivElement>>;
|
|
38
|
+
export { SceneShelfScene };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as v}from"react/jsx-runtime";import*as t from"react";import{cn as E}from"../../helpers/index.js";import{SceneShelfContext as N}from"./context.js";const C=t.forwardRef(({showTags:l=!0,showOriginalPrice:s=!0,classNames:r,onSelectionChange:i,onAddToCart:S,onShopNow:f,addToCartButtonText:u="Add to Cart",shopNowButtonText:h="Shop Now",totalPriceLabel:P="Total Price:",totalCurrentPrice:m,totalOriginalPrice:p,products:a=[],className:D,children:g,...w},b)=>{const[n,M]=t.useState(()=>{const e=new Set;return a.forEach(o=>{o.defaultSelected&&e.add(o.id)}),e}),c=t.useMemo(()=>a.filter(e=>n.has(e.id)),[a,n]),x=t.useCallback((e,o)=>{M(y=>{const d=new Set(y);return e?d.add(o.id):d.delete(o.id),d})},[]);t.useEffect(()=>{i?.(c)},[c,i]);const R=t.useMemo(()=>({showTags:l,showOriginalPrice:s,classNames:r,selectedIds:n,selectedProducts:c,onSelectChange:x,onAddToCart:S,onShopNow:f,addToCartButtonText:u,shopNowButtonText:h,totalPriceLabel:P,totalCurrentPrice:m,totalOriginalPrice:p}),[l,s,r,n,c,x,S,f,u,h,P,m,p]);return v(N.Provider,{value:R,children:v("div",{ref:b,className:E("rounded-box tablet:flex-row lg-desktop:min-h-[560px] desktop:h-[448px] laptop:min-h-[448px] flex min-h-[560px] w-full flex-col items-stretch gap-0 overflow-hidden",D,r?.scene),...w,children:g})})});C.displayName="SceneShelf.Scene";export{C as SceneShelfScene};
|
|
2
|
+
//# sourceMappingURL=Scene.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/SceneShelf/Scene.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { SceneShelfContext, type SceneShelfContextValue } from './context.js'\nimport type { SceneProductCardData, PriceData } from './types.js'\n\nexport interface SceneShelfSceneProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u662F\u5426\u5C55\u793A\u6807\u7B7E */\n showTags?: boolean\n /** \u662F\u5426\u5C55\u793A\u539F\u4EF7 */\n showOriginalPrice?: boolean\n /** \u8BED\u4E49\u5316\u7C7B\u540D */\n classNames?: SceneShelfContextValue['classNames']\n /** \u4EA7\u54C1\u9009\u4E2D\u72B6\u6001\u53D8\u5316\u56DE\u8C03 */\n onSelectionChange?: (selectedProducts: SceneProductCardData[]) => void\n /** \u70B9\u51FB\u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\u56DE\u8C03 */\n onAddToCart?: (selectedProducts: SceneProductCardData[]) => void | Promise<void>\n /** \u70B9\u51FB\u7ACB\u5373\u8D2D\u4E70\u56DE\u8C03 */\n onShopNow?: (selectedProducts: SceneProductCardData[]) => void | Promise<void>\n /** \u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\u6309\u94AE\u6587\u672C */\n addToCartButtonText?: string\n /** \u7ACB\u5373\u8D2D\u4E70\u6309\u94AE\u6587\u672C */\n shopNowButtonText?: string\n /** \u603B\u4EF7\u6807\u7B7E */\n totalPriceLabel?: string\n /** \u5F53\u524D\u603B\u4EF7 */\n totalCurrentPrice?: PriceData\n /** \u539F\u603B\u4EF7 */\n totalOriginalPrice?: PriceData\n /** \u521D\u59CB\u9009\u4E2D\u7684\u4EA7\u54C1\u5217\u8868\uFF08\u901A\u8FC7 defaultSelected \u6807\u8BB0\uFF09 */\n products?: SceneProductCardData[]\n /** \u5B50\u7EC4\u4EF6 */\n children: React.ReactNode\n}\n\n/**\n * SceneShelf Scene \u7EC4\u4EF6\n *\n * @description \u5355\u4E2A\u573A\u666F\u5BB9\u5668\uFF0C\u63D0\u4F9B Context \u914D\u7F6E\u548C\u9009\u62E9\u72B6\u6001\u7BA1\u7406\n */\nconst SceneShelfScene = React.forwardRef<HTMLDivElement, SceneShelfSceneProps>(\n (\n {\n showTags = true,\n showOriginalPrice = true,\n classNames,\n onSelectionChange,\n onAddToCart,\n onShopNow,\n addToCartButtonText = 'Add to Cart',\n shopNowButtonText = 'Shop Now',\n totalPriceLabel = 'Total Price:',\n totalCurrentPrice,\n totalOriginalPrice,\n products = [],\n className,\n children,\n ...props\n },\n ref\n ) => {\n // \u7BA1\u7406\u9009\u4E2D\u72B6\u6001\n const [selectedIds, setSelectedIds] = React.useState<Set<string>>(() => {\n const initialSelected = new Set<string>()\n products.forEach(product => {\n if (product.defaultSelected) {\n initialSelected.add(product.id)\n }\n })\n return initialSelected\n })\n\n // \u8BA1\u7B97\u9009\u4E2D\u7684\u4EA7\u54C1\n const selectedProducts = React.useMemo(() => {\n return products.filter(product => selectedIds.has(product.id))\n }, [products, selectedIds])\n\n // \u5904\u7406\u9009\u4E2D\u72B6\u6001\u53D8\u5316\n const handleSelectChange = React.useCallback((selected: boolean, product: SceneProductCardData) => {\n setSelectedIds(prev => {\n const newSet = new Set(prev)\n if (selected) {\n newSet.add(product.id)\n } else {\n newSet.delete(product.id)\n }\n return newSet\n })\n }, [])\n\n // \u901A\u77E5\u7236\u7EC4\u4EF6\u9009\u4E2D\u72B6\u6001\u53D8\u5316\n React.useEffect(() => {\n onSelectionChange?.(selectedProducts)\n }, [selectedProducts, onSelectionChange])\n\n const contextValue = React.useMemo<SceneShelfContextValue>(\n () => ({\n showTags,\n showOriginalPrice,\n classNames,\n selectedIds,\n selectedProducts,\n onSelectChange: handleSelectChange,\n onAddToCart,\n onShopNow,\n addToCartButtonText,\n shopNowButtonText,\n totalPriceLabel,\n totalCurrentPrice,\n totalOriginalPrice,\n }),\n [\n showTags,\n showOriginalPrice,\n classNames,\n selectedIds,\n selectedProducts,\n handleSelectChange,\n onAddToCart,\n onShopNow,\n addToCartButtonText,\n shopNowButtonText,\n totalPriceLabel,\n totalCurrentPrice,\n totalOriginalPrice,\n ]\n )\n\n return (\n <SceneShelfContext.Provider value={contextValue}>\n <div\n ref={ref}\n className={cn(\n 'rounded-box tablet:flex-row lg-desktop:min-h-[560px] desktop:h-[448px] laptop:min-h-[448px] flex min-h-[560px] w-full flex-col items-stretch gap-0 overflow-hidden',\n className,\n classNames?.scene\n )}\n {...props}\n >\n {children}\n </div>\n </SceneShelfContext.Provider>\n )\n }\n)\n\nSceneShelfScene.displayName = 'SceneShelf.Scene'\n\nexport { SceneShelfScene }\n"],
|
|
5
|
+
"mappings": "aAmIQ,cAAAA,MAAA,oBAjIR,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAS,qBAAAC,MAAsD,eAqC/D,MAAMC,EAAkBH,EAAM,WAC5B,CACE,CACE,SAAAI,EAAW,GACX,kBAAAC,EAAoB,GACpB,WAAAC,EACA,kBAAAC,EACA,YAAAC,EACA,UAAAC,EACA,oBAAAC,EAAsB,cACtB,kBAAAC,EAAoB,WACpB,gBAAAC,EAAkB,eAClB,kBAAAC,EACA,mBAAAC,EACA,SAAAC,EAAW,CAAC,EACZ,UAAAC,EACA,SAAAC,EACA,GAAGC,CACL,EACAC,IACG,CAEH,KAAM,CAACC,EAAaC,CAAc,EAAIrB,EAAM,SAAsB,IAAM,CACtE,MAAMsB,EAAkB,IAAI,IAC5B,OAAAP,EAAS,QAAQQ,GAAW,CACtBA,EAAQ,iBACVD,EAAgB,IAAIC,EAAQ,EAAE,CAElC,CAAC,EACMD,CACT,CAAC,EAGKE,EAAmBxB,EAAM,QAAQ,IAC9Be,EAAS,OAAOQ,GAAWH,EAAY,IAAIG,EAAQ,EAAE,CAAC,EAC5D,CAACR,EAAUK,CAAW,CAAC,EAGpBK,EAAqBzB,EAAM,YAAY,CAAC0B,EAAmBH,IAAkC,CACjGF,EAAeM,GAAQ,CACrB,MAAMC,EAAS,IAAI,IAAID,CAAI,EAC3B,OAAID,EACFE,EAAO,IAAIL,EAAQ,EAAE,EAErBK,EAAO,OAAOL,EAAQ,EAAE,EAEnBK,CACT,CAAC,CACH,EAAG,CAAC,CAAC,EAGL5B,EAAM,UAAU,IAAM,CACpBO,IAAoBiB,CAAgB,CACtC,EAAG,CAACA,EAAkBjB,CAAiB,CAAC,EAExC,MAAMsB,EAAe7B,EAAM,QACzB,KAAO,CACL,SAAAI,EACA,kBAAAC,EACA,WAAAC,EACA,YAAAc,EACA,iBAAAI,EACA,eAAgBC,EAChB,YAAAjB,EACA,UAAAC,EACA,oBAAAC,EACA,kBAAAC,EACA,gBAAAC,EACA,kBAAAC,EACA,mBAAAC,CACF,GACA,CACEV,EACAC,EACAC,EACAc,EACAI,EACAC,EACAjB,EACAC,EACAC,EACAC,EACAC,EACAC,EACAC,CACF,CACF,EAEA,OACEf,EAACG,EAAkB,SAAlB,CAA2B,MAAO2B,EACjC,SAAA9B,EAAC,OACC,IAAKoB,EACL,UAAWlB,EACT,sKACAe,EACAV,GAAY,KACd,EACC,GAAGY,EAEH,SAAAD,EACH,EACF,CAEJ,CACF,EAEAd,EAAgB,YAAc",
|
|
6
|
+
"names": ["jsx", "React", "cn", "SceneShelfContext", "SceneShelfScene", "showTags", "showOriginalPrice", "classNames", "onSelectionChange", "onAddToCart", "onShopNow", "addToCartButtonText", "shopNowButtonText", "totalPriceLabel", "totalCurrentPrice", "totalOriginalPrice", "products", "className", "children", "props", "ref", "selectedIds", "setSelectedIds", "initialSelected", "product", "selectedProducts", "handleSelectChange", "selected", "prev", "newSet", "contextValue"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface SceneShelfSceneImageProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
3
|
+
/** 场景图片 URL */
|
|
4
|
+
imageUrl: string;
|
|
5
|
+
/** 场景图片 Alt */
|
|
6
|
+
imageAlt?: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* SceneShelf SceneImage 组件
|
|
10
|
+
*
|
|
11
|
+
* @description 场景推荐货架的场景图片展示组件
|
|
12
|
+
*/
|
|
13
|
+
declare const SceneShelfSceneImage: React.ForwardRefExoticComponent<SceneShelfSceneImageProps & React.RefAttributes<HTMLDivElement>>;
|
|
14
|
+
export { SceneShelfSceneImage };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{jsx as t}from"react/jsx-runtime";import*as m from"react";import{cn as o}from"../../helpers/index.js";import{Picture as i}from"../../components/index.js";import{useSceneShelfContext as f}from"./context.js";const e=m.forwardRef(({imageUrl:s,imageAlt:c,className:l,...a},n)=>{const r=f()?.classNames;return t("div",{ref:n,className:o("tablet:h-full tablet:w-[327px] desktop:w-[544px] h-[240px] w-full shrink-0",l,r?.sceneImage),...a,children:t(i,{source:s,alt:c||"",className:"size-full",imgClassName:"size-full object-cover"})})});e.displayName="SceneShelf.SceneImage";export{e as SceneShelfSceneImage};
|
|
2
|
+
//# sourceMappingURL=SceneImage.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/SceneShelf/SceneImage.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Picture } from '../../components/index.js'\nimport { useSceneShelfContext } from './context.js'\n\nexport interface SceneShelfSceneImageProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u573A\u666F\u56FE\u7247 URL */\n imageUrl: string\n /** \u573A\u666F\u56FE\u7247 Alt */\n imageAlt?: string\n}\n\n/**\n * SceneShelf SceneImage \u7EC4\u4EF6\n *\n * @description \u573A\u666F\u63A8\u8350\u8D27\u67B6\u7684\u573A\u666F\u56FE\u7247\u5C55\u793A\u7EC4\u4EF6\n */\nconst SceneShelfSceneImage = React.forwardRef<HTMLDivElement, SceneShelfSceneImageProps>(\n ({ imageUrl, imageAlt, className, ...props }, ref) => {\n const context = useSceneShelfContext()\n const classNames = context?.classNames\n\n return (\n <div\n ref={ref}\n className={cn(\n 'tablet:h-full tablet:w-[327px] desktop:w-[544px] h-[240px] w-full shrink-0',\n className,\n classNames?.sceneImage\n )}\n {...props}\n >\n <Picture source={imageUrl} alt={imageAlt || ''} className=\"size-full\" imgClassName=\"size-full object-cover\" />\n </div>\n )\n }\n)\n\nSceneShelfSceneImage.displayName = 'SceneShelf.SceneImage'\n\nexport { SceneShelfSceneImage }\n"],
|
|
5
|
+
"mappings": "aAkCQ,cAAAA,MAAA,oBAhCR,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,MAAe,4BACxB,OAAS,wBAAAC,MAA4B,eAcrC,MAAMC,EAAuBJ,EAAM,WACjC,CAAC,CAAE,SAAAK,EAAU,SAAAC,EAAU,UAAAC,EAAW,GAAGC,CAAM,EAAGC,IAAQ,CAEpD,MAAMC,EADUP,EAAqB,GACT,WAE5B,OACEJ,EAAC,OACC,IAAKU,EACL,UAAWR,EACT,6EACAM,EACAG,GAAY,UACd,EACC,GAAGF,EAEJ,SAAAT,EAACG,EAAA,CAAQ,OAAQG,EAAU,IAAKC,GAAY,GAAI,UAAU,YAAY,aAAa,yBAAyB,EAC9G,CAEJ,CACF,EAEAF,EAAqB,YAAc",
|
|
6
|
+
"names": ["jsx", "React", "cn", "Picture", "useSceneShelfContext", "SceneShelfSceneImage", "imageUrl", "imageAlt", "className", "props", "ref", "classNames"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import type { SceneShelfSemanticName, SceneProductCardData, PriceData } from './types.js';
|
|
3
|
+
/**
|
|
4
|
+
* SceneShelf Context 值类型
|
|
5
|
+
*/
|
|
6
|
+
export interface SceneShelfContextValue {
|
|
7
|
+
/** 是否展示标签 */
|
|
8
|
+
showTags?: boolean;
|
|
9
|
+
/** 是否展示原价 */
|
|
10
|
+
showOriginalPrice?: boolean;
|
|
11
|
+
/** 语义化类名 */
|
|
12
|
+
classNames?: Partial<Record<SceneShelfSemanticName, string>>;
|
|
13
|
+
/** 选中的产品 ID 集合 */
|
|
14
|
+
selectedIds: Set<string>;
|
|
15
|
+
/** 选中的产品列表 */
|
|
16
|
+
selectedProducts: SceneProductCardData[];
|
|
17
|
+
/** 选中状态变化回调 */
|
|
18
|
+
onSelectChange: (selected: boolean, product: SceneProductCardData) => void;
|
|
19
|
+
/** 添加到购物车回调 */
|
|
20
|
+
onAddToCart?: (selectedProducts: SceneProductCardData[]) => void | Promise<void>;
|
|
21
|
+
/** 立即购买回调 */
|
|
22
|
+
onShopNow?: (selectedProducts: SceneProductCardData[]) => void | Promise<void>;
|
|
23
|
+
/** 添加到购物车按钮文本 */
|
|
24
|
+
addToCartButtonText?: string;
|
|
25
|
+
/** 立即购买按钮文本 */
|
|
26
|
+
shopNowButtonText?: string;
|
|
27
|
+
/** 总价标签 */
|
|
28
|
+
totalPriceLabel?: string;
|
|
29
|
+
/** 当前总价 */
|
|
30
|
+
totalCurrentPrice?: PriceData;
|
|
31
|
+
/** 原总价 */
|
|
32
|
+
totalOriginalPrice?: PriceData;
|
|
33
|
+
}
|
|
34
|
+
declare const SceneShelfContext: React.Context<SceneShelfContextValue | null>;
|
|
35
|
+
/**
|
|
36
|
+
* 获取 SceneShelf Context
|
|
37
|
+
* @returns Context 值,如果在 Root 外使用则返回 null
|
|
38
|
+
*/
|
|
39
|
+
export declare function useSceneShelfContext(): SceneShelfContextValue | null;
|
|
40
|
+
export { SceneShelfContext };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/SceneShelf/context.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport type { SceneShelfSemanticName, SceneProductCardData, PriceData } from './types.js'\n\n/**\n * SceneShelf Context \u503C\u7C7B\u578B\n */\nexport interface SceneShelfContextValue {\n /** \u662F\u5426\u5C55\u793A\u6807\u7B7E */\n showTags?: boolean\n /** \u662F\u5426\u5C55\u793A\u539F\u4EF7 */\n showOriginalPrice?: boolean\n /** \u8BED\u4E49\u5316\u7C7B\u540D */\n classNames?: Partial<Record<SceneShelfSemanticName, string>>\n /** \u9009\u4E2D\u7684\u4EA7\u54C1 ID \u96C6\u5408 */\n selectedIds: Set<string>\n /** \u9009\u4E2D\u7684\u4EA7\u54C1\u5217\u8868 */\n selectedProducts: SceneProductCardData[]\n /** \u9009\u4E2D\u72B6\u6001\u53D8\u5316\u56DE\u8C03 */\n onSelectChange: (selected: boolean, product: SceneProductCardData) => void\n /** \u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\u56DE\u8C03 */\n onAddToCart?: (selectedProducts: SceneProductCardData[]) => void | Promise<void>\n /** \u7ACB\u5373\u8D2D\u4E70\u56DE\u8C03 */\n onShopNow?: (selectedProducts: SceneProductCardData[]) => void | Promise<void>\n /** \u6DFB\u52A0\u5230\u8D2D\u7269\u8F66\u6309\u94AE\u6587\u672C */\n addToCartButtonText?: string\n /** \u7ACB\u5373\u8D2D\u4E70\u6309\u94AE\u6587\u672C */\n shopNowButtonText?: string\n /** \u603B\u4EF7\u6807\u7B7E */\n totalPriceLabel?: string\n /** \u5F53\u524D\u603B\u4EF7 */\n totalCurrentPrice?: PriceData\n /** \u539F\u603B\u4EF7 */\n totalOriginalPrice?: PriceData\n}\n\nconst SceneShelfContext = React.createContext<SceneShelfContextValue | null>(null)\n\n/**\n * \u83B7\u53D6 SceneShelf Context\n * @returns Context \u503C\uFF0C\u5982\u679C\u5728 Root \u5916\u4F7F\u7528\u5219\u8FD4\u56DE null\n */\nexport function useSceneShelfContext() {\n return React.useContext(SceneShelfContext)\n}\n\nexport { SceneShelfContext }\n"],
|
|
5
|
+
"mappings": "aAEA,UAAYA,MAAW,QAmCvB,MAAMC,EAAoBD,EAAM,cAA6C,IAAI,EAM1E,SAASE,GAAuB,CACrC,OAAOF,EAAM,WAAWC,CAAiB,CAC3C",
|
|
6
|
+
"names": ["React", "SceneShelfContext", "useSceneShelfContext"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { SceneShelfRoot } from './Root.js';
|
|
2
|
+
import { SceneShelfScene } from './Scene.js';
|
|
3
|
+
import { SceneShelfSceneImage } from './SceneImage.js';
|
|
4
|
+
import { SceneShelfProductsPanel } from './ProductsPanel.js';
|
|
5
|
+
import { SceneProductCard } from './ProductCard.js';
|
|
6
|
+
export type { SceneShelfSemanticName, SceneProductCardSemanticName, ProductTag, PriceData, SceneProductCardData, } from './types.js';
|
|
7
|
+
export type { SceneShelfRootProps } from './Root.js';
|
|
8
|
+
export type { SceneShelfSceneProps } from './Scene.js';
|
|
9
|
+
export type { SceneShelfSceneImageProps } from './SceneImage.js';
|
|
10
|
+
export type { SceneShelfProductsPanelProps } from './ProductsPanel.js';
|
|
11
|
+
export type { SceneProductCardProps } from './ProductCard.js';
|
|
12
|
+
export type { SceneShelfContextValue } from './context.js';
|
|
13
|
+
export { SceneShelfRoot, SceneShelfScene, SceneShelfSceneImage, SceneShelfProductsPanel, SceneProductCard };
|
|
14
|
+
declare const SceneShelf: {
|
|
15
|
+
Root: import("react").ForwardRefExoticComponent<import("./Root.js").SceneShelfRootProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
16
|
+
Scene: import("react").ForwardRefExoticComponent<import("./Scene.js").SceneShelfSceneProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
17
|
+
SceneImage: import("react").ForwardRefExoticComponent<import("./SceneImage.js").SceneShelfSceneImageProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
18
|
+
ProductsPanel: import("react").ForwardRefExoticComponent<import("./ProductsPanel.js").SceneShelfProductsPanelProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
19
|
+
ProductCard: import("react").ForwardRefExoticComponent<import("./ProductCard.js").SceneProductCardProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
20
|
+
};
|
|
21
|
+
export default SceneShelf;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use client";import{SceneShelfRoot as e}from"./Root.js";import{SceneShelfScene as o}from"./Scene.js";import{SceneShelfSceneImage as r}from"./SceneImage.js";import{SceneShelfProductsPanel as t}from"./ProductsPanel.js";import{SceneProductCard as c}from"./ProductCard.js";const S={Root:e,Scene:o,SceneImage:r,ProductsPanel:t,ProductCard:c};var P=S;export{c as SceneProductCard,t as SceneShelfProductsPanel,e as SceneShelfRoot,o as SceneShelfScene,r as SceneShelfSceneImage,P as default};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/biz-components/SceneShelf/index.tsx"],
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport { SceneShelfRoot } from './Root.js'\nimport { SceneShelfScene } from './Scene.js'\nimport { SceneShelfSceneImage } from './SceneImage.js'\nimport { SceneShelfProductsPanel } from './ProductsPanel.js'\nimport { SceneProductCard } from './ProductCard.js'\n\n// \u5BFC\u51FA\u7C7B\u578B\nexport type {\n SceneShelfSemanticName,\n SceneProductCardSemanticName,\n ProductTag,\n PriceData,\n SceneProductCardData,\n} from './types.js'\n\nexport type { SceneShelfRootProps } from './Root.js'\nexport type { SceneShelfSceneProps } from './Scene.js'\nexport type { SceneShelfSceneImageProps } from './SceneImage.js'\nexport type { SceneShelfProductsPanelProps } from './ProductsPanel.js'\nexport type { SceneProductCardProps } from './ProductCard.js'\nexport type { SceneShelfContextValue } from './context.js'\n\n// \u5BFC\u51FA\u5B50\u7EC4\u4EF6\nexport { SceneShelfRoot, SceneShelfScene, SceneShelfSceneImage, SceneShelfProductsPanel, SceneProductCard }\n\n// \u7EC4\u5408\u5F0F\u7EC4\u4EF6\nconst SceneShelf = {\n Root: SceneShelfRoot,\n Scene: SceneShelfScene,\n SceneImage: SceneShelfSceneImage,\n ProductsPanel: SceneShelfProductsPanel,\n ProductCard: SceneProductCard,\n}\n\nexport default SceneShelf\n"],
|
|
5
|
+
"mappings": "aAEA,OAAS,kBAAAA,MAAsB,YAC/B,OAAS,mBAAAC,MAAuB,aAChC,OAAS,wBAAAC,MAA4B,kBACrC,OAAS,2BAAAC,MAA+B,qBACxC,OAAS,oBAAAC,MAAwB,mBAsBjC,MAAMC,EAAa,CACjB,KAAML,EACN,MAAOC,EACP,WAAYC,EACZ,cAAeC,EACf,YAAaC,CACf,EAEA,IAAOE,EAAQD",
|
|
6
|
+
"names": ["SceneShelfRoot", "SceneShelfScene", "SceneShelfSceneImage", "SceneShelfProductsPanel", "SceneProductCard", "SceneShelf", "SceneShelf_default"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 产品卡片语义化名称
|
|
3
|
+
*/
|
|
4
|
+
export type SceneProductCardSemanticName = 'card' | 'cardSelected' | 'tags' | 'checkbox' | 'image' | 'title' | 'priceWrapper' | 'currentPrice' | 'originalPrice';
|
|
5
|
+
/**
|
|
6
|
+
* SceneShelf 语义化类名
|
|
7
|
+
*/
|
|
8
|
+
export type SceneShelfSemanticName = 'root' | 'header' | 'title' | 'subtitle' | 'sceneList' | 'scene' | 'sceneImage' | 'content' | 'productList' | 'footer' | 'totalPrice' | 'currentTotalPrice' | 'originalTotalPrice' | 'buttonGroup' | SceneProductCardSemanticName;
|
|
9
|
+
/**
|
|
10
|
+
* 产品标签数据
|
|
11
|
+
*/
|
|
12
|
+
export interface ProductTag {
|
|
13
|
+
/** 标签文本 */
|
|
14
|
+
label: string;
|
|
15
|
+
/** 标签样式变体 */
|
|
16
|
+
variant?: 'outline' | 'fill';
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* 价格数据接口
|
|
20
|
+
*/
|
|
21
|
+
export interface PriceData {
|
|
22
|
+
/** 价格数值 */
|
|
23
|
+
value: number;
|
|
24
|
+
/** 格式化后的价格字符串 */
|
|
25
|
+
formatted: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* 产品卡片数据接口
|
|
29
|
+
*/
|
|
30
|
+
export interface SceneProductCardData {
|
|
31
|
+
/** 产品唯一标识 */
|
|
32
|
+
id: string;
|
|
33
|
+
/** 产品名称 */
|
|
34
|
+
title: string;
|
|
35
|
+
/** 产品图片 URL */
|
|
36
|
+
imageUrl: string;
|
|
37
|
+
/** 产品图片 Alt */
|
|
38
|
+
imageAlt?: string;
|
|
39
|
+
/** 当前价格 */
|
|
40
|
+
currentPrice: PriceData;
|
|
41
|
+
/** 原价(可选,用于显示删除线价格) */
|
|
42
|
+
originalPrice?: PriceData;
|
|
43
|
+
/** 产品标签列表 */
|
|
44
|
+
tags?: ProductTag[];
|
|
45
|
+
/** 是否默认选中 */
|
|
46
|
+
defaultSelected?: boolean;
|
|
47
|
+
/** 产品链接 */
|
|
48
|
+
href?: string;
|
|
49
|
+
/** 是否售罄 */
|
|
50
|
+
soldOut?: boolean;
|
|
51
|
+
}
|
|
@@ -2,12 +2,32 @@ import * as React from 'react';
|
|
|
2
2
|
import type { Media as MediaType, Theme } from '../../types/props.js';
|
|
3
3
|
import type { ButtonProps } from '../../components/button.js';
|
|
4
4
|
export type SecondaryBannerSemanticName = 'root' | 'title' | 'superTitle' | 'subtitle' | 'content' | 'buttonGroup' | 'primaryButton' | 'secondaryButton';
|
|
5
|
+
/**
|
|
6
|
+
* jump.js 配置选项
|
|
7
|
+
*/
|
|
8
|
+
export interface JumpOptions {
|
|
9
|
+
/** 动画持续时间(毫秒) @default 500 */
|
|
10
|
+
duration?: number;
|
|
11
|
+
/** 偏移量(像素) @default 0 */
|
|
12
|
+
offset?: number;
|
|
13
|
+
/** 动画完成回调 */
|
|
14
|
+
callback?: () => void;
|
|
15
|
+
/** 缓动函数 */
|
|
16
|
+
easing?: (t: number, b: number, c: number, d: number) => number;
|
|
17
|
+
/** 是否考虑 a11y @default false */
|
|
18
|
+
a11y?: boolean;
|
|
19
|
+
}
|
|
5
20
|
/**
|
|
6
21
|
* SecondaryBanner 业务组件数据接口
|
|
7
22
|
*/
|
|
8
23
|
export interface SecondaryBannerData {
|
|
9
24
|
/** 主标题*/
|
|
10
25
|
title?: string;
|
|
26
|
+
/**
|
|
27
|
+
* 主标题标签
|
|
28
|
+
* @default 'h1'
|
|
29
|
+
*/
|
|
30
|
+
titleTag?: 'h1' | 'h2';
|
|
11
31
|
/**
|
|
12
32
|
* 上标题/引导标题
|
|
13
33
|
* 通常用于分类、引导性文字
|
|
@@ -61,6 +81,11 @@ export interface SecondaryBannerProps extends React.HTMLAttributes<HTMLElement>
|
|
|
61
81
|
/** 业务数据 */
|
|
62
82
|
data: SecondaryBannerData;
|
|
63
83
|
classNames?: Partial<Record<SecondaryBannerSemanticName, string>>;
|
|
84
|
+
/**
|
|
85
|
+
* 锚点跳转配置(用于 # 开头的链接)
|
|
86
|
+
* @default { duration: 500, offset: 0 }
|
|
87
|
+
*/
|
|
88
|
+
jumpOptions?: JumpOptions;
|
|
64
89
|
}
|
|
65
90
|
/**
|
|
66
91
|
* SecondaryBanner - 次级横幅banner
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as
|
|
1
|
+
"use client";import{jsx as e,jsxs as p}from"react/jsx-runtime";import*as y from"react";import{cva as w}from"class-variance-authority";import x from"jump.js";import{cn as a}from"../../helpers/index.js";import{Text as k,Button as v,Heading as A,Picture as E,Countdown as J}from"../../components/index.js";import R from"../Media/index.js";const V=w("text-info-primary relative w-full",{variants:{size:{sm:"tablet:aspect-[768/480] laptop:aspect-[1024/400] desktop:aspect-[1440/384] lg-desktop:aspect-[1920/480] aspect-[390/480]",base:"tablet:aspect-[768/660] laptop:aspect-[1024/432] desktop:aspect-[1440/576] lg-desktop:aspect-[1920/720] aspect-[390/660]",lg:"tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660]",xlg:"tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660] overflow-visible"}},defaultVariants:{size:"base"}}),B=y.forwardRef(({className:h,classNames:n={},data:t,jumpOptions:T={},...I},M)=>{const{pcImage:N,padImage:z,mobileImage:S,isVideoLoop:C=!1,endDate:u,endDate_tz:D,dateFormat:O,size:c="base",iconArray:d,theme:j="light",primaryButton:o,secondaryButton:s,title:L,titleTag:P="h1"}=t,b={...{duration:500,offset:0},...T},m=y.useId(),l=L?`${m}-title`:void 0,g=t.subtitle?`${m}-subtitle`:void 0,f=t.superTitle?`${m}-super-title`:void 0,H=[f,g].filter(Boolean).join(" ")||void 0;return p("section",{ref:M,role:"banner","aria-labelledby":l,"aria-describedby":H,className:a({"aiui-dark":j==="dark"},V({size:c}),h,n?.root),...I,children:[e(R,{pcImage:N,padImage:z,mobileImage:S,className:a("absolute inset-0 size-full object-cover",{"h-fit":c==="xlg"}),imgClassName:"object-cover",videoClassName:"object-cover",muted:!0,loop:C,playsInline:!0,autoPlay:!0}),p("div",{className:a("banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] absolute top-12 z-10 flex flex-col items-start justify-center px-[16px] text-left",n?.content),children:[p("div",{className:"banner-inner-title desktop:gap-2 flex flex-col items-start gap-1",children:[t.superTitle&&e(k,{as:"p",size:2,id:f,className:a("banner-super-title desktop:text-[16px] lg-desktop:text-[18px]",n?.superTitle),html:t.superTitle}),t.title&&e(A,{as:P,size:["xlg","lg"].includes(c)?5:4,id:l,className:a("banner-title ",n?.title),html:t.title}),t.subtitle&&e(k,{as:"p",size:3,id:g,className:a("banner-subtitle desktop:text-[16px] lg-desktop:text-[18px]",n?.subtitle),html:t.subtitle})]}),u&&e("div",{className:"banner-countdown",children:e(J,{endDate:u,endDate_tz:D,dateFormat:O,variant:"spacious",className:"lg-desktop:mt-8 mt-6"})}),p("div",{className:a("banner-cta-group lg-desktop:mt-[32px] lg-desktop:gap-3 mt-6 flex gap-2",n?.buttonGroup),children:[s?.text&&e(v,{variant:"secondary",onClick:r=>{if(s.link?.startsWith("#")){r.preventDefault();const i=document.querySelector(s.link);i&&x(i,b)}s.onClick?.()},className:a("",n?.secondaryButton),"aria-describedby":l,...s.link&&!s.link.startsWith("#")?{as:"a",href:s.link}:{},children:s.text}),o?.text&&e(v,{onClick:r=>{if(o.link?.startsWith("#")){r.preventDefault();const i=document.querySelector(o.link);i&&x(i,b)}o.onClick?.()},className:a("",n?.primaryButton),"aria-describedby":l,...o.link&&!o.link.startsWith("#")?{as:"a",href:o.link}:{},children:o.text})]}),Array.isArray(d)&&d.length>0&&e("div",{className:"banner-icons desktop:mt-3 lg-desktop:mt-4 mt-2 flex items-center gap-2",role:"group","aria-label":"brand icons",children:d.map((r,i)=>r.pcImage?e(E,{source:r.pcImage.url,alt:r.pcImage.alt||`icon ${i+1}`,role:"img",className:"laptop:h-auto h-[48px] max-w-none",imgClassName:"h-full"},i):null)})]})]})});B.displayName="SecondaryBanner";var K=B;export{K as default};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../../src/biz-components/SecondaryBanner/index.tsx"],
|
|
4
|
-
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cva } from 'class-variance-authority'\nimport { cn } from '../../helpers/index.js'\nimport type { Media as MediaType, Theme } from '../../types/props.js'\nimport { Text, Button, Heading, Picture, Countdown } from '../../components/index.js'\nimport Media from '../Media/index.js'\nimport type { ButtonProps } from '../../components/button.js'\n\nexport type SecondaryBannerSemanticName =\n | 'root'\n | 'title'\n | 'superTitle'\n | 'subtitle'\n | 'content'\n | 'buttonGroup'\n | 'primaryButton'\n | 'secondaryButton'\n\nconst secondaryBannerVariants = cva(\n // \u57FA\u7840\u6837\u5F0F\n 'text-info-primary relative w-full',\n {\n variants: {\n size: {\n sm: 'tablet:aspect-[768/480] laptop:aspect-[1024/400] desktop:aspect-[1440/384] lg-desktop:aspect-[1920/480] aspect-[390/480]',\n base: 'tablet:aspect-[768/660] laptop:aspect-[1024/432] desktop:aspect-[1440/576] lg-desktop:aspect-[1920/720] aspect-[390/660]',\n lg: 'tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660]',\n xlg: 'tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660] overflow-visible',\n },\n },\n defaultVariants: {\n size: 'base',\n },\n }\n)\n\n/**\n * SecondaryBanner \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface SecondaryBannerData {\n /** \u4E3B\u6807\u9898*/\n title?: string\n /**\n * \u4E0A\u6807\u9898/\u5F15\u5BFC\u6807\u9898\n * \u901A\u5E38\u7528\u4E8E\u5206\u7C7B\u3001\u5F15\u5BFC\u6027\u6587\u5B57\n */\n superTitle?: string\n /**\n * \u526F\u6807\u9898/\u63CF\u8FF0\u6587\u5B57\n * \u901A\u5E38\u7528\u4E8E\u8865\u5145\u8BF4\u660E\u3001\u8BE6\u7EC6\u63CF\u8FF0\n */\n subtitle?: string\n /**\n * \u5C3A\u5BF8:\n * sm: \u5C0F\u5C3A\u5BF8\u7528\u4E8E\u7B5B\u9009\u9875\u9762\n * base: \u57FA\u7840\u5C3A\u5BF8\u7528\u4E8E\n * lg: \u5927\u5C3A\u5BF8\u7528\u4E8E\u4E13\u9898\u9875\n * xlg: \u6D3B\u52A8\u9875\uFF08\u901A\u680F\uFF09\n */\n size?: 'sm' | 'base' | 'lg' | 'xlg'\n pcImage?: MediaType\n padImage?: MediaType\n mobileImage?: MediaType\n /** \u89C6\u9891\u662F\u5426\u5FAA\u73AF\u64AD\u653E */\n isVideoLoop?: boolean\n /** \u7ED3\u675F\u65F6\u95F4\uFF08ISO \u5B57\u7B26\u4E32\uFF09 */\n endDate?: string\n /** \u7ED3\u675F\u65F6\u95F4\u65F6\u533A\uFF08\u5982: America/Los_Angeles\uFF09 */\n endDate_tz?: string\n /**\n * \u65F6\u95F4\u683C\u5F0F\u5316\u914D\u7F6E\uFF08JSON \u5B57\u7B26\u4E32\uFF09\n * {\"day\":\"\u65E5\",\"hour\":\"\u65F6\",\"minute\":\"\u5206\",\"second\":\"\u79D2\"}\n */\n dateFormat?: string\n\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: {\n text: string\n link?: string\n onClick?: () => void\n } & Omit<ButtonProps, 'children'>\n /** \u6B21\u7EA7\u6309\u94AE\u914D\u7F6E */\n secondaryButton?: {\n text: string\n link?: string\n onClick?: () => void\n } & Omit<ButtonProps, 'children'>\n\n iconArray?: Array<{ pcImage: MediaType }>\n theme?: Theme\n}\n\nexport interface SecondaryBannerProps extends React.HTMLAttributes<HTMLElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: SecondaryBannerData\n classNames?: Partial<Record<SecondaryBannerSemanticName, string>>\n}\n\n/**\n * SecondaryBanner - \u6B21\u7EA7\u6A2A\u5E45banner\n *\n * @description \u662F\u6307\u7528\u6237\u8FDB\u5165\u4E8C\u7EA7\u9875\u9762\u540E\uFF0C\u65E0\u9700\u6EDA\u52A8\u9875\u9762\u5C31\u80FD\u5728\u7B2C\u4E00\u5C4F\uFF08\u5373\"\u9996\u5C4F\"\uFF09\u770B\u5230\u7684\u3001\u901A\u5E38\u6A2A\u8DE8\u6574\u4E2A\u6D4F\u89C8\u5668\u7A97\u53E3\u5BBD\u5EA6\u7684\u6838\u5FC3\u89C6\u89C9\u533A\u57DF\u3002\n */\nconst SecondaryBanner = React.forwardRef<HTMLElement, SecondaryBannerProps>(\n ({ className, classNames = {}, data, ...props }, ref) => {\n const {\n pcImage,\n padImage,\n mobileImage,\n isVideoLoop = false,\n endDate,\n endDate_tz,\n dateFormat,\n size = 'base',\n iconArray: icons,\n theme = 'light',\n primaryButton,\n secondaryButton,\n } = data\n\n // \u751F\u6210\u552F\u4E00ID\u7528\u4E8E\u53EF\u8BBF\u95EE\u6027\n const bannerId = React.useId()\n const titleId = data.title ? `${bannerId}-title` : undefined\n const subtitleId = data.subtitle ? `${bannerId}-subtitle` : undefined\n const superTitleId = data.superTitle ? `${bannerId}-super-title` : undefined\n\n // \u6784\u5EFAaria-describedby\n const describedBy = [superTitleId, subtitleId].filter(Boolean).join(' ') || undefined\n\n return (\n <section\n ref={ref}\n role=\"banner\"\n aria-labelledby={titleId}\n aria-describedby={describedBy}\n className={cn(\n {\n 'aiui-dark': theme === 'dark',\n },\n secondaryBannerVariants({ size: size }),\n className,\n classNames?.root\n )}\n {...props}\n >\n <Media\n pcImage={pcImage}\n padImage={padImage}\n mobileImage={mobileImage}\n className={cn('absolute inset-0 size-full object-cover', {\n 'h-fit': size === 'xlg',\n })}\n imgClassName=\"object-cover\"\n videoClassName=\"object-cover\"\n muted={true}\n loop={isVideoLoop}\n playsInline={true}\n autoPlay={true}\n />\n <div\n className={cn(\n 'banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] absolute top-12 z-10 flex flex-col items-start justify-center px-[16px] text-left',\n classNames?.content\n )}\n >\n <div className=\"banner-inner-title desktop:gap-2 flex flex-col items-start gap-1\">\n {data.superTitle && (\n <Text\n as=\"p\"\n size={2}\n id={superTitleId}\n className={cn('banner-super-title desktop:text-[16px] lg-desktop:text-[18px]', classNames?.superTitle)}\n html={data.superTitle}\n />\n )}\n\n {data.title && (\n <Heading\n as=\"h1\"\n size={['xlg', 'lg'].includes(size) ? 5 : 4}\n id={titleId}\n className={cn('banner-title ', classNames?.title)}\n html={data.title}\n />\n )}\n\n {data.subtitle && (\n <Text\n as=\"p\"\n size={3}\n id={subtitleId}\n className={cn('banner-subtitle desktop:text-[16px] lg-desktop:text-[18px]', classNames?.subtitle)}\n html={data.subtitle}\n />\n )}\n </div>\n\n {endDate && (\n <div className=\"banner-countdown\">\n <Countdown\n endDate={endDate}\n endDate_tz={endDate_tz}\n dateFormat={dateFormat}\n variant=\"spacious\"\n className=\"mt-3\"\n />\n </div>\n )}\n\n <div\n className={cn(\n 'banner-cta-group lg-desktop:mt-[32px] lg-desktop:gap-3 mt-6 flex gap-2',\n classNames?.buttonGroup\n )}\n >\n {secondaryButton?.text && (\n <Button\n variant=\"secondary\"\n onClick={secondaryButton.onClick}\n className={cn('', classNames?.secondaryButton)}\n aria-describedby={titleId}\n {...(secondaryButton.link ? { as: 'a', href: secondaryButton.link } : {})}\n >\n {secondaryButton.text}\n </Button>\n )}\n {primaryButton?.text && (\n <Button\n onClick={primaryButton.onClick}\n className={cn('', classNames?.primaryButton)}\n aria-describedby={titleId}\n {...(primaryButton.link ? { as: 'a', href: primaryButton.link } : {})}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n\n {Array.isArray(icons) && icons.length > 0 && (\n <div\n className=\"banner-icons desktop:mt-3 lg-desktop:mt-4 mt-2 flex items-center gap-2\"\n role=\"group\"\n aria-label=\"brand icons\"\n >\n {icons.map((icon, index) =>\n icon.pcImage ? (\n <Picture\n key={index}\n source={icon.pcImage.url}\n alt={icon.pcImage.alt || `icon ${index + 1}`}\n role=\"img\"\n className=\"h-auto max-w-none\"\n />\n ) : null\n )}\n </div>\n )}\n </div>\n </section>\n )\n }\n)\n\nSecondaryBanner.displayName = 'SecondaryBanner'\nexport default SecondaryBanner\n"],
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "React", "cva", "cn", "Text", "Button", "Heading", "Picture", "Countdown", "Media", "secondaryBannerVariants", "SecondaryBanner", "className", "classNames", "data", "props", "ref", "pcImage", "padImage", "mobileImage", "isVideoLoop", "endDate", "endDate_tz", "dateFormat", "size", "icons", "theme", "primaryButton", "secondaryButton", "bannerId", "titleId", "subtitleId", "superTitleId", "describedBy", "icon", "index", "SecondaryBanner_default"]
|
|
4
|
+
"sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cva } from 'class-variance-authority'\nimport jump from 'jump.js'\nimport { cn } from '../../helpers/index.js'\nimport type { Media as MediaType, Theme } from '../../types/props.js'\nimport { Text, Button, Heading, Picture, Countdown } from '../../components/index.js'\nimport Media from '../Media/index.js'\nimport type { ButtonProps } from '../../components/button.js'\n\nexport type SecondaryBannerSemanticName =\n | 'root'\n | 'title'\n | 'superTitle'\n | 'subtitle'\n | 'content'\n | 'buttonGroup'\n | 'primaryButton'\n | 'secondaryButton'\n\n/**\n * jump.js \u914D\u7F6E\u9009\u9879\n */\nexport interface JumpOptions {\n /** \u52A8\u753B\u6301\u7EED\u65F6\u95F4\uFF08\u6BEB\u79D2\uFF09 @default 500 */\n duration?: number\n /** \u504F\u79FB\u91CF\uFF08\u50CF\u7D20\uFF09 @default 0 */\n offset?: number\n /** \u52A8\u753B\u5B8C\u6210\u56DE\u8C03 */\n callback?: () => void\n /** \u7F13\u52A8\u51FD\u6570 */\n easing?: (t: number, b: number, c: number, d: number) => number\n /** \u662F\u5426\u8003\u8651 a11y @default false */\n a11y?: boolean\n}\n\nconst secondaryBannerVariants = cva(\n // \u57FA\u7840\u6837\u5F0F\n 'text-info-primary relative w-full',\n {\n variants: {\n size: {\n sm: 'tablet:aspect-[768/480] laptop:aspect-[1024/400] desktop:aspect-[1440/384] lg-desktop:aspect-[1920/480] aspect-[390/480]',\n base: 'tablet:aspect-[768/660] laptop:aspect-[1024/432] desktop:aspect-[1440/576] lg-desktop:aspect-[1920/720] aspect-[390/660]',\n lg: 'tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660]',\n xlg: 'tablet:aspect-[768/660] laptop:aspect-[1024/520] desktop:aspect-[1440/700] lg-desktop:aspect-[1920/930] aspect-[390/660] overflow-visible',\n },\n },\n defaultVariants: {\n size: 'base',\n },\n }\n)\n\n/**\n * SecondaryBanner \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface SecondaryBannerData {\n /** \u4E3B\u6807\u9898*/\n title?: string\n /**\n * \u4E3B\u6807\u9898\u6807\u7B7E\n * @default 'h1'\n */\n titleTag?: 'h1' | 'h2'\n /**\n * \u4E0A\u6807\u9898/\u5F15\u5BFC\u6807\u9898\n * \u901A\u5E38\u7528\u4E8E\u5206\u7C7B\u3001\u5F15\u5BFC\u6027\u6587\u5B57\n */\n superTitle?: string\n /**\n * \u526F\u6807\u9898/\u63CF\u8FF0\u6587\u5B57\n * \u901A\u5E38\u7528\u4E8E\u8865\u5145\u8BF4\u660E\u3001\u8BE6\u7EC6\u63CF\u8FF0\n */\n subtitle?: string\n /**\n * \u5C3A\u5BF8:\n * sm: \u5C0F\u5C3A\u5BF8\u7528\u4E8E\u7B5B\u9009\u9875\u9762\n * base: \u57FA\u7840\u5C3A\u5BF8\u7528\u4E8E\n * lg: \u5927\u5C3A\u5BF8\u7528\u4E8E\u4E13\u9898\u9875\n * xlg: \u6D3B\u52A8\u9875\uFF08\u901A\u680F\uFF09\n */\n size?: 'sm' | 'base' | 'lg' | 'xlg'\n pcImage?: MediaType\n padImage?: MediaType\n mobileImage?: MediaType\n /** \u89C6\u9891\u662F\u5426\u5FAA\u73AF\u64AD\u653E */\n isVideoLoop?: boolean\n /** \u7ED3\u675F\u65F6\u95F4\uFF08ISO \u5B57\u7B26\u4E32\uFF09 */\n endDate?: string\n /** \u7ED3\u675F\u65F6\u95F4\u65F6\u533A\uFF08\u5982: America/Los_Angeles\uFF09 */\n endDate_tz?: string\n /**\n * \u65F6\u95F4\u683C\u5F0F\u5316\u914D\u7F6E\uFF08JSON \u5B57\u7B26\u4E32\uFF09\n * {\"day\":\"\u65E5\",\"hour\":\"\u65F6\",\"minute\":\"\u5206\",\"second\":\"\u79D2\"}\n */\n dateFormat?: string\n\n /** \u4E3B\u6309\u94AE\u914D\u7F6E */\n primaryButton?: {\n text: string\n link?: string\n onClick?: () => void\n } & Omit<ButtonProps, 'children'>\n /** \u6B21\u7EA7\u6309\u94AE\u914D\u7F6E */\n secondaryButton?: {\n text: string\n link?: string\n onClick?: () => void\n } & Omit<ButtonProps, 'children'>\n\n iconArray?: Array<{ pcImage: MediaType }>\n theme?: Theme\n}\n\nexport interface SecondaryBannerProps extends React.HTMLAttributes<HTMLElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: SecondaryBannerData\n classNames?: Partial<Record<SecondaryBannerSemanticName, string>>\n /**\n * \u951A\u70B9\u8DF3\u8F6C\u914D\u7F6E\uFF08\u7528\u4E8E # \u5F00\u5934\u7684\u94FE\u63A5\uFF09\n * @default { duration: 500, offset: 0 }\n */\n jumpOptions?: JumpOptions\n}\n\n/**\n * SecondaryBanner - \u6B21\u7EA7\u6A2A\u5E45banner\n *\n * @description \u662F\u6307\u7528\u6237\u8FDB\u5165\u4E8C\u7EA7\u9875\u9762\u540E\uFF0C\u65E0\u9700\u6EDA\u52A8\u9875\u9762\u5C31\u80FD\u5728\u7B2C\u4E00\u5C4F\uFF08\u5373\"\u9996\u5C4F\"\uFF09\u770B\u5230\u7684\u3001\u901A\u5E38\u6A2A\u8DE8\u6574\u4E2A\u6D4F\u89C8\u5668\u7A97\u53E3\u5BBD\u5EA6\u7684\u6838\u5FC3\u89C6\u89C9\u533A\u57DF\u3002\n */\nconst SecondaryBanner = React.forwardRef<HTMLElement, SecondaryBannerProps>(\n ({ className, classNames = {}, data, jumpOptions = {}, ...props }, ref) => {\n const {\n pcImage,\n padImage,\n mobileImage,\n isVideoLoop = false,\n endDate,\n endDate_tz,\n dateFormat,\n size = 'base',\n iconArray: icons,\n theme = 'light',\n primaryButton,\n secondaryButton,\n title,\n titleTag = 'h1',\n } = data\n\n // \u9ED8\u8BA4 jump \u914D\u7F6E\n const defaultJumpOptions: JumpOptions = { duration: 500, offset: 0 }\n const mergedJumpOptions = { ...defaultJumpOptions, ...jumpOptions }\n\n // \u751F\u6210\u552F\u4E00ID\u7528\u4E8E\u53EF\u8BBF\u95EE\u6027\n const bannerId = React.useId()\n const titleId = title ? `${bannerId}-title` : undefined\n const subtitleId = data.subtitle ? `${bannerId}-subtitle` : undefined\n const superTitleId = data.superTitle ? `${bannerId}-super-title` : undefined\n\n // \u6784\u5EFAaria-describedby\n const describedBy = [superTitleId, subtitleId].filter(Boolean).join(' ') || undefined\n\n return (\n <section\n ref={ref}\n role=\"banner\"\n aria-labelledby={titleId}\n aria-describedby={describedBy}\n className={cn(\n {\n 'aiui-dark': theme === 'dark',\n },\n secondaryBannerVariants({ size: size }),\n className,\n classNames?.root\n )}\n {...props}\n >\n <Media\n pcImage={pcImage}\n padImage={padImage}\n mobileImage={mobileImage}\n className={cn('absolute inset-0 size-full object-cover', {\n 'h-fit': size === 'xlg',\n })}\n imgClassName=\"object-cover\"\n videoClassName=\"object-cover\"\n muted={true}\n loop={isVideoLoop}\n playsInline={true}\n autoPlay={true}\n />\n <div\n className={cn(\n 'banner-content laptop:top-1/2 laptop:-translate-y-1/2 tablet:px-[32px] laptop:px-[64px] lg-desktop:px-[calc(50%-832px)] absolute top-12 z-10 flex flex-col items-start justify-center px-[16px] text-left',\n classNames?.content\n )}\n >\n <div className=\"banner-inner-title desktop:gap-2 flex flex-col items-start gap-1\">\n {data.superTitle && (\n <Text\n as=\"p\"\n size={2}\n id={superTitleId}\n className={cn('banner-super-title desktop:text-[16px] lg-desktop:text-[18px]', classNames?.superTitle)}\n html={data.superTitle}\n />\n )}\n\n {data.title && (\n <Heading\n as={titleTag}\n size={['xlg', 'lg'].includes(size) ? 5 : 4}\n id={titleId}\n className={cn('banner-title ', classNames?.title)}\n html={data.title}\n />\n )}\n\n {data.subtitle && (\n <Text\n as=\"p\"\n size={3}\n id={subtitleId}\n className={cn('banner-subtitle desktop:text-[16px] lg-desktop:text-[18px]', classNames?.subtitle)}\n html={data.subtitle}\n />\n )}\n </div>\n\n {endDate && (\n <div className=\"banner-countdown\">\n <Countdown\n endDate={endDate}\n endDate_tz={endDate_tz}\n dateFormat={dateFormat}\n variant=\"spacious\"\n className=\"lg-desktop:mt-8 mt-6\"\n />\n </div>\n )}\n\n <div\n className={cn(\n 'banner-cta-group lg-desktop:mt-[32px] lg-desktop:gap-3 mt-6 flex gap-2',\n classNames?.buttonGroup\n )}\n >\n {secondaryButton?.text && (\n <Button\n variant=\"secondary\"\n onClick={(e: React.MouseEvent<HTMLButtonElement>) => {\n if (secondaryButton.link?.startsWith('#')) {\n e.preventDefault()\n const element = document.querySelector(secondaryButton.link)\n if (element) {\n jump(element as HTMLElement, mergedJumpOptions)\n }\n }\n secondaryButton.onClick?.()\n }}\n className={cn('', classNames?.secondaryButton)}\n aria-describedby={titleId}\n {...(secondaryButton.link && !secondaryButton.link.startsWith('#')\n ? { as: 'a', href: secondaryButton.link }\n : {})}\n >\n {secondaryButton.text}\n </Button>\n )}\n {primaryButton?.text && (\n <Button\n onClick={e => {\n if (primaryButton.link?.startsWith('#')) {\n e.preventDefault()\n const element = document.querySelector(primaryButton.link)\n if (element) {\n jump(element as HTMLElement, mergedJumpOptions)\n }\n }\n primaryButton.onClick?.()\n }}\n className={cn('', classNames?.primaryButton)}\n aria-describedby={titleId}\n {...(primaryButton.link && !primaryButton.link.startsWith('#')\n ? { as: 'a', href: primaryButton.link }\n : {})}\n >\n {primaryButton.text}\n </Button>\n )}\n </div>\n\n {Array.isArray(icons) && icons.length > 0 && (\n <div\n className=\"banner-icons desktop:mt-3 lg-desktop:mt-4 mt-2 flex items-center gap-2\"\n role=\"group\"\n aria-label=\"brand icons\"\n >\n {icons.map((icon, index) =>\n icon.pcImage ? (\n <Picture\n key={index}\n source={icon.pcImage.url}\n alt={icon.pcImage.alt || `icon ${index + 1}`}\n role=\"img\"\n className=\"laptop:h-auto h-[48px] max-w-none\"\n imgClassName=\"h-full\"\n />\n ) : null\n )}\n </div>\n )}\n </div>\n </section>\n )\n }\n)\n\nSecondaryBanner.displayName = 'SecondaryBanner'\nexport default SecondaryBanner\n"],
|
|
5
|
+
"mappings": "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",
|
|
6
|
+
"names": ["jsx", "jsxs", "React", "cva", "jump", "cn", "Text", "Button", "Heading", "Picture", "Countdown", "Media", "secondaryBannerVariants", "SecondaryBanner", "className", "classNames", "data", "jumpOptions", "props", "ref", "pcImage", "padImage", "mobileImage", "isVideoLoop", "endDate", "endDate_tz", "dateFormat", "size", "icons", "theme", "primaryButton", "secondaryButton", "title", "titleTag", "mergedJumpOptions", "bannerId", "titleId", "subtitleId", "superTitleId", "describedBy", "e", "element", "icon", "index", "SecondaryBanner_default"]
|
|
7
7
|
}
|
|
@@ -96,11 +96,17 @@ export { default as SecondaryBanner } from './SecondaryBanner/index.js';
|
|
|
96
96
|
export { default as BuyOneGetOneShelf } from './BuyOneGetOneShelf/index.js';
|
|
97
97
|
export { default as ActiveShelf } from './ActiveShelf/index.js';
|
|
98
98
|
export { default as MediaShelf } from './MediaShelf/index.js';
|
|
99
|
+
export { default as CreditsShelf, CreditsProductCard } from './CreditsShelf/index.js';
|
|
100
|
+
export type { CreditsShelfSemanticName, CreditsProductCardData, CopyConfig as CreditsShelfCopyConfig, ButtonFunctionType as CreditsShelfButtonFunctionType, } from './CreditsShelf/index.js';
|
|
101
|
+
export { default as SceneShelf, SceneProductCard } from './SceneShelf/index.js';
|
|
102
|
+
export type { SceneShelfSemanticName, SceneProductCardData, SceneProductCardSemanticName } from './SceneShelf/index.js';
|
|
99
103
|
export type { CopyConfig as MediaShelfCopyConfig, ButtonFunctionType as MediaShelfButtonFunctionType, } from './MediaShelf/types.js';
|
|
100
104
|
export type { CopyConfig as ActiveShelfCopyConfig, ButtonFunctionType } from './ActiveShelf/types.js';
|
|
101
105
|
export { default as ImageOverlayShelf, type ButtonFunctionType as ImageOverlayShelfButtonFunctionType, } from './ImageOverlayShelf/index.js';
|
|
102
106
|
export { default as MiniCart } from './MiniCart/index.js';
|
|
103
|
-
export type { Cart, CartLineItem, MiniCartData, MiniCartProps } from './MiniCart/index.js';
|
|
107
|
+
export type { Cart, CartLineItem, MiniCartData, MiniCartProps, CircleProgressConfig } from './MiniCart/index.js';
|
|
108
|
+
export { default as MiniCartCircleProgress } from './MiniCart/CircleProgress.js';
|
|
109
|
+
export type { CircleProgressProps as MiniCartCircleProgressProps } from './MiniCart/CircleProgress.js';
|
|
104
110
|
export { default as MiniCartDialog, MiniCartDialog as MiniCartDialogComponent } from './MiniCart/MiniCartDialog.js';
|
|
105
111
|
export type { MiniCartDialogProps, MiniCartDialogCopy, MiniCartDialogSemanticName, CartData, } from './MiniCart/MiniCartDialog.js';
|
|
106
112
|
/**
|