import { Input } from 'antd'; import React from 'react'; import SenderHeader from './SenderHeader'; import ModeSelect from './ModeSelect'; import type { InputRef as AntdInputRef, ButtonProps, GetProps } from 'antd'; import BeforeUIContainer from './BeforeUIContainer'; export type SubmitType = 'enter' | 'shiftEnter' | false; type TextareaProps = GetProps; export interface SenderComponents { input?: React.ComponentType; } export type ActionsRender = (ori: React.ReactNode, info: { components: { SendButton: React.ComponentType; ClearButton: React.ComponentType; LoadingButton: React.ComponentType; }; }) => React.ReactNode; export interface SenderProps extends Pick { /** * @description 建议列表 * @descriptionEn Suggestions list * @example [ * { label: 'Draw a picture', value: 'draw' }, * { label: 'Check some knowledge', value: 'knowledge' }, * ] */ suggestions?: { label?: string | React.ReactNode; value: string; }[]; /** * @description 输入框的默认初始值,仅在非受控模式下生效 * @descriptionEn Default initial value for the input field, only effective in uncontrolled mode */ defaultValue?: string; /** * @description 输入框的当前值,用于受控组件模式 * @descriptionEn Current value of the input field for controlled component mode */ value?: string; /** * @description 是否显示回复中的加载状态,影响按钮和输入框的交互 * @descriptionEn Whether to display loading state during reply, affects button and input interaction */ loading?: boolean | string; /** * @description 是否将输入框设置为只读模式,禁止用户编辑 * @descriptionEn Whether to set the input field to read-only mode, preventing user editing */ readOnly?: boolean; /** * @description 消息提交的方式,影响发送按钮的行为和快捷键 * @descriptionEn Method for message submission, affects send button behavior and keyboard shortcuts */ submitType?: SubmitType; /** * @description 是否禁用整个发送器组件,包括输入框和按钮 * @descriptionEn Whether to disable the entire sender component, including input field and buttons */ disabled?: boolean | string; /** * @description 是否禁用发送按钮 * @descriptionEn Whether to disable the send button */ sendDisabled?: boolean; /** * @description 是否允许在输入框为空时触发发送 * @descriptionEn Whether to allow sending when input is empty */ allowEmptySubmit?: boolean; /** * @description 是否启用用户focus时展开输入框组件 * @descriptionEn Whether to enable the user focus to expand the input box component */ enableFocusExpand?: boolean; /** * @description 用户提交消息时的回调函数,接收消息内容作为参数 * @descriptionEn Callback function when user submits a message, receives message content as parameter */ onSubmit?: (message: string) => void; /** * @description 输入框值发生变化时的回调函数,用于实时处理用户输入 * @descriptionEn Callback function when input value changes, for real-time processing of user input */ onChange?: (value: string, event?: React.FormEvent | React.ChangeEvent) => void; /** * @description 用户取消操作时的回调函数,通常用于清空输入或重置状态 * @descriptionEn Callback function when user cancels operation, usually for clearing input or resetting state */ onCancel?: VoidFunction; /** * @description 用户blur时回调函数 * @descriptionEn Callback function when user blurs */ onBlur?: VoidFunction; /** * @description 用户focus时回调函数 * @descriptionEn Callback function when user focuses */ onFocus?: VoidFunction; /** * @description 键盘事件处理函数,用于自定义键盘快捷键和特殊按键行为 * @descriptionEn Keyboard event handler for custom keyboard shortcuts and special key behaviors */ onKeyDown?: React.KeyboardEventHandler; /** * @description 语义化样式对象,用于精确控制不同区域的样式 * @descriptionEn Semantic style object for precise control of different area styles */ styles?: { prefix?: React.CSSProperties; input?: React.CSSProperties; actions?: React.CSSProperties; }; /** * @description 自定义根容器的CSS类名,用于覆盖默认样式 * @descriptionEn Custom CSS class name for the root container to override default styles */ rootClassName?: string; /** * @description 语义化CSS类名,用于为不同区域添加自定义类名 * @descriptionEn Semantic CSS class names for adding custom classes to different areas */ classNames?: { prefix?: string; input?: string; actions?: string; }; /** * @description 样式 * @descriptionEn Style */ style?: React.CSSProperties; /** * @description 类名 * @descriptionEn Classname */ className?: string; /** * @description 前缀 UI * @descriptionEn Prefix UI */ prefix?: React.ReactNode | React.ReactNode[]; /** * @description 头部 UI * @descriptionEn Header UI */ header?: React.ReactNode; /** * @description 底部 UI * @descriptionEn Footer UI */ footer?: React.ReactNode; /** * @description 最大文本长度 * @descriptionEn Max content length */ maxLength?: number; /** * @description 是否支持语音输入 * @descriptionEn Allow speech input */ allowSpeech?: boolean; /** * @description 粘贴事件处理函数 * @descriptionEn Paste event handler */ onPaste?: React.ClipboardEventHandler; /** * @description 粘贴文件时的回调函数,当用户粘贴文件时触发 * @descriptionEn Callback function when user pastes a file */ onPasteFile?: (file: File) => void; } export type SenderRef = { nativeElement: HTMLDivElement; } & Pick; declare const ForwardSender: React.ForwardRefExoticComponent>; type CompoundedSender = typeof ForwardSender & { Header: typeof SenderHeader; ModeSelect: typeof ModeSelect; BeforeUIContainer: typeof BeforeUIContainer; }; declare const Sender: CompoundedSender; export default Sender;