File tree Expand file tree Collapse file tree 5 files changed +20
-11
lines changed
Expand file tree Collapse file tree 5 files changed +20
-11
lines changed Original file line number Diff line number Diff line change @@ -24,7 +24,7 @@ import type {
2424 ChatTemplateRenderer ,
2525 IgcChatMessageAttachment ,
2626} from './types.js' ;
27- import { getChatAcceptedFiles , getIconName } from './utils.js' ;
27+ import { adoptPageStyles , getChatAcceptedFiles , getIconName } from './utils.js' ;
2828
2929type DefaultInputRenderers = {
3030 input : ChatTemplateRenderer < ChatInputRenderContext > ;
@@ -119,6 +119,12 @@ export default class IgcChatInputComponent extends LitElement {
119119 addThemingController ( this , all ) ;
120120 }
121121
122+ protected override firstUpdated ( ) : void {
123+ if ( this . _state . options ?. adoptRootStyles ) {
124+ adoptPageStyles ( this ) ;
125+ }
126+ }
127+
122128 /** @internal */
123129 public focusInput ( ) : void {
124130 this . _textInputElement . focus ( ) ;
Original file line number Diff line number Diff line change @@ -19,7 +19,7 @@ import type {
1919 ChatTemplateRenderer ,
2020 IgcChatMessage ,
2121} from './types.js' ;
22- import { chatMessageAdoptPageStyles } from './utils.js' ;
22+ import { adoptPageStyles } from './utils.js' ;
2323
2424const LIKE_INACTIVE = 'thumb_up_inactive' ;
2525const LIKE_ACTIVE = 'thumb_up_active' ;
@@ -89,7 +89,7 @@ export default class IgcChatMessageComponent extends LitElement {
8989
9090 protected override firstUpdated ( ) : void {
9191 if ( this . _state . options ?. adoptRootStyles ) {
92- chatMessageAdoptPageStyles ( this ) ;
92+ adoptPageStyles ( this ) ;
9393 }
9494 }
9595
Original file line number Diff line number Diff line change @@ -105,7 +105,8 @@ const Slots = setSlots(
105105 'suggestions' ,
106106 'suggestions-actions' ,
107107 'suggestion' ,
108- 'empty-state'
108+ 'empty-state' ,
109+ 'typing-indicator'
109110) ;
110111
111112/**
@@ -133,6 +134,7 @@ const Slots = setSlots(
133134 * @slot suggestions-actions - Slot for rendering additional actions.
134135 * @slot suggestion - Slot for rendering a single suggestion item.
135136 * @slot empty-state - Slot shown when there are no messages.
137+ * @slot typing-indicator - Slot for the "is typing" indicator.
136138 *
137139 * @csspart chat-container - Styles the main chat container.
138140 * @csspart header - Styles the chat header container.
@@ -413,7 +415,9 @@ export default class IgcChatComponent extends EventEmitterMixin<
413415 ${ this . _state . options ?. isTyping
414416 ? html `
415417 < div part ="typing-indicator ">
416- ${ this . _getRenderer ( 'typingIndicator' ) ( ctx ) }
418+ < slot name ="typing-indicator "
419+ > ${ this . _getRenderer ( 'typingIndicator' ) ( ctx ) } </ slot
420+ >
417421 </ div >
418422 `
419423 : nothing }
Original file line number Diff line number Diff line change @@ -234,6 +234,8 @@ export interface ChatRenderers {
234234 messageHeader ?: ChatTemplateRenderer < ChatMessageRenderContext > ;
235235 /**
236236 * Custom renderer for the "is typing" indicator.
237+ *
238+ * @deprecated since 6.4.0. Use the `typing-indicator` slot.
237239 */
238240 typingIndicator ?: ChatTemplateRenderer < ChatRenderContext > ;
239241 /**
Original file line number Diff line number Diff line change 11import { adoptStyles , type LitElement } from 'lit' ;
22import { last } from '../common/util.js' ;
3- import type IgcChatMessageComponent from './chat-message.js' ;
43import type { IgcChatMessageAttachment } from './types.js' ;
54
65export type ChatAcceptedFileTypes = {
@@ -110,9 +109,7 @@ export function isImageAttachment(
110109 ) ;
111110}
112111
113- export function chatMessageAdoptPageStyles (
114- message : IgcChatMessageComponent
115- ) : void {
112+ export function adoptPageStyles ( element : LitElement ) : void {
116113 const sheets : CSSStyleSheet [ ] = [ ] ;
117114
118115 for ( const sheet of document . styleSheets ) {
@@ -129,6 +126,6 @@ export function chatMessageAdoptPageStyles(
129126 } catch { }
130127 }
131128
132- const ctor = message . constructor as typeof LitElement ;
133- adoptStyles ( message . shadowRoot ! , [ ...ctor . elementStyles , ...sheets ] ) ;
129+ const ctor = element . constructor as typeof LitElement ;
130+ adoptStyles ( element . shadowRoot ! , [ ...ctor . elementStyles , ...sheets ] ) ;
134131}
You can’t perform that action at this time.
0 commit comments