@carbon/ai-chat-components 1.14.0 → 1.15.0-rc.0
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/custom-elements.json +8737 -8823
- package/es/components/audio-player/src/transcript.js +1 -1
- package/es/components/carousel/src/carousel.d.ts +1 -1
- package/es/components/carousel/src/carousel.js +1 -1
- package/es/components/carousel/src/carousel.js.map +1 -1
- package/es/components/chat-history/src/history-panel-item.d.ts +8 -0
- package/es/components/chat-history/src/history-panel-item.js +44 -1
- package/es/components/chat-history/src/history-panel-item.js.map +1 -1
- package/es/components/code-snippet/src/code-snippet.d.ts +4 -0
- package/es/components/code-snippet/src/code-snippet.js +12 -0
- package/es/components/code-snippet/src/code-snippet.js.map +1 -1
- package/es/components/feedback/src/feedback.js +1 -1
- package/es/components/file-uploads/src/file-upload-item.d.ts +16 -17
- package/es/components/file-uploads/src/file-upload-item.js +98 -58
- package/es/components/file-uploads/src/file-upload-item.js.map +1 -1
- package/es/components/file-uploads/src/file-upload-item.scss.js +1 -1
- package/es/components/file-uploads/src/file-uploads.d.ts +20 -0
- package/es/components/file-uploads/src/file-uploads.js +55 -1
- package/es/components/file-uploads/src/file-uploads.js.map +1 -1
- package/es/components/file-uploads/src/file-uploads.scss.js +1 -1
- package/es/components/markdown/index.js +1 -2
- package/es/components/markdown/index.js.map +1 -1
- package/es/components/markdown/src/inline-markdown.d.ts +2 -2
- package/es/components/markdown/src/inline-markdown.js +8 -2
- package/es/components/markdown/src/inline-markdown.js.map +1 -1
- package/es/components/markdown/src/inline-markdown.scss.js +2 -2
- package/es/components/markdown/src/markdown-renderer-types.d.ts +2 -0
- package/es/components/markdown/src/markdown-renderer.js +3 -1
- package/es/components/markdown/src/markdown-renderer.js.map +1 -1
- package/es/components/markdown/src/markdown.d.ts +4 -0
- package/es/components/markdown/src/markdown.js +14 -0
- package/es/components/markdown/src/markdown.js.map +1 -1
- package/es/components/markdown/src/utils/inline-run-projection.js +3 -17
- package/es/components/markdown/src/utils/inline-run-projection.js.map +1 -1
- package/es/components/message-item-shell/index.d.ts +11 -0
- package/es/components/message-item-shell/index.js +9 -0
- package/es/components/message-item-shell/index.js.map +1 -0
- package/es/components/message-item-shell/src/message-item-shell.d.ts +48 -0
- package/es/components/message-item-shell/src/message-item-shell.js +91 -0
- package/es/components/message-item-shell/src/message-item-shell.js.map +1 -0
- package/es/components/message-item-shell/src/message-item-shell.scss.js +13 -0
- package/es/components/message-item-shell/src/message-item-shell.scss.js.map +1 -0
- package/es/components/prompt-line/src/prompt-line-controller.d.ts +1 -1
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js +19 -2
- package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
- package/es/components/prompt-line/src/prompt-line-textarea-runtime.js +9 -4
- package/es/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line.d.ts +17 -7
- package/es/components/prompt-line/src/prompt-line.js +39 -0
- package/es/components/prompt-line/src/prompt-line.js.map +1 -1
- package/es/components/prompt-line/src/prompt-line.scss.js +1 -1
- package/es/components/prompt-line/src/tiptap/chat-enter.d.ts +2 -2
- package/es/components/prompt-line/src/tiptap/chat-enter.js +2 -2
- package/es/components/prompt-line/src/tiptap/chat-enter.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/editor-styles.js +1 -1
- package/es/components/prompt-line/src/tiptap/editor-styles.js.map +1 -1
- package/es/components/prompt-line/src/tiptap/types.d.ts +3 -4
- package/es/components/shared/root-styles.d.ts +30 -0
- package/es/components/shared/root-styles.js +72 -0
- package/es/components/shared/root-styles.js.map +1 -0
- package/es/components/toolbar/src/toolbar.d.ts +14 -4
- package/es/components/toolbar/src/toolbar.js +29 -6
- package/es/components/toolbar/src/toolbar.js.map +1 -1
- package/es/components/user-avatar/index.d.ts +10 -0
- package/es/components/user-avatar/index.js +9 -0
- package/es/components/user-avatar/index.js.map +1 -0
- package/es/components/user-avatar/src/user-avatar.d.ts +46 -0
- package/es/components/user-avatar/src/user-avatar.js +153 -0
- package/es/components/user-avatar/src/user-avatar.js.map +1 -0
- package/es/components/user-avatar/src/user-avatar.scss.js +13 -0
- package/es/components/user-avatar/src/user-avatar.scss.js.map +1 -0
- package/es/globals/utils/iconTransform.js +1 -0
- package/es/globals/utils/iconTransform.js.map +1 -1
- package/es/react/chat-header.js +4 -2
- package/es/react/chat-header.js.map +1 -1
- package/es/react/code-snippet.d.ts +4 -1
- package/es/react/code-snippet.js +3 -1
- package/es/react/code-snippet.js.map +1 -1
- package/es/react/message-item-shell.d.ts +3 -0
- package/es/react/message-item-shell.js +30 -0
- package/es/react/message-item-shell.js.map +1 -0
- package/es/react/toolbar.d.ts +1 -1
- package/es/react/toolbar.js +3 -1
- package/es/react/toolbar.js.map +1 -1
- package/es/react/user-avatar.d.ts +3 -0
- package/es/react/user-avatar.js +29 -0
- package/es/react/user-avatar.js.map +1 -0
- package/es-custom/components/audio-player/src/transcript.js +1 -1
- package/es-custom/components/carousel/src/carousel.d.ts +1 -1
- package/es-custom/components/carousel/src/carousel.js +1 -1
- package/es-custom/components/carousel/src/carousel.js.map +1 -1
- package/es-custom/components/chat-history/src/history-panel-item.d.ts +8 -0
- package/es-custom/components/chat-history/src/history-panel-item.js +44 -1
- package/es-custom/components/chat-history/src/history-panel-item.js.map +1 -1
- package/es-custom/components/code-snippet/src/code-snippet.d.ts +4 -0
- package/es-custom/components/code-snippet/src/code-snippet.js +12 -0
- package/es-custom/components/code-snippet/src/code-snippet.js.map +1 -1
- package/es-custom/components/feedback/src/feedback.js +1 -1
- package/es-custom/components/file-uploads/src/file-upload-item.d.ts +16 -17
- package/es-custom/components/file-uploads/src/file-upload-item.js +98 -58
- package/es-custom/components/file-uploads/src/file-upload-item.js.map +1 -1
- package/es-custom/components/file-uploads/src/file-upload-item.scss.js +1 -1
- package/es-custom/components/file-uploads/src/file-uploads.d.ts +20 -0
- package/es-custom/components/file-uploads/src/file-uploads.js +55 -1
- package/es-custom/components/file-uploads/src/file-uploads.js.map +1 -1
- package/es-custom/components/file-uploads/src/file-uploads.scss.js +1 -1
- package/es-custom/components/markdown/index.js +1 -2
- package/es-custom/components/markdown/index.js.map +1 -1
- package/es-custom/components/markdown/src/inline-markdown.d.ts +2 -2
- package/es-custom/components/markdown/src/inline-markdown.js +8 -2
- package/es-custom/components/markdown/src/inline-markdown.js.map +1 -1
- package/es-custom/components/markdown/src/inline-markdown.scss.js +2 -2
- package/es-custom/components/markdown/src/markdown-renderer-types.d.ts +2 -0
- package/es-custom/components/markdown/src/markdown-renderer.js +3 -1
- package/es-custom/components/markdown/src/markdown-renderer.js.map +1 -1
- package/es-custom/components/markdown/src/markdown.d.ts +4 -0
- package/es-custom/components/markdown/src/markdown.js +14 -0
- package/es-custom/components/markdown/src/markdown.js.map +1 -1
- package/es-custom/components/markdown/src/utils/inline-run-projection.js +3 -17
- package/es-custom/components/markdown/src/utils/inline-run-projection.js.map +1 -1
- package/es-custom/components/message-item-shell/index.d.ts +11 -0
- package/es-custom/components/message-item-shell/index.js +9 -0
- package/es-custom/components/message-item-shell/index.js.map +1 -0
- package/es-custom/components/message-item-shell/src/message-item-shell.d.ts +48 -0
- package/es-custom/components/message-item-shell/src/message-item-shell.js +91 -0
- package/es-custom/components/message-item-shell/src/message-item-shell.js.map +1 -0
- package/es-custom/components/message-item-shell/src/message-item-shell.scss.js +13 -0
- package/es-custom/components/message-item-shell/src/message-item-shell.scss.js.map +1 -0
- package/es-custom/components/prompt-line/src/prompt-line-controller.d.ts +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +19 -2
- package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
- package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js +9 -4
- package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line.d.ts +17 -7
- package/es-custom/components/prompt-line/src/prompt-line.js +39 -0
- package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
- package/es-custom/components/prompt-line/src/prompt-line.scss.js +1 -1
- package/es-custom/components/prompt-line/src/tiptap/chat-enter.d.ts +2 -2
- package/es-custom/components/prompt-line/src/tiptap/chat-enter.js +2 -2
- package/es-custom/components/prompt-line/src/tiptap/chat-enter.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.js +1 -1
- package/es-custom/components/prompt-line/src/tiptap/editor-styles.js.map +1 -1
- package/es-custom/components/prompt-line/src/tiptap/types.d.ts +3 -4
- package/es-custom/components/shared/root-styles.d.ts +30 -0
- package/es-custom/components/shared/root-styles.js +72 -0
- package/es-custom/components/shared/root-styles.js.map +1 -0
- package/es-custom/components/toolbar/src/toolbar.d.ts +14 -4
- package/es-custom/components/toolbar/src/toolbar.js +29 -6
- package/es-custom/components/toolbar/src/toolbar.js.map +1 -1
- package/es-custom/components/user-avatar/index.d.ts +10 -0
- package/es-custom/components/user-avatar/index.js +9 -0
- package/es-custom/components/user-avatar/index.js.map +1 -0
- package/es-custom/components/user-avatar/src/user-avatar.d.ts +46 -0
- package/es-custom/components/user-avatar/src/user-avatar.js +153 -0
- package/es-custom/components/user-avatar/src/user-avatar.js.map +1 -0
- package/es-custom/components/user-avatar/src/user-avatar.scss.js +13 -0
- package/es-custom/components/user-avatar/src/user-avatar.scss.js.map +1 -0
- package/es-custom/globals/utils/iconTransform.js +1 -0
- package/es-custom/globals/utils/iconTransform.js.map +1 -1
- package/es-custom/react/chat-header.js +4 -2
- package/es-custom/react/chat-header.js.map +1 -1
- package/es-custom/react/code-snippet.d.ts +4 -1
- package/es-custom/react/code-snippet.js +3 -1
- package/es-custom/react/code-snippet.js.map +1 -1
- package/es-custom/react/message-item-shell.d.ts +3 -0
- package/es-custom/react/message-item-shell.js +30 -0
- package/es-custom/react/message-item-shell.js.map +1 -0
- package/es-custom/react/toolbar.d.ts +1 -1
- package/es-custom/react/toolbar.js +3 -1
- package/es-custom/react/toolbar.js.map +1 -1
- package/es-custom/react/user-avatar.d.ts +3 -0
- package/es-custom/react/user-avatar.js +29 -0
- package/es-custom/react/user-avatar.js.map +1 -0
- package/package.json +8 -6
- package/telemetry.yml +16 -0
|
@@ -18,6 +18,7 @@ import ChevronUp16 from '@carbon/icons/es/chevron--up/16.js';
|
|
|
18
18
|
import '../../markdown/src/markdown.js';
|
|
19
19
|
import 'markdown-it';
|
|
20
20
|
import 'lit/directives/unsafe-html.js';
|
|
21
|
+
import '../../markdown/src/inline-markdown.scss.js';
|
|
21
22
|
import 'dompurify';
|
|
22
23
|
import '../../markdown/src/utils/inline-validation.js';
|
|
23
24
|
import 'lit/directives/repeat.js';
|
|
@@ -31,7 +32,6 @@ import '../../card/src/card-steps.js';
|
|
|
31
32
|
import '../../table/src/table.js';
|
|
32
33
|
import '../../markdown/src/utils/inline-run-projection.js';
|
|
33
34
|
import '../../markdown/src/utils/lit-directives.js';
|
|
34
|
-
import '../../markdown/src/inline-markdown.scss.js';
|
|
35
35
|
|
|
36
36
|
/**
|
|
37
37
|
* @license
|
|
@@ -13,7 +13,7 @@ import '@carbon/web-components/es/components/icon-button/icon-button.js';
|
|
|
13
13
|
*
|
|
14
14
|
* @element cds-aichat-carousel
|
|
15
15
|
* @fires cds-aichat-carousel-onchange custom event for when the carousel changes
|
|
16
|
-
* @slot
|
|
16
|
+
* @slot - Carousel views.
|
|
17
17
|
*/
|
|
18
18
|
declare class CDSAICarousel extends LitElement {
|
|
19
19
|
/**
|
|
@@ -31,7 +31,7 @@ const blockClass = `${prefix}-carousel`;
|
|
|
31
31
|
*
|
|
32
32
|
* @element cds-aichat-carousel
|
|
33
33
|
* @fires cds-aichat-carousel-onchange custom event for when the carousel changes
|
|
34
|
-
* @slot
|
|
34
|
+
* @slot - Carousel views.
|
|
35
35
|
*/
|
|
36
36
|
let CDSAICarousel = class CDSAICarousel extends LitElement {
|
|
37
37
|
constructor() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"carousel.js","sources":["../../../../src/components/carousel/src/carousel.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html } from 'lit';\nimport styles from './carousel.scss?lit';\nimport { carbonElement } from '../../../globals/decorators/index.js';\nimport prefix from '../../../globals/settings.js';\nimport {\n initCarousel,\n InitCarousel,\n Config,\n CarouselResponse,\n} from '@carbon/utilities';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport { property, state } from 'lit/decorators.js';\nimport '@carbon/web-components/es/components/icon-button/icon-button.js';\nimport { iconLoader } from '@carbon/web-components/es/globals/internal/icon-loader.js';\nimport { ChevronLeft16, ChevronRight16 } from '@carbon/icons';\n\nconst blockClass = `${prefix}-carousel`;\n\n/**\n * Carousel component\n *\n * @element cds-aichat-carousel\n * @fires cds-aichat-carousel-onchange custom event for when the carousel changes\n * @slot
|
|
1
|
+
{"version":3,"file":"carousel.js","sources":["../../../../src/components/carousel/src/carousel.ts"],"sourcesContent":["/**\n * @license\n *\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { LitElement, html } from 'lit';\nimport styles from './carousel.scss?lit';\nimport { carbonElement } from '../../../globals/decorators/index.js';\nimport prefix from '../../../globals/settings.js';\nimport {\n initCarousel,\n InitCarousel,\n Config,\n CarouselResponse,\n} from '@carbon/utilities';\nimport { queryAssignedElements } from 'lit/decorators/query-assigned-elements.js';\nimport { property, state } from 'lit/decorators.js';\nimport '@carbon/web-components/es/components/icon-button/icon-button.js';\nimport { iconLoader } from '@carbon/web-components/es/globals/internal/icon-loader.js';\nimport { ChevronLeft16, ChevronRight16 } from '@carbon/icons';\n\nconst blockClass = `${prefix}-carousel`;\n\n/**\n * Carousel component\n *\n * @element cds-aichat-carousel\n * @fires cds-aichat-carousel-onchange custom event for when the carousel changes\n * @slot - Carousel views.\n */\n@carbonElement(blockClass)\nclass CDSAICarousel extends LitElement {\n /**\n * Text for the next button\n */\n @property({ type: String })\n nextBtnText?: string;\n\n /**\n * Text for the previous button\n */\n @property({ type: String })\n previousBtnText?: string;\n\n @queryAssignedElements({ flatten: true })\n private container?: Array<HTMLElement>;\n\n private carousel?: InitCarousel;\n\n @state()\n private _currentIndex = 0;\n\n @state()\n private _lastIndex = 0;\n\n private _handlePrev() {\n this.carousel?.prev();\n }\n\n private _handleNext() {\n this.carousel?.next();\n }\n\n private _dispatchChange(data: CarouselResponse) {\n const init = {\n detail: data,\n bubbles: true,\n composed: true,\n };\n this.dispatchEvent(\n new CustomEvent(\n (this.constructor as typeof CDSAICarousel).eventOnChange,\n init\n )\n );\n }\n\n async firstUpdated() {\n if (this.container) {\n // temp solution to account for image load time\n await new Promise<void>((resolve) => setTimeout(() => resolve(), 100));\n const config: Config = {\n onViewChangeEnd: (endData) => {\n this._currentIndex = endData.currentIndex;\n this._dispatchChange(endData);\n },\n };\n this.carousel = initCarousel(this.container[0], config);\n this._lastIndex = Object.keys(this.carousel.allViews).length - 1;\n }\n }\n\n render() {\n return html`\n <div class=${blockClass}>\n <slot></slot>\n <div class=\"${blockClass}__controls\">\n <cds-icon-button\n class=\"${blockClass}__previous-btn\"\n @click=${this._handlePrev}\n kind=\"ghost\"\n size=\"sm\"\n align=\"bottom-start\"\n enter-delay-ms=\"0\"\n leave-delay-ms=\"0\">\n ${iconLoader(ChevronLeft16, { slot: 'icon' })}\n <span slot=\"tooltip-content\">${this.previousBtnText}</span>\n </cds-icon-button>\n <span class=\"${blockClass}__indicator\"\n >${this._currentIndex + 1} / ${this._lastIndex + 1}</span\n >\n <cds-icon-button\n class=\"${blockClass}__next-btn\"\n @click=${this._handleNext}\n kind=\"ghost\"\n size=\"sm\"\n align=\"bottom-start\"\n enter-delay-ms=\"0\"\n leave-delay-ms=\"0\">\n ${iconLoader(ChevronRight16, { slot: 'icon' })}\n <span slot=\"tooltip-content\">${this.nextBtnText}</span>\n </cds-icon-button>\n </div>\n </div>\n `;\n }\n\n static get eventOnChange() {\n return `${blockClass}-onchange`;\n }\n\n static styles = styles;\n}\n\nexport default CDSAICarousel;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAkBH,MAAM,UAAU,GAAG,CAAA,EAAG,MAAM,WAAW;AAEvC;;;;;;AAMG;AAEH,IAAM,aAAa,GAAnB,MAAM,aAAc,SAAQ,UAAU,CAAA;AAAtC,IAAA,WAAA,GAAA;;QAmBU,IAAA,CAAA,aAAa,GAAG,CAAC;QAGjB,IAAA,CAAA,UAAU,GAAG,CAAC;IA+ExB;IA7EU,WAAW,GAAA;AACjB,QAAA,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE;IACvB;IAEQ,WAAW,GAAA;AACjB,QAAA,IAAI,CAAC,QAAQ,EAAE,IAAI,EAAE;IACvB;AAEQ,IAAA,eAAe,CAAC,IAAsB,EAAA;AAC5C,QAAA,MAAM,IAAI,GAAG;AACX,YAAA,MAAM,EAAE,IAAI;AACZ,YAAA,OAAO,EAAE,IAAI;AACb,YAAA,QAAQ,EAAE,IAAI;SACf;AACD,QAAA,IAAI,CAAC,aAAa,CAChB,IAAI,WAAW,CACZ,IAAI,CAAC,WAAoC,CAAC,aAAa,EACxD,IAAI,CACL,CACF;IACH;AAEA,IAAA,MAAM,YAAY,GAAA;AAChB,QAAA,IAAI,IAAI,CAAC,SAAS,EAAE;;AAElB,YAAA,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,KAAK,UAAU,CAAC,MAAM,OAAO,EAAE,EAAE,GAAG,CAAC,CAAC;AACtE,YAAA,MAAM,MAAM,GAAW;AACrB,gBAAA,eAAe,EAAE,CAAC,OAAO,KAAI;AAC3B,oBAAA,IAAI,CAAC,aAAa,GAAG,OAAO,CAAC,YAAY;AACzC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AA,MAAA,CAAA;AAGjB,UAAA,CAAA;AADP,IAAA,qBAAqB,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AACD,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAK/B,UAAA,CAAA;AADP,IAAA,KAAK;AACoB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,eAAA,EAAA,MAAA,CAAA;AAGlB,UAAA,CAAA;AADP,IAAA,KAAK;AACiB,CAAA,EAAA,aAAA,CAAA,SAAA,EAAA,YAAA,EAAA,MAAA,CAAA;AAtBnB,aAAa,GAAA,UAAA,CAAA;IADlB,aAAa,CAAC,UAAU;AACnB,CAAA,EAAA,aAAa,CAqGlB;AAED,sBAAe,aAAa;;"}
|
|
@@ -7,6 +7,10 @@ export interface Action {
|
|
|
7
7
|
text: string;
|
|
8
8
|
delete?: boolean;
|
|
9
9
|
divider?: boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Prevents activation while keeping the action visible. Defaults to false.
|
|
12
|
+
*/
|
|
13
|
+
disabled?: boolean;
|
|
10
14
|
icon: CarbonIcon;
|
|
11
15
|
onClick: () => void;
|
|
12
16
|
}
|
|
@@ -123,6 +127,10 @@ declare class CDSAIChatHistoryPanelItem extends CDSAIChatHistoryPanelItem_base {
|
|
|
123
127
|
* Handle menu item clicks
|
|
124
128
|
*/
|
|
125
129
|
private _handleMenuItemClick;
|
|
130
|
+
/**
|
|
131
|
+
* Restore focus before rendering a disabled button can drop it to the body.
|
|
132
|
+
*/
|
|
133
|
+
willUpdate(changedProperties: Map<string, any>): void;
|
|
126
134
|
/**
|
|
127
135
|
* Handler for menu item keydown event
|
|
128
136
|
*
|
|
@@ -93,12 +93,23 @@ let CDSAIChatHistoryPanelItem = class CDSAIChatHistoryPanelItem extends HostList
|
|
|
93
93
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
94
94
|
this._adjustMenuPosition();
|
|
95
95
|
}
|
|
96
|
+
const menu = event.currentTarget;
|
|
97
|
+
if (event.key === 'Escape' && menu.open) {
|
|
98
|
+
event.preventDefault();
|
|
99
|
+
event.stopPropagation();
|
|
100
|
+
menu.open = false;
|
|
101
|
+
}
|
|
96
102
|
};
|
|
97
103
|
/**
|
|
98
104
|
* Handle menu item clicks
|
|
99
105
|
*/
|
|
100
106
|
this._handleMenuItemClick = (event) => {
|
|
101
107
|
const target = event.currentTarget;
|
|
108
|
+
if (target.hasAttribute('disabled')) {
|
|
109
|
+
event.preventDefault();
|
|
110
|
+
event.stopPropagation();
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
102
113
|
const menuItemText = target.getAttribute('data-action-text') || target.textContent?.trim();
|
|
103
114
|
// Dispatch a custom event with item details
|
|
104
115
|
const itemActionEvent = new CustomEvent('history-item-menu-action', {
|
|
@@ -112,6 +123,7 @@ let CDSAIChatHistoryPanelItem = class CDSAIChatHistoryPanelItem extends HostList
|
|
|
112
123
|
},
|
|
113
124
|
});
|
|
114
125
|
this.dispatchEvent(itemActionEvent);
|
|
126
|
+
return true;
|
|
115
127
|
};
|
|
116
128
|
/**
|
|
117
129
|
* Handler for menu item keydown event
|
|
@@ -121,7 +133,9 @@ let CDSAIChatHistoryPanelItem = class CDSAIChatHistoryPanelItem extends HostList
|
|
|
121
133
|
this._handleMenuItemKeyDown = (event) => {
|
|
122
134
|
if (event.key === 'Enter' || event.key === ' ') {
|
|
123
135
|
event.preventDefault();
|
|
124
|
-
this._handleMenuItemClick(event)
|
|
136
|
+
if (!this._handleMenuItemClick(event)) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
125
139
|
// Close the overflow menu after handling the action
|
|
126
140
|
if (this.overflowMenu) {
|
|
127
141
|
this.overflowMenu.open = false;
|
|
@@ -216,6 +230,33 @@ let CDSAIChatHistoryPanelItem = class CDSAIChatHistoryPanelItem extends HostList
|
|
|
216
230
|
overflowMenuBody.classList.toggle(this._overflowMenuBodyFlippedClass, flipUp);
|
|
217
231
|
this._adoptOverflowMenuBodyStylesAfterPortal(overflowMenuBody);
|
|
218
232
|
}
|
|
233
|
+
/**
|
|
234
|
+
* Restore focus before rendering a disabled button can drop it to the body.
|
|
235
|
+
*/
|
|
236
|
+
willUpdate(changedProperties) {
|
|
237
|
+
super.willUpdate(changedProperties);
|
|
238
|
+
const menu = this.overflowMenu;
|
|
239
|
+
if (!changedProperties.has('actions') || !menu?.open) {
|
|
240
|
+
return;
|
|
241
|
+
}
|
|
242
|
+
// Carbon portals the menu body out of this shadow root, so follow focus.
|
|
243
|
+
let focused = this.ownerDocument.activeElement;
|
|
244
|
+
while (focused?.shadowRoot?.activeElement &&
|
|
245
|
+
!focused.matches('cds-overflow-menu-item')) {
|
|
246
|
+
focused = focused.shadowRoot.activeElement;
|
|
247
|
+
}
|
|
248
|
+
const body = focused?.closest('cds-overflow-menu-body');
|
|
249
|
+
if (!focused?.matches('cds-overflow-menu-item') || body?.parent !== menu) {
|
|
250
|
+
return;
|
|
251
|
+
}
|
|
252
|
+
const focusedIndex = Array.from(body.querySelectorAll('cds-overflow-menu-item')).indexOf(focused);
|
|
253
|
+
const focusedAction = changedProperties.get('actions')?.[focusedIndex];
|
|
254
|
+
if (focusedAction &&
|
|
255
|
+
this.actions.some((action) => action.disabled && action.text === focusedAction.text)) {
|
|
256
|
+
menu.open = false;
|
|
257
|
+
menu.focus();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
219
260
|
_handleClick(event) {
|
|
220
261
|
const composedPath = event.composedPath();
|
|
221
262
|
// Check if the click originated from an interactive element (overflow menu, etc.)
|
|
@@ -323,6 +364,7 @@ let CDSAIChatHistoryPanelItem = class CDSAIChatHistoryPanelItem extends HostList
|
|
|
323
364
|
<cds-overflow-menu
|
|
324
365
|
align="top-right"
|
|
325
366
|
size="sm"
|
|
367
|
+
.index=${Math.max(1, actions.findIndex((action) => !action.disabled) + 1)}
|
|
326
368
|
@click=${adjustMenuPosition}
|
|
327
369
|
@keydown=${handleMenuTriggerKeyDown}>
|
|
328
370
|
${iconLoader(OverflowMenuVertical16, {
|
|
@@ -334,6 +376,7 @@ let CDSAIChatHistoryPanelItem = class CDSAIChatHistoryPanelItem extends HostList
|
|
|
334
376
|
${repeat(actions, (action) => action.text, (action) => html `<cds-overflow-menu-item
|
|
335
377
|
?danger=${action.delete}
|
|
336
378
|
?divider=${action.divider}
|
|
379
|
+
?disabled=${action.disabled}
|
|
337
380
|
@click=${handleMenuItemClick}
|
|
338
381
|
@keydown=${handleMenuItemKeyDown}
|
|
339
382
|
>${action.text}${action.icon}</cds-overflow-menu-item
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"history-panel-item.js","sources":["../../../../src/components/chat-history/src/history-panel-item.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { LitElement, html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport prefix from '../../../globals/settings.js';\n\nimport { carbonElement } from '../../../globals/decorators/carbon-element.js';\nimport './history-panel-item-input.js';\nimport FocusMixin from '@carbon/web-components/es/globals/mixins/focus.js';\nimport HostListener from '@carbon/web-components/es/globals/decorators/host-listener.js';\nimport HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';\nimport { CarbonIcon } from '@carbon/web-components/es/globals/internal/icon-loader-utils.js';\nimport OverflowMenuVertical16 from '@carbon/icons/es/overflow-menu--vertical/16.js';\nimport { iconLoader } from '@carbon/web-components/es/globals/internal/icon-loader.js';\nimport '@carbon/web-components/es/components/overflow-menu/index.js';\nimport '@carbon/web-components/es/components/icon-button/index.js';\nimport {\n adoptOnRoot,\n setVarsForSelector,\n} from '../../shared/dynamic-css-var-sheet.js';\n\nimport styles from './chat-history.scss?lit';\n\nexport interface Action {\n text: string;\n delete?: boolean;\n divider?: boolean;\n icon: CarbonIcon;\n onClick: () => void;\n}\n\n/**\n * Chat History panel item.\n *\n * @element cds-aichat-history-panel-item\n * @fires history-panel-item-input-change\n * Bubbles up from the inner input component on every input value change when `rename` is true.\n * @fires history-panel-item-input-cancel\n * Bubbles up from the inner input component when the rename is canceled.\n * @fires history-panel-item-input-save\n * Bubbles up from the inner input component when the rename is saved.\n *\n */\n@carbonElement(`${prefix}-history-panel-item`)\nclass CDSAIChatHistoryPanelItem extends HostListenerMixin(\n FocusMixin(LitElement)\n) {\n /**\n * `true` if the history panel item is selected.\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * id of chat history item element\n */\n @property({ type: String, reflect: true })\n id;\n\n /**\n * Chat history item name.\n */\n @property({ reflect: true })\n name!: string;\n\n /**\n * `true` if the history panel item is in rename mode.\n * rename mode switches the history panel item into an input component.\n */\n @property({ type: Boolean, reflect: true })\n rename = false;\n /**\n * Actions for each panel item.\n */\n @property({ type: Array })\n actions: Action[] = [];\n\n /**\n * Overflow tooltip label\n */\n @property({ type: String, attribute: 'overflow-menu-label' })\n overflowMenuLabel = 'Options';\n\n /**\n * `true` to always show the actions menu for this item.\n * When set, the actions menu will be visible without requiring hover or selection.\n * Can be set directly on the item or inherited from the parent panel's `show-actions` attribute.\n */\n @property({ type: Boolean, reflect: true, attribute: 'show-actions' })\n showActions = false;\n\n /**\n * `true` if the rename input is in an invalid state.\n */\n @property({ type: Boolean, reflect: true, attribute: 'rename-invalid' })\n renameInvalid = false;\n\n /**\n * Error message to display below the rename input when it is invalid.\n */\n @property({\n type: String,\n reflect: true,\n attribute: 'rename-invalid-message',\n })\n renameInvalidMessage = '';\n\n /**\n * `true` if the parent menu is expanded.\n * This is automatically set based on the parent history-panel-menu's expanded attribute.\n */\n @property({ type: Boolean, reflect: true, attribute: 'parent-menu-expanded' })\n parentMenuExpanded = true;\n\n @query(`${prefix}-history-panel-item-input`) input!: HTMLElement;\n\n @query('cds-overflow-menu') overflowMenu!: HTMLElement;\n @query('cds-overflow-menu-body') overflowMenuBody!: HTMLElement;\n\n private _overflowMenuBodyElement?: HTMLElement;\n private _overflowMenuBodyFlippedClass = `${prefix}--history-overflow-menu-body--flipped`;\n private _overflowMenuBodyFlippedSelector = `cds-overflow-menu-body.${this._overflowMenuBodyFlippedClass}`;\n\n private _adoptOverflowMenuBodyStyles(overflowMenuBody: HTMLElement) {\n const root = overflowMenuBody.getRootNode();\n if (root instanceof Document || root instanceof ShadowRoot) {\n adoptOnRoot(root);\n }\n }\n\n private _adoptOverflowMenuBodyStylesAfterPortal(\n overflowMenuBody: HTMLElement\n ) {\n requestAnimationFrame(() => {\n this._adoptOverflowMenuBodyStyles(overflowMenuBody);\n });\n }\n\n /**\n * MutationObserver to watch for changes to parent panel's always-show-actions attribute\n */\n private _parentObserver?: MutationObserver;\n\n /**\n * Event listener for parent menu toggle events\n */\n private _parentMenuToggleListener?: EventListener;\n\n /**\n * Reference to parent menu element\n */\n private _parentMenu?: HTMLElement;\n\n /**\n *\n * The current cds-overflow-menu doesn't support opening the menu body in different\n * directions (top / bottom). This method detects if there's enough space below\n * the menu trigger to show the menu body, and if not, it flips the menu to open upward\n * by setting the `transform` style on the menu body; This is a workaround until the\n * Carbon core team adds support for this.\n *\n */\n private _adjustMenuPosition() {\n if (!this.overflowMenu || !this.overflowMenuBody) {\n return;\n }\n const overflowMenuBody = this.overflowMenuBody;\n this._overflowMenuBodyElement = overflowMenuBody;\n this._adoptOverflowMenuBodyStyles(overflowMenuBody);\n\n const menuRect = this.overflowMenu.getBoundingClientRect();\n const menuTriggerHeight = menuRect.height;\n setVarsForSelector(this._overflowMenuBodyFlippedSelector, {\n transform: `translateY(calc(-100% - ${menuTriggerHeight}px))`,\n });\n const menuBodyRect = overflowMenuBody.getBoundingClientRect();\n const actualMenuHeight = menuBodyRect.height || this.actions.length * 40; // fallback\n\n const parentContainer = this.closest(`${prefix}-history-content`);\n if (!parentContainer) {\n return;\n }\n\n const containerRect = parentContainer.getBoundingClientRect();\n const spaceBelow = containerRect.bottom - menuRect.bottom;\n const spaceAbove = menuRect.top - containerRect.top;\n\n const flipUp = spaceBelow < actualMenuHeight && spaceAbove > spaceBelow;\n overflowMenuBody.classList.toggle(\n this._overflowMenuBodyFlippedClass,\n flipUp\n );\n this._adoptOverflowMenuBodyStylesAfterPortal(overflowMenuBody);\n }\n\n /**\n * Handler for overflow menu trigger keydown event\n *\n * * @param event The event.\n */\n private _handleMenuTriggerKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n this._adjustMenuPosition();\n }\n };\n\n /**\n * Handle menu item clicks\n */\n private _handleMenuItemClick = (event: Event) => {\n const target = event.currentTarget as HTMLElement;\n const menuItemText =\n target.getAttribute('data-action-text') || target.textContent?.trim();\n\n // Dispatch a custom event with item details\n const itemActionEvent = new CustomEvent('history-item-menu-action', {\n bubbles: true,\n composed: true,\n detail: {\n action: menuItemText,\n itemId: this.id,\n itemName: this.name,\n element: this,\n },\n });\n this.dispatchEvent(itemActionEvent);\n };\n\n /**\n * Handler for menu item keydown event\n *\n * * @param event The event.\n */\n private _handleMenuItemKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n this._handleMenuItemClick(event);\n // Close the overflow menu after handling the action\n if (this.overflowMenu) {\n (this.overflowMenu as any).open = false;\n }\n return;\n }\n\n // Handle arrow keys\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n\n const direction = event.key === 'ArrowDown' ? 1 : -1;\n\n // Find the menu body - the event target is the menu item\n const target = event.target as HTMLElement;\n const menuBody = target.closest('cds-overflow-menu-body');\n\n if (!menuBody) {\n return;\n }\n\n const menuItems = Array.from(\n menuBody.querySelectorAll('cds-overflow-menu-item:not([disabled])')\n ) as HTMLElement[];\n\n if (menuItems.length === 0) {\n return;\n }\n\n const currentIndex = menuItems.findIndex(\n (item) =>\n item.contains(document.activeElement) ||\n item === document.activeElement ||\n item.matches(':focus-within')\n );\n\n let nextIndex: number;\n if (currentIndex === -1) {\n // No item focused, focus first or last\n nextIndex = direction === 1 ? 0 : menuItems.length - 1;\n } else {\n // Navigate to next/previous with wrapping\n nextIndex = currentIndex + direction;\n if (nextIndex < 0) {\n nextIndex = menuItems.length - 1;\n } else if (nextIndex >= menuItems.length) {\n nextIndex = 0;\n }\n }\n\n menuItems[nextIndex]?.focus();\n }\n };\n\n @HostListener('click')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleClick(event: Event) {\n const composedPath = event.composedPath();\n\n // Check if the click originated from an interactive element (overflow menu, etc.)\n // by checking the composed path for any overflow menu elements\n const isOverflowMenuClick = composedPath.some((element) => {\n if (element instanceof HTMLElement) {\n const tagName = element.tagName?.toLowerCase();\n return (\n tagName?.includes('overflow-menu') ||\n tagName === 'cds-overflow-menu' ||\n tagName === 'cds-overflow-menu-body' ||\n tagName === 'cds-overflow-menu-item'\n );\n }\n return false;\n });\n\n if (isOverflowMenuClick) {\n return;\n }\n\n // Dispatch a custom event with item details\n const itemActionEvent = new CustomEvent('history-item-selected', {\n bubbles: true,\n composed: true,\n detail: {\n itemId: this.id,\n itemName: this.name,\n element: this,\n },\n });\n this.dispatchEvent(itemActionEvent);\n }\n\n @HostListener('keydown')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n this._handleClick(event);\n }\n };\n\n connectedCallback() {\n super.connectedCallback();\n\n // Inherit show-actions from parent panel if not explicitly set on this item\n const parentPanel = this.closest(`${prefix}-history-panel`);\n if (parentPanel && !this.hasAttribute('show-actions')) {\n // Set initial value\n this.showActions = parentPanel.hasAttribute('show-actions');\n\n // Watch for changes to parent's show-actions attribute\n this._parentObserver = new MutationObserver(() => {\n const parentHasAttribute = parentPanel.hasAttribute('show-actions');\n this.showActions = parentHasAttribute;\n });\n\n this._parentObserver.observe(parentPanel, {\n attributes: true,\n attributeFilter: ['show-actions'],\n });\n }\n\n // Track parent menu's expanded state\n const parentMenu = this.closest(`${prefix}-history-panel-menu`);\n if (parentMenu) {\n this._parentMenu = parentMenu as HTMLElement;\n\n // Listen for toggle events from the parent menu\n this._parentMenuToggleListener = ((event: CustomEvent) => {\n this.parentMenuExpanded = event.detail.expanded;\n }) as EventListener;\n\n parentMenu.addEventListener(\n 'cds-side-nav-menu-toggled',\n this._parentMenuToggleListener\n );\n }\n }\n\n disconnectedCallback() {\n this._overflowMenuBodyElement?.classList.remove(\n this._overflowMenuBodyFlippedClass\n );\n\n super.disconnectedCallback();\n this._parentObserver?.disconnect();\n\n // Remove event listener from parent menu\n if (this._parentMenu && this._parentMenuToggleListener) {\n this._parentMenu.removeEventListener(\n 'cds-side-nav-menu-toggled',\n this._parentMenuToggleListener\n );\n }\n }\n\n firstUpdated() {\n if (this._parentMenu) {\n const expandedValue = (this._parentMenu as any).expanded;\n if (expandedValue !== undefined) {\n this.parentMenuExpanded = expandedValue;\n }\n }\n }\n\n updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (this.input) {\n this.input.addEventListener('history-panel-item-input-cancel', () => {\n this.rename = false;\n this.renameInvalid = false;\n this.renameInvalidMessage = '';\n });\n\n this.input.addEventListener('history-panel-item-input-save', (event) => {\n const newName = (event as CustomEvent).detail.newName;\n this.name = newName;\n this.rename = false;\n this.renameInvalid = false;\n this.renameInvalidMessage = '';\n });\n }\n }\n\n render() {\n const {\n id,\n selected,\n name,\n actions,\n rename,\n overflowMenuLabel,\n _adjustMenuPosition: adjustMenuPosition,\n _handleMenuTriggerKeyDown: handleMenuTriggerKeyDown,\n _handleMenuItemClick: handleMenuItemClick,\n _handleMenuItemKeyDown: handleMenuItemKeyDown,\n } = this;\n const classes = classMap({\n [`cds--side-nav__link`]: true,\n [`cds--side-nav__link--current`]: selected,\n });\n return html`\n ${\n !rename\n ? html` <button class=\"${classes}\">\n <span part=\"name\" class=\"cds--side-nav__link-text\">\n ${name}\n </span>\n <slot name=\"actions\">\n <cds-overflow-menu\n align=\"top-right\"\n size=\"sm\"\n @click=${adjustMenuPosition}\n @keydown=${handleMenuTriggerKeyDown}>\n ${iconLoader(OverflowMenuVertical16, {\n class: `${prefix}--overflow-menu__icon`,\n slot: 'icon',\n })}\n <span slot=\"tooltip-content\">${overflowMenuLabel}</span>\n <cds-overflow-menu-body flipped>\n ${repeat(\n actions,\n (action) => action.text,\n (action) =>\n html`<cds-overflow-menu-item\n ?danger=${action.delete}\n ?divider=${action.divider}\n @click=${handleMenuItemClick}\n @keydown=${handleMenuItemKeyDown}\n >${action.text}${action.icon}</cds-overflow-menu-item\n >`\n )}\n </cds-overflow-menu-body>\n </cds-overflow-menu>\n </slot>\n </button>`\n : html`\n <cds-aichat-history-panel-item-input\n value=\"${name}\"\n item-id=\"${id}\"\n ?invalid=${this.renameInvalid}\n invalid-message=\"${this.renameInvalidMessage}\"></cds-aichat-history-panel-item-input>\n `\n }\n `;\n }\n\n static styles = styles;\n}\n\nexport { CDSAIChatHistoryPanelItem };\nexport default CDSAIChatHistoryPanelItem;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAiCH;;;;;;;;;;;AAWG;AAEH,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,iBAAiB,CACvD,UAAU,CAAC,UAAU,CAAC,CACvB,CAAA;AAFD,IAAA,WAAA,GAAA;;AAGE;;AAEG;QAEH,IAAA,CAAA,QAAQ,GAAG,KAAK;AAchB;;;AAGG;QAEH,IAAA,CAAA,MAAM,GAAG,KAAK;AACd;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAa,EAAE;AAEtB;;AAEG;QAEH,IAAA,CAAA,iBAAiB,GAAG,SAAS;AAE7B;;;;AAIG;QAEH,IAAA,CAAA,WAAW,GAAG,KAAK;AAEnB;;AAEG;QAEH,IAAA,CAAA,aAAa,GAAG,KAAK;AAErB;;AAEG;QAMH,IAAA,CAAA,oBAAoB,GAAG,EAAE;AAEzB;;;AA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,EAAA,cAAA,EAAA,IAAA,CAAA;AAIO,UAAA,CAAA;IAFP,YAAY,CAAC,SAAS;;AAOrB,CAAA,EAAA,yBAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AApSE,yBAAyB,GAAA,UAAA,CAAA;AAD9B,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,mBAAA,CAAqB;AACvC,CAAA,EAAA,yBAAyB,CA0b9B;AAGD,kCAAe,yBAAyB;;"}
|
|
1
|
+
{"version":3,"file":"history-panel-item.js","sources":["../../../../src/components/chat-history/src/history-panel-item.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2026\n *\n * This source code is licensed under the Apache-2.0 license found in the\n * LICENSE file in the root directory of this source tree.\n *\n * @license\n */\n\nimport { LitElement, html } from 'lit';\nimport { property, query } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport prefix from '../../../globals/settings.js';\n\nimport { carbonElement } from '../../../globals/decorators/carbon-element.js';\nimport './history-panel-item-input.js';\nimport FocusMixin from '@carbon/web-components/es/globals/mixins/focus.js';\nimport HostListener from '@carbon/web-components/es/globals/decorators/host-listener.js';\nimport HostListenerMixin from '@carbon/web-components/es/globals/mixins/host-listener.js';\nimport { CarbonIcon } from '@carbon/web-components/es/globals/internal/icon-loader-utils.js';\nimport OverflowMenuVertical16 from '@carbon/icons/es/overflow-menu--vertical/16.js';\nimport { iconLoader } from '@carbon/web-components/es/globals/internal/icon-loader.js';\nimport '@carbon/web-components/es/components/overflow-menu/index.js';\nimport '@carbon/web-components/es/components/icon-button/index.js';\nimport {\n adoptOnRoot,\n setVarsForSelector,\n} from '../../shared/dynamic-css-var-sheet.js';\n\nimport styles from './chat-history.scss?lit';\n\nexport interface Action {\n text: string;\n delete?: boolean;\n divider?: boolean;\n /**\n * Prevents activation while keeping the action visible. Defaults to false.\n */\n disabled?: boolean;\n icon: CarbonIcon;\n onClick: () => void;\n}\n\n/**\n * Chat History panel item.\n *\n * @element cds-aichat-history-panel-item\n * @fires history-panel-item-input-change\n * Bubbles up from the inner input component on every input value change when `rename` is true.\n * @fires history-panel-item-input-cancel\n * Bubbles up from the inner input component when the rename is canceled.\n * @fires history-panel-item-input-save\n * Bubbles up from the inner input component when the rename is saved.\n *\n */\n@carbonElement(`${prefix}-history-panel-item`)\nclass CDSAIChatHistoryPanelItem extends HostListenerMixin(\n FocusMixin(LitElement)\n) {\n /**\n * `true` if the history panel item is selected.\n */\n @property({ type: Boolean, reflect: true })\n selected = false;\n\n /**\n * id of chat history item element\n */\n @property({ type: String, reflect: true })\n id;\n\n /**\n * Chat history item name.\n */\n @property({ reflect: true })\n name!: string;\n\n /**\n * `true` if the history panel item is in rename mode.\n * rename mode switches the history panel item into an input component.\n */\n @property({ type: Boolean, reflect: true })\n rename = false;\n /**\n * Actions for each panel item.\n */\n @property({ type: Array })\n actions: Action[] = [];\n\n /**\n * Overflow tooltip label\n */\n @property({ type: String, attribute: 'overflow-menu-label' })\n overflowMenuLabel = 'Options';\n\n /**\n * `true` to always show the actions menu for this item.\n * When set, the actions menu will be visible without requiring hover or selection.\n * Can be set directly on the item or inherited from the parent panel's `show-actions` attribute.\n */\n @property({ type: Boolean, reflect: true, attribute: 'show-actions' })\n showActions = false;\n\n /**\n * `true` if the rename input is in an invalid state.\n */\n @property({ type: Boolean, reflect: true, attribute: 'rename-invalid' })\n renameInvalid = false;\n\n /**\n * Error message to display below the rename input when it is invalid.\n */\n @property({\n type: String,\n reflect: true,\n attribute: 'rename-invalid-message',\n })\n renameInvalidMessage = '';\n\n /**\n * `true` if the parent menu is expanded.\n * This is automatically set based on the parent history-panel-menu's expanded attribute.\n */\n @property({ type: Boolean, reflect: true, attribute: 'parent-menu-expanded' })\n parentMenuExpanded = true;\n\n @query(`${prefix}-history-panel-item-input`) input!: HTMLElement;\n\n @query('cds-overflow-menu') overflowMenu!: HTMLElement;\n @query('cds-overflow-menu-body') overflowMenuBody!: HTMLElement;\n\n private _overflowMenuBodyElement?: HTMLElement;\n private _overflowMenuBodyFlippedClass = `${prefix}--history-overflow-menu-body--flipped`;\n private _overflowMenuBodyFlippedSelector = `cds-overflow-menu-body.${this._overflowMenuBodyFlippedClass}`;\n\n private _adoptOverflowMenuBodyStyles(overflowMenuBody: HTMLElement) {\n const root = overflowMenuBody.getRootNode();\n if (root instanceof Document || root instanceof ShadowRoot) {\n adoptOnRoot(root);\n }\n }\n\n private _adoptOverflowMenuBodyStylesAfterPortal(\n overflowMenuBody: HTMLElement\n ) {\n requestAnimationFrame(() => {\n this._adoptOverflowMenuBodyStyles(overflowMenuBody);\n });\n }\n\n /**\n * MutationObserver to watch for changes to parent panel's always-show-actions attribute\n */\n private _parentObserver?: MutationObserver;\n\n /**\n * Event listener for parent menu toggle events\n */\n private _parentMenuToggleListener?: EventListener;\n\n /**\n * Reference to parent menu element\n */\n private _parentMenu?: HTMLElement;\n\n /**\n *\n * The current cds-overflow-menu doesn't support opening the menu body in different\n * directions (top / bottom). This method detects if there's enough space below\n * the menu trigger to show the menu body, and if not, it flips the menu to open upward\n * by setting the `transform` style on the menu body; This is a workaround until the\n * Carbon core team adds support for this.\n *\n */\n private _adjustMenuPosition() {\n if (!this.overflowMenu || !this.overflowMenuBody) {\n return;\n }\n const overflowMenuBody = this.overflowMenuBody;\n this._overflowMenuBodyElement = overflowMenuBody;\n this._adoptOverflowMenuBodyStyles(overflowMenuBody);\n\n const menuRect = this.overflowMenu.getBoundingClientRect();\n const menuTriggerHeight = menuRect.height;\n setVarsForSelector(this._overflowMenuBodyFlippedSelector, {\n transform: `translateY(calc(-100% - ${menuTriggerHeight}px))`,\n });\n const menuBodyRect = overflowMenuBody.getBoundingClientRect();\n const actualMenuHeight = menuBodyRect.height || this.actions.length * 40; // fallback\n\n const parentContainer = this.closest(`${prefix}-history-content`);\n if (!parentContainer) {\n return;\n }\n\n const containerRect = parentContainer.getBoundingClientRect();\n const spaceBelow = containerRect.bottom - menuRect.bottom;\n const spaceAbove = menuRect.top - containerRect.top;\n\n const flipUp = spaceBelow < actualMenuHeight && spaceAbove > spaceBelow;\n overflowMenuBody.classList.toggle(\n this._overflowMenuBodyFlippedClass,\n flipUp\n );\n this._adoptOverflowMenuBodyStylesAfterPortal(overflowMenuBody);\n }\n\n /**\n * Handler for overflow menu trigger keydown event\n *\n * * @param event The event.\n */\n private _handleMenuTriggerKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n this._adjustMenuPosition();\n }\n const menu = event.currentTarget as HTMLElement & { open: boolean };\n if (event.key === 'Escape' && menu.open) {\n event.preventDefault();\n event.stopPropagation();\n menu.open = false;\n }\n };\n\n /**\n * Handle menu item clicks\n */\n private _handleMenuItemClick = (event: Event) => {\n const target = event.currentTarget as HTMLElement;\n if (target.hasAttribute('disabled')) {\n event.preventDefault();\n event.stopPropagation();\n return false;\n }\n const menuItemText =\n target.getAttribute('data-action-text') || target.textContent?.trim();\n\n // Dispatch a custom event with item details\n const itemActionEvent = new CustomEvent('history-item-menu-action', {\n bubbles: true,\n composed: true,\n detail: {\n action: menuItemText,\n itemId: this.id,\n itemName: this.name,\n element: this,\n },\n });\n this.dispatchEvent(itemActionEvent);\n return true;\n };\n\n /**\n * Restore focus before rendering a disabled button can drop it to the body.\n */\n willUpdate(changedProperties: Map<string, any>) {\n super.willUpdate(changedProperties);\n const menu = this.overflowMenu as (HTMLElement & { open: boolean }) | null;\n if (!changedProperties.has('actions') || !menu?.open) {\n return;\n }\n // Carbon portals the menu body out of this shadow root, so follow focus.\n let focused = this.ownerDocument.activeElement;\n while (\n focused?.shadowRoot?.activeElement &&\n !focused.matches('cds-overflow-menu-item')\n ) {\n focused = focused.shadowRoot.activeElement;\n }\n const body = focused?.closest('cds-overflow-menu-body') as\n (HTMLElement & { parent: HTMLElement }) | null;\n if (!focused?.matches('cds-overflow-menu-item') || body?.parent !== menu) {\n return;\n }\n const focusedIndex = Array.from(\n body.querySelectorAll('cds-overflow-menu-item')\n ).indexOf(focused);\n const focusedAction = changedProperties.get('actions')?.[focusedIndex];\n if (\n focusedAction &&\n this.actions.some(\n (action) => action.disabled && action.text === focusedAction.text\n )\n ) {\n menu.open = false;\n menu.focus();\n }\n }\n\n /**\n * Handler for menu item keydown event\n *\n * * @param event The event.\n */\n private _handleMenuItemKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter' || event.key === ' ') {\n event.preventDefault();\n if (!this._handleMenuItemClick(event)) {\n return;\n }\n // Close the overflow menu after handling the action\n if (this.overflowMenu) {\n (this.overflowMenu as any).open = false;\n }\n return;\n }\n\n // Handle arrow keys\n if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n event.preventDefault();\n event.stopPropagation();\n\n const direction = event.key === 'ArrowDown' ? 1 : -1;\n\n // Find the menu body - the event target is the menu item\n const target = event.target as HTMLElement;\n const menuBody = target.closest('cds-overflow-menu-body');\n\n if (!menuBody) {\n return;\n }\n\n const menuItems = Array.from(\n menuBody.querySelectorAll('cds-overflow-menu-item:not([disabled])')\n ) as HTMLElement[];\n\n if (menuItems.length === 0) {\n return;\n }\n\n const currentIndex = menuItems.findIndex(\n (item) =>\n item.contains(document.activeElement) ||\n item === document.activeElement ||\n item.matches(':focus-within')\n );\n\n let nextIndex: number;\n if (currentIndex === -1) {\n // No item focused, focus first or last\n nextIndex = direction === 1 ? 0 : menuItems.length - 1;\n } else {\n // Navigate to next/previous with wrapping\n nextIndex = currentIndex + direction;\n if (nextIndex < 0) {\n nextIndex = menuItems.length - 1;\n } else if (nextIndex >= menuItems.length) {\n nextIndex = 0;\n }\n }\n\n menuItems[nextIndex]?.focus();\n }\n };\n\n @HostListener('click')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleClick(event: Event) {\n const composedPath = event.composedPath();\n\n // Check if the click originated from an interactive element (overflow menu, etc.)\n // by checking the composed path for any overflow menu elements\n const isOverflowMenuClick = composedPath.some((element) => {\n if (element instanceof HTMLElement) {\n const tagName = element.tagName?.toLowerCase();\n return (\n tagName?.includes('overflow-menu') ||\n tagName === 'cds-overflow-menu' ||\n tagName === 'cds-overflow-menu-body' ||\n tagName === 'cds-overflow-menu-item'\n );\n }\n return false;\n });\n\n if (isOverflowMenuClick) {\n return;\n }\n\n // Dispatch a custom event with item details\n const itemActionEvent = new CustomEvent('history-item-selected', {\n bubbles: true,\n composed: true,\n detail: {\n itemId: this.id,\n itemName: this.name,\n element: this,\n },\n });\n this.dispatchEvent(itemActionEvent);\n }\n\n @HostListener('keydown')\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleKeyDown = (event: KeyboardEvent) => {\n if (event.key === 'Enter') {\n event.preventDefault();\n this._handleClick(event);\n }\n };\n\n connectedCallback() {\n super.connectedCallback();\n\n // Inherit show-actions from parent panel if not explicitly set on this item\n const parentPanel = this.closest(`${prefix}-history-panel`);\n if (parentPanel && !this.hasAttribute('show-actions')) {\n // Set initial value\n this.showActions = parentPanel.hasAttribute('show-actions');\n\n // Watch for changes to parent's show-actions attribute\n this._parentObserver = new MutationObserver(() => {\n const parentHasAttribute = parentPanel.hasAttribute('show-actions');\n this.showActions = parentHasAttribute;\n });\n\n this._parentObserver.observe(parentPanel, {\n attributes: true,\n attributeFilter: ['show-actions'],\n });\n }\n\n // Track parent menu's expanded state\n const parentMenu = this.closest(`${prefix}-history-panel-menu`);\n if (parentMenu) {\n this._parentMenu = parentMenu as HTMLElement;\n\n // Listen for toggle events from the parent menu\n this._parentMenuToggleListener = ((event: CustomEvent) => {\n this.parentMenuExpanded = event.detail.expanded;\n }) as EventListener;\n\n parentMenu.addEventListener(\n 'cds-side-nav-menu-toggled',\n this._parentMenuToggleListener\n );\n }\n }\n\n disconnectedCallback() {\n this._overflowMenuBodyElement?.classList.remove(\n this._overflowMenuBodyFlippedClass\n );\n\n super.disconnectedCallback();\n this._parentObserver?.disconnect();\n\n // Remove event listener from parent menu\n if (this._parentMenu && this._parentMenuToggleListener) {\n this._parentMenu.removeEventListener(\n 'cds-side-nav-menu-toggled',\n this._parentMenuToggleListener\n );\n }\n }\n\n firstUpdated() {\n if (this._parentMenu) {\n const expandedValue = (this._parentMenu as any).expanded;\n if (expandedValue !== undefined) {\n this.parentMenuExpanded = expandedValue;\n }\n }\n }\n\n updated(changedProperties: Map<string, any>) {\n super.updated(changedProperties);\n\n if (this.input) {\n this.input.addEventListener('history-panel-item-input-cancel', () => {\n this.rename = false;\n this.renameInvalid = false;\n this.renameInvalidMessage = '';\n });\n\n this.input.addEventListener('history-panel-item-input-save', (event) => {\n const newName = (event as CustomEvent).detail.newName;\n this.name = newName;\n this.rename = false;\n this.renameInvalid = false;\n this.renameInvalidMessage = '';\n });\n }\n }\n\n render() {\n const {\n id,\n selected,\n name,\n actions,\n rename,\n overflowMenuLabel,\n _adjustMenuPosition: adjustMenuPosition,\n _handleMenuTriggerKeyDown: handleMenuTriggerKeyDown,\n _handleMenuItemClick: handleMenuItemClick,\n _handleMenuItemKeyDown: handleMenuItemKeyDown,\n } = this;\n const classes = classMap({\n [`cds--side-nav__link`]: true,\n [`cds--side-nav__link--current`]: selected,\n });\n return html`\n ${\n !rename\n ? html` <button class=\"${classes}\">\n <span part=\"name\" class=\"cds--side-nav__link-text\">\n ${name}\n </span>\n <slot name=\"actions\">\n <cds-overflow-menu\n align=\"top-right\"\n size=\"sm\"\n .index=${Math.max(\n 1,\n actions.findIndex((action) => !action.disabled) + 1\n )}\n @click=${adjustMenuPosition}\n @keydown=${handleMenuTriggerKeyDown}>\n ${iconLoader(OverflowMenuVertical16, {\n class: `${prefix}--overflow-menu__icon`,\n slot: 'icon',\n })}\n <span slot=\"tooltip-content\">${overflowMenuLabel}</span>\n <cds-overflow-menu-body flipped>\n ${repeat(\n actions,\n (action) => action.text,\n (action) =>\n html`<cds-overflow-menu-item\n ?danger=${action.delete}\n ?divider=${action.divider}\n ?disabled=${action.disabled}\n @click=${handleMenuItemClick}\n @keydown=${handleMenuItemKeyDown}\n >${action.text}${action.icon}</cds-overflow-menu-item\n >`\n )}\n </cds-overflow-menu-body>\n </cds-overflow-menu>\n </slot>\n </button>`\n : html`\n <cds-aichat-history-panel-item-input\n value=\"${name}\"\n item-id=\"${id}\"\n ?invalid=${this.renameInvalid}\n invalid-message=\"${this.renameInvalidMessage}\"></cds-aichat-history-panel-item-input>\n `\n }\n `;\n }\n\n static styles = styles;\n}\n\nexport { CDSAIChatHistoryPanelItem };\nexport default CDSAIChatHistoryPanelItem;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAqCH;;;;;;;;;;;AAWG;AAEH,IAAM,yBAAyB,GAA/B,MAAM,yBAA0B,SAAQ,iBAAiB,CACvD,UAAU,CAAC,UAAU,CAAC,CACvB,CAAA;AAFD,IAAA,WAAA,GAAA;;AAGE;;AAEG;QAEH,IAAA,CAAA,QAAQ,GAAG,KAAK;AAchB;;;AAGG;QAEH,IAAA,CAAA,MAAM,GAAG,KAAK;AACd;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAa,EAAE;AAEtB;;AAEG;QAEH,IAAA,CAAA,iBAAiB,GAAG,SAAS;AAE7B;;;;AAIG;QAEH,IAAA,CAAA,WAAW,GAAG,KAAK;AAEnB;;AAEG;QAEH,IAAA,CAAA,aAAa,GAAG,KAAK;AAErB;;AAEG;QAMH,IAAA,CAAA,oBAAoB,GAAG,EAAE;AAEzB;;;AAGG;QAEH,IAAA,CAAA,kBAAkB,GAAG,IAAI;AAQjB,QAAA,IAAA,CAAA,6BAA6B,GAAG,CAAA,EAAG,MAAM,CAAA,qCAAA,CAAuC;AAChF,QAAA,IAAA,CAAA,gCAAgC,GAAG,CAAA,uBAAA,EAA0B,IAAI,CAAC,6BAA6B,EAAE;AA0EzG;;;;AAIG;AACK,QAAA,IAAA,CAAA,yBAAyB,GAAG,CAAC,KAAoB,KAAI;AAC3D,YAAA,IAAI,KAAK,CAAC,GAAG,KAAK,OAAO,IAAI,KAAK,CAAC,GAAG,KAAK,GAAG,EAAE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AA,CAAA,SAAA,EAAA,kBAAA,EAAA,MAAA,CAAA;AAoOxD,UAAA,CAAA;IAFP,YAAY,CAAC,OAAO;;AAmCpB,CAAA,EAAA,yBAAA,CAAA,SAAA,EAAA,cAAA,EAAA,IAAA,CAAA;AAIO,UAAA,CAAA;IAFP,YAAY,CAAC,SAAS;;AAOrB,CAAA,EAAA,yBAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAvVE,yBAAyB,GAAA,UAAA,CAAA;AAD9B,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,mBAAA,CAAqB;AACvC,CAAA,EAAA,yBAAyB,CAkf9B;AAGD,kCAAe,yBAAyB;;"}
|
|
@@ -74,6 +74,10 @@ declare class CDSAIChatCodeSnippet extends CDSAIChatCodeSnippet_base {
|
|
|
74
74
|
showMoreText: string;
|
|
75
75
|
/** Tooltip label for the copy action. */
|
|
76
76
|
copyButtonTooltipContent: string;
|
|
77
|
+
/** Feedback text shown after copying. */
|
|
78
|
+
feedback: string;
|
|
79
|
+
/** The number in milliseconds to determine how long the feedback tooltip should remain. */
|
|
80
|
+
feedbackTimeout: number;
|
|
77
81
|
/** Label for folding/collapsing code. */
|
|
78
82
|
foldCollapseLabel: string;
|
|
79
83
|
/** Label for unfolding/expanding code. */
|
|
@@ -138,6 +138,10 @@ let CDSAIChatCodeSnippet = class CDSAIChatCodeSnippet extends FocusMixin(LitElem
|
|
|
138
138
|
this.showMoreText = 'Show more';
|
|
139
139
|
/** Tooltip label for the copy action. */
|
|
140
140
|
this.copyButtonTooltipContent = 'Copy to clipboard';
|
|
141
|
+
/** Feedback text shown after copying. */
|
|
142
|
+
this.feedback = 'Copied!';
|
|
143
|
+
/** The number in milliseconds to determine how long the feedback tooltip should remain. */
|
|
144
|
+
this.feedbackTimeout = 2000;
|
|
141
145
|
/** Label for folding/collapsing code. */
|
|
142
146
|
this.foldCollapseLabel = 'Collapse code block';
|
|
143
147
|
/** Label for unfolding/expanding code. */
|
|
@@ -756,6 +760,8 @@ let CDSAIChatCodeSnippet = class CDSAIChatCodeSnippet extends FocusMixin(LitElem
|
|
|
756
760
|
const copyAction = {
|
|
757
761
|
text: this.copyButtonTooltipContent,
|
|
758
762
|
icon: Copy16,
|
|
763
|
+
feedback: this.feedback,
|
|
764
|
+
feedbackTimeout: this.feedbackTimeout,
|
|
759
765
|
onClick: () => this._handleCopyClick(),
|
|
760
766
|
};
|
|
761
767
|
return [copyAction, ...this.actions];
|
|
@@ -934,6 +940,12 @@ __decorate([
|
|
|
934
940
|
__decorate([
|
|
935
941
|
property({ attribute: 'copy-button-tooltip-content' })
|
|
936
942
|
], CDSAIChatCodeSnippet.prototype, "copyButtonTooltipContent", void 0);
|
|
943
|
+
__decorate([
|
|
944
|
+
property({ attribute: 'feedback' })
|
|
945
|
+
], CDSAIChatCodeSnippet.prototype, "feedback", void 0);
|
|
946
|
+
__decorate([
|
|
947
|
+
property({ type: Number, attribute: 'feedback-timeout' })
|
|
948
|
+
], CDSAIChatCodeSnippet.prototype, "feedbackTimeout", void 0);
|
|
937
949
|
__decorate([
|
|
938
950
|
property({ attribute: 'fold-collapse-label' })
|
|
939
951
|
], CDSAIChatCodeSnippet.prototype, "foldCollapseLabel", void 0);
|