From ea13160694ebfd39cebac254acad2c8d26661623 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=BC=A6=E8=AF=AD?= Date: Mon, 29 Sep 2025 15:43:42 +0800 Subject: [PATCH 1/3] feat(textarea): overflow-y-auto --- src/sender.tsx | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/sender.tsx b/src/sender.tsx index be51a55..af17e49 100644 --- a/src/sender.tsx +++ b/src/sender.tsx @@ -122,11 +122,11 @@ export function Sender({ const [isSending, setIsSending] = useState(false); useEffect(() => { + onMessageChange?.(message); if (textareaRef.current) { textareaRef.current.style.height = "auto"; textareaRef.current.style.height = `${textareaRef.current.scrollHeight}px`; } - onMessageChange?.(message); }, [message, onMessageChange]); const [controller, setController] = useState(null); @@ -180,7 +180,9 @@ export function Sender({ data-slot="sender" className={twMerge( clsx( - "flex flex-col items-center border border-gray-200 dark:border-gray-700 rounded-2xl shadow-sm transition-all duration-300 hover:shadow-md focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500", + "flex flex-col items-center border rounded-2xl", + "border-gray-200 dark:border-gray-700 shadow-sm transition-all duration-300 hover:shadow-md", + "focus-within:ring-2 focus-within:ring-blue-500 focus-within:border-blue-500", className, ), )} @@ -192,7 +194,11 @@ export function Sender({ onChange={handleChange} onKeyDown={handleKeyDown} placeholder={placeholder} - className="w-full pt-4 px-4 border-0 rounded-2xl !resize-none focus:ring-0 focus:outline-none text-gray-700 placeholder-gray-400" + className={clsx( + "w-full pt-4 px-4 border-0 rounded-2xl !resize-none", + "focus:ring-0 focus:outline-none text-gray-700 placeholder-gray-400", + "overflow-y-auto max-h-32" + )} rows={2} />
@@ -205,4 +211,4 @@ export function Sender({
); -} +} \ No newline at end of file From 56c782423637f9b059e9882101d361971c1af15a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=BC=A6=E8=AF=AD?= Date: Mon, 29 Sep 2025 15:48:23 +0800 Subject: [PATCH 2/3] fit/lint --- src/sender.tsx | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sender.tsx b/src/sender.tsx index af17e49..9b444ab 100644 --- a/src/sender.tsx +++ b/src/sender.tsx @@ -197,7 +197,7 @@ export function Sender({ className={clsx( "w-full pt-4 px-4 border-0 rounded-2xl !resize-none", "focus:ring-0 focus:outline-none text-gray-700 placeholder-gray-400", - "overflow-y-auto max-h-32" + "overflow-y-auto max-h-32", )} rows={2} /> @@ -211,4 +211,4 @@ export function Sender({ ); -} \ No newline at end of file +} From a4dd7b17dcdce22e01ab29829ad65a230640da0e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=98=9F=E5=BC=A6=E8=AF=AD?= Date: Mon, 29 Sep 2025 18:02:54 +0800 Subject: [PATCH 3/3] feat(sender): income senderButton className --- src/sender.tsx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/sender.tsx b/src/sender.tsx index 9b444ab..5966174 100644 --- a/src/sender.tsx +++ b/src/sender.tsx @@ -105,6 +105,7 @@ export interface SenderProps extends React.ComponentProps<"div"> { */ onSend?: (controller: AbortController) => void; toolbar?: React.ReactNode; + senderButtonClassName?: string; } export function Sender({ @@ -115,6 +116,7 @@ export function Sender({ input, onSend, toolbar, + senderButtonClassName, ...props }: SenderProps) { const textareaRef = useRef(null); @@ -206,7 +208,7 @@ export function Sender({