igniteui-webcomponents 6.3.0-alpha.0 → 6.3.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/accordion/accordion.js +1 -4
- package/components/accordion/accordion.js.map +1 -1
- package/components/button/themes/button/button.base.css.js +1 -1
- package/components/button/themes/button/button.base.css.js.map +1 -1
- package/components/button/themes/button/shared/button.common.css.js +1 -1
- package/components/button/themes/button/shared/button.common.css.js.map +1 -1
- package/components/button/themes/button/shared/button.fluent.css.js +1 -1
- package/components/button/themes/button/shared/button.fluent.css.js.map +1 -1
- package/components/button/themes/button/shared/button.indigo.css.js +1 -1
- package/components/button/themes/button/shared/button.indigo.css.js.map +1 -1
- package/components/button/themes/icon-button/icon-button.base.css.js +1 -1
- package/components/button/themes/icon-button/icon-button.base.css.js.map +1 -1
- package/components/button/themes/icon-button/shared/icon-button.bootstrap.css.js +1 -1
- package/components/button/themes/icon-button/shared/icon-button.bootstrap.css.js.map +1 -1
- package/components/button/themes/icon-button/shared/icon-button.fluent.css.js +1 -1
- package/components/button/themes/icon-button/shared/icon-button.fluent.css.js.map +1 -1
- package/components/button/themes/icon-button/shared/icon-button.indigo.css.js +1 -1
- package/components/button/themes/icon-button/shared/icon-button.indigo.css.js.map +1 -1
- package/components/button/themes/icon-button/shared/icon-button.material.css.js +1 -1
- package/components/button/themes/icon-button/shared/icon-button.material.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.bootstrap.css.js +1 -1
- package/components/button-group/themes/shared/button/button.bootstrap.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.common.css.js +1 -1
- package/components/button-group/themes/shared/button/button.common.css.js.map +1 -1
- package/components/button-group/themes/shared/button/button.indigo.css.js +1 -1
- package/components/button-group/themes/shared/button/button.indigo.css.js.map +1 -1
- package/components/calendar/days-view/days-view.js +1 -3
- package/components/calendar/days-view/days-view.js.map +1 -1
- package/components/calendar/months-view/months-view.js +1 -3
- package/components/calendar/months-view/months-view.js.map +1 -1
- package/components/calendar/themes/year-month-view.base.css.js +1 -1
- package/components/calendar/themes/year-month-view.base.css.js.map +1 -1
- package/components/calendar/years-view/years-view.js +1 -3
- package/components/calendar/years-view/years-view.js.map +1 -1
- package/components/carousel/carousel.js +0 -3
- package/components/carousel/carousel.js.map +1 -1
- package/components/chat/assets/file.png +0 -0
- package/components/chat/assets/json.png +0 -0
- package/components/chat/assets/link.png +0 -0
- package/components/chat/chat-input.d.ts +6 -22
- package/components/chat/chat-input.js +34 -163
- package/components/chat/chat-input.js.map +1 -1
- package/components/chat/chat-message-list.d.ts +5 -46
- package/components/chat/chat-message-list.js +16 -105
- package/components/chat/chat-message-list.js.map +1 -1
- package/components/chat/chat-message.d.ts +8 -18
- package/components/chat/chat-message.js +40 -29
- package/components/chat/chat-message.js.map +1 -1
- package/components/chat/chat-renderer.d.ts +14 -0
- package/components/chat/chat-renderer.js +39 -0
- package/components/chat/chat-renderer.js.map +1 -0
- package/components/chat/chat-state.d.ts +116 -21
- package/components/chat/chat-state.js +446 -75
- package/components/chat/chat-state.js.map +1 -1
- package/components/chat/chat.d.ts +27 -14
- package/components/chat/chat.js +145 -63
- package/components/chat/chat.js.map +1 -1
- package/components/chat/markdown-renderer.d.ts +72 -0
- package/components/chat/markdown-renderer.js +71 -0
- package/components/chat/markdown-renderer.js.map +1 -0
- package/components/chat/message-attachments.d.ts +0 -7
- package/components/chat/message-attachments.js +3 -81
- package/components/chat/message-attachments.js.map +1 -1
- package/components/chat/plain-text-renderer.d.ts +15 -0
- package/components/chat/plain-text-renderer.js +7 -0
- package/components/chat/plain-text-renderer.js.map +1 -0
- package/components/chat/themes/chat.base.css.js +1 -1
- package/components/chat/themes/chat.base.css.js.map +1 -1
- package/components/chat/themes/dark/chat.bootstrap.css.js +1 -1
- package/components/chat/themes/dark/chat.bootstrap.css.js.map +1 -1
- package/components/chat/themes/dark/chat.fluent.css.js +1 -1
- package/components/chat/themes/dark/chat.fluent.css.js.map +1 -1
- package/components/chat/themes/dark/chat.indigo.css.js +1 -1
- package/components/chat/themes/dark/chat.indigo.css.js.map +1 -1
- package/components/chat/themes/input.base.css.js +1 -1
- package/components/chat/themes/input.base.css.js.map +1 -1
- package/components/chat/themes/light/chat.bootstrap.css.js +1 -1
- package/components/chat/themes/light/chat.bootstrap.css.js.map +1 -1
- package/components/chat/themes/light/chat.fluent.css.js +1 -1
- package/components/chat/themes/light/chat.fluent.css.js.map +1 -1
- package/components/chat/themes/light/chat.indigo.css.js +1 -1
- package/components/chat/themes/light/chat.indigo.css.js.map +1 -1
- package/components/chat/themes/light/chat.shared.css.js +1 -1
- package/components/chat/themes/light/chat.shared.css.js.map +1 -1
- package/components/chat/themes/message-attachments.base.css.js +1 -1
- package/components/chat/themes/message-attachments.base.css.js.map +1 -1
- package/components/chat/themes/message-list.base.css.js +1 -1
- package/components/chat/themes/message-list.base.css.js.map +1 -1
- package/components/chat/themes/message.base.css.js +1 -1
- package/components/chat/themes/message.base.css.js.map +1 -1
- package/components/chat/themes/message.d.ts +2 -0
- package/components/chat/themes/message.js +28 -0
- package/components/chat/themes/message.js.map +1 -0
- package/components/chat/themes/shared/chat-message/chat-message.bootstrap.css.js +3 -0
- package/components/chat/themes/shared/chat-message/chat-message.bootstrap.css.js.map +1 -0
- package/components/chat/themes/shared/chat-message/chat-message.common.css.d.ts +1 -0
- package/components/chat/themes/shared/chat-message/chat-message.common.css.js +3 -0
- package/components/chat/themes/shared/chat-message/chat-message.common.css.js.map +1 -0
- package/components/chat/themes/shared/chat-message/chat-message.fluent.css.d.ts +1 -0
- package/components/chat/themes/shared/chat-message/chat-message.fluent.css.js +3 -0
- package/components/chat/themes/shared/chat-message/chat-message.fluent.css.js.map +1 -0
- package/components/chat/themes/shared/chat-message/chat-message.indigo.css.d.ts +1 -0
- package/components/chat/themes/shared/chat-message/chat-message.indigo.css.js +3 -0
- package/components/chat/themes/shared/chat-message/chat-message.indigo.css.js.map +1 -0
- package/components/chat/themes/shared/chat.bootstrap.css.d.ts +1 -0
- package/components/chat/themes/shared/chat.bootstrap.css.js +3 -0
- package/components/chat/themes/shared/chat.bootstrap.css.js.map +1 -0
- package/components/chat/themes/shared/chat.indigo.css.d.ts +1 -0
- package/components/chat/themes/shared/chat.indigo.css.js +3 -0
- package/components/chat/themes/shared/chat.indigo.css.js.map +1 -0
- package/components/chat/themes/shared/input/input.common.css.js +1 -1
- package/components/chat/themes/shared/input/input.common.css.js.map +1 -1
- package/components/chat/themes/shared/input/input.indigo.css.js +1 -1
- package/components/chat/themes/shared/input/input.indigo.css.js.map +1 -1
- package/components/chat/themes/shared/message-attachments.common.css.js +1 -1
- package/components/chat/themes/shared/message-attachments.common.css.js.map +1 -1
- package/components/chat/themes/shared/message-list.common.css.js +1 -1
- package/components/chat/themes/shared/message-list.common.css.js.map +1 -1
- package/components/chat/themes/themes.js +6 -4
- package/components/chat/themes/themes.js.map +1 -1
- package/components/chat/types.d.ts +72 -18
- package/components/chat/types.js +7 -0
- package/components/chat/types.js.map +1 -1
- package/components/checkbox/themes/shared/switch/switch.bootstrap.css.js +1 -1
- package/components/checkbox/themes/shared/switch/switch.bootstrap.css.js.map +1 -1
- package/components/checkbox/themes/shared/switch/switch.common.css.js +1 -1
- package/components/checkbox/themes/shared/switch/switch.common.css.js.map +1 -1
- package/components/checkbox/themes/shared/switch/switch.fluent.css.js +1 -1
- package/components/checkbox/themes/shared/switch/switch.fluent.css.js.map +1 -1
- package/components/checkbox/themes/shared/switch/switch.indigo.css.js +1 -1
- package/components/checkbox/themes/shared/switch/switch.indigo.css.js.map +1 -1
- package/components/chip/themes/chip.base.css.js +1 -1
- package/components/chip/themes/chip.base.css.js.map +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js +1 -1
- package/components/chip/themes/shared/chip.indigo.css.js.map +1 -1
- package/components/combo/controllers/navigation.js +1 -1
- package/components/combo/controllers/navigation.js.map +1 -1
- package/components/combo/themes/combo-item.base.css.js +1 -1
- package/components/combo/themes/combo-item.base.css.js.map +1 -1
- package/components/combo/themes/combo.base.css.js +1 -1
- package/components/combo/themes/combo.base.css.js.map +1 -1
- package/components/combo/themes/shared/combo.bootstrap.css.js +1 -1
- package/components/combo/themes/shared/combo.bootstrap.css.js.map +1 -1
- package/components/combo/themes/shared/combo.common.css.js +1 -1
- package/components/combo/themes/shared/combo.common.css.js.map +1 -1
- package/components/combo/themes/shared/combo.fluent.css.js +1 -1
- package/components/combo/themes/shared/combo.fluent.css.js.map +1 -1
- package/components/combo/themes/shared/combo.indigo.css.js +1 -1
- package/components/combo/themes/shared/combo.indigo.css.js.map +1 -1
- package/components/combo/themes/shared/combo.material.css.js +1 -1
- package/components/combo/themes/shared/combo.material.css.js.map +1 -1
- package/components/common/controllers/key-bindings.js +4 -3
- package/components/common/controllers/key-bindings.js.map +1 -1
- package/components/common/i18n/chat.resources.d.ts +8 -0
- package/components/common/i18n/chat.resources.js +8 -0
- package/components/common/i18n/chat.resources.js.map +1 -0
- package/components/common/util.d.ts +14 -0
- package/components/common/util.js +51 -1
- package/components/common/util.js.map +1 -1
- package/components/date-picker/date-picker.js +2 -2
- package/components/date-picker/date-picker.js.map +1 -1
- package/components/date-picker/themes/shared/date-picker.common.css.js +1 -1
- package/components/date-picker/themes/shared/date-picker.common.css.js.map +1 -1
- package/components/date-range-picker/date-range-picker.js +0 -1
- package/components/date-range-picker/date-range-picker.js.map +1 -1
- package/components/date-range-picker/themes/shared/date-range-picker.bootstrap.css.js +1 -1
- package/components/date-range-picker/themes/shared/date-range-picker.bootstrap.css.js.map +1 -1
- package/components/date-range-picker/themes/shared/date-range-picker.common.css.js +1 -1
- package/components/date-range-picker/themes/shared/date-range-picker.common.css.js.map +1 -1
- package/components/date-time-input/date-time-input.js +1 -1
- package/components/date-time-input/date-time-input.js.map +1 -1
- package/components/dropdown/themes/dropdown-group.base.css.js +1 -1
- package/components/dropdown/themes/dropdown-group.base.css.js.map +1 -1
- package/components/dropdown/themes/dropdown-item.base.css.js +1 -1
- package/components/dropdown/themes/dropdown-item.base.css.js.map +1 -1
- package/components/dropdown/themes/shared/group/dropdown-group.fluent.css.js +1 -1
- package/components/dropdown/themes/shared/group/dropdown-group.fluent.css.js.map +1 -1
- package/components/dropdown/themes/shared/header/dropdown-header.common.css.js +1 -1
- package/components/dropdown/themes/shared/header/dropdown-header.common.css.js.map +1 -1
- package/components/dropdown/themes/shared/header/dropdown-header.indigo.css.js +1 -1
- package/components/dropdown/themes/shared/header/dropdown-header.indigo.css.js.map +1 -1
- package/components/dropdown/themes/shared/item/dropdown-item.indigo.css.js +1 -1
- package/components/dropdown/themes/shared/item/dropdown-item.indigo.css.js.map +1 -1
- package/components/expansion-panel/expansion-panel.js +0 -1
- package/components/expansion-panel/expansion-panel.js.map +1 -1
- package/components/expansion-panel/themes/expansion-panel.base.css.js +1 -1
- package/components/expansion-panel/themes/expansion-panel.base.css.js.map +1 -1
- package/components/expansion-panel/themes/shared/expansion-panel.indigo.css.js +1 -1
- package/components/expansion-panel/themes/shared/expansion-panel.indigo.css.js.map +1 -1
- package/components/file-input/themes/shared/file-input.bootstrap.css.js +1 -1
- package/components/file-input/themes/shared/file-input.bootstrap.css.js.map +1 -1
- package/components/input/themes/shared/input.bootstrap.css.js +1 -1
- package/components/input/themes/shared/input.bootstrap.css.js.map +1 -1
- package/components/input/themes/shared/input.common.css.js +1 -1
- package/components/input/themes/shared/input.common.css.js.map +1 -1
- package/components/input/themes/shared/input.fluent.css.js +1 -1
- package/components/input/themes/shared/input.fluent.css.js.map +1 -1
- package/components/input/themes/shared/input.indigo.css.js +1 -1
- package/components/input/themes/shared/input.indigo.css.js.map +1 -1
- package/components/input/themes/shared/input.material.css.js +1 -1
- package/components/input/themes/shared/input.material.css.js.map +1 -1
- package/components/list/themes/header.base.css.js +1 -1
- package/components/list/themes/header.base.css.js.map +1 -1
- package/components/list/themes/item.base.css.js +1 -1
- package/components/list/themes/item.base.css.js.map +1 -1
- package/components/list/themes/shared/header/list-header.indigo.css.js +1 -1
- package/components/list/themes/shared/header/list-header.indigo.css.js.map +1 -1
- package/components/list/themes/shared/item/list-item.indigo.css.js +1 -1
- package/components/list/themes/shared/item/list-item.indigo.css.js.map +1 -1
- package/components/rating/rating.js +0 -1
- package/components/rating/rating.js.map +1 -1
- package/components/select/themes/dark/select.bootstrap.css.js +1 -1
- package/components/select/themes/dark/select.bootstrap.css.js.map +1 -1
- package/components/select/themes/light/select.bootstrap.css.js +1 -1
- package/components/select/themes/light/select.bootstrap.css.js.map +1 -1
- package/components/select/themes/shared/select.bootstrap.css.js +1 -1
- package/components/select/themes/shared/select.bootstrap.css.js.map +1 -1
- package/components/select/themes/shared/select.common.css.js +1 -1
- package/components/select/themes/shared/select.common.css.js.map +1 -1
- package/components/select/themes/shared/select.material.css.js +1 -1
- package/components/select/themes/shared/select.material.css.js.map +1 -1
- package/components/slider/slider-base.js +0 -1
- package/components/slider/slider-base.js.map +1 -1
- package/components/tabs/tabs.js +0 -1
- package/components/tabs/tabs.js.map +1 -1
- package/components/textarea/themes/shared/textarea.bootstrap.css.js +1 -1
- package/components/textarea/themes/shared/textarea.bootstrap.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.common.css.js +1 -1
- package/components/textarea/themes/shared/textarea.common.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.fluent.css.js +1 -1
- package/components/textarea/themes/shared/textarea.fluent.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.indigo.css.js +1 -1
- package/components/textarea/themes/shared/textarea.indigo.css.js.map +1 -1
- package/components/textarea/themes/shared/textarea.material.css.js +1 -1
- package/components/textarea/themes/shared/textarea.material.css.js.map +1 -1
- package/components/textarea/themes/textarea.base.css.js +1 -1
- package/components/textarea/themes/textarea.base.css.js.map +1 -1
- package/components/tree/themes/item.base.css.js +1 -1
- package/components/tree/themes/item.base.css.js.map +1 -1
- package/components/tree/themes/shared/item.indigo.css.js +1 -1
- package/components/tree/themes/shared/item.indigo.css.js.map +1 -1
- package/components/tree/tree.js +3 -1
- package/components/tree/tree.js.map +1 -1
- package/components/tree/tree.navigation.js +3 -3
- package/components/tree/tree.navigation.js.map +1 -1
- package/components/tree/tree.selection.js +6 -2
- package/components/tree/tree.selection.js.map +1 -1
- package/custom-elements.json +5131 -4707
- package/igniteui-webcomponents.css-data.json +1 -1
- package/igniteui-webcomponents.html-data.json +1 -1
- package/index.d.ts +3 -0
- package/index.js +3 -0
- package/index.js.map +1 -1
- package/package.json +1 -1
- package/themes/dark/bootstrap.css +1 -1
- package/themes/dark/fluent.css +1 -1
- package/themes/dark/indigo.css +1 -1
- package/themes/dark/material.css +1 -1
- package/themes/light/bootstrap.css +1 -1
- package/themes/light/fluent.css +1 -1
- package/themes/light/indigo.css +1 -1
- package/themes/light/material.css +1 -1
- package/web-types.json +2 -2
- package/components/chat/markdown-util.d.ts +0 -2
- package/components/chat/markdown-util.js +0 -22
- package/components/chat/markdown-util.js.map +0 -1
- package/components/chat/themes/shared/chat-message.common.css.js +0 -3
- package/components/chat/themes/shared/chat-message.common.css.js.map +0 -1
- /package/components/chat/themes/shared/{chat-message.common.css.d.ts → chat-message/chat-message.bootstrap.css.d.ts} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat-state.js","sourceRoot":"","sources":["../../../src/components/chat/chat-state.ts"],"names":[],"mappings":"AAcA,MAAM,OAAO,SAAS;IAgCpB,IAAW,iBAAiB;QAC1B,OAAO,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IAKD,IAAW,QAAQ;QACjB,OAAO,IAAI,CAAC,SAAS,CAAC;IACxB,CAAC;IAMD,IAAW,QAAQ,CAAC,KAAmB;QACrC,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;QACvB,IAAI,CAAC,eAAe,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;YACjD,OAAO,CAA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CAAC,mBAAmB,CAAC,UAAU,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE,CAAC;YAC3D,OAAO,IAAI,CAAC;QACd,CAAC;QAGD,IAAI,IAAI,CAAC,mBAAmB,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC;YACrD,OAAO,IAAI,CAAC;QACd,CAAC;QAGD,MAAM,CAAC,YAAY,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAC3C,OAAO,IAAI,CAAC,mBAAmB,CAAC,aAAa,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;IAClE,CAAC;IAOM,cAAc,CAAC,IAAY;QAChC,OAAO,CACL,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAkB,aAAa,IAAI,GAAG,CAAC;YACxE,EAAE,UAAU,CAAC,MAAM,KAAK,CAAC,CAC5B,CAAC;IACJ,CAAC;CAEF;AAED,MAAM,UAAU,eAAe,CAAC,IAAsB;IACpD,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import type IgcTextareaComponent from '../textarea/textarea.js';\nimport type IgcChatComponent from './chat.js';\nimport type { IgcChatComponentEventMap } from './chat.js';\nimport type {\n IgcChatOptions,\n IgcMessage,\n IgcMessageAttachment,\n} from './types.js';\n\n/**\n * Internal state manager for the `<igc-chat>` component.\n *\n * Manages messages, input value, attachments, options, and event emissions.\n */\nexport class ChatState {\n //#region Internal properties and state /** The host `<igc-chat>` component instance */\n private readonly _host: IgcChatComponent;\n /** Reference to the text area input component */\n private _textArea: IgcTextareaComponent | null = null;\n /** The current list of messages */\n private _messages: IgcMessage[] = [];\n /** Sorted copy of messages by timestamp */\n private _sortedMessages: IgcMessage[] = [];\n /** Chat options/configuration */\n private _options?: IgcChatOptions;\n /** List of current input attachments */\n private _inputAttachments: IgcMessageAttachment[] = [];\n /** Current input text */\n private _inputValue = '';\n /**\n * Cache of accepted file types, organized into extensions, mimeTypes, and wildcardTypes\n */\n private _acceptedTypesCache: {\n extensions: Set<string>;\n mimeTypes: Set<string>;\n wildcardTypes: Set<string>;\n } | null = null;\n\n private _suggestionsPosition: 'below-input' | 'below-messages' =\n 'below-messages';\n //#endregion\n\n //#region Public properties\n /**\n * Array of message IDs sorted by timestamp ascending.\n */\n public get sortedMessagesIds(): string[] {\n return this._sortedMessages.map((m) => m.id);\n }\n\n /**\n * Gets the list of chat messages.\n */\n public get messages(): IgcMessage[] {\n return this._messages;\n }\n\n /**\n * Sets the list of chat messages.\n * Also sorts messages by timestamp and requests host update.\n */\n public set messages(value: IgcMessage[]) {\n this._messages = value;\n this._sortedMessages = value.slice().sort((a, b) => {\n return a.timestamp.getTime() - b.timestamp.getTime();\n });\n this._host.requestUpdate();\n }\n\n /**\n * Gets current chat options.\n */\n public get options(): IgcChatOptions | undefined {\n return this._options;\n }\n\n /**\n * Sets chat options and requests host update.\n */\n public set options(value: IgcChatOptions) {\n this._options = value;\n this._host.requestUpdate();\n }\n\n /**\n * Gets the current user ID from options or returns 'user' as fallback.\n */\n public get currentUserId(): string {\n return this._options?.currentUserId ?? 'user';\n }\n\n /**\n * Gets the current suggestionsPosition from options or returns the default value 'below-messages'.\n */\n public get suggestionsPosition(): string {\n return this._options?.suggestionsPosition ?? this._suggestionsPosition;\n }\n /**\n * Gets the text area component.\n */\n public get textArea(): IgcTextareaComponent | null {\n return this._textArea;\n }\n\n /**\n * Sets the text area component.\n */\n public set textArea(value: IgcTextareaComponent) {\n this._textArea = value;\n }\n\n /**\n * Gets the list of attachments currently attached to input.\n */\n public get inputAttachments(): IgcMessageAttachment[] {\n return this._inputAttachments;\n }\n\n /**\n * Sets the input attachments and requests host update.\n */\n public set inputAttachments(value: IgcMessageAttachment[]) {\n this._inputAttachments = value;\n this._host.requestUpdate(); // Notify the host component to re-render\n }\n\n /**\n * Gets the current input value.\n */\n public get inputValue(): string {\n return this._inputValue;\n }\n\n /**\n * Sets the current input value and requests host update.\n */\n public set inputValue(value: string) {\n this._inputValue = value;\n this._host.requestUpdate();\n }\n //#endregion\n\n /**\n * Creates an instance of ChatState.\n * @param chat The host `<igc-chat>` component.\n */\n constructor(chat: IgcChatComponent) {\n this._host = chat;\n }\n\n //#region Event handlers\n\n /**\n * Emits a custom event from the host component.\n * @param name Event name (key of IgcChatComponentEventMap)\n * @param args Event detail or options\n * @returns true if event was not canceled, false otherwise\n */\n public emitEvent(name: keyof IgcChatComponentEventMap, args?: any) {\n return this._host.emitEvent(name, args);\n }\n\n /**\n * Handles input text changes.\n * Updates internal inputValue and emits 'igcInputChange' event.\n * @param value New input value\n */\n public handleInputChange(value: string): void {\n this.inputValue = value;\n this.emitEvent('igcInputChange', { detail: { value: this.inputValue } });\n }\n\n //#endregion\n\n //#region Public API\n\n /**\n * Adds a new chat message.\n * Emits 'igcMessageCreated' event which can be canceled to prevent adding.\n * Clears input value and attachments on success.\n * @param message Partial message object with optional id, sender, timestamp\n */\n public addMessage(message: {\n id?: string;\n text: string;\n sender?: string;\n timestamp?: Date;\n attachments?: IgcMessageAttachment[];\n }): void {\n const newMessage: IgcMessage = {\n id: message.id ?? Date.now().toString(),\n text: message.text,\n sender: message.sender ?? this.currentUserId,\n timestamp: message.timestamp ?? new Date(),\n attachments: message.attachments || [],\n };\n\n const allowed = this.emitEvent('igcMessageCreated', {\n detail: newMessage,\n cancelable: true,\n });\n\n if (allowed) {\n if (!this.messages.some((msg) => msg.id === newMessage.id)) {\n this.messages = [...this.messages, newMessage];\n }\n this.inputValue = '';\n this.inputAttachments = [];\n }\n }\n\n /**\n * Adds files as attachments to the input.\n * Emits 'igcAttachmentChange' event which can be canceled to prevent adding.\n * @param files Array of File objects to attach\n */\n public attachFiles(files: File[]) {\n const newAttachments: IgcMessageAttachment[] = [];\n let count = this.inputAttachments.length;\n files.forEach((file) => {\n if (this.inputAttachments.find((a) => a.name === file.name)) {\n return;\n }\n\n const isImage = file.type.startsWith('image/');\n newAttachments.push({\n id: Date.now().toString() + count++,\n url: URL.createObjectURL(file),\n name: file.name,\n file: file,\n thumbnail: isImage ? URL.createObjectURL(file) : undefined,\n });\n });\n\n const allowed = this.emitEvent('igcAttachmentChange', {\n detail: [...this.inputAttachments, ...newAttachments],\n cancelable: true,\n });\n if (allowed) {\n this.inputAttachments = [...this.inputAttachments, ...newAttachments];\n }\n }\n\n /**\n * Removes an attachment by index.\n * Emits 'igcAttachmentChange' event which can be canceled to prevent removal.\n * @param index Index of the attachment to remove\n */\n public removeAttachment(index: number): void {\n const allowed = this.emitEvent('igcAttachmentChange', {\n detail: this.inputAttachments.filter((_, i) => i !== index),\n cancelable: true,\n });\n if (allowed) {\n this.inputAttachments = this.inputAttachments.filter(\n (_, i) => i !== index\n );\n }\n }\n\n /**\n * Handles when a suggestion is clicked.\n * Adds the suggestion as a new message and focuses the text area.\n * @param suggestion The suggestion string clicked\n */\n public handleSuggestionClick(suggestion: string): void {\n this.addMessage({ text: suggestion });\n if (this.textArea) {\n this.textArea.focus();\n }\n }\n\n /**\n * Updates the chat options partially.\n * @param options Partial options to merge with current options\n */\n public updateOptions(options: Partial<IgcChatOptions>): void {\n this.options = { ...this.options, ...options };\n }\n\n /**\n * Updates the internal cache for accepted file types.\n * Parses the acceptedFiles string option into extensions, mimeTypes, and wildcard types.\n */\n public updateAcceptedTypesCache() {\n if (!this.options?.acceptedFiles) {\n this._acceptedTypesCache = null;\n return;\n }\n\n const types = this.options?.acceptedFiles\n .split(',')\n .map((type) => type.trim().toLowerCase());\n this._acceptedTypesCache = {\n extensions: new Set(types.filter((t) => t.startsWith('.'))),\n mimeTypes: new Set(\n types.filter((t) => !t.startsWith('.') && !t.endsWith('/*'))\n ),\n wildcardTypes: new Set(\n types.filter((t) => t.endsWith('/*')).map((t) => t.slice(0, -2))\n ),\n };\n }\n\n /**\n * Checks if a file's type or extension is accepted by the chat's acceptedFiles setting.\n * @param file File object to check\n * @param type Optional MIME type override if no file provided\n * @returns True if accepted, false otherwise\n */\n public isFileTypeAccepted(file: File, type = ''): boolean {\n if (!this._acceptedTypesCache) return true;\n\n if (file === null && type === '') return false;\n\n const fileType =\n file != null ? file.type.toLowerCase() : type.toLowerCase();\n const fileExtension =\n file != null\n ? `.${file.name.split('.').pop()?.toLowerCase()}`\n : `.${type.split('/').pop()?.toLowerCase()}`;\n\n // Check file extension\n if (this._acceptedTypesCache.extensions.has(fileExtension)) {\n return true;\n }\n\n // Check exact MIME type\n if (this._acceptedTypesCache.mimeTypes.has(fileType)) {\n return true;\n }\n\n // Check wildcard MIME types\n const [fileBaseType] = fileType.split('/');\n return this._acceptedTypesCache.wildcardTypes.has(fileBaseType);\n }\n\n /**\n * Checks if a slot is empty.\n * @param name Slot name to check\n * @returns True if the slot has content, false otherwise\n */\n public hasSlotContent(name: string): boolean {\n return (\n this._host.renderRoot.querySelector<HTMLSlotElement>(`slot[name=${name}]`)\n ?.childNodes.length !== 0\n );\n }\n //#endregion\n}\n\nexport function createChatState(host: IgcChatComponent): ChatState {\n return new ChatState(host);\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat-state.js","sourceRoot":"","sources":["../../../src/components/chat/chat-state.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAuB,MAAM,KAAK,CAAC;AACzD,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,SAAS,EAAY,GAAG,EAAE,MAAM,uBAAuB,CAAC;AACjE,OAAO,EAAE,QAAQ,EAAE,MAAM,uCAAuC,CAAC;AACjE,OAAO,EAAE,uBAAuB,EAAE,MAAM,kCAAkC,CAAC;AAC3E,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAChD,OAAO,EAAE,oBAAoB,EAAE,MAAM,0BAA0B,CAAC;AAKhE,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,iBAAiB,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAO,EACL,QAAQ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C,CAAC;QAClC,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACrB,OAAO,KAAK,CAAC,GAAG,EAAG,CAAC,WAAW,EAAE,CAAC;QACpC,CAAC;QACD,OAAO,EAAE,CAAC;IACZ,CAAC;IAmGM,aAAa,CAAC,OAAgC;QACnD,IAAI,CAAC,OAAO,GAAG,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,GAAG,OAAO,EAAE,CAAC;IACjD,CAAC;IAgEM,cAAc,CAAC,IAAY;QAChC,OAAO,CACL,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,aAAa,CAAkB,aAAa,IAAI,GAAG,CAAC;YACxE,EAAE,UAAU,CAAC,MAAM,KAAK,CAAC,CAC5B,CAAC;IACJ,CAAC;CAEF;AAED,MAAM,UAAU,eAAe,CAAC,IAAsB;IACpD,OAAO,IAAI,SAAS,CAAC,IAAI,CAAC,CAAC;AAC7B,CAAC","sourcesContent":["import { html, nothing, type TemplateResult } from 'lit';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { createRef, type Ref, ref } from 'lit/directives/ref.js';\nimport { enterKey } from '../common/controllers/key-bindings.js';\nimport { IgcChatResourceStringEN } from '../common/i18n/chat.resources.js';\nimport { partMap } from '../common/part-map.js';\nimport { registerIconFromText } from '../icon/icon.registry.js';\nimport type IgcTextareaComponent from '../textarea/textarea.js';\nimport type IgcTooltipComponent from '../tooltip/tooltip.js';\nimport type IgcChatComponent from './chat.js';\nimport type { IgcChatComponentEventMap } from './chat.js';\nimport { DefaultChatRenderer } from './chat-renderer.js';\nimport { PlainTextRenderer } from './plain-text-renderer.js';\nimport {\n copyIcon,\n type IgcChatOptions,\n type IgcChatTemplates,\n type IgcMessage,\n type IgcMessageAttachment,\n regenerateIcon,\n thumbDownIcon,\n thumbUpIcon,\n} from './types.js';\n\n/**\n * Internal state manager for the `<igc-chat>` component.\n *\n * Manages messages, input value, attachments, options, and event emissions.\n */\nexport class ChatState {\n //#region Internal properties and state /** The host `<igc-chat>` component instance */\n private readonly _host: IgcChatComponent;\n /** Reference to the text area input component */\n private _textArea: IgcTextareaComponent | null = null;\n /** The current list of messages */\n private _messages: IgcMessage[] = [];\n /** Chat options/configuration */\n private _options?: IgcChatOptions;\n /** List of current input attachments */\n private _inputAttachments: IgcMessageAttachment[] = [];\n /** Current input text */\n private _inputValue = '';\n /**\n * Cache of accepted file types, organized into extensions, mimeTypes, and wildcardTypes\n */\n private _acceptedTypesCache: {\n extensions: Set<string>;\n mimeTypes: Set<string>;\n wildcardTypes: Set<string>;\n } | null = null;\n /** Default position of the suggestions */\n private _suggestionsPosition: 'below-input' | 'below-messages' =\n 'below-messages';\n /** Default time in milliseconds before dispatching stop typing event */\n private _stopTypingDelay = 3000;\n\n private _isTyping = false;\n private _lastTyped = Date.now();\n\n private _fileIcon = new URL('./assets/file.png', import.meta.url).href;\n private _jsonIcon = new URL('./assets/json.png', import.meta.url).href;\n private _linkIcon = new URL('./assets/link.png', import.meta.url).href;\n\n private readonly _textAreaRef = createRef<IgcTextareaComponent>();\n private readonly _attachmentsButtonInputRef = createRef<HTMLInputElement>();\n private readonly _sharedTooltipRef = createRef<IgcTooltipComponent>();\n\n private _chatRenderer?: DefaultChatRenderer;\n private resourceStrings = IgcChatResourceStringEN;\n\n /** Default templates of the chat components */\n private _defaultTemplates: Required<IgcChatTemplates> = {\n attachmentTemplate: (att: IgcMessageAttachment, m: IgcMessage) =>\n this.renderDefaultAttachmentTemplate(att, m),\n attachmentsTemplate: (\n m: IgcMessage,\n _ctx: { templates: Partial<IgcChatTemplates> }\n ) => this.renderDefaultAttachmentsTemplate(m),\n attachmentHeaderTemplate: (att: IgcMessageAttachment, msg: IgcMessage) =>\n this.renderDefaultAttachmentHeader(att, msg),\n attachmentContentTemplate: (att: IgcMessageAttachment) =>\n this.renderDefaultAttachmentContent(att),\n messageAuthorTemplate: () => {},\n messageTemplate: (\n m: IgcMessage,\n ctx: { textContent: unknown; templates: Partial<IgcChatTemplates> }\n ) => this.renderDefaultMessageTemplate(m, ctx),\n messageActionsTemplate: (message: IgcMessage) =>\n this.renderDefaultMessageActionsTemplate(message),\n suggestionPrefixTemplate: () => {},\n typingIndicatorTemplate: () => this.renderDefaultTypingIndicator(),\n textInputTemplate: () => this.renderDefaultTextArea(),\n textAreaActionsTemplate: () => this.renderDefaultActionsArea(),\n textAreaAttachmentsTemplate: (attachments: IgcMessageAttachment[]) =>\n this.renderDefaultAttachmentsArea(attachments),\n };\n\n /** The tooltip component used for showing action tooltips. */\n private get _sharedTooltip(): IgcTooltipComponent | undefined {\n return this._sharedTooltipRef?.value;\n }\n\n private getIconName(fileType: string | undefined): string {\n if (fileType?.startsWith('image')) {\n return 'file-image';\n }\n return 'file-document';\n }\n //#endregion\n\n // #region Default renderers\n\n /**\n * Default attachments area template used when no custom template is provided.\n * Renders the list of input attachments as chips.\n * @returns TemplateResult containing the attachments area\n */\n private renderDefaultAttachmentsArea = (\n attachments: IgcMessageAttachment[]\n ): TemplateResult => {\n return html`${attachments?.map(\n (attachment, index) => html`\n <div part=\"attachment-wrapper\" role=\"listitem\">\n <igc-chip removable @igcRemove=${() => this.removeAttachment(index)}>\n <igc-icon\n slot=\"prefix\"\n name=${this.getIconName(attachment.file?.type ?? attachment.type)}\n collection=\"material\"\n ></igc-icon>\n <span part=\"attachment-name\">${attachment.name}</span>\n </igc-chip>\n </div>\n `\n )} `;\n };\n\n /**\n * Default text area template used when no custom template is provided.\n * Renders a text area for user input.\n * @returns TemplateResult containing the text area\n */\n private renderDefaultTextArea = (): TemplateResult => {\n return html` <igc-textarea\n part=\"text-input\"\n ${ref(this._textAreaRef)}\n .placeholder=${this.options?.inputPlaceholder}\n resize=\"auto\"\n rows=\"1\"\n .value=${this.inputValue}\n @igcInput=${this.handleInput}\n @focus=${this.handleFocus}\n @blur=${this.handleBlur}\n ></igc-textarea>`;\n };\n\n /**\n * Default file upload button template used when no custom template is provided.\n * Renders a file input for attaching files.\n * @returns TemplateResult containing the file upload button\n */\n private renderDefaultFileUploadButton = (): TemplateResult => {\n if (this.options?.disableInputAttachments) return html``;\n return html`\n <label for=\"input_attachments\" part=\"upload-button\">\n <igc-icon-button\n variant=\"flat\"\n name=\"attachment\"\n collection=\"material\"\n @click=${() => this._attachmentsButtonInputRef?.value?.click()}\n ></igc-icon-button>\n <input\n type=\"file\"\n id=\"input_attachments\"\n name=\"input_attachments\"\n ${ref(this._attachmentsButtonInputRef)}\n multiple\n accept=${ifDefined(this.options?.acceptedFiles === '' ? undefined : this.options?.acceptedFiles)}\n @change=${this.handleFileUpload}>\n </input>\n </label>\n `;\n };\n\n /**\n * Default send button template used when no custom template is provided.\n * Renders a send button that submits the current input value and attachments.\n * @returns TemplateResult containing the send button\n */\n private renderDefaultSendButton = (): TemplateResult => {\n return html` <igc-icon-button\n aria-label=\"Send message\"\n name=\"send-message\"\n collection=\"material\"\n variant=\"contained\"\n part=\"send-button\"\n ?disabled=${!this.inputValue.trim() && this.inputAttachments.length === 0}\n @click=${this.sendMessage}\n ></igc-icon-button>`;\n };\n\n private renderDefaultActionsArea = () => {\n return html` ${this.renderDefaultFileUploadButton()}\n ${this.renderDefaultSendButton()}`;\n };\n /**\n * Default typing indicator template used when no custom template is provided.\n * Renders a simple typing indicator with three dots.\n * @returns TemplateResult containing the typing indicator\n */\n private renderDefaultTypingIndicator = (): TemplateResult => {\n return html`<div part=\"typing-indicator\">\n <div part=\"typing-dot\"></div>\n <div part=\"typing-dot\"></div>\n <div part=\"typing-dot\"></div>\n </div>`;\n };\n\n /**\n * Default message template used when no custom template is provided.\n * Renders the message text, sanitized for security.\n * @param message The chat message to render\n * @returns TemplateResult containing the rendered message\n */\n private renderDefaultMessageTemplate = (\n m: IgcMessage,\n ctx: { textContent: unknown; templates: Partial<IgcChatTemplates> }\n ) => {\n const templates = { ...this._defaultTemplates, ...ctx.templates };\n return html`\n ${templates.messageAuthorTemplate(m) ?? nothing}\n ${ctx?.textContent ?? m.text}\n ${m.attachments?.length\n ? html`<igc-message-attachments .message=${m}>\n </igc-message-attachments>`\n : nothing}\n ${templates.messageActionsTemplate(m) ?? nothing}\n `;\n };\n\n private renderDefaultAttachmentHeaderText(\n attachment: IgcMessageAttachment,\n message: IgcMessage\n ) {\n return html`\n ${html`${message.sender !== this.currentUserId\n ? html`${attachment.type === 'image' ||\n attachment.file?.type.startsWith('image/')\n ? html`<igc-icon\n name=\"image\"\n collection=\"material\"\n part=\"attachment-icon\"\n ></igc-icon>`\n : html`<igc-icon\n name=\"file\"\n collection=\"material\"\n part=\"attachment-icon\"\n ></igc-icon>`}`\n : nothing} <span part=\"file-name\">${attachment.name}</span>`}\n `;\n }\n\n private handleHeaderClick(attachment: IgcMessageAttachment) {\n this.emitEvent('igcAttachmentClick', { detail: attachment });\n }\n /**\n * Default attachment header template used when no custom template is provided.\n * Renders the attachment icon and name.\n * @param attachment The message attachment to render\n * @returns TemplateResult containing the rendered attachment header\n */\n private renderDefaultAttachmentHeader = (\n attachment: IgcMessageAttachment,\n message: IgcMessage\n ) => {\n return this.renderDefaultAttachmentHeaderText(attachment, message);\n };\n\n /**\n * Default attachment content template used when no custom template is provided.\n * Renders the attachment content based on its type.\n * @param attachment The message attachment to render\n * @returns TemplateResult containing the rendered attachment content\n */\n private renderDefaultAttachmentContent = (\n attachment: IgcMessageAttachment\n ) => {\n const ext = this.getFileExtension(attachment.name);\n const isImage = this.isImageAttachment(attachment);\n const url = isImage\n ? this.getURL(attachment)\n : (this._fileIconMap[ext] ?? this._fileIconMap['default']);\n const partName = isImage ? 'image-attachment' : 'file-attachment';\n return html`<img part=\"${partName}\" src=${url} alt=${attachment.name} />`;\n };\n\n private renderDefaultMessageActionsTemplate = (\n message: IgcMessage\n ): unknown => {\n const isLastMessage = message === this.messages.at(-1);\n return message?.sender !== this.currentUserId &&\n message?.text.trim() &&\n (!isLastMessage || !this._isTyping)\n ? html`<div>\n <igc-icon-button\n id=\"copy-response-button\"\n @pointerenter=${(ev: PointerEvent) =>\n this.showTooltip(ev, this.resourceStrings.reactionCopyResponse)}\n name=\"copy-response\"\n collection=\"material\"\n variant=\"flat\"\n @click=${(e: MouseEvent) =>\n this.handleMessageActionClick(e, message)}\n ></igc-icon-button>\n <igc-icon-button\n id=\"good-response-button\"\n @pointerenter=${(ev: PointerEvent) =>\n this.showTooltip(ev, this.resourceStrings.reactionGoodResponse)}\n name=\"good-response\"\n collection=\"material\"\n variant=\"flat\"\n @click=${(e: MouseEvent) =>\n this.handleMessageActionClick(e, message)}\n ></igc-icon-button>\n <igc-icon-button\n id=\"bad-response-button\"\n @pointerenter=${(ev: PointerEvent) =>\n this.showTooltip(ev, this.resourceStrings.reactionBadResponse)}\n name=\"bad-response\"\n variant=\"flat\"\n collection=\"material\"\n @click=${(e: MouseEvent) =>\n this.handleMessageActionClick(e, message)}\n ></igc-icon-button>\n <igc-icon-button\n id=\"redo-button\"\n @pointerenter=${(ev: PointerEvent) =>\n this.showTooltip(ev, this.resourceStrings.reactionRedo)}\n name=\"redo\"\n variant=\"flat\"\n collection=\"material\"\n @click=${(e: MouseEvent) =>\n this.handleMessageActionClick(e, message)}\n ></igc-icon-button>\n <igc-tooltip\n id=\"sharedTooltip\"\n ${ref(this._sharedTooltipRef)}\n ></igc-tooltip>\n </div>`\n : nothing;\n };\n\n private handleMessageActionClick = (\n event: MouseEvent,\n message: IgcMessage\n ): void => {\n const reaction = (event.target as HTMLElement).getAttribute('name');\n this.emitEvent('igcMessageReact', {\n detail: { message, reaction },\n });\n };\n\n private renderDefaultAttachmentTemplate = (\n att: IgcMessageAttachment,\n msg: IgcMessage\n ) => {\n const isCurrentUser = msg.sender === this.currentUserId;\n const attachmentParts = {\n attachment: true,\n sent: isCurrentUser,\n };\n const contentParts = {\n 'attachment-content': true,\n sent: isCurrentUser,\n };\n const headerParts = {\n 'attachment-header': true,\n sent: isCurrentUser,\n };\n\n const content = html`<div part=${partMap(contentParts)}>\n ${this.mergedTemplates.attachmentContentTemplate(att)}\n </div>`;\n const header = html` <div\n part=${partMap(headerParts)}\n role=\"button\"\n @click=${() => this.handleHeaderClick(att)}\n >\n <div part=\"details\">\n ${this.mergedTemplates.attachmentHeaderTemplate(att, msg)}\n </div>\n </div>`;\n\n return html`<div part=${partMap(attachmentParts)}>\n ${isCurrentUser ? content : nothing} ${header}\n ${!isCurrentUser ? content : nothing}\n </div> `;\n };\n\n private renderDefaultAttachmentsTemplate = (m: IgcMessage) => {\n return html`\n ${(m.attachments ?? []).map((att: IgcMessageAttachment) =>\n this.mergedTemplates.attachmentTemplate(att, m)\n ) || nothing}\n `;\n };\n\n private showTooltip(ev: PointerEvent, text: string) {\n if (!this._sharedTooltip) return;\n this._sharedTooltip.message = text;\n this._sharedTooltip.hideDelay = 300;\n this._sharedTooltip.show(ev.composedPath()[0] as any);\n }\n\n // #endregion\n\n //#region Public properties\n /**\n * Gets the list of chat messages.\n */\n public get messages(): IgcMessage[] {\n return this._messages;\n }\n\n /**\n * Sets the list of chat messages.\n */\n public set messages(value: IgcMessage[]) {\n this._messages = value;\n this._host.requestUpdate();\n }\n\n /**\n * Gets current chat options.\n */\n public get options(): IgcChatOptions | undefined {\n return this._options;\n }\n\n /**\n * Sets chat options and requests host update.\n */\n public set options(value: IgcChatOptions) {\n this._options = value;\n this._host.requestUpdate();\n // Notify context consumers about the state change\n if (this._host.updateContextValue) {\n this._host.updateContextValue();\n }\n }\n\n /**\n * Gets the current user ID from options or returns 'user' as fallback.\n */\n public get currentUserId(): string {\n return this._options?.currentUserId ?? 'user';\n }\n\n /**\n * Gets the current suggestionsPosition from options or returns the default value 'below-messages'.\n */\n public get suggestionsPosition(): string {\n return this._options?.suggestionsPosition ?? this._suggestionsPosition;\n }\n\n /**\n * Gets the current stopTypingDelay from options or returns the default value `3000`.\n */\n public get stopTypingDelay(): number {\n return this._options?.stopTypingDelay ?? this._stopTypingDelay;\n }\n\n /**\n * Gets the text area component.\n */\n public get textArea(): IgcTextareaComponent | null {\n return this._textArea;\n }\n\n /**\n * Sets the text area component.\n */\n public set textArea(value: IgcTextareaComponent) {\n this._textArea = value;\n }\n\n /**\n * Gets the text area component.\n */\n public get textAreaRef(): Ref<IgcTextareaComponent> {\n return this._textAreaRef;\n }\n\n /**\n * Gets the list of attachments currently attached to input.\n */\n public get inputAttachments(): IgcMessageAttachment[] {\n return this._inputAttachments;\n }\n\n /**\n * Sets the input attachments and requests host update.\n */\n public set inputAttachments(value: IgcMessageAttachment[]) {\n this._inputAttachments = value;\n this._host.requestUpdate(); // Notify the host component to re-render\n // Notify context consumers about the state change\n if (this._host.updateContextValue) {\n this._host.updateContextValue();\n }\n }\n\n /**\n * Gets the current input value.\n */\n public get inputValue(): string {\n return this._inputValue;\n }\n\n /**\n * Sets the current input value and requests host update.\n */\n public set inputValue(value: string) {\n this._inputValue = value;\n this._host.requestUpdate();\n // Notify context consumers about the state change\n if (this._host.updateContextValue) {\n this._host.updateContextValue();\n }\n }\n\n /** Returns all default templates applied in the chat component. */\n public get defaultTemplates(): Required<IgcChatTemplates> {\n return this._defaultTemplates;\n }\n\n /** Sets the default templates applied in the chat component. */\n public set defaultTemplates(templates: Required<IgcChatTemplates>) {\n this._defaultTemplates = { ...templates };\n }\n\n public get mergedTemplates(): Required<IgcChatTemplates> {\n return { ...this._defaultTemplates, ...this.options?.templates };\n }\n\n public get chatRenderer(): DefaultChatRenderer | undefined {\n if (\n !this._chatRenderer ||\n this._chatRenderer !== this.options?.messageRenderer\n ) {\n this._chatRenderer = new DefaultChatRenderer(\n this.options?.messageRenderer ?? new PlainTextRenderer(),\n this.mergedTemplates\n );\n this.options?.messageRenderer?.init?.();\n }\n return this._chatRenderer;\n }\n\n /**\n * Handles input text changes.\n * Updates internal inputValue and emits 'igcInputChange' event.\n * @param e Input event from the text area\n */\n private handleInput = ({ detail }: CustomEvent<string>) => {\n if (detail === this.inputValue) return;\n\n this.inputValue = detail;\n this.emitEvent('igcInputChange', { detail: { value: this.inputValue } });\n };\n //#endregion\n\n /**\n * Creates an instance of ChatState.\n * @param chat The host `<igc-chat>` component.\n */\n constructor(chat: IgcChatComponent) {\n this._host = chat;\n registerIconFromText('copy-response', copyIcon, 'material');\n registerIconFromText('good-response', thumbUpIcon, 'material');\n registerIconFromText('bad-response', thumbDownIcon, 'material');\n registerIconFromText('redo', regenerateIcon, 'material');\n }\n\n //#region Event handlers\n\n /**\n * Emits a custom event from the host component.\n * @param name Event name (key of IgcChatComponentEventMap)\n * @param args Event detail or options\n * @returns true if event was not canceled, false otherwise\n */\n public emitEvent = (name: keyof IgcChatComponentEventMap, args?: any) => {\n return this._host.emitEvent(name, args);\n };\n\n // /**\n // * Handles input text changes.\n // * Updates internal inputValue and emits 'igcInputChange' event.\n // * @param e Input event from the text area\n // */\n // private handleInputChange = (value: string): void => {\n // if (value === this.inputValue) return;\n\n // this.inputValue = value;\n // this.emitEvent('igcInputChange', { detail: { value: this.inputValue } });\n // };\n\n //#endregion\n\n //#region Public API\n\n /**\n * Adds a new chat message.\n * Emits 'igcMessageCreated' event which can be canceled to prevent adding.\n * Clears input value and attachments on success.\n * @param message Partial message object with optional id, sender, timestamp\n */\n public addMessage = (message: {\n id?: string;\n text: string;\n sender?: string;\n timestamp?: Date;\n attachments?: IgcMessageAttachment[];\n }): void => {\n const newMessage: IgcMessage = {\n id: message.id ?? Date.now().toString(),\n text: message.text,\n sender: message.sender ?? this.currentUserId,\n timestamp: message.timestamp ?? new Date(),\n attachments: message.attachments || [],\n };\n\n const allowed = this.emitEvent('igcMessageCreated', {\n detail: newMessage,\n cancelable: true,\n });\n\n if (allowed) {\n if (!this.messages.some((msg) => msg.id === newMessage.id)) {\n this.messages = [...this.messages, newMessage];\n }\n this.inputValue = '';\n this.inputAttachments = [];\n }\n };\n\n /**\n * Adds files as attachments to the input.\n * Emits 'igcAttachmentChange' event which can be canceled to prevent adding.\n * @param files Array of File objects to attach\n */\n public attachFiles(files: File[]) {\n const newAttachments: IgcMessageAttachment[] = [];\n let count = this.inputAttachments.length;\n files.forEach((file) => {\n if (this.inputAttachments.find((a) => a.name === file.name)) {\n return;\n }\n\n const isImage = file.type.startsWith('image/');\n newAttachments.push({\n id: Date.now().toString() + count++,\n url: URL.createObjectURL(file),\n name: file.name,\n file: file,\n thumbnail: isImage ? URL.createObjectURL(file) : undefined,\n });\n });\n\n const allowed = this.emitEvent('igcAttachmentChange', {\n detail: [...this.inputAttachments, ...newAttachments],\n cancelable: true,\n });\n if (allowed) {\n this.inputAttachments = [...this.inputAttachments, ...newAttachments];\n }\n }\n\n private getURL = (attachment: IgcMessageAttachment): string => {\n if (attachment.url) {\n return attachment.url;\n }\n if (attachment.file) {\n return URL.createObjectURL(attachment.file);\n }\n return '';\n };\n\n private isImageAttachment(attachment: IgcMessageAttachment): boolean {\n return (\n attachment.type === 'image' ||\n !!attachment.file?.type.startsWith('image/')\n );\n }\n\n private _fileIconMap: Record<string, string> = {\n pdf: this._fileIcon,\n doc: this._fileIcon,\n docx: this._fileIcon,\n xls: this._fileIcon,\n xlsx: this._fileIcon,\n txt: this._fileIcon,\n json: this._jsonIcon,\n link: this._linkIcon,\n default: this._fileIcon, // A fallback icon\n };\n\n private getFileExtension(fileName: string): string {\n const parts = fileName.split('.');\n if (parts.length > 1) {\n return parts.pop()!.toLowerCase();\n }\n return '';\n }\n\n public handleKeyDown = (e: KeyboardEvent) => {\n if (e.key.toLowerCase() === enterKey.toLowerCase() && !e.shiftKey) {\n e.preventDefault();\n this.sendMessage();\n } else {\n this._lastTyped = Date.now();\n if (!this._isTyping) {\n this.emitEvent('igcTypingChange', {\n detail: { isTyping: true },\n });\n this._isTyping = true;\n }\n\n const stopTypingDelay = this.stopTypingDelay;\n setTimeout(() => {\n if (\n this._isTyping &&\n stopTypingDelay &&\n this._lastTyped + stopTypingDelay < Date.now()\n ) {\n this.emitEvent('igcTypingChange', {\n detail: { isTyping: false },\n });\n this._isTyping = false;\n }\n }, stopTypingDelay);\n }\n };\n\n private handleFocus = () => {\n this.emitEvent('igcInputFocus');\n };\n\n private handleBlur = () => {\n this.emitEvent('igcInputBlur');\n };\n\n private sendMessage = () => {\n if (!this.inputValue.trim() && this.inputAttachments.length === 0) return;\n\n this.addMessage({\n text: this.inputValue,\n attachments: this.inputAttachments,\n });\n this.inputValue = '';\n\n if (this._textArea) {\n this._textArea.style.height = 'auto';\n }\n\n this._host.updateComplete.then(() => {\n this._textArea?.focus();\n });\n };\n\n private handleFileUpload = (e: Event) => {\n const input = e.target as HTMLInputElement;\n if (!input.files || input.files.length === 0) return;\n\n const files = Array.from(input.files);\n this.attachFiles(files);\n this._host.requestUpdate();\n };\n\n /**\n * Removes an attachment by index.\n * Emits 'igcAttachmentChange' event which can be canceled to prevent removal.\n * @param index Index of the attachment to remove\n */\n private removeAttachment = (index: number): void => {\n const allowed = this.emitEvent('igcAttachmentChange', {\n detail: this.inputAttachments.filter((_, i) => i !== index),\n cancelable: true,\n });\n if (allowed) {\n this.inputAttachments = this.inputAttachments.filter(\n (_, i) => i !== index\n );\n }\n };\n\n /**\n * Handles when a suggestion is clicked.\n * Adds the suggestion as a new message and focuses the text area.\n * @param suggestion The suggestion string clicked\n */\n public handleSuggestionClick = (suggestion: string): void => {\n this.addMessage({ text: suggestion });\n if (this.textArea) {\n this.textArea.focus();\n }\n };\n\n /**\n * Updates the chat options partially.\n * @param options Partial options to merge with current options\n */\n public updateOptions(options: Partial<IgcChatOptions>): void {\n this.options = { ...this.options, ...options };\n }\n\n /**\n * Updates the internal cache for accepted file types.\n * Parses the acceptedFiles string option into extensions, mimeTypes, and wildcard types.\n */\n public updateAcceptedTypesCache = () => {\n if (!this.options?.acceptedFiles) {\n this._acceptedTypesCache = null;\n return;\n }\n\n const types = this.options?.acceptedFiles\n .split(',')\n .map((type) => type.trim().toLowerCase());\n this._acceptedTypesCache = {\n extensions: new Set(types.filter((t) => t.startsWith('.'))),\n mimeTypes: new Set(\n types.filter((t) => !t.startsWith('.') && !t.endsWith('/*'))\n ),\n wildcardTypes: new Set(\n types.filter((t) => t.endsWith('/*')).map((t) => t.slice(0, -2))\n ),\n };\n };\n\n /**\n * Checks if a file's type or extension is accepted by the chat's acceptedFiles setting.\n * @param file File object to check\n * @param type Optional MIME type override if no file provided\n * @returns True if accepted, false otherwise\n */\n public isFileTypeAccepted = (file: File, type = ''): boolean => {\n if (!this._acceptedTypesCache) return true;\n\n if (file === null && type === '') return false;\n\n const fileType =\n file != null ? file.type.toLowerCase() : type.toLowerCase();\n const fileExtension =\n file != null\n ? `.${file.name.split('.').pop()?.toLowerCase()}`\n : `.${type.split('/').pop()?.toLowerCase()}`;\n\n // Check file extension\n if (this._acceptedTypesCache.extensions.has(fileExtension)) {\n return true;\n }\n\n // Check exact MIME type\n if (this._acceptedTypesCache.mimeTypes.has(fileType)) {\n return true;\n }\n\n // Check wildcard MIME types\n const [fileBaseType] = fileType.split('/');\n return this._acceptedTypesCache.wildcardTypes.has(fileBaseType);\n };\n\n /**\n * Checks if a slot is empty.\n * @param name Slot name to check\n * @returns True if the slot has content, false otherwise\n */\n public hasSlotContent(name: string): boolean {\n return (\n this._host.renderRoot.querySelector<HTMLSlotElement>(`slot[name=${name}]`)\n ?.childNodes.length !== 0\n );\n }\n //#endregion\n}\n\nexport function createChatState(host: IgcChatComponent): ChatState {\n return new ChatState(host);\n}\n"]}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { LitElement
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
2
|
import type { Constructor } from '../common/mixins/constructor.js';
|
|
3
3
|
import type { IgcChatOptions, IgcMessage, IgcMessageAttachment } from './types.js';
|
|
4
4
|
/**
|
|
@@ -13,6 +13,17 @@ export interface IgcChatComponentEventMap {
|
|
|
13
13
|
* @detail The message that was created.
|
|
14
14
|
*/
|
|
15
15
|
igcMessageCreated: CustomEvent<IgcMessage>;
|
|
16
|
+
/**
|
|
17
|
+
* Dispatched when a new chat message is created (sent).
|
|
18
|
+
*
|
|
19
|
+
* @event igcMessageCreated
|
|
20
|
+
* @type {CustomEvent<IgcMessage>}
|
|
21
|
+
* @detail The message that was reacted to and the reaction.
|
|
22
|
+
*/
|
|
23
|
+
igcMessageReact: CustomEvent<{
|
|
24
|
+
message: IgcMessage;
|
|
25
|
+
reaction: string;
|
|
26
|
+
}>;
|
|
16
27
|
/**
|
|
17
28
|
* Dispatched when a chat message attachment is clicked.
|
|
18
29
|
*
|
|
@@ -112,9 +123,8 @@ export default class IgcChatComponent extends IgcChatComponent_base {
|
|
|
112
123
|
*/
|
|
113
124
|
static register(): void;
|
|
114
125
|
private readonly _chatState;
|
|
126
|
+
private readonly _slots;
|
|
115
127
|
private _context;
|
|
116
|
-
private _hasContent;
|
|
117
|
-
private _chatInput;
|
|
118
128
|
constructor();
|
|
119
129
|
/**
|
|
120
130
|
* The list of chat messages currently displayed.
|
|
@@ -140,20 +150,23 @@ export default class IgcChatComponent extends IgcChatComponent_base {
|
|
|
140
150
|
*/
|
|
141
151
|
set options(value: IgcChatOptions);
|
|
142
152
|
get options(): IgcChatOptions | undefined;
|
|
143
|
-
/**
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
get defaultSendButton(): TemplateResult;
|
|
153
|
+
/** The resource strings. */
|
|
154
|
+
resourceStrings: import("../common/i18n/chat.resources.js").IgcChatResourceStrings;
|
|
155
|
+
/**
|
|
156
|
+
* Scrolls the view to a specific message by id.
|
|
157
|
+
* @param messageId - The id of the message to scroll to
|
|
158
|
+
*/
|
|
159
|
+
scrollToMessage(messageId: string): void;
|
|
151
160
|
protected contextChanged(): void;
|
|
152
161
|
private renderHeader;
|
|
162
|
+
private renderSuggestionPrefix;
|
|
153
163
|
private renderSuggestions;
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
164
|
+
/**
|
|
165
|
+
* Updates the context value to notify all consumers that the chat state has changed.
|
|
166
|
+
* This ensures that components consuming the chat context will re-render.
|
|
167
|
+
*/
|
|
168
|
+
updateContextValue(): void;
|
|
169
|
+
protected render(): import("lit-html").TemplateResult<1>;
|
|
157
170
|
}
|
|
158
171
|
declare global {
|
|
159
172
|
interface HTMLElementTagNameMap {
|
package/components/chat/chat.js
CHANGED
|
@@ -6,31 +6,41 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
6
6
|
};
|
|
7
7
|
import { ContextProvider } from '@lit/context';
|
|
8
8
|
import { html, LitElement, nothing } from 'lit';
|
|
9
|
-
import { property
|
|
9
|
+
import { property } from 'lit/decorators.js';
|
|
10
10
|
import { addThemingController } from '../../theming/theming-controller.js';
|
|
11
11
|
import IgcButtonComponent from '../button/button.js';
|
|
12
12
|
import { chatContext } from '../common/context.js';
|
|
13
|
+
import { addSlotController, setSlots } from '../common/controllers/slot.js';
|
|
13
14
|
import { watch } from '../common/decorators/watch.js';
|
|
14
15
|
import { registerComponent } from '../common/definitions/register.js';
|
|
16
|
+
import { IgcChatResourceStringEN } from '../common/i18n/chat.resources.js';
|
|
15
17
|
import { EventEmitterMixin } from '../common/mixins/event-emitter.js';
|
|
18
|
+
import IgcIconComponent from '../icon/icon.js';
|
|
19
|
+
import IgcListComponent from '../list/list.js';
|
|
20
|
+
import IgcListHeaderComponent from '../list/list-header.js';
|
|
21
|
+
import IgcListItemComponent from '../list/list-item.js';
|
|
16
22
|
import IgcChatInputComponent from './chat-input.js';
|
|
17
23
|
import IgcChatMessageListComponent from './chat-message-list.js';
|
|
18
24
|
import { createChatState } from './chat-state.js';
|
|
19
25
|
import { styles } from './themes/chat.base.css.js';
|
|
20
26
|
import { styles as shared } from './themes/shared/chat.common.css.js';
|
|
21
27
|
import { all } from './themes/themes.js';
|
|
28
|
+
const Slots = setSlots('prefix', 'title', 'actions', 'suggestions-header', 'suggestions', 'suggestions-actions', 'suggestions-header', 'suggestion', 'empty-state');
|
|
22
29
|
class IgcChatComponent extends EventEmitterMixin(LitElement) {
|
|
23
30
|
static register() {
|
|
24
|
-
registerComponent(IgcChatComponent, IgcChatInputComponent, IgcChatMessageListComponent, IgcButtonComponent);
|
|
31
|
+
registerComponent(IgcChatComponent, IgcChatInputComponent, IgcChatMessageListComponent, IgcButtonComponent, IgcIconComponent, IgcListComponent, IgcListItemComponent, IgcListHeaderComponent);
|
|
25
32
|
}
|
|
26
33
|
constructor() {
|
|
27
34
|
super();
|
|
28
35
|
this._chatState = createChatState(this);
|
|
36
|
+
this._slots = addSlotController(this, {
|
|
37
|
+
slots: Slots,
|
|
38
|
+
});
|
|
29
39
|
this._context = new ContextProvider(this, {
|
|
30
40
|
context: chatContext,
|
|
31
41
|
initialValue: this._chatState,
|
|
32
42
|
});
|
|
33
|
-
this.
|
|
43
|
+
this.resourceStrings = IgcChatResourceStringEN;
|
|
34
44
|
addThemingController(this, all);
|
|
35
45
|
}
|
|
36
46
|
set messages(value) {
|
|
@@ -40,7 +50,7 @@ class IgcChatComponent extends EventEmitterMixin(LitElement) {
|
|
|
40
50
|
return this._chatState.messages;
|
|
41
51
|
}
|
|
42
52
|
set draftMessage(value) {
|
|
43
|
-
if (this._chatState) {
|
|
53
|
+
if (this._chatState && value) {
|
|
44
54
|
this._chatState.inputValue = value.text;
|
|
45
55
|
this._chatState.inputAttachments = value.attachments || [];
|
|
46
56
|
this.requestUpdate();
|
|
@@ -58,23 +68,29 @@ class IgcChatComponent extends EventEmitterMixin(LitElement) {
|
|
|
58
68
|
get options() {
|
|
59
69
|
return this._chatState.options;
|
|
60
70
|
}
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
71
|
+
scrollToMessage(messageId) {
|
|
72
|
+
const messageListComponent = this.shadowRoot?.querySelector('igc-chat-message-list');
|
|
73
|
+
if (!messageListComponent) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
const messageElement = messageListComponent.shadowRoot?.querySelector(`#message-${messageId}`);
|
|
77
|
+
if (!messageElement) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
messageElement.scrollIntoView({
|
|
81
|
+
behavior: 'smooth',
|
|
82
|
+
block: 'center',
|
|
83
|
+
inline: 'nearest',
|
|
84
|
+
});
|
|
72
85
|
}
|
|
73
86
|
contextChanged() {
|
|
74
87
|
this._context.setValue(this._chatState, true);
|
|
75
88
|
}
|
|
76
89
|
renderHeader() {
|
|
77
|
-
|
|
90
|
+
const hasContent = this._slots.hasAssignedElements('prefix') ||
|
|
91
|
+
this._slots.hasAssignedElements('title') ||
|
|
92
|
+
this._slots.hasAssignedElements('actions');
|
|
93
|
+
return html ` <div part="header" ?hidden=${!hasContent}>
|
|
78
94
|
<slot name="prefix" part="prefix"></slot>
|
|
79
95
|
<slot name="title" part="title"
|
|
80
96
|
>${this._chatState.options?.headerText}</slot
|
|
@@ -82,58 +98,127 @@ class IgcChatComponent extends EventEmitterMixin(LitElement) {
|
|
|
82
98
|
<slot name="actions" part="actions"></slot>
|
|
83
99
|
</div>`;
|
|
84
100
|
}
|
|
101
|
+
renderSuggestionPrefix() {
|
|
102
|
+
const defaultPrefix = html `<igc-icon
|
|
103
|
+
name="star-icon"
|
|
104
|
+
collection="material"
|
|
105
|
+
></igc-icon>`;
|
|
106
|
+
return html `<span slot="start">
|
|
107
|
+
${this._chatState?.options?.templates?.suggestionPrefixTemplate
|
|
108
|
+
? this._chatState.options.templates.suggestionPrefixTemplate
|
|
109
|
+
: defaultPrefix}
|
|
110
|
+
</span>`;
|
|
111
|
+
}
|
|
85
112
|
renderSuggestions() {
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
role="list"
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
>
|
|
98
|
-
<
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
113
|
+
const hasContent = this._slots.hasAssignedElements('suggestions-header');
|
|
114
|
+
return html `<div part="suggestions-container">
|
|
115
|
+
<igc-list role="list" aria-label="Suggestions">
|
|
116
|
+
<igc-list-header part="suggestions-header">
|
|
117
|
+
<span ?hidden=${hasContent}>
|
|
118
|
+
${this.resourceStrings.suggestionsHeader}
|
|
119
|
+
</span>
|
|
120
|
+
<slot name="suggestions-header"></slot>
|
|
121
|
+
</igc-list-header>
|
|
122
|
+
<slot name="suggestions" part="suggestions">
|
|
123
|
+
${this._chatState.options?.suggestions?.map((suggestion) => html `
|
|
124
|
+
<slot name="suggestion" part="suggestion" role="listitem">
|
|
125
|
+
<igc-list-item
|
|
126
|
+
@click=${() => this._chatState?.handleSuggestionClick(suggestion)}
|
|
127
|
+
>
|
|
128
|
+
${this.renderSuggestionPrefix()}
|
|
129
|
+
<span slot="title">${suggestion}</span>
|
|
130
|
+
</igc-list-item>
|
|
131
|
+
</slot>
|
|
132
|
+
`)}
|
|
133
|
+
</slot>
|
|
134
|
+
<slot name="suggestions-actions" part="suggestions-actions"></slot>
|
|
135
|
+
</igc-list>
|
|
104
136
|
</div>`;
|
|
105
137
|
}
|
|
106
|
-
|
|
138
|
+
updateContextValue() {
|
|
107
139
|
this._context.setValue(this._chatState, true);
|
|
108
140
|
}
|
|
109
|
-
createRenderRoot() {
|
|
110
|
-
const root = super.createRenderRoot();
|
|
111
|
-
root.addEventListener('slotchange', () => {
|
|
112
|
-
this._hasContent =
|
|
113
|
-
this._chatState?.hasSlotContent('prefix') ||
|
|
114
|
-
this._chatState?.hasSlotContent('title') ||
|
|
115
|
-
this._chatState?.hasSlotContent('actions');
|
|
116
|
-
});
|
|
117
|
-
return root;
|
|
118
|
-
}
|
|
119
141
|
render() {
|
|
120
142
|
const hasSuggestions = this._chatState.options?.suggestions &&
|
|
121
143
|
this._chatState.options.suggestions.length > 0;
|
|
122
144
|
return html `
|
|
123
|
-
<div
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
145
|
+
<div
|
|
146
|
+
part="chat-container"
|
|
147
|
+
exportparts="
|
|
148
|
+
chat-container,
|
|
149
|
+
header,
|
|
150
|
+
prefix,
|
|
151
|
+
title,
|
|
152
|
+
actions,
|
|
153
|
+
chat-wrapper,
|
|
154
|
+
chat-messages,
|
|
155
|
+
empty-state,
|
|
156
|
+
suggestions-container,
|
|
157
|
+
suggestions-header,
|
|
158
|
+
suggestions,
|
|
159
|
+
suggestions-actions,
|
|
160
|
+
suggestion,
|
|
161
|
+
message-container,
|
|
162
|
+
message-list,
|
|
163
|
+
message-item,
|
|
164
|
+
message,
|
|
165
|
+
message-text,
|
|
166
|
+
message-attachments,
|
|
167
|
+
message-actions,
|
|
168
|
+
typing-indicator,
|
|
169
|
+
attachments-container,
|
|
170
|
+
attachment,
|
|
171
|
+
attachment-header,
|
|
172
|
+
attachment-content,
|
|
173
|
+
attachment-icon,
|
|
174
|
+
file-name,
|
|
175
|
+
attachment-actions
|
|
176
|
+
"
|
|
177
|
+
>
|
|
178
|
+
${this.renderHeader()}
|
|
179
|
+
<div part="chat-wrapper">
|
|
180
|
+
${this.messages.length === 0
|
|
128
181
|
? html `<div part="empty-state">
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
: html
|
|
132
|
-
|
|
182
|
+
<slot name="empty-state"> </slot>
|
|
183
|
+
</div>`
|
|
184
|
+
: html ` <igc-chat-message-list
|
|
185
|
+
part="chat-messages"
|
|
186
|
+
exportparts="
|
|
187
|
+
message-container,
|
|
188
|
+
message-list,
|
|
189
|
+
message-item,
|
|
190
|
+
message,
|
|
191
|
+
message-text,
|
|
192
|
+
message-attachments,
|
|
193
|
+
message-actions,
|
|
194
|
+
typing-indicator,
|
|
195
|
+
attachments-container,
|
|
196
|
+
attachment,
|
|
197
|
+
attachment-header,
|
|
198
|
+
attachment-content,
|
|
199
|
+
attachment-icon,
|
|
200
|
+
file-name,
|
|
201
|
+
actions: attachment-actions"
|
|
202
|
+
>
|
|
203
|
+
</igc-chat-message-list>`}
|
|
204
|
+
${hasSuggestions &&
|
|
133
205
|
this._chatState.suggestionsPosition === 'below-messages'
|
|
134
206
|
? this.renderSuggestions()
|
|
135
207
|
: nothing}
|
|
136
|
-
|
|
208
|
+
</div>
|
|
209
|
+
<igc-chat-input
|
|
210
|
+
exportparts="
|
|
211
|
+
input-container,
|
|
212
|
+
input-wrapper,
|
|
213
|
+
attachments: input-attachments-container,
|
|
214
|
+
attachments-wrapper: input-attachment,
|
|
215
|
+
attachment-name: input-attachment-name,
|
|
216
|
+
text-input,
|
|
217
|
+
buttons-container: input-buttons-container,
|
|
218
|
+
upload-button,
|
|
219
|
+
send-button"
|
|
220
|
+
>
|
|
221
|
+
</igc-chat-input>
|
|
137
222
|
${hasSuggestions &&
|
|
138
223
|
this._chatState.suggestionsPosition === 'below-input'
|
|
139
224
|
? this.renderSuggestions()
|
|
@@ -146,20 +231,17 @@ IgcChatComponent.tagName = 'igc-chat';
|
|
|
146
231
|
IgcChatComponent.styles = [styles, shared];
|
|
147
232
|
export default IgcChatComponent;
|
|
148
233
|
__decorate([
|
|
149
|
-
|
|
150
|
-
], IgcChatComponent.prototype, "_hasContent", void 0);
|
|
151
|
-
__decorate([
|
|
152
|
-
query(IgcChatInputComponent.tagName)
|
|
153
|
-
], IgcChatComponent.prototype, "_chatInput", void 0);
|
|
154
|
-
__decorate([
|
|
155
|
-
property({ reflect: true, attribute: false })
|
|
234
|
+
property({ attribute: false })
|
|
156
235
|
], IgcChatComponent.prototype, "messages", null);
|
|
157
236
|
__decorate([
|
|
158
|
-
property({
|
|
237
|
+
property({ attribute: false })
|
|
159
238
|
], IgcChatComponent.prototype, "draftMessage", null);
|
|
160
239
|
__decorate([
|
|
161
240
|
property({ attribute: false })
|
|
162
241
|
], IgcChatComponent.prototype, "options", null);
|
|
242
|
+
__decorate([
|
|
243
|
+
property({ attribute: false })
|
|
244
|
+
], IgcChatComponent.prototype, "resourceStrings", void 0);
|
|
163
245
|
__decorate([
|
|
164
246
|
watch('messages'),
|
|
165
247
|
watch('draftMessage'),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":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,CAAC,UAAU,CAAC,OAAO,EAAE,UAAU;YACvD,CAAC,CAAC,IAAI,CAAC,YAAY,EAAE;YACrB,CAAC,CAAC,OAAO;UACT,IAAI,CAAC,QAAQ,CAAC,MAAM,KAAK,CAAC;YAC1B,CAAC,CAAC,IAAI,CAAA;;mBAEG;YACT,CAAC,CAAC,IAAI,CAAA,kDAAkD;UACxD,cAAc;YAChB,IAAI,CAAC,UAAU,CAAC,mBAAmB,KAAK,gBAAgB;YACtD,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAC1B,CAAC,CAAC,OAAO;;UAET,cAAc;YAChB,IAAI,CAAC,UAAU,CAAC,mBAAmB,KAAK,aAAa;YACnD,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAC1B,CAAC,CAAC,OAAO;;KAEd,CAAC;IACJ,CAAC;;AAjMsB,wBAAO,GAAG,UAAU,AAAb,CAAc;AAE9B,uBAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,AAAnB,CAAoB;eANrB,gBAAgB;AAiC3B;IADP,KAAK,EAAE;qDACoB;AAGpB;IADP,KAAK,CAAC,qBAAqB,CAAC,OAAO,CAAC;oDACM;AAY3C;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;gDAG7C;AAWD;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDAU7C;AAiBD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAG9B;AA6BS;IAHT,KAAK,CAAC,UAAU,CAAC;IACjB,KAAK,CAAC,cAAc,CAAC;IACrB,KAAK,CAAC,SAAS,CAAC;sDAGhB","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport { html, LitElement, nothing, type TemplateResult } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { addThemingController } from '../../theming/theming-controller.js';\nimport IgcButtonComponent from '../button/button.js';\nimport { chatContext } from '../common/context.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport IgcChatInputComponent from './chat-input.js';\nimport IgcChatMessageListComponent from './chat-message-list.js';\nimport { createChatState } from './chat-state.js';\nimport { styles } from './themes/chat.base.css.js';\nimport { styles as shared } from './themes/shared/chat.common.css.js';\nimport { all } from './themes/themes.js';\nimport type {\n IgcChatOptions,\n IgcMessage,\n IgcMessageAttachment,\n} from './types.js';\n\n/**\n * Defines the custom events dispatched by the `<igc-chat>` component.\n */\nexport interface IgcChatComponentEventMap {\n /**\n * Dispatched when a new chat message is created (sent).\n *\n * @event igcMessageCreated\n * @type {CustomEvent<IgcMessage>}\n * @detail The message that was created.\n */\n igcMessageCreated: CustomEvent<IgcMessage>;\n\n /**\n * Dispatched when a chat message attachment is clicked.\n *\n * @event igcAttachmentClick\n * @type {CustomEvent<IgcMessageAttachment>}\n * @detail The attachment that was clicked.\n */\n igcAttachmentClick: CustomEvent<IgcMessageAttachment>;\n\n /**\n * Dispatched when an attachment is changed (e.g., updated or removed).\n *\n * @event igcAttachmentChange\n * @type {CustomEvent<IgcMessageAttachment>}\n * @detail The attachment that was changed.\n */\n igcAttachmentChange: CustomEvent<IgcMessageAttachment>;\n\n /**\n * Dispatched during an attachment drag operation.\n *\n * @event igcAttachmentDrag\n * @type {CustomEvent<any>}\n * @detail The drag event payload.\n */\n igcAttachmentDrag: CustomEvent<any>;\n\n /**\n * Dispatched when an attachment is dropped (e.g., in a drag-and-drop operation).\n *\n * @event igcAttachmentDrop\n * @type {CustomEvent<any>}\n * @detail The drop event payload.\n */\n igcAttachmentDrop: CustomEvent<any>;\n\n /**\n * Dispatched when the typing status changes (e.g., user starts or stops typing).\n *\n * @event igcTypingChange\n * @type {CustomEvent<boolean>}\n * @detail `true` if typing started, `false` if stopped.\n */\n igcTypingChange: CustomEvent<boolean>;\n\n /**\n * Dispatched when the chat input field gains focus.\n *\n * @event igcInputFocus\n * @type {CustomEvent<any>}\n * @detail Focus event payload.\n */\n igcInputFocus: CustomEvent<any>;\n\n /**\n * Dispatched when the chat input field loses focus.\n *\n * @event igcInputBlur\n * @type {CustomEvent<any>}\n * @detail Blur event payload.\n */\n igcInputBlur: CustomEvent<any>;\n\n /**\n * Dispatched when the content of the chat input changes.\n *\n * @event igcInputChange\n * @type {CustomEvent<string>}\n * @detail The current text value of the input.\n */\n igcInputChange: CustomEvent<string>;\n}\n\n/**\n * A chat UI component for displaying messages, attachments, and input interaction.\n *\n * This component is part of the Ignite UI Web Components suite.\n *\n * @element igc-chat\n * @slot prefix - Slot for injecting content (e.g., avatar or icon) before the chat title.\n * @slot title - Slot for overriding the chat title content.\n * @slot actions - Slot for injecting header actions (e.g., buttons, menus).\n * @slot suggestions-header - Slot for rendering a custom header for the suggestions list.\n * @slot suggestions - Slot for rendering a custom list of quick reply suggestions.\n * @slot suggestions-actions - Slot for rendering additional actions.\n * @slot suggestion - Slot for rendering a single suggestion item.\n * @slot empty-state - Slot shown when there are no messages.\n *\n * @csspart header - Styles the header container.\n * @csspart prefix - Styles the element before the title (e.g., avatar).\n * @csspart title - Styles the chat header title.\n * @csspart suggestions - Styles the suggestion container.\n * @csspart suggestion - Styles each suggestion item.\n */\nexport default class IgcChatComponent extends EventEmitterMixin<\n IgcChatComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-chat';\n\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n /**\n * Registers the chat component and its child components.\n * Should be called once before using the component.\n *\n * @example\n * IgcChatComponent.register();\n */\n public static register() {\n registerComponent(\n IgcChatComponent,\n IgcChatInputComponent,\n IgcChatMessageListComponent,\n IgcButtonComponent\n );\n }\n\n private readonly _chatState = createChatState(this);\n\n private _context = new ContextProvider(this, {\n context: chatContext,\n initialValue: this._chatState,\n });\n\n @state()\n private _hasContent = false;\n\n @query(IgcChatInputComponent.tagName)\n private _chatInput!: IgcChatInputComponent;\n\n constructor() {\n super();\n addThemingController(this, all);\n }\n\n /**\n * The list of chat messages currently displayed.\n * Use this property to set or update the message history.\n */\n @property({ reflect: true, attribute: false })\n public set messages(value: IgcMessage[]) {\n this._chatState.messages = value;\n }\n\n public get messages(): IgcMessage[] {\n return this._chatState.messages;\n }\n\n /**\n * The chat message currently being composed but not yet sent.\n * Includes the draft text and any attachments.\n */\n @property({ reflect: true, attribute: false })\n public set draftMessage(value: {\n text: string;\n attachments?: IgcMessageAttachment[];\n }) {\n if (this._chatState) {\n this._chatState.inputValue = value.text;\n this._chatState.inputAttachments = value.attachments || [];\n this.requestUpdate();\n }\n }\n\n public get draftMessage(): {\n text: string;\n attachments?: IgcMessageAttachment[];\n } {\n return {\n text: this._chatState?.inputValue,\n attachments: this._chatState?.inputAttachments,\n };\n }\n\n /**\n * Controls the chat behavior and appearance through a configuration object.\n * Use this to toggle UI options, provide suggestions, templates, etc.\n */\n @property({ attribute: false })\n public set options(value: IgcChatOptions) {\n this._chatState.options = value;\n }\n\n public get options(): IgcChatOptions | undefined {\n return this._chatState.options;\n }\n\n /** Returns the default attachments element. */\n public get defaultAttachments(): TemplateResult {\n return this._chatInput.defaultAttachmentsArea;\n }\n\n /** Returns the default textarea element. */\n public get defaultTextArea(): TemplateResult {\n return this._chatInput.defaultTextArea;\n }\n\n /** Returns the default file upload button element. */\n public get defaultFileUploadButton(): TemplateResult {\n return this._chatInput.defaultFileUploadButton;\n }\n\n /** Returns the default send message button element. */\n public get defaultSendButton(): TemplateResult {\n return this._chatInput.defaultSendButton;\n }\n\n @watch('messages')\n @watch('draftMessage')\n @watch('options')\n protected contextChanged() {\n this._context.setValue(this._chatState, true);\n }\n\n private renderHeader() {\n return html` <div part=\"header\">\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot name=\"title\" part=\"title\"\n >${this._chatState.options?.headerText}</slot\n >\n <slot name=\"actions\" part=\"actions\"></slot>\n </div>`;\n }\n\n private renderSuggestions() {\n return html` <div\n part=\"suggestions-container\"\n role=\"list\"\n aria-label=\"Suggestions\"\n >\n <slot name=\"suggestions-header\" part=\"suggestions-header\"></slot>\n <slot name=\"suggestions\" part=\"suggestions\">\n ${this._chatState.options?.suggestions?.map(\n (suggestion) => html`\n <slot name=\"suggestion\" part=\"suggestion\" role=\"listitem\">\n <igc-chip\n @click=${() =>\n this._chatState?.handleSuggestionClick(suggestion)}\n >\n <span>${suggestion}</span>\n </igc-chip>\n </slot>\n `\n )}\n </slot>\n <slot name=\"suggestions-actions\" part=\"suggestions-actions\"></slot>\n </div>`;\n }\n\n protected override firstUpdated() {\n this._context.setValue(this._chatState, true);\n }\n\n protected override createRenderRoot(): HTMLElement | DocumentFragment {\n const root = super.createRenderRoot();\n root.addEventListener('slotchange', () => {\n this._hasContent =\n this._chatState?.hasSlotContent('prefix') ||\n this._chatState?.hasSlotContent('title') ||\n this._chatState?.hasSlotContent('actions');\n });\n return root;\n }\n\n protected override render() {\n const hasSuggestions =\n this._chatState.options?.suggestions &&\n this._chatState.options.suggestions.length > 0;\n return html`\n <div part=\"chat-container\">\n ${this._hasContent || this._chatState.options?.headerText\n ? this.renderHeader()\n : nothing}\n ${this.messages.length === 0\n ? html`<div part=\"empty-state\">\n <slot name=\"empty-state\"> </slot>\n </div>`\n : html`<igc-chat-message-list> </igc-chat-message-list>`}\n ${hasSuggestions &&\n this._chatState.suggestionsPosition === 'below-messages'\n ? this.renderSuggestions()\n : nothing}\n <igc-chat-input> </igc-chat-input>\n ${hasSuggestions &&\n this._chatState.suggestionsPosition === 'below-input'\n ? this.renderSuggestions()\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** The `<igc-chat>` custom element. */\n 'igc-chat': IgcChatComponent;\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"chat.js","sourceRoot":"","sources":["../../../src/components/chat/chat.ts"],"names":[],"mappings":";;;;;;AAA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;;;;;;;;;;;;UAeX,cAAc;YAChB,IAAI,CAAC,UAAU,CAAC,mBAAmB,KAAK,aAAa;YACnD,CAAC,CAAC,IAAI,CAAC,iBAAiB,EAAE;YAC1B,CAAC,CAAC,OAAO;;KAEd,CAAC;IACJ,CAAC;;AA7RsB,wBAAO,GAAG,UAAU,AAAb,CAAc;AAE9B,uBAAM,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,AAAnB,CAAoB;eANrB,gBAAgB;AAiDnC;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;gDAG9B;AAWD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;oDAU9B;AAiBD;IADC,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;+CAG9B;AAQM;IADN,QAAQ,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,CAAC;yDACkB;AAmCvC;IAHT,KAAK,CAAC,UAAU,CAAC;IACjB,KAAK,CAAC,cAAc,CAAC;IACrB,KAAK,CAAC,SAAS,CAAC;sDAGhB","sourcesContent":["import { ContextProvider } from '@lit/context';\nimport { html, LitElement, nothing } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { addThemingController } from '../../theming/theming-controller.js';\nimport IgcButtonComponent from '../button/button.js';\nimport { chatContext } from '../common/context.js';\nimport { addSlotController, setSlots } from '../common/controllers/slot.js';\nimport { watch } from '../common/decorators/watch.js';\nimport { registerComponent } from '../common/definitions/register.js';\nimport { IgcChatResourceStringEN } from '../common/i18n/chat.resources.js';\nimport type { Constructor } from '../common/mixins/constructor.js';\nimport { EventEmitterMixin } from '../common/mixins/event-emitter.js';\nimport IgcIconComponent from '../icon/icon.js';\nimport IgcListComponent from '../list/list.js';\nimport IgcListHeaderComponent from '../list/list-header.js';\nimport IgcListItemComponent from '../list/list-item.js';\nimport IgcChatInputComponent from './chat-input.js';\nimport IgcChatMessageListComponent from './chat-message-list.js';\nimport { createChatState } from './chat-state.js';\nimport { styles } from './themes/chat.base.css.js';\nimport { styles as shared } from './themes/shared/chat.common.css.js';\nimport { all } from './themes/themes.js';\nimport type {\n IgcChatOptions,\n IgcMessage,\n IgcMessageAttachment,\n} from './types.js';\n\n/**\n * Defines the custom events dispatched by the `<igc-chat>` component.\n */\nexport interface IgcChatComponentEventMap {\n /**\n * Dispatched when a new chat message is created (sent).\n *\n * @event igcMessageCreated\n * @type {CustomEvent<IgcMessage>}\n * @detail The message that was created.\n */\n igcMessageCreated: CustomEvent<IgcMessage>;\n\n /**\n * Dispatched when a new chat message is created (sent).\n *\n * @event igcMessageCreated\n * @type {CustomEvent<IgcMessage>}\n * @detail The message that was reacted to and the reaction.\n */\n igcMessageReact: CustomEvent<{ message: IgcMessage; reaction: string }>;\n\n /**\n * Dispatched when a chat message attachment is clicked.\n *\n * @event igcAttachmentClick\n * @type {CustomEvent<IgcMessageAttachment>}\n * @detail The attachment that was clicked.\n */\n igcAttachmentClick: CustomEvent<IgcMessageAttachment>;\n\n /**\n * Dispatched when an attachment is changed (e.g., updated or removed).\n *\n * @event igcAttachmentChange\n * @type {CustomEvent<IgcMessageAttachment>}\n * @detail The attachment that was changed.\n */\n igcAttachmentChange: CustomEvent<IgcMessageAttachment>;\n\n /**\n * Dispatched during an attachment drag operation.\n *\n * @event igcAttachmentDrag\n * @type {CustomEvent<any>}\n * @detail The drag event payload.\n */\n igcAttachmentDrag: CustomEvent<any>;\n\n /**\n * Dispatched when an attachment is dropped (e.g., in a drag-and-drop operation).\n *\n * @event igcAttachmentDrop\n * @type {CustomEvent<any>}\n * @detail The drop event payload.\n */\n igcAttachmentDrop: CustomEvent<any>;\n\n /**\n * Dispatched when the typing status changes (e.g., user starts or stops typing).\n *\n * @event igcTypingChange\n * @type {CustomEvent<boolean>}\n * @detail `true` if typing started, `false` if stopped.\n */\n igcTypingChange: CustomEvent<boolean>;\n\n /**\n * Dispatched when the chat input field gains focus.\n *\n * @event igcInputFocus\n * @type {CustomEvent<any>}\n * @detail Focus event payload.\n */\n igcInputFocus: CustomEvent<any>;\n\n /**\n * Dispatched when the chat input field loses focus.\n *\n * @event igcInputBlur\n * @type {CustomEvent<any>}\n * @detail Blur event payload.\n */\n igcInputBlur: CustomEvent<any>;\n\n /**\n * Dispatched when the content of the chat input changes.\n *\n * @event igcInputChange\n * @type {CustomEvent<string>}\n * @detail The current text value of the input.\n */\n igcInputChange: CustomEvent<string>;\n}\n\nconst Slots = setSlots(\n 'prefix',\n 'title',\n 'actions',\n 'suggestions-header',\n 'suggestions',\n 'suggestions-actions',\n 'suggestions-header',\n 'suggestion',\n 'empty-state'\n);\n\n/**\n * A chat UI component for displaying messages, attachments, and input interaction.\n *\n * This component is part of the Ignite UI Web Components suite.\n *\n * @element igc-chat\n * @slot prefix - Slot for injecting content (e.g., avatar or icon) before the chat title.\n * @slot title - Slot for overriding the chat title content.\n * @slot actions - Slot for injecting header actions (e.g., buttons, menus).\n * @slot suggestions-header - Slot for rendering a custom header for the suggestions list.\n * @slot suggestions - Slot for rendering a custom list of quick reply suggestions.\n * @slot suggestions-actions - Slot for rendering additional actions.\n * @slot suggestion - Slot for rendering a single suggestion item.\n * @slot empty-state - Slot shown when there are no messages.\n *\n * @csspart header - Styles the header container.\n * @csspart prefix - Styles the element before the title (e.g., avatar).\n * @csspart title - Styles the chat header title.\n * @csspart suggestions - Styles the suggestion container.\n * @csspart suggestion - Styles each suggestion item.\n */\nexport default class IgcChatComponent extends EventEmitterMixin<\n IgcChatComponentEventMap,\n Constructor<LitElement>\n>(LitElement) {\n public static readonly tagName = 'igc-chat';\n\n public static styles = [styles, shared];\n\n /* blazorSuppress */\n /**\n * Registers the chat component and its child components.\n * Should be called once before using the component.\n *\n * @example\n * IgcChatComponent.register();\n */\n public static register() {\n registerComponent(\n IgcChatComponent,\n IgcChatInputComponent,\n IgcChatMessageListComponent,\n IgcButtonComponent,\n IgcIconComponent,\n IgcListComponent,\n IgcListItemComponent,\n IgcListHeaderComponent\n );\n }\n\n private readonly _chatState = createChatState(this);\n\n private readonly _slots = addSlotController(this, {\n slots: Slots,\n });\n\n private _context = new ContextProvider(this, {\n context: chatContext,\n initialValue: this._chatState,\n });\n constructor() {\n super();\n addThemingController(this, all);\n }\n\n /**\n * The list of chat messages currently displayed.\n * Use this property to set or update the message history.\n */\n @property({ attribute: false })\n public set messages(value: IgcMessage[]) {\n this._chatState.messages = value;\n }\n\n public get messages(): IgcMessage[] {\n return this._chatState.messages;\n }\n\n /**\n * The chat message currently being composed but not yet sent.\n * Includes the draft text and any attachments.\n */\n @property({ attribute: false })\n public set draftMessage(value: {\n text: string;\n attachments?: IgcMessageAttachment[];\n }) {\n if (this._chatState && value) {\n this._chatState.inputValue = value.text;\n this._chatState.inputAttachments = value.attachments || [];\n this.requestUpdate();\n }\n }\n\n public get draftMessage(): {\n text: string;\n attachments?: IgcMessageAttachment[];\n } {\n return {\n text: this._chatState?.inputValue,\n attachments: this._chatState?.inputAttachments,\n };\n }\n\n /**\n * Controls the chat behavior and appearance through a configuration object.\n * Use this to toggle UI options, provide suggestions, templates, etc.\n */\n @property({ attribute: false })\n public set options(value: IgcChatOptions) {\n this._chatState.options = value;\n }\n\n public get options(): IgcChatOptions | undefined {\n return this._chatState.options;\n }\n\n /** The resource strings. */\n @property({ attribute: false })\n public resourceStrings = IgcChatResourceStringEN;\n\n /**\n * Scrolls the view to a specific message by id.\n * @param messageId - The id of the message to scroll to\n */\n public scrollToMessage(messageId: string) {\n // Find the message list component\n const messageListComponent = this.shadowRoot?.querySelector(\n 'igc-chat-message-list'\n );\n if (!messageListComponent) {\n return;\n }\n\n // Look for the message element inside the message list's shadow DOM\n const messageElement = messageListComponent.shadowRoot?.querySelector(\n `#message-${messageId}`\n );\n\n if (!messageElement) {\n return;\n }\n\n // Scroll the message into view with smooth behavior\n messageElement.scrollIntoView({\n behavior: 'smooth',\n block: 'center',\n inline: 'nearest',\n });\n }\n\n @watch('messages')\n @watch('draftMessage')\n @watch('options')\n protected contextChanged() {\n this._context.setValue(this._chatState, true);\n }\n\n private renderHeader() {\n const hasContent =\n this._slots.hasAssignedElements('prefix') ||\n this._slots.hasAssignedElements('title') ||\n this._slots.hasAssignedElements('actions');\n return html` <div part=\"header\" ?hidden=${!hasContent}>\n <slot name=\"prefix\" part=\"prefix\"></slot>\n <slot name=\"title\" part=\"title\"\n >${this._chatState.options?.headerText}</slot\n >\n <slot name=\"actions\" part=\"actions\"></slot>\n </div>`;\n }\n\n private renderSuggestionPrefix() {\n const defaultPrefix = html`<igc-icon\n name=\"star-icon\"\n collection=\"material\"\n ></igc-icon>`;\n return html`<span slot=\"start\">\n ${this._chatState?.options?.templates?.suggestionPrefixTemplate\n ? this._chatState.options.templates.suggestionPrefixTemplate\n : defaultPrefix}\n </span>`;\n }\n\n private renderSuggestions() {\n const hasContent = this._slots.hasAssignedElements('suggestions-header');\n return html`<div part=\"suggestions-container\">\n <igc-list role=\"list\" aria-label=\"Suggestions\">\n <igc-list-header part=\"suggestions-header\">\n <span ?hidden=${hasContent}>\n ${this.resourceStrings.suggestionsHeader}\n </span>\n <slot name=\"suggestions-header\"></slot>\n </igc-list-header>\n <slot name=\"suggestions\" part=\"suggestions\">\n ${this._chatState.options?.suggestions?.map(\n (suggestion) => html`\n <slot name=\"suggestion\" part=\"suggestion\" role=\"listitem\">\n <igc-list-item\n @click=${() =>\n this._chatState?.handleSuggestionClick(suggestion)}\n >\n ${this.renderSuggestionPrefix()}\n <span slot=\"title\">${suggestion}</span>\n </igc-list-item>\n </slot>\n `\n )}\n </slot>\n <slot name=\"suggestions-actions\" part=\"suggestions-actions\"></slot>\n </igc-list>\n </div>`;\n }\n\n /**\n * Updates the context value to notify all consumers that the chat state has changed.\n * This ensures that components consuming the chat context will re-render.\n */\n public updateContextValue() {\n this._context.setValue(this._chatState, true);\n }\n\n protected override render() {\n const hasSuggestions =\n this._chatState.options?.suggestions &&\n this._chatState.options.suggestions.length > 0;\n return html`\n <div\n part=\"chat-container\"\n exportparts=\"\n chat-container,\n header,\n prefix,\n title,\n actions,\n chat-wrapper,\n chat-messages,\n empty-state,\n suggestions-container,\n suggestions-header,\n suggestions,\n suggestions-actions,\n suggestion,\n message-container,\n message-list,\n message-item,\n message,\n message-text,\n message-attachments,\n message-actions,\n typing-indicator,\n attachments-container,\n attachment,\n attachment-header,\n attachment-content,\n attachment-icon,\n file-name,\n attachment-actions\n \"\n >\n ${this.renderHeader()}\n <div part=\"chat-wrapper\">\n ${this.messages.length === 0\n ? html`<div part=\"empty-state\">\n <slot name=\"empty-state\"> </slot>\n </div>`\n : html` <igc-chat-message-list\n part=\"chat-messages\"\n exportparts=\"\n message-container,\n message-list,\n message-item,\n message,\n message-text,\n message-attachments,\n message-actions,\n typing-indicator,\n attachments-container,\n attachment,\n attachment-header,\n attachment-content,\n attachment-icon,\n file-name,\n actions: attachment-actions\"\n >\n </igc-chat-message-list>`}\n ${hasSuggestions &&\n this._chatState.suggestionsPosition === 'below-messages'\n ? this.renderSuggestions()\n : nothing}\n </div>\n <igc-chat-input\n exportparts=\"\n input-container,\n input-wrapper,\n attachments: input-attachments-container,\n attachments-wrapper: input-attachment,\n attachment-name: input-attachment-name,\n text-input,\n buttons-container: input-buttons-container,\n upload-button,\n send-button\"\n >\n </igc-chat-input>\n ${hasSuggestions &&\n this._chatState.suggestionsPosition === 'below-input'\n ? this.renderSuggestions()\n : nothing}\n </div>\n `;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n /** The `<igc-chat>` custom element. */\n 'igc-chat': IgcChatComponent;\n }\n}\n"]}
|