@@ -58,7 +58,7 @@ export default class IgcChatInputComponent extends LitElement {
5858 public static override styles = [ styles , shared ] ;
5959
6060 @consume ( { context : chatContext , subscribe : true } )
61- private _chatState ? : ChatState ;
61+ private _chatState ! : ChatState ;
6262
6363 /* blazorSuppress */
6464 public static register ( ) {
@@ -81,7 +81,7 @@ export default class IgcChatInputComponent extends LitElement {
8181
8282 @watch ( 'acceptedFiles' , { waitUntilFirstUpdate : true } )
8383 protected acceptedFilesChange ( ) : void {
84- this . _chatState ? .updateAcceptedTypesCache ( ) ;
84+ this . _chatState . updateAcceptedTypesCache ( ) ;
8585 }
8686
8787 @state ( )
@@ -99,23 +99,21 @@ export default class IgcChatInputComponent extends LitElement {
9999
100100 protected override firstUpdated ( ) {
101101 this . setupDragAndDrop ( ) ;
102- if ( this . _chatState ) {
103- this . _chatState . updateAcceptedTypesCache ( ) ;
104- this . _chatState . textArea = this . _textInputElement ;
105- }
102+ this . _chatState . updateAcceptedTypesCache ( ) ;
103+ this . _chatState . textArea = this . _textInputElement ;
106104
107105 // Use keybindings controller to capture all key events
108106 // Custom skip function that never skips - this captures ALL key events
109107 const keybindings = addKeybindings ( this , {
110108 skip : ( ) => false , // Never skip any key events
111- ref : this . _chatState ? .textAreaRef ,
109+ ref : this . _chatState . textAreaRef ,
112110 } ) ;
113111
114112 // Override the controller's handleEvent to capture all keys
115113 // This is a more direct approach that doesn't require listing specific keys
116114 keybindings . handleEvent = ( event : KeyboardEvent ) => {
117115 // Call our handler for every key event
118- this . _chatState ? .handleKeyDown ( event ) ;
116+ this . _chatState . handleKeyDown ( event ) ;
119117 } ;
120118 }
121119
@@ -139,12 +137,12 @@ export default class IgcChatInputComponent extends LitElement {
139137 ( item ) => item . kind === 'file'
140138 ) ;
141139 const hasValidFiles = files . some ( ( item ) =>
142- this . _chatState ? .isFileTypeAccepted ( item . getAsFile ( ) as File , item . type )
140+ this . _chatState . isFileTypeAccepted ( item . getAsFile ( ) as File , item . type )
143141 ) ;
144142
145143 this . containerPart = `input-container ${ hasValidFiles ? ' dragging' : '' } ` ;
146144
147- this . _chatState ? .emitEvent ( 'igcAttachmentDrag' ) ;
145+ this . _chatState . emitEvent ( 'igcAttachmentDrag' ) ;
148146 }
149147
150148 private handleDragOver ( e : DragEvent ) {
@@ -180,29 +178,29 @@ export default class IgcChatInputComponent extends LitElement {
180178 if ( files . length === 0 ) return ;
181179
182180 const validFiles = files . filter ( ( file ) =>
183- this . _chatState ? .isFileTypeAccepted ( file )
181+ this . _chatState . isFileTypeAccepted ( file )
184182 ) ;
185183
186- this . _chatState ? .emitEvent ( 'igcAttachmentDrop' ) ;
184+ this . _chatState . emitEvent ( 'igcAttachmentDrop' ) ;
187185
188- this . _chatState ? .attachFiles ( validFiles ) ;
186+ this . _chatState . attachFiles ( validFiles ) ;
189187 this . requestUpdate ( ) ;
190188 }
191189
192190 protected override render ( ) {
193- const templates = this . _chatState ? .mergedTemplates ;
191+ const templates = this . _chatState . mergedTemplates ;
194192 return html `
195193 < div part ="${ this . containerPart } ">
196- ${ this . _chatState ? .inputAttachments &&
197- this . _chatState ? .inputAttachments . length > 0
194+ ${ this . _chatState . inputAttachments &&
195+ this . _chatState . inputAttachments . length > 0
198196 ? html ` < div part ="attachments " role ="list " aria-label ="Attachments ">
199197 ${ templates ?. textAreaAttachmentsTemplate (
200- this . _chatState ? .inputAttachments
198+ this . _chatState . inputAttachments
201199 ) }
202200 </ div > `
203201 : nothing }
204202 < div part ="input-wrapper ">
205- ${ templates ?. textInputTemplate ( this . _chatState ? .inputValue ?? '' ) }
203+ ${ templates ?. textInputTemplate ( this . _chatState . inputValue ?? '' ) }
206204 </ div >
207205 < div part ="buttons-container ">
208206 ${ templates ?. textAreaActionsTemplate ( ) }
0 commit comments