@anker-in/headless-ui 1.1.34-alpha.1768461697532 → 1.1.34-alpha.1768470531746

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.
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var F=Object.create;var S=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var s in t)S(e,s,{get:t[s],enumerable:!0})},C=(e,t,s,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of R(t))!H.call(e,n)&&n!==s&&S(e,n,{get:()=>t[n],enumerable:!(c=z(t,n))||c.enumerable});return e};var A=(e,t,s)=>(s=e!=null?F(j(e)):{},C(t||!e||!e.__esModule?S(s,"default",{value:e,enumerable:!0}):s,e)),O=e=>C(S({},"__esModule",{value:!0}),e);var Y={};$(Y,{default:()=>X});module.exports=O(Y);var a=require("react/jsx-runtime"),l=A(require("react")),p=require("../../helpers/index.js"),v=require("../../components/index.js"),f=require("swiper/react"),b=A(require("dayjs")),h=require("class-variance-authority");const q=(e,t)=>{const s=(0,b.default)(),c=(0,b.default)(e).startOf("day"),n=(0,b.default)(t).endOf("day");return s.isAfter(c)&&s.isBefore(n)},w=e=>q(e.startDate,e.endDate),G=(0,h.cva)("h-2 w-full overflow-hidden",{variants:{state:{"active-light":"bg-[#F6CD4E]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#75787F]"}},defaultVariants:{state:"inactive-light"}}),J=(0,h.cva)("size-4 rounded-full transition-colors",{variants:{state:{"active-light":"bg-[#F6CD4E]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#75787F]"}},defaultVariants:{state:"inactive-light"}}),I=(0,h.cva)("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-[#080A0F]","inactive-light":"text-[#4A4C56]","active-dark":"text-white","inactive-dark":"text-[#8A8D92]"}},defaultVariants:{state:"inactive-light"}}),K=(0,h.cva)("laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden",{variants:{state:{"active-light":"bg-[#F4E8BC]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#1E2024]"}},defaultVariants:{state:"inactive-light"}}),Q=({active:e,theme:t="light",className:s,index:c,nodeLength:n})=>{const o=`${e?"active":"inactive"}-${t}`,r=c===0,d=c===n-1;return(0,a.jsxs)("div",{className:"relative my-1 flex h-2 w-full items-center justify-center",children:[(0,a.jsx)("div",{className:(0,p.cn)(G({state:o}),r&&"rounded-l-full",d&&"rounded-r-full",s)}),(0,a.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:(0,a.jsx)("div",{className:J({state:o})})})]})},U=(e,t)=>{if(e)return t?e.active:e.inactive},W=({active:e,item:t,theme:s="light",className:c})=>{const n=l.useMemo(()=>U(t.icon,e),[t.icon,e]),o=`${e?"active":"inactive"}-${s}`;return(0,a.jsxs)("div",{className:(0,p.cn)(K({state:o}),c),children:[n&&(0,a.jsx)("div",{className:"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]",children:(0,a.jsx)(v.Picture,{source:n.url,alt:n.alt,className:"aspect-square"})}),(0,a.jsxs)("div",{className:"tablet:px-4 tablet:py-3 laptop:p-4 desktop:px-6 relative z-20 flex h-full flex-col justify-between px-6 py-4",children:[(0,a.jsx)(v.Heading,{html:t.title,className:(0,p.cn)("desktop:text-[32px] laptop:text-[24px] line-clamp-1 text-[20px]",I({state:o}))}),(0,a.jsx)("div",{className:"flex flex-col gap-0.5",children:t.items.map((r,d)=>(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[r.icon&&(0,a.jsx)("div",{className:"desktop:size-6 size-5 shrink-0",children:(0,a.jsx)(v.Picture,{source:r.icon.url,alt:r.icon.alt,className:"size-full"})}),(0,a.jsx)(v.Text,{html:r.label,className:(0,p.cn)("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]",I({state:o}))})]},d))})]})]})},V=l.forwardRef(({classNames:e={},data:t},s)=>{const c=t.theme||"light",n=l.useRef(null),o=l.useRef(null),r=l.useRef(!1),d=l.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),g=l.useMemo(()=>t.scheduleList.findIndex(i=>w(i)),[t.scheduleList]),x=l.useCallback((i,m=!1)=>{const u=P=>{switch(P){case"mobile":return{slidesPerView:1.17};case"tablet":return i===2?{slidesPerView:2}:{slidesPerView:2.4};case"laptop":return i===2?{}:i===4?{slidesPerView:3.2}:{slidesPerView:i};case"desktop":return i===2?{slidesPerView:2}:{slidesPerView:i}}},N=u("mobile"),E=u("tablet"),T=u("laptop"),y=u("desktop");return m?{0:{...N,spaceBetween:12},768:{...E,spaceBetween:i===1?12:void 0},1024:{...T,spaceBetween:16},1440:{...y,spaceBetween:16}}:{0:N,768:E,1024:T,1440:y}},[]),D=l.useMemo(()=>x(d,!0),[d,x]),L=l.useMemo(()=>x(d,!1),[d,x]),k=t.showTimeline!==!1,M=l.useCallback(i=>{r.current||!o.current||(r.current=!0,o.current.slideTo(i.activeIndex,i.params.speed),setTimeout(()=>{r.current=!1},50))},[]),B=l.useCallback(i=>{r.current||!n.current||(r.current=!0,n.current.slideTo(i.activeIndex,i.params.speed),setTimeout(()=>{r.current=!1},50))},[]);return l.useEffect(()=>{n.current&&o.current&&g>=0&&setTimeout(()=>{r.current=!0,n.current?.slideTo(g,500),o.current?.slideTo(g,500),setTimeout(()=>{r.current=!1},600)},100)},[g]),(0,a.jsxs)("div",{ref:s,className:(0,p.cn)("tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] overflow-hidden px-4",e?.root),children:[k&&(0,a.jsx)(f.Swiper,{breakpoints:L,className:"h-4 w-full !overflow-visible",onSwiper:i=>{o.current=i},onSlideChange:B,children:t.scheduleList.map((i,m)=>{const u=w(i);return(0,a.jsx)(f.SwiperSlide,{className:"",children:(0,a.jsx)(Q,{className:e?.timeline,active:u,theme:c,index:m,nodeLength:t.scheduleList.length})},"timelineNode"+m)})}),(0,a.jsx)(f.Swiper,{breakpoints:D,className:"w-full !overflow-visible",onSwiper:i=>{n.current=i},onSlideChange:M,children:t.scheduleList.map((i,m)=>{const u=w(i);return(0,a.jsx)(f.SwiperSlide,{children:(0,a.jsx)(W,{active:u,className:(0,p.cn)(k?"laptop:mt-4 mt-2":"",e?.eventScheduleCard),item:i,theme:c})},"SwiperSlideItem"+m)})})]})});V.displayName="EventSchedule";var X=V;
1
+ "use strict";"use client";var F=Object.create;var S=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var R=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,H=Object.prototype.hasOwnProperty;var $=(e,t)=>{for(var a in t)S(e,a,{get:t[a],enumerable:!0})},y=(e,t,a,c)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of R(t))!H.call(e,s)&&s!==a&&S(e,s,{get:()=>t[s],enumerable:!(c=z(t,s))||c.enumerable});return e};var A=(e,t,a)=>(a=e!=null?F(j(e)):{},y(t||!e||!e.__esModule?S(a,"default",{value:e,enumerable:!0}):a,e)),O=e=>y(S({},"__esModule",{value:!0}),e);var Y={};$(Y,{default:()=>X});module.exports=O(Y);var n=require("react/jsx-runtime"),l=A(require("react")),p=require("../../helpers/index.js"),v=require("../../components/index.js"),h=require("swiper/react"),b=A(require("dayjs")),g=require("class-variance-authority");const q=(e,t)=>{const a=(0,b.default)(),c=(0,b.default)(e).startOf("day"),s=(0,b.default)(t).endOf("day");return a.isAfter(c)&&a.isBefore(s)},w=e=>q(e.startDate,e.endDate),G=(0,g.cva)("h-1 w-full overflow-hidden",{variants:{state:{"active-light":"bg-[#F6CD4E]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#75787F]"}},defaultVariants:{state:"inactive-light"}}),J=(0,g.cva)("size-4 rounded-full transition-colors",{variants:{state:{"active-light":"bg-[#F6CD4E]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#75787F]"}},defaultVariants:{state:"inactive-light"}}),I=(0,g.cva)("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-[#080A0F]","inactive-light":"text-[#4A4C56]","active-dark":"text-white","inactive-dark":"text-[#8A8D92]"}},defaultVariants:{state:"inactive-light"}}),K=(0,g.cva)("laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden",{variants:{state:{"active-light":"bg-[#F4E8BC]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#1E2024]"}},defaultVariants:{state:"inactive-light"}}),Q=({active:e,theme:t="light",className:a,index:c,nodeLength:s})=>{const o=`${e?"active":"inactive"}-${t}`,r=c===0,d=c===s-1;return(0,n.jsxs)("div",{className:"relative my-2 flex h-1 w-full items-center justify-center",children:[(0,n.jsx)("div",{className:(0,p.cn)(G({state:o}),r&&"rounded-l-full",d&&"rounded-r-full",a)}),(0,n.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:(0,n.jsx)("div",{className:J({state:o})})})]})},U=(e,t)=>{if(e)return t?e.active:e.inactive},W=({active:e,item:t,theme:a="light",className:c,scheduleCount:s})=>{const o=l.useMemo(()=>U(t.icon,e),[t.icon,e]),r=`${e?"active":"inactive"}-${a}`;return(0,n.jsxs)("div",{className:(0,p.cn)(K({state:r}),c),children:[o&&(0,n.jsx)("div",{className:"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]",children:(0,n.jsx)(v.Picture,{source:o.url,alt:o.alt,className:"aspect-square"})}),(0,n.jsxs)("div",{className:"tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8",children:[(0,n.jsx)(v.Heading,{html:t.title,className:(0,p.cn)(s>=4?"desktop:text-[24px]":"desktop:text-[32px]","laptop:text-[24px] line-clamp-1 text-[20px]",I({state:r}))}),(0,n.jsx)("div",{className:"flex flex-col gap-0.5",children:t.items.map((d,m)=>(0,n.jsxs)("div",{className:"flex items-center gap-2",children:[d.icon&&(0,n.jsx)("div",{className:"desktop:size-6 size-5 shrink-0",children:(0,n.jsx)(v.Picture,{source:d.icon.url,alt:d.icon.alt,className:"size-full"})}),(0,n.jsx)(v.Text,{html:d.label,className:(0,p.cn)("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]",I({state:r}))})]},m))})]})]})},L=l.forwardRef(({classNames:e={},data:t},a)=>{const c=t.theme||"light",s=l.useRef(null),o=l.useRef(null),r=l.useRef(!1),d=l.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),m=l.useMemo(()=>t.scheduleList.findIndex(i=>w(i)),[t.scheduleList]),x=l.useCallback((i,f=!1)=>{const u=P=>{switch(P){case"mobile":return{slidesPerView:1.17};case"tablet":return i===2?{slidesPerView:2}:{slidesPerView:2.4};case"laptop":return i===2?{}:i===4?{slidesPerView:3.2}:{slidesPerView:i};case"desktop":return i===2?{slidesPerView:2}:{slidesPerView:i}}},N=u("mobile"),E=u("tablet"),C=u("laptop"),T=u("desktop");return f?{0:{...N,spaceBetween:12},768:{...E,spaceBetween:i===1?12:void 0},1024:{...C,spaceBetween:16},1440:{...T,spaceBetween:16}}:{0:N,768:E,1024:C,1440:T}},[]),V=l.useMemo(()=>x(d,!0),[d,x]),D=l.useMemo(()=>x(d,!1),[d,x]),k=t.showTimeline!==!1,M=l.useCallback(i=>{r.current||!o.current||(r.current=!0,o.current.slideTo(i.activeIndex,i.params.speed),setTimeout(()=>{r.current=!1},50))},[]),B=l.useCallback(i=>{r.current||!s.current||(r.current=!0,s.current.slideTo(i.activeIndex,i.params.speed),setTimeout(()=>{r.current=!1},50))},[]);return l.useEffect(()=>{s.current&&o.current&&m>=0&&setTimeout(()=>{r.current=!0,s.current?.slideTo(m,500),o.current?.slideTo(m,500),setTimeout(()=>{r.current=!1},600)},100)},[m]),(0,n.jsxs)("div",{ref:a,className:(0,p.cn)("tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] overflow-hidden px-4",e?.root),children:[k&&(0,n.jsx)(h.Swiper,{breakpoints:D,className:"h-4 w-full !overflow-visible",onSwiper:i=>{o.current=i},onSlideChange:B,children:t.scheduleList.map((i,f)=>{const u=w(i);return(0,n.jsx)(h.SwiperSlide,{className:"",children:(0,n.jsx)(Q,{className:e?.timeline,active:u,theme:c,index:f,nodeLength:t.scheduleList.length})},"timelineNode"+f)})}),(0,n.jsx)(h.Swiper,{breakpoints:V,className:"w-full !overflow-visible",onSwiper:i=>{s.current=i},onSlideChange:M,children:t.scheduleList.map((i,f)=>{const u=w(i);return(0,n.jsx)(h.SwiperSlide,{children:(0,n.jsx)(W,{active:u,className:(0,p.cn)(k?"laptop:mt-4 mt-2":"",e?.eventScheduleCard),item:i,theme:c,scheduleCount:t.scheduleList.length})},"SwiperSlideItem"+f)})})]})});L.displayName="EventSchedule";var X=L;
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/EventSchedule/index.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text, Picture, Heading } from '../../components/index.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport type { Swiper as SwiperType } from 'swiper'\nimport dayjs from 'dayjs'\nimport { cva } from 'class-variance-authority'\nimport type { Media } from '../../types/props.js'\nexport type EventScheduleSemanticName = 'root' | 'timeline' | 'eventScheduleCard'\n\n/**\n * \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n */\nexport interface StateIcon {\n /** \u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807 */\n active: Media\n /** \u975E\u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807 */\n inactive: Media\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u9879\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleItem {\n /** \u6807\u9898 */\n title: string\n /** \u5F00\u59CB\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-01'\uFF09 */\n startDate: string\n /** \u7ED3\u675F\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-31'\uFF09 */\n endDate: string\n /**\n * \u5361\u7247\u80CC\u666F\u56FE\u6807\u914D\u7F6E\uFF0C\u72B6\u6001\u5316\u56FE\u6807\uFF08\u5FC5\u987B\u5305\u542B active \u548C inactive\uFF09\n *\n * @example\n * icon: {\n * active: { url: \"https://example.com/active-icon.svg\", alt: \"Active Icon\" },\n * inactive: { url: \"https://example.com/inactive-icon.svg\", alt: \"Inactive Icon\" }\n * }\n */\n icon?: StateIcon\n /** \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */\n items: {\n /** \u56FE\u6807 (SVG \u5B57\u7B26\u4E32\u6216 URL) */\n icon?: Media\n /** \u6587\u672C\u5185\u5BB9 */\n label: string\n }[]\n}\n\n/**\n * EventSchedule \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleData {\n /** \u65E5\u7A0B\u5217\u8868 */\n scheduleList: EventScheduleItem[]\n /** \u662F\u5426\u663E\u793A\u65F6\u95F4\u8F74\uFF0C\u9ED8\u8BA4\u4E3A true */\n showTimeline?: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n}\n\nexport interface EventScheduleProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: EventScheduleData\n classNames?: Partial<Record<EventScheduleSemanticName, string>>\n}\n\n/**\n * \u5224\u65AD\u5F53\u524D\u65F6\u95F4\u662F\u5426\u5728\u6307\u5B9A\u7684\u65F6\u95F4\u533A\u95F4\u5185\n * @param startDate \u5F00\u59CB\u65E5\u671F\n * @param endDate \u7ED3\u675F\u65E5\u671F\n * @returns \u662F\u5426\u5728\u533A\u95F4\u5185\n */\nconst isInTimeRange = (startDate: string, endDate: string): boolean => {\n const now = dayjs()\n const start = dayjs(startDate).startOf('day')\n const end = dayjs(endDate).endOf('day')\n return now.isAfter(start) && now.isBefore(end)\n}\n\n/**\n * \u83B7\u53D6\u6D3B\u52A8\u9879\u7684\u6FC0\u6D3B\u72B6\u6001\n * @param item \u6D3B\u52A8\u9879\n * @returns \u662F\u5426\u6FC0\u6D3B\n */\nconst getItemActiveStatus = (item: EventScheduleItem): boolean => {\n // \u5426\u5219\u6839\u636E\u65F6\u95F4\u533A\u95F4\u81EA\u52A8\u5224\u65AD\n return isInTimeRange(item.startDate, item.endDate)\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8FDB\u5EA6\u6761\u6FC0\u6D3B\u72B6\u6001\u6837\u5F0F\u53D8\u4F53\n */\nconst timelineProgressActiveVariants = cva('h-2 w-full overflow-hidden', {\n variants: {\n state: {\n 'active-light': 'bg-[#F6CD4E]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#75787F]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u6FC0\u6D3B\u72B6\u6001\u6837\u5F0F\u53D8\u4F53\n */\nconst timelineNodeActiveVariants = cva('size-4 rounded-full transition-colors', {\n variants: {\n state: {\n 'active-light': 'bg-[#F6CD4E]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#75787F]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u5361\u7247\u6587\u672C\u6837\u5F0F\u53D8\u4F53\n */\nconst cardTextVariants = cva('font-bold leading-[1.2]', {\n variants: {\n state: {\n 'active-light': 'text-[#080A0F]',\n 'inactive-light': 'text-[#4A4C56]',\n 'active-dark': 'text-white',\n 'inactive-dark': 'text-[#8A8D92]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u5361\u7247\u5BB9\u5668\u6837\u5F0F\u53D8\u4F53\n */\nconst eventScheduleCardVariants = cva(\n 'laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden',\n {\n variants: {\n state: {\n 'active-light': 'bg-[#F4E8BC]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#1E2024]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n }\n)\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6 Props\n */\ninterface TimelineNodeProps {\n /** \u662F\u5426\u6FC0\u6D3B\u72B6\u6001 */\n active: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n /** \u5F53\u524D\u8282\u70B9\u7D22\u5F15 */\n index: number\n /** \u8282\u70B9\u603B\u6570 */\n nodeLength: number\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6\n */\nconst TimelineNode = ({ active, theme = 'light', className, index, nodeLength }: TimelineNodeProps) => {\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const state = `${active ? 'active' : 'inactive'}-${theme}` as\n | 'active-light'\n | 'inactive-light'\n | 'active-dark'\n | 'inactive-dark'\n\n // \u5224\u65AD\u9996\u5C3E\u4F4D\u7F6E\n const isFirst = index === 0\n const isLast = index === nodeLength - 1\n\n return (\n <div className=\"relative my-1 flex h-2 w-full items-center justify-center\">\n {/* \u8FDB\u5EA6\u6761\u80CC\u666F */}\n <div\n className={cn(\n timelineProgressActiveVariants({ state }),\n isFirst && 'rounded-l-full',\n isLast && 'rounded-r-full',\n className\n )}\n />\n {/* \u65F6\u95F4\u8282\u70B9\u5706\u70B9 */}\n <div className=\"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\">\n <div className={timelineNodeActiveVariants({ state })} />\n </div>\n </div>\n )\n}\n\n/**\n * \u6839\u636E\u6FC0\u6D3B\u72B6\u6001\u83B7\u53D6\u5BF9\u5E94\u7684\u56FE\u6807\n * @param icon \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n * @param isActive \u662F\u5426\u6FC0\u6D3B\u72B6\u6001\n * @returns \u56FE\u6807 Media \u5BF9\u8C61\n */\nconst getIconByState = (icon: StateIcon | undefined, isActive: boolean): Media | undefined => {\n if (!icon) return undefined\n return isActive ? icon.active : icon.inactive\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u5361\u7247\u7EC4\u4EF6\n */\nconst EventScheduleCard = ({\n active,\n item,\n theme = 'light',\n className,\n}: {\n active: boolean\n item: EventScheduleItem\n theme?: 'light' | 'dark'\n className?: string\n}) => {\n const currentIcon = React.useMemo(() => {\n return getIconByState(item.icon, active)\n }, [item.icon, active])\n\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const cardState = `${active ? 'active' : 'inactive'}-${theme}` as\n | 'active-light'\n | 'inactive-light'\n | 'active-dark'\n | 'inactive-dark'\n\n return (\n <div className={cn(eventScheduleCardVariants({ state: cardState }), className)}>\n {/* \u80CC\u666F\u56FE\u6807 */}\n {currentIcon && (\n <div className=\"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]\">\n <Picture source={currentIcon.url} alt={currentIcon.alt} className=\"aspect-square\" />\n </div>\n )}\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"tablet:px-4 tablet:py-3 laptop:p-4 desktop:px-6 relative z-20 flex h-full flex-col justify-between px-6 py-4\">\n <Heading\n html={item.title}\n className={cn(\n 'desktop:text-[32px] laptop:text-[24px] line-clamp-1 text-[20px]',\n cardTextVariants({ state: cardState })\n )}\n />\n {/* \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */}\n <div className=\"flex flex-col gap-0.5\">\n {item.items.map((detail, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n {/* \u56FE\u6807 */}\n {detail.icon && (\n <div className=\"desktop:size-6 size-5 shrink-0\">\n <Picture source={detail.icon.url} alt={detail.icon.alt} className=\"size-full\" />\n </div>\n )}\n {/* \u6587\u672C */}\n <Text\n html={detail.label}\n className={cn(\n 'lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]',\n cardTextVariants({ state: cardState })\n )}\n />\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * EventSchedule - \u6D3B\u52A8\u65E5\u7A0B\u7EC4\u4EF6\n *\n * @description \u663E\u793A\u6D3B\u52A8\u65E5\u7A0B\u65F6\u95F4\u8F74\u548C\u6D3B\u52A8\u5361\u7247\u5217\u8868\n */\nconst EventSchedule = React.forwardRef<HTMLDivElement, EventScheduleProps>(({ classNames = {}, data }, ref) => {\n const theme = data.theme || 'light'\n const swiperRef = React.useRef<SwiperType | null>(null)\n const timelineSwiperRef = React.useRef<SwiperType | null>(null)\n const isSyncingRef = React.useRef(false) // \u9632\u6B62\u5FAA\u73AF\u89E6\u53D1\n const itemsPerRow = React.useMemo(() => {\n return data?.scheduleList?.length || 2\n }, [data?.scheduleList])\n\n // \u8BA1\u7B97 active item \u7684\u7D22\u5F15\n const activeIndex = React.useMemo(() => {\n return data.scheduleList.findIndex(item => getItemActiveStatus(item))\n }, [data.scheduleList])\n\n /**\n * \u751F\u6210\u7EDF\u4E00\u7684 Swiper \u65AD\u70B9\u914D\u7F6E\n * @param itemsPerRow \u6BCF\u884C\u663E\u793A\u7684\u9879\u76EE\u6570\n * @param withSpaceBetween \u662F\u5426\u5305\u542B\u95F4\u8DDD\u914D\u7F6E\n * @returns Swiper \u65AD\u70B9\u914D\u7F6E\u5BF9\u8C61\n */\n const generateSwiperBreakpoints = React.useCallback((itemsPerRow: number, withSpaceBetween: boolean = false) => {\n // \u6839\u636E itemsPerRow \u786E\u5B9A\u4E0D\u540C\u65AD\u70B9\u4E0B\u7684 slidesPerView\n const getBreakpointConfig = (breakpoint: 'mobile' | 'tablet' | 'laptop' | 'desktop') => {\n switch (breakpoint) {\n case 'mobile':\n return { slidesPerView: 1.17 }\n case 'tablet':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: 2.4 }\n case 'laptop':\n if (itemsPerRow === 2) return {}\n if (itemsPerRow === 4) return { slidesPerView: 3.2 }\n return { slidesPerView: itemsPerRow }\n case 'desktop':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: itemsPerRow }\n }\n }\n\n const mobileConfig = getBreakpointConfig('mobile')\n const tabletConfig = getBreakpointConfig('tablet')\n const laptopConfig = getBreakpointConfig('laptop')\n const desktopConfig = getBreakpointConfig('desktop')\n\n // \u5982\u679C\u9700\u8981 spaceBetween\uFF0C\u5219\u6DFB\u52A0\u5230\u914D\u7F6E\u4E2D\n if (withSpaceBetween) {\n return {\n 0: { ...mobileConfig, spaceBetween: 12 },\n 768: { ...tabletConfig, spaceBetween: itemsPerRow === 1 ? 12 : undefined },\n 1024: { ...laptopConfig, spaceBetween: 16 },\n 1440: { ...desktopConfig, spaceBetween: 16 },\n }\n }\n\n return {\n 0: mobileConfig,\n 768: tabletConfig,\n 1024: laptopConfig,\n 1440: desktopConfig,\n }\n }, [])\n\n // \u6839\u636E itemsPerRow \u914D\u7F6E\u54CD\u5E94\u5F0F\u65AD\u70B9\uFF08\u5361\u7247 Swiper - \u5305\u542B\u95F4\u8DDD\uFF09\n const swiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, true)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n // \u65F6\u95F4\u8F74 Swiper \u65AD\u70B9\u914D\u7F6E\uFF08\u4E0D\u5305\u542B\u95F4\u8DDD\uFF09\n const timeNodeSwiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, false)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n const showTimeline = data.showTimeline !== false // \u9ED8\u8BA4\u4E3A true\n\n // \u540C\u6B65\u4E24\u4E2A Swiper \u7684\u6ED1\u52A8\n const handleCardSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !timelineSwiperRef.current) return\n isSyncingRef.current = true\n timelineSwiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n const handleTimelineSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !swiperRef.current) return\n isSyncingRef.current = true\n swiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n // \u81EA\u52A8\u6EDA\u52A8\u5230 active item\n React.useEffect(() => {\n if (swiperRef.current && timelineSwiperRef.current && activeIndex >= 0) {\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u786E\u4FDD Swiper \u5DF2\u7ECF\u5B8C\u5168\u521D\u59CB\u5316\n setTimeout(() => {\n isSyncingRef.current = true\n swiperRef.current?.slideTo(activeIndex, 500)\n timelineSwiperRef.current?.slideTo(activeIndex, 500)\n setTimeout(() => {\n isSyncingRef.current = false\n }, 600)\n }, 100)\n }\n }, [activeIndex])\n\n return (\n <div\n ref={ref}\n className={cn(\n 'tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] overflow-hidden px-4',\n classNames?.root\n )}\n >\n {showTimeline && (\n <Swiper\n breakpoints={timeNodeSwiperBreakpoints}\n className=\"h-4 w-full !overflow-visible\"\n onSwiper={swiper => {\n timelineSwiperRef.current = swiper\n }}\n onSlideChange={handleTimelineSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const isActive = getItemActiveStatus(item)\n return (\n <SwiperSlide key={'timelineNode' + index} className=\"\">\n <TimelineNode\n className={classNames?.timeline}\n active={isActive}\n theme={theme}\n index={index}\n nodeLength={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n )}\n <Swiper\n breakpoints={swiperBreakpoints}\n className=\"w-full !overflow-visible\"\n onSwiper={swiper => {\n swiperRef.current = swiper\n }}\n onSlideChange={handleCardSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const isActive = getItemActiveStatus(item)\n return (\n <SwiperSlide key={'SwiperSlideItem' + index}>\n <EventScheduleCard\n active={isActive}\n className={cn(showTimeline ? 'laptop:mt-4 mt-2' : '', classNames?.eventScheduleCard)}\n item={item}\n theme={theme}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n </div>\n )\n})\n\nEventSchedule.displayName = 'EventSchedule'\nexport default EventSchedule\n\n// \u5BFC\u51FA\u7C7B\u578B\u4F9B\u5916\u90E8\u4F7F\u7528\n// export type { StateIcon, EventScheduleItem, EventScheduleData, EventScheduleProps }\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmMI,IAAAI,EAAA,6BAjMJC,EAAuB,oBACvBC,EAAmB,kCACnBC,EAAuC,qCACvCC,EAAoC,wBAEpCC,EAAkB,oBAClBC,EAAoB,oCAmEpB,MAAMC,EAAgB,CAACC,EAAmBC,IA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GAClD,mBAACK,EAAA,CACC,UAAWiB,GAAY,SACvB,OAAQN,EACR,MAAOT,EACP,MAAOE,EACP,WAAYc,EAAK,aAAa,OAChC,GAPgB,eAAiBd,CAQnC,CAEJ,CAAC,EACH,KAEF,OAAC,UACC,YAAa6B,EACb,UAAU,2BACV,SAAUI,GAAU,CAClBjB,EAAU,QAAUiB,CACtB,EACA,cAAeD,EAEd,SAAAlB,EAAK,aAAa,IAAI,CAACvB,EAAMS,IAAU,CACtC,MAAMO,EAAWjB,EAAoBC,CAAI,EACzC,SACE,OAAC,eACC,mBAACiB,EAAA,CACC,OAAQD,EACR,aAAW,MAAGwB,EAAe,mBAAqB,GAAIlB,GAAY,iBAAiB,EACnF,KAAMtB,EACN,MAAOO,EACT,GANgB,kBAAoBE,CAOtC,CAEJ,CAAC,EACH,GACF,CAEJ,CAAC,EAEDY,EAAc,YAAc,gBAC5B,IAAOtC,EAAQsC",
6
- "names": ["EventSchedule_exports", "__export", "EventSchedule_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_components", "import_react", "import_dayjs", "import_class_variance_authority", "isInTimeRange", "startDate", "endDate", "now", "dayjs", "start", "end", "getItemActiveStatus", "item", "timelineProgressActiveVariants", "timelineNodeActiveVariants", "cardTextVariants", "eventScheduleCardVariants", "TimelineNode", "active", "theme", "className", "index", "nodeLength", "state", "isFirst", "isLast", "getIconByState", "icon", "isActive", "EventScheduleCard", "currentIcon", "cardState", "detail", "EventSchedule", "classNames", "data", "ref", "swiperRef", "timelineSwiperRef", "isSyncingRef", "itemsPerRow", "activeIndex", "generateSwiperBreakpoints", "withSpaceBetween", "getBreakpointConfig", "breakpoint", "mobileConfig", "tabletConfig", "laptopConfig", "desktopConfig", "swiperBreakpoints", "timeNodeSwiperBreakpoints", "showTimeline", "handleCardSwiperSlideChange", "swiper", "handleTimelineSwiperSlideChange"]
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text, Picture, Heading } from '../../components/index.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport type { Swiper as SwiperType } from 'swiper'\nimport dayjs from 'dayjs'\nimport { cva } from 'class-variance-authority'\nimport type { Media } from '../../types/props.js'\nexport type EventScheduleSemanticName = 'root' | 'timeline' | 'eventScheduleCard'\n\n/**\n * \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n */\nexport interface StateIcon {\n /** \u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807 */\n active: Media\n /** \u975E\u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807 */\n inactive: Media\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u9879\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleItem {\n /** \u6807\u9898 */\n title: string\n /** \u5F00\u59CB\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-01'\uFF09 */\n startDate: string\n /** \u7ED3\u675F\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-31'\uFF09 */\n endDate: string\n /**\n * \u5361\u7247\u80CC\u666F\u56FE\u6807\u914D\u7F6E\uFF0C\u72B6\u6001\u5316\u56FE\u6807\uFF08\u5FC5\u987B\u5305\u542B active \u548C inactive\uFF09\n *\n * @example\n * icon: {\n * active: { url: \"https://example.com/active-icon.svg\", alt: \"Active Icon\" },\n * inactive: { url: \"https://example.com/inactive-icon.svg\", alt: \"Inactive Icon\" }\n * }\n */\n icon?: StateIcon\n /** \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */\n items: {\n /** \u56FE\u6807 (SVG \u5B57\u7B26\u4E32\u6216 URL) */\n icon?: Media\n /** \u6587\u672C\u5185\u5BB9 */\n label: string\n }[]\n}\n\n/**\n * EventSchedule \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleData {\n /** \u65E5\u7A0B\u5217\u8868 */\n scheduleList: EventScheduleItem[]\n /** \u662F\u5426\u663E\u793A\u65F6\u95F4\u8F74\uFF0C\u9ED8\u8BA4\u4E3A true */\n showTimeline?: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n}\n\nexport interface EventScheduleProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: EventScheduleData\n classNames?: Partial<Record<EventScheduleSemanticName, string>>\n}\n\n/**\n * \u5224\u65AD\u5F53\u524D\u65F6\u95F4\u662F\u5426\u5728\u6307\u5B9A\u7684\u65F6\u95F4\u533A\u95F4\u5185\n * @param startDate \u5F00\u59CB\u65E5\u671F\n * @param endDate \u7ED3\u675F\u65E5\u671F\n * @returns \u662F\u5426\u5728\u533A\u95F4\u5185\n */\nconst isInTimeRange = (startDate: string, endDate: string): boolean => {\n const now = dayjs()\n const start = dayjs(startDate).startOf('day')\n const end = dayjs(endDate).endOf('day')\n return now.isAfter(start) && now.isBefore(end)\n}\n\n/**\n * \u83B7\u53D6\u6D3B\u52A8\u9879\u7684\u6FC0\u6D3B\u72B6\u6001\n * @param item \u6D3B\u52A8\u9879\n * @returns \u662F\u5426\u6FC0\u6D3B\n */\nconst getItemActiveStatus = (item: EventScheduleItem): boolean => {\n // \u5426\u5219\u6839\u636E\u65F6\u95F4\u533A\u95F4\u81EA\u52A8\u5224\u65AD\n return isInTimeRange(item.startDate, item.endDate)\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8FDB\u5EA6\u6761\u6FC0\u6D3B\u72B6\u6001\u6837\u5F0F\u53D8\u4F53\n */\nconst timelineProgressActiveVariants = cva('h-1 w-full overflow-hidden', {\n variants: {\n state: {\n 'active-light': 'bg-[#F6CD4E]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#75787F]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u6FC0\u6D3B\u72B6\u6001\u6837\u5F0F\u53D8\u4F53\n */\nconst timelineNodeActiveVariants = cva('size-4 rounded-full transition-colors', {\n variants: {\n state: {\n 'active-light': 'bg-[#F6CD4E]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#75787F]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u5361\u7247\u6587\u672C\u6837\u5F0F\u53D8\u4F53\n */\nconst cardTextVariants = cva('font-bold leading-[1.2]', {\n variants: {\n state: {\n 'active-light': 'text-[#080A0F]',\n 'inactive-light': 'text-[#4A4C56]',\n 'active-dark': 'text-white',\n 'inactive-dark': 'text-[#8A8D92]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u5361\u7247\u5BB9\u5668\u6837\u5F0F\u53D8\u4F53\n */\nconst eventScheduleCardVariants = cva(\n 'laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden',\n {\n variants: {\n state: {\n 'active-light': 'bg-[#F4E8BC]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#1E2024]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n }\n)\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6 Props\n */\ninterface TimelineNodeProps {\n /** \u662F\u5426\u6FC0\u6D3B\u72B6\u6001 */\n active: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n /** \u5F53\u524D\u8282\u70B9\u7D22\u5F15 */\n index: number\n /** \u8282\u70B9\u603B\u6570 */\n nodeLength: number\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6\n */\nconst TimelineNode = ({ active, theme = 'light', className, index, nodeLength }: TimelineNodeProps) => {\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const state = `${active ? 'active' : 'inactive'}-${theme}` as\n | 'active-light'\n | 'inactive-light'\n | 'active-dark'\n | 'inactive-dark'\n\n // \u5224\u65AD\u9996\u5C3E\u4F4D\u7F6E\n const isFirst = index === 0\n const isLast = index === nodeLength - 1\n\n return (\n <div className=\"relative my-2 flex h-1 w-full items-center justify-center\">\n {/* \u8FDB\u5EA6\u6761\u80CC\u666F */}\n <div\n className={cn(\n timelineProgressActiveVariants({ state }),\n isFirst && 'rounded-l-full',\n isLast && 'rounded-r-full',\n className\n )}\n />\n {/* \u65F6\u95F4\u8282\u70B9\u5706\u70B9 */}\n <div className=\"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\">\n <div className={timelineNodeActiveVariants({ state })} />\n </div>\n </div>\n )\n}\n\n/**\n * \u6839\u636E\u6FC0\u6D3B\u72B6\u6001\u83B7\u53D6\u5BF9\u5E94\u7684\u56FE\u6807\n * @param icon \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n * @param isActive \u662F\u5426\u6FC0\u6D3B\u72B6\u6001\n * @returns \u56FE\u6807 Media \u5BF9\u8C61\n */\nconst getIconByState = (icon: StateIcon | undefined, isActive: boolean): Media | undefined => {\n if (!icon) return undefined\n return isActive ? icon.active : icon.inactive\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u5361\u7247\u7EC4\u4EF6\n */\nconst EventScheduleCard = ({\n active,\n item,\n theme = 'light',\n className,\n scheduleCount,\n}: {\n active: boolean\n item: EventScheduleItem\n theme?: 'light' | 'dark'\n className?: string\n scheduleCount: number\n}) => {\n const currentIcon = React.useMemo(() => {\n return getIconByState(item.icon, active)\n }, [item.icon, active])\n\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const cardState = `${active ? 'active' : 'inactive'}-${theme}` as\n | 'active-light'\n | 'inactive-light'\n | 'active-dark'\n | 'inactive-dark'\n\n return (\n <div className={cn(eventScheduleCardVariants({ state: cardState }), className)}>\n {/* \u80CC\u666F\u56FE\u6807 */}\n {currentIcon && (\n <div className=\"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]\">\n <Picture source={currentIcon.url} alt={currentIcon.alt} className=\"aspect-square\" />\n </div>\n )}\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8\">\n <Heading\n html={item.title}\n className={cn(\n scheduleCount >= 4 ? 'desktop:text-[24px]' : 'desktop:text-[32px]',\n 'laptop:text-[24px] line-clamp-1 text-[20px]',\n cardTextVariants({ state: cardState })\n )}\n />\n {/* \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */}\n <div className=\"flex flex-col gap-0.5\">\n {item.items.map((detail, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n {/* \u56FE\u6807 */}\n {detail.icon && (\n <div className=\"desktop:size-6 size-5 shrink-0\">\n <Picture source={detail.icon.url} alt={detail.icon.alt} className=\"size-full\" />\n </div>\n )}\n {/* \u6587\u672C */}\n <Text\n html={detail.label}\n className={cn(\n 'lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]',\n cardTextVariants({ state: cardState })\n )}\n />\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * EventSchedule - \u6D3B\u52A8\u65E5\u7A0B\u7EC4\u4EF6\n *\n * @description \u663E\u793A\u6D3B\u52A8\u65E5\u7A0B\u65F6\u95F4\u8F74\u548C\u6D3B\u52A8\u5361\u7247\u5217\u8868\n */\nconst EventSchedule = React.forwardRef<HTMLDivElement, EventScheduleProps>(({ classNames = {}, data }, ref) => {\n const theme = data.theme || 'light'\n const swiperRef = React.useRef<SwiperType | null>(null)\n const timelineSwiperRef = React.useRef<SwiperType | null>(null)\n const isSyncingRef = React.useRef(false) // \u9632\u6B62\u5FAA\u73AF\u89E6\u53D1\n const itemsPerRow = React.useMemo(() => {\n return data?.scheduleList?.length || 2\n }, [data?.scheduleList])\n\n // \u8BA1\u7B97 active item \u7684\u7D22\u5F15\n const activeIndex = React.useMemo(() => {\n return data.scheduleList.findIndex(item => getItemActiveStatus(item))\n }, [data.scheduleList])\n\n /**\n * \u751F\u6210\u7EDF\u4E00\u7684 Swiper \u65AD\u70B9\u914D\u7F6E\n * @param itemsPerRow \u6BCF\u884C\u663E\u793A\u7684\u9879\u76EE\u6570\n * @param withSpaceBetween \u662F\u5426\u5305\u542B\u95F4\u8DDD\u914D\u7F6E\n * @returns Swiper \u65AD\u70B9\u914D\u7F6E\u5BF9\u8C61\n */\n const generateSwiperBreakpoints = React.useCallback((itemsPerRow: number, withSpaceBetween: boolean = false) => {\n // \u6839\u636E itemsPerRow \u786E\u5B9A\u4E0D\u540C\u65AD\u70B9\u4E0B\u7684 slidesPerView\n const getBreakpointConfig = (breakpoint: 'mobile' | 'tablet' | 'laptop' | 'desktop') => {\n switch (breakpoint) {\n case 'mobile':\n return { slidesPerView: 1.17 }\n case 'tablet':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: 2.4 }\n case 'laptop':\n if (itemsPerRow === 2) return {}\n if (itemsPerRow === 4) return { slidesPerView: 3.2 }\n return { slidesPerView: itemsPerRow }\n case 'desktop':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: itemsPerRow }\n }\n }\n\n const mobileConfig = getBreakpointConfig('mobile')\n const tabletConfig = getBreakpointConfig('tablet')\n const laptopConfig = getBreakpointConfig('laptop')\n const desktopConfig = getBreakpointConfig('desktop')\n\n // \u5982\u679C\u9700\u8981 spaceBetween\uFF0C\u5219\u6DFB\u52A0\u5230\u914D\u7F6E\u4E2D\n if (withSpaceBetween) {\n return {\n 0: { ...mobileConfig, spaceBetween: 12 },\n 768: { ...tabletConfig, spaceBetween: itemsPerRow === 1 ? 12 : undefined },\n 1024: { ...laptopConfig, spaceBetween: 16 },\n 1440: { ...desktopConfig, spaceBetween: 16 },\n }\n }\n\n return {\n 0: mobileConfig,\n 768: tabletConfig,\n 1024: laptopConfig,\n 1440: desktopConfig,\n }\n }, [])\n\n // \u6839\u636E itemsPerRow \u914D\u7F6E\u54CD\u5E94\u5F0F\u65AD\u70B9\uFF08\u5361\u7247 Swiper - \u5305\u542B\u95F4\u8DDD\uFF09\n const swiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, true)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n // \u65F6\u95F4\u8F74 Swiper \u65AD\u70B9\u914D\u7F6E\uFF08\u4E0D\u5305\u542B\u95F4\u8DDD\uFF09\n const timeNodeSwiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, false)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n const showTimeline = data.showTimeline !== false // \u9ED8\u8BA4\u4E3A true\n\n // \u540C\u6B65\u4E24\u4E2A Swiper \u7684\u6ED1\u52A8\n const handleCardSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !timelineSwiperRef.current) return\n isSyncingRef.current = true\n timelineSwiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n const handleTimelineSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !swiperRef.current) return\n isSyncingRef.current = true\n swiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n // \u81EA\u52A8\u6EDA\u52A8\u5230 active item\n React.useEffect(() => {\n if (swiperRef.current && timelineSwiperRef.current && activeIndex >= 0) {\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u786E\u4FDD Swiper \u5DF2\u7ECF\u5B8C\u5168\u521D\u59CB\u5316\n setTimeout(() => {\n isSyncingRef.current = true\n swiperRef.current?.slideTo(activeIndex, 500)\n timelineSwiperRef.current?.slideTo(activeIndex, 500)\n setTimeout(() => {\n isSyncingRef.current = false\n }, 600)\n }, 100)\n }\n }, [activeIndex])\n\n return (\n <div\n ref={ref}\n className={cn(\n 'tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] overflow-hidden px-4',\n classNames?.root\n )}\n >\n {showTimeline && (\n <Swiper\n breakpoints={timeNodeSwiperBreakpoints}\n className=\"h-4 w-full !overflow-visible\"\n onSwiper={swiper => {\n timelineSwiperRef.current = swiper\n }}\n onSlideChange={handleTimelineSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const isActive = getItemActiveStatus(item)\n return (\n <SwiperSlide key={'timelineNode' + index} className=\"\">\n <TimelineNode\n className={classNames?.timeline}\n active={isActive}\n theme={theme}\n index={index}\n nodeLength={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n )}\n <Swiper\n breakpoints={swiperBreakpoints}\n className=\"w-full !overflow-visible\"\n onSwiper={swiper => {\n swiperRef.current = swiper\n }}\n onSlideChange={handleCardSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const isActive = getItemActiveStatus(item)\n return (\n <SwiperSlide key={'SwiperSlideItem' + index}>\n <EventScheduleCard\n active={isActive}\n className={cn(showTimeline ? 'laptop:mt-4 mt-2' : '', classNames?.eventScheduleCard)}\n item={item}\n theme={theme}\n scheduleCount={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n </div>\n )\n})\n\nEventSchedule.displayName = 'EventSchedule'\nexport default EventSchedule\n\n// \u5BFC\u51FA\u7C7B\u578B\u4F9B\u5916\u90E8\u4F7F\u7528\n// export type { StateIcon, EventScheduleItem, EventScheduleData, EventScheduleProps }\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAmMI,IAAAI,EAAA,6BAjMJC,EAAuB,oBACvBC,EAAmB,kCACnBC,EAAuC,qCACvCC,EAAoC,wBAEpCC,EAAkB,oBAClBC,EAAoB,oCAmEpB,MAAMC,EAAgB,CAACC,EAAmBC,IAA6B,CACrE,MAAMC,KAAM,EAAAC,SAAM,EACZC,KAAQ,EAAAD,SAAMH,CAAS,EAAE,QAAQ,KAAK,EACtCK,KAAM,EAAAF,SAAMF,CAAO,EAAE,MAAM,KAAK,EACtC,OAAOC,EAAI,QAAQE,CAAK,GAAKF,EAAI,SAASG,CAAG,CAC/C,EAOMC,EAAuBC,GAEpBR,EAAcQ,EAAK,UAAWA,EAAK,OAAO,EAM7CC,KAAiC,OAAI,8BAA+B,CACxE,SAAU,CACR,MAAO,CACL,eAAgB,eAChB,iBAAkB,eAClB,cAAe,eACf,gBAAiB,cACnB,CACF,EACA,gBAAiB,CACf,MAAO,gBACT,CACF,CAAC,EAKKC,KAA6B,OAAI,wCAAyC,CAC9E,SAAU,CACR,MAAO,CACL,eAAgB,eAChB,iBAAkB,eAClB,cAAe,eACf,gBAAiB,cACnB,CACF,EACA,gBAAiB,CACf,MAAO,gBACT,CACF,CAAC,EAKKC,KAAmB,OAAI,0BAA2B,CACtD,SAAU,CACR,MAAO,CACL,eAAgB,iBAChB,iBAAkB,iBAClB,cAAe,aACf,gBAAiB,gBACnB,CACF,EACA,gBAAiB,CACf,MAAO,gBACT,CACF,CAAC,EAKKC,KAA4B,OAChC,8GACA,CACE,SAAU,CACR,MAAO,CACL,eAAgB,eAChB,iBAAkB,eAClB,cAAe,eACf,gBAAiB,cACnB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EAAa,GAAG,EAC3CH,EAAkB,SAAS,QAAQG,EAAa,GAAG,EACnD,WAAW,IAAM,CACfF,EAAa,QAAU,EACzB,EAAG,GAAG,CACR,EAAG,GAAG,CAEV,EAAG,CAACE,CAAW,CAAC,KAGd,QAAC,OACC,IAAKL,EACL,aAAW,MACT,8FACAF,GAAY,IACd,EAEC,UAAAkB,MACC,OAAC,UACC,YAAaD,EACb,UAAU,+BACV,SAAUG,GAAU,CAClBhB,EAAkB,QAAUgB,CAC9B,EACA,cAAeC,EAEd,SAAApB,EAAK,aAAa,IAAI,CAACxB,EAAMS,IAAU,CACtC,MAAMO,EAAWjB,EAAoBC,CAAI,EACzC,SACE,OAAC,eAAyC,UAAU,GAClD,mBAACK,EAAA,CACC,UAAWkB,GAAY,SACvB,OAAQP,EACR,MAAOT,EACP,MAAOE,EACP,WAAYe,EAAK,aAAa,OAChC,GAPgB,eAAiBf,CAQnC,CAEJ,CAAC,EACH,KAEF,OAAC,UACC,YAAa8B,EACb,UAAU,2BACV,SAAUI,GAAU,CAClBjB,EAAU,QAAUiB,CACtB,EACA,cAAeD,EAEd,SAAAlB,EAAK,aAAa,IAAI,CAACxB,EAAMS,IAAU,CACtC,MAAMO,EAAWjB,EAAoBC,CAAI,EACzC,SACE,OAAC,eACC,mBAACiB,EAAA,CACC,OAAQD,EACR,aAAW,MAAGyB,EAAe,mBAAqB,GAAIlB,GAAY,iBAAiB,EACnF,KAAMvB,EACN,MAAOO,EACP,cAAeiB,EAAK,aAAa,OACnC,GAPgB,kBAAoBf,CAQtC,CAEJ,CAAC,EACH,GACF,CAEJ,CAAC,EAEDa,EAAc,YAAc,gBAC5B,IAAOvC,EAAQuC",
6
+ "names": ["EventSchedule_exports", "__export", "EventSchedule_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_components", "import_react", "import_dayjs", "import_class_variance_authority", "isInTimeRange", "startDate", "endDate", "now", "dayjs", "start", "end", "getItemActiveStatus", "item", "timelineProgressActiveVariants", "timelineNodeActiveVariants", "cardTextVariants", "eventScheduleCardVariants", "TimelineNode", "active", "theme", "className", "index", "nodeLength", "state", "isFirst", "isLast", "getIconByState", "icon", "isActive", "EventScheduleCard", "scheduleCount", "currentIcon", "cardState", "detail", "EventSchedule", "classNames", "data", "ref", "swiperRef", "timelineSwiperRef", "isSyncingRef", "itemsPerRow", "activeIndex", "generateSwiperBreakpoints", "withSpaceBetween", "getBreakpointConfig", "breakpoint", "mobileConfig", "tabletConfig", "laptopConfig", "desktopConfig", "swiperBreakpoints", "timeNodeSwiperBreakpoints", "showTimeline", "handleCardSwiperSlideChange", "swiper", "handleTimelineSwiperSlideChange"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var M=Object.create;var x=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var N=(t,e)=>{for(var o in e)x(t,o,{get:e[o],enumerable:!0})},g=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of T(e))!F.call(t,r)&&r!==o&&x(t,r,{get:()=>e[r],enumerable:!(a=P(e,r))||a.enumerable});return t};var y=(t,e,o)=>(o=t!=null?M(D(t)):{},g(e||!t||!t.__esModule?x(o,"default",{value:t,enumerable:!0}):o,t)),R=t=>g(x({},"__esModule",{value:!0}),t);var I={};N(I,{default:()=>w});module.exports=R(I);var i=require("react/jsx-runtime"),b=y(require("react")),c=require("../../helpers/index.js"),m=require("../../components/index.js"),v=require("../../shared/Styles.js");const L=t=>{if(!t)return;const{mobile:e,tablet:o,laptop:a,desktop:r,lgDesktop:k}=t,n=[],u=B=>B?.url,p=u(k),l=u(r),s=u(a),d=u(o),f=u(e);return p?n.push(p):l?n.push(l):s?n.push(s):d?n.push(d):f&&n.push(f),l&&p&&n.push(`${l} 1920`),s&&(l||p)&&n.push(`${s} 1440`),d&&(s||l||p)&&n.push(`${d} 1024`),f&&(d||s||l||p)&&n.push(`${f} 768`),n.length>0?n.join(", "):void 0},h=b.forwardRef(({classNames:t,data:e},o)=>{const{backgroundImage:a}=e,r=b.useMemo(()=>L(a),[a]);return(0,i.jsx)("div",{ref:o,className:(0,c.cn)("laptop:h-[192px] lg-desktop:h-[240px] h-[240px]",t?.root),children:(0,i.jsxs)("div",{className:"promotional-bar-content rounded-box relative h-full overflow-hidden",children:[(0,i.jsxs)("div",{className:(0,c.cn)("laptop:px-8 laptop:justify-center lg-desktop:max-w-[620px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4",t?.content),children:[e.contentTitle&&(0,i.jsx)(m.Heading,{className:(0,c.cn)("line-clamp-2 text-[#F5F6F7]",t?.title),html:e.contentTitle,size:3}),e.contentDesc&&(0,i.jsx)("p",{className:(0,c.cn)("laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] text-[#F5F6F7]",t?.description),dangerouslySetInnerHTML:{__html:e.contentDesc}}),(0,i.jsx)("div",{className:"laptop:mt-4 mt-2",children:e.buttonText&&(0,i.jsx)(m.Button,{as:"a",variant:"link",className:(0,c.cn)("!p-0 text-[#F5F6F7]",t?.button),href:e.buttonLink,children:e.buttonText})})]}),(0,i.jsx)(m.Picture,{source:r,className:"absolute inset-0 z-10 ",imgClassName:"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]"})]})})});h.displayName="PromotionalBar";var w=(0,v.withLayout)(h);
1
+ "use strict";"use client";var M=Object.create;var g=Object.defineProperty;var P=Object.getOwnPropertyDescriptor;var T=Object.getOwnPropertyNames;var D=Object.getPrototypeOf,N=Object.prototype.hasOwnProperty;var F=(t,e)=>{for(var o in e)g(t,o,{get:e[o],enumerable:!0})},x=(t,e,o,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let r of T(e))!N.call(t,r)&&r!==o&&g(t,r,{get:()=>e[r],enumerable:!(a=P(e,r))||a.enumerable});return t};var y=(t,e,o)=>(o=t!=null?M(D(t)):{},x(e||!t||!t.__esModule?g(o,"default",{value:t,enumerable:!0}):o,t)),R=t=>x(g({},"__esModule",{value:!0}),t);var I={};F(I,{default:()=>w});module.exports=R(I);var i=require("react/jsx-runtime"),h=y(require("react")),c=require("../../helpers/index.js"),m=require("../../components/index.js"),v=require("../../shared/Styles.js");const L=t=>{if(!t)return;const{mobile:e,tablet:o,laptop:a,desktop:r,lgDesktop:k}=t,n=[],u=B=>B?.url,l=u(k),s=u(r),p=u(a),d=u(o),f=u(e);return l?n.push(l):s?n.push(s):p?n.push(p):d?n.push(d):f&&n.push(f),s&&l&&n.push(`${s} 1920`),p&&(s||l)&&n.push(`${p} 1440`),d&&(p||s||l)&&n.push(`${d} 1024`),f&&(d||p||s||l)&&n.push(`${f} 768`),n.length>0?n.join(", "):void 0},b=h.forwardRef(({classNames:t,data:e},o)=>{const{backgroundImage:a}=e,r=h.useMemo(()=>L(a),[a]);return(0,i.jsx)("div",{ref:o,className:(0,c.cn)("laptop:h-[192px] lg-desktop:h-[240px] h-[240px]",t?.root),children:(0,i.jsxs)("div",{className:"promotional-bar-content rounded-card relative h-full overflow-hidden",children:[(0,i.jsxs)("div",{className:(0,c.cn)("laptop:px-8 laptop:justify-center lg-desktop:max-w-[620px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4",t?.content),children:[e.contentTitle&&(0,i.jsx)(m.Heading,{className:(0,c.cn)("line-clamp-2 text-[#F5F6F7]",t?.title),html:e.contentTitle,size:3}),e.contentDesc&&(0,i.jsx)("p",{className:(0,c.cn)("laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] text-[#F5F6F7]",t?.description),dangerouslySetInnerHTML:{__html:e.contentDesc}}),(0,i.jsx)("div",{className:"laptop:mt-4 mt-2",children:e.buttonText&&(0,i.jsx)(m.Button,{as:"a",variant:"link",className:(0,c.cn)("!p-0 text-[#F5F6F7]",t?.button),href:e.buttonLink,iconClassName:"size-4",children:e.buttonText})})]}),(0,i.jsx)(m.Picture,{source:r,className:"absolute inset-0 z-10 ",imgClassName:"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]"})]})})});b.displayName="PromotionalBar";var w=(0,v.withLayout)(b);
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/PromotionalBar/index.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Heading, Button, Picture } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { Media } from '../../types/props.js'\n\nexport interface PromotionalBarSemanticName {\n root: 'root'\n content: 'content'\n title: 'title'\n description: 'description'\n button: 'button'\n}\n\n/**\n * \u54CD\u5E94\u5F0F\u80CC\u666F\u56FE\u7247\u914D\u7F6E\n */\nexport interface ResponsiveBackgroundImage {\n /** \u79FB\u52A8\u7AEF\u56FE\u7247 (<768px) */\n mobile?: Media\n /** \u5E73\u677F\u56FE\u7247 (768-1440px) */\n tablet?: Media\n /** \u7B14\u8BB0\u672C\u56FE\u7247 (1025-1440px) */\n laptop?: Media\n /** \u684C\u9762\u56FE\u7247 (1441-1920px) */\n desktop?: Media\n /** \u8D85\u5927\u684C\u9762\u56FE\u7247 (\u22651921px) */\n lgDesktop?: Media\n}\n\n/**\n * PromotionalBar \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface PromotionalBarData {\n /** \u7EC4\u4EF6\u5185\u5BB9\u6807\u9898 */\n contentTitle?: string\n /** \u7EC4\u4EF6\u5185\u5BB9\u63CF\u8FF0 */\n contentDesc?: string\n /** \u6309\u94AE\u6587\u672C */\n buttonText?: string\n /** \u6309\u94AE\u94FE\u63A5 */\n buttonLink?: string\n /** \u80CC\u666F\u56FE\u7247 - \u54CD\u5E94\u5F0F\u56FE\u7247\u5BF9\u8C61 */\n backgroundImage?: ResponsiveBackgroundImage\n}\n\nexport interface PromotionalBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: PromotionalBarData\n classNames?: Partial<Record<keyof PromotionalBarSemanticName, string>>\n}\n\n/**\n * \u5C06\u54CD\u5E94\u5F0F\u80CC\u666F\u56FE\u7247\u5BF9\u8C61\u8F6C\u6362\u4E3A Picture \u7EC4\u4EF6\u6240\u9700\u7684\u5B57\u7B26\u4E32\u683C\u5F0F\n */\nconst convertResponsiveImageToString = (backgroundImage: ResponsiveBackgroundImage | undefined): string | undefined => {\n if (!backgroundImage) return undefined\n\n const { mobile, tablet, laptop, desktop, lgDesktop } = backgroundImage\n const parts: string[] = []\n\n // \u8F85\u52A9\u51FD\u6570\uFF1A\u4ECE Media \u5BF9\u8C61\u4E2D\u63D0\u53D6 URL\n const getUrl = (media: Media | undefined): string | undefined => {\n return media?.url\n }\n\n // \u9ED8\u8BA4\u56FE\u7247\uFF08\u6700\u5927\u5C3A\u5BF8\uFF09\u653E\u5728\u6700\u524D\u9762\uFF0C\u4E0D\u9700\u8981\u65AD\u70B9\n const lgDesktopUrl = getUrl(lgDesktop)\n const desktopUrl = getUrl(desktop)\n const laptopUrl = getUrl(laptop)\n const tabletUrl = getUrl(tablet)\n const mobileUrl = getUrl(mobile)\n\n if (lgDesktopUrl) parts.push(lgDesktopUrl)\n else if (desktopUrl) parts.push(desktopUrl)\n else if (laptopUrl) parts.push(laptopUrl)\n else if (tabletUrl) parts.push(tabletUrl)\n else if (mobileUrl) parts.push(mobileUrl)\n\n // \u6309\u65AD\u70B9\u4ECE\u5927\u5230\u5C0F\u6DFB\u52A0\n if (desktopUrl && lgDesktopUrl) parts.push(`${desktopUrl} 1920`)\n if (laptopUrl && (desktopUrl || lgDesktopUrl)) parts.push(`${laptopUrl} 1440`)\n if (tabletUrl && (laptopUrl || desktopUrl || lgDesktopUrl)) parts.push(`${tabletUrl} 1024`)\n if (mobileUrl && (tabletUrl || laptopUrl || desktopUrl || lgDesktopUrl)) parts.push(`${mobileUrl} 768`)\n\n return parts.length > 0 ? parts.join(', ') : undefined\n}\n\n/**\n * PromotionalBar - \u63A8\u5E7F\u680F\n *\n * @description \u63A8\u5E7F\u680F\n */\nconst PromotionalBar = React.forwardRef<HTMLDivElement, PromotionalBarProps>(({ classNames, data }, ref) => {\n const { backgroundImage } = data\n const pictureSource = React.useMemo(() => {\n return convertResponsiveImageToString(backgroundImage)\n }, [backgroundImage])\n return (\n <div ref={ref} className={cn('laptop:h-[192px] lg-desktop:h-[240px] h-[240px]', classNames?.root)}>\n {/* \u63A8\u5E7F\u680F\u5185\u5BB9\u533A\u57DF - \u6839\u636E\u5177\u4F53\u4E1A\u52A1\u9700\u6C42\u5B9A\u5236 */}\n <div className=\"promotional-bar-content rounded-box relative h-full overflow-hidden\">\n <div\n className={cn(\n 'laptop:px-8 laptop:justify-center lg-desktop:max-w-[620px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4',\n classNames?.content\n )}\n >\n {data.contentTitle && (\n <Heading\n className={cn('line-clamp-2 text-[#F5F6F7]', classNames?.title)}\n html={data.contentTitle}\n size={3}\n />\n )}\n {data.contentDesc && (\n <p\n className={cn(\n 'laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] text-[#F5F6F7]',\n classNames?.description\n )}\n dangerouslySetInnerHTML={{ __html: data.contentDesc }}\n />\n )}\n <div className=\"laptop:mt-4 mt-2\">\n {data.buttonText && (\n <Button\n as=\"a\"\n variant=\"link\"\n className={cn('!p-0 text-[#F5F6F7]', classNames?.button)}\n href={data.buttonLink}\n >\n {data.buttonText}\n </Button>\n )}\n </div>\n </div>\n <Picture\n source={pictureSource}\n className=\"absolute inset-0 z-10 \"\n imgClassName=\"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]\"\n />\n </div>\n </div>\n )\n})\n\nPromotionalBar.displayName = 'PromotionalBar'\nexport default withLayout(PromotionalBar)\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAwGQ,IAAAI,EAAA,6BAtGRC,EAAuB,oBACvBC,EAAmB,kCACnBC,EAAyC,qCACzCC,EAA2B,kCAoD3B,MAAMC,EAAkCC,GAA+E,CACrH,GAAI,CAACA,EAAiB,OAEtB,KAAM,CAAE,OAAAC,EAAQ,OAAAC,EAAQ,OAAAC,EAAQ,QAAAC,EAAS,UAAAC,CAAU,EAAIL,EACjDM,EAAkB,CAAC,EAGnBC,EAAUC,GACPA,GAAO,IAIVC,EAAeF,EAAOF,CAAS,EAC/BK,EAAaH,EAAOH,CAAO,EAC3BO,EAAYJ,EAAOJ,CAAM,EACzBS,EAAYL,EAAOL,CAAM,EACzBW,EAAYN,EAAON,CAAM,EAE/B,OAAIQ,EAAcH,EAAM,KAAKG,CAAY,EAChCC,EAAYJ,EAAM,KAAKI,CAAU,EACjCC,EAAWL,EAAM,KAAKK,CAAS,EAC/BC,EAAWN,EAAM,KAAKM,CAAS,EAC/BC,GAAWP,EAAM,KAAKO,CAAS,EAGpCH,GAAcD,GAAcH,EAAM,KAAK,GAAGI,CAAU,OAAO,EAC3DC,IAAcD,GAAcD,IAAeH,EAAM,KAAK,GAAGK,CAAS,OAAO,EACzEC,IAAcD,GAAaD,GAAcD,IAAeH,EAAM,KAAK,GAAGM,CAAS,OAAO,EACtFC,IAAcD,GAAaD,GAAaD,GAAcD,IAAeH,EAAM,KAAK,GAAGO,CAAS,MAAM,EAE/FP,EAAM,OAAS,EAAIA,EAAM,KAAK,IAAI,EAAI,MAC/C,EAOMQ,EAAiBnB,EAAM,WAAgD,CAAC,CAAE,WAAAoB,EAAY,KAAAC,CAAK,EAAGC,IAAQ,CAC1G,KAAM,CAAE,gBAAAjB,CAAgB,EAAIgB,EACtBE,EAAgBvB,EAAM,QAAQ,IAC3BI,EAA+BC,CAAe,EACpD,CAACA,CAAe,CAAC,EACpB,SACE,OAAC,OAAI,IAAKiB,EAAK,aAAW,MAAG,kDAAmDF,GAAY,IAAI,EAE9F,oBAAC,OAAI,UAAU,sEACb,qBAAC,OACC,aAAW,MACT,mLACAA,GAAY,OACd,EAEC,UAAAC,EAAK,iBACJ,OAAC,WACC,aAAW,MAAG,8BAA+BD,GAAY,KAAK,EAC9D,KAAMC,EAAK,aACX,KAAM,EACR,EAEDA,EAAK,gBACJ,OAAC,KACC,aAAW,MACT,6HACAD,GAAY,WACd,EACA,wBAAyB,CAAE,OAAQC,EAAK,WAAY,EACtD,KAEF,OAAC,OAAI,UAAU,mBACZ,SAAAA,EAAK,eACJ,OAAC,UACC,GAAG,IACH,QAAQ,OACR,aAAW,MAAG,sBAAuBD,GAAY,MAAM,EACvD,KAAMC,EAAK,WAEV,SAAAA,EAAK,WACR,EAEJ,GACF,KACA,OAAC,WACC,OAAQE,EACR,UAAU,yBACV,aAAa,uFACf,GACF,EACF,CAEJ,CAAC,EAEDJ,EAAe,YAAc,iBAC7B,IAAOtB,KAAQ,cAAWsB,CAAc",
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Heading, Button, Picture } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { Media } from '../../types/props.js'\n\nexport interface PromotionalBarSemanticName {\n root: 'root'\n content: 'content'\n title: 'title'\n description: 'description'\n button: 'button'\n}\n\n/**\n * \u54CD\u5E94\u5F0F\u80CC\u666F\u56FE\u7247\u914D\u7F6E\n */\nexport interface ResponsiveBackgroundImage {\n /** \u79FB\u52A8\u7AEF\u56FE\u7247 (<768px) */\n mobile?: Media\n /** \u5E73\u677F\u56FE\u7247 (768-1440px) */\n tablet?: Media\n /** \u7B14\u8BB0\u672C\u56FE\u7247 (1025-1440px) */\n laptop?: Media\n /** \u684C\u9762\u56FE\u7247 (1441-1920px) */\n desktop?: Media\n /** \u8D85\u5927\u684C\u9762\u56FE\u7247 (\u22651921px) */\n lgDesktop?: Media\n}\n\n/**\n * PromotionalBar \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface PromotionalBarData {\n /** \u7EC4\u4EF6\u5185\u5BB9\u6807\u9898 */\n contentTitle?: string\n /** \u7EC4\u4EF6\u5185\u5BB9\u63CF\u8FF0 */\n contentDesc?: string\n /** \u6309\u94AE\u6587\u672C */\n buttonText?: string\n /** \u6309\u94AE\u94FE\u63A5 */\n buttonLink?: string\n /** \u80CC\u666F\u56FE\u7247 - \u54CD\u5E94\u5F0F\u56FE\u7247\u5BF9\u8C61 */\n backgroundImage?: ResponsiveBackgroundImage\n}\n\nexport interface PromotionalBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: PromotionalBarData\n classNames?: Partial<Record<keyof PromotionalBarSemanticName, string>>\n}\n\n/**\n * \u5C06\u54CD\u5E94\u5F0F\u80CC\u666F\u56FE\u7247\u5BF9\u8C61\u8F6C\u6362\u4E3A Picture \u7EC4\u4EF6\u6240\u9700\u7684\u5B57\u7B26\u4E32\u683C\u5F0F\n */\nconst convertResponsiveImageToString = (backgroundImage: ResponsiveBackgroundImage | undefined): string | undefined => {\n if (!backgroundImage) return undefined\n\n const { mobile, tablet, laptop, desktop, lgDesktop } = backgroundImage\n const parts: string[] = []\n\n // \u8F85\u52A9\u51FD\u6570\uFF1A\u4ECE Media \u5BF9\u8C61\u4E2D\u63D0\u53D6 URL\n const getUrl = (media: Media | undefined): string | undefined => {\n return media?.url\n }\n\n // \u9ED8\u8BA4\u56FE\u7247\uFF08\u6700\u5927\u5C3A\u5BF8\uFF09\u653E\u5728\u6700\u524D\u9762\uFF0C\u4E0D\u9700\u8981\u65AD\u70B9\n const lgDesktopUrl = getUrl(lgDesktop)\n const desktopUrl = getUrl(desktop)\n const laptopUrl = getUrl(laptop)\n const tabletUrl = getUrl(tablet)\n const mobileUrl = getUrl(mobile)\n\n if (lgDesktopUrl) parts.push(lgDesktopUrl)\n else if (desktopUrl) parts.push(desktopUrl)\n else if (laptopUrl) parts.push(laptopUrl)\n else if (tabletUrl) parts.push(tabletUrl)\n else if (mobileUrl) parts.push(mobileUrl)\n\n // \u6309\u65AD\u70B9\u4ECE\u5927\u5230\u5C0F\u6DFB\u52A0\n if (desktopUrl && lgDesktopUrl) parts.push(`${desktopUrl} 1920`)\n if (laptopUrl && (desktopUrl || lgDesktopUrl)) parts.push(`${laptopUrl} 1440`)\n if (tabletUrl && (laptopUrl || desktopUrl || lgDesktopUrl)) parts.push(`${tabletUrl} 1024`)\n if (mobileUrl && (tabletUrl || laptopUrl || desktopUrl || lgDesktopUrl)) parts.push(`${mobileUrl} 768`)\n\n return parts.length > 0 ? parts.join(', ') : undefined\n}\n\n/**\n * PromotionalBar - \u63A8\u5E7F\u680F\n *\n * @description \u63A8\u5E7F\u680F\n */\nconst PromotionalBar = React.forwardRef<HTMLDivElement, PromotionalBarProps>(({ classNames, data }, ref) => {\n const { backgroundImage } = data\n const pictureSource = React.useMemo(() => {\n return convertResponsiveImageToString(backgroundImage)\n }, [backgroundImage])\n return (\n <div ref={ref} className={cn('laptop:h-[192px] lg-desktop:h-[240px] h-[240px]', classNames?.root)}>\n {/* \u63A8\u5E7F\u680F\u5185\u5BB9\u533A\u57DF - \u6839\u636E\u5177\u4F53\u4E1A\u52A1\u9700\u6C42\u5B9A\u5236 */}\n <div className=\"promotional-bar-content rounded-card relative h-full overflow-hidden\">\n <div\n className={cn(\n 'laptop:px-8 laptop:justify-center lg-desktop:max-w-[620px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4',\n classNames?.content\n )}\n >\n {data.contentTitle && (\n <Heading\n className={cn('line-clamp-2 text-[#F5F6F7]', classNames?.title)}\n html={data.contentTitle}\n size={3}\n />\n )}\n {data.contentDesc && (\n <p\n className={cn(\n 'laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] text-[#F5F6F7]',\n classNames?.description\n )}\n dangerouslySetInnerHTML={{ __html: data.contentDesc }}\n />\n )}\n <div className=\"laptop:mt-4 mt-2\">\n {data.buttonText && (\n <Button\n as=\"a\"\n variant=\"link\"\n className={cn('!p-0 text-[#F5F6F7]', classNames?.button)}\n href={data.buttonLink}\n iconClassName=\"size-4\"\n >\n {data.buttonText}\n </Button>\n )}\n </div>\n </div>\n <Picture\n source={pictureSource}\n className=\"absolute inset-0 z-10 \"\n imgClassName=\"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]\"\n />\n </div>\n </div>\n )\n})\n\nPromotionalBar.displayName = 'PromotionalBar'\nexport default withLayout(PromotionalBar)\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAwGQ,IAAAI,EAAA,6BAtGRC,EAAuB,oBACvBC,EAAmB,kCACnBC,EAAyC,qCACzCC,EAA2B,kCAoD3B,MAAMC,EAAkCC,GAA+E,CACrH,GAAI,CAACA,EAAiB,OAEtB,KAAM,CAAE,OAAAC,EAAQ,OAAAC,EAAQ,OAAAC,EAAQ,QAAAC,EAAS,UAAAC,CAAU,EAAIL,EACjDM,EAAkB,CAAC,EAGnBC,EAAUC,GACPA,GAAO,IAIVC,EAAeF,EAAOF,CAAS,EAC/BK,EAAaH,EAAOH,CAAO,EAC3BO,EAAYJ,EAAOJ,CAAM,EACzBS,EAAYL,EAAOL,CAAM,EACzBW,EAAYN,EAAON,CAAM,EAE/B,OAAIQ,EAAcH,EAAM,KAAKG,CAAY,EAChCC,EAAYJ,EAAM,KAAKI,CAAU,EACjCC,EAAWL,EAAM,KAAKK,CAAS,EAC/BC,EAAWN,EAAM,KAAKM,CAAS,EAC/B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  "names": ["PromotionalBar_exports", "__export", "PromotionalBar_default", "__toCommonJS", "import_jsx_runtime", "React", "import_helpers", "import_components", "import_Styles", "convertResponsiveImageToString", "backgroundImage", "mobile", "tablet", "laptop", "desktop", "lgDesktop", "parts", "getUrl", "media", "lgDesktopUrl", "desktopUrl", "laptopUrl", "tabletUrl", "mobileUrl", "PromotionalBar", "classNames", "data", "ref", "pictureSource"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var S=Object.create;var p=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var H=(e,t)=>{for(var s in t)p(e,s,{get:t[s],enumerable:!0})},v=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of V(t))!F.call(e,a)&&a!==s&&p(e,a,{get:()=>t[a],enumerable:!(n=D(t,a))||n.enumerable});return e};var w=(e,t,s)=>(s=e!=null?S(j(e)):{},v(t||!e||!e.__esModule?p(s,"default",{value:e,enumerable:!0}):s,e)),I=e=>v(p({},"__esModule",{value:!0}),e);var U={};H(U,{default:()=>P});module.exports=I(U);var o=require("react/jsx-runtime"),i=w(require("react")),b=w(require("dayjs")),h=require("../../helpers/utils.js"),y=require("class-variance-authority");const T=e=>{const t=(0,b.default)(),n=(0,b.default)(e).diff(t,"second");if(n<=0)return{days:0,hours:0,minutes:0,seconds:0};const a=Math.floor(n/(24*60*60)),c=Math.floor(n%(24*60*60)/(60*60)),g=Math.floor(n%(60*60)/60),x=n%60;return{days:a,hours:c,minutes:g,seconds:x}},R=(0,y.cva)("lg-desktop:size-12 lg-desktop:px-1 flex size-10 flex-col items-center justify-center px-[2px] text-center",{variants:{theme:{light:"bg-info-primary",dark:"bg-[#f5f6f7]"}},defaultVariants:{theme:"light"}}),k=(0,y.cva)("",{variants:{theme:{light:"text-white",dark:"text-[#080A0F]"}},defaultVariants:{theme:"light"}}),z=({value:e,label:t,theme:s="light"})=>(0,o.jsxs)("div",{className:R({theme:s}),children:[(0,o.jsx)("p",{className:(0,h.cn)("lg-desktop:text-2xl text-[20px] font-bold leading-[1.2] tracking-[-0.96px]",k({theme:s})),children:String(e).padStart(2,"0")}),(0,o.jsx)("p",{className:(0,h.cn)("text-[12px] font-bold leading-[1.4] tracking-[-0.24px]",k({theme:s})),children:t})]}),E=()=>(0,o.jsx)("p",{className:"lg-desktop:text-2xl text-info-primary text-center text-xl font-bold leading-[1.2] tracking-[-0.96px]",children:":"}),C=i.default.forwardRef(({config:e,className:t,onCountdownEnd:s,theme:n="light"},a)=>{const{targetDate:c,showDays:g=!0,showHours:x=!0,showMinutes:L=!0,showSeconds:N=!0,labels:d={}}=e,[m,M]=(0,i.useState)(()=>T(c));(0,i.useEffect)(()=>{const u=setInterval(()=>{const r=T(c);M(r),r.days===0&&r.hours===0&&r.minutes===0&&r.seconds===0&&(s?.(),clearInterval(u))},1e3);return()=>clearInterval(u)},[c,s]);const f={days:d.days||"Day",hours:d.hours||"Hours",minutes:d.minutes||"Mins",seconds:d.seconds||"Secs"},l=[];return g&&l.push({value:m.days,label:f.days}),x&&l.push({value:m.hours,label:f.hours}),L&&l.push({value:m.minutes,label:f.minutes}),N&&l.push({value:m.seconds,label:f.seconds}),(0,o.jsx)("div",{ref:a,className:(0,h.cn)("flex items-center gap-1",t),children:l.map((u,r)=>(0,o.jsxs)(i.default.Fragment,{children:[(0,o.jsx)(z,{value:u.value,label:u.label,theme:n}),r<l.length-1&&(0,o.jsx)(E,{})]},u.label))})});C.displayName="Countdown";var P=C;
1
+ "use strict";"use client";var S=Object.create;var p=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var V=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,F=Object.prototype.hasOwnProperty;var H=(e,t)=>{for(var s in t)p(e,s,{get:t[s],enumerable:!0})},v=(e,t,s,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let a of V(t))!F.call(e,a)&&a!==s&&p(e,a,{get:()=>t[a],enumerable:!(n=D(t,a))||n.enumerable});return e};var w=(e,t,s)=>(s=e!=null?S(j(e)):{},v(t||!e||!e.__esModule?p(s,"default",{value:e,enumerable:!0}):s,e)),I=e=>v(p({},"__esModule",{value:!0}),e);var U={};H(U,{default:()=>P});module.exports=I(U);var o=require("react/jsx-runtime"),i=w(require("react")),b=w(require("dayjs")),h=require("../../helpers/utils.js"),y=require("class-variance-authority");const T=e=>{const t=(0,b.default)(),n=(0,b.default)(e).diff(t,"second");if(n<=0)return{days:0,hours:0,minutes:0,seconds:0};const a=Math.floor(n/(24*60*60)),c=Math.floor(n%(24*60*60)/(60*60)),g=Math.floor(n%(60*60)/60),x=n%60;return{days:a,hours:c,minutes:g,seconds:x}},R=(0,y.cva)("lg-desktop:size-12 lg-desktop:px-1 flex size-10 flex-col items-center justify-center px-[2px] text-center",{variants:{theme:{light:"bg-info-primary",dark:"bg-[#f5f6f7]"}},defaultVariants:{theme:"light"}}),k=(0,y.cva)("",{variants:{theme:{light:"text-white",dark:"text-[#080A0F]"}},defaultVariants:{theme:"light"}}),z=({value:e,label:t,theme:s="light"})=>(0,o.jsxs)("div",{className:R({theme:s}),children:[(0,o.jsx)("p",{className:(0,h.cn)("lg-desktop:text-2xl text-[20px] font-bold leading-[1.2] tracking-[-0.96px]",k({theme:s})),children:String(e).padStart(2,"0")}),(0,o.jsx)("p",{className:(0,h.cn)("mt-[-6px] text-[12px] font-bold leading-[1.4] tracking-[-0.24px]",k({theme:s})),children:t})]}),E=()=>(0,o.jsx)("p",{className:"lg-desktop:text-2xl text-info-primary text-center text-xl font-bold leading-[1.2] tracking-[-0.96px]",children:":"}),C=i.default.forwardRef(({config:e,className:t,onCountdownEnd:s,theme:n="light"},a)=>{const{targetDate:c,showDays:g=!0,showHours:x=!0,showMinutes:L=!0,showSeconds:N=!0,labels:m={}}=e,[d,M]=(0,i.useState)(()=>T(c));(0,i.useEffect)(()=>{const u=setInterval(()=>{const r=T(c);M(r),r.days===0&&r.hours===0&&r.minutes===0&&r.seconds===0&&(s?.(),clearInterval(u))},1e3);return()=>clearInterval(u)},[c,s]);const f={days:m.days||"Day",hours:m.hours||"Hours",minutes:m.minutes||"Mins",seconds:m.seconds||"Secs"},l=[];return g&&l.push({value:d.days,label:f.days}),x&&l.push({value:d.hours,label:f.hours}),L&&l.push({value:d.minutes,label:f.minutes}),N&&l.push({value:d.seconds,label:f.seconds}),(0,o.jsx)("div",{ref:a,className:(0,h.cn)("flex items-center gap-1",t),children:l.map((u,r)=>(0,o.jsxs)(i.default.Fragment,{children:[(0,o.jsx)(z,{value:u.value,label:u.label,theme:n}),r<l.length-1&&(0,o.jsx)(E,{})]},u.label))})});C.displayName="Countdown";var P=C;
2
2
  //# sourceMappingURL=Countdown.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/Title/Countdown.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useState, useEffect } from 'react'\nimport dayjs from 'dayjs'\nimport { cn } from '../../helpers/utils.js'\nimport { cva } from 'class-variance-authority'\nimport type { CountdownConfig } from './types.js'\nimport type { Theme } from '../../types/props.js'\n\ninterface CountdownProps {\n config: CountdownConfig\n className?: string\n onCountdownEnd?: () => void\n theme?: Theme\n}\n\ninterface TimeLeft {\n days: number\n hours: number\n minutes: number\n seconds: number\n}\n\n/**\n * \u8BA1\u7B97\u5269\u4F59\u65F6\u95F4\n */\nconst calculateTimeLeft = (targetDate: string): TimeLeft => {\n const now = dayjs()\n const target = dayjs(targetDate)\n const diff = target.diff(now, 'second')\n\n if (diff <= 0) {\n return { days: 0, hours: 0, minutes: 0, seconds: 0 }\n }\n\n const days = Math.floor(diff / (24 * 60 * 60))\n const hours = Math.floor((diff % (24 * 60 * 60)) / (60 * 60))\n const minutes = Math.floor((diff % (60 * 60)) / 60)\n const seconds = diff % 60\n\n return { days, hours, minutes, seconds }\n}\n\n/**\n * \u5012\u8BA1\u65F6\u6570\u5B57\u5757\u80CC\u666F\u8272\u6837\u5F0F\u53D8\u4F53\n */\nconst countdownUnitVariants = cva(\n 'lg-desktop:size-12 lg-desktop:px-1 flex size-10 flex-col items-center justify-center px-[2px] text-center',\n {\n variants: {\n theme: {\n light: 'bg-info-primary',\n dark: 'bg-[#f5f6f7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n }\n)\n\n/**\n * \u5012\u8BA1\u65F6\u6587\u5B57\u989C\u8272\u6837\u5F0F\u53D8\u4F53\n */\nconst countdownTextVariants = cva('', {\n variants: {\n theme: {\n light: 'text-white',\n dark: 'text-[#080A0F]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n})\n\n/**\n * \u5012\u8BA1\u65F6\u6570\u5B57\u5757\u7EC4\u4EF6\n */\nconst CountdownUnit = ({ value, label, theme = 'light' }: { value: number; label: string; theme?: Theme }) => {\n return (\n <div className={countdownUnitVariants({ theme })}>\n <p\n className={cn(\n 'lg-desktop:text-2xl text-[20px] font-bold leading-[1.2] tracking-[-0.96px]',\n countdownTextVariants({ theme })\n )}\n >\n {String(value).padStart(2, '0')}\n </p>\n <p className={cn('text-[12px] font-bold leading-[1.4] tracking-[-0.24px]', countdownTextVariants({ theme }))}>\n {label}\n </p>\n </div>\n )\n}\n\n/**\n * \u5012\u8BA1\u65F6\u5206\u9694\u7B26\n */\nconst CountdownSeparator = () => {\n return (\n <p className=\"lg-desktop:text-2xl text-info-primary text-center text-xl font-bold leading-[1.2] tracking-[-0.96px]\">\n :\n </p>\n )\n}\n\n/**\n * Countdown - \u5012\u8BA1\u65F6\u7EC4\u4EF6\n */\nconst Countdown = React.forwardRef<HTMLDivElement, CountdownProps>(\n ({ config, className, onCountdownEnd, theme = 'light' }, ref) => {\n const {\n targetDate,\n showDays = true,\n showHours = true,\n showMinutes = true,\n showSeconds = true,\n labels = {},\n } = config\n\n const [timeLeft, setTimeLeft] = useState<TimeLeft>(() => calculateTimeLeft(targetDate))\n\n useEffect(() => {\n const timer = setInterval(() => {\n const newTimeLeft = calculateTimeLeft(targetDate)\n setTimeLeft(newTimeLeft)\n\n // \u68C0\u67E5\u5012\u8BA1\u65F6\u662F\u5426\u7ED3\u675F\n if (\n newTimeLeft.days === 0 &&\n newTimeLeft.hours === 0 &&\n newTimeLeft.minutes === 0 &&\n newTimeLeft.seconds === 0\n ) {\n onCountdownEnd?.()\n clearInterval(timer)\n }\n }, 1000)\n\n return () => clearInterval(timer)\n }, [targetDate, onCountdownEnd])\n\n const defaultLabels = {\n days: labels.days || 'Day',\n hours: labels.hours || 'Hours',\n minutes: labels.minutes || 'Mins',\n seconds: labels.seconds || 'Secs',\n }\n\n const units = []\n if (showDays) units.push({ value: timeLeft.days, label: defaultLabels.days })\n if (showHours) units.push({ value: timeLeft.hours, label: defaultLabels.hours })\n if (showMinutes) units.push({ value: timeLeft.minutes, label: defaultLabels.minutes })\n if (showSeconds) units.push({ value: timeLeft.seconds, label: defaultLabels.seconds })\n\n return (\n <div ref={ref} className={cn('flex items-center gap-1', className)}>\n {units.map((unit, index) => (\n <React.Fragment key={unit.label}>\n <CountdownUnit value={unit.value} label={unit.label} theme={theme} />\n {index < units.length - 1 && <CountdownSeparator />}\n </React.Fragment>\n ))}\n </div>\n )\n }\n)\n\nCountdown.displayName = 'Countdown'\n\nexport default Countdown\n"],
5
- "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgFI,IAAAI,EAAA,6BA/EJC,EAA2C,oBAC3CC,EAAkB,oBAClBC,EAAmB,kCACnBC,EAAoB,oCAqBpB,MAAMC,EAAqBC,GAAiC,CAC1D,MAAMC,KAAM,EAAAC,SAAM,EAEZC,KADS,EAAAD,SAAMF,CAAU,EACX,KAAKC,EAAK,QAAQ,EAEtC,GAAIE,GAAQ,EACV,MAAO,CAAE,KAAM,EAAG,MAAO,EAAG,QAAS,EAAG,QAAS,CAAE,EAGrD,MAAMC,EAAO,KAAK,MAAMD,GAAQ,GAAK,GAAK,GAAG,EACvCE,EAAQ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,YAAY,IAAM,CAC9B,MAAMC,EAAc9B,EAAkBC,CAAU,EAChD2B,EAAYE,CAAW,EAIrBA,EAAY,OAAS,GACrBA,EAAY,QAAU,GACtBA,EAAY,UAAY,GACxBA,EAAY,UAAY,IAExBV,IAAiB,EACjB,cAAcS,CAAK,EAEvB,EAAG,GAAI,EAEP,MAAO,IAAM,cAAcA,CAAK,CAClC,EAAG,CAAC5B,EAAYmB,CAAc,CAAC,EAE/B,MAAMW,EAAgB,CACpB,KAAML,EAAO,MAAQ,MACrB,MAAOA,EAAO,OAAS,QACvB,QAASA,EAAO,SAAW,OAC3B,QAASA,EAAO,SAAW,MAC7B,EAEMM,EAAQ,CAAC,EACf,OAAIV,GAAUU,EAAM,KAAK,CAAE,MAAOL,EAAS,KAAM,MAAOI,EAAc,IAAK,CAAC,EACxER,GAAWS,EAAM,KAAK,CAAE,MAAOL,EAAS,MAAO,MAAOI,EAAc,KAAM,CAAC,EAC3EP,GAAaQ,EAAM,KAAK,CAAE,MAAOL,EAAS,QAAS,MAAOI,EAAc,OAAQ,CAAC,EACjFN,GAAaO,EAAM,KAAK,CAAE,MAAOL,EAAS,QAAS,MAAOI,EAAc,OAAQ,CAAC,KAGnF,OAAC,OAAI,IAAKV,EAAK,aAAW,MAAG,0BAA2BF,CAAS,EAC9D,SAAAa,EAAM,IAAI,CAACC,EAAMC,OAChB,QAAC,EAAAjB,QAAM,SAAN,CACC,oBAACN,EAAA,CAAc,MAAOsB,EAAK,MAAO,MAAOA,EAAK,MAAO,MAAOnB,EAAO,EAClEoB,EAAQF,EAAM,OAAS,MAAK,OAACjB,EAAA,EAAmB,IAF9BkB,EAAK,KAG1B,CACD,EACH,CAEJ,CACF,EAEAjB,EAAU,YAAc,YAExB,IAAOvB,EAAQuB",
4
+ "sourcesContent": ["'use client'\nimport React, { useState, useEffect } from 'react'\nimport dayjs from 'dayjs'\nimport { cn } from '../../helpers/utils.js'\nimport { cva } from 'class-variance-authority'\nimport type { CountdownConfig } from './types.js'\nimport type { Theme } from '../../types/props.js'\n\ninterface CountdownProps {\n config: CountdownConfig\n className?: string\n onCountdownEnd?: () => void\n theme?: Theme\n}\n\ninterface TimeLeft {\n days: number\n hours: number\n minutes: number\n seconds: number\n}\n\n/**\n * \u8BA1\u7B97\u5269\u4F59\u65F6\u95F4\n */\nconst calculateTimeLeft = (targetDate: string): TimeLeft => {\n const now = dayjs()\n const target = dayjs(targetDate)\n const diff = target.diff(now, 'second')\n\n if (diff <= 0) {\n return { days: 0, hours: 0, minutes: 0, seconds: 0 }\n }\n\n const days = Math.floor(diff / (24 * 60 * 60))\n const hours = Math.floor((diff % (24 * 60 * 60)) / (60 * 60))\n const minutes = Math.floor((diff % (60 * 60)) / 60)\n const seconds = diff % 60\n\n return { days, hours, minutes, seconds }\n}\n\n/**\n * \u5012\u8BA1\u65F6\u6570\u5B57\u5757\u80CC\u666F\u8272\u6837\u5F0F\u53D8\u4F53\n */\nconst countdownUnitVariants = cva(\n 'lg-desktop:size-12 lg-desktop:px-1 flex size-10 flex-col items-center justify-center px-[2px] text-center',\n {\n variants: {\n theme: {\n light: 'bg-info-primary',\n dark: 'bg-[#f5f6f7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n }\n)\n\n/**\n * \u5012\u8BA1\u65F6\u6587\u5B57\u989C\u8272\u6837\u5F0F\u53D8\u4F53\n */\nconst countdownTextVariants = cva('', {\n variants: {\n theme: {\n light: 'text-white',\n dark: 'text-[#080A0F]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n})\n\n/**\n * \u5012\u8BA1\u65F6\u6570\u5B57\u5757\u7EC4\u4EF6\n */\nconst CountdownUnit = ({ value, label, theme = 'light' }: { value: number; label: string; theme?: Theme }) => {\n return (\n <div className={countdownUnitVariants({ theme })}>\n <p\n className={cn(\n 'lg-desktop:text-2xl text-[20px] font-bold leading-[1.2] tracking-[-0.96px]',\n countdownTextVariants({ theme })\n )}\n >\n {String(value).padStart(2, '0')}\n </p>\n <p\n className={cn(\n 'mt-[-6px] text-[12px] font-bold leading-[1.4] tracking-[-0.24px]',\n countdownTextVariants({ theme })\n )}\n >\n {label}\n </p>\n </div>\n )\n}\n\n/**\n * \u5012\u8BA1\u65F6\u5206\u9694\u7B26\n */\nconst CountdownSeparator = () => {\n return (\n <p className=\"lg-desktop:text-2xl text-info-primary text-center text-xl font-bold leading-[1.2] tracking-[-0.96px]\">\n :\n </p>\n )\n}\n\n/**\n * Countdown - \u5012\u8BA1\u65F6\u7EC4\u4EF6\n */\nconst Countdown = React.forwardRef<HTMLDivElement, CountdownProps>(\n ({ config, className, onCountdownEnd, theme = 'light' }, ref) => {\n const {\n targetDate,\n showDays = true,\n showHours = true,\n showMinutes = true,\n showSeconds = true,\n labels = {},\n } = config\n\n const [timeLeft, setTimeLeft] = useState<TimeLeft>(() => calculateTimeLeft(targetDate))\n\n useEffect(() => {\n const timer = setInterval(() => {\n const newTimeLeft = calculateTimeLeft(targetDate)\n setTimeLeft(newTimeLeft)\n\n // \u68C0\u67E5\u5012\u8BA1\u65F6\u662F\u5426\u7ED3\u675F\n if (\n newTimeLeft.days === 0 &&\n newTimeLeft.hours === 0 &&\n newTimeLeft.minutes === 0 &&\n newTimeLeft.seconds === 0\n ) {\n onCountdownEnd?.()\n clearInterval(timer)\n }\n }, 1000)\n\n return () => clearInterval(timer)\n }, [targetDate, onCountdownEnd])\n\n const defaultLabels = {\n days: labels.days || 'Day',\n hours: labels.hours || 'Hours',\n minutes: labels.minutes || 'Mins',\n seconds: labels.seconds || 'Secs',\n }\n\n const units = []\n if (showDays) units.push({ value: timeLeft.days, label: defaultLabels.days })\n if (showHours) units.push({ value: timeLeft.hours, label: defaultLabels.hours })\n if (showMinutes) units.push({ value: timeLeft.minutes, label: defaultLabels.minutes })\n if (showSeconds) units.push({ value: timeLeft.seconds, label: defaultLabels.seconds })\n\n return (\n <div ref={ref} className={cn('flex items-center gap-1', className)}>\n {units.map((unit, index) => (\n <React.Fragment key={unit.label}>\n <CountdownUnit value={unit.value} label={unit.label} theme={theme} />\n {index < units.length - 1 && <CountdownSeparator />}\n </React.Fragment>\n ))}\n </div>\n )\n }\n)\n\nCountdown.displayName = 'Countdown'\n\nexport default Countdown\n"],
5
+ "mappings": "ukBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GAgFI,IAAAI,EAAA,6BA/EJC,EAA2C,oBAC3CC,EAAkB,oBAClBC,EAAmB,kCACnBC,EAAoB,oCAqBpB,MAAMC,EAAqBC,GAAiC,CAC1D,MAAMC,KAAM,EAAAC,SAAM,EAEZC,KADS,EAAAD,SAAMF,CAAU,EACX,KAAKC,EAAK,QAAQ,EAEtC,GAAIE,GAAQ,EACV,MAAO,CAAE,KAAM,EAAG,MAAO,EAAG,QAAS,EAAG,QAAS,CAAE,EAGrD,MAAMC,EAAO,KAAK,MAAMD,GAAQ,GAAK,GAAK,GAAG,EACvCE,EAAQ,KAAK,MAAOF,GAAQ,GAAK,GAAK,KAAQ,GAAK,GAAG,EACtDG,EAAU,KAAK,MAAOH,GAAQ,GAAK,IAAO,EAAE,EAC5CI,EAAUJ,EAAO,GAEvB,MAAO,CAAE,KAAAC,EAAM,MAAAC,EAAO,QAAAC,EAAS,QAAAC,CAAQ,CACzC,EAKMC,KAAwB,OAC5B,4GACA,CACE,SAAU,CACR,MAAO,CACL,MAAO,kBACP,KAAM,cACR,CACF,EACA,gBAAiB,CACf,MAAO,OACT,CACF,CACF,EAKMC,KAAwB,OAAI,GAAI,CACpC,SAAU,CACR,MAAO,CACL,MAAO,aACP,KAAM,gBACR,CACF,EACA,gBAAiB,CACf,MAAO,OACT,CACF,CAAC,EAKKC,EAAgB,CAAC,CAAE,MAAAC,EAAO,MAAAC,EAAO,MAAAC,EAAQ,OAAQ,OAEnD,QAAC,OAAI,UAAWL,EAAsB,CAAE,MAAAK,CAAM,CAAC,EAC7C,oBAAC,KACC,aAAW,MACT,6EACAJ,EAAsB,CAAE,MAAAI,CAAM,CAAC,CAC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C,EACjFN,GAAaO,EAAM,KAAK,CAAE,MAAOL,EAAS,QAAS,MAAOI,EAAc,OAAQ,CAAC,KAGnF,OAAC,OAAI,IAAKV,EAAK,aAAW,MAAG,0BAA2BF,CAAS,EAC9D,SAAAa,EAAM,IAAI,CAACC,EAAMC,OAChB,QAAC,EAAAjB,QAAM,SAAN,CACC,oBAACN,EAAA,CAAc,MAAOsB,EAAK,MAAO,MAAOA,EAAK,MAAO,MAAOnB,EAAO,EAClEoB,EAAQF,EAAM,OAAS,MAAK,OAACjB,EAAA,EAAmB,IAF9BkB,EAAK,KAG1B,CACD,EACH,CAEJ,CACF,EAEAjB,EAAU,YAAc,YAExB,IAAOvB,EAAQuB",
6
6
  "names": ["Countdown_exports", "__export", "Countdown_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_dayjs", "import_utils", "import_class_variance_authority", "calculateTimeLeft", "targetDate", "now", "dayjs", "diff", "days", "hours", "minutes", "seconds", "countdownUnitVariants", "countdownTextVariants", "CountdownUnit", "value", "label", "theme", "CountdownSeparator", "Countdown", "React", "config", "className", "onCountdownEnd", "ref", "showDays", "showHours", "showMinutes", "showSeconds", "labels", "timeLeft", "setTimeLeft", "timer", "newTimeLeft", "defaultLabels", "units", "unit", "index"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use strict";"use client";var rt=Object.create;var h=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var ot=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var lt=(t,e)=>{for(var n in e)h(t,n,{get:e[n],enumerable:!0})},M=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of it(e))!at.call(t,i)&&i!==n&&h(t,i,{get:()=>e[i],enumerable:!(o=st(e,i))||o.enumerable});return t};var C=(t,e,n)=>(n=t!=null?rt(ot(t)):{},M(e||!t||!t.__esModule?h(n,"default",{value:t,enumerable:!0}):n,t)),ct=t=>M(h({},"__esModule",{value:!0}),t);var ft={};lt(ft,{default:()=>ut});module.exports=ct(ft);var r=require("react/jsx-runtime"),s=C(require("react")),g=require("gsap"),b=require("gsap/dist/SplitText"),T=require("gsap/dist/ScrollTrigger"),a=require("../../helpers/utils.js"),F=require("class-variance-authority"),x=require("../../components/index.js"),z=require("../../shared/Styles.js"),A=require("../../shared/trackUrlRef.js"),I=require("react-intersection-observer"),B=C(require("./Countdown.js"));const $="link",P="title",dt=(0,F.cva)("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),mt=(0,F.cva)("desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),S=({data:t,className:e})=>{const{theme:n="light",extensions:o,title:i,caption:f,align:c}=t;return o?.textLink?(0,r.jsxs)("a",{className:(0,a.cn)({"aiui-dark":n==="dark"},"hover:text-brand-0 [&_svg_path]:hover:stroke-brand-0 flex items-center overflow-hidden text-base font-[700] leading-[1.4] transition-all duration-[0.4s]",{"text-[#080A0F]":n==="light"},{"text-[#F5F6F7]":n==="dark"},{"justify-center":c==="center"},e),href:(0,A.trackUrlRef)(o?.link,`${$}_${P}`),"data-headless-type-name":`${$}#${P}`,"data-headless-title-desc-button":`${i}#${f}`,children:[(0,r.jsx)("div",{className:(0,a.cn)("flex-1 truncate whitespace-nowrap",{"flex-none":c==="center"}),children:o?.textLink}),(0,r.jsx)("div",{className:"size-6",children:(0,r.jsx)("svg",{width:"24",height:"24",className:"mb-[3px]",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",children:(0,r.jsx)("path",{className:"transition-all duration-[0.4s]",d:"M10.5 8L14.5 12L10.5 16",stroke:n==="dark"?"#F5F6F7":"#080A0F",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null},j=s.default.forwardRef(({data:t,className:e,as:n="h2",weight:o="bold"},i)=>{const{title:f,caption:c,subtitle:y,countdown:N,showCountdown:D=!1,theme:p="light",extensions:_,align:d="left"}=t,L=(0,s.useRef)(null),m=(0,s.useRef)(null),l=(0,s.useRef)(null),u=(0,s.useRef)(null),[U,O]=(0,s.useState)(!0),{ref:W,inView:R}=(0,I.useInView)();(0,s.useImperativeHandle)(i,()=>L.current);const q=()=>{O(!1)};return(0,s.useEffect)(()=>{g.gsap.registerPlugin(b.SplitText,T.ScrollTrigger);function G(){if(!m.current)return;const J=m.current?.clientHeight||80;l.current&&l.current.revert(),u.current&&u.current.kill(),l.current=new b.SplitText(m.current,{type:"words",wordsClass:"word"});const w=l.current.words;g.gsap.set(w,{opacity:0}),u.current=T.ScrollTrigger.create({trigger:m.current,start:"bottom bottom-=4%",end:`bottom+=${J*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:K=>{const Q=K.progress,E=w.length||1,X=.5,v=1/E,H=v*(1-X),V=(E-1)*H+v,Y=Math.min(1,V>0?Q/V:0);w.forEach((Z,tt)=>{const et=tt*H,nt=v;let k=(Y-et)/nt;k=Math.max(0,Math.min(1,k)),g.gsap.set(Z,{opacity:k})})}})}return R&&G(),()=>{l.current&&l.current.revert(),u.current&&u.current.kill()}},[R]),(f||c)&&(0,r.jsxs)("div",{id:_?.id,className:"titleBottom title-box mb-6 flex items-end justify-between gap-2",ref:L,children:[(0,r.jsxs)("div",{ref:W,className:(0,a.cn)("flex-1",e,{"aiui-dark":p==="dark","text-center":d==="center","text-left":d==="left"}),children:[(0,r.jsx)(x.Heading,{ref:m,as:n,size:4,html:c||f,weight:o,className:dt({theme:p})}),y&&(0,r.jsx)(x.Text,{html:y,as:"p",className:mt({theme:p})}),(0,r.jsx)(S,{data:t,className:(0,a.cn)({hidden:d==="left"})}),D&&N&&U&&(0,r.jsx)(B.default,{className:(0,a.cn)("mt-4 justify-start",{"justify-center":d==="center"}),config:N,onCountdownEnd:q,theme:p})]}),(0,r.jsx)(S,{data:t,className:(0,a.cn)({hidden:d==="center"})})]})});j.displayName="Title";var ut=(0,z.withLayout)(j);
1
+ "use strict";"use client";var rt=Object.create;var g=Object.defineProperty;var st=Object.getOwnPropertyDescriptor;var it=Object.getOwnPropertyNames;var ot=Object.getPrototypeOf,at=Object.prototype.hasOwnProperty;var lt=(t,e)=>{for(var n in e)g(t,n,{get:e[n],enumerable:!0})},V=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of it(e))!at.call(t,i)&&i!==n&&g(t,i,{get:()=>e[i],enumerable:!(o=st(e,i))||o.enumerable});return t};var M=(t,e,n)=>(n=t!=null?rt(ot(t)):{},V(e||!t||!t.__esModule?g(n,"default",{value:t,enumerable:!0}):n,t)),ct=t=>V(g({},"__esModule",{value:!0}),t);var ft={};lt(ft,{default:()=>ut});module.exports=ct(ft);var r=require("react/jsx-runtime"),s=M(require("react")),h=require("gsap"),b=require("gsap/dist/SplitText"),T=require("gsap/dist/ScrollTrigger"),a=require("../../helpers/utils.js"),F=require("class-variance-authority"),x=require("../../components/index.js"),j=require("../../shared/Styles.js"),A=require("../../shared/trackUrlRef.js"),I=require("react-intersection-observer"),B=M(require("./Countdown.js"));const $="link",z="title",dt=(0,F.cva)("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),mt=(0,F.cva)("desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),P=({data:t,className:e})=>{const{theme:n="light",extensions:o,title:i,caption:f,align:c}=t;return o?.textLink?(0,r.jsxs)("a",{className:(0,a.cn)({"aiui-dark":n==="dark"},"hover:text-brand-0 [&_svg_path]:hover:stroke-brand-0 lg-desktop:text-base flex items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"text-[#080A0F]":n==="light"},{"text-[#F5F6F7]":n==="dark"},{"justify-center mt-4":c==="center"},e),href:(0,A.trackUrlRef)(o?.link,`${$}_${z}`),"data-headless-type-name":`${$}#${z}`,"data-headless-title-desc-button":`${i}#${f}`,children:[(0,r.jsx)("div",{className:(0,a.cn)("flex-1 truncate whitespace-nowrap",{"flex-none":c==="center"}),children:o?.textLink}),(0,r.jsx)("div",{className:"lg-desktop:size-5 size-4",children:(0,r.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:(0,r.jsx)("path",{d:"M5.52876 3.52876C5.78911 3.26841 6.21112 3.26841 6.47147 3.52876L10.4715 7.52876C10.7318 7.78911 10.7318 8.21112 10.4715 8.47147L6.47147 12.4715C6.21112 12.7318 5.78911 12.7318 5.52876 12.4715C5.26841 12.2111 5.26841 11.7891 5.52876 11.5288L9.0574 8.00011L5.52876 4.47147C5.26841 4.21112 5.26841 3.78911 5.52876 3.52876Z",stroke:n==="dark"?"#F5F6F7":"#080A0F"})})})]}):null},S=s.default.forwardRef(({data:t,className:e,as:n="h2",weight:o="bold"},i)=>{const{title:f,caption:c,subtitle:y,countdown:N,showCountdown:D=!1,theme:p="light",extensions:_,align:d="left"}=t,C=(0,s.useRef)(null),m=(0,s.useRef)(null),l=(0,s.useRef)(null),u=(0,s.useRef)(null),[U,O]=(0,s.useState)(!0),{ref:Z,inView:L}=(0,I.useInView)();(0,s.useImperativeHandle)(i,()=>C.current);const q=()=>{O(!1)};return(0,s.useEffect)(()=>{h.gsap.registerPlugin(b.SplitText,T.ScrollTrigger);function G(){if(!m.current)return;const J=m.current?.clientHeight||80;l.current&&l.current.revert(),u.current&&u.current.kill(),l.current=new b.SplitText(m.current,{type:"words",wordsClass:"word"});const w=l.current.words;h.gsap.set(w,{opacity:0}),u.current=T.ScrollTrigger.create({trigger:m.current,start:"bottom bottom-=4%",end:`bottom+=${J*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:K=>{const Q=K.progress,R=w.length||1,W=.5,v=1/R,E=v*(1-W),H=(R-1)*E+v,X=Math.min(1,H>0?Q/H:0);w.forEach((Y,tt)=>{const et=tt*E,nt=v;let k=(X-et)/nt;k=Math.max(0,Math.min(1,k)),h.gsap.set(Y,{opacity:k})})}})}return L&&G(),()=>{l.current&&l.current.revert(),u.current&&u.current.kill()}},[L]),(f||c)&&(0,r.jsxs)("div",{id:_?.id,className:"titleBottom title-box mb-6 flex items-end justify-between gap-2",ref:C,children:[(0,r.jsxs)("div",{ref:Z,className:(0,a.cn)("flex-1",e,{"aiui-dark":p==="dark","text-center":d==="center","text-left":d==="left"}),children:[(0,r.jsx)(x.Heading,{ref:m,as:n,size:4,html:c||f,weight:o,className:dt({theme:p})}),y&&(0,r.jsx)(x.Text,{html:y,as:"p",className:mt({theme:p})}),(0,r.jsx)(P,{data:t,className:(0,a.cn)({hidden:d==="left"})}),D&&N&&U&&(0,r.jsx)(B.default,{className:(0,a.cn)("mt-4 justify-start",{"justify-center":d==="center"}),config:N,onCountdownEnd:q,theme:p})]}),(0,r.jsx)(P,{data:t,className:(0,a.cn)({hidden:d==="center"})})]})});S.displayName="Title";var ut=(0,j.withLayout)(S);
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/Title/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle, useState } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { cva } from 'class-variance-authority'\nimport { Heading, Text } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\nimport Countdown from './Countdown.js'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\n/**\n * \u6807\u9898\u6837\u5F0F\u53D8\u4F53\n */\nconst titleHeadingVariants = cva('', {\n variants: {\n theme: {\n light: 'text-[#080A0F]',\n dark: 'text-[#F5F6F7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n})\n\n/**\n * \u526F\u6807\u9898\u6837\u5F0F\u53D8\u4F53\n */\nconst subtitleVariants = cva(\n 'desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]',\n {\n variants: {\n theme: {\n light: 'text-[#080A0F]',\n dark: 'text-[#F5F6F7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n }\n)\n\nconst TitleButton = ({ data, className }: { data: TitleProps['data']; className?: string }) => {\n const { theme = 'light', extensions, title, caption, align } = data\n if (!extensions?.textLink) return null\n return (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'hover:text-brand-0 [&_svg_path]:hover:stroke-brand-0 flex items-center overflow-hidden text-base font-[700] leading-[1.4] transition-all duration-[0.4s]',\n { 'text-[#080A0F]': theme === 'light' },\n { 'text-[#F5F6F7]': theme === 'dark' },\n { 'justify-center': align === 'center' },\n className\n )}\n href={trackUrlRef(extensions?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${caption}`}\n >\n <div\n className={cn('flex-1 truncate whitespace-nowrap', {\n 'flex-none': align === 'center',\n })}\n >\n {extensions?.textLink}\n </div>\n <div className=\"size-6\">\n <svg\n width=\"24\"\n height=\"24\"\n className=\"mb-[3px]\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n >\n <path\n className=\"transition-all duration-[0.4s]\"\n d=\"M10.5 8L14.5 12L10.5 16\"\n stroke={theme === 'dark' ? '#F5F6F7' : '#080A0F'}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n ></path>\n </svg>\n </div>\n </a>\n )\n}\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className, as = 'h2', weight = 'bold' }, ref) => {\n const {\n title,\n caption,\n subtitle,\n countdown,\n showCountdown = false,\n theme = 'light',\n extensions,\n align = 'left',\n } = data\n const innerRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n // \u63A7\u5236\u5012\u8BA1\u65F6\u663E\u793A\u72B6\u6001\n const [isCountdownVisible, setIsCountdownVisible] = useState(true)\n\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n // \u5012\u8BA1\u65F6\u7ED3\u675F\u56DE\u8C03\n const handleCountdownEnd = () => {\n setIsCountdownVisible(false)\n }\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n if (splitTextInstance.current) {\n splitTextInstance.current.revert()\n }\n if (scrollTriggerRef.current) {\n scrollTriggerRef.current.kill()\n }\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n invalidateOnRefresh: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length || 1\n const overlap = 0.5\n const interval = 1 / total\n const step = interval * (1 - overlap)\n const lastEnd = (total - 1) * step + interval\n const normalizedProgress = Math.min(1, lastEnd > 0 ? progress / lastEnd : 0)\n words.forEach((word: any, i: number) => {\n const start = i * step\n const width = interval\n let opacity = (normalizedProgress - start) / width\n opacity = Math.max(0, Math.min(1, opacity))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n (title || caption) && (\n <div\n id={extensions?.id}\n className=\"titleBottom title-box mb-6 flex items-end justify-between gap-2\"\n ref={innerRef}\n >\n <div\n ref={inViewRef}\n className={cn('flex-1', className, {\n 'aiui-dark': theme === 'dark',\n 'text-center': align === 'center',\n 'text-left': align === 'left',\n })}\n >\n <Heading\n ref={titleRef}\n as={as}\n size={4}\n html={caption || title}\n weight={weight}\n className={titleHeadingVariants({ theme })}\n />\n {subtitle && <Text html={subtitle} as=\"p\" className={subtitleVariants({ theme })} />}\n <TitleButton data={data} className={cn({ hidden: align === 'left' })} />\n {showCountdown && countdown && isCountdownVisible && (\n <Countdown\n className={cn('mt-4 justify-start', {\n 'justify-center': align === 'center',\n })}\n config={countdown}\n onCountdownEnd={handleCountdownEnd}\n theme={theme}\n />\n )}\n </div>\n <TitleButton data={data} className={cn({ hidden: align === 'center' })} />\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
5
- "mappings": "mlBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAsDI,IAAAI,EAAA,6BArDJC,EAAwE,oBACxEC,EAAqB,gBACrBC,EAA0B,+BAC1BC,EAA8B,mCAC9BC,EAAmB,kCACnBC,EAAoB,oCACpBC,EAA8B,qCAC9BC,EAA2B,kCAE3BC,EAA4B,uCAC5BC,EAA0B,uCAC1BC,EAAsB,6BAEtB,MAAMC,EAAgB,OAChBC,EAAgB,QAKhBC,MAAuB,OAAI,GAAI,CACnC,SAAU,CACR,MAAO,CACL,MAAO,iBACP,KAAM,gBACR,CACF,EACA,gBAAiB,CACf,MAAO,OACT,CACF,CAAC,EAKKC,MAAmB,OACvB,oHACA,CACE,S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AI,CAAQ,CAAC,CAC5B,CAAC,CACH,CACF,CAAC,CACH,CAEA,OAAIjB,GACFE,EAAW,EAGN,IAAM,CACXP,EAAkB,SAAWA,EAAkB,QAAQ,OAAO,EAE9DC,EAAiB,SAAWA,EAAiB,QAAQ,KAAK,CAC5D,CACF,EAAG,CAACI,CAAM,CAAC,GAGRlB,GAASC,OACR,QAAC,OACC,GAAIF,GAAY,GAChB,UAAU,kEACV,IAAKY,EAEL,qBAAC,OACC,IAAKM,EACL,aAAW,MAAG,SAAUpB,EAAW,CACjC,YAAaC,IAAU,OACvB,cAAeI,IAAU,SACzB,YAAaA,IAAU,MACzB,CAAC,EAED,oBAAC,WACC,IAAKU,EACL,GAAIP,EACJ,KAAM,EACN,KAAMJ,GAAWD,EACjB,OAAQM,EACR,UAAWb,GAAqB,CAAE,MAAAK,CAAM,CAAC,EAC3C,EACCU,MAAY,OAAC,QAAK,KAAMA,EAAU,GAAG,IAAI,UAAWd,GAAiB,CAAE,MAAAI,CAAM,CAAC,EAAG,KAClF,OAACH,EAAA,CAAY,KAAMC,EAAM,aAAW,MAAG,CAAE,OAAQM,IAAU,MAAO,CAAC,EAAG,EACrEQ,GAAiBD,GAAaM,MAC7B,OAAC,EAAAqB,QAAA,CACC,aAAW,MAAG,qBAAsB,CAClC,iBAAkBlC,IAAU,QAC9B,CAAC,EACD,OAAQO,EACR,eAAgBU,EAChB,MAAOrB,EACT,GAEJ,KACA,OAACH,EAAA,CAAY,KAAMC,EAAM,aAAW,MAAG,CAAE,OAAQM,IAAU,QAAS,CAAC,EAAG,GAC1E,CAGN,CAAC,EAEDC,EAAM,YAAc,QAEpB,IAAO1B,MAAQ,cAAW0B,CAAK",
4
+ "sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle, useState } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { cva } from 'class-variance-authority'\nimport { Heading, Text } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\nimport Countdown from './Countdown.js'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\n/**\n * \u6807\u9898\u6837\u5F0F\u53D8\u4F53\n */\nconst titleHeadingVariants = cva('', {\n variants: {\n theme: {\n light: 'text-[#080A0F]',\n dark: 'text-[#F5F6F7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n})\n\n/**\n * \u526F\u6807\u9898\u6837\u5F0F\u53D8\u4F53\n */\nconst subtitleVariants = cva(\n 'desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]',\n {\n variants: {\n theme: {\n light: 'text-[#080A0F]',\n dark: 'text-[#F5F6F7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n }\n)\n\nconst TitleButton = ({ data, className }: { data: TitleProps['data']; className?: string }) => {\n const { theme = 'light', extensions, title, caption, align } = data\n if (!extensions?.textLink) return null\n return (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'hover:text-brand-0 [&_svg_path]:hover:stroke-brand-0 lg-desktop:text-base flex items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]',\n { 'text-[#080A0F]': theme === 'light' },\n { 'text-[#F5F6F7]': theme === 'dark' },\n { 'justify-center mt-4': align === 'center' },\n className\n )}\n href={trackUrlRef(extensions?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${caption}`}\n >\n <div\n className={cn('flex-1 truncate whitespace-nowrap', {\n 'flex-none': align === 'center',\n })}\n >\n {extensions?.textLink}\n </div>\n <div className=\"lg-desktop:size-5 size-4\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M5.52876 3.52876C5.78911 3.26841 6.21112 3.26841 6.47147 3.52876L10.4715 7.52876C10.7318 7.78911 10.7318 8.21112 10.4715 8.47147L6.47147 12.4715C6.21112 12.7318 5.78911 12.7318 5.52876 12.4715C5.26841 12.2111 5.26841 11.7891 5.52876 11.5288L9.0574 8.00011L5.52876 4.47147C5.26841 4.21112 5.26841 3.78911 5.52876 3.52876Z\"\n stroke={theme === 'dark' ? '#F5F6F7' : '#080A0F'}\n />\n </svg>\n </div>\n </a>\n )\n}\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className, as = 'h2', weight = 'bold' }, ref) => {\n const {\n title,\n caption,\n subtitle,\n countdown,\n showCountdown = false,\n theme = 'light',\n extensions,\n align = 'left',\n } = data\n const innerRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n // \u63A7\u5236\u5012\u8BA1\u65F6\u663E\u793A\u72B6\u6001\n const [isCountdownVisible, setIsCountdownVisible] = useState(true)\n\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n // \u5012\u8BA1\u65F6\u7ED3\u675F\u56DE\u8C03\n const handleCountdownEnd = () => {\n setIsCountdownVisible(false)\n }\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n if (splitTextInstance.current) {\n splitTextInstance.current.revert()\n }\n if (scrollTriggerRef.current) {\n scrollTriggerRef.current.kill()\n }\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n invalidateOnRefresh: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length || 1\n const overlap = 0.5\n const interval = 1 / total\n const step = interval * (1 - overlap)\n const lastEnd = (total - 1) * step + interval\n const normalizedProgress = Math.min(1, lastEnd > 0 ? progress / lastEnd : 0)\n words.forEach((word: any, i: number) => {\n const start = i * step\n const width = interval\n let opacity = (normalizedProgress - start) / width\n opacity = Math.max(0, Math.min(1, opacity))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n (title || caption) && (\n <div\n id={extensions?.id}\n className=\"titleBottom title-box mb-6 flex items-end justify-between gap-2\"\n ref={innerRef}\n >\n <div\n ref={inViewRef}\n className={cn('flex-1', className, {\n 'aiui-dark': theme === 'dark',\n 'text-center': align === 'center',\n 'text-left': align === 'left',\n })}\n >\n <Heading\n ref={titleRef}\n as={as}\n size={4}\n html={caption || title}\n weight={weight}\n className={titleHeadingVariants({ theme })}\n />\n {subtitle && <Text html={subtitle} as=\"p\" className={subtitleVariants({ theme })} />}\n <TitleButton data={data} className={cn({ hidden: align === 'left' })} />\n {showCountdown && countdown && isCountdownVisible && (\n <Countdown\n className={cn('mt-4 justify-start', {\n 'justify-center': align === 'center',\n })}\n config={countdown}\n onCountdownEnd={handleCountdownEnd}\n theme={theme}\n />\n )}\n </div>\n <TitleButton data={data} className={cn({ hidden: align === 'center' })} />\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
5
+ "mappings": "mlBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAsDI,IAAAI,EAAA,6BArDJC,EAAwE,o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MC,EAAM,aAAW,MAAG,CAAE,OAAQM,IAAU,QAAS,CAAC,EAAG,GAC1E,CAGN,CAAC,EAEDC,EAAM,YAAc,QAEpB,IAAO1B,MAAQ,cAAW0B,CAAK",
6
6
  "names": ["Title_exports", "__export", "Title_default", "__toCommonJS", "import_jsx_runtime", "import_react", "import_gsap", "import_SplitText", "import_ScrollTrigger", "import_utils", "import_class_variance_authority", "import_components", "import_Styles", "import_trackUrlRef", "import_react_intersection_observer", "import_Countdown", "componentType", "componentName", "titleHeadingVariants", "subtitleVariants", "TitleButton", "data", "className", "theme", "extensions", "title", "caption", "align", "Title", "React", "as", "weight", "ref", "subtitle", "countdown", "showCountdown", "innerRef", "titleRef", "splitTextInstance", "scrollTriggerRef", "isCountdownVisible", "setIsCountdownVisible", "inViewRef", "inView", "handleCountdownEnd", "gsapResize", "height", "words", "self", "progress", "total", "overlap", "interval", "step", "lastEnd", "normalizedProgress", "word", "i", "start", "width", "opacity", "Countdown"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as a,jsxs as m}from"react/jsx-runtime";import*as r from"react";import{cn as v}from"../../helpers/index.js";import{Text as P,Picture as T,Heading as F}from"../../components/index.js";import{Swiper as y,SwiperSlide as C}from"swiper/react";import x from"dayjs";import{cva as g}from"class-variance-authority";const z=(i,t)=>{const o=x(),c=x(i).startOf("day"),s=x(t).endOf("day");return o.isAfter(c)&&o.isBefore(s)},S=i=>z(i.startDate,i.endDate),R=g("h-2 w-full overflow-hidden",{variants:{state:{"active-light":"bg-[#F6CD4E]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#75787F]"}},defaultVariants:{state:"inactive-light"}}),j=g("size-4 rounded-full transition-colors",{variants:{state:{"active-light":"bg-[#F6CD4E]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#75787F]"}},defaultVariants:{state:"inactive-light"}}),A=g("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-[#080A0F]","inactive-light":"text-[#4A4C56]","active-dark":"text-white","inactive-dark":"text-[#8A8D92]"}},defaultVariants:{state:"inactive-light"}}),H=g("laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden",{variants:{state:{"active-light":"bg-[#F4E8BC]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#1E2024]"}},defaultVariants:{state:"inactive-light"}}),$=({active:i,theme:t="light",className:o,index:c,nodeLength:s})=>{const l=`${i?"active":"inactive"}-${t}`,n=c===0,d=c===s-1;return m("div",{className:"relative my-1 flex h-2 w-full items-center justify-center",children:[a("div",{className:v(R({state:l}),n&&"rounded-l-full",d&&"rounded-r-full",o)}),a("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:a("div",{className:j({state:l})})})]})},O=(i,t)=>{if(i)return t?i.active:i.inactive},q=({active:i,item:t,theme:o="light",className:c})=>{const s=r.useMemo(()=>O(t.icon,i),[t.icon,i]),l=`${i?"active":"inactive"}-${o}`;return m("div",{className:v(H({state:l}),c),children:[s&&a("div",{className:"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]",children:a(T,{source:s.url,alt:s.alt,className:"aspect-square"})}),m("div",{className:"tablet:px-4 tablet:py-3 laptop:p-4 desktop:px-6 relative z-20 flex h-full flex-col justify-between px-6 py-4",children:[a(F,{html:t.title,className:v("desktop:text-[32px] laptop:text-[24px] line-clamp-1 text-[20px]",A({state:l}))}),a("div",{className:"flex flex-col gap-0.5",children:t.items.map((n,d)=>m("div",{className:"flex items-center gap-2",children:[n.icon&&a("div",{className:"desktop:size-6 size-5 shrink-0",children:a(T,{source:n.icon.url,alt:n.icon.alt,className:"size-full"})}),a(P,{html:n.label,className:v("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]",A({state:l}))})]},d))})]})]})},I=r.forwardRef(({classNames:i={},data:t},o)=>{const c=t.theme||"light",s=r.useRef(null),l=r.useRef(null),n=r.useRef(!1),d=r.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),f=r.useMemo(()=>t.scheduleList.findIndex(e=>S(e)),[t.scheduleList]),h=r.useCallback((e,p=!1)=>{const u=B=>{switch(B){case"mobile":return{slidesPerView:1.17};case"tablet":return e===2?{slidesPerView:2}:{slidesPerView:2.4};case"laptop":return e===2?{}:e===4?{slidesPerView:3.2}:{slidesPerView:e};case"desktop":return e===2?{slidesPerView:2}:{slidesPerView:e}}},w=u("mobile"),k=u("tablet"),N=u("laptop"),E=u("desktop");return p?{0:{...w,spaceBetween:12},768:{...k,spaceBetween:e===1?12:void 0},1024:{...N,spaceBetween:16},1440:{...E,spaceBetween:16}}:{0:w,768:k,1024:N,1440:E}},[]),V=r.useMemo(()=>h(d,!0),[d,h]),D=r.useMemo(()=>h(d,!1),[d,h]),b=t.showTimeline!==!1,L=r.useCallback(e=>{n.current||!l.current||(n.current=!0,l.current.slideTo(e.activeIndex,e.params.speed),setTimeout(()=>{n.current=!1},50))},[]),M=r.useCallback(e=>{n.current||!s.current||(n.current=!0,s.current.slideTo(e.activeIndex,e.params.speed),setTimeout(()=>{n.current=!1},50))},[]);return r.useEffect(()=>{s.current&&l.current&&f>=0&&setTimeout(()=>{n.current=!0,s.current?.slideTo(f,500),l.current?.slideTo(f,500),setTimeout(()=>{n.current=!1},600)},100)},[f]),m("div",{ref:o,className:v("tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] overflow-hidden px-4",i?.root),children:[b&&a(y,{breakpoints:D,className:"h-4 w-full !overflow-visible",onSwiper:e=>{l.current=e},onSlideChange:M,children:t.scheduleList.map((e,p)=>{const u=S(e);return a(C,{className:"",children:a($,{className:i?.timeline,active:u,theme:c,index:p,nodeLength:t.scheduleList.length})},"timelineNode"+p)})}),a(y,{breakpoints:V,className:"w-full !overflow-visible",onSwiper:e=>{s.current=e},onSlideChange:L,children:t.scheduleList.map((e,p)=>{const u=S(e);return a(C,{children:a(q,{active:u,className:v(b?"laptop:mt-4 mt-2":"",i?.eventScheduleCard),item:e,theme:c})},"SwiperSlideItem"+p)})})]})});I.displayName="EventSchedule";var W=I;export{W as default};
1
+ "use client";import{jsx as n,jsxs as f}from"react/jsx-runtime";import*as s from"react";import{cn as m}from"../../helpers/index.js";import{Text as P,Picture as C,Heading as F}from"../../components/index.js";import{Swiper as T,SwiperSlide as y}from"swiper/react";import x from"dayjs";import{cva as g}from"class-variance-authority";const z=(i,t)=>{const d=x(),o=x(i).startOf("day"),l=x(t).endOf("day");return d.isAfter(o)&&d.isBefore(l)},S=i=>z(i.startDate,i.endDate),R=g("h-1 w-full overflow-hidden",{variants:{state:{"active-light":"bg-[#F6CD4E]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#75787F]"}},defaultVariants:{state:"inactive-light"}}),j=g("size-4 rounded-full transition-colors",{variants:{state:{"active-light":"bg-[#F6CD4E]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#75787F]"}},defaultVariants:{state:"inactive-light"}}),A=g("font-bold leading-[1.2]",{variants:{state:{"active-light":"text-[#080A0F]","inactive-light":"text-[#4A4C56]","active-dark":"text-white","inactive-dark":"text-[#8A8D92]"}},defaultVariants:{state:"inactive-light"}}),H=g("laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden",{variants:{state:{"active-light":"bg-[#F4E8BC]","inactive-light":"bg-[#EAEAEC]","active-dark":"bg-[#D79941]","inactive-dark":"bg-[#1E2024]"}},defaultVariants:{state:"inactive-light"}}),$=({active:i,theme:t="light",className:d,index:o,nodeLength:l})=>{const r=`${i?"active":"inactive"}-${t}`,a=o===0,c=o===l-1;return f("div",{className:"relative my-2 flex h-1 w-full items-center justify-center",children:[n("div",{className:m(R({state:r}),a&&"rounded-l-full",c&&"rounded-r-full",d)}),n("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2",children:n("div",{className:j({state:r})})})]})},O=(i,t)=>{if(i)return t?i.active:i.inactive},q=({active:i,item:t,theme:d="light",className:o,scheduleCount:l})=>{const r=s.useMemo(()=>O(t.icon,i),[t.icon,i]),a=`${i?"active":"inactive"}-${d}`;return f("div",{className:m(H({state:a}),o),children:[r&&n("div",{className:"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]",children:n(C,{source:r.url,alt:r.alt,className:"aspect-square"})}),f("div",{className:"tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8",children:[n(F,{html:t.title,className:m(l>=4?"desktop:text-[24px]":"desktop:text-[32px]","laptop:text-[24px] line-clamp-1 text-[20px]",A({state:a}))}),n("div",{className:"flex flex-col gap-0.5",children:t.items.map((c,p)=>f("div",{className:"flex items-center gap-2",children:[c.icon&&n("div",{className:"desktop:size-6 size-5 shrink-0",children:n(C,{source:c.icon.url,alt:c.icon.alt,className:"size-full"})}),n(P,{html:c.label,className:m("lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]",A({state:a}))})]},p))})]})]})},I=s.forwardRef(({classNames:i={},data:t},d)=>{const o=t.theme||"light",l=s.useRef(null),r=s.useRef(null),a=s.useRef(!1),c=s.useMemo(()=>t?.scheduleList?.length||2,[t?.scheduleList]),p=s.useMemo(()=>t.scheduleList.findIndex(e=>S(e)),[t.scheduleList]),h=s.useCallback((e,v=!1)=>{const u=B=>{switch(B){case"mobile":return{slidesPerView:1.17};case"tablet":return e===2?{slidesPerView:2}:{slidesPerView:2.4};case"laptop":return e===2?{}:e===4?{slidesPerView:3.2}:{slidesPerView:e};case"desktop":return e===2?{slidesPerView:2}:{slidesPerView:e}}},w=u("mobile"),k=u("tablet"),N=u("laptop"),E=u("desktop");return v?{0:{...w,spaceBetween:12},768:{...k,spaceBetween:e===1?12:void 0},1024:{...N,spaceBetween:16},1440:{...E,spaceBetween:16}}:{0:w,768:k,1024:N,1440:E}},[]),L=s.useMemo(()=>h(c,!0),[c,h]),V=s.useMemo(()=>h(c,!1),[c,h]),b=t.showTimeline!==!1,D=s.useCallback(e=>{a.current||!r.current||(a.current=!0,r.current.slideTo(e.activeIndex,e.params.speed),setTimeout(()=>{a.current=!1},50))},[]),M=s.useCallback(e=>{a.current||!l.current||(a.current=!0,l.current.slideTo(e.activeIndex,e.params.speed),setTimeout(()=>{a.current=!1},50))},[]);return s.useEffect(()=>{l.current&&r.current&&p>=0&&setTimeout(()=>{a.current=!0,l.current?.slideTo(p,500),r.current?.slideTo(p,500),setTimeout(()=>{a.current=!1},600)},100)},[p]),f("div",{ref:d,className:m("tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] overflow-hidden px-4",i?.root),children:[b&&n(T,{breakpoints:V,className:"h-4 w-full !overflow-visible",onSwiper:e=>{r.current=e},onSlideChange:M,children:t.scheduleList.map((e,v)=>{const u=S(e);return n(y,{className:"",children:n($,{className:i?.timeline,active:u,theme:o,index:v,nodeLength:t.scheduleList.length})},"timelineNode"+v)})}),n(T,{breakpoints:L,className:"w-full !overflow-visible",onSwiper:e=>{l.current=e},onSlideChange:D,children:t.scheduleList.map((e,v)=>{const u=S(e);return n(y,{children:n(q,{active:u,className:m(b?"laptop:mt-4 mt-2":"",i?.eventScheduleCard),item:e,theme:o,scheduleCount:t.scheduleList.length})},"SwiperSlideItem"+v)})})]})});I.displayName="EventSchedule";var W=I;export{W as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/EventSchedule/index.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text, Picture, Heading } from '../../components/index.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport type { Swiper as SwiperType } from 'swiper'\nimport dayjs from 'dayjs'\nimport { cva } from 'class-variance-authority'\nimport type { Media } from '../../types/props.js'\nexport type EventScheduleSemanticName = 'root' | 'timeline' | 'eventScheduleCard'\n\n/**\n * \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n */\nexport interface StateIcon {\n /** \u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807 */\n active: Media\n /** \u975E\u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807 */\n inactive: Media\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u9879\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleItem {\n /** \u6807\u9898 */\n title: string\n /** \u5F00\u59CB\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-01'\uFF09 */\n startDate: string\n /** \u7ED3\u675F\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-31'\uFF09 */\n endDate: string\n /**\n * \u5361\u7247\u80CC\u666F\u56FE\u6807\u914D\u7F6E\uFF0C\u72B6\u6001\u5316\u56FE\u6807\uFF08\u5FC5\u987B\u5305\u542B active \u548C inactive\uFF09\n *\n * @example\n * icon: {\n * active: { url: \"https://example.com/active-icon.svg\", alt: \"Active Icon\" },\n * inactive: { url: \"https://example.com/inactive-icon.svg\", alt: \"Inactive Icon\" }\n * }\n */\n icon?: StateIcon\n /** \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */\n items: {\n /** \u56FE\u6807 (SVG \u5B57\u7B26\u4E32\u6216 URL) */\n icon?: Media\n /** \u6587\u672C\u5185\u5BB9 */\n label: string\n }[]\n}\n\n/**\n * EventSchedule \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleData {\n /** \u65E5\u7A0B\u5217\u8868 */\n scheduleList: EventScheduleItem[]\n /** \u662F\u5426\u663E\u793A\u65F6\u95F4\u8F74\uFF0C\u9ED8\u8BA4\u4E3A true */\n showTimeline?: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n}\n\nexport interface EventScheduleProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: EventScheduleData\n classNames?: Partial<Record<EventScheduleSemanticName, string>>\n}\n\n/**\n * \u5224\u65AD\u5F53\u524D\u65F6\u95F4\u662F\u5426\u5728\u6307\u5B9A\u7684\u65F6\u95F4\u533A\u95F4\u5185\n * @param startDate \u5F00\u59CB\u65E5\u671F\n * @param endDate \u7ED3\u675F\u65E5\u671F\n * @returns \u662F\u5426\u5728\u533A\u95F4\u5185\n */\nconst isInTimeRange = (startDate: string, endDate: string): boolean => {\n const now = dayjs()\n const start = dayjs(startDate).startOf('day')\n const end = dayjs(endDate).endOf('day')\n return now.isAfter(start) && now.isBefore(end)\n}\n\n/**\n * \u83B7\u53D6\u6D3B\u52A8\u9879\u7684\u6FC0\u6D3B\u72B6\u6001\n * @param item \u6D3B\u52A8\u9879\n * @returns \u662F\u5426\u6FC0\u6D3B\n */\nconst getItemActiveStatus = (item: EventScheduleItem): boolean => {\n // \u5426\u5219\u6839\u636E\u65F6\u95F4\u533A\u95F4\u81EA\u52A8\u5224\u65AD\n return isInTimeRange(item.startDate, item.endDate)\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8FDB\u5EA6\u6761\u6FC0\u6D3B\u72B6\u6001\u6837\u5F0F\u53D8\u4F53\n */\nconst timelineProgressActiveVariants = cva('h-2 w-full overflow-hidden', {\n variants: {\n state: {\n 'active-light': 'bg-[#F6CD4E]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#75787F]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u6FC0\u6D3B\u72B6\u6001\u6837\u5F0F\u53D8\u4F53\n */\nconst timelineNodeActiveVariants = cva('size-4 rounded-full transition-colors', {\n variants: {\n state: {\n 'active-light': 'bg-[#F6CD4E]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#75787F]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u5361\u7247\u6587\u672C\u6837\u5F0F\u53D8\u4F53\n */\nconst cardTextVariants = cva('font-bold leading-[1.2]', {\n variants: {\n state: {\n 'active-light': 'text-[#080A0F]',\n 'inactive-light': 'text-[#4A4C56]',\n 'active-dark': 'text-white',\n 'inactive-dark': 'text-[#8A8D92]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u5361\u7247\u5BB9\u5668\u6837\u5F0F\u53D8\u4F53\n */\nconst eventScheduleCardVariants = cva(\n 'laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden',\n {\n variants: {\n state: {\n 'active-light': 'bg-[#F4E8BC]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#1E2024]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n }\n)\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6 Props\n */\ninterface TimelineNodeProps {\n /** \u662F\u5426\u6FC0\u6D3B\u72B6\u6001 */\n active: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n /** \u5F53\u524D\u8282\u70B9\u7D22\u5F15 */\n index: number\n /** \u8282\u70B9\u603B\u6570 */\n nodeLength: number\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6\n */\nconst TimelineNode = ({ active, theme = 'light', className, index, nodeLength }: TimelineNodeProps) => {\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const state = `${active ? 'active' : 'inactive'}-${theme}` as\n | 'active-light'\n | 'inactive-light'\n | 'active-dark'\n | 'inactive-dark'\n\n // \u5224\u65AD\u9996\u5C3E\u4F4D\u7F6E\n const isFirst = index === 0\n const isLast = index === nodeLength - 1\n\n return (\n <div className=\"relative my-1 flex h-2 w-full items-center justify-center\">\n {/* \u8FDB\u5EA6\u6761\u80CC\u666F */}\n <div\n className={cn(\n timelineProgressActiveVariants({ state }),\n isFirst && 'rounded-l-full',\n isLast && 'rounded-r-full',\n className\n )}\n />\n {/* \u65F6\u95F4\u8282\u70B9\u5706\u70B9 */}\n <div className=\"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\">\n <div className={timelineNodeActiveVariants({ state })} />\n </div>\n </div>\n )\n}\n\n/**\n * \u6839\u636E\u6FC0\u6D3B\u72B6\u6001\u83B7\u53D6\u5BF9\u5E94\u7684\u56FE\u6807\n * @param icon \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n * @param isActive \u662F\u5426\u6FC0\u6D3B\u72B6\u6001\n * @returns \u56FE\u6807 Media \u5BF9\u8C61\n */\nconst getIconByState = (icon: StateIcon | undefined, isActive: boolean): Media | undefined => {\n if (!icon) return undefined\n return isActive ? icon.active : icon.inactive\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u5361\u7247\u7EC4\u4EF6\n */\nconst EventScheduleCard = ({\n active,\n item,\n theme = 'light',\n className,\n}: {\n active: boolean\n item: EventScheduleItem\n theme?: 'light' | 'dark'\n className?: string\n}) => {\n const currentIcon = React.useMemo(() => {\n return getIconByState(item.icon, active)\n }, [item.icon, active])\n\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const cardState = `${active ? 'active' : 'inactive'}-${theme}` as\n | 'active-light'\n | 'inactive-light'\n | 'active-dark'\n | 'inactive-dark'\n\n return (\n <div className={cn(eventScheduleCardVariants({ state: cardState }), className)}>\n {/* \u80CC\u666F\u56FE\u6807 */}\n {currentIcon && (\n <div className=\"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]\">\n <Picture source={currentIcon.url} alt={currentIcon.alt} className=\"aspect-square\" />\n </div>\n )}\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"tablet:px-4 tablet:py-3 laptop:p-4 desktop:px-6 relative z-20 flex h-full flex-col justify-between px-6 py-4\">\n <Heading\n html={item.title}\n className={cn(\n 'desktop:text-[32px] laptop:text-[24px] line-clamp-1 text-[20px]',\n cardTextVariants({ state: cardState })\n )}\n />\n {/* \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */}\n <div className=\"flex flex-col gap-0.5\">\n {item.items.map((detail, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n {/* \u56FE\u6807 */}\n {detail.icon && (\n <div className=\"desktop:size-6 size-5 shrink-0\">\n <Picture source={detail.icon.url} alt={detail.icon.alt} className=\"size-full\" />\n </div>\n )}\n {/* \u6587\u672C */}\n <Text\n html={detail.label}\n className={cn(\n 'lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]',\n cardTextVariants({ state: cardState })\n )}\n />\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * EventSchedule - \u6D3B\u52A8\u65E5\u7A0B\u7EC4\u4EF6\n *\n * @description \u663E\u793A\u6D3B\u52A8\u65E5\u7A0B\u65F6\u95F4\u8F74\u548C\u6D3B\u52A8\u5361\u7247\u5217\u8868\n */\nconst EventSchedule = React.forwardRef<HTMLDivElement, EventScheduleProps>(({ classNames = {}, data }, ref) => {\n const theme = data.theme || 'light'\n const swiperRef = React.useRef<SwiperType | null>(null)\n const timelineSwiperRef = React.useRef<SwiperType | null>(null)\n const isSyncingRef = React.useRef(false) // \u9632\u6B62\u5FAA\u73AF\u89E6\u53D1\n const itemsPerRow = React.useMemo(() => {\n return data?.scheduleList?.length || 2\n }, [data?.scheduleList])\n\n // \u8BA1\u7B97 active item \u7684\u7D22\u5F15\n const activeIndex = React.useMemo(() => {\n return data.scheduleList.findIndex(item => getItemActiveStatus(item))\n }, [data.scheduleList])\n\n /**\n * \u751F\u6210\u7EDF\u4E00\u7684 Swiper \u65AD\u70B9\u914D\u7F6E\n * @param itemsPerRow \u6BCF\u884C\u663E\u793A\u7684\u9879\u76EE\u6570\n * @param withSpaceBetween \u662F\u5426\u5305\u542B\u95F4\u8DDD\u914D\u7F6E\n * @returns Swiper \u65AD\u70B9\u914D\u7F6E\u5BF9\u8C61\n */\n const generateSwiperBreakpoints = React.useCallback((itemsPerRow: number, withSpaceBetween: boolean = false) => {\n // \u6839\u636E itemsPerRow \u786E\u5B9A\u4E0D\u540C\u65AD\u70B9\u4E0B\u7684 slidesPerView\n const getBreakpointConfig = (breakpoint: 'mobile' | 'tablet' | 'laptop' | 'desktop') => {\n switch (breakpoint) {\n case 'mobile':\n return { slidesPerView: 1.17 }\n case 'tablet':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: 2.4 }\n case 'laptop':\n if (itemsPerRow === 2) return {}\n if (itemsPerRow === 4) return { slidesPerView: 3.2 }\n return { slidesPerView: itemsPerRow }\n case 'desktop':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: itemsPerRow }\n }\n }\n\n const mobileConfig = getBreakpointConfig('mobile')\n const tabletConfig = getBreakpointConfig('tablet')\n const laptopConfig = getBreakpointConfig('laptop')\n const desktopConfig = getBreakpointConfig('desktop')\n\n // \u5982\u679C\u9700\u8981 spaceBetween\uFF0C\u5219\u6DFB\u52A0\u5230\u914D\u7F6E\u4E2D\n if (withSpaceBetween) {\n return {\n 0: { ...mobileConfig, spaceBetween: 12 },\n 768: { ...tabletConfig, spaceBetween: itemsPerRow === 1 ? 12 : undefined },\n 1024: { ...laptopConfig, spaceBetween: 16 },\n 1440: { ...desktopConfig, spaceBetween: 16 },\n }\n }\n\n return {\n 0: mobileConfig,\n 768: tabletConfig,\n 1024: laptopConfig,\n 1440: desktopConfig,\n }\n }, [])\n\n // \u6839\u636E itemsPerRow \u914D\u7F6E\u54CD\u5E94\u5F0F\u65AD\u70B9\uFF08\u5361\u7247 Swiper - \u5305\u542B\u95F4\u8DDD\uFF09\n const swiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, true)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n // \u65F6\u95F4\u8F74 Swiper \u65AD\u70B9\u914D\u7F6E\uFF08\u4E0D\u5305\u542B\u95F4\u8DDD\uFF09\n const timeNodeSwiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, false)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n const showTimeline = data.showTimeline !== false // \u9ED8\u8BA4\u4E3A true\n\n // \u540C\u6B65\u4E24\u4E2A Swiper \u7684\u6ED1\u52A8\n const handleCardSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !timelineSwiperRef.current) return\n isSyncingRef.current = true\n timelineSwiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n const handleTimelineSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !swiperRef.current) return\n isSyncingRef.current = true\n swiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n // \u81EA\u52A8\u6EDA\u52A8\u5230 active item\n React.useEffect(() => {\n if (swiperRef.current && timelineSwiperRef.current && activeIndex >= 0) {\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u786E\u4FDD Swiper \u5DF2\u7ECF\u5B8C\u5168\u521D\u59CB\u5316\n setTimeout(() => {\n isSyncingRef.current = true\n swiperRef.current?.slideTo(activeIndex, 500)\n timelineSwiperRef.current?.slideTo(activeIndex, 500)\n setTimeout(() => {\n isSyncingRef.current = false\n }, 600)\n }, 100)\n }\n }, [activeIndex])\n\n return (\n <div\n ref={ref}\n className={cn(\n 'tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] overflow-hidden px-4',\n classNames?.root\n )}\n >\n {showTimeline && (\n <Swiper\n breakpoints={timeNodeSwiperBreakpoints}\n className=\"h-4 w-full !overflow-visible\"\n onSwiper={swiper => {\n timelineSwiperRef.current = swiper\n }}\n onSlideChange={handleTimelineSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const isActive = getItemActiveStatus(item)\n return (\n <SwiperSlide key={'timelineNode' + index} className=\"\">\n <TimelineNode\n className={classNames?.timeline}\n active={isActive}\n theme={theme}\n index={index}\n nodeLength={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n )}\n <Swiper\n breakpoints={swiperBreakpoints}\n className=\"w-full !overflow-visible\"\n onSwiper={swiper => {\n swiperRef.current = swiper\n }}\n onSlideChange={handleCardSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const isActive = getItemActiveStatus(item)\n return (\n <SwiperSlide key={'SwiperSlideItem' + index}>\n <EventScheduleCard\n active={isActive}\n className={cn(showTimeline ? 'laptop:mt-4 mt-2' : '', classNames?.eventScheduleCard)}\n item={item}\n theme={theme}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n </div>\n )\n})\n\nEventSchedule.displayName = 'EventSchedule'\nexport default EventSchedule\n\n// \u5BFC\u51FA\u7C7B\u578B\u4F9B\u5916\u90E8\u4F7F\u7528\n// export type { StateIcon, EventScheduleItem, EventScheduleData, EventScheduleProps }\n"],
5
- "mappings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B,EAAG,GAAG,CACR,EAAG,GAAG,CAEV,EAAG,CAACE,CAAW,CAAC,EAGd9C,EAAC,OACC,IAAKyC,EACL,UAAWvC,EACT,8FACAqC,GAAY,IACd,EAEC,UAAAkB,GACC1D,EAACO,EAAA,CACC,YAAakD,EACb,UAAU,+BACV,SAAUG,GAAU,CAClBhB,EAAkB,QAAUgB,CAC9B,EACA,cAAeC,EAEd,SAAApB,EAAK,aAAa,IAAI,CAACvB,EAAMS,IAAU,CACtC,MAAMO,EAAWjB,EAAoBC,CAAI,EACzC,OACElB,EAACQ,EAAA,CAAyC,UAAU,GAClD,SAAAR,EAACuB,EAAA,CACC,UAAWiB,GAAY,SACvB,OAAQN,EACR,MAAOT,EACP,MAAOE,EACP,WAAYc,EAAK,aAAa,OAChC,GAPgB,eAAiBd,CAQnC,CAEJ,CAAC,EACH,EAEF3B,EAACO,EAAA,CACC,YAAaiD,EACb,UAAU,2BACV,SAAUI,GAAU,CAClBjB,EAAU,QAAUiB,CACtB,EACA,cAAeD,EAEd,SAAAlB,EAAK,aAAa,IAAI,CAACvB,EAAMS,IAAU,CACtC,MAAMO,EAAWjB,EAAoBC,CAAI,EACzC,OACElB,EAACQ,EAAA,CACC,SAAAR,EAACmC,EAAA,CACC,OAAQD,EACR,UAAW/B,EAAGuD,EAAe,mBAAqB,GAAIlB,GAAY,iBAAiB,EACnF,KAAMtB,EACN,MAAOO,EACT,GANgB,kBAAoBE,CAOtC,CAEJ,CAAC,EACH,GACF,CAEJ,CAAC,EAEDY,EAAc,YAAc,gBAC5B,IAAOuB,EAAQvB",
6
- "names": ["jsx", "jsxs", "React", "cn", "Text", "Picture", "Heading", "Swiper", "SwiperSlide", "dayjs", "cva", "isInTimeRange", "startDate", "endDate", "now", "start", "end", "getItemActiveStatus", "item", "timelineProgressActiveVariants", "timelineNodeActiveVariants", "cardTextVariants", "eventScheduleCardVariants", "TimelineNode", "active", "theme", "className", "index", "nodeLength", "state", "isFirst", "isLast", "getIconByState", "icon", "isActive", "EventScheduleCard", "currentIcon", "cardState", "detail", "EventSchedule", "classNames", "data", "ref", "swiperRef", "timelineSwiperRef", "isSyncingRef", "itemsPerRow", "activeIndex", "generateSwiperBreakpoints", "withSpaceBetween", "getBreakpointConfig", "breakpoint", "mobileConfig", "tabletConfig", "laptopConfig", "desktopConfig", "swiperBreakpoints", "timeNodeSwiperBreakpoints", "showTimeline", "handleCardSwiperSlideChange", "swiper", "handleTimelineSwiperSlideChange", "EventSchedule_default"]
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Text, Picture, Heading } from '../../components/index.js'\nimport { Swiper, SwiperSlide } from 'swiper/react'\nimport type { Swiper as SwiperType } from 'swiper'\nimport dayjs from 'dayjs'\nimport { cva } from 'class-variance-authority'\nimport type { Media } from '../../types/props.js'\nexport type EventScheduleSemanticName = 'root' | 'timeline' | 'eventScheduleCard'\n\n/**\n * \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n */\nexport interface StateIcon {\n /** \u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807 */\n active: Media\n /** \u975E\u6FC0\u6D3B\u72B6\u6001\u7684\u56FE\u6807 */\n inactive: Media\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u9879\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleItem {\n /** \u6807\u9898 */\n title: string\n /** \u5F00\u59CB\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-01'\uFF09 */\n startDate: string\n /** \u7ED3\u675F\u65E5\u671F\uFF08ISO 8601 \u683C\u5F0F\u6216\u4EFB\u4F55 dayjs \u652F\u6301\u7684\u683C\u5F0F\uFF0C\u5982 '2024-12-31'\uFF09 */\n endDate: string\n /**\n * \u5361\u7247\u80CC\u666F\u56FE\u6807\u914D\u7F6E\uFF0C\u72B6\u6001\u5316\u56FE\u6807\uFF08\u5FC5\u987B\u5305\u542B active \u548C inactive\uFF09\n *\n * @example\n * icon: {\n * active: { url: \"https://example.com/active-icon.svg\", alt: \"Active Icon\" },\n * inactive: { url: \"https://example.com/inactive-icon.svg\", alt: \"Inactive Icon\" }\n * }\n */\n icon?: StateIcon\n /** \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */\n items: {\n /** \u56FE\u6807 (SVG \u5B57\u7B26\u4E32\u6216 URL) */\n icon?: Media\n /** \u6587\u672C\u5185\u5BB9 */\n label: string\n }[]\n}\n\n/**\n * EventSchedule \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface EventScheduleData {\n /** \u65E5\u7A0B\u5217\u8868 */\n scheduleList: EventScheduleItem[]\n /** \u662F\u5426\u663E\u793A\u65F6\u95F4\u8F74\uFF0C\u9ED8\u8BA4\u4E3A true */\n showTimeline?: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n}\n\nexport interface EventScheduleProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: EventScheduleData\n classNames?: Partial<Record<EventScheduleSemanticName, string>>\n}\n\n/**\n * \u5224\u65AD\u5F53\u524D\u65F6\u95F4\u662F\u5426\u5728\u6307\u5B9A\u7684\u65F6\u95F4\u533A\u95F4\u5185\n * @param startDate \u5F00\u59CB\u65E5\u671F\n * @param endDate \u7ED3\u675F\u65E5\u671F\n * @returns \u662F\u5426\u5728\u533A\u95F4\u5185\n */\nconst isInTimeRange = (startDate: string, endDate: string): boolean => {\n const now = dayjs()\n const start = dayjs(startDate).startOf('day')\n const end = dayjs(endDate).endOf('day')\n return now.isAfter(start) && now.isBefore(end)\n}\n\n/**\n * \u83B7\u53D6\u6D3B\u52A8\u9879\u7684\u6FC0\u6D3B\u72B6\u6001\n * @param item \u6D3B\u52A8\u9879\n * @returns \u662F\u5426\u6FC0\u6D3B\n */\nconst getItemActiveStatus = (item: EventScheduleItem): boolean => {\n // \u5426\u5219\u6839\u636E\u65F6\u95F4\u533A\u95F4\u81EA\u52A8\u5224\u65AD\n return isInTimeRange(item.startDate, item.endDate)\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8FDB\u5EA6\u6761\u6FC0\u6D3B\u72B6\u6001\u6837\u5F0F\u53D8\u4F53\n */\nconst timelineProgressActiveVariants = cva('h-1 w-full overflow-hidden', {\n variants: {\n state: {\n 'active-light': 'bg-[#F6CD4E]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#75787F]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u6FC0\u6D3B\u72B6\u6001\u6837\u5F0F\u53D8\u4F53\n */\nconst timelineNodeActiveVariants = cva('size-4 rounded-full transition-colors', {\n variants: {\n state: {\n 'active-light': 'bg-[#F6CD4E]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#75787F]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u5361\u7247\u6587\u672C\u6837\u5F0F\u53D8\u4F53\n */\nconst cardTextVariants = cva('font-bold leading-[1.2]', {\n variants: {\n state: {\n 'active-light': 'text-[#080A0F]',\n 'inactive-light': 'text-[#4A4C56]',\n 'active-dark': 'text-white',\n 'inactive-dark': 'text-[#8A8D92]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n})\n\n/**\n * \u5361\u7247\u5BB9\u5668\u6837\u5F0F\u53D8\u4F53\n */\nconst eventScheduleCardVariants = cva(\n 'laptop:h-[160px] rounded-box relative flex h-[120px] min-w-0 flex-col justify-between gap-2 overflow-hidden',\n {\n variants: {\n state: {\n 'active-light': 'bg-[#F4E8BC]',\n 'inactive-light': 'bg-[#EAEAEC]',\n 'active-dark': 'bg-[#D79941]',\n 'inactive-dark': 'bg-[#1E2024]',\n },\n },\n defaultVariants: {\n state: 'inactive-light',\n },\n }\n)\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6 Props\n */\ninterface TimelineNodeProps {\n /** \u662F\u5426\u6FC0\u6D3B\u72B6\u6001 */\n active: boolean\n /** \u4E3B\u9898\u6A21\u5F0F */\n theme?: 'light' | 'dark'\n /** \u81EA\u5B9A\u4E49\u7C7B\u540D */\n className?: string\n /** \u5F53\u524D\u8282\u70B9\u7D22\u5F15 */\n index: number\n /** \u8282\u70B9\u603B\u6570 */\n nodeLength: number\n}\n\n/**\n * \u65F6\u95F4\u8F74\u8282\u70B9\u7EC4\u4EF6\n */\nconst TimelineNode = ({ active, theme = 'light', className, index, nodeLength }: TimelineNodeProps) => {\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const state = `${active ? 'active' : 'inactive'}-${theme}` as\n | 'active-light'\n | 'inactive-light'\n | 'active-dark'\n | 'inactive-dark'\n\n // \u5224\u65AD\u9996\u5C3E\u4F4D\u7F6E\n const isFirst = index === 0\n const isLast = index === nodeLength - 1\n\n return (\n <div className=\"relative my-2 flex h-1 w-full items-center justify-center\">\n {/* \u8FDB\u5EA6\u6761\u80CC\u666F */}\n <div\n className={cn(\n timelineProgressActiveVariants({ state }),\n isFirst && 'rounded-l-full',\n isLast && 'rounded-r-full',\n className\n )}\n />\n {/* \u65F6\u95F4\u8282\u70B9\u5706\u70B9 */}\n <div className=\"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2\">\n <div className={timelineNodeActiveVariants({ state })} />\n </div>\n </div>\n )\n}\n\n/**\n * \u6839\u636E\u6FC0\u6D3B\u72B6\u6001\u83B7\u53D6\u5BF9\u5E94\u7684\u56FE\u6807\n * @param icon \u72B6\u6001\u5316\u56FE\u6807\u914D\u7F6E\n * @param isActive \u662F\u5426\u6FC0\u6D3B\u72B6\u6001\n * @returns \u56FE\u6807 Media \u5BF9\u8C61\n */\nconst getIconByState = (icon: StateIcon | undefined, isActive: boolean): Media | undefined => {\n if (!icon) return undefined\n return isActive ? icon.active : icon.inactive\n}\n\n/**\n * \u6D3B\u52A8\u65E5\u7A0B\u5361\u7247\u7EC4\u4EF6\n */\nconst EventScheduleCard = ({\n active,\n item,\n theme = 'light',\n className,\n scheduleCount,\n}: {\n active: boolean\n item: EventScheduleItem\n theme?: 'light' | 'dark'\n className?: string\n scheduleCount: number\n}) => {\n const currentIcon = React.useMemo(() => {\n return getIconByState(item.icon, active)\n }, [item.icon, active])\n\n // \u8BA1\u7B97\u7EC4\u5408\u72B6\u6001\n const cardState = `${active ? 'active' : 'inactive'}-${theme}` as\n | 'active-light'\n | 'inactive-light'\n | 'active-dark'\n | 'inactive-dark'\n\n return (\n <div className={cn(eventScheduleCardVariants({ state: cardState }), className)}>\n {/* \u80CC\u666F\u56FE\u6807 */}\n {currentIcon && (\n <div className=\"laptop:w-[128px] desktop:w-[160px] absolute bottom-0 right-0 z-10 w-[120px]\">\n <Picture source={currentIcon.url} alt={currentIcon.alt} className=\"aspect-square\" />\n </div>\n )}\n {/* \u5185\u5BB9\u533A\u57DF */}\n <div className=\"tablet:px-4 tablet:py-3 desktop:pl-6 desktop:pr-16 relative z-20 flex h-full flex-col justify-between p-4 pr-8\">\n <Heading\n html={item.title}\n className={cn(\n scheduleCount >= 4 ? 'desktop:text-[24px]' : 'desktop:text-[32px]',\n 'laptop:text-[24px] line-clamp-1 text-[20px]',\n cardTextVariants({ state: cardState })\n )}\n />\n {/* \u8BE6\u7EC6\u4FE1\u606F\u5217\u8868 */}\n <div className=\"flex flex-col gap-0.5\">\n {item.items.map((detail, index) => (\n <div key={index} className=\"flex items-center gap-2\">\n {/* \u56FE\u6807 */}\n {detail.icon && (\n <div className=\"desktop:size-6 size-5 shrink-0\">\n <Picture source={detail.icon.url} alt={detail.icon.alt} className=\"size-full\" />\n </div>\n )}\n {/* \u6587\u672C */}\n <Text\n html={detail.label}\n className={cn(\n 'lg-desktop:text-[18px] desktop:text-[16px] line-clamp-1 flex-1 text-[14px] leading-[1.4]',\n cardTextVariants({ state: cardState })\n )}\n />\n </div>\n ))}\n </div>\n </div>\n </div>\n )\n}\n\n/**\n * EventSchedule - \u6D3B\u52A8\u65E5\u7A0B\u7EC4\u4EF6\n *\n * @description \u663E\u793A\u6D3B\u52A8\u65E5\u7A0B\u65F6\u95F4\u8F74\u548C\u6D3B\u52A8\u5361\u7247\u5217\u8868\n */\nconst EventSchedule = React.forwardRef<HTMLDivElement, EventScheduleProps>(({ classNames = {}, data }, ref) => {\n const theme = data.theme || 'light'\n const swiperRef = React.useRef<SwiperType | null>(null)\n const timelineSwiperRef = React.useRef<SwiperType | null>(null)\n const isSyncingRef = React.useRef(false) // \u9632\u6B62\u5FAA\u73AF\u89E6\u53D1\n const itemsPerRow = React.useMemo(() => {\n return data?.scheduleList?.length || 2\n }, [data?.scheduleList])\n\n // \u8BA1\u7B97 active item \u7684\u7D22\u5F15\n const activeIndex = React.useMemo(() => {\n return data.scheduleList.findIndex(item => getItemActiveStatus(item))\n }, [data.scheduleList])\n\n /**\n * \u751F\u6210\u7EDF\u4E00\u7684 Swiper \u65AD\u70B9\u914D\u7F6E\n * @param itemsPerRow \u6BCF\u884C\u663E\u793A\u7684\u9879\u76EE\u6570\n * @param withSpaceBetween \u662F\u5426\u5305\u542B\u95F4\u8DDD\u914D\u7F6E\n * @returns Swiper \u65AD\u70B9\u914D\u7F6E\u5BF9\u8C61\n */\n const generateSwiperBreakpoints = React.useCallback((itemsPerRow: number, withSpaceBetween: boolean = false) => {\n // \u6839\u636E itemsPerRow \u786E\u5B9A\u4E0D\u540C\u65AD\u70B9\u4E0B\u7684 slidesPerView\n const getBreakpointConfig = (breakpoint: 'mobile' | 'tablet' | 'laptop' | 'desktop') => {\n switch (breakpoint) {\n case 'mobile':\n return { slidesPerView: 1.17 }\n case 'tablet':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: 2.4 }\n case 'laptop':\n if (itemsPerRow === 2) return {}\n if (itemsPerRow === 4) return { slidesPerView: 3.2 }\n return { slidesPerView: itemsPerRow }\n case 'desktop':\n if (itemsPerRow === 2) return { slidesPerView: 2 }\n return { slidesPerView: itemsPerRow }\n }\n }\n\n const mobileConfig = getBreakpointConfig('mobile')\n const tabletConfig = getBreakpointConfig('tablet')\n const laptopConfig = getBreakpointConfig('laptop')\n const desktopConfig = getBreakpointConfig('desktop')\n\n // \u5982\u679C\u9700\u8981 spaceBetween\uFF0C\u5219\u6DFB\u52A0\u5230\u914D\u7F6E\u4E2D\n if (withSpaceBetween) {\n return {\n 0: { ...mobileConfig, spaceBetween: 12 },\n 768: { ...tabletConfig, spaceBetween: itemsPerRow === 1 ? 12 : undefined },\n 1024: { ...laptopConfig, spaceBetween: 16 },\n 1440: { ...desktopConfig, spaceBetween: 16 },\n }\n }\n\n return {\n 0: mobileConfig,\n 768: tabletConfig,\n 1024: laptopConfig,\n 1440: desktopConfig,\n }\n }, [])\n\n // \u6839\u636E itemsPerRow \u914D\u7F6E\u54CD\u5E94\u5F0F\u65AD\u70B9\uFF08\u5361\u7247 Swiper - \u5305\u542B\u95F4\u8DDD\uFF09\n const swiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, true)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n // \u65F6\u95F4\u8F74 Swiper \u65AD\u70B9\u914D\u7F6E\uFF08\u4E0D\u5305\u542B\u95F4\u8DDD\uFF09\n const timeNodeSwiperBreakpoints = React.useMemo(() => {\n return generateSwiperBreakpoints(itemsPerRow, false)\n }, [itemsPerRow, generateSwiperBreakpoints])\n\n const showTimeline = data.showTimeline !== false // \u9ED8\u8BA4\u4E3A true\n\n // \u540C\u6B65\u4E24\u4E2A Swiper \u7684\u6ED1\u52A8\n const handleCardSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !timelineSwiperRef.current) return\n isSyncingRef.current = true\n timelineSwiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n const handleTimelineSwiperSlideChange = React.useCallback((swiper: SwiperType) => {\n if (isSyncingRef.current || !swiperRef.current) return\n isSyncingRef.current = true\n swiperRef.current.slideTo(swiper.activeIndex, swiper.params.speed)\n // \u5EF6\u8FDF\u91CD\u7F6E\u6807\u5FD7\uFF0C\u786E\u4FDD\u540C\u6B65\u5B8C\u6210\n setTimeout(() => {\n isSyncingRef.current = false\n }, 50)\n }, [])\n\n // \u81EA\u52A8\u6EDA\u52A8\u5230 active item\n React.useEffect(() => {\n if (swiperRef.current && timelineSwiperRef.current && activeIndex >= 0) {\n // \u5EF6\u8FDF\u6267\u884C\uFF0C\u786E\u4FDD Swiper \u5DF2\u7ECF\u5B8C\u5168\u521D\u59CB\u5316\n setTimeout(() => {\n isSyncingRef.current = true\n swiperRef.current?.slideTo(activeIndex, 500)\n timelineSwiperRef.current?.slideTo(activeIndex, 500)\n setTimeout(() => {\n isSyncingRef.current = false\n }, 600)\n }, 100)\n }\n }, [activeIndex])\n\n return (\n <div\n ref={ref}\n className={cn(\n 'tablet:px-8 laptop:px-16 desktop:px-16 lg-desktop:px-[calc(50%-832px)] overflow-hidden px-4',\n classNames?.root\n )}\n >\n {showTimeline && (\n <Swiper\n breakpoints={timeNodeSwiperBreakpoints}\n className=\"h-4 w-full !overflow-visible\"\n onSwiper={swiper => {\n timelineSwiperRef.current = swiper\n }}\n onSlideChange={handleTimelineSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const isActive = getItemActiveStatus(item)\n return (\n <SwiperSlide key={'timelineNode' + index} className=\"\">\n <TimelineNode\n className={classNames?.timeline}\n active={isActive}\n theme={theme}\n index={index}\n nodeLength={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n )}\n <Swiper\n breakpoints={swiperBreakpoints}\n className=\"w-full !overflow-visible\"\n onSwiper={swiper => {\n swiperRef.current = swiper\n }}\n onSlideChange={handleCardSwiperSlideChange}\n >\n {data.scheduleList.map((item, index) => {\n const isActive = getItemActiveStatus(item)\n return (\n <SwiperSlide key={'SwiperSlideItem' + index}>\n <EventScheduleCard\n active={isActive}\n className={cn(showTimeline ? 'laptop:mt-4 mt-2' : '', classNames?.eventScheduleCard)}\n item={item}\n theme={theme}\n scheduleCount={data.scheduleList.length}\n />\n </SwiperSlide>\n )\n })}\n </Swiper>\n </div>\n )\n})\n\nEventSchedule.displayName = 'EventSchedule'\nexport default EventSchedule\n\n// \u5BFC\u51FA\u7C7B\u578B\u4F9B\u5916\u90E8\u4F7F\u7528\n// export type { StateIcon, EventScheduleItem, EventScheduleData, EventScheduleProps }\n"],
5
+ "mappings": "aAmMI,OAEE,OAAAA,EAFF,QAAAC,MAAA,oBAjMJ,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAS,QAAAC,EAAM,WAAAC,EAAS,WAAAC,MAAe,4BACvC,OAAS,UAAAC,EAAQ,eAAAC,MAAmB,eAEpC,OAAOC,MAAW,QAClB,OAAS,OAAAC,MAAW,2BAmEpB,MAAMC,EAAgB,CAACC,EAAmBC,IAA6B,CACrE,MAAMC,EAAML,EAAM,EACZM,EAAQN,EAAMG,CAAS,EAAE,QAAQ,KAAK,EACtCI,EAAMP,EAAMI,CAAO,EAAE,MAAM,KAAK,EACtC,OAAOC,EAAI,QAAQC,CAAK,GAAKD,EAAI,SAASE,CAAG,CAC/C,EAOMC,EAAuBC,GAEpBP,EAAcO,EAAK,UAAWA,EAAK,OAAO,EAM7CC,EAAiCT,EAAI,8BAA+B,CACxE,SAAU,CACR,MAAO,CACL,eAAgB,eAChB,iBAAkB,eAClB,cAAe,eACf,gBAAiB,cACnB,CACF,EACA,gBAAiB,CACf,MAAO,gBACT,CACF,CAAC,EAKKU,EAA6BV,EAAI,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AAK,aAAa,IAAI,CAACxB,EAAMS,IAAU,CACtC,MAAMO,EAAWjB,EAAoBC,CAAI,EACzC,OACElB,EAACQ,EAAA,CACC,SAAAR,EAACmC,EAAA,CACC,OAAQD,EACR,UAAW/B,EAAGwD,EAAe,mBAAqB,GAAIlB,GAAY,iBAAiB,EACnF,KAAMvB,EACN,MAAOO,EACP,cAAeiB,EAAK,aAAa,OACnC,GAPgB,kBAAoBf,CAQtC,CAEJ,CAAC,EACH,GACF,CAEJ,CAAC,EAEDa,EAAc,YAAc,gBAC5B,IAAOuB,EAAQvB",
6
+ "names": ["jsx", "jsxs", "React", "cn", "Text", "Picture", "Heading", "Swiper", "SwiperSlide", "dayjs", "cva", "isInTimeRange", "startDate", "endDate", "now", "start", "end", "getItemActiveStatus", "item", "timelineProgressActiveVariants", "timelineNodeActiveVariants", "cardTextVariants", "eventScheduleCardVariants", "TimelineNode", "active", "theme", "className", "index", "nodeLength", "state", "isFirst", "isLast", "getIconByState", "icon", "isActive", "EventScheduleCard", "scheduleCount", "currentIcon", "cardState", "detail", "EventSchedule", "classNames", "data", "ref", "swiperRef", "timelineSwiperRef", "isSyncingRef", "itemsPerRow", "activeIndex", "generateSwiperBreakpoints", "withSpaceBetween", "getBreakpointConfig", "breakpoint", "mobileConfig", "tabletConfig", "laptopConfig", "desktopConfig", "swiperBreakpoints", "timeNodeSwiperBreakpoints", "showTimeline", "handleCardSwiperSlideChange", "swiper", "handleTimelineSwiperSlideChange", "EventSchedule_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as a,jsxs as g}from"react/jsx-runtime";import*as f from"react";import{cn as s}from"../../helpers/index.js";import{Heading as v,Button as k,Picture as B}from"../../components/index.js";import{withLayout as M}from"../../shared/Styles.js";const P=o=>{if(!o)return;const{mobile:e,tablet:u,laptop:c,desktop:d,lgDesktop:b}=o,t=[],l=h=>h?.url,i=l(b),n=l(d),r=l(c),p=l(u),m=l(e);return i?t.push(i):n?t.push(n):r?t.push(r):p?t.push(p):m&&t.push(m),n&&i&&t.push(`${n} 1920`),r&&(n||i)&&t.push(`${r} 1440`),p&&(r||n||i)&&t.push(`${p} 1024`),m&&(p||r||n||i)&&t.push(`${m} 768`),t.length>0?t.join(", "):void 0},x=f.forwardRef(({classNames:o,data:e},u)=>{const{backgroundImage:c}=e,d=f.useMemo(()=>P(c),[c]);return a("div",{ref:u,className:s("laptop:h-[192px] lg-desktop:h-[240px] h-[240px]",o?.root),children:g("div",{className:"promotional-bar-content rounded-box relative h-full overflow-hidden",children:[g("div",{className:s("laptop:px-8 laptop:justify-center lg-desktop:max-w-[620px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4",o?.content),children:[e.contentTitle&&a(v,{className:s("line-clamp-2 text-[#F5F6F7]",o?.title),html:e.contentTitle,size:3}),e.contentDesc&&a("p",{className:s("laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] text-[#F5F6F7]",o?.description),dangerouslySetInnerHTML:{__html:e.contentDesc}}),a("div",{className:"laptop:mt-4 mt-2",children:e.buttonText&&a(k,{as:"a",variant:"link",className:s("!p-0 text-[#F5F6F7]",o?.button),href:e.buttonLink,children:e.buttonText})})]}),a(B,{source:d,className:"absolute inset-0 z-10 ",imgClassName:"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]"})]})})});x.displayName="PromotionalBar";var N=M(x);export{N as default};
1
+ "use client";import{jsx as a,jsxs as x}from"react/jsx-runtime";import*as f from"react";import{cn as p}from"../../helpers/index.js";import{Heading as v,Button as k,Picture as B}from"../../components/index.js";import{withLayout as M}from"../../shared/Styles.js";const P=o=>{if(!o)return;const{mobile:e,tablet:u,laptop:c,desktop:d,lgDesktop:h}=o,t=[],s=b=>b?.url,i=s(h),n=s(d),r=s(c),l=s(u),m=s(e);return i?t.push(i):n?t.push(n):r?t.push(r):l?t.push(l):m&&t.push(m),n&&i&&t.push(`${n} 1920`),r&&(n||i)&&t.push(`${r} 1440`),l&&(r||n||i)&&t.push(`${l} 1024`),m&&(l||r||n||i)&&t.push(`${m} 768`),t.length>0?t.join(", "):void 0},g=f.forwardRef(({classNames:o,data:e},u)=>{const{backgroundImage:c}=e,d=f.useMemo(()=>P(c),[c]);return a("div",{ref:u,className:p("laptop:h-[192px] lg-desktop:h-[240px] h-[240px]",o?.root),children:x("div",{className:"promotional-bar-content rounded-card relative h-full overflow-hidden",children:[x("div",{className:p("laptop:px-8 laptop:justify-center lg-desktop:max-w-[620px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4",o?.content),children:[e.contentTitle&&a(v,{className:p("line-clamp-2 text-[#F5F6F7]",o?.title),html:e.contentTitle,size:3}),e.contentDesc&&a("p",{className:p("laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] text-[#F5F6F7]",o?.description),dangerouslySetInnerHTML:{__html:e.contentDesc}}),a("div",{className:"laptop:mt-4 mt-2",children:e.buttonText&&a(k,{as:"a",variant:"link",className:p("!p-0 text-[#F5F6F7]",o?.button),href:e.buttonLink,iconClassName:"size-4",children:e.buttonText})})]}),a(B,{source:d,className:"absolute inset-0 z-10 ",imgClassName:"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]"})]})})});g.displayName="PromotionalBar";var F=M(g);export{F as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/PromotionalBar/index.tsx"],
4
- "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Heading, Button, Picture } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { Media } from '../../types/props.js'\n\nexport interface PromotionalBarSemanticName {\n root: 'root'\n content: 'content'\n title: 'title'\n description: 'description'\n button: 'button'\n}\n\n/**\n * \u54CD\u5E94\u5F0F\u80CC\u666F\u56FE\u7247\u914D\u7F6E\n */\nexport interface ResponsiveBackgroundImage {\n /** \u79FB\u52A8\u7AEF\u56FE\u7247 (<768px) */\n mobile?: Media\n /** \u5E73\u677F\u56FE\u7247 (768-1440px) */\n tablet?: Media\n /** \u7B14\u8BB0\u672C\u56FE\u7247 (1025-1440px) */\n laptop?: Media\n /** \u684C\u9762\u56FE\u7247 (1441-1920px) */\n desktop?: Media\n /** \u8D85\u5927\u684C\u9762\u56FE\u7247 (\u22651921px) */\n lgDesktop?: Media\n}\n\n/**\n * PromotionalBar \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface PromotionalBarData {\n /** \u7EC4\u4EF6\u5185\u5BB9\u6807\u9898 */\n contentTitle?: string\n /** \u7EC4\u4EF6\u5185\u5BB9\u63CF\u8FF0 */\n contentDesc?: string\n /** \u6309\u94AE\u6587\u672C */\n buttonText?: string\n /** \u6309\u94AE\u94FE\u63A5 */\n buttonLink?: string\n /** \u80CC\u666F\u56FE\u7247 - \u54CD\u5E94\u5F0F\u56FE\u7247\u5BF9\u8C61 */\n backgroundImage?: ResponsiveBackgroundImage\n}\n\nexport interface PromotionalBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: PromotionalBarData\n classNames?: Partial<Record<keyof PromotionalBarSemanticName, string>>\n}\n\n/**\n * \u5C06\u54CD\u5E94\u5F0F\u80CC\u666F\u56FE\u7247\u5BF9\u8C61\u8F6C\u6362\u4E3A Picture \u7EC4\u4EF6\u6240\u9700\u7684\u5B57\u7B26\u4E32\u683C\u5F0F\n */\nconst convertResponsiveImageToString = (backgroundImage: ResponsiveBackgroundImage | undefined): string | undefined => {\n if (!backgroundImage) return undefined\n\n const { mobile, tablet, laptop, desktop, lgDesktop } = backgroundImage\n const parts: string[] = []\n\n // \u8F85\u52A9\u51FD\u6570\uFF1A\u4ECE Media \u5BF9\u8C61\u4E2D\u63D0\u53D6 URL\n const getUrl = (media: Media | undefined): string | undefined => {\n return media?.url\n }\n\n // \u9ED8\u8BA4\u56FE\u7247\uFF08\u6700\u5927\u5C3A\u5BF8\uFF09\u653E\u5728\u6700\u524D\u9762\uFF0C\u4E0D\u9700\u8981\u65AD\u70B9\n const lgDesktopUrl = getUrl(lgDesktop)\n const desktopUrl = getUrl(desktop)\n const laptopUrl = getUrl(laptop)\n const tabletUrl = getUrl(tablet)\n const mobileUrl = getUrl(mobile)\n\n if (lgDesktopUrl) parts.push(lgDesktopUrl)\n else if (desktopUrl) parts.push(desktopUrl)\n else if (laptopUrl) parts.push(laptopUrl)\n else if (tabletUrl) parts.push(tabletUrl)\n else if (mobileUrl) parts.push(mobileUrl)\n\n // \u6309\u65AD\u70B9\u4ECE\u5927\u5230\u5C0F\u6DFB\u52A0\n if (desktopUrl && lgDesktopUrl) parts.push(`${desktopUrl} 1920`)\n if (laptopUrl && (desktopUrl || lgDesktopUrl)) parts.push(`${laptopUrl} 1440`)\n if (tabletUrl && (laptopUrl || desktopUrl || lgDesktopUrl)) parts.push(`${tabletUrl} 1024`)\n if (mobileUrl && (tabletUrl || laptopUrl || desktopUrl || lgDesktopUrl)) parts.push(`${mobileUrl} 768`)\n\n return parts.length > 0 ? parts.join(', ') : undefined\n}\n\n/**\n * PromotionalBar - \u63A8\u5E7F\u680F\n *\n * @description \u63A8\u5E7F\u680F\n */\nconst PromotionalBar = React.forwardRef<HTMLDivElement, PromotionalBarProps>(({ classNames, data }, ref) => {\n const { backgroundImage } = data\n const pictureSource = React.useMemo(() => {\n return convertResponsiveImageToString(backgroundImage)\n }, [backgroundImage])\n return (\n <div ref={ref} className={cn('laptop:h-[192px] lg-desktop:h-[240px] h-[240px]', classNames?.root)}>\n {/* \u63A8\u5E7F\u680F\u5185\u5BB9\u533A\u57DF - \u6839\u636E\u5177\u4F53\u4E1A\u52A1\u9700\u6C42\u5B9A\u5236 */}\n <div className=\"promotional-bar-content rounded-box relative h-full overflow-hidden\">\n <div\n className={cn(\n 'laptop:px-8 laptop:justify-center lg-desktop:max-w-[620px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4',\n classNames?.content\n )}\n >\n {data.contentTitle && (\n <Heading\n className={cn('line-clamp-2 text-[#F5F6F7]', classNames?.title)}\n html={data.contentTitle}\n size={3}\n />\n )}\n {data.contentDesc && (\n <p\n className={cn(\n 'laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] text-[#F5F6F7]',\n classNames?.description\n )}\n dangerouslySetInnerHTML={{ __html: data.contentDesc }}\n />\n )}\n <div className=\"laptop:mt-4 mt-2\">\n {data.buttonText && (\n <Button\n as=\"a\"\n variant=\"link\"\n className={cn('!p-0 text-[#F5F6F7]', classNames?.button)}\n href={data.buttonLink}\n >\n {data.buttonText}\n </Button>\n )}\n </div>\n </div>\n <Picture\n source={pictureSource}\n className=\"absolute inset-0 z-10 \"\n imgClassName=\"h-full object-cover transition-transform duration-300 ease-in-out hover:scale-[1.05]\"\n />\n </div>\n </div>\n )\n})\n\nPromotionalBar.displayName = 'PromotionalBar'\nexport default withLayout(PromotionalBar)\n"],
5
- "mappings": "aAwGQ,OAOI,OAAAA,EAPJ,QAAAC,MAAA,oBAtGR,UAAYC,MAAW,QACvB,OAAS,MAAAC,MAAU,yBACnB,OAAS,WAAAC,EAAS,UAAAC,EAAQ,WAAAC,MAAe,4BACzC,OAAS,cAAAC,MAAkB,yBAoD3B,MAAMC,EAAkCC,GAA+E,CACrH,GAAI,CAACA,EAAiB,OAEtB,KAAM,CAAE,OAAAC,EAAQ,OAAAC,EAAQ,OAAAC,EAAQ,QAAAC,EAAS,UAAAC,CAAU,EAAIL,EACjDM,EAAkB,CAAC,EAGnBC,EAAUC,GACPA,GAAO,IAIVC,EAAeF,EAAOF,CAA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,mBACZ,SAAAyB,EAAK,YACJzB,EAACK,EAAA,CACC,GAAG,IACH,QAAQ,OACR,UAAWF,EAAG,sBAAuBqB,GAAY,MAAM,EACvD,KAAMC,EAAK,WAEV,SAAAA,EAAK,WACR,EAEJ,GACF,EACAzB,EAACM,EAAA,CACC,OAAQqB,EACR,UAAU,yBACV,aAAa,uFACf,GACF,EACF,CAEJ,CAAC,EAEDJ,EAAe,YAAc,iBAC7B,IAAOK,EAAQrB,EAAWgB,CAAc",
4
+ "sourcesContent": ["'use client'\n\nimport * as React from 'react'\nimport { cn } from '../../helpers/index.js'\nimport { Heading, Button, Picture } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { Media } from '../../types/props.js'\n\nexport interface PromotionalBarSemanticName {\n root: 'root'\n content: 'content'\n title: 'title'\n description: 'description'\n button: 'button'\n}\n\n/**\n * \u54CD\u5E94\u5F0F\u80CC\u666F\u56FE\u7247\u914D\u7F6E\n */\nexport interface ResponsiveBackgroundImage {\n /** \u79FB\u52A8\u7AEF\u56FE\u7247 (<768px) */\n mobile?: Media\n /** \u5E73\u677F\u56FE\u7247 (768-1440px) */\n tablet?: Media\n /** \u7B14\u8BB0\u672C\u56FE\u7247 (1025-1440px) */\n laptop?: Media\n /** \u684C\u9762\u56FE\u7247 (1441-1920px) */\n desktop?: Media\n /** \u8D85\u5927\u684C\u9762\u56FE\u7247 (\u22651921px) */\n lgDesktop?: Media\n}\n\n/**\n * PromotionalBar \u4E1A\u52A1\u7EC4\u4EF6\u6570\u636E\u63A5\u53E3\n */\nexport interface PromotionalBarData {\n /** \u7EC4\u4EF6\u5185\u5BB9\u6807\u9898 */\n contentTitle?: string\n /** \u7EC4\u4EF6\u5185\u5BB9\u63CF\u8FF0 */\n contentDesc?: string\n /** \u6309\u94AE\u6587\u672C */\n buttonText?: string\n /** \u6309\u94AE\u94FE\u63A5 */\n buttonLink?: string\n /** \u80CC\u666F\u56FE\u7247 - \u54CD\u5E94\u5F0F\u56FE\u7247\u5BF9\u8C61 */\n backgroundImage?: ResponsiveBackgroundImage\n}\n\nexport interface PromotionalBarProps extends React.HTMLAttributes<HTMLDivElement> {\n /** \u4E1A\u52A1\u6570\u636E */\n data: PromotionalBarData\n classNames?: Partial<Record<keyof PromotionalBarSemanticName, string>>\n}\n\n/**\n * \u5C06\u54CD\u5E94\u5F0F\u80CC\u666F\u56FE\u7247\u5BF9\u8C61\u8F6C\u6362\u4E3A Picture \u7EC4\u4EF6\u6240\u9700\u7684\u5B57\u7B26\u4E32\u683C\u5F0F\n */\nconst convertResponsiveImageToString = (backgroundImage: ResponsiveBackgroundImage | undefined): string | undefined => {\n if (!backgroundImage) return undefined\n\n const { mobile, tablet, laptop, desktop, lgDesktop } = backgroundImage\n const parts: string[] = []\n\n // \u8F85\u52A9\u51FD\u6570\uFF1A\u4ECE Media \u5BF9\u8C61\u4E2D\u63D0\u53D6 URL\n const getUrl = (media: Media | undefined): string | undefined => {\n return media?.url\n }\n\n // \u9ED8\u8BA4\u56FE\u7247\uFF08\u6700\u5927\u5C3A\u5BF8\uFF09\u653E\u5728\u6700\u524D\u9762\uFF0C\u4E0D\u9700\u8981\u65AD\u70B9\n const lgDesktopUrl = getUrl(lgDesktop)\n const desktopUrl = getUrl(desktop)\n const laptopUrl = getUrl(laptop)\n const tabletUrl = getUrl(tablet)\n const mobileUrl = getUrl(mobile)\n\n if (lgDesktopUrl) parts.push(lgDesktopUrl)\n else if (desktopUrl) parts.push(desktopUrl)\n else if (laptopUrl) parts.push(laptopUrl)\n else if (tabletUrl) parts.push(tabletUrl)\n else if (mobileUrl) parts.push(mobileUrl)\n\n // \u6309\u65AD\u70B9\u4ECE\u5927\u5230\u5C0F\u6DFB\u52A0\n if (desktopUrl && lgDesktopUrl) parts.push(`${desktopUrl} 1920`)\n if (laptopUrl && (desktopUrl || lgDesktopUrl)) parts.push(`${laptopUrl} 1440`)\n if (tabletUrl && (laptopUrl || desktopUrl || lgDesktopUrl)) parts.push(`${tabletUrl} 1024`)\n if (mobileUrl && (tabletUrl || laptopUrl || desktopUrl || lgDesktopUrl)) parts.push(`${mobileUrl} 768`)\n\n return parts.length > 0 ? parts.join(', ') : undefined\n}\n\n/**\n * PromotionalBar - \u63A8\u5E7F\u680F\n *\n * @description \u63A8\u5E7F\u680F\n */\nconst PromotionalBar = React.forwardRef<HTMLDivElement, PromotionalBarProps>(({ classNames, data }, ref) => {\n const { backgroundImage } = data\n const pictureSource = React.useMemo(() => {\n return convertResponsiveImageToString(backgroundImage)\n }, [backgroundImage])\n return (\n <div ref={ref} className={cn('laptop:h-[192px] lg-desktop:h-[240px] h-[240px]', classNames?.root)}>\n {/* \u63A8\u5E7F\u680F\u5185\u5BB9\u533A\u57DF - \u6839\u636E\u5177\u4F53\u4E1A\u52A1\u9700\u6C42\u5B9A\u5236 */}\n <div className=\"promotional-bar-content rounded-card relative h-full overflow-hidden\">\n <div\n className={cn(\n 'laptop:px-8 laptop:justify-center lg-desktop:max-w-[620px] laptop:max-w-[392px] desktop:max-w-[584px] laptop:py-0 tablet:px-8 laptop:pr-0 relative z-20 flex h-full flex-col p-4',\n classNames?.content\n )}\n >\n {data.contentTitle && (\n <Heading\n className={cn('line-clamp-2 text-[#F5F6F7]', classNames?.title)}\n html={data.contentTitle}\n size={3}\n />\n )}\n {data.contentDesc && (\n <p\n className={cn(\n 'laptop:text-[16px] laptop:mt-2 lg-desktop:text-[18px] mt-1 line-clamp-2 text-[14px] font-bold leading-[1.4] text-[#F5F6F7]',\n classNames?.description\n )}\n dangerouslySetInnerHTML={{ __html: data.contentDesc }}\n />\n )}\n <div className=\"laptop:mt-4 mt-2\">\n {data.buttonText && (\n <Button\n as=\"a\"\n variant=\"link\"\n className={cn('!p-0 text-[#F5F6F7]', classNames?.button)}\n href={data.buttonLink}\n iconClassName=\"size-4\"\n >\n {data.buttonText}\n </Button>\n )}\n </div>\n </div>\n <Picture\n source={pictureSource}\n className=\"absolute inset-0 z-10 \"\n imgClassName=\"h-full object-cover transition-transform duration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AAE,gBAAAjB,CAAgB,EAAIgB,EACtBE,EAAgBzB,EAAM,QAAQ,IAC3BM,EAA+BC,CAAe,EACpD,CAACA,CAAe,CAAC,EACpB,OACET,EAAC,OAAI,IAAK0B,EAAK,UAAWvB,EAAG,kDAAmDqB,GAAY,IAAI,EAE9F,SAAAvB,EAAC,OAAI,UAAU,uEACb,UAAAA,EAAC,OACC,UAAWE,EACT,mLACAqB,GAAY,OACd,EAEC,UAAAC,EAAK,cACJzB,EAACI,EAAA,CACC,UAAWD,EAAG,8BAA+BqB,GAAY,KAAK,EAC9D,KAAMC,EAAK,aACX,KAAM,EACR,EAEDA,EAAK,aACJzB,EAAC,KACC,UAAWG,EACT,6HACAqB,GAAY,WACd,EACA,wBAAyB,CAAE,OAAQC,EAAK,WAAY,EACtD,EAEFzB,EAAC,OAAI,UAAU,mBACZ,SAAAyB,EAAK,YACJzB,EAACK,EAAA,CACC,GAAG,IACH,QAAQ,OACR,UAAWF,EAAG,sBAAuBqB,GAAY,MAAM,EACvD,KAAMC,EAAK,WACX,cAAc,SAEb,SAAAA,EAAK,WACR,EAEJ,GACF,EACAzB,EAACM,EAAA,CACC,OAAQqB,EACR,UAAU,yBACV,aAAa,uFACf,GACF,EACF,CAEJ,CAAC,EAEDJ,EAAe,YAAc,iBAC7B,IAAOK,EAAQrB,EAAWgB,CAAc",
6
6
  "names": ["jsx", "jsxs", "React", "cn", "Heading", "Button", "Picture", "withLayout", "convertResponsiveImageToString", "backgroundImage", "mobile", "tablet", "laptop", "desktop", "lgDesktop", "parts", "getUrl", "media", "lgDesktopUrl", "desktopUrl", "laptopUrl", "tabletUrl", "mobileUrl", "PromotionalBar", "classNames", "data", "ref", "pictureSource", "PromotionalBar_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as a,jsxs as T}from"react/jsx-runtime";import g,{useState as N,useEffect as M}from"react";import x from"dayjs";import{cn as h}from"../../helpers/utils.js";import{cva as b}from"class-variance-authority";const y=r=>{const i=x(),t=x(r).diff(i,"second");if(t<=0)return{days:0,hours:0,minutes:0,seconds:0};const m=Math.floor(t/(24*60*60)),l=Math.floor(t%(24*60*60)/(60*60)),f=Math.floor(t%(60*60)/60),p=t%60;return{days:m,hours:l,minutes:f,seconds:p}},S=b("lg-desktop:size-12 lg-desktop:px-1 flex size-10 flex-col items-center justify-center px-[2px] text-center",{variants:{theme:{light:"bg-info-primary",dark:"bg-[#f5f6f7]"}},defaultVariants:{theme:"light"}}),v=b("",{variants:{theme:{light:"text-white",dark:"text-[#080A0F]"}},defaultVariants:{theme:"light"}}),D=({value:r,label:i,theme:e="light"})=>T("div",{className:S({theme:e}),children:[a("p",{className:h("lg-desktop:text-2xl text-[20px] font-bold leading-[1.2] tracking-[-0.96px]",v({theme:e})),children:String(r).padStart(2,"0")}),a("p",{className:h("text-[12px] font-bold leading-[1.4] tracking-[-0.24px]",v({theme:e})),children:i})]}),V=()=>a("p",{className:"lg-desktop:text-2xl text-info-primary text-center text-xl font-bold leading-[1.2] tracking-[-0.96px]",children:":"}),w=g.forwardRef(({config:r,className:i,onCountdownEnd:e,theme:t="light"},m)=>{const{targetDate:l,showDays:f=!0,showHours:p=!0,showMinutes:k=!0,showSeconds:C=!0,labels:u={}}=r,[c,L]=N(()=>y(l));M(()=>{const o=setInterval(()=>{const s=y(l);L(s),s.days===0&&s.hours===0&&s.minutes===0&&s.seconds===0&&(e?.(),clearInterval(o))},1e3);return()=>clearInterval(o)},[l,e]);const d={days:u.days||"Day",hours:u.hours||"Hours",minutes:u.minutes||"Mins",seconds:u.seconds||"Secs"},n=[];return f&&n.push({value:c.days,label:d.days}),p&&n.push({value:c.hours,label:d.hours}),k&&n.push({value:c.minutes,label:d.minutes}),C&&n.push({value:c.seconds,label:d.seconds}),a("div",{ref:m,className:h("flex items-center gap-1",i),children:n.map((o,s)=>T(g.Fragment,{children:[a(D,{value:o.value,label:o.label,theme:t}),s<n.length-1&&a(V,{})]},o.label))})});w.displayName="Countdown";var R=w;export{R as default};
1
+ "use client";import{jsx as a,jsxs as T}from"react/jsx-runtime";import g,{useState as N,useEffect as M}from"react";import x from"dayjs";import{cn as h}from"../../helpers/utils.js";import{cva as b}from"class-variance-authority";const y=r=>{const i=x(),t=x(r).diff(i,"second");if(t<=0)return{days:0,hours:0,minutes:0,seconds:0};const d=Math.floor(t/(24*60*60)),l=Math.floor(t%(24*60*60)/(60*60)),f=Math.floor(t%(60*60)/60),p=t%60;return{days:d,hours:l,minutes:f,seconds:p}},S=b("lg-desktop:size-12 lg-desktop:px-1 flex size-10 flex-col items-center justify-center px-[2px] text-center",{variants:{theme:{light:"bg-info-primary",dark:"bg-[#f5f6f7]"}},defaultVariants:{theme:"light"}}),v=b("",{variants:{theme:{light:"text-white",dark:"text-[#080A0F]"}},defaultVariants:{theme:"light"}}),D=({value:r,label:i,theme:e="light"})=>T("div",{className:S({theme:e}),children:[a("p",{className:h("lg-desktop:text-2xl text-[20px] font-bold leading-[1.2] tracking-[-0.96px]",v({theme:e})),children:String(r).padStart(2,"0")}),a("p",{className:h("mt-[-6px] text-[12px] font-bold leading-[1.4] tracking-[-0.24px]",v({theme:e})),children:i})]}),V=()=>a("p",{className:"lg-desktop:text-2xl text-info-primary text-center text-xl font-bold leading-[1.2] tracking-[-0.96px]",children:":"}),w=g.forwardRef(({config:r,className:i,onCountdownEnd:e,theme:t="light"},d)=>{const{targetDate:l,showDays:f=!0,showHours:p=!0,showMinutes:k=!0,showSeconds:C=!0,labels:u={}}=r,[c,L]=N(()=>y(l));M(()=>{const o=setInterval(()=>{const s=y(l);L(s),s.days===0&&s.hours===0&&s.minutes===0&&s.seconds===0&&(e?.(),clearInterval(o))},1e3);return()=>clearInterval(o)},[l,e]);const m={days:u.days||"Day",hours:u.hours||"Hours",minutes:u.minutes||"Mins",seconds:u.seconds||"Secs"},n=[];return f&&n.push({value:c.days,label:m.days}),p&&n.push({value:c.hours,label:m.hours}),k&&n.push({value:c.minutes,label:m.minutes}),C&&n.push({value:c.seconds,label:m.seconds}),a("div",{ref:d,className:h("flex items-center gap-1",i),children:n.map((o,s)=>T(g.Fragment,{children:[a(D,{value:o.value,label:o.label,theme:t}),s<n.length-1&&a(V,{})]},o.label))})});w.displayName="Countdown";var R=w;export{R as default};
2
2
  //# sourceMappingURL=Countdown.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/Title/Countdown.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useState, useEffect } from 'react'\nimport dayjs from 'dayjs'\nimport { cn } from '../../helpers/utils.js'\nimport { cva } from 'class-variance-authority'\nimport type { CountdownConfig } from './types.js'\nimport type { Theme } from '../../types/props.js'\n\ninterface CountdownProps {\n config: CountdownConfig\n className?: string\n onCountdownEnd?: () => void\n theme?: Theme\n}\n\ninterface TimeLeft {\n days: number\n hours: number\n minutes: number\n seconds: number\n}\n\n/**\n * \u8BA1\u7B97\u5269\u4F59\u65F6\u95F4\n */\nconst calculateTimeLeft = (targetDate: string): TimeLeft => {\n const now = dayjs()\n const target = dayjs(targetDate)\n const diff = target.diff(now, 'second')\n\n if (diff <= 0) {\n return { days: 0, hours: 0, minutes: 0, seconds: 0 }\n }\n\n const days = Math.floor(diff / (24 * 60 * 60))\n const hours = Math.floor((diff % (24 * 60 * 60)) / (60 * 60))\n const minutes = Math.floor((diff % (60 * 60)) / 60)\n const seconds = diff % 60\n\n return { days, hours, minutes, seconds }\n}\n\n/**\n * \u5012\u8BA1\u65F6\u6570\u5B57\u5757\u80CC\u666F\u8272\u6837\u5F0F\u53D8\u4F53\n */\nconst countdownUnitVariants = cva(\n 'lg-desktop:size-12 lg-desktop:px-1 flex size-10 flex-col items-center justify-center px-[2px] text-center',\n {\n variants: {\n theme: {\n light: 'bg-info-primary',\n dark: 'bg-[#f5f6f7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n }\n)\n\n/**\n * \u5012\u8BA1\u65F6\u6587\u5B57\u989C\u8272\u6837\u5F0F\u53D8\u4F53\n */\nconst countdownTextVariants = cva('', {\n variants: {\n theme: {\n light: 'text-white',\n dark: 'text-[#080A0F]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n})\n\n/**\n * \u5012\u8BA1\u65F6\u6570\u5B57\u5757\u7EC4\u4EF6\n */\nconst CountdownUnit = ({ value, label, theme = 'light' }: { value: number; label: string; theme?: Theme }) => {\n return (\n <div className={countdownUnitVariants({ theme })}>\n <p\n className={cn(\n 'lg-desktop:text-2xl text-[20px] font-bold leading-[1.2] tracking-[-0.96px]',\n countdownTextVariants({ theme })\n )}\n >\n {String(value).padStart(2, '0')}\n </p>\n <p className={cn('text-[12px] font-bold leading-[1.4] tracking-[-0.24px]', countdownTextVariants({ theme }))}>\n {label}\n </p>\n </div>\n )\n}\n\n/**\n * \u5012\u8BA1\u65F6\u5206\u9694\u7B26\n */\nconst CountdownSeparator = () => {\n return (\n <p className=\"lg-desktop:text-2xl text-info-primary text-center text-xl font-bold leading-[1.2] tracking-[-0.96px]\">\n :\n </p>\n )\n}\n\n/**\n * Countdown - \u5012\u8BA1\u65F6\u7EC4\u4EF6\n */\nconst Countdown = React.forwardRef<HTMLDivElement, CountdownProps>(\n ({ config, className, onCountdownEnd, theme = 'light' }, ref) => {\n const {\n targetDate,\n showDays = true,\n showHours = true,\n showMinutes = true,\n showSeconds = true,\n labels = {},\n } = config\n\n const [timeLeft, setTimeLeft] = useState<TimeLeft>(() => calculateTimeLeft(targetDate))\n\n useEffect(() => {\n const timer = setInterval(() => {\n const newTimeLeft = calculateTimeLeft(targetDate)\n setTimeLeft(newTimeLeft)\n\n // \u68C0\u67E5\u5012\u8BA1\u65F6\u662F\u5426\u7ED3\u675F\n if (\n newTimeLeft.days === 0 &&\n newTimeLeft.hours === 0 &&\n newTimeLeft.minutes === 0 &&\n newTimeLeft.seconds === 0\n ) {\n onCountdownEnd?.()\n clearInterval(timer)\n }\n }, 1000)\n\n return () => clearInterval(timer)\n }, [targetDate, onCountdownEnd])\n\n const defaultLabels = {\n days: labels.days || 'Day',\n hours: labels.hours || 'Hours',\n minutes: labels.minutes || 'Mins',\n seconds: labels.seconds || 'Secs',\n }\n\n const units = []\n if (showDays) units.push({ value: timeLeft.days, label: defaultLabels.days })\n if (showHours) units.push({ value: timeLeft.hours, label: defaultLabels.hours })\n if (showMinutes) units.push({ value: timeLeft.minutes, label: defaultLabels.minutes })\n if (showSeconds) units.push({ value: timeLeft.seconds, label: defaultLabels.seconds })\n\n return (\n <div ref={ref} className={cn('flex items-center gap-1', className)}>\n {units.map((unit, index) => (\n <React.Fragment key={unit.label}>\n <CountdownUnit value={unit.value} label={unit.label} theme={theme} />\n {index < units.length - 1 && <CountdownSeparator />}\n </React.Fragment>\n ))}\n </div>\n )\n }\n)\n\nCountdown.displayName = 'Countdown'\n\nexport default Countdown\n"],
5
- "mappings": "aAgFI,OACE,OAAAA,EADF,QAAAC,MAAA,oBA/EJ,OAAOC,GAAS,YAAAC,EAAU,aAAAC,MAAiB,QAC3C,OAAOC,MAAW,QAClB,OAAS,MAAAC,MAAU,yBACnB,OAAS,OAAAC,MAAW,2BAqBpB,MAAMC,EAAqBC,GAAiC,CAC1D,MAAMC,EAAML,EAAM,EAEZM,EADSN,EAAMI,CAAU,EACX,KAAKC,EAAK,QAAQ,EAEtC,GAAIC,GAAQ,EACV,MAAO,CAAE,KAAM,EAAG,MAAO,EAAG,QAAS,EAAG,QAAS,CAAE,EAGrD,MAAMC,EAAO,KAAK,MAAMD,GAAQ,GAAK,GAAK,GAAG,EACvCE,EAAQ,KAAK,MAAOF,GAAQ,GAAK,GAAK,KAAQ,GAAK,GAAG,EACtDG,EAAU,KAAK,MAAOH,GAAQ,GAAK,IAAO,EAAE,EAC5CI,EAAUJ,EAAO,GAEvB,MAAO,CAAE,KAAAC,EAAM,MAAAC,EAAO,QAAAC,EAAS,QAAAC,CAAQ,CACzC,EAKMC,EAAwBT,EAC5B,4GACA,CACE,SAAU,CACR,MAAO,CACL,MAAO,kBACP,KAAM,cACR,CACF,EACA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EAE/B,MAAMW,EAAgB,CACpB,KAAML,EAAO,MAAQ,MACrB,MAAOA,EAAO,OAAS,QACvB,QAASA,EAAO,SAAW,OAC3B,QAASA,EAAO,SAAW,MAC7B,EAEMM,EAAQ,CAAC,EACf,OAAIV,GAAUU,EAAM,KAAK,CAAE,MAAOL,EAAS,KAAM,MAAOI,EAAc,IAAK,CAAC,EACxER,GAAWS,EAAM,KAAK,CAAE,MAAOL,EAAS,MAAO,MAAOI,EAAc,KAAM,CAAC,EAC3EP,GAAaQ,EAAM,KAAK,CAAE,MAAOL,EAAS,QAAS,MAAOI,EAAc,OAAQ,CAAC,EACjFN,GAAaO,EAAM,KAAK,CAAE,MAAOL,EAAS,QAAS,MAAOI,EAAc,OAAQ,CAAC,EAGnFrC,EAAC,OAAI,IAAK2B,EAAK,UAAWrB,EAAG,0BAA2BmB,CAAS,EAC9D,SAAAa,EAAM,IAAI,CAACC,EAAMC,IAChBvC,EAACC,EAAM,SAAN,CACC,UAAAF,EAACkB,EAAA,CAAc,MAAOqB,EAAK,MAAO,MAAOA,EAAK,MAAO,MAAOlB,EAAO,EAClEmB,EAAQF,EAAM,OAAS,GAAKtC,EAACsB,EAAA,EAAmB,IAF9BiB,EAAK,KAG1B,CACD,EACH,CAEJ,CACF,EAEAhB,EAAU,YAAc,YAExB,IAAOkB,EAAQlB",
4
+ "sourcesContent": ["'use client'\nimport React, { useState, useEffect } from 'react'\nimport dayjs from 'dayjs'\nimport { cn } from '../../helpers/utils.js'\nimport { cva } from 'class-variance-authority'\nimport type { CountdownConfig } from './types.js'\nimport type { Theme } from '../../types/props.js'\n\ninterface CountdownProps {\n config: CountdownConfig\n className?: string\n onCountdownEnd?: () => void\n theme?: Theme\n}\n\ninterface TimeLeft {\n days: number\n hours: number\n minutes: number\n seconds: number\n}\n\n/**\n * \u8BA1\u7B97\u5269\u4F59\u65F6\u95F4\n */\nconst calculateTimeLeft = (targetDate: string): TimeLeft => {\n const now = dayjs()\n const target = dayjs(targetDate)\n const diff = target.diff(now, 'second')\n\n if (diff <= 0) {\n return { days: 0, hours: 0, minutes: 0, seconds: 0 }\n }\n\n const days = Math.floor(diff / (24 * 60 * 60))\n const hours = Math.floor((diff % (24 * 60 * 60)) / (60 * 60))\n const minutes = Math.floor((diff % (60 * 60)) / 60)\n const seconds = diff % 60\n\n return { days, hours, minutes, seconds }\n}\n\n/**\n * \u5012\u8BA1\u65F6\u6570\u5B57\u5757\u80CC\u666F\u8272\u6837\u5F0F\u53D8\u4F53\n */\nconst countdownUnitVariants = cva(\n 'lg-desktop:size-12 lg-desktop:px-1 flex size-10 flex-col items-center justify-center px-[2px] text-center',\n {\n variants: {\n theme: {\n light: 'bg-info-primary',\n dark: 'bg-[#f5f6f7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n }\n)\n\n/**\n * \u5012\u8BA1\u65F6\u6587\u5B57\u989C\u8272\u6837\u5F0F\u53D8\u4F53\n */\nconst countdownTextVariants = cva('', {\n variants: {\n theme: {\n light: 'text-white',\n dark: 'text-[#080A0F]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n})\n\n/**\n * \u5012\u8BA1\u65F6\u6570\u5B57\u5757\u7EC4\u4EF6\n */\nconst CountdownUnit = ({ value, label, theme = 'light' }: { value: number; label: string; theme?: Theme }) => {\n return (\n <div className={countdownUnitVariants({ theme })}>\n <p\n className={cn(\n 'lg-desktop:text-2xl text-[20px] font-bold leading-[1.2] tracking-[-0.96px]',\n countdownTextVariants({ theme })\n )}\n >\n {String(value).padStart(2, '0')}\n </p>\n <p\n className={cn(\n 'mt-[-6px] text-[12px] font-bold leading-[1.4] tracking-[-0.24px]',\n countdownTextVariants({ theme })\n )}\n >\n {label}\n </p>\n </div>\n )\n}\n\n/**\n * \u5012\u8BA1\u65F6\u5206\u9694\u7B26\n */\nconst CountdownSeparator = () => {\n return (\n <p className=\"lg-desktop:text-2xl text-info-primary text-center text-xl font-bold leading-[1.2] tracking-[-0.96px]\">\n :\n </p>\n )\n}\n\n/**\n * Countdown - \u5012\u8BA1\u65F6\u7EC4\u4EF6\n */\nconst Countdown = React.forwardRef<HTMLDivElement, CountdownProps>(\n ({ config, className, onCountdownEnd, theme = 'light' }, ref) => {\n const {\n targetDate,\n showDays = true,\n showHours = true,\n showMinutes = true,\n showSeconds = true,\n labels = {},\n } = config\n\n const [timeLeft, setTimeLeft] = useState<TimeLeft>(() => calculateTimeLeft(targetDate))\n\n useEffect(() => {\n const timer = setInterval(() => {\n const newTimeLeft = calculateTimeLeft(targetDate)\n setTimeLeft(newTimeLeft)\n\n // \u68C0\u67E5\u5012\u8BA1\u65F6\u662F\u5426\u7ED3\u675F\n if (\n newTimeLeft.days === 0 &&\n newTimeLeft.hours === 0 &&\n newTimeLeft.minutes === 0 &&\n newTimeLeft.seconds === 0\n ) {\n onCountdownEnd?.()\n clearInterval(timer)\n }\n }, 1000)\n\n return () => clearInterval(timer)\n }, [targetDate, onCountdownEnd])\n\n const defaultLabels = {\n days: labels.days || 'Day',\n hours: labels.hours || 'Hours',\n minutes: labels.minutes || 'Mins',\n seconds: labels.seconds || 'Secs',\n }\n\n const units = []\n if (showDays) units.push({ value: timeLeft.days, label: defaultLabels.days })\n if (showHours) units.push({ value: timeLeft.hours, label: defaultLabels.hours })\n if (showMinutes) units.push({ value: timeLeft.minutes, label: defaultLabels.minutes })\n if (showSeconds) units.push({ value: timeLeft.seconds, label: defaultLabels.seconds })\n\n return (\n <div ref={ref} className={cn('flex items-center gap-1', className)}>\n {units.map((unit, index) => (\n <React.Fragment key={unit.label}>\n <CountdownUnit value={unit.value} label={unit.label} theme={theme} />\n {index < units.length - 1 && <CountdownSeparator />}\n </React.Fragment>\n ))}\n </div>\n )\n }\n)\n\nCountdown.displayName = 'Countdown'\n\nexport default Countdown\n"],
5
+ "mappings": "aAgFI,OACE,OAAAA,EADF,QAAAC,MAAA,oBA/EJ,OAAOC,GAAS,YAAAC,EAAU,aAAAC,MAAiB,QAC3C,OAAOC,MAAW,QAClB,OAAS,MAAAC,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AK,MAAO,MAAOA,EAAK,MAAO,MAAOlB,EAAO,EAClEmB,EAAQF,EAAM,OAAS,GAAKtC,EAACsB,EAAA,EAAmB,IAF9BiB,EAAK,KAG1B,CACD,EACH,CAEJ,CACF,EAEAhB,EAAU,YAAc,YAExB,IAAOkB,EAAQlB",
6
6
  "names": ["jsx", "jsxs", "React", "useState", "useEffect", "dayjs", "cn", "cva", "calculateTimeLeft", "targetDate", "now", "diff", "days", "hours", "minutes", "seconds", "countdownUnitVariants", "countdownTextVariants", "CountdownUnit", "value", "label", "theme", "CountdownSeparator", "Countdown", "config", "className", "onCountdownEnd", "ref", "showDays", "showHours", "showMinutes", "showSeconds", "labels", "timeLeft", "setTimeLeft", "timer", "newTimeLeft", "defaultLabels", "units", "unit", "index", "Countdown_default"]
7
7
  }
@@ -1,2 +1,2 @@
1
- "use client";import{jsx as t,jsxs as v}from"react/jsx-runtime";import Q,{useEffect as X,useRef as u,useImperativeHandle as Y,useState as Z}from"react";import{gsap as w}from"gsap";import{SplitText as R}from"gsap/dist/SplitText";import{ScrollTrigger as E}from"gsap/dist/ScrollTrigger";import{cn as r}from"../../helpers/utils.js";import{cva as H}from"class-variance-authority";import{Heading as tt,Text as et}from"../../components/index.js";import{withLayout as nt}from"../../shared/Styles.js";import{trackUrlRef as rt}from"../../shared/trackUrlRef.js";import{useInView as st}from"react-intersection-observer";import it from"./Countdown.js";const V="link",M="title",ot=H("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),at=H("desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),C=({data:s,className:f})=>{const{theme:e="light",extensions:i,title:p,caption:d,align:o}=s;return i?.textLink?v("a",{className:r({"aiui-dark":e==="dark"},"hover:text-brand-0 [&_svg_path]:hover:stroke-brand-0 flex items-center overflow-hidden text-base font-[700] leading-[1.4] transition-all duration-[0.4s]",{"text-[#080A0F]":e==="light"},{"text-[#F5F6F7]":e==="dark"},{"justify-center":o==="center"},f),href:rt(i?.link,`${V}_${M}`),"data-headless-type-name":`${V}#${M}`,"data-headless-title-desc-button":`${p}#${d}`,children:[t("div",{className:r("flex-1 truncate whitespace-nowrap",{"flex-none":o==="center"}),children:i?.textLink}),t("div",{className:"size-6",children:t("svg",{width:"24",height:"24",className:"mb-[3px]",xmlns:"http://www.w3.org/2000/svg",viewBox:"0 0 24 24",fill:"none",children:t("path",{className:"transition-all duration-[0.4s]",d:"M10.5 8L14.5 12L10.5 16",stroke:e==="dark"?"#F5F6F7":"#080A0F",strokeWidth:"1.5",strokeLinecap:"round"})})})]}):null},$=Q.forwardRef(({data:s,className:f,as:e="h2",weight:i="bold"},p)=>{const{title:d,caption:o,subtitle:k,countdown:b,showCountdown:P=!1,theme:m="light",extensions:S,align:a="left"}=s,T=u(null),l=u(null),n=u(null),c=u(null),[j,z]=Z(!0),{ref:A,inView:F}=st();Y(p,()=>T.current);const I=()=>{z(!1)};return X(()=>{w.registerPlugin(R,E);function B(){if(!l.current)return;const D=l.current?.clientHeight||80;n.current&&n.current.revert(),c.current&&c.current.kill(),n.current=new R(l.current,{type:"words",wordsClass:"word"});const h=n.current.words;w.set(h,{opacity:0}),c.current=E.create({trigger:l.current,start:"bottom bottom-=4%",end:`bottom+=${D*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:_=>{const U=_.progress,y=h.length||1,O=.5,g=1/y,N=g*(1-O),L=(y-1)*N+g,W=Math.min(1,L>0?U/L:0);h.forEach((q,G)=>{const J=G*N,K=g;let x=(W-J)/K;x=Math.max(0,Math.min(1,x)),w.set(q,{opacity:x})})}})}return F&&B(),()=>{n.current&&n.current.revert(),c.current&&c.current.kill()}},[F]),(d||o)&&v("div",{id:S?.id,className:"titleBottom title-box mb-6 flex items-end justify-between gap-2",ref:T,children:[v("div",{ref:A,className:r("flex-1",f,{"aiui-dark":m==="dark","text-center":a==="center","text-left":a==="left"}),children:[t(tt,{ref:l,as:e,size:4,html:o||d,weight:i,className:ot({theme:m})}),k&&t(et,{html:k,as:"p",className:at({theme:m})}),t(C,{data:s,className:r({hidden:a==="left"})}),P&&b&&j&&t(it,{className:r("mt-4 justify-start",{"justify-center":a==="center"}),config:b,onCountdownEnd:I,theme:m})]}),t(C,{data:s,className:r({hidden:a==="center"})})]})});$.displayName="Title";var vt=nt($);export{vt as default};
1
+ "use client";import{jsx as t,jsxs as v}from"react/jsx-runtime";import Q,{useEffect as W,useRef as u,useImperativeHandle as X,useState as Y}from"react";import{gsap as w}from"gsap";import{SplitText as L}from"gsap/dist/SplitText";import{ScrollTrigger as R}from"gsap/dist/ScrollTrigger";import{cn as r}from"../../helpers/utils.js";import{cva as E}from"class-variance-authority";import{Heading as tt,Text as et}from"../../components/index.js";import{withLayout as nt}from"../../shared/Styles.js";import{trackUrlRef as rt}from"../../shared/trackUrlRef.js";import{useInView as st}from"react-intersection-observer";import it from"./Countdown.js";const H="link",V="title",ot=E("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),at=E("desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),M=({data:s,className:f})=>{const{theme:e="light",extensions:i,title:p,caption:d,align:o}=s;return i?.textLink?v("a",{className:r({"aiui-dark":e==="dark"},"hover:text-brand-0 [&_svg_path]:hover:stroke-brand-0 lg-desktop:text-base flex items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"text-[#080A0F]":e==="light"},{"text-[#F5F6F7]":e==="dark"},{"justify-center mt-4":o==="center"},f),href:rt(i?.link,`${H}_${V}`),"data-headless-type-name":`${H}#${V}`,"data-headless-title-desc-button":`${p}#${d}`,children:[t("div",{className:r("flex-1 truncate whitespace-nowrap",{"flex-none":o==="center"}),children:i?.textLink}),t("div",{className:"lg-desktop:size-5 size-4",children:t("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:t("path",{d:"M5.52876 3.52876C5.78911 3.26841 6.21112 3.26841 6.47147 3.52876L10.4715 7.52876C10.7318 7.78911 10.7318 8.21112 10.4715 8.47147L6.47147 12.4715C6.21112 12.7318 5.78911 12.7318 5.52876 12.4715C5.26841 12.2111 5.26841 11.7891 5.52876 11.5288L9.0574 8.00011L5.52876 4.47147C5.26841 4.21112 5.26841 3.78911 5.52876 3.52876Z",stroke:e==="dark"?"#F5F6F7":"#080A0F"})})})]}):null},$=Q.forwardRef(({data:s,className:f,as:e="h2",weight:i="bold"},p)=>{const{title:d,caption:o,subtitle:k,countdown:b,showCountdown:z=!1,theme:m="light",extensions:P,align:a="left"}=s,T=u(null),l=u(null),n=u(null),c=u(null),[S,j]=Y(!0),{ref:A,inView:F}=st();X(p,()=>T.current);const I=()=>{j(!1)};return W(()=>{w.registerPlugin(L,R);function B(){if(!l.current)return;const D=l.current?.clientHeight||80;n.current&&n.current.revert(),c.current&&c.current.kill(),n.current=new L(l.current,{type:"words",wordsClass:"word"});const g=n.current.words;w.set(g,{opacity:0}),c.current=R.create({trigger:l.current,start:"bottom bottom-=4%",end:`bottom+=${D*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:_=>{const U=_.progress,y=g.length||1,O=.5,h=1/y,N=h*(1-O),C=(y-1)*N+h,Z=Math.min(1,C>0?U/C:0);g.forEach((q,G)=>{const J=G*N,K=h;let x=(Z-J)/K;x=Math.max(0,Math.min(1,x)),w.set(q,{opacity:x})})}})}return F&&B(),()=>{n.current&&n.current.revert(),c.current&&c.current.kill()}},[F]),(d||o)&&v("div",{id:P?.id,className:"titleBottom title-box mb-6 flex items-end justify-between gap-2",ref:T,children:[v("div",{ref:A,className:r("flex-1",f,{"aiui-dark":m==="dark","text-center":a==="center","text-left":a==="left"}),children:[t(tt,{ref:l,as:e,size:4,html:o||d,weight:i,className:ot({theme:m})}),k&&t(et,{html:k,as:"p",className:at({theme:m})}),t(M,{data:s,className:r({hidden:a==="left"})}),z&&b&&S&&t(it,{className:r("mt-4 justify-start",{"justify-center":a==="center"}),config:b,onCountdownEnd:I,theme:m})]}),t(M,{data:s,className:r({hidden:a==="center"})})]})});$.displayName="Title";var vt=nt($);export{vt as default};
2
2
  //# sourceMappingURL=index.js.map
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "version": 3,
3
3
  "sources": ["../../../../src/biz-components/Title/index.tsx"],
4
- "sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle, useState } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { cva } from 'class-variance-authority'\nimport { Heading, Text } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\nimport Countdown from './Countdown.js'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\n/**\n * \u6807\u9898\u6837\u5F0F\u53D8\u4F53\n */\nconst titleHeadingVariants = cva('', {\n variants: {\n theme: {\n light: 'text-[#080A0F]',\n dark: 'text-[#F5F6F7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n})\n\n/**\n * \u526F\u6807\u9898\u6837\u5F0F\u53D8\u4F53\n */\nconst subtitleVariants = cva(\n 'desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]',\n {\n variants: {\n theme: {\n light: 'text-[#080A0F]',\n dark: 'text-[#F5F6F7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n }\n)\n\nconst TitleButton = ({ data, className }: { data: TitleProps['data']; className?: string }) => {\n const { theme = 'light', extensions, title, caption, align } = data\n if (!extensions?.textLink) return null\n return (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'hover:text-brand-0 [&_svg_path]:hover:stroke-brand-0 flex items-center overflow-hidden text-base font-[700] leading-[1.4] transition-all duration-[0.4s]',\n { 'text-[#080A0F]': theme === 'light' },\n { 'text-[#F5F6F7]': theme === 'dark' },\n { 'justify-center': align === 'center' },\n className\n )}\n href={trackUrlRef(extensions?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${caption}`}\n >\n <div\n className={cn('flex-1 truncate whitespace-nowrap', {\n 'flex-none': align === 'center',\n })}\n >\n {extensions?.textLink}\n </div>\n <div className=\"size-6\">\n <svg\n width=\"24\"\n height=\"24\"\n className=\"mb-[3px]\"\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n >\n <path\n className=\"transition-all duration-[0.4s]\"\n d=\"M10.5 8L14.5 12L10.5 16\"\n stroke={theme === 'dark' ? '#F5F6F7' : '#080A0F'}\n strokeWidth=\"1.5\"\n strokeLinecap=\"round\"\n ></path>\n </svg>\n </div>\n </a>\n )\n}\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className, as = 'h2', weight = 'bold' }, ref) => {\n const {\n title,\n caption,\n subtitle,\n countdown,\n showCountdown = false,\n theme = 'light',\n extensions,\n align = 'left',\n } = data\n const innerRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n // \u63A7\u5236\u5012\u8BA1\u65F6\u663E\u793A\u72B6\u6001\n const [isCountdownVisible, setIsCountdownVisible] = useState(true)\n\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n // \u5012\u8BA1\u65F6\u7ED3\u675F\u56DE\u8C03\n const handleCountdownEnd = () => {\n setIsCountdownVisible(false)\n }\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n if (splitTextInstance.current) {\n splitTextInstance.current.revert()\n }\n if (scrollTriggerRef.current) {\n scrollTriggerRef.current.kill()\n }\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n invalidateOnRefresh: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length || 1\n const overlap = 0.5\n const interval = 1 / total\n const step = interval * (1 - overlap)\n const lastEnd = (total - 1) * step + interval\n const normalizedProgress = Math.min(1, lastEnd > 0 ? progress / lastEnd : 0)\n words.forEach((word: any, i: number) => {\n const start = i * step\n const width = interval\n let opacity = (normalizedProgress - start) / width\n opacity = Math.max(0, Math.min(1, opacity))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n (title || caption) && (\n <div\n id={extensions?.id}\n className=\"titleBottom title-box mb-6 flex items-end justify-between gap-2\"\n ref={innerRef}\n >\n <div\n ref={inViewRef}\n className={cn('flex-1', className, {\n 'aiui-dark': theme === 'dark',\n 'text-center': align === 'center',\n 'text-left': align === 'left',\n })}\n >\n <Heading\n ref={titleRef}\n as={as}\n size={4}\n html={caption || title}\n weight={weight}\n className={titleHeadingVariants({ theme })}\n />\n {subtitle && <Text html={subtitle} as=\"p\" className={subtitleVariants({ theme })} />}\n <TitleButton data={data} className={cn({ hidden: align === 'left' })} />\n {showCountdown && countdown && isCountdownVisible && (\n <Countdown\n className={cn('mt-4 justify-start', {\n 'justify-center': align === 'center',\n })}\n config={countdown}\n onCountdownEnd={handleCountdownEnd}\n theme={theme}\n />\n )}\n </div>\n <TitleButton data={data} className={cn({ hidden: align === 'center' })} />\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
5
- "mappings": "aAsDI,OAaE,OAAAA,EAbF,QAAAC,MAAA,oBArDJ,OAAOC,GAAS,aAAAC,EAAW,UAAAC,EAAQ,uBAAAC,EAAqB,YAAAC,MAAgB,QACxE,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,OAAAC,MAAW,2BACpB,OAAS,WAAAC,GAAS,QAAAC,OAAY,4BAC9B,OAAS,cAAAC,OAAkB,yBAE3B,OAAS,eAAAC,OAAmB,8BAC5B,OAAS,aAAAC,OAAiB,8BAC1B,OAAOC,OAAe,iBAEtB,MAAMC,EAAgB,OAChBC,EAAgB,QAKhBC,GAAuBT,EAAI,GAAI,CACnC,SAAU,CACR,MAAO,CACL,MAAO,iBACP,KAAM,gBACR,CACF,EACA,gBAAiB,CACf,MAAO,OACT,CACF,CAAC,EAKKU,GAAmBV,EACvB,oHACA,CACE,SAAU,CACR,MAAO,CACL,MAAO,iBACP,KAAM,gBACR,CACF,EACA,gBAAiB,CACf,MAAO,OACT,CACF,CACF,EAEMW,EAAc,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,IAAwD,CAC7F,KAAM,CAAE,MAAAC,EAAQ,QAAS,WAAAC,EAAY,MAAAC,EAAO,QAAAC,EAAS,MAAAC,CAAM,EAAIN,EAC/D,OAAKG,GAAY,SAEfzB,EAAC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RjB,GAASC,IACR3B,EAAC,OACC,GAAIyB,GAAY,GAChB,UAAU,kEACV,IAAKW,EAEL,UAAApC,EAAC,OACC,IAAK0C,EACL,UAAWjC,EAAG,SAAUc,EAAW,CACjC,YAAaC,IAAU,OACvB,cAAeI,IAAU,SACzB,YAAaA,IAAU,MACzB,CAAC,EAED,UAAA7B,EAACY,GAAA,CACC,IAAK0B,EACL,GAAIP,EACJ,KAAM,EACN,KAAMH,GAAWD,EACjB,OAAQK,EACR,UAAWZ,GAAqB,CAAE,MAAAK,CAAM,CAAC,EAC3C,EACCS,GAAYlC,EAACa,GAAA,CAAK,KAAMqB,EAAU,GAAG,IAAI,UAAWb,GAAiB,CAAE,MAAAI,CAAM,CAAC,EAAG,EAClFzB,EAACsB,EAAA,CAAY,KAAMC,EAAM,UAAWb,EAAG,CAAE,OAAQmB,IAAU,MAAO,CAAC,EAAG,EACrEO,GAAiBD,GAAaM,GAC7BzC,EAACiB,GAAA,CACC,UAAWP,EAAG,qBAAsB,CAClC,iBAAkBmB,IAAU,QAC9B,CAAC,EACD,OAAQM,EACR,eAAgBU,EAChB,MAAOpB,EACT,GAEJ,EACAzB,EAACsB,EAAA,CAAY,KAAMC,EAAM,UAAWb,EAAG,CAAE,OAAQmB,IAAU,QAAS,CAAC,EAAG,GAC1E,CAGN,CAAC,EAEDC,EAAM,YAAc,QAEpB,IAAOgC,GAAQhD,GAAWgB,CAAK",
4
+ "sourcesContent": ["'use client'\nimport React, { useEffect, useRef, useImperativeHandle, useState } from 'react'\nimport { gsap } from 'gsap'\nimport { SplitText } from 'gsap/dist/SplitText'\nimport { ScrollTrigger } from 'gsap/dist/ScrollTrigger'\nimport { cn } from '../../helpers/utils.js'\nimport { cva } from 'class-variance-authority'\nimport { Heading, Text } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitleProps } from './types.js'\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\nimport Countdown from './Countdown.js'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\n/**\n * \u6807\u9898\u6837\u5F0F\u53D8\u4F53\n */\nconst titleHeadingVariants = cva('', {\n variants: {\n theme: {\n light: 'text-[#080A0F]',\n dark: 'text-[#F5F6F7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n})\n\n/**\n * \u526F\u6807\u9898\u6837\u5F0F\u53D8\u4F53\n */\nconst subtitleVariants = cva(\n 'desktop:text-base desktop:mt-2 lg-desktop:text-[18px] mt-1 text-[14px] font-bold leading-[1.4] tracking-[-0.36px]',\n {\n variants: {\n theme: {\n light: 'text-[#080A0F]',\n dark: 'text-[#F5F6F7]',\n },\n },\n defaultVariants: {\n theme: 'light',\n },\n }\n)\n\nconst TitleButton = ({ data, className }: { data: TitleProps['data']; className?: string }) => {\n const { theme = 'light', extensions, title, caption, align } = data\n if (!extensions?.textLink) return null\n return (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'hover:text-brand-0 [&_svg_path]:hover:stroke-brand-0 lg-desktop:text-base flex items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]',\n { 'text-[#080A0F]': theme === 'light' },\n { 'text-[#F5F6F7]': theme === 'dark' },\n { 'justify-center mt-4': align === 'center' },\n className\n )}\n href={trackUrlRef(extensions?.link, `${componentType}_${componentName}`)}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${caption}`}\n >\n <div\n className={cn('flex-1 truncate whitespace-nowrap', {\n 'flex-none': align === 'center',\n })}\n >\n {extensions?.textLink}\n </div>\n <div className=\"lg-desktop:size-5 size-4\">\n <svg xmlns=\"http://www.w3.org/2000/svg\" width=\"100%\" height=\"100%\" viewBox=\"0 0 16 16\" fill=\"none\">\n <path\n d=\"M5.52876 3.52876C5.78911 3.26841 6.21112 3.26841 6.47147 3.52876L10.4715 7.52876C10.7318 7.78911 10.7318 8.21112 10.4715 8.47147L6.47147 12.4715C6.21112 12.7318 5.78911 12.7318 5.52876 12.4715C5.26841 12.2111 5.26841 11.7891 5.52876 11.5288L9.0574 8.00011L5.52876 4.47147C5.26841 4.21112 5.26841 3.78911 5.52876 3.52876Z\"\n stroke={theme === 'dark' ? '#F5F6F7' : '#080A0F'}\n />\n </svg>\n </div>\n </a>\n )\n}\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(({ data, className, as = 'h2', weight = 'bold' }, ref) => {\n const {\n title,\n caption,\n subtitle,\n countdown,\n showCountdown = false,\n theme = 'light',\n extensions,\n align = 'left',\n } = data\n const innerRef = useRef<HTMLDivElement>(null)\n const titleRef = useRef<HTMLHeadingElement>(null)\n const splitTextInstance = useRef<SplitText | null>(null)\n const scrollTriggerRef = useRef<ScrollTrigger | null>(null)\n\n // \u63A7\u5236\u5012\u8BA1\u65F6\u663E\u793A\u72B6\u6001\n const [isCountdownVisible, setIsCountdownVisible] = useState(true)\n\n const { ref: inViewRef, inView } = useInView()\n\n useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)\n\n // \u5012\u8BA1\u65F6\u7ED3\u675F\u56DE\u8C03\n const handleCountdownEnd = () => {\n setIsCountdownVisible(false)\n }\n\n useEffect(() => {\n gsap.registerPlugin(SplitText, ScrollTrigger)\n function gsapResize() {\n if (!titleRef.current) return\n const height = titleRef.current?.clientHeight || 80\n if (splitTextInstance.current) {\n splitTextInstance.current.revert()\n }\n if (scrollTriggerRef.current) {\n scrollTriggerRef.current.kill()\n }\n splitTextInstance.current = new SplitText(titleRef.current, {\n type: 'words',\n wordsClass: 'word',\n })\n const words = splitTextInstance.current.words\n gsap.set(words, { opacity: 0 })\n scrollTriggerRef.current = ScrollTrigger.create({\n trigger: titleRef.current,\n start: 'bottom bottom-=4%',\n end: `bottom+=${height * 1.5 + 60}px bottom-=4%`,\n scrub: true,\n invalidateOnRefresh: true,\n onUpdate: (self: any) => {\n const progress = self.progress\n const total = words.length || 1\n const overlap = 0.5\n const interval = 1 / total\n const step = interval * (1 - overlap)\n const lastEnd = (total - 1) * step + interval\n const normalizedProgress = Math.min(1, lastEnd > 0 ? progress / lastEnd : 0)\n words.forEach((word: any, i: number) => {\n const start = i * step\n const width = interval\n let opacity = (normalizedProgress - start) / width\n opacity = Math.max(0, Math.min(1, opacity))\n gsap.set(word, { opacity })\n })\n },\n })\n }\n\n if (inView) {\n gsapResize()\n }\n\n return () => {\n splitTextInstance.current && splitTextInstance.current.revert()\n // ScrollTrigger.getAll().forEach((t: { kill: () => any }) => t.kill())\n scrollTriggerRef.current && scrollTriggerRef.current.kill()\n }\n }, [inView])\n\n return (\n (title || caption) && (\n <div\n id={extensions?.id}\n className=\"titleBottom title-box mb-6 flex items-end justify-between gap-2\"\n ref={innerRef}\n >\n <div\n ref={inViewRef}\n className={cn('flex-1', className, {\n 'aiui-dark': theme === 'dark',\n 'text-center': align === 'center',\n 'text-left': align === 'left',\n })}\n >\n <Heading\n ref={titleRef}\n as={as}\n size={4}\n html={caption || title}\n weight={weight}\n className={titleHeadingVariants({ theme })}\n />\n {subtitle && <Text html={subtitle} as=\"p\" className={subtitleVariants({ theme })} />}\n <TitleButton data={data} className={cn({ hidden: align === 'left' })} />\n {showCountdown && countdown && isCountdownVisible && (\n <Countdown\n className={cn('mt-4 justify-start', {\n 'justify-center': align === 'center',\n })}\n config={countdown}\n onCountdownEnd={handleCountdownEnd}\n theme={theme}\n />\n )}\n </div>\n <TitleButton data={data} className={cn({ hidden: align === 'center' })} />\n </div>\n )\n )\n})\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
5
+ "mappings": "aAsDI,OAaE,OAAAA,EAbF,QAAAC,MAAA,oBArDJ,OAAOC,GAAS,aAAAC,EAAW,UAAAC,EAAQ,uBAAAC,EAAqB,YAAAC,MAAgB,QACxE,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,OAAAC,MAAW,2BACpB,OAAS,WAAAC,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AAQM,EACR,eAAgBU,EAChB,MAAOpB,EACT,GAEJ,EACAzB,EAACsB,EAAA,CAAY,KAAMC,EAAM,UAAWb,EAAG,CAAE,OAAQmB,IAAU,QAAS,CAAC,EAAG,GAC1E,CAGN,CAAC,EAEDC,EAAM,YAAc,QAEpB,IAAOgC,GAAQhD,GAAWgB,CAAK",
6
6
  "names": ["jsx", "jsxs", "React", "useEffect", "useRef", "useImperativeHandle", "useState", "gsap", "SplitText", "ScrollTrigger", "cn", "cva", "Heading", "Text", "withLayout", "trackUrlRef", "useInView", "Countdown", "componentType", "componentName", "titleHeadingVariants", "subtitleVariants", "TitleButton", "data", "className", "theme", "extensions", "title", "caption", "align", "Title", "as", "weight", "ref", "subtitle", "countdown", "showCountdown", "innerRef", "titleRef", "splitTextInstance", "scrollTriggerRef", "isCountdownVisible", "setIsCountdownVisible", "inViewRef", "inView", "handleCountdownEnd", "gsapResize", "height", "words", "self", "progress", "total", "overlap", "interval", "step", "lastEnd", "normalizedProgress", "word", "i", "start", "width", "opacity", "Title_default"]
7
7
  }
@@ -3,6 +3,7 @@
3
3
 
4
4
  --btn-radius: 0;
5
5
  --box-radius: 0;
6
+ --card-radius: 0;
6
7
  --radius: 0em;
7
8
 
8
9
  --brand-gradient-color-0: linear-gradient(90deg, var(--btn-bg-active-color) 0%, var(--btn-bg-active-color) 100%);
@@ -59,6 +59,7 @@
59
59
  --tabs-list-bg-color: var(--container-primary-color);
60
60
 
61
61
  --box-radius: 12px;
62
+ --card-radius: 12px;
62
63
  --tabs-radius: 0px;
63
64
  }
64
65
 
@@ -107,9 +108,16 @@
107
108
  --masks-color-1: rgba(255, 255, 255, 0.6);
108
109
 
109
110
  --box-radius: 12px;
111
+ --card-radius: 12px;
110
112
  }
111
113
 
112
114
 
115
+ @media (min-width: 1024px) {
116
+ :root {
117
+ --card-radius: 16px;
118
+ }
119
+ }
120
+
113
121
  @media (min-width: 1441px) {
114
122
  :root {
115
123
  --box-radius: 16px;
@@ -4,6 +4,7 @@
4
4
 
5
5
  --btn-radius: -0px;
6
6
  --box-radius: 0;
7
+ --card-radius: 0;
7
8
  --radius: 0em;
8
9
 
9
10
  --brand-color-0: #00BEFA;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@anker-in/headless-ui",
3
- "version": "1.1.34-alpha.1768461697532",
3
+ "version": "1.1.34-alpha.1768470531746",
4
4
  "type": "commonjs",
5
5
  "main": "./dist/cjs/index.js",
6
6
  "types": "./dist/cjs/index.d.ts",
package/style.css CHANGED
@@ -965,6 +965,9 @@ video {
965
965
  .mt-\[-2px\] {
966
966
  margin-top: -2px;
967
967
  }
968
+ .mt-\[-6px\] {
969
+ margin-top: -6px;
970
+ }
968
971
  .mt-\[12px\] {
969
972
  margin-top: 12px;
970
973
  }
@@ -1253,6 +1256,9 @@ video {
1253
1256
  .\!h-full {
1254
1257
  height: 100% !important;
1255
1258
  }
1259
+ .h-1 {
1260
+ height: 0.25rem;
1261
+ }
1256
1262
  .h-10 {
1257
1263
  height: 2.5rem;
1258
1264
  }
@@ -2215,6 +2221,9 @@ video {
2215
2221
  .rounded-btn {
2216
2222
  border-radius: var(--btn-radius);
2217
2223
  }
2224
+ .rounded-card {
2225
+ border-radius: var(--card-radius);
2226
+ }
2218
2227
  .rounded-full {
2219
2228
  border-radius: 9999px;
2220
2229
  }
@@ -6049,6 +6058,12 @@ video {
6049
6058
  .desktop\:pb-\[24px\] {
6050
6059
  padding-bottom: 24px;
6051
6060
  }
6061
+ .desktop\:pl-6 {
6062
+ padding-left: 1.5rem;
6063
+ }
6064
+ .desktop\:pr-16 {
6065
+ padding-right: 4rem;
6066
+ }
6052
6067
  .desktop\:pt-0 {
6053
6068
  padding-top: 0px;
6054
6069
  }
@@ -6206,6 +6221,10 @@ video {
6206
6221
  width: 4rem;
6207
6222
  height: 4rem;
6208
6223
  }
6224
+ .lg-desktop\:size-5 {
6225
+ width: 1.25rem;
6226
+ height: 1.25rem;
6227
+ }
6209
6228
  .lg-desktop\:size-\[108px\] {
6210
6229
  width: 108px;
6211
6230
  height: 108px;
@@ -169,6 +169,7 @@ module.exports = {
169
169
  borderRadius: {
170
170
  btn: 'var(--btn-radius)',
171
171
  box: 'var(--box-radius)',
172
+ card: 'var(--card-radius)',
172
173
  tabs: 'var(--tabs-radius)',
173
174
  },
174
175
  lineHeight: {