@anker-in/headless-ui 1.3.45 → 1.3.47
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/biz-components/Title/index.js +1 -1
- package/dist/cjs/biz-components/Title/index.js.map +2 -2
- package/dist/cjs/components/board.d.ts +14 -4
- package/dist/cjs/components/board.js +1 -1
- package/dist/cjs/components/board.js.map +3 -3
- package/dist/cjs/components/index.d.ts +1 -1
- package/dist/cjs/components/index.js +1 -1
- package/dist/cjs/components/index.js.map +2 -2
- package/dist/cjs/shared/Styles.d.ts +0 -1
- package/dist/cjs/shared/Styles.js +1 -1
- package/dist/cjs/shared/Styles.js.map +3 -3
- package/dist/esm/biz-components/Title/index.js +1 -1
- package/dist/esm/biz-components/Title/index.js.map +2 -2
- package/dist/esm/components/board.d.ts +14 -4
- package/dist/esm/components/board.js +1 -1
- package/dist/esm/components/board.js.map +3 -3
- package/dist/esm/components/index.d.ts +1 -1
- package/dist/esm/components/index.js +1 -1
- package/dist/esm/components/index.js.map +2 -2
- package/dist/esm/shared/Styles.d.ts +0 -1
- package/dist/esm/shared/Styles.js +1 -1
- package/dist/esm/shared/Styles.js.map +3 -3
- package/package.json +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";"use client";var dt=Object.create;var w=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf,pt=Object.prototype.hasOwnProperty;var ft=(t,n)=>{for(var e in n)w(t,e,{get:n[e],enumerable:!0})},N=(t,n,e,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of ut(n))!pt.call(t,r)&&r!==e&&w(t,r,{get:()=>n[r],enumerable:!(s=ct(n,r))||s.enumerable});return t};var ht=(t,n,e)=>(e=t!=null?dt(mt(t)):{},N(n||!t||!t.__esModule?w(e,"default",{value:t,enumerable:!0}):e,t)),gt=t=>N(w({},"__esModule",{value:!0}),t);var yt={};ft(yt,{default:()=>vt});module.exports=gt(yt);var i=require("react/jsx-runtime"),a=ht(require("react")),b=require("gsap"),F=require("gsap/dist/SplitText"),H=require("gsap/dist/ScrollTrigger"),l=require("../../helpers/utils.js"),L=require("class-variance-authority"),d=require("../../components/index.js"),B=require("../../shared/Styles.js"),I=require("../../shared/trackUrlRef.js"),j=require("react-intersection-observer");const P="link",S="title";function xt(t){if(!t)return!1;if(typeof t=="string")return t.trim().length>0;const n=t?.root?.children;return!Array.isArray(n)||n.length===0?!1:n.some(e=>{const s=e?.children;return!Array.isArray(s)||s.length===0?!1:s.some(r=>typeof r?.text=="string"&&r.text.length>0)})}const wt=(0,L.cva)("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),bt=(0,L.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"}}),$=({data:t,onClick:n,className:e})=>{const{theme:s="light",extensions:r,title:h,caption:v,align:g}=t;if(!r?.textLink)return null;const u=r?.link?(0,I.trackUrlRef)(r.link,`${P}_${S}`):void 0;return(0,i.jsxs)("a",{className:(0,l.cn)({"aiui-dark":s==="dark"},"hover:text-brand-0 [&_svg_path]:hover:fill-brand-0 lg-desktop:text-base flex cursor-pointer items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"text-[#080A0F]":s==="light"},{"text-[#F5F6F7]":s==="dark"},{"justify-center mt-4":g==="center"},{"mt-1 laptop:mt-0":g==="left"},e),...u?{href:u}:{},"data-headless-type-name":`${P}#${S}`,"data-headless-title-desc-button":`${h}#${v}`,...n?{onClick:n}:{},children:[(0,i.jsx)("div",{className:"truncate whitespace-nowrap",children:r?.textLink}),(0,i.jsx)("div",{className:"lg-desktop:size-5 size-4",children:(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:(0,i.jsx)("path",{d:"M5.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z",fill:s==="dark"?"#F5F6F7":"#080A0F",className:"transition-all duration-[0.4s]"})})})]})},_=a.default.forwardRef(({data:t,className:n,classNames:e,as:s="h2",weight:r="bold",onButtonClick:h,...v},g)=>{const{title:u,titleSize:O=4,caption:C,subtitle:D,content:M,countdown:o,showCountdown:U=!1,theme:x="light",extensions:W,align:m="left"}=t,E=(0,a.useRef)(null),p=(0,a.useRef)(null),c=(0,a.useRef)(null),f=(0,a.useRef)(null),[Z,q]=(0,a.useState)(!0),{ref:G,inView:z}=(0,j.useInView)();(0,a.useImperativeHandle)(g,()=>E.current);const J=()=>{q(!1)},K=o?.targetDateTime||o?.targetDate||"",Q=o?.targetDateTime_tz,X=o?.labels?{day:o.labels.days||"Day",hour:o.labels.hours||"Hours",minute:o.labels.minutes||"Mins",second:o.labels.seconds||"Secs"}:void 0;return(0,a.useEffect)(()=>{b.gsap.registerPlugin(F.SplitText,H.ScrollTrigger);function Y(){if(!p.current)return;const tt=p.current?.clientHeight||80;c.current&&c.current.revert(),f.current&&f.current.kill(),c.current=new F.SplitText(p.current,{type:"words",wordsClass:"word"});const y=c.current.words;b.gsap.set(y,{opacity:0}),f.current=H.ScrollTrigger.create({trigger:p.current,start:"bottom bottom-=4%",end:`bottom+=${tt*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:et=>{const nt=et.progress,R=y.length||1,rt=.5,k=1/R,V=k*(1-rt),A=(R-1)*V+k,it=Math.min(1,A>0?nt/A:0);y.forEach((st,ot)=>{const at=ot*V,lt=k;let T=(it-at)/lt;T=Math.max(0,Math.min(1,T)),b.gsap.set(st,{opacity:T})})}})}return z&&Y(),()=>{c.current&&c.current.revert(),f.current&&f.current.kill()}},[z]),(0,i.jsxs)("div",{
|
|
1
|
+
"use strict";"use client";var dt=Object.create;var w=Object.defineProperty;var ct=Object.getOwnPropertyDescriptor;var ut=Object.getOwnPropertyNames;var mt=Object.getPrototypeOf,pt=Object.prototype.hasOwnProperty;var ft=(t,n)=>{for(var e in n)w(t,e,{get:n[e],enumerable:!0})},N=(t,n,e,s)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of ut(n))!pt.call(t,r)&&r!==e&&w(t,r,{get:()=>n[r],enumerable:!(s=ct(n,r))||s.enumerable});return t};var ht=(t,n,e)=>(e=t!=null?dt(mt(t)):{},N(n||!t||!t.__esModule?w(e,"default",{value:t,enumerable:!0}):e,t)),gt=t=>N(w({},"__esModule",{value:!0}),t);var yt={};ft(yt,{default:()=>vt});module.exports=gt(yt);var i=require("react/jsx-runtime"),a=ht(require("react")),b=require("gsap"),F=require("gsap/dist/SplitText"),H=require("gsap/dist/ScrollTrigger"),l=require("../../helpers/utils.js"),L=require("class-variance-authority"),d=require("../../components/index.js"),B=require("../../shared/Styles.js"),I=require("../../shared/trackUrlRef.js"),j=require("react-intersection-observer");const P="link",S="title";function xt(t){if(!t)return!1;if(typeof t=="string")return t.trim().length>0;const n=t?.root?.children;return!Array.isArray(n)||n.length===0?!1:n.some(e=>{const s=e?.children;return!Array.isArray(s)||s.length===0?!1:s.some(r=>typeof r?.text=="string"&&r.text.length>0)})}const wt=(0,L.cva)("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),bt=(0,L.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"}}),$=({data:t,onClick:n,className:e})=>{const{theme:s="light",extensions:r,title:h,caption:v,align:g}=t;if(!r?.textLink)return null;const u=r?.link?(0,I.trackUrlRef)(r.link,`${P}_${S}`):void 0;return(0,i.jsxs)("a",{className:(0,l.cn)({"aiui-dark":s==="dark"},"hover:text-brand-0 [&_svg_path]:hover:fill-brand-0 lg-desktop:text-base flex cursor-pointer items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"text-[#080A0F]":s==="light"},{"text-[#F5F6F7]":s==="dark"},{"justify-center mt-4":g==="center"},{"mt-1 laptop:mt-0":g==="left"},e),...u?{href:u}:{},"data-headless-type-name":`${P}#${S}`,"data-headless-title-desc-button":`${h}#${v}`,...n?{onClick:n}:{},children:[(0,i.jsx)("div",{className:"truncate whitespace-nowrap",children:r?.textLink}),(0,i.jsx)("div",{className:"lg-desktop:size-5 size-4",children:(0,i.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:(0,i.jsx)("path",{d:"M5.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z",fill:s==="dark"?"#F5F6F7":"#080A0F",className:"transition-all duration-[0.4s]"})})})]})},_=a.default.forwardRef(({data:t,className:n,classNames:e,as:s="h2",weight:r="bold",onButtonClick:h,...v},g)=>{const{title:u,titleSize:O=4,caption:C,subtitle:D,content:M,countdown:o,showCountdown:U=!1,theme:x="light",extensions:W,align:m="left"}=t,E=(0,a.useRef)(null),p=(0,a.useRef)(null),c=(0,a.useRef)(null),f=(0,a.useRef)(null),[Z,q]=(0,a.useState)(!0),{ref:G,inView:z}=(0,j.useInView)();(0,a.useImperativeHandle)(g,()=>E.current);const J=()=>{q(!1)},K=o?.targetDateTime||o?.targetDate||"",Q=o?.targetDateTime_tz,X=o?.labels?{day:o.labels.days||"Day",hour:o.labels.hours||"Hours",minute:o.labels.minutes||"Mins",second:o.labels.seconds||"Secs"}:void 0;return(0,a.useEffect)(()=>{b.gsap.registerPlugin(F.SplitText,H.ScrollTrigger);function Y(){if(!p.current)return;const tt=p.current?.clientHeight||80;c.current&&c.current.revert(),f.current&&f.current.kill(),c.current=new F.SplitText(p.current,{type:"words",wordsClass:"word"});const y=c.current.words;b.gsap.set(y,{opacity:0}),f.current=H.ScrollTrigger.create({trigger:p.current,start:"bottom bottom-=4%",end:`bottom+=${tt*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:et=>{const nt=et.progress,R=y.length||1,rt=.5,k=1/R,V=k*(1-rt),A=(R-1)*V+k,it=Math.min(1,A>0?nt/A:0);y.forEach((st,ot)=>{const at=ot*V,lt=k;let T=(it-at)/lt;T=Math.max(0,Math.min(1,T)),b.gsap.set(st,{opacity:T})})}})}return z&&Y(),()=>{c.current&&c.current.revert(),f.current&&f.current.kill()}},[z]),(0,i.jsxs)("div",{id:W?.id,className:(0,l.cn)("titleBottom title-box flex items-end justify-between gap-2 pb-6",n,e?.wrapper),...v,ref:E,children:[(0,i.jsxs)("div",{ref:G,className:(0,l.cn)("flex-1",e?.container,{"aiui-dark":x==="dark","text-center":m==="center","text-left":m==="left"}),children:[(C||u)&&(0,i.jsx)(d.Heading,{ref:p,as:s,size:O,html:C||u,weight:r,className:(0,l.cn)(wt({theme:x}),e?.title)}),D&&(0,i.jsx)(d.Text,{html:D,as:"div",className:(0,l.cn)(bt({theme:x}),e?.subtitle)}),xt(M)&&(0,i.jsx)(d.Text,{html:M,as:"div",size:4,className:(0,l.cn)("title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]",e?.content)}),(0,i.jsx)($,{data:t,className:(0,l.cn)({"laptop:hidden":m==="left"},e?.button),onClick:h}),U&&o&&Z&&(0,i.jsx)(d.Countdown,{endDate:K,endDate_tz:Q,timeLabels:X,showDays:o?.showDays,showHours:o?.showHours,showMinutes:o?.showMinutes,showSeconds:o?.showSeconds,theme:x,onExpire:J,hideWhenExpired:!0,align:m==="center"?"center":"left",className:(0,l.cn)("mt-4",e?.countdown)})]}),(0,i.jsx)($,{data:t,className:(0,l.cn)("hidden",{"laptop:flex":m==="left"},e?.button),onClick:h})]})});_.displayName="Title";var vt=(0,B.withLayout)(_);
|
|
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, Countdown, type HeadingProps } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitlePropsBase } from './types.js'\n\nexport interface TitleProps extends TitlePropsBase, Omit<React.HTMLAttributes<HTMLDivElement>, 'className' | 'title'> {}\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\n/**\n * \u5224\u65AD content \u5B57\u6BB5\u662F\u5426\u6709\u5B9E\u9645\u53EF\u89C1\u5185\u5BB9\u3002\n * - string\uFF1A\u53BB\u6389\u7A7A\u767D\u540E\u975E\u7A7A\u5373\u6709\u5185\u5BB9\n * - SerializedEditorState\uFF1A\u68C0\u67E5 root.children \u5185\u662F\u5426\u5B58\u5728\u975E\u7A7A\u6587\u672C\u8282\u70B9\uFF0C\n * \u907F\u514D convertLexicalToHTML \u628A\u7A7A\u6587\u6863\u8F93\u51FA\u4E3A <div class=\"payload-richtext\"></div>\n */\nfunction hasVisibleContent(content: string | { root?: { children?: unknown[] } } | null | undefined): boolean {\n if (!content) return false\n if (typeof content === 'string') return content.trim().length > 0\n const children = content?.root?.children\n if (!Array.isArray(children) || children.length === 0) return false\n return children.some((node: any) => {\n const nodeChildren = node?.children\n if (!Array.isArray(nodeChildren) || nodeChildren.length === 0) return false\n return nodeChildren.some((child: any) => typeof child?.text === 'string' && child.text.length > 0)\n })\n}\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 = ({\n data,\n onClick,\n className,\n}: {\n data: TitleProps['data']\n onClick?: () => void\n className?: string\n}) => {\n const { theme = 'light', extensions, title, caption, align } = data\n if (!extensions?.textLink) return null\n\n const href = extensions?.link ? trackUrlRef(extensions.link, `${componentType}_${componentName}`) : undefined\n\n return (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'hover:text-brand-0 [&_svg_path]:hover:fill-brand-0 lg-desktop:text-base flex cursor-pointer 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 { 'mt-1 laptop:mt-0': align === 'left' },\n className\n )}\n {...(href ? { href } : {})}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${caption}`}\n {...(onClick ? { onClick } : {})}\n >\n <div className=\"truncate whitespace-nowrap\">{extensions?.textLink}</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.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z\"\n fill={theme === 'dark' ? '#F5F6F7' : '#080A0F'}\n className=\"transition-all duration-[0.4s]\"\n />\n </svg>\n </div>\n </a>\n )\n}\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(\n ({ data, className, classNames, as = 'h2', weight = 'bold', onButtonClick, ...rest }, ref) => {\n const {\n title,\n titleSize = 4,\n caption,\n subtitle,\n content,\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 // CMS field mapping: new targetDateTime > legacy targetDate\n const countdownEndDate = countdown?.targetDateTime || countdown?.targetDate || ''\n const countdownTz = countdown?.targetDateTime_tz\n // Label mapping: plural keys (Title CMS format) \u2192 atomic Countdown format\n const countdownLabels = countdown?.labels\n ? {\n day: countdown.labels.days || 'Day',\n hour: countdown.labels.hours || 'Hours',\n minute: countdown.labels.minutes || 'Mins',\n second: countdown.labels.seconds || 'Secs',\n }\n : undefined\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 <div\n {...rest}\n id={extensions?.id}\n className={cn(\n 'titleBottom title-box flex items-end justify-between gap-2 pb-6',\n className,\n classNames?.wrapper\n )}\n ref={innerRef}\n >\n <div\n ref={inViewRef}\n className={cn('flex-1', classNames?.container, {\n 'aiui-dark': theme === 'dark',\n 'text-center': align === 'center',\n 'text-left': align === 'left',\n })}\n >\n {(caption || title) && (\n <Heading\n ref={titleRef}\n as={as}\n size={titleSize as HeadingProps['size']}\n html={caption || title}\n weight={weight}\n className={cn(titleHeadingVariants({ theme }), classNames?.title)}\n />\n )}\n {subtitle && (\n <Text html={subtitle} as=\"div\" className={cn(subtitleVariants({ theme }), classNames?.subtitle)} />\n )}\n {hasVisibleContent(content) && (\n <Text\n html={content}\n as=\"div\"\n size={4}\n className={cn(\n 'title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]',\n classNames?.content\n )}\n />\n )}\n <TitleButton\n data={data}\n className={cn({ 'laptop:hidden': align === 'left' }, classNames?.button)}\n onClick={onButtonClick}\n />\n {showCountdown && countdown && isCountdownVisible && (\n <Countdown\n endDate={countdownEndDate}\n endDate_tz={countdownTz}\n timeLabels={countdownLabels}\n showDays={countdown?.showDays}\n showHours={countdown?.showHours}\n showMinutes={countdown?.showMinutes}\n showSeconds={countdown?.showSeconds}\n theme={theme}\n onExpire={handleCountdownEnd}\n hideWhenExpired={true}\n align={align === 'center' ? 'center' : 'left'}\n className={cn('mt-4', classNames?.countdown)}\n />\n )}\n </div>\n <TitleButton\n data={data}\n className={cn('hidden', { ['laptop:flex']: align === 'left' }, classNames?.button)}\n onClick={onButtonClick}\n />\n </div>\n )\n }\n)\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
|
|
5
|
-
"mappings": "olBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAoFI,IAAAI,EAAA,6BAnFJC,EAAwE,qBACxEC,EAAqB,gBACrBC,EAA0B,+BAC1BC,EAA8B,mCAC9BC,EAAmB,kCACnBC,EAAoB,oCACpBC,EAA4D,qCAC5DC,EAA2B,kCAI3BC,EAA4B,uCAC5BC,EAA0B,uCAE1B,MAAMC,EAAg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AAG,CAACI,CAAM,CAAC,KAGT,QAAC,
|
|
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, Countdown, type HeadingProps } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitlePropsBase } from './types.js'\n\nexport interface TitleProps extends TitlePropsBase, Omit<React.HTMLAttributes<HTMLDivElement>, 'className' | 'title'> {}\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\n/**\n * \u5224\u65AD content \u5B57\u6BB5\u662F\u5426\u6709\u5B9E\u9645\u53EF\u89C1\u5185\u5BB9\u3002\n * - string\uFF1A\u53BB\u6389\u7A7A\u767D\u540E\u975E\u7A7A\u5373\u6709\u5185\u5BB9\n * - SerializedEditorState\uFF1A\u68C0\u67E5 root.children \u5185\u662F\u5426\u5B58\u5728\u975E\u7A7A\u6587\u672C\u8282\u70B9\uFF0C\n * \u907F\u514D convertLexicalToHTML \u628A\u7A7A\u6587\u6863\u8F93\u51FA\u4E3A <div class=\"payload-richtext\"></div>\n */\nfunction hasVisibleContent(content: string | { root?: { children?: unknown[] } } | null | undefined): boolean {\n if (!content) return false\n if (typeof content === 'string') return content.trim().length > 0\n const children = content?.root?.children\n if (!Array.isArray(children) || children.length === 0) return false\n return children.some((node: any) => {\n const nodeChildren = node?.children\n if (!Array.isArray(nodeChildren) || nodeChildren.length === 0) return false\n return nodeChildren.some((child: any) => typeof child?.text === 'string' && child.text.length > 0)\n })\n}\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 = ({\n data,\n onClick,\n className,\n}: {\n data: TitleProps['data']\n onClick?: () => void\n className?: string\n}) => {\n const { theme = 'light', extensions, title, caption, align } = data\n if (!extensions?.textLink) return null\n\n const href = extensions?.link ? trackUrlRef(extensions.link, `${componentType}_${componentName}`) : undefined\n\n return (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'hover:text-brand-0 [&_svg_path]:hover:fill-brand-0 lg-desktop:text-base flex cursor-pointer 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 { 'mt-1 laptop:mt-0': align === 'left' },\n className\n )}\n {...(href ? { href } : {})}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${caption}`}\n {...(onClick ? { onClick } : {})}\n >\n <div className=\"truncate whitespace-nowrap\">{extensions?.textLink}</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.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z\"\n fill={theme === 'dark' ? '#F5F6F7' : '#080A0F'}\n className=\"transition-all duration-[0.4s]\"\n />\n </svg>\n </div>\n </a>\n )\n}\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(\n ({ data, className, classNames, as = 'h2', weight = 'bold', onButtonClick, ...rest }, ref) => {\n const {\n title,\n titleSize = 4,\n caption,\n subtitle,\n content,\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 // CMS field mapping: new targetDateTime > legacy targetDate\n const countdownEndDate = countdown?.targetDateTime || countdown?.targetDate || ''\n const countdownTz = countdown?.targetDateTime_tz\n // Label mapping: plural keys (Title CMS format) \u2192 atomic Countdown format\n const countdownLabels = countdown?.labels\n ? {\n day: countdown.labels.days || 'Day',\n hour: countdown.labels.hours || 'Hours',\n minute: countdown.labels.minutes || 'Mins',\n second: countdown.labels.seconds || 'Secs',\n }\n : undefined\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 <div\n id={extensions?.id}\n className={cn(\n 'titleBottom title-box flex items-end justify-between gap-2 pb-6',\n className,\n classNames?.wrapper\n )}\n {...rest}\n ref={innerRef}\n >\n <div\n ref={inViewRef}\n className={cn('flex-1', classNames?.container, {\n 'aiui-dark': theme === 'dark',\n 'text-center': align === 'center',\n 'text-left': align === 'left',\n })}\n >\n {(caption || title) && (\n <Heading\n ref={titleRef}\n as={as}\n size={titleSize as HeadingProps['size']}\n html={caption || title}\n weight={weight}\n className={cn(titleHeadingVariants({ theme }), classNames?.title)}\n />\n )}\n {subtitle && (\n <Text html={subtitle} as=\"div\" className={cn(subtitleVariants({ theme }), classNames?.subtitle)} />\n )}\n {hasVisibleContent(content) && (\n <Text\n html={content}\n as=\"div\"\n size={4}\n className={cn(\n 'title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]',\n classNames?.content\n )}\n />\n )}\n <TitleButton\n data={data}\n className={cn({ 'laptop:hidden': align === 'left' }, classNames?.button)}\n onClick={onButtonClick}\n />\n {showCountdown && countdown && isCountdownVisible && (\n <Countdown\n endDate={countdownEndDate}\n endDate_tz={countdownTz}\n timeLabels={countdownLabels}\n showDays={countdown?.showDays}\n showHours={countdown?.showHours}\n showMinutes={countdown?.showMinutes}\n showSeconds={countdown?.showSeconds}\n theme={theme}\n onExpire={handleCountdownEnd}\n hideWhenExpired={true}\n align={align === 'center' ? 'center' : 'left'}\n className={cn('mt-4', classNames?.countdown)}\n />\n )}\n </div>\n <TitleButton\n data={data}\n className={cn('hidden', { ['laptop:flex']: align === 'left' }, classNames?.button)}\n onClick={onButtonClick}\n />\n </div>\n )\n }\n)\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
|
|
5
|
+
"mappings": "olBAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,aAAAE,KAAA,eAAAC,GAAAH,IAoFI,IAAAI,EAAA,6BAnFJC,EAAwE,qBACxEC,EAAqB,gBACrBC,EAA0B,+BAC1BC,EAA8B,mCAC9BC,EAAmB,kCACnBC,EAAoB,oCACpBC,EAA4D,qCAC5DC,EAA2B,kCAI3BC,EAA4B,uCAC5BC,EAA0B,uCAE1B,MAAMC,EAAgB,OAChBC,EAAgB,QAQtB,SAASC,GAAkBC,EAAmF,CAC5G,GAAI,CAACA,EAAS,MAAO,GACrB,GAAI,OAAOA,GAAY,SAAU,OAAOA,EAAQ,KAAK,EAAE,OAAS,EAChE,MAAMC,EAAWD,GAAS,MAAM,SAChC,MAAI,CAAC,MAAM,QAAQC,CAAQ,GAAKA,EAAS,SAAW,EAAU,GACvDA,EAAS,KAAMC,GAAc,CAClC,MAAMC,EAAeD,GAAM,SAC3B,MAAI,CAAC,MAAM,QAAQC,CAAY,GAAKA,EAAa,SAAW,EAAU,GAC/DA,EAAa,KAAMC,GAAe,OAAOA,GAAO,MAAS,UAAYA,EAAM,KAAK,OAAS,CAAC,CACnG,CAAC,CACH,CAKA,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AAK,KAAMA,EAAU,GAAG,MAAM,aAAW,MAAGpB,GAAiB,CAAE,MAAAK,CAAM,CAAC,EAAGQ,GAAY,QAAQ,EAAG,EAElGpB,GAAkBC,CAAO,MACxB,OAAC,QACC,KAAMA,EACN,GAAG,MACH,KAAM,EACN,aAAW,MACT,uHACAmB,GAAY,OACd,EACF,KAEF,OAACZ,EAAA,CACC,KAAMC,EACN,aAAW,MAAG,CAAE,gBAAiBO,IAAU,MAAO,EAAGI,GAAY,MAAM,EACvE,QAASG,EACX,EACCM,GAAiBD,GAAaM,MAC7B,OAAC,aACC,QAASK,EACT,WAAYC,EACZ,WAAYC,EACZ,SAAUb,GAAW,SACrB,UAAWA,GAAW,UACtB,YAAaA,GAAW,YACxB,YAAaA,GAAW,YACxB,MAAOhB,EACP,SAAU0B,EACV,gBAAiB,GACjB,MAAOtB,IAAU,SAAW,SAAW,OACvC,aAAW,MAAG,OAAQI,GAAY,SAAS,EAC7C,GAEJ,KACA,OAACZ,EAAA,CACC,KAAMC,EACN,aAAW,MAAG,SAAU,CAAG,cAAgBO,IAAU,MAAO,EAAGI,GAAY,MAAM,EACjF,QAASG,EACX,GACF,CAEJ,CACF,EAEAL,EAAM,YAAc,QAEpB,IAAOjC,MAAQ,cAAWiC,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", "componentType", "componentName", "hasVisibleContent", "content", "children", "node", "nodeChildren", "child", "titleHeadingVariants", "subtitleVariants", "TitleButton", "data", "onClick", "className", "theme", "extensions", "title", "caption", "align", "href", "Title", "React", "classNames", "as", "weight", "onButtonClick", "rest", "ref", "titleSize", "subtitle", "countdown", "showCountdown", "innerRef", "titleRef", "splitTextInstance", "scrollTriggerRef", "isCountdownVisible", "setIsCountdownVisible", "inViewRef", "inView", "handleCountdownEnd", "countdownEndDate", "countdownTz", "countdownLabels", "gsapResize", "height", "words", "self", "progress", "total", "overlap", "interval", "step", "lastEnd", "normalizedProgress", "word", "i", "start", "width", "opacity"]
|
|
7
7
|
}
|
|
@@ -3,9 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @description Anker Innovations品牌标识栏组件,用于显示公司Logo和品牌信息
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
interface BoardIconItem {
|
|
7
|
+
link?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
logo?: string;
|
|
11
|
+
}
|
|
12
|
+
interface BoardData {
|
|
13
|
+
leftIcon?: BoardIconItem[];
|
|
14
|
+
rightIcon?: BoardIconItem[];
|
|
15
|
+
}
|
|
16
|
+
export interface BoardProps {
|
|
17
|
+
data?: BoardData;
|
|
9
18
|
sizeClass?: string;
|
|
10
|
-
}
|
|
19
|
+
}
|
|
20
|
+
declare const Board: ({ data, sizeClass }: BoardProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
21
|
export default Board;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var h=Object.create;var i=Object.defineProperty;var c=Object.getOwnPropertyDescriptor;var g=Object.getOwnPropertyNames;var p=Object.getPrototypeOf,u=Object.prototype.hasOwnProperty;var m=(l,a)=>{for(var e in a)i(l,e,{get:a[e],enumerable:!0})},d=(l,a,e,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let r of g(a))!u.call(l,r)&&r!==e&&i(l,r,{get:()=>a[r],enumerable:!(n=c(a,r))||n.enumerable});return l};var v=(l,a,e)=>(e=l!=null?h(p(l)):{},d(a||!l||!l.__esModule?i(e,"default",{value:l,enumerable:!0}):e,l)),_=l=>d(i({},"__esModule",{value:!0}),l);var y={};m(y,{default:()=>k});module.exports=_(y);var t=require("react/jsx-runtime"),o=require("../helpers/utils.js"),f=require("./container.js"),s=v(require("./link.js"));const b=({data:l,sizeClass:a})=>(0,t.jsx)("div",{className:"relative z-[46] box-border h-[30px]",children:(0,t.jsxs)(f.Container,{childClassName:"flex !bg-[#080A0F] items-center justify-between",className:"h-full",children:[(0,t.jsx)("div",{className:"flex h-full items-center gap-2 py-[5px]",children:l?.leftIcon?.map?.((e,n)=>(0,t.jsx)(s.default,{href:e?.link,asChild:!e?.link,"aria-label":e?.label||e?.title,className:(0,o.cn)("hidden h-full",`${a||"desktop:block"}`),children:(0,t.jsx)("div",{className:(0,o.cn)(`${a||"desktop:block"}`,"hidden h-fit transition-all duration-200 [&_svg]:h-full [&_svg]:w-auto [&_svg_path]:transition-all [&_svg_path]:duration-200 [&_svg_path]:[fill:#75787F] [&_svg_path]:hover:[fill:#FFFFFF]"),style:{filter:"none"},"aria-hidden":"true",dangerouslySetInnerHTML:{__html:e?.logo||""}})},n))}),(0,t.jsx)("div",{className:"flex h-full items-center justify-end gap-2 py-[5px]",children:l?.rightIcon?.map?.((e,n)=>(0,t.jsx)(s.default,{href:e?.link,asChild:!e?.link,"aria-label":e?.label||e?.title,className:"flex h-full items-center",children:(0,t.jsx)("div",{className:"board-right-icon h-fit [&_svg]:h-full [&_svg]:w-auto",style:{filter:"none"},"aria-hidden":"true",dangerouslySetInnerHTML:{__html:e?.logo||""}})},n))})]})});var k=b;
|
|
2
2
|
//# sourceMappingURL=board.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/board.tsx"],
|
|
4
|
-
"sourcesContent": ["import { cn } from '../helpers/utils.js'\nimport { Container } from './container.js'\nimport Link from './link.js'\n\n/**\n * Board - \u54C1\u724C\u6807\u8BC6\u680F\n *\n * @description Anker Innovations\u54C1\u724C\u6807\u8BC6\u680F\u7EC4\u4EF6\uFF0C\u7528\u4E8E\u663E\u793A\u516C\u53F8Logo\u548C\u54C1\u724C\u4FE1\u606F\n */\n\
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,
|
|
6
|
-
"names": ["board_exports", "__export", "board_default", "__toCommonJS", "import_jsx_runtime", "import_utils", "import_container", "import_link", "Board", "
|
|
4
|
+
"sourcesContent": ["import { cn } from '../helpers/utils.js'\nimport { Container } from './container.js'\nimport Link from './link.js'\n\n/**\n * Board - \u54C1\u724C\u6807\u8BC6\u680F\n *\n * @description Anker Innovations\u54C1\u724C\u6807\u8BC6\u680F\u7EC4\u4EF6\uFF0C\u7528\u4E8E\u663E\u793A\u516C\u53F8Logo\u548C\u54C1\u724C\u4FE1\u606F\n */\n\ninterface BoardIconItem {\n link?: string\n label?: string\n title?: string\n logo?: string\n}\n\ninterface BoardData {\n leftIcon?: BoardIconItem[]\n rightIcon?: BoardIconItem[]\n}\n\nexport interface BoardProps {\n data?: BoardData\n sizeClass?: string\n}\n\nconst Board = ({ data, sizeClass }: BoardProps) => {\n return (\n <div className=\"relative z-[46] box-border h-[30px]\">\n <Container childClassName=\"flex !bg-[#080A0F] items-center justify-between\" className=\"h-full\">\n <div className=\"flex h-full items-center gap-2 py-[5px]\">\n {data?.leftIcon?.map?.((item: any, index: number) => (\n <Link\n key={index}\n href={item?.link}\n asChild={!item?.link}\n aria-label={item?.label || item?.title}\n className={cn('hidden h-full', `${sizeClass || 'desktop:block'}`)}\n >\n <div\n className={cn(\n `${sizeClass || 'desktop:block'}`,\n 'hidden h-fit transition-all duration-200 [&_svg]:h-full [&_svg]:w-auto [&_svg_path]:transition-all [&_svg_path]:duration-200 [&_svg_path]:[fill:#75787F] [&_svg_path]:hover:[fill:#FFFFFF]'\n )}\n style={{ filter: 'none' }}\n aria-hidden=\"true\"\n dangerouslySetInnerHTML={{ __html: item?.logo || '' }}\n />\n </Link>\n ))}\n </div>\n <div className=\"flex h-full items-center justify-end gap-2 py-[5px]\">\n {data?.rightIcon?.map?.((item: any, index: number) => (\n <Link\n key={index}\n href={item?.link}\n asChild={!item?.link}\n aria-label={item?.label || item?.title}\n className=\"flex h-full items-center\"\n >\n <div\n className=\"board-right-icon h-fit [&_svg]:h-full [&_svg]:w-auto\"\n style={{ filter: 'none' }}\n aria-hidden=\"true\"\n dangerouslySetInnerHTML={{ __html: item?.logo || '' }}\n />\n </Link>\n ))}\n </div>\n </Container>\n </div>\n )\n}\n\nexport default Board\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,aAAAE,IAAA,eAAAC,EAAAH,GA8BM,IAAAI,EAAA,6BA9BNC,EAAmB,+BACnBC,EAA0B,0BAC1BC,EAAiB,wBAyBjB,MAAMC,EAAQ,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,OAE7B,OAAC,OAAI,UAAU,sCACb,oBAAC,aAAU,eAAe,kDAAkD,UAAU,SACpF,oBAAC,OAAI,UAAU,0CACZ,SAAAD,GAAM,UAAU,MAAM,CAACE,EAAWC,OACjC,OAAC,EAAAC,QAAA,CAEC,KAAMF,GAAM,KACZ,QAAS,CAACA,GAAM,KAChB,aAAYA,GAAM,OAASA,GAAM,MACjC,aAAW,MAAG,gBAAiB,GAAGD,GAAa,eAAe,EAAE,EAEhE,mBAAC,OACC,aAAW,MACT,GAAGA,GAAa,eAAe,GAC/B,4LACF,EACA,MAAO,CAAE,OAAQ,MAAO,EACxB,cAAY,OACZ,wBAAyB,CAAE,OAAQC,GAAM,MAAQ,EAAG,EACtD,GAdKC,CAeP,CACD,EACH,KACA,OAAC,OAAI,UAAU,sDACZ,SAAAH,GAAM,WAAW,MAAM,CAACE,EAAWC,OAClC,OAAC,EAAAC,QAAA,CAEC,KAAMF,GAAM,KACZ,QAAS,CAACA,GAAM,KAChB,aAAYA,GAAM,OAASA,GAAM,MACjC,UAAU,2BAEV,mBAAC,OACC,UAAU,uDACV,MAAO,CAAE,OAAQ,MAAO,EACxB,cAAY,OACZ,wBAAyB,CAAE,OAAQA,GAAM,MAAQ,EAAG,EACtD,GAXKC,CAYP,CACD,EACH,GACF,EACF,EAIJ,IAAOV,EAAQM",
|
|
6
|
+
"names": ["board_exports", "__export", "board_default", "__toCommonJS", "import_jsx_runtime", "import_utils", "import_container", "import_link", "Board", "data", "sizeClass", "item", "index", "Link"]
|
|
7
7
|
}
|
|
@@ -23,7 +23,7 @@ export { Tabs, TabsList, TabsTrigger, TabsContent } from './tabs.js';
|
|
|
23
23
|
export { Alert, AlertTitle, AlertDescription } from './alert.js';
|
|
24
24
|
export { default as Picture } from './picture.js';
|
|
25
25
|
export { default as Theme } from './theme.js';
|
|
26
|
-
export { default as Board } from './board.js';
|
|
26
|
+
export { default as Board, type BoardProps } from './board.js';
|
|
27
27
|
export { default as LoadingDots } from './loadingDots.js';
|
|
28
28
|
export { ExposureDetector, type ExposureDetectorProps } from './ExposureDetector.js';
|
|
29
29
|
export { default as BrandStrip } from './brand-strip.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var j=Object.create;var D=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var J=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var Q=(t,n)=>{for(var
|
|
1
|
+
"use strict";var j=Object.create;var D=Object.defineProperty;var z=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var J=Object.getPrototypeOf,K=Object.prototype.hasOwnProperty;var Q=(t,n)=>{for(var u in n)D(t,u,{get:n[u],enumerable:!0})},P=(t,n,u,w)=>{if(n&&typeof n=="object"||typeof n=="function")for(let m of q(n))!K.call(t,m)&&m!==u&&D(t,m,{get:()=>n[m],enumerable:!(w=z(n,m))||w.enumerable});return t};var p=(t,n,u)=>(u=t!=null?j(J(t)):{},P(n||!t||!t.__esModule?D(u,"default",{value:t,enumerable:!0}):u,t)),U=t=>P(D({},"__esModule",{value:!0}),t);var V={};Q(V,{Alert:()=>f.Alert,AlertDescription:()=>f.AlertDescription,AlertTitle:()=>f.AlertTitle,Avatar:()=>i.Avatar,AvatarFallback:()=>i.AvatarFallback,AvatarImage:()=>i.AvatarImage,Badge:()=>T.default,Board:()=>H.default,BrandStrip:()=>F.default,Button:()=>y.default,Card:()=>a.Card,CardContent:()=>a.CardContent,CardDescription:()=>a.CardDescription,CardFooter:()=>a.CardFooter,CardHeader:()=>a.CardHeader,CardTitle:()=>a.CardTitle,Carousel:()=>s.Carousel,CarouselContent:()=>s.CarouselContent,CarouselItem:()=>s.CarouselItem,CarouselNext:()=>s.CarouselNext,CarouselPrevious:()=>s.CarouselPrevious,Checkbox:()=>M.default,Color:()=>v.Color,Container:()=>G.Container,Countdown:()=>k.default,Dialog:()=>r.Dialog,DialogClose:()=>r.DialogClose,DialogContent:()=>r.DialogContent,DialogDescription:()=>r.DialogDescription,DialogFooter:()=>r.DialogFooter,DialogHeader:()=>r.DialogHeader,DialogOverlay:()=>r.DialogOverlay,DialogPortal:()=>r.DialogPortal,DialogTitle:()=>r.DialogTitle,DialogTrigger:()=>r.DialogTrigger,Drawer:()=>e.Drawer,DrawerClose:()=>e.DrawerClose,DrawerContent:()=>e.DrawerContent,DrawerDescription:()=>e.DrawerDescription,DrawerFooter:()=>e.DrawerFooter,DrawerHeader:()=>e.DrawerHeader,DrawerOverlay:()=>e.DrawerOverlay,DrawerPortal:()=>e.DrawerPortal,DrawerTitle:()=>e.DrawerTitle,DrawerTrigger:()=>e.DrawerTrigger,DropdownMenu:()=>o.DropdownMenu,DropdownMenuCheckboxItem:()=>o.DropdownMenuCheckboxItem,DropdownMenuContent:()=>o.DropdownMenuContent,DropdownMenuGroup:()=>o.DropdownMenuGroup,DropdownMenuItem:()=>o.DropdownMenuItem,DropdownMenuLabel:()=>o.DropdownMenuLabel,DropdownMenuPortal:()=>o.DropdownMenuPortal,DropdownMenuRadioGroup:()=>o.DropdownMenuRadioGroup,DropdownMenuRadioItem:()=>o.DropdownMenuRadioItem,DropdownMenuSeparator:()=>o.DropdownMenuSeparator,DropdownMenuShortcut:()=>o.DropdownMenuShortcut,DropdownMenuSub:()=>o.DropdownMenuSub,DropdownMenuSubContent:()=>o.DropdownMenuSubContent,DropdownMenuSubTrigger:()=>o.DropdownMenuSubTrigger,DropdownMenuTrigger:()=>o.DropdownMenuTrigger,ExposureDetector:()=>h.ExposureDetector,Grid:()=>g.Grid,GridItem:()=>g.GridItem,Heading:()=>c.Heading,Input:()=>x.Input,InputNumber:()=>A.default,InputSlot:()=>x.InputSlot,Link:()=>S.default,LoadingDots:()=>L.default,OtpInput:()=>O.default,Picture:()=>B.default,Popover:()=>l.Popover,PopoverContent:()=>l.PopoverContent,PopoverTrigger:()=>l.PopoverTrigger,Progress:()=>N.default,RadioGroup:()=>C.RadioGroup,RadioGroupItem:()=>C.RadioGroupItem,Skeleton:()=>I.default,Tabs:()=>d.Tabs,TabsContent:()=>d.TabsContent,TabsList:()=>d.TabsList,TabsTrigger:()=>d.TabsTrigger,Text:()=>b.Text,Theme:()=>R.default,sizeMap:()=>E.sizeMap});module.exports=U(V);var y=p(require("./button.js")),T=p(require("./badge.js")),x=require("./input.js"),M=p(require("./checkbox.js")),I=p(require("./skeleton.js")),r=require("./dialog.js"),l=require("./popover.js"),C=require("./radio.js"),b=require("./text.js"),g=require("./grid.js"),c=require("./heading.js"),G=require("./container.js"),v=require("./color.js"),e=require("./drawer.js"),S=p(require("./link.js")),i=require("./avatar.js"),A=p(require("./input-number.js")),o=require("./drop-down.js"),a=require("./card.js"),k=p(require("./Countdown.js")),s=require("./carousel.js"),d=require("./tabs.js"),f=require("./alert.js"),B=p(require("./picture.js")),R=p(require("./theme.js")),H=p(require("./board.js")),L=p(require("./loadingDots.js")),h=require("./ExposureDetector.js"),F=p(require("./brand-strip.js")),N=p(require("./progress.js")),O=p(require("./otp-input.js")),E=require("./button.js");
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as Button } from './button.js'\nexport { default as Badge } from './badge.js'\nexport { Input, InputSlot } from './input.js'\n\nexport { default as Checkbox } from './checkbox.js'\n\nexport { default as Skeleton } from './skeleton.js'\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './dialog.js'\nexport { Popover, PopoverTrigger, PopoverContent } from './popover.js'\nexport { RadioGroup, RadioGroupItem, type RadioGroupProps, type RadioGroupItemProps } from './radio.js'\nexport { Text, type TextProps } from './text.js'\nexport { Grid, GridItem, type GridProps, type GridItemProps } from './grid.js'\nexport { Heading, type HeadingProps } from './heading.js'\nexport { Container, type ContainerProps } from './container.js'\nexport { Color, type ColorProps } from './color.js'\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n} from './drawer.js'\nexport { default as Link, type LinkProps } from './link.js'\nexport { Avatar, AvatarImage, AvatarFallback } from './avatar.js'\nexport { default as InputNumber, type InputNumberProps } from './input-number.js'\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n} from './drop-down.js'\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from './card.js'\nexport { default as Countdown, type CountdownProps } from './Countdown.js'\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n} from './carousel.js'\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './tabs.js'\nexport { Alert, AlertTitle, AlertDescription } from './alert.js'\nexport { default as Picture } from './picture.js'\nexport { default as Theme } from './theme.js'\nexport { default as Board } from './board.js'\nexport { default as LoadingDots } from './loadingDots.js'\nexport { ExposureDetector, type ExposureDetectorProps } from './ExposureDetector.js'\nexport { default as BrandStrip } from './brand-strip.js'\nexport { default as Progress, type ProgressProps, type ProgressClassNames } from './progress.js'\nexport { default as OtpInput, type OtpInputProps } from './otp-input.js'\n\n// \u516C\uAC1C\u5BFC\u51FA button \u5185\u90E8\u5DE5\u5177\uFF08\u4F9B Registry \u5206\u53D1\u7684 biz-components \u4F7F\u7528\uFF09\nexport { sizeMap } from './button.js'\nexport type { ButtonProps } from './button.js'\n"],
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6lFAAAE,EAAAF,GAAA,IAAAG,EAAkC,0BAClCC,EAAiC,yBACjCC,EAAiC,sBAEjCC,EAAoC,4BAEpCC,EAAoC,4BACpCC,EAWO,uBACPC,EAAwD,wBACxDC,EAA2F,sBAC3FC,EAAqC,qBACrCC,EAAmE,qBACnEC,EAA2C,wBAC3CC,EAA+C,0BAC/CC,EAAuC,sBACvCC,EAWO,uBACPC,EAAgD,wBAChDC,EAAoD,uBACpDC,EAA8D,gCAC9DC,EAgBO,0BACPC,EAAsF,qBACtFC,EAA0D,6BAC1DC,EAOO,yBACPC,EAAyD,qBACzDC,EAAoD,sBACpDC,EAAmC,2BACnCC,EAAiC,yBACjCC,
|
|
4
|
+
"sourcesContent": ["export { default as Button } from './button.js'\nexport { default as Badge } from './badge.js'\nexport { Input, InputSlot } from './input.js'\n\nexport { default as Checkbox } from './checkbox.js'\n\nexport { default as Skeleton } from './skeleton.js'\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './dialog.js'\nexport { Popover, PopoverTrigger, PopoverContent } from './popover.js'\nexport { RadioGroup, RadioGroupItem, type RadioGroupProps, type RadioGroupItemProps } from './radio.js'\nexport { Text, type TextProps } from './text.js'\nexport { Grid, GridItem, type GridProps, type GridItemProps } from './grid.js'\nexport { Heading, type HeadingProps } from './heading.js'\nexport { Container, type ContainerProps } from './container.js'\nexport { Color, type ColorProps } from './color.js'\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n} from './drawer.js'\nexport { default as Link, type LinkProps } from './link.js'\nexport { Avatar, AvatarImage, AvatarFallback } from './avatar.js'\nexport { default as InputNumber, type InputNumberProps } from './input-number.js'\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n} from './drop-down.js'\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from './card.js'\nexport { default as Countdown, type CountdownProps } from './Countdown.js'\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n} from './carousel.js'\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './tabs.js'\nexport { Alert, AlertTitle, AlertDescription } from './alert.js'\nexport { default as Picture } from './picture.js'\nexport { default as Theme } from './theme.js'\nexport { default as Board, type BoardProps } from './board.js'\nexport { default as LoadingDots } from './loadingDots.js'\nexport { ExposureDetector, type ExposureDetectorProps } from './ExposureDetector.js'\nexport { default as BrandStrip } from './brand-strip.js'\nexport { default as Progress, type ProgressProps, type ProgressClassNames } from './progress.js'\nexport { default as OtpInput, type OtpInputProps } from './otp-input.js'\n\n// \u516C\uAC1C\u5BFC\u51FA button \u5185\u90E8\u5DE5\u5177\uFF08\u4F9B Registry \u5206\u53D1\u7684 biz-components \u4F7F\u7528\uFF09\nexport { sizeMap } from './button.js'\nexport type { ButtonProps } from './button.js'\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,6lFAAAE,EAAAF,GAAA,IAAAG,EAAkC,0BAClCC,EAAiC,yBACjCC,EAAiC,sBAEjCC,EAAoC,4BAEpCC,EAAoC,4BACpCC,EAWO,uBACPC,EAAwD,wBACxDC,EAA2F,sBAC3FC,EAAqC,qBACrCC,EAAmE,qBACnEC,EAA2C,wBAC3CC,EAA+C,0BAC/CC,EAAuC,sBACvCC,EAWO,uBACPC,EAAgD,wBAChDC,EAAoD,uBACpDC,EAA8D,gCAC9DC,EAgBO,0BACPC,EAAsF,qBACtFC,EAA0D,6BAC1DC,EAOO,yBACPC,EAAyD,qBACzDC,EAAoD,sBACpDC,EAAmC,2BACnCC,EAAiC,yBACjCC,EAAkD,yBAClDC,EAAuC,+BACvCC,EAA6D,iCAC7DC,EAAsC,+BACtCC,EAAiF,4BACjFC,EAAwD,6BAGxD9B,EAAwB",
|
|
6
6
|
"names": ["components_exports", "__export", "__toCommonJS", "import_button", "import_badge", "import_input", "import_checkbox", "import_skeleton", "import_dialog", "import_popover", "import_radio", "import_text", "import_grid", "import_heading", "import_container", "import_color", "import_drawer", "import_link", "import_avatar", "import_input_number", "import_drop_down", "import_card", "import_Countdown", "import_carousel", "import_tabs", "import_alert", "import_picture", "import_theme", "import_board", "import_loadingDots", "import_ExposureDetector", "import_brand_strip", "import_progress", "import_otp_input"]
|
|
7
7
|
}
|
|
@@ -10,7 +10,6 @@ export interface StylesProps {
|
|
|
10
10
|
uid?: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
containerClassName?: string;
|
|
13
|
-
idx?: string;
|
|
14
13
|
}
|
|
15
14
|
type LayoutProps<P> = Omit<P, keyof StylesProps | keyof ContainerProps> & StylesProps & ContainerProps;
|
|
16
15
|
type StaticComponentProperties<T> = Omit<T, keyof React.ComponentType<any> | 'displayName' | 'prototype'>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var h=Object.create;var m=Object.defineProperty;var
|
|
1
|
+
"use strict";var h=Object.create;var m=Object.defineProperty;var $=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var j=Object.getPrototypeOf,L=Object.prototype.hasOwnProperty;var E=(t,e)=>{for(var n in e)m(t,n,{get:e[n],enumerable:!0})},C=(t,e,n,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of x(e))!L.call(t,o)&&o!==n&&m(t,o,{get:()=>e[o],enumerable:!(r=$(e,o))||r.enumerable});return t};var d=(t,e,n)=>(n=t!=null?h(j(t)):{},C(e||!t||!t.__esModule?m(n,"default",{value:t,enumerable:!0}):n,t)),B=t=>C(m({},"__esModule",{value:!0}),t);var U={};E(U,{getStylesProps:()=>T,useStyles:()=>N,withLayout:()=>D});module.exports=B(U);var s=require("react/jsx-runtime"),a=d(require("react")),S=require("./simpleHash.js"),g=d(require("./getKeyPropsString.js")),u=require("../components/grid.js"),b=require("../components/container.js"),w=d(require("./ErrorBoundary.js"));const _={12:"col-start-1 col-end-13",10:"col-start-2 col-end-12",8:"col-start-3 col-end-11",6:"col-start-4 col-end-10",4:"col-start-5 col-end-9"},O={12:"tablet:col-start-1 tablet:col-end-13",10:"tablet:col-start-2 tablet:col-end-12",8:"tablet:col-start-3 tablet:col-end-11",6:"tablet:col-start-4 tablet:col-end-10",4:"tablet:col-start-5 tablet:col-end-9"},f=t=>{const e=(0,g.default)(t);return`style_${(0,S.simpleHash)(e)}`},T=t=>{const{style:e,uid:n,disabled:r,containerClassName:o}=t;return{style:e,uid:n,disabled:r,containerClassName:o}},G=({style:t,uid:e=f({}),disabled:n=!1})=>!t||n?null:(0,s.jsx)("style",{suppressHydrationWarning:!0,"data-style-id":e,dangerouslySetInnerHTML:{__html:`.block-${e} { ${t} }`}}),N=(t,e)=>{const n=(0,a.useMemo)(()=>t?.uid||f({...t,...e??{}}),[e,t]),r=(0,a.useMemo)(()=>(0,s.jsx)(G,{...t,uid:n}),[t,n]);return{className:`block-${n} `,StyleComponent:r,uid:n,idx:e?.idx!=null?String(e.idx):void 0}},A=t=>{const{desktopSpan:e,mobileSpan:n}=t||{},r=n?_[n]:"",o=e?O[e]:"";return`${r} ${o}`.trim()},F=t=>t?typeof t=="string"?t:typeof t=="object"&&Object.entries(t).length<=0?"":Object.entries(t).map(([e,n])=>`${e.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${n}`).join("; ")+";":"",K=(t,e)=>[t,e].map(F).filter(n=>!!n).map(n=>n.trim().endsWith(";")?n:`${n};`).join(" ");function v(t,e){const n=a.default.forwardRef((r,o)=>{const{container:i,containerClassName:c,className:l,...p}=r;if(!i||Reflect.ownKeys(i).length===0)return(0,s.jsx)(t,{...p,className:l,ref:o});const y=[e,c,l].filter(Boolean).join(" ").trim();return(0,s.jsx)(b.Container,{className:y,children:(0,s.jsx)(u.Grid,{className:"container_grid",children:(0,s.jsx)(u.GridItem,{className:A(i),children:(0,s.jsx)(t,{...p,ref:o})})})})});return n.displayName=`WithContainerLayout(${t.displayName||t.name||"Component"})`,n}function H(t,e){const n=a.default.forwardRef((r,o)=>{const i=T(r),c=K(e?.style,i.style),l={...e,...i,...c&&{style:c}},{className:p,StyleComponent:y,idx:P}=N(l,r.data),{style:Z,uid:q,disabled:z,className:I,...k}=r;return(0,s.jsxs)(s.Fragment,{children:[y,(0,s.jsx)(t,{...P?{id:P}:{},...k,className:[p,I].filter(Boolean).join(" ").trim(),ref:o})]})});return n.displayName=`WithStyleInjection(${t.displayName||t.name||"Component"})`,n}function M(t){const e=a.default.forwardRef((n,r)=>(0,s.jsx)(w.default,{children:(0,s.jsx)(t,{...n,ref:r})}));return e.displayName=`WithErrorBoundary(${t.displayName||t.name||"Component"})`,e}const R=new WeakMap;function D(t,e){if(R.has(t))return t;const n=M(H(v(t,e?.containerClassName),e));n.displayName=`WithLayout(${t.displayName||t.name||"Component"})`,R.set(t,!0);const r=n;return Object.getOwnPropertyNames(t).forEach(o=>{!(o in r)&&o!=="arguments"&&o!=="caller"&&o!=="length"&&o!=="name"&&(r[o]=t[o])}),r}
|
|
2
2
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/shared/Styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\nimport { Grid, GridItem } from '../components/grid.js'\nimport { Container } from '../components/container.js'\nimport ErrorBoundary from './ErrorBoundary.js'\n\nconst colContentClasses: Record<number, string> = {\n 12: 'col-start-1 col-end-13',\n 10: 'col-start-2 col-end-12',\n 8: 'col-start-3 col-end-11',\n 6: 'col-start-4 col-end-10',\n 4: 'col-start-5 col-end-9',\n} as const\n\n// \u9884\u5B9A\u4E49\u5E26 tablet \u524D\u7F00\u7684\u7C7B\u540D\uFF0C\u786E\u4FDD Tailwind \u53EF\u4EE5\u8BC6\u522B\nconst colContentClassesTablet: Record<number, string> = {\n 12: 'tablet:col-start-1 tablet:col-end-13',\n 10: 'tablet:col-start-2 tablet:col-end-12',\n 8: 'tablet:col-start-3 tablet:col-end-11',\n 6: 'tablet:col-start-4 tablet:col-end-10',\n 4: 'tablet:col-start-5 tablet:col-end-9',\n} as const\n\nexport interface ContainerProps {\n container?: {\n desktopSpan: number\n mobileSpan: number\n }\n}\n\nexport interface StylesProps {\n style?: string | React.CSSProperties\n uid?: string\n disabled?: boolean\n containerClassName?: string\n
|
|
5
|
-
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,cAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,
|
|
6
|
-
"names": ["Styles_exports", "__export", "getStylesProps", "useStyles", "withLayout", "__toCommonJS", "import_jsx_runtime", "import_react", "import_simpleHash", "import_getKeyPropsString", "import_grid", "import_container", "import_ErrorBoundary", "colContentClasses", "colContentClassesTablet", "generateUID", "props", "keyString", "getKeyPropsString", "style", "uid", "disabled", "containerClassName", "
|
|
4
|
+
"sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\nimport { Grid, GridItem } from '../components/grid.js'\nimport { Container } from '../components/container.js'\nimport ErrorBoundary from './ErrorBoundary.js'\n\nconst colContentClasses: Record<number, string> = {\n 12: 'col-start-1 col-end-13',\n 10: 'col-start-2 col-end-12',\n 8: 'col-start-3 col-end-11',\n 6: 'col-start-4 col-end-10',\n 4: 'col-start-5 col-end-9',\n} as const\n\n// \u9884\u5B9A\u4E49\u5E26 tablet \u524D\u7F00\u7684\u7C7B\u540D\uFF0C\u786E\u4FDD Tailwind \u53EF\u4EE5\u8BC6\u522B\nconst colContentClassesTablet: Record<number, string> = {\n 12: 'tablet:col-start-1 tablet:col-end-13',\n 10: 'tablet:col-start-2 tablet:col-end-12',\n 8: 'tablet:col-start-3 tablet:col-end-11',\n 6: 'tablet:col-start-4 tablet:col-end-10',\n 4: 'tablet:col-start-5 tablet:col-end-9',\n} as const\n\nexport interface ContainerProps {\n container?: {\n desktopSpan: number\n mobileSpan: number\n }\n}\n\nexport interface StylesProps {\n style?: string | React.CSSProperties\n uid?: string\n disabled?: boolean\n containerClassName?: string\n}\n\ntype LayoutProps<P> = Omit<P, keyof StylesProps | keyof ContainerProps> & StylesProps & ContainerProps\n\ntype StaticComponentProperties<T> = Omit<T, keyof React.ComponentType<any> | 'displayName' | 'prototype'>\n\nconst generateUID = (props: Record<string, unknown>) => {\n const keyString = getKeyPropsString(props)\n return `style_${simpleHash(keyString)}`\n}\n\nexport const getStylesProps = <T extends StylesProps>(props: T): StylesProps => {\n const { style, uid, disabled, containerClassName } = props\n return { style, uid, disabled, containerClassName }\n}\n\nconst Styles: React.FC<StylesProps> = ({ style, uid = generateUID({}), disabled = false }) => {\n if (!style || disabled) {\n return null\n }\n\n return (\n <style\n suppressHydrationWarning\n data-style-id={uid}\n dangerouslySetInnerHTML={{ __html: `.block-${uid} { ${style} }` }}\n />\n )\n}\n\nexport const useStyles = (styleProps: Partial<StylesProps>, data?: Record<string, unknown>) => {\n const uid = useMemo(() => styleProps?.uid || generateUID({ ...styleProps, ...(data ?? {}) }), [data, styleProps])\n\n const StyleComponent = useMemo(() => <Styles {...styleProps} uid={uid} />, [styleProps, uid])\n\n return {\n className: `block-${uid} `,\n StyleComponent,\n uid,\n idx: data?.idx != null ? String(data.idx) : undefined,\n } as const\n}\n\nconst getGridItemClassName = (container?: ContainerProps['container']) => {\n const { desktopSpan, mobileSpan } = container || {}\n const mobileClasses = mobileSpan ? colContentClasses[mobileSpan] : ''\n const desktopClasses = desktopSpan ? colContentClassesTablet[desktopSpan] : ''\n return `${mobileClasses} ${desktopClasses}`.trim()\n}\n\nconst styleToString = (style?: string | React.CSSProperties): string => {\n if (!style) return ''\n if (typeof style === 'string') return style\n if (typeof style === 'object' && Object.entries(style).length <= 0) return ''\n return (\n Object.entries(style)\n .map(([key, value]) => {\n const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase()\n return `${cssKey}: ${value}`\n })\n .join('; ') + ';'\n )\n}\n\nconst mergeStyles = (a?: string | React.CSSProperties, b?: string | React.CSSProperties): string =>\n [a, b]\n .map(styleToString)\n .filter((s): s is string => Boolean(s))\n .map(s => (s.trim().endsWith(';') ? s : `${s};`))\n .join(' ')\n\ntype InternalProps = StylesProps &\n ContainerProps & { className?: string; data?: Record<string, unknown> } & Record<string, unknown>\n\nfunction withContainerLayout(\n WrappedComponent: React.ComponentType<InternalProps>,\n defaultContainerClassName?: string\n): React.ComponentType<InternalProps> {\n const Wrapped = React.forwardRef<unknown, InternalProps>((props, ref) => {\n // eslint-disable-next-line no-unused-vars\n const { container, containerClassName, className, ...componentProps } = props\n\n if (!container || Reflect.ownKeys(container).length === 0) {\n return <WrappedComponent {...componentProps} className={className as string | undefined} ref={ref} />\n }\n\n const mergedContainerClassName = [defaultContainerClassName, containerClassName, className]\n .filter(Boolean)\n .join(' ')\n .trim()\n\n return (\n <Container className={mergedContainerClassName}>\n <Grid className=\"container_grid\">\n <GridItem className={getGridItemClassName(container as ContainerProps['container'])}>\n <WrappedComponent {...componentProps} ref={ref} />\n </GridItem>\n </Grid>\n </Container>\n )\n })\n\n Wrapped.displayName = `WithContainerLayout(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`\n return Wrapped as React.ComponentType<InternalProps>\n}\n\nfunction withStyleInjection(\n WrappedComponent: React.ComponentType<InternalProps>,\n defaultStyleProps?: Partial<StylesProps>\n): React.ComponentType<InternalProps> {\n const Wrapped = React.forwardRef<unknown, InternalProps>((props, ref) => {\n const propsStyleProps = getStylesProps(props)\n const mergedStyle = mergeStyles(defaultStyleProps?.style, propsStyleProps.style)\n\n const finalStyleProps: StylesProps = {\n ...defaultStyleProps,\n ...propsStyleProps,\n ...(mergedStyle && { style: mergedStyle }),\n }\n\n const { className, StyleComponent, idx } = useStyles(\n finalStyleProps,\n props.data as Record<string, unknown> | undefined\n )\n\n // eslint-disable-next-line no-unused-vars\n const { style: _s, uid: _u, disabled: _d, className: ownClassName, ...rest } = props\n\n return (\n <>\n {StyleComponent}\n <WrappedComponent\n {...(idx ? { id: idx } : {})}\n {...rest}\n className={[className, ownClassName].filter(Boolean).join(' ').trim()}\n ref={ref}\n />\n </>\n )\n })\n\n Wrapped.displayName = `WithStyleInjection(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`\n return Wrapped as React.ComponentType<InternalProps>\n}\n\nfunction withErrorBoundary(WrappedComponent: React.ComponentType<InternalProps>): React.ComponentType<InternalProps> {\n const Wrapped = React.forwardRef<unknown, InternalProps>((props, ref) => (\n <ErrorBoundary>\n <WrappedComponent {...props} ref={ref} />\n </ErrorBoundary>\n ))\n\n Wrapped.displayName = `WithErrorBoundary(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`\n return Wrapped as React.ComponentType<InternalProps>\n}\n\nconst wrappedComponents = new WeakMap<React.ComponentType<never>, true>()\n\nexport function withLayout<T extends React.ComponentType<any>>(\n WrappedComponent: T,\n defaultLayoutProps?: Partial<StylesProps & ContainerProps>\n): React.ForwardRefExoticComponent<LayoutProps<React.ComponentProps<T>> & React.RefAttributes<unknown>> &\n StaticComponentProperties<T> {\n if (wrappedComponents.has(WrappedComponent as React.ComponentType<never>)) {\n return WrappedComponent as unknown as React.ForwardRefExoticComponent<\n LayoutProps<React.ComponentProps<T>> & React.RefAttributes<unknown>\n > &\n StaticComponentProperties<T>\n }\n\n const composed = withErrorBoundary(\n withStyleInjection(\n withContainerLayout(\n WrappedComponent as unknown as React.ComponentType<InternalProps>,\n defaultLayoutProps?.containerClassName\n ),\n defaultLayoutProps\n )\n )\n\n composed.displayName = `WithLayout(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`\n\n wrappedComponents.set(WrappedComponent as React.ComponentType<never>, true)\n\n const result = composed as unknown as React.ForwardRefExoticComponent<\n LayoutProps<React.ComponentProps<T>> & React.RefAttributes<unknown>\n > &\n StaticComponentProperties<T>\n\n Object.getOwnPropertyNames(WrappedComponent).forEach(key => {\n if (!(key in result) && key !== 'arguments' && key !== 'caller' && key !== 'length' && key !== 'name') {\n ;(result as any)[key] = (WrappedComponent as any)[key]\n }\n })\n\n return result\n}\n"],
|
|
5
|
+
"mappings": "0jBAAA,IAAAA,EAAA,GAAAC,EAAAD,EAAA,oBAAAE,EAAA,cAAAC,EAAA,eAAAC,IAAA,eAAAC,EAAAL,GA0DI,IAAAM,EAAA,6BA1DJC,EAA+B,oBAC/BC,EAA2B,2BAC3BC,EAA8B,qCAC9BC,EAA+B,iCAC/BC,EAA0B,sCAC1BC,EAA0B,iCAE1B,MAAMC,EAA4C,CAChD,GAAI,yBACJ,GAAI,yBACJ,EAAG,yBACH,EAAG,yBACH,EAAG,uBACL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E1E,MAAMwB,EAASD,EAKf,cAAO,oBAAoBvB,CAAgB,EAAE,QAAQP,GAAO,CACtD,EAAEA,KAAO+B,IAAW/B,IAAQ,aAAeA,IAAQ,UAAYA,IAAQ,UAAYA,IAAQ,SAC3F+B,EAAe/B,CAAG,EAAKO,EAAyBP,CAAG,EAEzD,CAAC,EAEM+B,CACT",
|
|
6
|
+
"names": ["Styles_exports", "__export", "getStylesProps", "useStyles", "withLayout", "__toCommonJS", "import_jsx_runtime", "import_react", "import_simpleHash", "import_getKeyPropsString", "import_grid", "import_container", "import_ErrorBoundary", "colContentClasses", "colContentClassesTablet", "generateUID", "props", "keyString", "getKeyPropsString", "style", "uid", "disabled", "containerClassName", "Styles", "styleProps", "data", "StyleComponent", "getGridItemClassName", "container", "desktopSpan", "mobileSpan", "mobileClasses", "desktopClasses", "styleToString", "key", "value", "mergeStyles", "a", "b", "s", "withContainerLayout", "WrappedComponent", "defaultContainerClassName", "Wrapped", "React", "ref", "className", "componentProps", "mergedContainerClassName", "withStyleInjection", "defaultStyleProps", "propsStyleProps", "mergedStyle", "finalStyleProps", "idx", "_s", "_u", "_d", "ownClassName", "rest", "withErrorBoundary", "ErrorBoundary", "wrappedComponents", "defaultLayoutProps", "composed", "result"]
|
|
7
7
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";import{jsx as i,jsxs as k}from"react/jsx-runtime";import st,{useEffect as ot,useRef as g,useImperativeHandle as at,useState as lt}from"react";import{gsap as y}from"gsap";import{SplitText as z}from"gsap/dist/SplitText";import{ScrollTrigger as R}from"gsap/dist/ScrollTrigger";import{cn as o}from"../../helpers/utils.js";import{cva as V}from"class-variance-authority";import{Heading as dt,Text as A,Countdown as ct}from"../../components/index.js";import{withLayout as ut}from"../../shared/Styles.js";import{trackUrlRef as mt}from"../../shared/trackUrlRef.js";import{useInView as pt}from"react-intersection-observer";const N="link",P="title";function ft(n){if(!n)return!1;if(typeof n=="string")return n.trim().length>0;const a=n?.root?.children;return!Array.isArray(a)||a.length===0?!1:a.some(e=>{const r=e?.children;return!Array.isArray(r)||r.length===0?!1:r.some(s=>typeof s?.text=="string"&&s.text.length>0)})}const ht=V("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),gt=V("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:n,onClick:a,className:e})=>{const{theme:r="light",extensions:s,title:p,caption:x,align:f}=n;if(!s?.textLink)return null;const d=s?.link?mt(s.link,`${N}_${P}`):void 0;return k("a",{className:o({"aiui-dark":r==="dark"},"hover:text-brand-0 [&_svg_path]:hover:fill-brand-0 lg-desktop:text-base flex cursor-pointer items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"text-[#080A0F]":r==="light"},{"text-[#F5F6F7]":r==="dark"},{"justify-center mt-4":f==="center"},{"mt-1 laptop:mt-0":f==="left"},e),...d?{href:d}:{},"data-headless-type-name":`${N}#${P}`,"data-headless-title-desc-button":`${p}#${x}`,...a?{onClick:a}:{},children:[i("div",{className:"truncate whitespace-nowrap",children:s?.textLink}),i("div",{className:"lg-desktop:size-5 size-4",children:i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:i("path",{d:"M5.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z",fill:r==="dark"?"#F5F6F7":"#080A0F",className:"transition-all duration-[0.4s]"})})})]})},$=st.forwardRef(({data:n,className:a,classNames:e,as:r="h2",weight:s="bold",onButtonClick:p,...x},f)=>{const{title:d,titleSize:_=4,caption:T,subtitle:F,content:H,countdown:t,showCountdown:B=!1,theme:h="light",extensions:I,align:c="left"}=n,L=g(null),u=g(null),l=g(null),m=g(null),[j,O]=lt(!0),{ref:U,inView:C}=pt();at(f,()=>L.current);const W=()=>{O(!1)},Z=t?.targetDateTime||t?.targetDate||"",q=t?.targetDateTime_tz,G=t?.labels?{day:t.labels.days||"Day",hour:t.labels.hours||"Hours",minute:t.labels.minutes||"Mins",second:t.labels.seconds||"Secs"}:void 0;return ot(()=>{y.registerPlugin(z,R);function J(){if(!u.current)return;const K=u.current?.clientHeight||80;l.current&&l.current.revert(),m.current&&m.current.kill(),l.current=new z(u.current,{type:"words",wordsClass:"word"});const w=l.current.words;y.set(w,{opacity:0}),m.current=R.create({trigger:u.current,start:"bottom bottom-=4%",end:`bottom+=${K*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:Q=>{const X=Q.progress,D=w.length||1,Y=.5,b=1/D,M=b*(1-Y),E=(D-1)*M+b,tt=Math.min(1,E>0?X/E:0);w.forEach((et,nt)=>{const rt=nt*M,it=b;let v=(tt-rt)/it;v=Math.max(0,Math.min(1,v)),y.set(et,{opacity:v})})}})}return C&&J(),()=>{l.current&&l.current.revert(),m.current&&m.current.kill()}},[C]),k("div",{
|
|
1
|
+
"use client";import{jsx as i,jsxs as k}from"react/jsx-runtime";import st,{useEffect as ot,useRef as g,useImperativeHandle as at,useState as lt}from"react";import{gsap as y}from"gsap";import{SplitText as z}from"gsap/dist/SplitText";import{ScrollTrigger as R}from"gsap/dist/ScrollTrigger";import{cn as o}from"../../helpers/utils.js";import{cva as V}from"class-variance-authority";import{Heading as dt,Text as A,Countdown as ct}from"../../components/index.js";import{withLayout as ut}from"../../shared/Styles.js";import{trackUrlRef as mt}from"../../shared/trackUrlRef.js";import{useInView as pt}from"react-intersection-observer";const N="link",P="title";function ft(n){if(!n)return!1;if(typeof n=="string")return n.trim().length>0;const a=n?.root?.children;return!Array.isArray(a)||a.length===0?!1:a.some(e=>{const r=e?.children;return!Array.isArray(r)||r.length===0?!1:r.some(s=>typeof s?.text=="string"&&s.text.length>0)})}const ht=V("",{variants:{theme:{light:"text-[#080A0F]",dark:"text-[#F5F6F7]"}},defaultVariants:{theme:"light"}}),gt=V("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:n,onClick:a,className:e})=>{const{theme:r="light",extensions:s,title:p,caption:x,align:f}=n;if(!s?.textLink)return null;const d=s?.link?mt(s.link,`${N}_${P}`):void 0;return k("a",{className:o({"aiui-dark":r==="dark"},"hover:text-brand-0 [&_svg_path]:hover:fill-brand-0 lg-desktop:text-base flex cursor-pointer items-center overflow-hidden text-sm font-[700] leading-[1.4] transition-all duration-[0.4s]",{"text-[#080A0F]":r==="light"},{"text-[#F5F6F7]":r==="dark"},{"justify-center mt-4":f==="center"},{"mt-1 laptop:mt-0":f==="left"},e),...d?{href:d}:{},"data-headless-type-name":`${N}#${P}`,"data-headless-title-desc-button":`${p}#${x}`,...a?{onClick:a}:{},children:[i("div",{className:"truncate whitespace-nowrap",children:s?.textLink}),i("div",{className:"lg-desktop:size-5 size-4",children:i("svg",{xmlns:"http://www.w3.org/2000/svg",width:"100%",height:"100%",viewBox:"0 0 16 16",fill:"none",children:i("path",{d:"M5.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z",fill:r==="dark"?"#F5F6F7":"#080A0F",className:"transition-all duration-[0.4s]"})})})]})},$=st.forwardRef(({data:n,className:a,classNames:e,as:r="h2",weight:s="bold",onButtonClick:p,...x},f)=>{const{title:d,titleSize:_=4,caption:T,subtitle:F,content:H,countdown:t,showCountdown:B=!1,theme:h="light",extensions:I,align:c="left"}=n,L=g(null),u=g(null),l=g(null),m=g(null),[j,O]=lt(!0),{ref:U,inView:C}=pt();at(f,()=>L.current);const W=()=>{O(!1)},Z=t?.targetDateTime||t?.targetDate||"",q=t?.targetDateTime_tz,G=t?.labels?{day:t.labels.days||"Day",hour:t.labels.hours||"Hours",minute:t.labels.minutes||"Mins",second:t.labels.seconds||"Secs"}:void 0;return ot(()=>{y.registerPlugin(z,R);function J(){if(!u.current)return;const K=u.current?.clientHeight||80;l.current&&l.current.revert(),m.current&&m.current.kill(),l.current=new z(u.current,{type:"words",wordsClass:"word"});const w=l.current.words;y.set(w,{opacity:0}),m.current=R.create({trigger:u.current,start:"bottom bottom-=4%",end:`bottom+=${K*1.5+60}px bottom-=4%`,scrub:!0,invalidateOnRefresh:!0,onUpdate:Q=>{const X=Q.progress,D=w.length||1,Y=.5,b=1/D,M=b*(1-Y),E=(D-1)*M+b,tt=Math.min(1,E>0?X/E:0);w.forEach((et,nt)=>{const rt=nt*M,it=b;let v=(tt-rt)/it;v=Math.max(0,Math.min(1,v)),y.set(et,{opacity:v})})}})}return C&&J(),()=>{l.current&&l.current.revert(),m.current&&m.current.kill()}},[C]),k("div",{id:I?.id,className:o("titleBottom title-box flex items-end justify-between gap-2 pb-6",a,e?.wrapper),...x,ref:L,children:[k("div",{ref:U,className:o("flex-1",e?.container,{"aiui-dark":h==="dark","text-center":c==="center","text-left":c==="left"}),children:[(T||d)&&i(dt,{ref:u,as:r,size:_,html:T||d,weight:s,className:o(ht({theme:h}),e?.title)}),F&&i(A,{html:F,as:"div",className:o(gt({theme:h}),e?.subtitle)}),ft(H)&&i(A,{html:H,as:"div",size:4,className:o("title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]",e?.content)}),i(S,{data:n,className:o({"laptop:hidden":c==="left"},e?.button),onClick:p}),B&&t&&j&&i(ct,{endDate:Z,endDate_tz:q,timeLabels:G,showDays:t?.showDays,showHours:t?.showHours,showMinutes:t?.showMinutes,showSeconds:t?.showSeconds,theme:h,onExpire:W,hideWhenExpired:!0,align:c==="center"?"center":"left",className:o("mt-4",e?.countdown)})]}),i(S,{data:n,className:o("hidden",{"laptop:flex":c==="left"},e?.button),onClick:p})]})});$.displayName="Title";var Ct=ut($);export{Ct 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, Countdown, type HeadingProps } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitlePropsBase } from './types.js'\n\nexport interface TitleProps extends TitlePropsBase, Omit<React.HTMLAttributes<HTMLDivElement>, 'className' | 'title'> {}\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\n/**\n * \u5224\u65AD content \u5B57\u6BB5\u662F\u5426\u6709\u5B9E\u9645\u53EF\u89C1\u5185\u5BB9\u3002\n * - string\uFF1A\u53BB\u6389\u7A7A\u767D\u540E\u975E\u7A7A\u5373\u6709\u5185\u5BB9\n * - SerializedEditorState\uFF1A\u68C0\u67E5 root.children \u5185\u662F\u5426\u5B58\u5728\u975E\u7A7A\u6587\u672C\u8282\u70B9\uFF0C\n * \u907F\u514D convertLexicalToHTML \u628A\u7A7A\u6587\u6863\u8F93\u51FA\u4E3A <div class=\"payload-richtext\"></div>\n */\nfunction hasVisibleContent(content: string | { root?: { children?: unknown[] } } | null | undefined): boolean {\n if (!content) return false\n if (typeof content === 'string') return content.trim().length > 0\n const children = content?.root?.children\n if (!Array.isArray(children) || children.length === 0) return false\n return children.some((node: any) => {\n const nodeChildren = node?.children\n if (!Array.isArray(nodeChildren) || nodeChildren.length === 0) return false\n return nodeChildren.some((child: any) => typeof child?.text === 'string' && child.text.length > 0)\n })\n}\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 = ({\n data,\n onClick,\n className,\n}: {\n data: TitleProps['data']\n onClick?: () => void\n className?: string\n}) => {\n const { theme = 'light', extensions, title, caption, align } = data\n if (!extensions?.textLink) return null\n\n const href = extensions?.link ? trackUrlRef(extensions.link, `${componentType}_${componentName}`) : undefined\n\n return (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'hover:text-brand-0 [&_svg_path]:hover:fill-brand-0 lg-desktop:text-base flex cursor-pointer 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 { 'mt-1 laptop:mt-0': align === 'left' },\n className\n )}\n {...(href ? { href } : {})}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${caption}`}\n {...(onClick ? { onClick } : {})}\n >\n <div className=\"truncate whitespace-nowrap\">{extensions?.textLink}</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.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z\"\n fill={theme === 'dark' ? '#F5F6F7' : '#080A0F'}\n className=\"transition-all duration-[0.4s]\"\n />\n </svg>\n </div>\n </a>\n )\n}\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(\n ({ data, className, classNames, as = 'h2', weight = 'bold', onButtonClick, ...rest }, ref) => {\n const {\n title,\n titleSize = 4,\n caption,\n subtitle,\n content,\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 // CMS field mapping: new targetDateTime > legacy targetDate\n const countdownEndDate = countdown?.targetDateTime || countdown?.targetDate || ''\n const countdownTz = countdown?.targetDateTime_tz\n // Label mapping: plural keys (Title CMS format) \u2192 atomic Countdown format\n const countdownLabels = countdown?.labels\n ? {\n day: countdown.labels.days || 'Day',\n hour: countdown.labels.hours || 'Hours',\n minute: countdown.labels.minutes || 'Mins',\n second: countdown.labels.seconds || 'Secs',\n }\n : undefined\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 <div\n {...rest}\n id={extensions?.id}\n className={cn(\n 'titleBottom title-box flex items-end justify-between gap-2 pb-6',\n className,\n classNames?.wrapper\n )}\n ref={innerRef}\n >\n <div\n ref={inViewRef}\n className={cn('flex-1', classNames?.container, {\n 'aiui-dark': theme === 'dark',\n 'text-center': align === 'center',\n 'text-left': align === 'left',\n })}\n >\n {(caption || title) && (\n <Heading\n ref={titleRef}\n as={as}\n size={titleSize as HeadingProps['size']}\n html={caption || title}\n weight={weight}\n className={cn(titleHeadingVariants({ theme }), classNames?.title)}\n />\n )}\n {subtitle && (\n <Text html={subtitle} as=\"div\" className={cn(subtitleVariants({ theme }), classNames?.subtitle)} />\n )}\n {hasVisibleContent(content) && (\n <Text\n html={content}\n as=\"div\"\n size={4}\n className={cn(\n 'title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]',\n classNames?.content\n )}\n />\n )}\n <TitleButton\n data={data}\n className={cn({ 'laptop:hidden': align === 'left' }, classNames?.button)}\n onClick={onButtonClick}\n />\n {showCountdown && countdown && isCountdownVisible && (\n <Countdown\n endDate={countdownEndDate}\n endDate_tz={countdownTz}\n timeLabels={countdownLabels}\n showDays={countdown?.showDays}\n showHours={countdown?.showHours}\n showMinutes={countdown?.showMinutes}\n showSeconds={countdown?.showSeconds}\n theme={theme}\n onExpire={handleCountdownEnd}\n hideWhenExpired={true}\n align={align === 'center' ? 'center' : 'left'}\n className={cn('mt-4', classNames?.countdown)}\n />\n )}\n </div>\n <TitleButton\n data={data}\n className={cn('hidden', { ['laptop:flex']: align === 'left' }, classNames?.button)}\n onClick={onButtonClick}\n />\n </div>\n )\n }\n)\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
|
|
5
|
-
"mappings": "aAoFI,OAeE,OAAAA,EAfF,QAAAC,MAAA,oBAnFJ,OAAOC,IAAS,aAAAC,GAAW,UAAAC,EAAQ,uBAAAC,GAAqB,YAAAC,OAAgB,QACxE,OAAS,QAAAC,MAAY,OACrB,OAAS,aAAAC,MAAiB,sBAC1B,OAAS,iBAAAC,MAAqB,0BAC9B,OAAS,MAAAC,MAAU,yBACnB,OAAS,OAAAC,MAAW,2BACpB,OAAS,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EAC1CrE,EAAK,IAAIiE,GAAM,CAAE,QAAAI,CAAQ,CAAC,CAC5B,CAAC,CACH,CACF,CAAC,CACH,CAEA,OAAIpB,GACFK,EAAW,EAGN,IAAM,CACXV,EAAkB,SAAWA,EAAkB,QAAQ,OAAO,EAE9DC,EAAiB,SAAWA,EAAiB,QAAQ,KAAK,CAC5D,CACF,EAAG,CAACI,CAAM,CAAC,EAGTvD,EAAC,
|
|
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, Countdown, type HeadingProps } from '../../components/index.js'\nimport { withLayout } from '../../shared/Styles.js'\nimport type { TitlePropsBase } from './types.js'\n\nexport interface TitleProps extends TitlePropsBase, Omit<React.HTMLAttributes<HTMLDivElement>, 'className' | 'title'> {}\nimport { trackUrlRef } from '../../shared/trackUrlRef.js'\nimport { useInView } from 'react-intersection-observer'\n\nconst componentType = 'link'\nconst componentName = 'title'\n\n/**\n * \u5224\u65AD content \u5B57\u6BB5\u662F\u5426\u6709\u5B9E\u9645\u53EF\u89C1\u5185\u5BB9\u3002\n * - string\uFF1A\u53BB\u6389\u7A7A\u767D\u540E\u975E\u7A7A\u5373\u6709\u5185\u5BB9\n * - SerializedEditorState\uFF1A\u68C0\u67E5 root.children \u5185\u662F\u5426\u5B58\u5728\u975E\u7A7A\u6587\u672C\u8282\u70B9\uFF0C\n * \u907F\u514D convertLexicalToHTML \u628A\u7A7A\u6587\u6863\u8F93\u51FA\u4E3A <div class=\"payload-richtext\"></div>\n */\nfunction hasVisibleContent(content: string | { root?: { children?: unknown[] } } | null | undefined): boolean {\n if (!content) return false\n if (typeof content === 'string') return content.trim().length > 0\n const children = content?.root?.children\n if (!Array.isArray(children) || children.length === 0) return false\n return children.some((node: any) => {\n const nodeChildren = node?.children\n if (!Array.isArray(nodeChildren) || nodeChildren.length === 0) return false\n return nodeChildren.some((child: any) => typeof child?.text === 'string' && child.text.length > 0)\n })\n}\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 = ({\n data,\n onClick,\n className,\n}: {\n data: TitleProps['data']\n onClick?: () => void\n className?: string\n}) => {\n const { theme = 'light', extensions, title, caption, align } = data\n if (!extensions?.textLink) return null\n\n const href = extensions?.link ? trackUrlRef(extensions.link, `${componentType}_${componentName}`) : undefined\n\n return (\n <a\n className={cn(\n { 'aiui-dark': theme === 'dark' },\n 'hover:text-brand-0 [&_svg_path]:hover:fill-brand-0 lg-desktop:text-base flex cursor-pointer 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 { 'mt-1 laptop:mt-0': align === 'left' },\n className\n )}\n {...(href ? { href } : {})}\n data-headless-type-name={`${componentType}#${componentName}`}\n data-headless-title-desc-button={`${title}#${caption}`}\n {...(onClick ? { onClick } : {})}\n >\n <div className=\"truncate whitespace-nowrap\">{extensions?.textLink}</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.52827 3.52864C5.78862 3.26829 6.21063 3.26829 6.47098 3.52864L10.471 7.52864C10.7313 7.78899 10.7313 8.21099 10.471 8.47134L6.47098 12.4713C6.21063 12.7317 5.78862 12.7317 5.52827 12.4713C5.26792 12.211 5.26792 11.789 5.52827 11.5286L9.05692 7.99999L5.52827 4.47134C5.26792 4.21099 5.26792 3.78899 5.52827 3.52864Z\"\n fill={theme === 'dark' ? '#F5F6F7' : '#080A0F'}\n className=\"transition-all duration-[0.4s]\"\n />\n </svg>\n </div>\n </a>\n )\n}\n\nconst Title = React.forwardRef<HTMLDivElement, TitleProps>(\n ({ data, className, classNames, as = 'h2', weight = 'bold', onButtonClick, ...rest }, ref) => {\n const {\n title,\n titleSize = 4,\n caption,\n subtitle,\n content,\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 // CMS field mapping: new targetDateTime > legacy targetDate\n const countdownEndDate = countdown?.targetDateTime || countdown?.targetDate || ''\n const countdownTz = countdown?.targetDateTime_tz\n // Label mapping: plural keys (Title CMS format) \u2192 atomic Countdown format\n const countdownLabels = countdown?.labels\n ? {\n day: countdown.labels.days || 'Day',\n hour: countdown.labels.hours || 'Hours',\n minute: countdown.labels.minutes || 'Mins',\n second: countdown.labels.seconds || 'Secs',\n }\n : undefined\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 <div\n id={extensions?.id}\n className={cn(\n 'titleBottom title-box flex items-end justify-between gap-2 pb-6',\n className,\n classNames?.wrapper\n )}\n {...rest}\n ref={innerRef}\n >\n <div\n ref={inViewRef}\n className={cn('flex-1', classNames?.container, {\n 'aiui-dark': theme === 'dark',\n 'text-center': align === 'center',\n 'text-left': align === 'left',\n })}\n >\n {(caption || title) && (\n <Heading\n ref={titleRef}\n as={as}\n size={titleSize as HeadingProps['size']}\n html={caption || title}\n weight={weight}\n className={cn(titleHeadingVariants({ theme }), classNames?.title)}\n />\n )}\n {subtitle && (\n <Text html={subtitle} as=\"div\" className={cn(subtitleVariants({ theme }), classNames?.subtitle)} />\n )}\n {hasVisibleContent(content) && (\n <Text\n html={content}\n as=\"div\"\n size={4}\n className={cn(\n 'title-content text-info-primary desktop:text-base desktop:mt-4 lg-desktop:text-[18px] mt-2 text-[14px] leading-[1.6]',\n classNames?.content\n )}\n />\n )}\n <TitleButton\n data={data}\n className={cn({ 'laptop:hidden': align === 'left' }, classNames?.button)}\n onClick={onButtonClick}\n />\n {showCountdown && countdown && isCountdownVisible && (\n <Countdown\n endDate={countdownEndDate}\n endDate_tz={countdownTz}\n timeLabels={countdownLabels}\n showDays={countdown?.showDays}\n showHours={countdown?.showHours}\n showMinutes={countdown?.showMinutes}\n showSeconds={countdown?.showSeconds}\n theme={theme}\n onExpire={handleCountdownEnd}\n hideWhenExpired={true}\n align={align === 'center' ? 'center' : 'left'}\n className={cn('mt-4', classNames?.countdown)}\n />\n )}\n </div>\n <TitleButton\n data={data}\n className={cn('hidden', { ['laptop:flex']: align === 'left' }, classNames?.button)}\n onClick={onButtonClick}\n />\n </div>\n )\n }\n)\n\nTitle.displayName = 'Title'\n\nexport default withLayout(Title)\n"],
|
|
5
|
+
"mappings": "aAoFI,OAeE,OAAAA,EAfF,QAAAC,MAAA,oBAnFJ,OAAOC,IAAS,aAAAC,GAAW,UAAAC,EAAQ,uBAAAC,GAAqB,YAAAC,OAAgB,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,EAAM,aAAAC,OAAoC,4BAC5D,OAAS,cAAAC,OAAkB,yBAI3B,OAAS,eAAAC,OAAmB,8BAC5B,OAAS,aAAAC,OAAiB,8BAE1B,MAAMC,EAAgB,OAChBC,EAAgB,QAQtB,SAASC,GAAkBC,EAAmF,CAC5G,GAAI,CAACA,EAAS,MAAO,GACrB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AASG,EACX,GACF,CAEJ,CACF,EAEAJ,EAAM,YAAc,QAEpB,IAAOuC,GAAQ9D,GAAWuB,CAAK",
|
|
6
6
|
"names": ["jsx", "jsxs", "React", "useEffect", "useRef", "useImperativeHandle", "useState", "gsap", "SplitText", "ScrollTrigger", "cn", "cva", "Heading", "Text", "Countdown", "withLayout", "trackUrlRef", "useInView", "componentType", "componentName", "hasVisibleContent", "content", "children", "node", "nodeChildren", "child", "titleHeadingVariants", "subtitleVariants", "TitleButton", "data", "onClick", "className", "theme", "extensions", "title", "caption", "align", "href", "Title", "classNames", "as", "weight", "onButtonClick", "rest", "ref", "titleSize", "subtitle", "countdown", "showCountdown", "innerRef", "titleRef", "splitTextInstance", "scrollTriggerRef", "isCountdownVisible", "setIsCountdownVisible", "inViewRef", "inView", "handleCountdownEnd", "countdownEndDate", "countdownTz", "countdownLabels", "gsapResize", "height", "words", "self", "progress", "total", "overlap", "interval", "step", "lastEnd", "normalizedProgress", "word", "i", "start", "width", "opacity", "Title_default"]
|
|
7
7
|
}
|
|
@@ -3,9 +3,19 @@
|
|
|
3
3
|
*
|
|
4
4
|
* @description Anker Innovations品牌标识栏组件,用于显示公司Logo和品牌信息
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
interface BoardIconItem {
|
|
7
|
+
link?: string;
|
|
8
|
+
label?: string;
|
|
9
|
+
title?: string;
|
|
10
|
+
logo?: string;
|
|
11
|
+
}
|
|
12
|
+
interface BoardData {
|
|
13
|
+
leftIcon?: BoardIconItem[];
|
|
14
|
+
rightIcon?: BoardIconItem[];
|
|
15
|
+
}
|
|
16
|
+
export interface BoardProps {
|
|
17
|
+
data?: BoardData;
|
|
9
18
|
sizeClass?: string;
|
|
10
|
-
}
|
|
19
|
+
}
|
|
20
|
+
declare const Board: ({ data, sizeClass }: BoardProps) => import("react/jsx-runtime").JSX.Element;
|
|
11
21
|
export default Board;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{jsx as
|
|
1
|
+
import{jsx as l,jsxs as d}from"react/jsx-runtime";import{cn as r}from"../helpers/utils.js";import{Container as o}from"./container.js";import i from"./link.js";const s=({data:t,sizeClass:n})=>l("div",{className:"relative z-[46] box-border h-[30px]",children:d(o,{childClassName:"flex !bg-[#080A0F] items-center justify-between",className:"h-full",children:[l("div",{className:"flex h-full items-center gap-2 py-[5px]",children:t?.leftIcon?.map?.((e,a)=>l(i,{href:e?.link,asChild:!e?.link,"aria-label":e?.label||e?.title,className:r("hidden h-full",`${n||"desktop:block"}`),children:l("div",{className:r(`${n||"desktop:block"}`,"hidden h-fit transition-all duration-200 [&_svg]:h-full [&_svg]:w-auto [&_svg_path]:transition-all [&_svg_path]:duration-200 [&_svg_path]:[fill:#75787F] [&_svg_path]:hover:[fill:#FFFFFF]"),style:{filter:"none"},"aria-hidden":"true",dangerouslySetInnerHTML:{__html:e?.logo||""}})},a))}),l("div",{className:"flex h-full items-center justify-end gap-2 py-[5px]",children:t?.rightIcon?.map?.((e,a)=>l(i,{href:e?.link,asChild:!e?.link,"aria-label":e?.label||e?.title,className:"flex h-full items-center",children:l("div",{className:"board-right-icon h-fit [&_svg]:h-full [&_svg]:w-auto",style:{filter:"none"},"aria-hidden":"true",dangerouslySetInnerHTML:{__html:e?.logo||""}})},a))})]})});var g=s;export{g as default};
|
|
2
2
|
//# sourceMappingURL=board.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/board.tsx"],
|
|
4
|
-
"sourcesContent": ["import { cn } from '../helpers/utils.js'\nimport { Container } from './container.js'\nimport Link from './link.js'\n\n/**\n * Board - \u54C1\u724C\u6807\u8BC6\u680F\n *\n * @description Anker Innovations\u54C1\u724C\u6807\u8BC6\u680F\u7EC4\u4EF6\uFF0C\u7528\u4E8E\u663E\u793A\u516C\u53F8Logo\u548C\u54C1\u724C\u4FE1\u606F\n */\n\
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["jsx", "jsxs", "cn", "Container", "Link", "Board", "
|
|
4
|
+
"sourcesContent": ["import { cn } from '../helpers/utils.js'\nimport { Container } from './container.js'\nimport Link from './link.js'\n\n/**\n * Board - \u54C1\u724C\u6807\u8BC6\u680F\n *\n * @description Anker Innovations\u54C1\u724C\u6807\u8BC6\u680F\u7EC4\u4EF6\uFF0C\u7528\u4E8E\u663E\u793A\u516C\u53F8Logo\u548C\u54C1\u724C\u4FE1\u606F\n */\n\ninterface BoardIconItem {\n link?: string\n label?: string\n title?: string\n logo?: string\n}\n\ninterface BoardData {\n leftIcon?: BoardIconItem[]\n rightIcon?: BoardIconItem[]\n}\n\nexport interface BoardProps {\n data?: BoardData\n sizeClass?: string\n}\n\nconst Board = ({ data, sizeClass }: BoardProps) => {\n return (\n <div className=\"relative z-[46] box-border h-[30px]\">\n <Container childClassName=\"flex !bg-[#080A0F] items-center justify-between\" className=\"h-full\">\n <div className=\"flex h-full items-center gap-2 py-[5px]\">\n {data?.leftIcon?.map?.((item: any, index: number) => (\n <Link\n key={index}\n href={item?.link}\n asChild={!item?.link}\n aria-label={item?.label || item?.title}\n className={cn('hidden h-full', `${sizeClass || 'desktop:block'}`)}\n >\n <div\n className={cn(\n `${sizeClass || 'desktop:block'}`,\n 'hidden h-fit transition-all duration-200 [&_svg]:h-full [&_svg]:w-auto [&_svg_path]:transition-all [&_svg_path]:duration-200 [&_svg_path]:[fill:#75787F] [&_svg_path]:hover:[fill:#FFFFFF]'\n )}\n style={{ filter: 'none' }}\n aria-hidden=\"true\"\n dangerouslySetInnerHTML={{ __html: item?.logo || '' }}\n />\n </Link>\n ))}\n </div>\n <div className=\"flex h-full items-center justify-end gap-2 py-[5px]\">\n {data?.rightIcon?.map?.((item: any, index: number) => (\n <Link\n key={index}\n href={item?.link}\n asChild={!item?.link}\n aria-label={item?.label || item?.title}\n className=\"flex h-full items-center\"\n >\n <div\n className=\"board-right-icon h-fit [&_svg]:h-full [&_svg]:w-auto\"\n style={{ filter: 'none' }}\n aria-hidden=\"true\"\n dangerouslySetInnerHTML={{ __html: item?.logo || '' }}\n />\n </Link>\n ))}\n </div>\n </Container>\n </div>\n )\n}\n\nexport default Board\n"],
|
|
5
|
+
"mappings": "AA8BM,OAUQ,OAAAA,EAVR,QAAAC,MAAA,oBA9BN,OAAS,MAAAC,MAAU,sBACnB,OAAS,aAAAC,MAAiB,iBAC1B,OAAOC,MAAU,YAyBjB,MAAMC,EAAQ,CAAC,CAAE,KAAAC,EAAM,UAAAC,CAAU,IAE7BP,EAAC,OAAI,UAAU,sCACb,SAAAC,EAACE,EAAA,CAAU,eAAe,kDAAkD,UAAU,SACpF,UAAAH,EAAC,OAAI,UAAU,0CACZ,SAAAM,GAAM,UAAU,MAAM,CAACE,EAAWC,IACjCT,EAACI,EAAA,CAEC,KAAMI,GAAM,KACZ,QAAS,CAACA,GAAM,KAChB,aAAYA,GAAM,OAASA,GAAM,MACjC,UAAWN,EAAG,gBAAiB,GAAGK,GAAa,eAAe,EAAE,EAEhE,SAAAP,EAAC,OACC,UAAWE,EACT,GAAGK,GAAa,eAAe,GAC/B,4LACF,EACA,MAAO,CAAE,OAAQ,MAAO,EACxB,cAAY,OACZ,wBAAyB,CAAE,OAAQC,GAAM,MAAQ,EAAG,EACtD,GAdKC,CAeP,CACD,EACH,EACAT,EAAC,OAAI,UAAU,sDACZ,SAAAM,GAAM,WAAW,MAAM,CAACE,EAAWC,IAClCT,EAACI,EAAA,CAEC,KAAMI,GAAM,KACZ,QAAS,CAACA,GAAM,KAChB,aAAYA,GAAM,OAASA,GAAM,MACjC,UAAU,2BAEV,SAAAR,EAAC,OACC,UAAU,uDACV,MAAO,CAAE,OAAQ,MAAO,EACxB,cAAY,OACZ,wBAAyB,CAAE,OAAQQ,GAAM,MAAQ,EAAG,EACtD,GAXKC,CAYP,CACD,EACH,GACF,EACF,EAIJ,IAAOC,EAAQL",
|
|
6
|
+
"names": ["jsx", "jsxs", "cn", "Container", "Link", "Board", "data", "sizeClass", "item", "index", "board_default"]
|
|
7
7
|
}
|
|
@@ -23,7 +23,7 @@ export { Tabs, TabsList, TabsTrigger, TabsContent } from './tabs.js';
|
|
|
23
23
|
export { Alert, AlertTitle, AlertDescription } from './alert.js';
|
|
24
24
|
export { default as Picture } from './picture.js';
|
|
25
25
|
export { default as Theme } from './theme.js';
|
|
26
|
-
export { default as Board } from './board.js';
|
|
26
|
+
export { default as Board, type BoardProps } from './board.js';
|
|
27
27
|
export { default as LoadingDots } from './loadingDots.js';
|
|
28
28
|
export { ExposureDetector, type ExposureDetectorProps } from './ExposureDetector.js';
|
|
29
29
|
export { default as BrandStrip } from './brand-strip.js';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{default as e}from"./button.js";import{default as p}from"./badge.js";import{Input as n,InputSlot as
|
|
1
|
+
import{default as e}from"./button.js";import{default as p}from"./badge.js";import{Input as n,InputSlot as s}from"./input.js";import{default as d}from"./checkbox.js";import{default as i}from"./skeleton.js";import{Dialog as m,DialogPortal as D,DialogOverlay as x,DialogClose as C,DialogTrigger as g,DialogContent as w,DialogHeader as P,DialogFooter as y,DialogTitle as T,DialogDescription as M}from"./dialog.js";import{Popover as b,PopoverTrigger as c,PopoverContent as G}from"./popover.js";import{RadioGroup as S,RadioGroupItem as A}from"./radio.js";import{Text as B}from"./text.js";import{Grid as H,GridItem as L}from"./grid.js";import{Heading as F}from"./heading.js";import{Container as O}from"./container.js";import{Color as j}from"./color.js";import{Drawer as q,DrawerPortal as J,DrawerOverlay as K,DrawerTrigger as Q,DrawerClose as U,DrawerContent as V,DrawerHeader as W,DrawerFooter as X,DrawerTitle as Y,DrawerDescription as Z}from"./drawer.js";import{default as $}from"./link.js";import{Avatar as ro,AvatarImage as eo,AvatarFallback as to}from"./avatar.js";import{default as ao}from"./input-number.js";import{DropdownMenu as so,DropdownMenuTrigger as uo,DropdownMenuContent as lo,DropdownMenuItem as io,DropdownMenuCheckboxItem as fo,DropdownMenuRadioItem as mo,DropdownMenuLabel as Do,DropdownMenuSeparator as xo,DropdownMenuShortcut as Co,DropdownMenuGroup as go,DropdownMenuPortal as wo,DropdownMenuSub as Po,DropdownMenuSubContent as yo,DropdownMenuSubTrigger as To,DropdownMenuRadioGroup as Mo}from"./drop-down.js";import{Card as bo,CardHeader as co,CardFooter as Go,CardTitle as vo,CardDescription as So,CardContent as Ao}from"./card.js";import{default as Bo}from"./Countdown.js";import{Carousel as Ho,CarouselContent as Lo,CarouselItem as ho,CarouselPrevious as Fo,CarouselNext as No}from"./carousel.js";import{Tabs as Eo,TabsList as jo,TabsTrigger as zo,TabsContent as qo}from"./tabs.js";import{Alert as Ko,AlertTitle as Qo,AlertDescription as Uo}from"./alert.js";import{default as Wo}from"./picture.js";import{default as Yo}from"./theme.js";import{default as _o}from"./board.js";import{default as or}from"./loadingDots.js";import{ExposureDetector as er}from"./ExposureDetector.js";import{default as pr}from"./brand-strip.js";import{default as nr}from"./progress.js";import{default as ur}from"./otp-input.js";import{sizeMap as lr}from"./button.js";export{Ko as Alert,Uo as AlertDescription,Qo as AlertTitle,ro as Avatar,to as AvatarFallback,eo as AvatarImage,p as Badge,_o as Board,pr as BrandStrip,e as Button,bo as Card,Ao as CardContent,So as CardDescription,Go as CardFooter,co as CardHeader,vo as CardTitle,Ho as Carousel,Lo as CarouselContent,ho as CarouselItem,No as CarouselNext,Fo as CarouselPrevious,d as Checkbox,j as Color,O as Container,Bo as Countdown,m as Dialog,C as DialogClose,w as DialogContent,M as DialogDescription,y as DialogFooter,P as DialogHeader,x as DialogOverlay,D as DialogPortal,T as DialogTitle,g as DialogTrigger,q as Drawer,U as DrawerClose,V as DrawerContent,Z as DrawerDescription,X as DrawerFooter,W as DrawerHeader,K as DrawerOverlay,J as DrawerPortal,Y as DrawerTitle,Q as DrawerTrigger,so as DropdownMenu,fo as DropdownMenuCheckboxItem,lo as DropdownMenuContent,go as DropdownMenuGroup,io as DropdownMenuItem,Do as DropdownMenuLabel,wo as DropdownMenuPortal,Mo as DropdownMenuRadioGroup,mo as DropdownMenuRadioItem,xo as DropdownMenuSeparator,Co as DropdownMenuShortcut,Po as DropdownMenuSub,yo as DropdownMenuSubContent,To as DropdownMenuSubTrigger,uo as DropdownMenuTrigger,er as ExposureDetector,H as Grid,L as GridItem,F as Heading,n as Input,ao as InputNumber,s as InputSlot,$ as Link,or as LoadingDots,ur as OtpInput,Wo as Picture,b as Popover,G as PopoverContent,c as PopoverTrigger,nr as Progress,S as RadioGroup,A as RadioGroupItem,i as Skeleton,Eo as Tabs,qo as TabsContent,jo as TabsList,zo as TabsTrigger,B as Text,Yo as Theme,lr as sizeMap};
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/components/index.ts"],
|
|
4
|
-
"sourcesContent": ["export { default as Button } from './button.js'\nexport { default as Badge } from './badge.js'\nexport { Input, InputSlot } from './input.js'\n\nexport { default as Checkbox } from './checkbox.js'\n\nexport { default as Skeleton } from './skeleton.js'\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './dialog.js'\nexport { Popover, PopoverTrigger, PopoverContent } from './popover.js'\nexport { RadioGroup, RadioGroupItem, type RadioGroupProps, type RadioGroupItemProps } from './radio.js'\nexport { Text, type TextProps } from './text.js'\nexport { Grid, GridItem, type GridProps, type GridItemProps } from './grid.js'\nexport { Heading, type HeadingProps } from './heading.js'\nexport { Container, type ContainerProps } from './container.js'\nexport { Color, type ColorProps } from './color.js'\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n} from './drawer.js'\nexport { default as Link, type LinkProps } from './link.js'\nexport { Avatar, AvatarImage, AvatarFallback } from './avatar.js'\nexport { default as InputNumber, type InputNumberProps } from './input-number.js'\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n} from './drop-down.js'\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from './card.js'\nexport { default as Countdown, type CountdownProps } from './Countdown.js'\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n} from './carousel.js'\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './tabs.js'\nexport { Alert, AlertTitle, AlertDescription } from './alert.js'\nexport { default as Picture } from './picture.js'\nexport { default as Theme } from './theme.js'\nexport { default as Board } from './board.js'\nexport { default as LoadingDots } from './loadingDots.js'\nexport { ExposureDetector, type ExposureDetectorProps } from './ExposureDetector.js'\nexport { default as BrandStrip } from './brand-strip.js'\nexport { default as Progress, type ProgressProps, type ProgressClassNames } from './progress.js'\nexport { default as OtpInput, type OtpInputProps } from './otp-input.js'\n\n// \u516C\uAC1C\u5BFC\u51FA button \u5185\u90E8\u5DE5\u5177\uFF08\u4F9B Registry \u5206\u53D1\u7684 biz-components \u4F7F\u7528\uFF09\nexport { sizeMap } from './button.js'\nexport type { ButtonProps } from './button.js'\n"],
|
|
5
|
-
"mappings": "AAAA,OAAoB,WAAXA,MAAyB,cAClC,OAAoB,WAAXA,MAAwB,aACjC,OAAS,SAAAC,EAAO,aAAAC,MAAiB,aAEjC,OAAoB,WAAXF,MAA2B,gBAEpC,OAAoB,WAAXA,MAA2B,gBACpC,OACE,UAAAG,EACA,gBAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,qBAAAC,MACK,cACP,OAAS,WAAAC,EAAS,kBAAAC,EAAgB,kBAAAC,MAAsB,eACxD,OAAS,cAAAC,EAAY,kBAAAC,MAAsE,aAC3F,OAAS,QAAAC,MAA4B,YACrC,OAAS,QAAAC,EAAM,YAAAC,MAAoD,YACnE,OAAS,WAAAC,MAAkC,eAC3C,OAAS,aAAAC,MAAsC,iBAC/C,OAAS,SAAAC,MAA8B,aACvC,OACE,UAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,qBAAAC,MACK,cACP,OAAoB,WAAXjC,MAAuC,YAChD,OAAS,UAAAkC,GAAQ,eAAAC,GAAa,kBAAAC,OAAsB,cACpD,OAAoB,WAAXpC,OAAqD,oBAC9D,OACE,gBAAAqC,GACA,uBAAAC,GACA,uBAAAC,GACA,oBAAAC,GACA,4BAAAC,GACA,yBAAAC,GACA,qBAAAC,GACA,yBAAAC,GACA,wBAAAC,GACA,qBAAAC,GACA,sBAAAC,GACA,mBAAAC,GACA,0BAAAC,GACA,0BAAAC,GACA,0BAAAC,OACK,iBACP,OAAS,QAAAC,GAAM,cAAAC,GAAY,cAAAC,GAAY,aAAAC,GAAW,mBAAAC,GAAiB,eAAAC,OAAmB,YACtF,OAAoB,WAAXzD,OAAiD,iBAC1D,OAEE,YAAA0D,GACA,mBAAAC,GACA,gBAAAC,GACA,oBAAAC,GACA,gBAAAC,OACK,gBACP,OAAS,QAAAC,GAAM,YAAAC,GAAU,eAAAC,GAAa,eAAAC,OAAmB,YACzD,OAAS,SAAAC,GAAO,cAAAC,GAAY,oBAAAC,OAAwB,aACpD,OAAoB,WAAXrE,OAA0B,eACnC,OAAoB,WAAXA,OAAwB,aACjC,OAAoB,WAAXA,
|
|
4
|
+
"sourcesContent": ["export { default as Button } from './button.js'\nexport { default as Badge } from './badge.js'\nexport { Input, InputSlot } from './input.js'\n\nexport { default as Checkbox } from './checkbox.js'\n\nexport { default as Skeleton } from './skeleton.js'\nexport {\n Dialog,\n DialogPortal,\n DialogOverlay,\n DialogClose,\n DialogTrigger,\n DialogContent,\n DialogHeader,\n DialogFooter,\n DialogTitle,\n DialogDescription,\n} from './dialog.js'\nexport { Popover, PopoverTrigger, PopoverContent } from './popover.js'\nexport { RadioGroup, RadioGroupItem, type RadioGroupProps, type RadioGroupItemProps } from './radio.js'\nexport { Text, type TextProps } from './text.js'\nexport { Grid, GridItem, type GridProps, type GridItemProps } from './grid.js'\nexport { Heading, type HeadingProps } from './heading.js'\nexport { Container, type ContainerProps } from './container.js'\nexport { Color, type ColorProps } from './color.js'\nexport {\n Drawer,\n DrawerPortal,\n DrawerOverlay,\n DrawerTrigger,\n DrawerClose,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerTitle,\n DrawerDescription,\n} from './drawer.js'\nexport { default as Link, type LinkProps } from './link.js'\nexport { Avatar, AvatarImage, AvatarFallback } from './avatar.js'\nexport { default as InputNumber, type InputNumberProps } from './input-number.js'\nexport {\n DropdownMenu,\n DropdownMenuTrigger,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuCheckboxItem,\n DropdownMenuRadioItem,\n DropdownMenuLabel,\n DropdownMenuSeparator,\n DropdownMenuShortcut,\n DropdownMenuGroup,\n DropdownMenuPortal,\n DropdownMenuSub,\n DropdownMenuSubContent,\n DropdownMenuSubTrigger,\n DropdownMenuRadioGroup,\n} from './drop-down.js'\nexport { Card, CardHeader, CardFooter, CardTitle, CardDescription, CardContent } from './card.js'\nexport { default as Countdown, type CountdownProps } from './Countdown.js'\nexport {\n type CarouselApi,\n Carousel,\n CarouselContent,\n CarouselItem,\n CarouselPrevious,\n CarouselNext,\n} from './carousel.js'\nexport { Tabs, TabsList, TabsTrigger, TabsContent } from './tabs.js'\nexport { Alert, AlertTitle, AlertDescription } from './alert.js'\nexport { default as Picture } from './picture.js'\nexport { default as Theme } from './theme.js'\nexport { default as Board, type BoardProps } from './board.js'\nexport { default as LoadingDots } from './loadingDots.js'\nexport { ExposureDetector, type ExposureDetectorProps } from './ExposureDetector.js'\nexport { default as BrandStrip } from './brand-strip.js'\nexport { default as Progress, type ProgressProps, type ProgressClassNames } from './progress.js'\nexport { default as OtpInput, type OtpInputProps } from './otp-input.js'\n\n// \u516C\uAC1C\u5BFC\u51FA button \u5185\u90E8\u5DE5\u5177\uFF08\u4F9B Registry \u5206\u53D1\u7684 biz-components \u4F7F\u7528\uFF09\nexport { sizeMap } from './button.js'\nexport type { ButtonProps } from './button.js'\n"],
|
|
5
|
+
"mappings": "AAAA,OAAoB,WAAXA,MAAyB,cAClC,OAAoB,WAAXA,MAAwB,aACjC,OAAS,SAAAC,EAAO,aAAAC,MAAiB,aAEjC,OAAoB,WAAXF,MAA2B,gBAEpC,OAAoB,WAAXA,MAA2B,gBACpC,OACE,UAAAG,EACA,gBAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,qBAAAC,MACK,cACP,OAAS,WAAAC,EAAS,kBAAAC,EAAgB,kBAAAC,MAAsB,eACxD,OAAS,cAAAC,EAAY,kBAAAC,MAAsE,aAC3F,OAAS,QAAAC,MAA4B,YACrC,OAAS,QAAAC,EAAM,YAAAC,MAAoD,YACnE,OAAS,WAAAC,MAAkC,eAC3C,OAAS,aAAAC,MAAsC,iBAC/C,OAAS,SAAAC,MAA8B,aACvC,OACE,UAAAC,EACA,gBAAAC,EACA,iBAAAC,EACA,iBAAAC,EACA,eAAAC,EACA,iBAAAC,EACA,gBAAAC,EACA,gBAAAC,EACA,eAAAC,EACA,qBAAAC,MACK,cACP,OAAoB,WAAXjC,MAAuC,YAChD,OAAS,UAAAkC,GAAQ,eAAAC,GAAa,kBAAAC,OAAsB,cACpD,OAAoB,WAAXpC,OAAqD,oBAC9D,OACE,gBAAAqC,GACA,uBAAAC,GACA,uBAAAC,GACA,oBAAAC,GACA,4BAAAC,GACA,yBAAAC,GACA,qBAAAC,GACA,yBAAAC,GACA,wBAAAC,GACA,qBAAAC,GACA,sBAAAC,GACA,mBAAAC,GACA,0BAAAC,GACA,0BAAAC,GACA,0BAAAC,OACK,iBACP,OAAS,QAAAC,GAAM,cAAAC,GAAY,cAAAC,GAAY,aAAAC,GAAW,mBAAAC,GAAiB,eAAAC,OAAmB,YACtF,OAAoB,WAAXzD,OAAiD,iBAC1D,OAEE,YAAA0D,GACA,mBAAAC,GACA,gBAAAC,GACA,oBAAAC,GACA,gBAAAC,OACK,gBACP,OAAS,QAAAC,GAAM,YAAAC,GAAU,eAAAC,GAAa,eAAAC,OAAmB,YACzD,OAAS,SAAAC,GAAO,cAAAC,GAAY,oBAAAC,OAAwB,aACpD,OAAoB,WAAXrE,OAA0B,eACnC,OAAoB,WAAXA,OAAwB,aACjC,OAAoB,WAAXA,OAAyC,aAClD,OAAoB,WAAXA,OAA8B,mBACvC,OAAS,oBAAAsE,OAAoD,wBAC7D,OAAoB,WAAXtE,OAA6B,mBACtC,OAAoB,WAAXA,OAAwE,gBACjF,OAAoB,WAAXA,OAA+C,iBAGxD,OAAS,WAAAuE,OAAe",
|
|
6
6
|
"names": ["default", "Input", "InputSlot", "Dialog", "DialogPortal", "DialogOverlay", "DialogClose", "DialogTrigger", "DialogContent", "DialogHeader", "DialogFooter", "DialogTitle", "DialogDescription", "Popover", "PopoverTrigger", "PopoverContent", "RadioGroup", "RadioGroupItem", "Text", "Grid", "GridItem", "Heading", "Container", "Color", "Drawer", "DrawerPortal", "DrawerOverlay", "DrawerTrigger", "DrawerClose", "DrawerContent", "DrawerHeader", "DrawerFooter", "DrawerTitle", "DrawerDescription", "Avatar", "AvatarImage", "AvatarFallback", "DropdownMenu", "DropdownMenuTrigger", "DropdownMenuContent", "DropdownMenuItem", "DropdownMenuCheckboxItem", "DropdownMenuRadioItem", "DropdownMenuLabel", "DropdownMenuSeparator", "DropdownMenuShortcut", "DropdownMenuGroup", "DropdownMenuPortal", "DropdownMenuSub", "DropdownMenuSubContent", "DropdownMenuSubTrigger", "DropdownMenuRadioGroup", "Card", "CardHeader", "CardFooter", "CardTitle", "CardDescription", "CardContent", "Carousel", "CarouselContent", "CarouselItem", "CarouselPrevious", "CarouselNext", "Tabs", "TabsList", "TabsTrigger", "TabsContent", "Alert", "AlertTitle", "AlertDescription", "ExposureDetector", "sizeMap"]
|
|
7
7
|
}
|
|
@@ -10,7 +10,6 @@ export interface StylesProps {
|
|
|
10
10
|
uid?: string;
|
|
11
11
|
disabled?: boolean;
|
|
12
12
|
containerClassName?: string;
|
|
13
|
-
idx?: string;
|
|
14
13
|
}
|
|
15
14
|
type LayoutProps<P> = Omit<P, keyof StylesProps | keyof ContainerProps> & StylesProps & ContainerProps;
|
|
16
15
|
type StaticComponentProperties<T> = Omit<T, keyof React.ComponentType<any> | 'displayName' | 'prototype'>;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{Fragment as O,jsx as s,jsxs as G}from"react/jsx-runtime";import m,{useMemo as
|
|
1
|
+
import{Fragment as O,jsx as s,jsxs as G}from"react/jsx-runtime";import m,{useMemo as y}from"react";import{simpleHash as R}from"./simpleHash.js";import S from"./getKeyPropsString.js";import{Grid as g,GridItem as b}from"../components/grid.js";import{Container as w}from"../components/container.js";import T from"./ErrorBoundary.js";const N={12:"col-start-1 col-end-13",10:"col-start-2 col-end-12",8:"col-start-3 col-end-11",6:"col-start-4 col-end-10",4:"col-start-5 col-end-9"},I={12:"tablet:col-start-1 tablet:col-end-13",10:"tablet:col-start-2 tablet:col-end-12",8:"tablet:col-start-3 tablet:col-end-11",6:"tablet:col-start-4 tablet:col-end-10",4:"tablet:col-start-5 tablet:col-end-9"},d=t=>{const n=S(t);return`style_${R(n)}`},k=t=>{const{style:n,uid:e,disabled:o,containerClassName:r}=t;return{style:n,uid:e,disabled:o,containerClassName:r}},h=({style:t,uid:n=d({}),disabled:e=!1})=>!t||e?null:s("style",{suppressHydrationWarning:!0,"data-style-id":n,dangerouslySetInnerHTML:{__html:`.block-${n} { ${t} }`}}),$=(t,n)=>{const e=y(()=>t?.uid||d({...t,...n??{}}),[n,t]),o=y(()=>s(h,{...t,uid:e}),[t,e]);return{className:`block-${e} `,StyleComponent:o,uid:e,idx:n?.idx!=null?String(n.idx):void 0}},x=t=>{const{desktopSpan:n,mobileSpan:e}=t||{},o=e?N[e]:"",r=n?I[n]:"";return`${o} ${r}`.trim()},j=t=>t?typeof t=="string"?t:typeof t=="object"&&Object.entries(t).length<=0?"":Object.entries(t).map(([n,e])=>`${n.replace(/([A-Z])/g,"-$1").toLowerCase()}: ${e}`).join("; ")+";":"",L=(t,n)=>[t,n].map(j).filter(e=>!!e).map(e=>e.trim().endsWith(";")?e:`${e};`).join(" ");function E(t,n){const e=m.forwardRef((o,r)=>{const{container:a,containerClassName:i,className:c,...l}=o;if(!a||Reflect.ownKeys(a).length===0)return s(t,{...l,className:c,ref:r});const p=[n,i,c].filter(Boolean).join(" ").trim();return s(w,{className:p,children:s(g,{className:"container_grid",children:s(b,{className:x(a),children:s(t,{...l,ref:r})})})})});return e.displayName=`WithContainerLayout(${t.displayName||t.name||"Component"})`,e}function B(t,n){const e=m.forwardRef((o,r)=>{const a=k(o),i=L(n?.style,a.style),c={...n,...a,...i&&{style:i}},{className:l,StyleComponent:p,idx:u}=$(c,o.data),{style:A,uid:F,disabled:K,className:C,...f}=o;return G(O,{children:[p,s(t,{...u?{id:u}:{},...f,className:[l,C].filter(Boolean).join(" ").trim(),ref:r})]})});return e.displayName=`WithStyleInjection(${t.displayName||t.name||"Component"})`,e}function _(t){const n=m.forwardRef((e,o)=>s(T,{children:s(t,{...e,ref:o})}));return n.displayName=`WithErrorBoundary(${t.displayName||t.name||"Component"})`,n}const P=new WeakMap;function q(t,n){if(P.has(t))return t;const e=_(B(E(t,n?.containerClassName),n));e.displayName=`WithLayout(${t.displayName||t.name||"Component"})`,P.set(t,!0);const o=e;return Object.getOwnPropertyNames(t).forEach(r=>{!(r in o)&&r!=="arguments"&&r!=="caller"&&r!=="length"&&r!=="name"&&(o[r]=t[r])}),o}export{k as getStylesProps,$ as useStyles,q as withLayout};
|
|
2
2
|
//# sourceMappingURL=Styles.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/shared/Styles.tsx"],
|
|
4
|
-
"sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\nimport { Grid, GridItem } from '../components/grid.js'\nimport { Container } from '../components/container.js'\nimport ErrorBoundary from './ErrorBoundary.js'\n\nconst colContentClasses: Record<number, string> = {\n 12: 'col-start-1 col-end-13',\n 10: 'col-start-2 col-end-12',\n 8: 'col-start-3 col-end-11',\n 6: 'col-start-4 col-end-10',\n 4: 'col-start-5 col-end-9',\n} as const\n\n// \u9884\u5B9A\u4E49\u5E26 tablet \u524D\u7F00\u7684\u7C7B\u540D\uFF0C\u786E\u4FDD Tailwind \u53EF\u4EE5\u8BC6\u522B\nconst colContentClassesTablet: Record<number, string> = {\n 12: 'tablet:col-start-1 tablet:col-end-13',\n 10: 'tablet:col-start-2 tablet:col-end-12',\n 8: 'tablet:col-start-3 tablet:col-end-11',\n 6: 'tablet:col-start-4 tablet:col-end-10',\n 4: 'tablet:col-start-5 tablet:col-end-9',\n} as const\n\nexport interface ContainerProps {\n container?: {\n desktopSpan: number\n mobileSpan: number\n }\n}\n\nexport interface StylesProps {\n style?: string | React.CSSProperties\n uid?: string\n disabled?: boolean\n containerClassName?: string\n
|
|
5
|
-
"mappings": "
|
|
6
|
-
"names": ["Fragment", "jsx", "jsxs", "React", "useMemo", "simpleHash", "getKeyPropsString", "Grid", "GridItem", "Container", "ErrorBoundary", "colContentClasses", "colContentClassesTablet", "generateUID", "props", "keyString", "getStylesProps", "style", "uid", "disabled", "containerClassName", "
|
|
4
|
+
"sourcesContent": ["import React, { useMemo } from 'react'\nimport { simpleHash } from './simpleHash.js'\nimport getKeyPropsString from './getKeyPropsString.js'\nimport { Grid, GridItem } from '../components/grid.js'\nimport { Container } from '../components/container.js'\nimport ErrorBoundary from './ErrorBoundary.js'\n\nconst colContentClasses: Record<number, string> = {\n 12: 'col-start-1 col-end-13',\n 10: 'col-start-2 col-end-12',\n 8: 'col-start-3 col-end-11',\n 6: 'col-start-4 col-end-10',\n 4: 'col-start-5 col-end-9',\n} as const\n\n// \u9884\u5B9A\u4E49\u5E26 tablet \u524D\u7F00\u7684\u7C7B\u540D\uFF0C\u786E\u4FDD Tailwind \u53EF\u4EE5\u8BC6\u522B\nconst colContentClassesTablet: Record<number, string> = {\n 12: 'tablet:col-start-1 tablet:col-end-13',\n 10: 'tablet:col-start-2 tablet:col-end-12',\n 8: 'tablet:col-start-3 tablet:col-end-11',\n 6: 'tablet:col-start-4 tablet:col-end-10',\n 4: 'tablet:col-start-5 tablet:col-end-9',\n} as const\n\nexport interface ContainerProps {\n container?: {\n desktopSpan: number\n mobileSpan: number\n }\n}\n\nexport interface StylesProps {\n style?: string | React.CSSProperties\n uid?: string\n disabled?: boolean\n containerClassName?: string\n}\n\ntype LayoutProps<P> = Omit<P, keyof StylesProps | keyof ContainerProps> & StylesProps & ContainerProps\n\ntype StaticComponentProperties<T> = Omit<T, keyof React.ComponentType<any> | 'displayName' | 'prototype'>\n\nconst generateUID = (props: Record<string, unknown>) => {\n const keyString = getKeyPropsString(props)\n return `style_${simpleHash(keyString)}`\n}\n\nexport const getStylesProps = <T extends StylesProps>(props: T): StylesProps => {\n const { style, uid, disabled, containerClassName } = props\n return { style, uid, disabled, containerClassName }\n}\n\nconst Styles: React.FC<StylesProps> = ({ style, uid = generateUID({}), disabled = false }) => {\n if (!style || disabled) {\n return null\n }\n\n return (\n <style\n suppressHydrationWarning\n data-style-id={uid}\n dangerouslySetInnerHTML={{ __html: `.block-${uid} { ${style} }` }}\n />\n )\n}\n\nexport const useStyles = (styleProps: Partial<StylesProps>, data?: Record<string, unknown>) => {\n const uid = useMemo(() => styleProps?.uid || generateUID({ ...styleProps, ...(data ?? {}) }), [data, styleProps])\n\n const StyleComponent = useMemo(() => <Styles {...styleProps} uid={uid} />, [styleProps, uid])\n\n return {\n className: `block-${uid} `,\n StyleComponent,\n uid,\n idx: data?.idx != null ? String(data.idx) : undefined,\n } as const\n}\n\nconst getGridItemClassName = (container?: ContainerProps['container']) => {\n const { desktopSpan, mobileSpan } = container || {}\n const mobileClasses = mobileSpan ? colContentClasses[mobileSpan] : ''\n const desktopClasses = desktopSpan ? colContentClassesTablet[desktopSpan] : ''\n return `${mobileClasses} ${desktopClasses}`.trim()\n}\n\nconst styleToString = (style?: string | React.CSSProperties): string => {\n if (!style) return ''\n if (typeof style === 'string') return style\n if (typeof style === 'object' && Object.entries(style).length <= 0) return ''\n return (\n Object.entries(style)\n .map(([key, value]) => {\n const cssKey = key.replace(/([A-Z])/g, '-$1').toLowerCase()\n return `${cssKey}: ${value}`\n })\n .join('; ') + ';'\n )\n}\n\nconst mergeStyles = (a?: string | React.CSSProperties, b?: string | React.CSSProperties): string =>\n [a, b]\n .map(styleToString)\n .filter((s): s is string => Boolean(s))\n .map(s => (s.trim().endsWith(';') ? s : `${s};`))\n .join(' ')\n\ntype InternalProps = StylesProps &\n ContainerProps & { className?: string; data?: Record<string, unknown> } & Record<string, unknown>\n\nfunction withContainerLayout(\n WrappedComponent: React.ComponentType<InternalProps>,\n defaultContainerClassName?: string\n): React.ComponentType<InternalProps> {\n const Wrapped = React.forwardRef<unknown, InternalProps>((props, ref) => {\n // eslint-disable-next-line no-unused-vars\n const { container, containerClassName, className, ...componentProps } = props\n\n if (!container || Reflect.ownKeys(container).length === 0) {\n return <WrappedComponent {...componentProps} className={className as string | undefined} ref={ref} />\n }\n\n const mergedContainerClassName = [defaultContainerClassName, containerClassName, className]\n .filter(Boolean)\n .join(' ')\n .trim()\n\n return (\n <Container className={mergedContainerClassName}>\n <Grid className=\"container_grid\">\n <GridItem className={getGridItemClassName(container as ContainerProps['container'])}>\n <WrappedComponent {...componentProps} ref={ref} />\n </GridItem>\n </Grid>\n </Container>\n )\n })\n\n Wrapped.displayName = `WithContainerLayout(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`\n return Wrapped as React.ComponentType<InternalProps>\n}\n\nfunction withStyleInjection(\n WrappedComponent: React.ComponentType<InternalProps>,\n defaultStyleProps?: Partial<StylesProps>\n): React.ComponentType<InternalProps> {\n const Wrapped = React.forwardRef<unknown, InternalProps>((props, ref) => {\n const propsStyleProps = getStylesProps(props)\n const mergedStyle = mergeStyles(defaultStyleProps?.style, propsStyleProps.style)\n\n const finalStyleProps: StylesProps = {\n ...defaultStyleProps,\n ...propsStyleProps,\n ...(mergedStyle && { style: mergedStyle }),\n }\n\n const { className, StyleComponent, idx } = useStyles(\n finalStyleProps,\n props.data as Record<string, unknown> | undefined\n )\n\n // eslint-disable-next-line no-unused-vars\n const { style: _s, uid: _u, disabled: _d, className: ownClassName, ...rest } = props\n\n return (\n <>\n {StyleComponent}\n <WrappedComponent\n {...(idx ? { id: idx } : {})}\n {...rest}\n className={[className, ownClassName].filter(Boolean).join(' ').trim()}\n ref={ref}\n />\n </>\n )\n })\n\n Wrapped.displayName = `WithStyleInjection(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`\n return Wrapped as React.ComponentType<InternalProps>\n}\n\nfunction withErrorBoundary(WrappedComponent: React.ComponentType<InternalProps>): React.ComponentType<InternalProps> {\n const Wrapped = React.forwardRef<unknown, InternalProps>((props, ref) => (\n <ErrorBoundary>\n <WrappedComponent {...props} ref={ref} />\n </ErrorBoundary>\n ))\n\n Wrapped.displayName = `WithErrorBoundary(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`\n return Wrapped as React.ComponentType<InternalProps>\n}\n\nconst wrappedComponents = new WeakMap<React.ComponentType<never>, true>()\n\nexport function withLayout<T extends React.ComponentType<any>>(\n WrappedComponent: T,\n defaultLayoutProps?: Partial<StylesProps & ContainerProps>\n): React.ForwardRefExoticComponent<LayoutProps<React.ComponentProps<T>> & React.RefAttributes<unknown>> &\n StaticComponentProperties<T> {\n if (wrappedComponents.has(WrappedComponent as React.ComponentType<never>)) {\n return WrappedComponent as unknown as React.ForwardRefExoticComponent<\n LayoutProps<React.ComponentProps<T>> & React.RefAttributes<unknown>\n > &\n StaticComponentProperties<T>\n }\n\n const composed = withErrorBoundary(\n withStyleInjection(\n withContainerLayout(\n WrappedComponent as unknown as React.ComponentType<InternalProps>,\n defaultLayoutProps?.containerClassName\n ),\n defaultLayoutProps\n )\n )\n\n composed.displayName = `WithLayout(${WrappedComponent.displayName || WrappedComponent.name || 'Component'})`\n\n wrappedComponents.set(WrappedComponent as React.ComponentType<never>, true)\n\n const result = composed as unknown as React.ForwardRefExoticComponent<\n LayoutProps<React.ComponentProps<T>> & React.RefAttributes<unknown>\n > &\n StaticComponentProperties<T>\n\n Object.getOwnPropertyNames(WrappedComponent).forEach(key => {\n if (!(key in result) && key !== 'arguments' && key !== 'caller' && key !== 'length' && key !== 'name') {\n ;(result as any)[key] = (WrappedComponent as any)[key]\n }\n })\n\n return result\n}\n"],
|
|
5
|
+
"mappings": "AA0DI,OA2GE,YAAAA,EA3GF,OAAAC,EA2GE,QAAAC,MA3GF,oBA1DJ,OAAOC,GAAS,WAAAC,MAAe,QAC/B,OAAS,cAAAC,MAAkB,kBAC3B,OAAOC,MAAuB,yBAC9B,OAAS,QAAAC,EAAM,YAAAC,MAAgB,wBAC/B,OAAS,aAAAC,MAAiB,6BAC1B,OAAOC,MAAmB,qBAE1B,MAAMC,EAA4C,CAChD,GAAI,yBACJ,GAAI,yBACJ,EAAG,yBACH,EAAG,yBACH,EAAG,uBACL,EAGMC,EAAkD,CACtD,GAAI,uCACJ,GAAI,uCACJ,EAAG,uCACH,EAAG,uCACH,EAAG,qCACL,EAoBMC,EAAeC,GAAmC,CACtD,MAAMC,EAAYT,EAAkBQ,CAAK,EACzC,MA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Q,aAAeA,IAAQ,UAAYA,IAAQ,UAAYA,IAAQ,SAC3F8B,EAAe9B,CAAG,EAAKO,EAAyBP,CAAG,EAEzD,CAAC,EAEM8B,CACT",
|
|
6
|
+
"names": ["Fragment", "jsx", "jsxs", "React", "useMemo", "simpleHash", "getKeyPropsString", "Grid", "GridItem", "Container", "ErrorBoundary", "colContentClasses", "colContentClassesTablet", "generateUID", "props", "keyString", "getStylesProps", "style", "uid", "disabled", "containerClassName", "Styles", "useStyles", "styleProps", "data", "StyleComponent", "getGridItemClassName", "container", "desktopSpan", "mobileSpan", "mobileClasses", "desktopClasses", "styleToString", "key", "value", "mergeStyles", "a", "b", "s", "withContainerLayout", "WrappedComponent", "defaultContainerClassName", "Wrapped", "ref", "className", "componentProps", "mergedContainerClassName", "withStyleInjection", "defaultStyleProps", "propsStyleProps", "mergedStyle", "finalStyleProps", "idx", "_s", "_u", "_d", "ownClassName", "rest", "withErrorBoundary", "wrappedComponents", "withLayout", "defaultLayoutProps", "composed", "result"]
|
|
7
7
|
}
|