Files
UHD_Media_Tool/apps/web/app/components/agentui/disclosure.tsx
T
rootandClaude Opus 5.5 8352e5e881 feat(web): W4-F rebuild agent conversation and drawer with agentui components
- Port agentui (MIT, ashish200729/agentui@b2b752b) Message/MessageBubble/MessageScroller,
  StreamingResponse, ToolResult/ToolApproval, TodoList, ApprovalCard, CodeBlock/FileDiff,
  Citations, PromptInput into components/agentui; drop motion/shiki/Next, switch colors,
  type scale, radii, durations and easing to semantic tokens, honour reduced motion
- Conversation: streaming cursor, collapsible thinking, tool cards with kind/scope/risk/
  idempotency badges and audit idempotency key, prominent server-rejection state for both
  whitelist rejections and unauthorized errors, compaction markers, budget meters with
  over-limit state, approval cards (admin session only), two-column final report
  (model said vs system verified with task/record links), follow-scroll with jump-to-bottom
- Composer: Enter send / Shift+Enter newline, stop = abort (confirmed), append,
  execute/plan_only switch, "execute this plan" from finished plan_only runs
- Session list sidebar with status filter and usage; reconnect/error banners with retry
- Drawer: route-derived context (entity/site/task), minimize to a live mini dock
- Fix stream refetch race when the run switches from loading to finished

Co-Authored-By: Claude Opus 5.5 <[email protected]>
2026-09-27 23:08:17 +08:00

35 lines
1.4 KiB
TypeScript

// Adapted from agentui (https://github.com/ashish200729/agentui), components/agents/agent-disclosure.tsx
// Copyright (c) 2026 Saurabh Chauhan. MIT License, see ./LICENSE-agentui.md
// 改造:motion 的 clipPath/height 动画换成 CSS grid-rows 0fr→1fr 过渡(duration-layout / ease-standard),
// reduced motion 下不做过渡;收起时 inert + aria-hidden,键盘与读屏都跳过。
import type { ComponentPropsWithRef } from "react";
import { cn } from "~/lib/utils.ts";
export interface DisclosureProps extends ComponentPropsWithRef<"div"> {
open: boolean;
innerClassName?: string;
}
/** 折叠区:展开/收起只动高度与透明度 */
export function Disclosure({ open, className, innerClassName, children, ...props }: DisclosureProps) {
return (
<div
{...props}
data-state={open ? "open" : "closed"}
aria-hidden={!open}
inert={!open}
className={cn(
"grid transition-[grid-template-rows,opacity] duration-layout ease-standard motion-reduce:transition-none",
open ? "grid-rows-[1fr] opacity-100" : "pointer-events-none grid-rows-[0fr] opacity-0",
className,
)}
>
<div className={cn("min-h-0 overflow-hidden", innerClassName)}>{children}</div>
</div>
);
}
/** 折叠箭头:展开时转 180°(旋转过渡 duration-base) */
export const CHEVRON_CLASS =
"shrink-0 text-muted-foreground/60 transition-transform duration-base ease-standard motion-reduce:transition-none";