UNPKG

@youwen/ai-design-system

Version:

Enterprise AI-driven design system with comprehensive design tokens

2 lines (1 loc) 11.6 kB
"use strict";const e=require("react/jsx-runtime"),O=require("react"),$=require("class-variance-authority"),y=require("./charts-3eb46e5d.js");function I(n){const i=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(n){for(const p in n)if(p!=="default"){const b=Object.getOwnPropertyDescriptor(n,p);Object.defineProperty(i,p,b.get?b:{enumerable:!0,get:()=>n[p]})}}return i.default=n,Object.freeze(i)}const L=I(O),V=$.cva("relative bg-card border rounded-lg shadow-sm",{variants:{size:{standard:"w-container-md h-container-md",auto:"w-full h-auto",v2Standard:"w-[430px] h-[195px]",figma:"w-[400px] h-[180px]"},padding:{none:"p-0",base:"p-[15px]",v2:"p-[12px]",figma:"p-[16px]"},theme:{default:"bg-card border",v2Dark:"bg-gradient-to-br from-[#1a1a1a] to-[#0d1117] border-[#30363d]",figma:"bg-white border-[#e1e5e9] shadow-sm",transparent:"bg-transparent border-transparent"}},defaultVariants:{size:"standard",padding:"base",theme:"default"}}),z=L.forwardRef(({className:n,layout:i="leftTop",size:p="standard",padding:b="base",theme:w="default",small:h,big:r,mini:l,backgroundGradient:d,conicBackground:m,...a},v)=>{const c=i.split(",").map(o=>o.trim()),j=()=>{const o={};if(d!=null&&d.enabled&&d.colors.length>=2&&(o.background=`linear-gradient(${d.direction||"to-br"}, ${d.colors.join(", ")})`),m!=null&&m.enabled&&m.colors.length>0){const u=m.colors.map(t=>`${t.color} ${t.position}deg`).join(", ");o.background=`conic-gradient(from 0deg, ${u})`}return o};return e.jsx("div",{className:y.cn(V({size:p,padding:b,theme:w}),n),style:j(),ref:v,...a,children:e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("div",{className:"absolute w-widget-sm h-widget-sm top-0 left-0",children:(c.includes("leftTop")||c.includes("all"))&&e.jsxs("div",{className:"relative w-full h-full font-scto",children:[e.jsx("div",{className:"absolute font-normal text-widget-small",style:{top:"5px",left:"0px",width:"195px"},children:h}),e.jsx("div",{className:"absolute font-normal text-widget-big",style:{top:"30px",left:"0px",width:"195px"},children:r}),e.jsx("div",{className:"absolute font-normal text-widget-mini",style:{top:"70px",left:"0px",width:"195px"},children:l})]})}),e.jsx("div",{className:"absolute w-widget-sm h-widget-sm top-0 right-0",children:(c.includes("rightTop")||c.includes("all"))&&e.jsxs("div",{className:"relative w-full h-full font-scto",children:[e.jsx("div",{className:"absolute font-normal text-widget-small text-right",style:{top:"5px",right:"0px",width:"195px"},children:h}),e.jsx("div",{className:"absolute font-normal text-widget-big text-right",style:{top:"30px",right:"0px",width:"195px"},children:r}),e.jsx("div",{className:"absolute font-normal text-widget-mini text-right",style:{top:"70px",right:"0px",width:"195px"},children:l})]})}),e.jsx("div",{className:"absolute w-widget-sm h-widget-sm bottom-0 left-0",children:(c.includes("leftBottom")||c.includes("all"))&&e.jsxs("div",{className:"relative w-full h-full font-scto",children:[e.jsx("div",{className:"absolute font-normal text-widget-mini",style:{bottom:"5px",left:"0px",width:"195px"},children:l}),e.jsx("div",{className:"absolute font-normal text-widget-big",style:{bottom:"25px",left:"0px",width:"195px"},children:r}),e.jsx("div",{className:"absolute font-normal text-widget-small",style:{bottom:"65px",left:"0px",width:"195px"},children:h})]})}),e.jsx("div",{className:"absolute w-widget-sm h-widget-sm bottom-0 right-0",children:(c.includes("rightBottom")||c.includes("all"))&&e.jsxs("div",{className:"relative w-full h-full font-scto",children:[e.jsx("div",{className:"absolute font-normal text-widget-mini text-right",style:{bottom:"5px",right:"0px",width:"195px"},children:l}),e.jsx("div",{className:"absolute font-normal text-widget-big text-right",style:{bottom:"25px",right:"0px",width:"195px"},children:r}),e.jsx("div",{className:"absolute font-normal text-widget-small text-right",style:{bottom:"65px",right:"0px",width:"195px"},children:h})]})})]})})});z.displayName="ThreeElementLayout";const D=$.cva("relative bg-card border rounded-lg shadow-sm",{variants:{size:{standard:"w-container-md h-container-md",auto:"w-full h-auto",v2Standard:"w-[430px] h-[195px]",figma:"w-[400px] h-[180px]",compact:"w-[320px] h-[160px]"},padding:{none:"p-0",base:"p-[15px]",v2:"p-[12px]",figma:"p-[16px]"},theme:{default:"bg-card border",v2Dark:"bg-gradient-to-br from-[#1a1a1a] to-[#0d1117] border-[#30363d]",v2Light:"bg-gradient-to-br from-[#f6f8fa] to-[#ffffff] border-[#d1d9e0]",figma:"bg-white border-[#e1e5e9] shadow-sm",glass:"bg-white/10 backdrop-blur-md border-white/20"}},defaultVariants:{size:"standard",padding:"base",theme:"default"}}),A=L.forwardRef(({className:n,layout:i="leftTop",size:p="standard",padding:b="base",theme:w="default",cardTitle:h="卡片标题",cardContent:r="卡片内容描述",cardFooter:l="更多信息",cardVariant:d="default",gradientConfig:m,animated:a=!1,hoverEffect:v="none",...c},j)=>{const o=i.split(",").map(s=>s.trim()),u=()=>{const s="w-full h-full border rounded-lg p-3 transition-all duration-300",f={scale:"hover:scale-105",glow:"hover:shadow-lg hover:shadow-blue-500/25",lift:"hover:-translate-y-1 hover:shadow-xl",none:""}[v||"none"],x=a?"animate-pulse":"";switch(d){case"outlined":return`${s} border-neutral-300 bg-white ${f} ${x}`;case"elevated":return`${s} border-neutral-200 bg-white shadow-md ${f} ${x}`;case"glass":return`${s} border-white/20 bg-white/10 backdrop-blur-md ${f} ${x}`;case"gradient":return`${s} border-transparent bg-gradient-to-br from-blue-500/10 to-purple-500/10 ${f} ${x}`;default:return`${s} border-neutral-200 bg-neutral-50 ${f} ${x}`}},t=()=>{if(!m)return{};const{type:s,colors:N,direction:f,opacity:x}=m;let g="";switch(s){case"linear":g=`linear-gradient(${f||"to-br"}, ${N.join(", ")})`;break;case"radial":g=`radial-gradient(circle, ${N.join(", ")})`;break;case"conic":g=`conic-gradient(from 0deg, ${N.join(", ")})`;break}return{background:g,opacity:x||1}};return e.jsx("div",{className:y.cn(D({size:p,padding:b,theme:w}),n),style:t(),ref:j,...c,children:e.jsxs("div",{className:"relative w-full h-full",children:[e.jsx("div",{className:"absolute w-widget-sm h-widget-sm top-0 left-0",children:(o.includes("leftTop")||o.includes("all"))&&e.jsx("div",{className:u(),children:e.jsxs("div",{className:"font-scto",children:[e.jsx("div",{className:"font-medium text-widget-small mb-2",children:h}),e.jsx("div",{className:"font-normal text-widget-mini text-gray-600 mb-2 flex-1",children:r}),e.jsx("div",{className:"font-normal text-widget-mini text-gray-500",children:l})]})})}),e.jsx("div",{className:"absolute w-widget-sm h-widget-sm top-0 right-0",children:(o.includes("rightTop")||o.includes("all"))&&e.jsx("div",{className:u(),children:e.jsxs("div",{className:"font-scto text-right",children:[e.jsx("div",{className:"font-medium text-widget-small mb-2",children:h}),e.jsx("div",{className:"font-normal text-widget-mini text-gray-600 mb-2 flex-1",children:r}),e.jsx("div",{className:"font-normal text-widget-mini text-gray-500",children:l})]})})}),e.jsx("div",{className:"absolute w-widget-sm h-widget-sm bottom-0 left-0",children:(o.includes("leftBottom")||o.includes("all"))&&e.jsx("div",{className:u(),children:e.jsxs("div",{className:"font-scto h-full flex flex-col",children:[e.jsx("div",{className:"font-normal text-widget-mini text-gray-500 mb-2",children:l}),e.jsx("div",{className:"font-normal text-widget-mini text-gray-600 mb-2 flex-1",children:r}),e.jsx("div",{className:"font-medium text-widget-small",children:h})]})})}),e.jsx("div",{className:"absolute w-widget-sm h-widget-sm bottom-0 right-0",children:(o.includes("rightBottom")||o.includes("all"))&&e.jsx("div",{className:u(),children:e.jsxs("div",{className:"font-scto text-right h-full flex flex-col",children:[e.jsx("div",{className:"font-normal text-widget-mini text-gray-500 mb-2",children:l}),e.jsx("div",{className:"font-normal text-widget-mini text-gray-600 mb-2 flex-1",children:r}),e.jsx("div",{className:"font-medium text-widget-small",children:h})]})})})]})})});A.displayName="WidgetCard";const R=$.cva("relative overflow-hidden",{variants:{size:{standard:"w-[430px] h-[195px]",large:"w-[500px] h-[240px]",compact:"w-[320px] h-[160px]",full:"w-full h-full"},theme:{v2Dark:"bg-gradient-to-br from-[#1a1a1a] to-[#0d1117]",v2Light:"bg-gradient-to-br from-[#f6f8fa] to-[#ffffff]",transparent:"bg-transparent",glass:"bg-white/10 backdrop-blur-md"},border:{none:"",subtle:"border border-[#30363d]",prominent:"border-2 border-[#6BB5FF]",gradient:"border border-transparent bg-gradient-to-r from-[#6BB5FF] to-[#4F46E5] bg-clip-border"},corners:{none:"rounded-none",sm:"rounded-sm",md:"rounded-md",lg:"rounded-lg",xl:"rounded-xl",full:"rounded-full"}},defaultVariants:{size:"standard",theme:"v2Dark",border:"subtle",corners:"md"}});function q(n){const i=/^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(n);return i?{r:parseInt(i[1],16),g:parseInt(i[2],16),b:parseInt(i[3],16)}:{r:0,g:0,b:0}}const S=L.forwardRef(({className:n,size:i="standard",theme:p="v2Dark",border:b="subtle",corners:w="md",children:h,conicGradient:r,maskEffect:l,layerSystem:d,indicators:m,gridGradient:a,...v},c)=>{var u;const j=()=>!(r!=null&&r.enabled)||!r.layers.length?{}:{background:r.layers.map((s,N)=>{const f=s.colors.map(x=>{const{r:g,g:T,b:C}=q(x.color);return`rgba(${g}, ${T}, ${C}, ${x.opacity||1}) ${x.position}%`}).join(", ");return`conic-gradient(from ${s.startAngle}deg, ${f})`}).join(", "),backgroundBlendMode:"multiply"},o=()=>{if(!(a!=null&&a.enabled))return null;const t=a.stops.map(s=>e.jsx("stop",{offset:s.offset,stopColor:s.color,stopOpacity:s.opacity},s.offset));return e.jsx("defs",{children:e.jsx("linearGradient",{id:"v2GridGradient",x1:"0%",y1:"0%",x2:a.direction==="horizontal"?"100%":"0%",y2:a.direction==="vertical"?"100%":"0%",children:t})})};return e.jsxs("div",{ref:c,className:y.cn(R({size:i,theme:p,border:b,corners:w}),n),style:j(),...v,children:[(d==null?void 0:d.enabled)&&d.layers.map((t,s)=>e.jsx("div",{className:"absolute inset-0 pointer-events-none",style:{background:t.background,opacity:t.opacity,mixBlendMode:t.blendMode||"normal",transform:t.offset?`translate(${t.offset.x}px, ${t.offset.y}px)`:void 0}},s)),((l==null?void 0:l.enabled)||(a==null?void 0:a.enabled))&&e.jsxs("svg",{className:"absolute inset-0 w-full h-full pointer-events-none",style:{zIndex:1},children:[o(),(l==null?void 0:l.enabled)&&e.jsx("defs",{children:e.jsxs("mask",{id:l.maskId,children:[e.jsx("rect",{width:"100%",height:"100%",fill:"black"}),(u=l.paths)==null?void 0:u.map((t,s)=>e.jsx("path",{d:t,fill:"white"},s))]})}),(a==null?void 0:a.enabled)&&e.jsx("g",{className:"opacity-20",children:Array.from({length:5}).map((t,s)=>e.jsx("line",{x1:"0",y1:`${s*25}%`,x2:"100%",y2:`${s*25}%`,stroke:"url(#v2GridGradient)",strokeWidth:"1",strokeDasharray:a.dashArray||"2 4",strokeLinecap:"round"},s))})]}),m==null?void 0:m.map((t,s)=>e.jsx("div",{className:y.cn("absolute",t.position==="top"&&"top-0 left-0 right-0",t.position==="bottom"&&"bottom-0 left-0 right-0",t.position==="left"&&"left-0 top-0 bottom-0",t.position==="right"&&"right-0 top-0 bottom-0",t.animated&&"animate-pulse"),style:{width:t.position==="top"||t.position==="bottom"?`${t.width}%`:`${t.height||4}px`,height:t.position==="left"||t.position==="right"?`${t.width}%`:`${t.height||4}px`,background:t.color,borderRadius:"2px"}},s)),e.jsx("div",{className:"relative z-10 w-full h-full",children:h})]})});S.displayName="V2AdvancedLayout";exports.ThreeElementLayout=z;exports.V2AdvancedLayout=S;exports.WidgetCard=A;exports.threeElementLayoutVariants=V;exports.v2AdvancedLayoutVariants=R;exports.widgetCardVariants=D;