refactor(json-tools): 优化 JsonDiffPanel 交互体验并增强 TextInputArea 灵活性

This commit is contained in:
2026-07-13 23:31:06 +08:00
parent 72e3f9012f
commit 31e28b136f
4 changed files with 63 additions and 40 deletions
+9 -2
View File
@@ -48,6 +48,9 @@ export interface TextInputAreaProps extends Omit<
* 用于需要固定高度 + 内部滚动的卡片面板。
*/
fill?: boolean;
/** 是否无边框、无阴影、无圆角(适用于嵌套在其他有边框的容器中) */
borderless?: boolean;
}
function ActionButton({
@@ -113,6 +116,7 @@ const TextInputArea = forwardRef<HTMLTextAreaElement, TextInputAreaProps>((props
externalError,
onClear,
fill = false,
borderless = false,
...restProps
} = props;
@@ -241,9 +245,12 @@ const TextInputArea = forwardRef<HTMLTextAreaElement, TextInputAreaProps>((props
<div
className={cn(
'rounded-md border border-input bg-background shadow-sm transition-all focus-within:ring-1 focus-within:ring-ring focus-within:border-input overflow-hidden',
borderless
? 'bg-transparent overflow-hidden'
: 'rounded-md border border-input bg-background shadow-sm transition-all focus-within:ring-1 focus-within:ring-ring focus-within:border-input overflow-hidden',
fill && 'flex-1 min-h-0 flex flex-col',
displayError &&
!borderless &&
displayError &&
'border-destructive focus-within:ring-destructive focus-within:border-destructive',
)}
>