An open source design system that's fully customizable and agent ready
TypeScript
fix(Chat): XDSChatComposerInput reads composer context as prop defaults (#1241)
Joey7476938759ae
diff --git a/packages/core/src/Chat/XDSChatComposerInput.tsx b/packages/core/src/Chat/XDSChatComposerInput.tsxindex 3ea3a4a887..568d921394 100644--- a/packages/core/src/Chat/XDSChatComposerInput.tsx+++ b/packages/core/src/Chat/XDSChatComposerInput.tsx@@ -41,6 +41,7 @@ import {import {xdsClassName, mergeProps} from '../utils';import {useTriggerMenu} from './useTriggerMenu';import {XDSBadge, type XDSBadgeProps} from '../Badge';+import {useXDSChatComposerContext} from './XDSChatContext';// =============================================================================// Types@@ -259,20 +260,22 @@ function insertTextAtCursor(text: string): void {// =============================================================================export function XDSChatComposerInput(props: XDSChatComposerInputProps) {+ const composerCtx = useXDSChatComposerContext();+const {ref,- value: controlledValue,- onChange,- placeholder = 'Type a message\u2026',+ value: controlledValue = composerCtx?.value,+ onChange = composerCtx?.onChange,+ placeholder = composerCtx?.placeholder ?? 'Type a message\u2026',maxRows = 8,triggers,debounceMs = 150,hasHistory = true,label = 'Message input',- isDisabled = false,+ isDisabled = composerCtx?.isDisabled ?? false,onPaste: onPasteProp,onFiles,- onSubmit,+ onSubmit = composerCtx?.onSubmit,xstyle,className,style,