|
| 1 | +{/* @jsxImportSource react */} |
| 2 | +import { Meta } from '@storybook/addon-docs/blocks' |
| 3 | +import { Avatar, AvatarFallback, ThinkingIndicator } from '@uix/agent' |
| 4 | + |
| 5 | +<Meta title="Foundation/Motion" /> |
| 6 | + |
| 7 | +# Motion |
| 8 | + |
| 9 | +Lucid UI 动画系统。所有动画基于实际业务状态设计,保持克制不引起视觉疲劳。 |
| 10 | + |
| 11 | +## Avatar 动画状态 |
| 12 | + |
| 13 | +`AvatarAnimationStatus`: idle | thinking | planning | responding | tool-calling |
| 14 | + |
| 15 | +<div className="flex items-center gap-8 p-4 bg-white rounded-lg"> |
| 16 | + {['idle', 'thinking', 'planning', 'responding', 'tool-calling'].map((status) => ( |
| 17 | + <div key={status} className="text-center"> |
| 18 | + <Avatar size="lg" status={status}> |
| 19 | + <AvatarFallback variant="primary">AI</AvatarFallback> |
| 20 | + </Avatar> |
| 21 | + <p className="text-xs text-gray-500 mt-2">{status}</p> |
| 22 | + </div> |
| 23 | + ))} |
| 24 | +</div> |
| 25 | + |
| 26 | +## Thinking 指示器 |
| 27 | + |
| 28 | +`ThinkingVariant`: dots | pulse | bounce | wave | spinner |
| 29 | + |
| 30 | +<div className="flex items-center gap-8 p-4 bg-white rounded-lg"> |
| 31 | + {['dots', 'pulse', 'bounce', 'wave', 'spinner'].map((variant) => ( |
| 32 | + <div key={variant} className="text-center"> |
| 33 | + <div className="h-8 flex items-center justify-center"> |
| 34 | + <ThinkingIndicator variant={variant} /> |
| 35 | + </div> |
| 36 | + <p className="text-xs text-gray-500 mt-2">{variant}</p> |
| 37 | + </div> |
| 38 | + ))} |
| 39 | +</div> |
| 40 | + |
| 41 | +## 消息状态流转 |
| 42 | + |
| 43 | +`MessageStatus`: idle → thinking → streaming → complete | error |
| 44 | + |
| 45 | +<div className="flex items-center gap-3 p-4 bg-white rounded-lg"> |
| 46 | + <span className="flex items-center gap-2 px-3 py-1.5 rounded-lg border bg-gray-100 border-gray-200 text-gray-700"> |
| 47 | + <span className="w-2 h-2 rounded-full bg-gray-400" /> |
| 48 | + <span className="text-xs font-medium">idle</span> |
| 49 | + </span> |
| 50 | + <span className="text-gray-300">→</span> |
| 51 | + <span className="flex items-center gap-2 px-3 py-1.5 rounded-lg border bg-blue-50 border-blue-200 text-blue-700"> |
| 52 | + <span className="w-2 h-2 rounded-full bg-blue-500 animate-pulse" /> |
| 53 | + <span className="text-xs font-medium">thinking</span> |
| 54 | + </span> |
| 55 | + <span className="text-gray-300">→</span> |
| 56 | + <span className="flex items-center gap-2 px-3 py-1.5 rounded-lg border bg-blue-50 border-blue-200 text-blue-700"> |
| 57 | + <span className="w-2 h-2 rounded-full bg-blue-500 animate-ping" /> |
| 58 | + <span className="text-xs font-medium">streaming</span> |
| 59 | + </span> |
| 60 | + <span className="text-gray-300">→</span> |
| 61 | + <div className="flex flex-col gap-2"> |
| 62 | + <span className="flex items-center gap-2 px-3 py-1.5 rounded-lg border bg-green-50 border-green-200 text-green-700"> |
| 63 | + <span className="w-2 h-2 rounded-full bg-green-500" /> |
| 64 | + <span className="text-xs font-medium">complete</span> |
| 65 | + </span> |
| 66 | + <span className="flex items-center gap-2 px-3 py-1.5 rounded-lg border bg-red-50 border-red-200 text-red-700"> |
| 67 | + <span className="w-2 h-2 rounded-full bg-red-500" /> |
| 68 | + <span className="text-xs font-medium">error</span> |
| 69 | + </span> |
| 70 | + </div> |
| 71 | +</div> |
| 72 | + |
| 73 | +## 在线状态 |
| 74 | + |
| 75 | +`PresenceStatus`: online | offline | busy |
| 76 | + |
| 77 | +<div className="flex items-center gap-8 p-4 bg-white rounded-lg"> |
| 78 | + <div className="flex items-center gap-3"> |
| 79 | + <div className="relative"> |
| 80 | + <div className="w-10 h-10 rounded-full bg-gray-200" /> |
| 81 | + <span className="absolute bottom-0 right-0 w-3 h-3 bg-green-500 rounded-full border-2 border-white" /> |
| 82 | + </div> |
| 83 | + <span className="text-sm">online</span> |
| 84 | + </div> |
| 85 | + <div className="flex items-center gap-3"> |
| 86 | + <div className="relative"> |
| 87 | + <div className="w-10 h-10 rounded-full bg-gray-200" /> |
| 88 | + <span className="absolute bottom-0 right-0 w-3 h-3 bg-gray-400 rounded-full border-2 border-white" /> |
| 89 | + </div> |
| 90 | + <span className="text-sm">offline</span> |
| 91 | + </div> |
| 92 | + <div className="flex items-center gap-3"> |
| 93 | + <div className="relative"> |
| 94 | + <div className="w-10 h-10 rounded-full bg-gray-200" /> |
| 95 | + <span className="absolute bottom-0 right-0 w-3 h-3 bg-amber-500 rounded-full border-2 border-white" /> |
| 96 | + </div> |
| 97 | + <span className="text-sm">busy</span> |
| 98 | + </div> |
| 99 | +</div> |
| 100 | + |
| 101 | +## 动画时间规范 |
| 102 | + |
| 103 | +<table> |
| 104 | + <thead> |
| 105 | + <tr> |
| 106 | + <th>用途</th> |
| 107 | + <th>时长</th> |
| 108 | + <th>缓动</th> |
| 109 | + <th>示例</th> |
| 110 | + </tr> |
| 111 | + </thead> |
| 112 | + <tbody> |
| 113 | + <tr> |
| 114 | + <td>微交互</td> |
| 115 | + <td>150-200ms</td> |
| 116 | + <td><code>ease-out</code></td> |
| 117 | + <td>按钮悬停</td> |
| 118 | + </tr> |
| 119 | + <tr> |
| 120 | + <td>状态切换</td> |
| 121 | + <td>200-300ms</td> |
| 122 | + <td><code>ease-in-out</code></td> |
| 123 | + <td>展开/收起</td> |
| 124 | + </tr> |
| 125 | + <tr> |
| 126 | + <td>思考动画</td> |
| 127 | + <td>1000-1500ms</td> |
| 128 | + <td><code>ease-in-out</code></td> |
| 129 | + <td>脉冲效果</td> |
| 130 | + </tr> |
| 131 | + <tr> |
| 132 | + <td>循环动画</td> |
| 133 | + <td>2000-3000ms</td> |
| 134 | + <td><code>linear</code></td> |
| 135 | + <td>旋转/涟漪</td> |
| 136 | + </tr> |
| 137 | + </tbody> |
| 138 | +</table> |
0 commit comments