File tree Expand file tree Collapse file tree 4 files changed +23
-5
lines changed
Expand file tree Collapse file tree 4 files changed +23
-5
lines changed Original file line number Diff line number Diff line change @@ -74,6 +74,9 @@ export default class IgcChatInputComponent extends LitElement {
7474 @state ( )
7575 private inputValue = '' ;
7676
77+ @state ( )
78+ private inputPlaceholder = '' ;
79+
7780 @state ( )
7881 private dragClass = '' ;
7982
@@ -98,7 +101,7 @@ export default class IgcChatInputComponent extends LitElement {
98101 public get defaultTextArea ( ) : TemplateResult {
99102 return html ` < igc-textarea
100103 part ="text-input "
101- placeholder =" Type a message... "
104+ . placeholder =${ this . inputPlaceholder }
102105 resize ="auto"
103106 rows="1"
104107 .value=${ this . inputValue }
@@ -154,6 +157,7 @@ export default class IgcChatInputComponent extends LitElement {
154157
155158 protected override updated ( ) {
156159 this . inputValue = this . _chatState ?. inputValue || '' ;
160+ this . inputPlaceholder = this . _chatState ?. options ?. inputPlaceholder || '' ;
157161 }
158162
159163 private handleInput ( e : Event ) {
Original file line number Diff line number Diff line change @@ -213,7 +213,6 @@ describe('Chat', () => {
213213 <div part="input-wrapper">
214214 <igc-textarea
215215 part="text-input"
216- placeholder="Type a message..."
217216 resize="auto"
218217 rows="1"
219218 >
@@ -414,6 +413,18 @@ describe('Chat', () => {
414413 ) ;
415414 } ) ;
416415
416+ it ( 'should apply `inputPlaceholder` correctly' , async ( ) => {
417+ chat . options = {
418+ inputPlaceholder : 'Type message here...' ,
419+ } ;
420+ await elementUpdated ( chat ) ;
421+
422+ const inputArea = chat . shadowRoot ?. querySelector ( 'igc-chat-input' ) ;
423+ const textArea = inputArea ?. shadowRoot ?. querySelector ( 'igc-textarea' ) ;
424+
425+ expect ( textArea ?. placeholder ) . to . equal ( 'Type message here...' ) ;
426+ } ) ;
427+
417428 it ( 'should render suggestions' , async ( ) => {
418429 chat . options = {
419430 suggestions : [ 'Suggestion 1' , 'Suggestion 2' ] ,
@@ -492,7 +503,6 @@ describe('Chat', () => {
492503 <div part="input-wrapper">
493504 <igc-textarea
494505 part="text-input"
495- placeholder="Type a message..."
496506 resize="auto"
497507 rows="1"
498508 >
@@ -570,7 +580,6 @@ describe('Chat', () => {
570580 <div part="input-wrapper">
571581 <igc-textarea
572582 part="text-input"
573- placeholder="Type a message..."
574583 resize="auto"
575584 rows="1"
576585 >
Original file line number Diff line number Diff line change @@ -125,6 +125,11 @@ export type IgcChatOptions = {
125125 * Optional header text to display at the top of the chat component.
126126 */
127127 headerText ?: string ;
128+ /**
129+ * Optional placeholder text for the chat input area.
130+ * Provides a hint to the user about what they can type (e.g. "Type a message...").
131+ */
132+ inputPlaceholder ?: string ;
128133 /**
129134 * Suggested text snippets or quick replies that can be shown as user-selectable options.
130135 */
Original file line number Diff line number Diff line change @@ -17,7 +17,6 @@ const supabaseUrl = import.meta.env.VITE_SUPABASE_URL;
1717const supabaseKey = import . meta. env . VITE_SUPABASE_ANON_KEY ;
1818const supabase = createClient ( supabaseUrl , supabaseKey ) ;
1919
20- const googleGenAIKey = import . meta. env . VITE_GOOGLE_GEN_AI_KEY ;
2120const ai = new GoogleGenAI ( {
2221 apiKey : googleGenAIKey ,
2322} ) ;
@@ -133,6 +132,7 @@ const _customRenderer = (text: string) =>
133132
134133const ai_chat_options = {
135134 headerText : 'Chat' ,
135+ inputPlaceholder : 'Type your message here...' ,
136136 suggestions : [ 'Hello' , 'Hi' , 'Generate an image of a pig!' ] ,
137137 templates : {
138138 // messageActionsTemplate: messageActionsTemplate,
You can’t perform that action at this time.
0 commit comments