@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.
Files changed (177) hide show
  1. package/custom-elements.json +8737 -8823
  2. package/es/components/audio-player/src/transcript.js +1 -1
  3. package/es/components/carousel/src/carousel.d.ts +1 -1
  4. package/es/components/carousel/src/carousel.js +1 -1
  5. package/es/components/carousel/src/carousel.js.map +1 -1
  6. package/es/components/chat-history/src/history-panel-item.d.ts +8 -0
  7. package/es/components/chat-history/src/history-panel-item.js +44 -1
  8. package/es/components/chat-history/src/history-panel-item.js.map +1 -1
  9. package/es/components/code-snippet/src/code-snippet.d.ts +4 -0
  10. package/es/components/code-snippet/src/code-snippet.js +12 -0
  11. package/es/components/code-snippet/src/code-snippet.js.map +1 -1
  12. package/es/components/feedback/src/feedback.js +1 -1
  13. package/es/components/file-uploads/src/file-upload-item.d.ts +16 -17
  14. package/es/components/file-uploads/src/file-upload-item.js +98 -58
  15. package/es/components/file-uploads/src/file-upload-item.js.map +1 -1
  16. package/es/components/file-uploads/src/file-upload-item.scss.js +1 -1
  17. package/es/components/file-uploads/src/file-uploads.d.ts +20 -0
  18. package/es/components/file-uploads/src/file-uploads.js +55 -1
  19. package/es/components/file-uploads/src/file-uploads.js.map +1 -1
  20. package/es/components/file-uploads/src/file-uploads.scss.js +1 -1
  21. package/es/components/markdown/index.js +1 -2
  22. package/es/components/markdown/index.js.map +1 -1
  23. package/es/components/markdown/src/inline-markdown.d.ts +2 -2
  24. package/es/components/markdown/src/inline-markdown.js +8 -2
  25. package/es/components/markdown/src/inline-markdown.js.map +1 -1
  26. package/es/components/markdown/src/inline-markdown.scss.js +2 -2
  27. package/es/components/markdown/src/markdown-renderer-types.d.ts +2 -0
  28. package/es/components/markdown/src/markdown-renderer.js +3 -1
  29. package/es/components/markdown/src/markdown-renderer.js.map +1 -1
  30. package/es/components/markdown/src/markdown.d.ts +4 -0
  31. package/es/components/markdown/src/markdown.js +14 -0
  32. package/es/components/markdown/src/markdown.js.map +1 -1
  33. package/es/components/markdown/src/utils/inline-run-projection.js +3 -17
  34. package/es/components/markdown/src/utils/inline-run-projection.js.map +1 -1
  35. package/es/components/message-item-shell/index.d.ts +11 -0
  36. package/es/components/message-item-shell/index.js +9 -0
  37. package/es/components/message-item-shell/index.js.map +1 -0
  38. package/es/components/message-item-shell/src/message-item-shell.d.ts +48 -0
  39. package/es/components/message-item-shell/src/message-item-shell.js +91 -0
  40. package/es/components/message-item-shell/src/message-item-shell.js.map +1 -0
  41. package/es/components/message-item-shell/src/message-item-shell.scss.js +13 -0
  42. package/es/components/message-item-shell/src/message-item-shell.scss.js.map +1 -0
  43. package/es/components/prompt-line/src/prompt-line-controller.d.ts +1 -1
  44. package/es/components/prompt-line/src/prompt-line-rich-runtime.js +19 -2
  45. package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  46. package/es/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  47. package/es/components/prompt-line/src/prompt-line-textarea-runtime.js +9 -4
  48. package/es/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
  49. package/es/components/prompt-line/src/prompt-line.d.ts +17 -7
  50. package/es/components/prompt-line/src/prompt-line.js +39 -0
  51. package/es/components/prompt-line/src/prompt-line.js.map +1 -1
  52. package/es/components/prompt-line/src/prompt-line.scss.js +1 -1
  53. package/es/components/prompt-line/src/tiptap/chat-enter.d.ts +2 -2
  54. package/es/components/prompt-line/src/tiptap/chat-enter.js +2 -2
  55. package/es/components/prompt-line/src/tiptap/chat-enter.js.map +1 -1
  56. package/es/components/prompt-line/src/tiptap/editor-styles.js +1 -1
  57. package/es/components/prompt-line/src/tiptap/editor-styles.js.map +1 -1
  58. package/es/components/prompt-line/src/tiptap/types.d.ts +3 -4
  59. package/es/components/shared/root-styles.d.ts +30 -0
  60. package/es/components/shared/root-styles.js +72 -0
  61. package/es/components/shared/root-styles.js.map +1 -0
  62. package/es/components/toolbar/src/toolbar.d.ts +14 -4
  63. package/es/components/toolbar/src/toolbar.js +29 -6
  64. package/es/components/toolbar/src/toolbar.js.map +1 -1
  65. package/es/components/user-avatar/index.d.ts +10 -0
  66. package/es/components/user-avatar/index.js +9 -0
  67. package/es/components/user-avatar/index.js.map +1 -0
  68. package/es/components/user-avatar/src/user-avatar.d.ts +46 -0
  69. package/es/components/user-avatar/src/user-avatar.js +153 -0
  70. package/es/components/user-avatar/src/user-avatar.js.map +1 -0
  71. package/es/components/user-avatar/src/user-avatar.scss.js +13 -0
  72. package/es/components/user-avatar/src/user-avatar.scss.js.map +1 -0
  73. package/es/globals/utils/iconTransform.js +1 -0
  74. package/es/globals/utils/iconTransform.js.map +1 -1
  75. package/es/react/chat-header.js +4 -2
  76. package/es/react/chat-header.js.map +1 -1
  77. package/es/react/code-snippet.d.ts +4 -1
  78. package/es/react/code-snippet.js +3 -1
  79. package/es/react/code-snippet.js.map +1 -1
  80. package/es/react/message-item-shell.d.ts +3 -0
  81. package/es/react/message-item-shell.js +30 -0
  82. package/es/react/message-item-shell.js.map +1 -0
  83. package/es/react/toolbar.d.ts +1 -1
  84. package/es/react/toolbar.js +3 -1
  85. package/es/react/toolbar.js.map +1 -1
  86. package/es/react/user-avatar.d.ts +3 -0
  87. package/es/react/user-avatar.js +29 -0
  88. package/es/react/user-avatar.js.map +1 -0
  89. package/es-custom/components/audio-player/src/transcript.js +1 -1
  90. package/es-custom/components/carousel/src/carousel.d.ts +1 -1
  91. package/es-custom/components/carousel/src/carousel.js +1 -1
  92. package/es-custom/components/carousel/src/carousel.js.map +1 -1
  93. package/es-custom/components/chat-history/src/history-panel-item.d.ts +8 -0
  94. package/es-custom/components/chat-history/src/history-panel-item.js +44 -1
  95. package/es-custom/components/chat-history/src/history-panel-item.js.map +1 -1
  96. package/es-custom/components/code-snippet/src/code-snippet.d.ts +4 -0
  97. package/es-custom/components/code-snippet/src/code-snippet.js +12 -0
  98. package/es-custom/components/code-snippet/src/code-snippet.js.map +1 -1
  99. package/es-custom/components/feedback/src/feedback.js +1 -1
  100. package/es-custom/components/file-uploads/src/file-upload-item.d.ts +16 -17
  101. package/es-custom/components/file-uploads/src/file-upload-item.js +98 -58
  102. package/es-custom/components/file-uploads/src/file-upload-item.js.map +1 -1
  103. package/es-custom/components/file-uploads/src/file-upload-item.scss.js +1 -1
  104. package/es-custom/components/file-uploads/src/file-uploads.d.ts +20 -0
  105. package/es-custom/components/file-uploads/src/file-uploads.js +55 -1
  106. package/es-custom/components/file-uploads/src/file-uploads.js.map +1 -1
  107. package/es-custom/components/file-uploads/src/file-uploads.scss.js +1 -1
  108. package/es-custom/components/markdown/index.js +1 -2
  109. package/es-custom/components/markdown/index.js.map +1 -1
  110. package/es-custom/components/markdown/src/inline-markdown.d.ts +2 -2
  111. package/es-custom/components/markdown/src/inline-markdown.js +8 -2
  112. package/es-custom/components/markdown/src/inline-markdown.js.map +1 -1
  113. package/es-custom/components/markdown/src/inline-markdown.scss.js +2 -2
  114. package/es-custom/components/markdown/src/markdown-renderer-types.d.ts +2 -0
  115. package/es-custom/components/markdown/src/markdown-renderer.js +3 -1
  116. package/es-custom/components/markdown/src/markdown-renderer.js.map +1 -1
  117. package/es-custom/components/markdown/src/markdown.d.ts +4 -0
  118. package/es-custom/components/markdown/src/markdown.js +14 -0
  119. package/es-custom/components/markdown/src/markdown.js.map +1 -1
  120. package/es-custom/components/markdown/src/utils/inline-run-projection.js +3 -17
  121. package/es-custom/components/markdown/src/utils/inline-run-projection.js.map +1 -1
  122. package/es-custom/components/message-item-shell/index.d.ts +11 -0
  123. package/es-custom/components/message-item-shell/index.js +9 -0
  124. package/es-custom/components/message-item-shell/index.js.map +1 -0
  125. package/es-custom/components/message-item-shell/src/message-item-shell.d.ts +48 -0
  126. package/es-custom/components/message-item-shell/src/message-item-shell.js +91 -0
  127. package/es-custom/components/message-item-shell/src/message-item-shell.js.map +1 -0
  128. package/es-custom/components/message-item-shell/src/message-item-shell.scss.js +13 -0
  129. package/es-custom/components/message-item-shell/src/message-item-shell.scss.js.map +1 -0
  130. package/es-custom/components/prompt-line/src/prompt-line-controller.d.ts +1 -1
  131. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +19 -2
  132. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  133. package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  134. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js +9 -4
  135. package/es-custom/components/prompt-line/src/prompt-line-textarea-runtime.js.map +1 -1
  136. package/es-custom/components/prompt-line/src/prompt-line.d.ts +17 -7
  137. package/es-custom/components/prompt-line/src/prompt-line.js +39 -0
  138. package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
  139. package/es-custom/components/prompt-line/src/prompt-line.scss.js +1 -1
  140. package/es-custom/components/prompt-line/src/tiptap/chat-enter.d.ts +2 -2
  141. package/es-custom/components/prompt-line/src/tiptap/chat-enter.js +2 -2
  142. package/es-custom/components/prompt-line/src/tiptap/chat-enter.js.map +1 -1
  143. package/es-custom/components/prompt-line/src/tiptap/editor-styles.js +1 -1
  144. package/es-custom/components/prompt-line/src/tiptap/editor-styles.js.map +1 -1
  145. package/es-custom/components/prompt-line/src/tiptap/types.d.ts +3 -4
  146. package/es-custom/components/shared/root-styles.d.ts +30 -0
  147. package/es-custom/components/shared/root-styles.js +72 -0
  148. package/es-custom/components/shared/root-styles.js.map +1 -0
  149. package/es-custom/components/toolbar/src/toolbar.d.ts +14 -4
  150. package/es-custom/components/toolbar/src/toolbar.js +29 -6
  151. package/es-custom/components/toolbar/src/toolbar.js.map +1 -1
  152. package/es-custom/components/user-avatar/index.d.ts +10 -0
  153. package/es-custom/components/user-avatar/index.js +9 -0
  154. package/es-custom/components/user-avatar/index.js.map +1 -0
  155. package/es-custom/components/user-avatar/src/user-avatar.d.ts +46 -0
  156. package/es-custom/components/user-avatar/src/user-avatar.js +153 -0
  157. package/es-custom/components/user-avatar/src/user-avatar.js.map +1 -0
  158. package/es-custom/components/user-avatar/src/user-avatar.scss.js +13 -0
  159. package/es-custom/components/user-avatar/src/user-avatar.scss.js.map +1 -0
  160. package/es-custom/globals/utils/iconTransform.js +1 -0
  161. package/es-custom/globals/utils/iconTransform.js.map +1 -1
  162. package/es-custom/react/chat-header.js +4 -2
  163. package/es-custom/react/chat-header.js.map +1 -1
  164. package/es-custom/react/code-snippet.d.ts +4 -1
  165. package/es-custom/react/code-snippet.js +3 -1
  166. package/es-custom/react/code-snippet.js.map +1 -1
  167. package/es-custom/react/message-item-shell.d.ts +3 -0
  168. package/es-custom/react/message-item-shell.js +30 -0
  169. package/es-custom/react/message-item-shell.js.map +1 -0
  170. package/es-custom/react/toolbar.d.ts +1 -1
  171. package/es-custom/react/toolbar.js +3 -1
  172. package/es-custom/react/toolbar.js.map +1 -1
  173. package/es-custom/react/user-avatar.d.ts +3 -0
  174. package/es-custom/react/user-avatar.js +29 -0
  175. package/es-custom/react/user-avatar.js.map +1 -0
  176. package/package.json +8 -6
  177. package/telemetry.yml +16 -0
@@ -0,0 +1,72 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ /**
9
+ * @license
10
+ *
11
+ * Copyright IBM Corp. 2026
12
+ *
13
+ * This source code is licensed under the Apache-2.0 license found in the
14
+ * LICENSE file in the root directory of this source tree.
15
+ */
16
+ /**
17
+ * Attaches CSS rules to one document or shadow root.
18
+ *
19
+ * Uses a constructed stylesheet so the rules pass a strict CSP. The sheet is
20
+ * built from the root's own document, since a sheet from another document
21
+ * can't be adopted. Browsers without constructed-sheet support get a `<style>`
22
+ * element instead.
23
+ *
24
+ * Each call owns its own sheet. Use `dynamic-css-var-sheet.ts` for one sheet
25
+ * shared across roots.
26
+ */
27
+ function attachRootStyles(root, cssText) {
28
+ const isDocument = root.nodeType === Node.DOCUMENT_NODE;
29
+ const ownerDocument = isDocument
30
+ ? root
31
+ : root.ownerDocument;
32
+ let sheet;
33
+ let element;
34
+ try {
35
+ const candidate = new ownerDocument.defaultView.CSSStyleSheet();
36
+ candidate.replaceSync(cssText);
37
+ root.adoptedStyleSheets = [...root.adoptedStyleSheets, candidate];
38
+ sheet = candidate;
39
+ }
40
+ catch {
41
+ element = ownerDocument.createElement('style');
42
+ element.textContent = cssText;
43
+ const container = isDocument
44
+ ? (root.head ?? root.documentElement)
45
+ : root;
46
+ container.appendChild(element);
47
+ }
48
+ let current = cssText;
49
+ return {
50
+ update(nextText) {
51
+ if (nextText === current) {
52
+ return;
53
+ }
54
+ current = nextText;
55
+ if (sheet) {
56
+ sheet.replaceSync(nextText);
57
+ }
58
+ else if (element) {
59
+ element.textContent = nextText;
60
+ }
61
+ },
62
+ detach() {
63
+ if (sheet) {
64
+ root.adoptedStyleSheets = root.adoptedStyleSheets.filter((existing) => existing !== sheet);
65
+ }
66
+ element?.remove();
67
+ },
68
+ };
69
+ }
70
+
71
+ export { attachRootStyles };
72
+ //# sourceMappingURL=root-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-styles.js","sources":["../../../src/components/shared/root-styles.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\n/**\n * Rules attached to one root by {@link attachRootStyles}.\n */\ninterface RootStyles {\n /** Replace the attached rules. A no-op when the text is unchanged. */\n update(cssText: string): void;\n /** Remove the attached rules from the root. */\n detach(): void;\n}\n\n/**\n * Attaches CSS rules to one document or shadow root.\n *\n * Uses a constructed stylesheet so the rules pass a strict CSP. The sheet is\n * built from the root's own document, since a sheet from another document\n * can't be adopted. Browsers without constructed-sheet support get a `<style>`\n * element instead.\n *\n * Each call owns its own sheet. Use `dynamic-css-var-sheet.ts` for one sheet\n * shared across roots.\n */\nfunction attachRootStyles(\n root: Document | ShadowRoot,\n cssText: string\n): RootStyles {\n const isDocument = root.nodeType === Node.DOCUMENT_NODE;\n const ownerDocument = isDocument\n ? (root as Document)\n : (root.ownerDocument as Document);\n let sheet: CSSStyleSheet | undefined;\n let element: HTMLStyleElement | undefined;\n\n try {\n const candidate = new ownerDocument.defaultView!.CSSStyleSheet();\n candidate.replaceSync(cssText);\n root.adoptedStyleSheets = [...root.adoptedStyleSheets, candidate];\n sheet = candidate;\n } catch {\n element = ownerDocument.createElement('style');\n element.textContent = cssText;\n const container = isDocument\n ? ((root as Document).head ?? (root as Document).documentElement)\n : root;\n container.appendChild(element);\n }\n\n let current = cssText;\n return {\n update(nextText) {\n if (nextText === current) {\n return;\n }\n current = nextText;\n if (sheet) {\n sheet.replaceSync(nextText);\n } else if (element) {\n element.textContent = nextText;\n }\n },\n detach() {\n if (sheet) {\n root.adoptedStyleSheets = root.adoptedStyleSheets.filter(\n (existing) => existing !== sheet\n );\n }\n element?.remove();\n },\n };\n}\n\nexport { attachRootStyles, type RootStyles };\n"],"names":[],"mappings":";;;;;;;AAAA;;;;;;;AAOG;AAYH;;;;;;;;;;AAUG;AACH,SAAS,gBAAgB,CACvB,IAA2B,EAC3B,OAAe,EAAA;IAEf,MAAM,UAAU,GAAG,IAAI,CAAC,QAAQ,KAAK,IAAI,CAAC,aAAa;IACvD,MAAM,aAAa,GAAG;AACpB,UAAG;AACH,UAAG,IAAI,CAAC,aAA0B;AACpC,IAAA,IAAI,KAAgC;AACpC,IAAA,IAAI,OAAqC;AAEzC,IAAA,IAAI;QACF,MAAM,SAAS,GAAG,IAAI,aAAa,CAAC,WAAY,CAAC,aAAa,EAAE;AAChE,QAAA,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC;QAC9B,IAAI,CAAC,kBAAkB,GAAG,CAAC,GAAG,IAAI,CAAC,kBAAkB,EAAE,SAAS,CAAC;QACjE,KAAK,GAAG,SAAS;IACnB;AAAE,IAAA,MAAM;AACN,QAAA,OAAO,GAAG,aAAa,CAAC,aAAa,CAAC,OAAO,CAAC;AAC9C,QAAA,OAAO,CAAC,WAAW,GAAG,OAAO;QAC7B,MAAM,SAAS,GAAG;eACZ,IAAiB,CAAC,IAAI,IAAK,IAAiB,CAAC,eAAe;cAC9D,IAAI;AACR,QAAA,SAAS,CAAC,WAAW,CAAC,OAAO,CAAC;IAChC;IAEA,IAAI,OAAO,GAAG,OAAO;IACrB,OAAO;AACL,QAAA,MAAM,CAAC,QAAQ,EAAA;AACb,YAAA,IAAI,QAAQ,KAAK,OAAO,EAAE;gBACxB;YACF;YACA,OAAO,GAAG,QAAQ;YAClB,IAAI,KAAK,EAAE;AACT,gBAAA,KAAK,CAAC,WAAW,CAAC,QAAQ,CAAC;YAC7B;iBAAO,IAAI,OAAO,EAAE;AAClB,gBAAA,OAAO,CAAC,WAAW,GAAG,QAAQ;YAChC;QACF,CAAC;QACD,MAAM,GAAA;YACJ,IAAI,KAAK,EAAE;AACT,gBAAA,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,kBAAkB,CAAC,MAAM,CACtD,CAAC,QAAQ,KAAK,QAAQ,KAAK,KAAK,CACjC;YACH;YACA,OAAO,EAAE,MAAM,EAAE;QACnB,CAAC;KACF;AACH;;"}
@@ -1,5 +1,6 @@
1
1
  import { LitElement } from 'lit';
2
2
  import '@carbon/web-components/es-custom/components/button/index.js';
3
+ import '@carbon/web-components/es-custom/components/copy-button/index.js';
3
4
  import '@carbon/web-components/es-custom/components/overflow-menu/index.js';
4
5
  import { CarbonIcon } from '@carbon/web-components/es-custom/globals/internal/icon-loader-utils.js';
5
6
  import '../../truncated-text/index.js';
@@ -16,9 +17,9 @@ import { BUTTON_SIZE } from '@carbon/web-components/es-custom/components/button/
16
17
  */
17
18
  export interface Action extends BaseOverflowMenuItem {
18
19
  /**
19
- * `@carbon/icons` icon for the action.
20
+ * `@carbon/icons` icon for the action. Optional when `feedback` is specified (defaults to Carbon copy icon).
20
21
  */
21
- icon: CarbonIcon;
22
+ icon?: CarbonIcon;
22
23
  /**
23
24
  * Size of button. Defaults to BUTTON_SIZE.MEDIUM.
24
25
  */
@@ -34,6 +35,15 @@ export interface Action extends BaseOverflowMenuItem {
34
35
  * semantics — `undefined` is intentionally distinct from `false`.
35
36
  */
36
37
  isSelected?: boolean;
38
+ /**
39
+ * When provided, renders this action using `<cds-custom-copy-button>` with the
40
+ * specified feedback text shown after copying (e.g. "Copied!").
41
+ */
42
+ feedback?: string;
43
+ /**
44
+ * The number in milliseconds to determine how long the feedback tooltip should remain.
45
+ */
46
+ feedbackTimeout?: number;
37
47
  }
38
48
  /**
39
49
  * Toolbar.
@@ -42,7 +52,7 @@ export interface Action extends BaseOverflowMenuItem {
42
52
  * @slot navigation - Defines the navigation area of the toolbar.
43
53
  * @slot title - Defines the title section of the toolbar.
44
54
  * @slot fixed-actions - Defines the area for displaying actions that are always visible (not overflowed) in the toolbar.
45
- * @slot toolbar-ai-label - Defines the area for displaying the AI label in the toolbar.
55
+ * @slot decorator - Decorative content such as an AI label.
46
56
  *
47
57
  */
48
58
  declare class CDSAIChatToolbar extends LitElement {
@@ -71,7 +81,7 @@ declare class CDSAIChatToolbar extends LitElement {
71
81
  private findFocusedOverflowMenuItem;
72
82
  private _handleToolbarKeydown;
73
83
  /**
74
- * Renders an action as an icon button.
84
+ * Renders an action as an icon button or copy button.
75
85
  * Note: Some Action properties only apply when rendered in overflow menu:
76
86
  * - danger/dangerDescription: cds-custom-icon-button doesn't support danger variant
77
87
  * - divider: Only applicable in menu context
@@ -10,6 +10,7 @@ import { LitElement, nothing, html } from 'lit';
10
10
  import { state, property, query } from 'lit/decorators.js';
11
11
  import { repeat } from 'lit/directives/repeat.js';
12
12
  import '@carbon/web-components/es-custom/components/button/index.js';
13
+ import '@carbon/web-components/es-custom/components/copy-button/index.js';
13
14
  import '@carbon/web-components/es-custom/components/overflow-menu/index.js';
14
15
  import { OVERFLOW_MENU_SIZE } from '@carbon/web-components/es-custom/components/overflow-menu/defs.js';
15
16
  import OverflowMenuVertical16 from '@carbon/icons/es/overflow-menu--vertical/16.js';
@@ -39,7 +40,7 @@ const blockClass = `${prefix}-toolbar`;
39
40
  * @slot navigation - Defines the navigation area of the toolbar.
40
41
  * @slot title - Defines the title section of the toolbar.
41
42
  * @slot fixed-actions - Defines the area for displaying actions that are always visible (not overflowed) in the toolbar.
42
- * @slot toolbar-ai-label - Defines the area for displaying the AI label in the toolbar.
43
+ * @slot decorator - Decorative content such as an AI label.
43
44
  *
44
45
  */
45
46
  let CDSAIChatToolbar = CDSAIChatToolbar_1 = class CDSAIChatToolbar extends LitElement {
@@ -79,14 +80,34 @@ let CDSAIChatToolbar = CDSAIChatToolbar_1 = class CDSAIChatToolbar extends LitEl
79
80
  }
80
81
  };
81
82
  /**
82
- * Renders an action as an icon button.
83
+ * Renders an action as an icon button or copy button.
83
84
  * Note: Some Action properties only apply when rendered in overflow menu:
84
85
  * - danger/dangerDescription: cds-custom-icon-button doesn't support danger variant
85
86
  * - divider: Only applicable in menu context
86
87
  */
87
88
  this.renderIconButton = (action) => {
88
89
  const tooltipAlign = this.isRTL ? 'bottom-start' : 'bottom-end';
89
- const { isSelected } = action;
90
+ const { isSelected, feedback } = action;
91
+ if (feedback !== undefined) {
92
+ return html `
93
+ <cds-custom-copy-button
94
+ align=${tooltipAlign}
95
+ @click=${action.onClick}
96
+ ?data-fixed=${action.fixed}
97
+ data-testid=${action.testId || nothing}
98
+ ?disabled=${action.disabled}
99
+ enter-delay-ms="0"
100
+ feedback=${feedback}
101
+ feedback-timeout=${action.feedbackTimeout !== undefined
102
+ ? action.feedbackTimeout
103
+ : nothing}
104
+ kind="ghost"
105
+ leave-delay-ms="0"
106
+ size=${action.size || BUTTON_SIZE.MEDIUM}>
107
+ ${action.text}
108
+ </cds-custom-copy-button>
109
+ `;
110
+ }
90
111
  return html `
91
112
  <cds-custom-icon-button
92
113
  align=${tooltipAlign}
@@ -103,9 +124,11 @@ let CDSAIChatToolbar = CDSAIChatToolbar_1 = class CDSAIChatToolbar extends LitEl
103
124
  leave-delay-ms="0"
104
125
  size=${action.size || BUTTON_SIZE.MEDIUM}
105
126
  target=${action.href ? action.target || '_self' : nothing}>
106
- ${iconLoader(action.icon, {
107
- slot: 'icon',
108
- })}
127
+ ${action.icon
128
+ ? iconLoader(action.icon, {
129
+ slot: 'icon',
130
+ })
131
+ : nothing}
109
132
  <span slot="tooltip-content">${action.text}</span>
110
133
  </cds-custom-icon-button>
111
134
  `;
@@ -1 +1 @@
1
- {"version":3,"file":"toolbar.js","sources":["../../../../src/components/toolbar/src/toolbar.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 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, nothing } from 'lit';\nimport { property, state, query } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport '@carbon/web-components/es-custom/components/button/index.js';\nimport '@carbon/web-components/es-custom/components/overflow-menu/index.js';\nimport { OVERFLOW_MENU_SIZE } from '@carbon/web-components/es-custom/components/overflow-menu/defs.js';\nimport OverflowMenuVertical16 from '@carbon/icons/es/overflow-menu--vertical/16.js';\nimport { iconLoader } from '@carbon/web-components/es-custom/globals/internal/icon-loader.js';\nimport prefix from '../../../globals/settings.js';\nimport commonStyles from '../../../globals/scss/common.scss?lit';\nimport styles from './toolbar.scss?lit';\nimport { CarbonIcon } from '@carbon/web-components/es-custom/globals/internal/icon-loader-utils.js';\nimport { carbonElement } from '../../../globals/decorators/index.js';\nimport '../../truncated-text/index.js';\nimport { BaseOverflowMenuItem } from '../../../typings/overflow-menu.js';\nimport { PageObjectId } from '../../../testing/PageObjectId.js';\n\nconst blockClass = `${prefix}-toolbar`;\nimport { BUTTON_SIZE } from '@carbon/web-components/es-custom/components/button/defs.js';\n\n/**\n * Actions that display in the toolbar.\n * Extends BaseOverflowMenuItem to support all overflow menu item properties\n * including danger variants, dividers, and links (href/target).\n *\n * Actions can be either:\n * - Interactive buttons with onClick handlers\n * - Links with href/target attributes\n */\nexport interface Action extends BaseOverflowMenuItem {\n /**\n * `@carbon/icons` icon for the action.\n */\n icon: CarbonIcon;\n\n /**\n * Size of button. Defaults to BUTTON_SIZE.MEDIUM.\n */\n size?: BUTTON_SIZE;\n\n /**\n * When overflow handling is enabled, setting fixed to true will force this action out of the overflow menu.\n */\n fixed?: boolean;\n\n /**\n * Renders this action as a two-state toggle and sets its current state.\n * When `true` or `false`, the button exposes `aria-pressed` and a visible\n * pressed treatment. Omit the field for a plain button with no toggle\n * semantics — `undefined` is intentionally distinct from `false`.\n */\n isSelected?: boolean;\n}\n\n/**\n * Toolbar.\n *\n * @element cds-custom-aichat-toolbar\n * @slot navigation - Defines the navigation area of the toolbar.\n * @slot title - Defines the title section of the toolbar.\n * @slot fixed-actions - Defines the area for displaying actions that are always visible (not overflowed) in the toolbar.\n * @slot toolbar-ai-label - Defines the area for displaying the AI label in the toolbar.\n *\n */\n@carbonElement(blockClass)\nclass CDSAIChatToolbar extends LitElement {\n /** Whether the component is in RTL mode.\n * @internal\n */\n @state() private isRTL = false;\n\n /** The list of actions. */\n @property({ type: Array, attribute: false, reflect: false })\n actions: Action[] = [];\n\n /** Should actions be overflowing. */\n @property({ type: Boolean, attribute: 'overflow', reflect: true })\n overflow = false;\n\n @property({ type: String })\n titleText?: string;\n\n @property({ type: String })\n nameText?: string;\n\n /** Container holding all action buttons and the overflow menu.\n * @internal\n */\n @query(`.${blockClass}__end`) private container!: HTMLElement;\n @query(`.${blockClass}__actions-container`)\n private actionsContainer!: HTMLElement;\n\n @query(`.${blockClass}__decorator-container`)\n private decoratorContainer!: HTMLElement;\n\n @query(`.${blockClass}__fixed-actions`)\n private fixedActions!: HTMLElement;\n\n @state()\n private containerWidth = 0;\n\n private resizeObserver?: ResizeObserver;\n\n private static readonly OVERFLOW_MENU_LABEL = 'Options';\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('keydown', this._handleToolbarKeydown);\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.resizeObserver = undefined;\n this.removeEventListener('keydown', this._handleToolbarKeydown);\n super.disconnectedCallback();\n }\n\n firstUpdated() {\n if (this.overflow) {\n this.setupResizeObserver();\n }\n }\n\n updated() {\n // Carbon's delegatesFocus moves focus to the inner shadow <button>, so\n // ARIA attributes on the host are invisible to assistive tech. Mirror\n // them onto the inner button after each element's update cycle completes.\n void this._patchShadowButtonAttrs('cds-custom-icon-button[data-pressed]', {\n 'aria-pressed': 'data-pressed',\n });\n void this._patchShadowButtonAttrs(\n 'cds-custom-overflow-menu-item[role=\"menuitemcheckbox\"]',\n { role: 'role', 'aria-checked': 'aria-checked' }\n );\n }\n\n /**\n * Copies attributes from each host element matching `selector` onto its\n * inner shadow `<button>`, after the element's own update cycle completes.\n *\n * @param selector - CSS selector scoped to this shadow root.\n * @param attrMap - `{ targetAttr: sourceAttr }` pairs to copy.\n * @internal\n */\n private async _patchShadowButtonAttrs(\n selector: string,\n attrMap: Record<string, string>\n ): Promise<void> {\n await Promise.all(\n Array.from(\n this.shadowRoot?.querySelectorAll<LitElement & HTMLElement>(selector) ??\n []\n ).map(async (el) => {\n await el.updateComplete;\n const btn = el.shadowRoot?.querySelector('button');\n if (!btn) {\n return;\n }\n for (const [target, source] of Object.entries(attrMap)) {\n const value = el.getAttribute(source);\n if (value !== null) {\n btn.setAttribute(target, value);\n }\n }\n })\n );\n }\n\n private sortActions() {\n return [...this.actions].sort((a, b) => {\n if (a.fixed && !b.fixed) {\n return -1;\n }\n if (!a.fixed && b.fixed) {\n return 1;\n }\n return 0;\n });\n }\n\n private setupResizeObserver() {\n this.resizeObserver?.disconnect();\n this.resizeObserver = new ResizeObserver((entries) => {\n const width = entries[0].contentRect.width;\n if (width !== this.containerWidth) {\n this.containerWidth = width;\n }\n });\n this.resizeObserver.observe(this.container);\n }\n\n private getActions() {\n if (!this.container || this.container.getBoundingClientRect().width === 0) {\n return {\n visibleActions: [],\n hiddenActions: [],\n };\n }\n\n const actionsContainerWidth =\n this.actionsContainer.getBoundingClientRect().width;\n const overflowMenuIconWidth = 40;\n const fixedActionsWidth =\n this.fixedActions.getBoundingClientRect().width || 0;\n const decoratorContainerWidth =\n this.decoratorContainer.getBoundingClientRect().width || 0;\n /**\n * to properly gauge the container width we need to account for some additional variables\n * 1. the size of the overflow menu icon, which should always be a constant\n * 2. the size of any optional fixed width items\n * 3. the size of any optional decorator items\n */\n const containerWidth =\n actionsContainerWidth -\n (overflowMenuIconWidth + fixedActionsWidth + decoratorContainerWidth);\n const children = this.actionsContainer.children;\n let currentWidth = 0;\n const visibleChildren: Element[] = [];\n const hiddenChildren: Element[] = [];\n for (const el of children) {\n const elWidth = el.getBoundingClientRect().width;\n const newWidth = currentWidth + elWidth;\n const widthCheck = newWidth < containerWidth;\n if (widthCheck) {\n currentWidth = newWidth;\n visibleChildren.push(el);\n } else {\n hiddenChildren.push(el);\n }\n }\n const idx = visibleChildren.length;\n const sortedActions = this.sortActions();\n const visibleActions = sortedActions.slice(0, idx);\n const hiddenActions = sortedActions.slice(idx);\n\n return {\n visibleActions,\n hiddenActions,\n };\n }\n\n /**\n * Returns the focused overflow menu item (if exists) by traversing shadow DOM\n */\n private findFocusedOverflowMenuItem(activeElem: Element): Element | null {\n if (activeElem.tagName.toLowerCase() === 'cds-custom-overflow-menu-item') {\n return activeElem;\n }\n\n if (activeElem?.shadowRoot?.activeElement) {\n return this.findFocusedOverflowMenuItem(\n activeElem.shadowRoot.activeElement\n );\n }\n\n return null;\n }\n\n private _handleToolbarKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') {\n return;\n }\n\n let focusedMenuItem: Element | null = null;\n\n if (document.activeElement) {\n focusedMenuItem = this.findFocusedOverflowMenuItem(\n document.activeElement\n );\n }\n\n if (focusedMenuItem) {\n event.preventDefault();\n const menuBody = focusedMenuItem.closest('cds-custom-overflow-menu-body');\n\n if (!menuBody) {\n return;\n }\n\n const items = Array.from(\n menuBody.querySelectorAll('cds-custom-overflow-menu-item:not([disabled])')\n ) as HTMLElement[];\n\n const currentIndex = items.indexOf(focusedMenuItem as HTMLElement);\n if (currentIndex === -1) {\n return;\n }\n\n const direction = event.key === 'ArrowDown' ? 1 : -1;\n const nextIndex =\n (currentIndex + direction + items.length) % items.length;\n items[nextIndex]?.focus();\n }\n };\n\n /**\n * Renders an action as an icon button.\n * Note: Some Action properties only apply when rendered in overflow menu:\n * - danger/dangerDescription: cds-custom-icon-button doesn't support danger variant\n * - divider: Only applicable in menu context\n */\n private renderIconButton = (action: Action) => {\n const tooltipAlign = this.isRTL ? 'bottom-start' : 'bottom-end';\n const { isSelected } = action;\n\n return html`\n <cds-custom-icon-button\n align=${tooltipAlign}\n @click=${action.onClick}\n ?data-fixed=${action.fixed}\n data-pressed=${isSelected !== undefined ? String(isSelected) : nothing}\n ?data-selected=${isSelected === true}\n data-testid=${action.testId || nothing}\n ?disabled=${action.disabled}\n enter-delay-ms=\"0\"\n href=${action.href || nothing}\n ?isSelected=${isSelected === true}\n kind=\"ghost\"\n leave-delay-ms=\"0\"\n size=${action.size || BUTTON_SIZE.MEDIUM}\n target=${action.href ? action.target || '_self' : nothing}>\n ${iconLoader(action.icon, {\n slot: 'icon',\n })}\n <span slot=\"tooltip-content\">${action.text}</span>\n </cds-custom-icon-button>\n `;\n };\n\n private getOverflowMenuSize(): OVERFLOW_MENU_SIZE {\n return (this.actions?.[0]?.size ||\n OVERFLOW_MENU_SIZE.MEDIUM) as OVERFLOW_MENU_SIZE;\n }\n\n render() {\n const {\n hiddenActions: rawHiddenActions,\n visibleActions: rawVisibleActions,\n } = this.getActions();\n const showOverflowMenu = rawHiddenActions.length > 1;\n const visibleActions = showOverflowMenu\n ? rawVisibleActions\n : [...rawVisibleActions, ...rawHiddenActions];\n const hiddenActions = showOverflowMenu ? rawHiddenActions : [];\n const showInitialActions =\n rawVisibleActions.length === 0 && rawHiddenActions.length === 0;\n\n return html`\n <div data-rounded=\"top\" class=${blockClass}>\n <div data-fixed class=\"${blockClass}__start\">\n <div data-fixed class=\"${blockClass}__navigation\">\n <slot name=\"navigation\"></slot>\n </div>\n\n <div data-fixed class=\"${blockClass}__title\">\n <slot name=\"title\">\n ${\n this.titleText || this.nameText\n ? html`\n <cds-custom-aichat-truncated-text\n lines=\"1\"\n type=\"tooltip\"\n align=${this.isRTL ? 'bottom-end' : 'bottom-start'}\n value=\"${[this.titleText, this.nameText]\n .filter(Boolean)\n .join(' ')}\">\n ${\n this.titleText\n ? html`<span\n data-testid=${PageObjectId.HEADER_TITLE}\n >${this.titleText}</span\n >`\n : nothing\n }\n ${this.titleText && this.nameText ? html`` : nothing}\n ${\n this.nameText\n ? html`<span\n class=\"${blockClass}__name\"\n data-testid=${PageObjectId.HEADER_NAME}\n >${this.nameText}</span\n >`\n : nothing\n }\n </cds-custom-aichat-truncated-text>\n `\n : nothing\n }\n </slot>\n </div>\n </div>\n <div\n class=\"${blockClass}__end\"\n data-rounded=\"top-right\"\n data-floating-menu-container>\n <div class=\"${blockClass}__actions-container\">\n <div class=\"${blockClass}__decorator-container\">\n <slot name=\"decorator\"></slot>\n </div>\n ${repeat(\n showInitialActions ? this.actions : visibleActions,\n (action) => action.text,\n this.renderIconButton\n )}\n ${\n showOverflowMenu\n ? html`\n <cds-custom-overflow-menu\n size=${this.getOverflowMenuSize()}\n align=${this.isRTL ? 'bottom-start' : 'bottom-end'}\n data-offset\n ?data-hidden=${hiddenActions.length === 0}\n kind=\"ghost\"\n close-on-activation\n enter-delay-ms=\"0\"\n leave-delay-ms=\"0\">\n ${iconLoader(OverflowMenuVertical16, {\n class: `${blockClass}-overflow-icon`,\n slot: 'icon',\n })}\n <span slot=\"tooltip-content\"\n >${CDSAIChatToolbar.OVERFLOW_MENU_LABEL}</span\n >\n <cds-custom-overflow-menu-body ?flipped=${!this.isRTL}>\n ${repeat(\n hiddenActions,\n (item) => item.text,\n (item) => {\n return html`\n <cds-custom-overflow-menu-item\n @click=${item.onClick}\n href=${item.href || nothing}\n target=${\n item.href ? item.target || '_self' : nothing\n }\n ?disabled=${item.disabled}\n ?danger=${item.danger}\n danger-description=${\n item.dangerDescription || nothing\n }\n ?divider=${item.divider}\n ?data-selected=${item.isSelected === true}\n role=${\n item.isSelected !== undefined\n ? 'menuitemcheckbox'\n : nothing\n }\n aria-checked=${\n item.isSelected !== undefined\n ? String(item.isSelected)\n : nothing\n }\n data-testid=${item.testId || nothing}>\n ${item.text}\n </cds-custom-overflow-menu-item>\n `;\n }\n )}\n </cds-custom-overflow-menu-body>\n </cds-custom-overflow-menu>\n `\n : nothing\n }\n <div data-fixed class=\"${blockClass}__fixed-actions\">\n <slot name=\"fixed-actions\"></slot>\n </div>\n </div>\n </div>\n </div>\n `;\n }\n\n static styles = [commonStyles, styles];\n}\n\nexport { CDSAIChatToolbar };\nexport default CDSAIChatToolbar;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;;AAmBH,MAAM,UAAU,GAAG,CAAA,EAAG,MAAM,UAAU;AAqCtC;;;;;;;;;AASG;AAEH,IAAM,gBAAgB,GAAA,kBAAA,GAAtB,MAAM,gBAAiB,SAAQ,UAAU,CAAA;AAAzC,IAAA,WAAA,GAAA;;AACE;;AAEG;QACc,IAAA,CAAA,KAAK,GAAG,KAAK;;QAI9B,IAAA,CAAA,OAAO,GAAa,EAAE;;QAItB,IAAA,CAAA,QAAQ,GAAG,KAAK;QAsBR,IAAA,CAAA,cAAc,GAAG,CAAC;AA+JlB,QAAA,IAAA,CAAA,qBAAqB,GAAG,CAAC,KAAoB,KAAI;AACvD,YAAA,IAAI,KAAK,CAAC,GAAG,KAAK,SAAS,IAAI,KAAK,CAAC,GAAG,KAAK,WAAW,EAAE;gBACxD;YACF;YAEA,IAAI,eAAe,GAAmB,IAAI;AAE1C,YAAA,IAAI,QAAQ,CAAC,aAAa,EAAE;gBAC1B,eAAe,GAAG,IAAI,CAAC,2BAA2B,CAChD,QAAQ,CAAC,aAAa,CACvB;YACH;YAEA,IAAI,eAAe,EAA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AU;AACnB,CAAA,EAAA,gBAAgB,CAwZrB;AAGD,yBAAe,gBAAgB;;"}
1
+ {"version":3,"file":"toolbar.js","sources":["../../../../src/components/toolbar/src/toolbar.ts"],"sourcesContent":["/*\n * Copyright IBM Corp. 2025, 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, nothing } from 'lit';\nimport { property, state, query } from 'lit/decorators.js';\nimport { repeat } from 'lit/directives/repeat.js';\nimport '@carbon/web-components/es-custom/components/button/index.js';\nimport '@carbon/web-components/es-custom/components/copy-button/index.js';\nimport '@carbon/web-components/es-custom/components/overflow-menu/index.js';\nimport { OVERFLOW_MENU_SIZE } from '@carbon/web-components/es-custom/components/overflow-menu/defs.js';\nimport OverflowMenuVertical16 from '@carbon/icons/es/overflow-menu--vertical/16.js';\nimport { iconLoader } from '@carbon/web-components/es-custom/globals/internal/icon-loader.js';\nimport prefix from '../../../globals/settings.js';\nimport commonStyles from '../../../globals/scss/common.scss?lit';\nimport styles from './toolbar.scss?lit';\nimport { CarbonIcon } from '@carbon/web-components/es-custom/globals/internal/icon-loader-utils.js';\nimport { carbonElement } from '../../../globals/decorators/index.js';\nimport '../../truncated-text/index.js';\nimport { BaseOverflowMenuItem } from '../../../typings/overflow-menu.js';\nimport { PageObjectId } from '../../../testing/PageObjectId.js';\n\nconst blockClass = `${prefix}-toolbar`;\nimport { BUTTON_SIZE } from '@carbon/web-components/es-custom/components/button/defs.js';\n\n/**\n * Actions that display in the toolbar.\n * Extends BaseOverflowMenuItem to support all overflow menu item properties\n * including danger variants, dividers, and links (href/target).\n *\n * Actions can be either:\n * - Interactive buttons with onClick handlers\n * - Links with href/target attributes\n */\nexport interface Action extends BaseOverflowMenuItem {\n /**\n * `@carbon/icons` icon for the action. Optional when `feedback` is specified (defaults to Carbon copy icon).\n */\n icon?: CarbonIcon;\n\n /**\n * Size of button. Defaults to BUTTON_SIZE.MEDIUM.\n */\n size?: BUTTON_SIZE;\n\n /**\n * When overflow handling is enabled, setting fixed to true will force this action out of the overflow menu.\n */\n fixed?: boolean;\n\n /**\n * Renders this action as a two-state toggle and sets its current state.\n * When `true` or `false`, the button exposes `aria-pressed` and a visible\n * pressed treatment. Omit the field for a plain button with no toggle\n * semantics — `undefined` is intentionally distinct from `false`.\n */\n isSelected?: boolean;\n\n /**\n * When provided, renders this action using `<cds-custom-copy-button>` with the\n * specified feedback text shown after copying (e.g. \"Copied!\").\n */\n feedback?: string;\n\n /**\n * The number in milliseconds to determine how long the feedback tooltip should remain.\n */\n feedbackTimeout?: number;\n}\n\n/**\n * Toolbar.\n *\n * @element cds-custom-aichat-toolbar\n * @slot navigation - Defines the navigation area of the toolbar.\n * @slot title - Defines the title section of the toolbar.\n * @slot fixed-actions - Defines the area for displaying actions that are always visible (not overflowed) in the toolbar.\n * @slot decorator - Decorative content such as an AI label.\n *\n */\n@carbonElement(blockClass)\nclass CDSAIChatToolbar extends LitElement {\n /** Whether the component is in RTL mode.\n * @internal\n */\n @state() private isRTL = false;\n\n /** The list of actions. */\n @property({ type: Array, attribute: false, reflect: false })\n actions: Action[] = [];\n\n /** Should actions be overflowing. */\n @property({ type: Boolean, attribute: 'overflow', reflect: true })\n overflow = false;\n\n @property({ type: String })\n titleText?: string;\n\n @property({ type: String })\n nameText?: string;\n\n /** Container holding all action buttons and the overflow menu.\n * @internal\n */\n @query(`.${blockClass}__end`) private container!: HTMLElement;\n @query(`.${blockClass}__actions-container`)\n private actionsContainer!: HTMLElement;\n\n @query(`.${blockClass}__decorator-container`)\n private decoratorContainer!: HTMLElement;\n\n @query(`.${blockClass}__fixed-actions`)\n private fixedActions!: HTMLElement;\n\n @state()\n private containerWidth = 0;\n\n private resizeObserver?: ResizeObserver;\n\n private static readonly OVERFLOW_MENU_LABEL = 'Options';\n\n connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener('keydown', this._handleToolbarKeydown);\n }\n\n disconnectedCallback() {\n this.resizeObserver?.disconnect();\n this.resizeObserver = undefined;\n this.removeEventListener('keydown', this._handleToolbarKeydown);\n super.disconnectedCallback();\n }\n\n firstUpdated() {\n if (this.overflow) {\n this.setupResizeObserver();\n }\n }\n\n updated() {\n // Carbon's delegatesFocus moves focus to the inner shadow <button>, so\n // ARIA attributes on the host are invisible to assistive tech. Mirror\n // them onto the inner button after each element's update cycle completes.\n void this._patchShadowButtonAttrs('cds-custom-icon-button[data-pressed]', {\n 'aria-pressed': 'data-pressed',\n });\n void this._patchShadowButtonAttrs(\n 'cds-custom-overflow-menu-item[role=\"menuitemcheckbox\"]',\n { role: 'role', 'aria-checked': 'aria-checked' }\n );\n }\n\n /**\n * Copies attributes from each host element matching `selector` onto its\n * inner shadow `<button>`, after the element's own update cycle completes.\n *\n * @param selector - CSS selector scoped to this shadow root.\n * @param attrMap - `{ targetAttr: sourceAttr }` pairs to copy.\n * @internal\n */\n private async _patchShadowButtonAttrs(\n selector: string,\n attrMap: Record<string, string>\n ): Promise<void> {\n await Promise.all(\n Array.from(\n this.shadowRoot?.querySelectorAll<LitElement & HTMLElement>(selector) ??\n []\n ).map(async (el) => {\n await el.updateComplete;\n const btn = el.shadowRoot?.querySelector('button');\n if (!btn) {\n return;\n }\n for (const [target, source] of Object.entries(attrMap)) {\n const value = el.getAttribute(source);\n if (value !== null) {\n btn.setAttribute(target, value);\n }\n }\n })\n );\n }\n\n private sortActions() {\n return [...this.actions].sort((a, b) => {\n if (a.fixed && !b.fixed) {\n return -1;\n }\n if (!a.fixed && b.fixed) {\n return 1;\n }\n return 0;\n });\n }\n\n private setupResizeObserver() {\n this.resizeObserver?.disconnect();\n this.resizeObserver = new ResizeObserver((entries) => {\n const width = entries[0].contentRect.width;\n if (width !== this.containerWidth) {\n this.containerWidth = width;\n }\n });\n this.resizeObserver.observe(this.container);\n }\n\n private getActions() {\n if (!this.container || this.container.getBoundingClientRect().width === 0) {\n return {\n visibleActions: [],\n hiddenActions: [],\n };\n }\n\n const actionsContainerWidth =\n this.actionsContainer.getBoundingClientRect().width;\n const overflowMenuIconWidth = 40;\n const fixedActionsWidth =\n this.fixedActions.getBoundingClientRect().width || 0;\n const decoratorContainerWidth =\n this.decoratorContainer.getBoundingClientRect().width || 0;\n /**\n * to properly gauge the container width we need to account for some additional variables\n * 1. the size of the overflow menu icon, which should always be a constant\n * 2. the size of any optional fixed width items\n * 3. the size of any optional decorator items\n */\n const containerWidth =\n actionsContainerWidth -\n (overflowMenuIconWidth + fixedActionsWidth + decoratorContainerWidth);\n const children = this.actionsContainer.children;\n let currentWidth = 0;\n const visibleChildren: Element[] = [];\n const hiddenChildren: Element[] = [];\n for (const el of children) {\n const elWidth = el.getBoundingClientRect().width;\n const newWidth = currentWidth + elWidth;\n const widthCheck = newWidth < containerWidth;\n if (widthCheck) {\n currentWidth = newWidth;\n visibleChildren.push(el);\n } else {\n hiddenChildren.push(el);\n }\n }\n const idx = visibleChildren.length;\n const sortedActions = this.sortActions();\n const visibleActions = sortedActions.slice(0, idx);\n const hiddenActions = sortedActions.slice(idx);\n\n return {\n visibleActions,\n hiddenActions,\n };\n }\n\n /**\n * Returns the focused overflow menu item (if exists) by traversing shadow DOM\n */\n private findFocusedOverflowMenuItem(activeElem: Element): Element | null {\n if (activeElem.tagName.toLowerCase() === 'cds-custom-overflow-menu-item') {\n return activeElem;\n }\n\n if (activeElem?.shadowRoot?.activeElement) {\n return this.findFocusedOverflowMenuItem(\n activeElem.shadowRoot.activeElement\n );\n }\n\n return null;\n }\n\n private _handleToolbarKeydown = (event: KeyboardEvent) => {\n if (event.key !== 'ArrowUp' && event.key !== 'ArrowDown') {\n return;\n }\n\n let focusedMenuItem: Element | null = null;\n\n if (document.activeElement) {\n focusedMenuItem = this.findFocusedOverflowMenuItem(\n document.activeElement\n );\n }\n\n if (focusedMenuItem) {\n event.preventDefault();\n const menuBody = focusedMenuItem.closest('cds-custom-overflow-menu-body');\n\n if (!menuBody) {\n return;\n }\n\n const items = Array.from(\n menuBody.querySelectorAll('cds-custom-overflow-menu-item:not([disabled])')\n ) as HTMLElement[];\n\n const currentIndex = items.indexOf(focusedMenuItem as HTMLElement);\n if (currentIndex === -1) {\n return;\n }\n\n const direction = event.key === 'ArrowDown' ? 1 : -1;\n const nextIndex =\n (currentIndex + direction + items.length) % items.length;\n items[nextIndex]?.focus();\n }\n };\n\n /**\n * Renders an action as an icon button or copy button.\n * Note: Some Action properties only apply when rendered in overflow menu:\n * - danger/dangerDescription: cds-custom-icon-button doesn't support danger variant\n * - divider: Only applicable in menu context\n */\n private renderIconButton = (action: Action) => {\n const tooltipAlign = this.isRTL ? 'bottom-start' : 'bottom-end';\n const { isSelected, feedback } = action;\n\n if (feedback !== undefined) {\n return html`\n <cds-custom-copy-button\n align=${tooltipAlign}\n @click=${action.onClick}\n ?data-fixed=${action.fixed}\n data-testid=${action.testId || nothing}\n ?disabled=${action.disabled}\n enter-delay-ms=\"0\"\n feedback=${feedback}\n feedback-timeout=${\n action.feedbackTimeout !== undefined\n ? action.feedbackTimeout\n : nothing\n }\n kind=\"ghost\"\n leave-delay-ms=\"0\"\n size=${action.size || BUTTON_SIZE.MEDIUM}>\n ${action.text}\n </cds-custom-copy-button>\n `;\n }\n\n return html`\n <cds-custom-icon-button\n align=${tooltipAlign}\n @click=${action.onClick}\n ?data-fixed=${action.fixed}\n data-pressed=${isSelected !== undefined ? String(isSelected) : nothing}\n ?data-selected=${isSelected === true}\n data-testid=${action.testId || nothing}\n ?disabled=${action.disabled}\n enter-delay-ms=\"0\"\n href=${action.href || nothing}\n ?isSelected=${isSelected === true}\n kind=\"ghost\"\n leave-delay-ms=\"0\"\n size=${action.size || BUTTON_SIZE.MEDIUM}\n target=${action.href ? action.target || '_self' : nothing}>\n ${\n action.icon\n ? iconLoader(action.icon, {\n slot: 'icon',\n })\n : nothing\n }\n <span slot=\"tooltip-content\">${action.text}</span>\n </cds-custom-icon-button>\n `;\n };\n\n private getOverflowMenuSize(): OVERFLOW_MENU_SIZE {\n return (this.actions?.[0]?.size ||\n OVERFLOW_MENU_SIZE.MEDIUM) as OVERFLOW_MENU_SIZE;\n }\n\n render() {\n const {\n hiddenActions: rawHiddenActions,\n visibleActions: rawVisibleActions,\n } = this.getActions();\n const showOverflowMenu = rawHiddenActions.length > 1;\n const visibleActions = showOverflowMenu\n ? rawVisibleActions\n : [...rawVisibleActions, ...rawHiddenActions];\n const hiddenActions = showOverflowMenu ? rawHiddenActions : [];\n const showInitialActions =\n rawVisibleActions.length === 0 && rawHiddenActions.length === 0;\n\n return html`\n <div data-rounded=\"top\" class=${blockClass}>\n <div data-fixed class=\"${blockClass}__start\">\n <div data-fixed class=\"${blockClass}__navigation\">\n <slot name=\"navigation\"></slot>\n </div>\n\n <div data-fixed class=\"${blockClass}__title\">\n <slot name=\"title\">\n ${\n this.titleText || this.nameText\n ? html`\n <cds-custom-aichat-truncated-text\n lines=\"1\"\n type=\"tooltip\"\n align=${this.isRTL ? 'bottom-end' : 'bottom-start'}\n value=\"${[this.titleText, this.nameText]\n .filter(Boolean)\n .join(' ')}\">\n ${\n this.titleText\n ? html`<span\n data-testid=${PageObjectId.HEADER_TITLE}\n >${this.titleText}</span\n >`\n : nothing\n }\n ${this.titleText && this.nameText ? html`` : nothing}\n ${\n this.nameText\n ? html`<span\n class=\"${blockClass}__name\"\n data-testid=${PageObjectId.HEADER_NAME}\n >${this.nameText}</span\n >`\n : nothing\n }\n </cds-custom-aichat-truncated-text>\n `\n : nothing\n }\n </slot>\n </div>\n </div>\n <div\n class=\"${blockClass}__end\"\n data-rounded=\"top-right\"\n data-floating-menu-container>\n <div class=\"${blockClass}__actions-container\">\n <div class=\"${blockClass}__decorator-container\">\n <slot name=\"decorator\"></slot>\n </div>\n ${repeat(\n showInitialActions ? this.actions : visibleActions,\n (action) => action.text,\n this.renderIconButton\n )}\n ${\n showOverflowMenu\n ? html`\n <cds-custom-overflow-menu\n size=${this.getOverflowMenuSize()}\n align=${this.isRTL ? 'bottom-start' : 'bottom-end'}\n data-offset\n ?data-hidden=${hiddenActions.length === 0}\n kind=\"ghost\"\n close-on-activation\n enter-delay-ms=\"0\"\n leave-delay-ms=\"0\">\n ${iconLoader(OverflowMenuVertical16, {\n class: `${blockClass}-overflow-icon`,\n slot: 'icon',\n })}\n <span slot=\"tooltip-content\"\n >${CDSAIChatToolbar.OVERFLOW_MENU_LABEL}</span\n >\n <cds-custom-overflow-menu-body ?flipped=${!this.isRTL}>\n ${repeat(\n hiddenActions,\n (item) => item.text,\n (item) => {\n return html`\n <cds-custom-overflow-menu-item\n @click=${item.onClick}\n href=${item.href || nothing}\n target=${\n item.href ? item.target || '_self' : nothing\n }\n ?disabled=${item.disabled}\n ?danger=${item.danger}\n danger-description=${\n item.dangerDescription || nothing\n }\n ?divider=${item.divider}\n ?data-selected=${item.isSelected === true}\n role=${\n item.isSelected !== undefined\n ? 'menuitemcheckbox'\n : nothing\n }\n aria-checked=${\n item.isSelected !== undefined\n ? String(item.isSelected)\n : nothing\n }\n data-testid=${item.testId || nothing}>\n ${item.text}\n </cds-custom-overflow-menu-item>\n `;\n }\n )}\n </cds-custom-overflow-menu-body>\n </cds-custom-overflow-menu>\n `\n : nothing\n }\n <div data-fixed class=\"${blockClass}__fixed-actions\">\n <slot name=\"fixed-actions\"></slot>\n </div>\n </div>\n </div>\n </div>\n `;\n }\n\n static styles = [commonStyles, styles];\n}\n\nexport { CDSAIChatToolbar };\nexport default CDSAIChatToolbar;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;;AAoBH,MAAM,UAAU,GAAG,CAAA,EAAG,MAAM,UAAU;AAgDtC;;;;;;;;;AASG;AAEH,IAAM,gBAAgB,GAAA,kBAAA,GAAtB,MAAM,gBAAiB,SAAQ,UAAU,CAAA;AAAzC,IAAA,WAAA,GAAA;;AACE;;AAEG;QACc,IAAA,CAAA,KAAK,GAAG,KAAK;;QAI9B,IAAA,CAAA,OAAO,GAAa,EAAE;;QAItB,IAAA,CAAA,QAAQ,GAAG,KAAK;QAs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AM,EAAE;AACR,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAKoB,UAAA,CAAA;AAArC,IAAA,KAAK,CAAC,CAAA,CAAA,EAAI,UAAU,CAAA,KAAA,CAAO;AAAkC,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,WAAA,EAAA,MAAA,CAAA;AAEtD,UAAA,CAAA;AADP,IAAA,KAAK,CAAC,CAAA,CAAA,EAAI,UAAU,CAAA,mBAAA,CAAqB;AACH,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,MAAA,CAAA;AAG/B,UAAA,CAAA;AADP,IAAA,KAAK,CAAC,CAAA,CAAA,EAAI,UAAU,CAAA,qBAAA,CAAuB;AACH,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,MAAA,CAAA;AAGjC,UAAA,CAAA;AADP,IAAA,KAAK,CAAC,CAAA,CAAA,EAAI,UAAU,CAAA,eAAA,CAAiB;AACH,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAG3B,UAAA,CAAA;AADP,IAAA,KAAK;AACqB,CAAA,EAAA,gBAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAlCvB,gBAAgB,GAAA,kBAAA,GAAA,UAAA,CAAA;IADrB,aAAa,CAAC,UAAU;AACnB,CAAA,EAAA,gBAAgB,CAmbrB;AAGD,yBAAe,gBAAgB;;"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * @license
3
+ *
4
+ * Copyright IBM Corp. 2026
5
+ *
6
+ * This source code is licensed under the Apache-2.0 license found in the
7
+ * LICENSE file in the root directory of this source tree.
8
+ */
9
+ import './src/user-avatar.js';
10
+ export { default as CDSAIChatUserAvatar } from './src/user-avatar.js';
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ export { default as CDSAIChatUserAvatar } from './src/user-avatar.js';
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;"}
@@ -0,0 +1,46 @@
1
+ import { LitElement, type PropertyValues } from 'lit';
2
+ /**
3
+ * Shows a person as a profile image, the first letter of their name, or a
4
+ * default user icon. It tries them in that order: a missing or failed image
5
+ * falls back to the initial, and a name with no usable initial falls back to
6
+ * the icon.
7
+ *
8
+ * @experimental
9
+ * @element cds-custom-aichat-user-avatar
10
+ */
11
+ declare class CDSAIChatUserAvatar extends LitElement {
12
+ static styles: any[];
13
+ /**
14
+ * The user's name. Its first character is the fallback initial when the
15
+ * name only contains characters from U+0020 to U+00FE. Any other name, or no
16
+ * name, shows the user icon.
17
+ */
18
+ name: string;
19
+ /**
20
+ * URL of the profile image. If the image fails to load, the avatar shows the
21
+ * initial or icon. Changing the URL tries the new image.
22
+ */
23
+ image: string;
24
+ /**
25
+ * Accessible label for the avatar.
26
+ */
27
+ label: string;
28
+ /**
29
+ * Width of the avatar, as a CSS length such as `48px`. Defaults to 2rem.
30
+ */
31
+ width: string;
32
+ /**
33
+ * Height of the avatar, as a CSS length such as `48px`. Defaults to 2rem.
34
+ */
35
+ height: string;
36
+ /** Whether the current `image` failed to load. */
37
+ private _hasImageError;
38
+ private readonly _avatar;
39
+ protected willUpdate(changed: PropertyValues): void;
40
+ protected updated(changed: PropertyValues): void;
41
+ private _onImageError;
42
+ private _renderContent;
43
+ render(): import("lit-html").TemplateResult<1>;
44
+ }
45
+ export { CDSAIChatUserAvatar };
46
+ export default CDSAIChatUserAvatar;
@@ -0,0 +1,153 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { __decorate } from 'tslib';
9
+ import { LitElement, nothing, html } from 'lit';
10
+ import { property, state, query } from 'lit/decorators.js';
11
+ import { iconLoader } from '@carbon/web-components/es-custom/globals/internal/icon-loader.js';
12
+ import UserAvatar32 from '@carbon/icons/es/user--avatar/32.js';
13
+ import { carbonElement } from '../../../globals/decorators/carbon-element.js';
14
+ import prefix from '../../../globals/settings.js';
15
+ import commonStyles from '../../../globals/scss/common.scss.js';
16
+ import styles from './user-avatar.scss.js';
17
+
18
+ /*
19
+ * Copyright IBM Corp. 2026
20
+ *
21
+ * This source code is licensed under the Apache-2.0 license found in the
22
+ * LICENSE file in the root directory of this source tree.
23
+ *
24
+ * @license
25
+ */
26
+ const blockClass = `${prefix}-user-avatar`;
27
+ /**
28
+ * A name made only of characters from U+0020 to U+00FE can use its first
29
+ * character as an initial. Browsers cannot reliably detect Latin script, so a
30
+ * name with any other character, such as Chinese, gets the icon instead.
31
+ */
32
+ const INITIAL_PATTERN = /^[\x20-\xFE]+$/;
33
+ /**
34
+ * Shows a person as a profile image, the first letter of their name, or a
35
+ * default user icon. It tries them in that order: a missing or failed image
36
+ * falls back to the initial, and a name with no usable initial falls back to
37
+ * the icon.
38
+ *
39
+ * @experimental
40
+ * @element cds-custom-aichat-user-avatar
41
+ */
42
+ let CDSAIChatUserAvatar = class CDSAIChatUserAvatar extends LitElement {
43
+ constructor() {
44
+ super(...arguments);
45
+ /**
46
+ * The user's name. Its first character is the fallback initial when the
47
+ * name only contains characters from U+0020 to U+00FE. Any other name, or no
48
+ * name, shows the user icon.
49
+ */
50
+ this.name = '';
51
+ /**
52
+ * URL of the profile image. If the image fails to load, the avatar shows the
53
+ * initial or icon. Changing the URL tries the new image.
54
+ */
55
+ this.image = '';
56
+ /**
57
+ * Accessible label for the avatar.
58
+ */
59
+ this.label = '';
60
+ /**
61
+ * Width of the avatar, as a CSS length such as `48px`. Defaults to 2rem.
62
+ */
63
+ this.width = '';
64
+ /**
65
+ * Height of the avatar, as a CSS length such as `48px`. Defaults to 2rem.
66
+ */
67
+ this.height = '';
68
+ /** Whether the current `image` failed to load. */
69
+ this._hasImageError = false;
70
+ this._onImageError = () => {
71
+ this._hasImageError = true;
72
+ };
73
+ }
74
+ willUpdate(changed) {
75
+ // A new URL deserves a new attempt, so forget the earlier failure.
76
+ if (changed.has('image')) {
77
+ this._hasImageError = false;
78
+ }
79
+ }
80
+ updated(changed) {
81
+ if (changed.has('width')) {
82
+ this._avatar.style.inlineSize = this.width;
83
+ }
84
+ if (changed.has('height')) {
85
+ this._avatar.style.blockSize = this.height;
86
+ }
87
+ }
88
+ _renderContent() {
89
+ const label = this.label || nothing;
90
+ const role = this.label ? 'img' : nothing;
91
+ if (this.image && !this._hasImageError) {
92
+ return html `<img
93
+ class="${blockClass}__image"
94
+ src=${this.image}
95
+ alt=${this.label}
96
+ @error=${this._onImageError} />`;
97
+ }
98
+ const hidden = this.label ? nothing : 'true';
99
+ if (INITIAL_PATTERN.test(this.name)) {
100
+ return html `<div
101
+ class="${blockClass}__initial"
102
+ role=${role}
103
+ aria-label=${label}
104
+ aria-hidden=${hidden}>
105
+ <div class="${blockClass}__letter">${this.name.trim().charAt(0)}</div>
106
+ </div>`;
107
+ }
108
+ return html `<div
109
+ class="${blockClass}__icon"
110
+ role=${role}
111
+ aria-label=${label}
112
+ aria-hidden=${hidden}>
113
+ ${iconLoader(UserAvatar32, {
114
+ class: `${blockClass}__icon-svg`,
115
+ 'aria-hidden': 'true',
116
+ })}
117
+ </div>`;
118
+ }
119
+ render() {
120
+ return html `<div class="${blockClass}__avatar">
121
+ ${this._renderContent()}
122
+ </div>`;
123
+ }
124
+ };
125
+ CDSAIChatUserAvatar.styles = [commonStyles, styles];
126
+ __decorate([
127
+ property({ type: String })
128
+ ], CDSAIChatUserAvatar.prototype, "name", void 0);
129
+ __decorate([
130
+ property({ type: String })
131
+ ], CDSAIChatUserAvatar.prototype, "image", void 0);
132
+ __decorate([
133
+ property({ type: String })
134
+ ], CDSAIChatUserAvatar.prototype, "label", void 0);
135
+ __decorate([
136
+ property({ type: String })
137
+ ], CDSAIChatUserAvatar.prototype, "width", void 0);
138
+ __decorate([
139
+ property({ type: String })
140
+ ], CDSAIChatUserAvatar.prototype, "height", void 0);
141
+ __decorate([
142
+ state()
143
+ ], CDSAIChatUserAvatar.prototype, "_hasImageError", void 0);
144
+ __decorate([
145
+ query(`.${blockClass}__avatar`)
146
+ ], CDSAIChatUserAvatar.prototype, "_avatar", void 0);
147
+ CDSAIChatUserAvatar = __decorate([
148
+ carbonElement(blockClass)
149
+ ], CDSAIChatUserAvatar);
150
+ var CDSAIChatUserAvatar$1 = CDSAIChatUserAvatar;
151
+
152
+ export { CDSAIChatUserAvatar, CDSAIChatUserAvatar$1 as default };
153
+ //# sourceMappingURL=user-avatar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-avatar.js","sources":["../../../../src/components/user-avatar/src/user-avatar.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, nothing, type PropertyValues } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\nimport { iconLoader } from '@carbon/web-components/es-custom/globals/internal/icon-loader.js';\nimport UserAvatar32 from '@carbon/icons/es/user--avatar/32.js';\nimport { carbonElement } from '../../../globals/decorators/index.js';\nimport prefix from '../../../globals/settings.js';\nimport commonStyles from '../../../globals/scss/common.scss?lit';\nimport styles from './user-avatar.scss?lit';\n\nconst blockClass = `${prefix}-user-avatar`;\n\n/**\n * A name made only of characters from U+0020 to U+00FE can use its first\n * character as an initial. Browsers cannot reliably detect Latin script, so a\n * name with any other character, such as Chinese, gets the icon instead.\n */\nconst INITIAL_PATTERN = /^[\\x20-\\xFE]+$/;\n\n/**\n * Shows a person as a profile image, the first letter of their name, or a\n * default user icon. It tries them in that order: a missing or failed image\n * falls back to the initial, and a name with no usable initial falls back to\n * the icon.\n *\n * @experimental\n * @element cds-custom-aichat-user-avatar\n */\n@carbonElement(blockClass)\nclass CDSAIChatUserAvatar extends LitElement {\n static styles = [commonStyles, styles];\n\n /**\n * The user's name. Its first character is the fallback initial when the\n * name only contains characters from U+0020 to U+00FE. Any other name, or no\n * name, shows the user icon.\n */\n @property({ type: String })\n name = '';\n\n /**\n * URL of the profile image. If the image fails to load, the avatar shows the\n * initial or icon. Changing the URL tries the new image.\n */\n @property({ type: String })\n image = '';\n\n /**\n * Accessible label for the avatar.\n */\n @property({ type: String })\n label = '';\n\n /**\n * Width of the avatar, as a CSS length such as `48px`. Defaults to 2rem.\n */\n @property({ type: String })\n width = '';\n\n /**\n * Height of the avatar, as a CSS length such as `48px`. Defaults to 2rem.\n */\n @property({ type: String })\n height = '';\n\n /** Whether the current `image` failed to load. */\n @state()\n private _hasImageError = false;\n\n @query(`.${blockClass}__avatar`)\n private readonly _avatar!: HTMLElement;\n\n protected willUpdate(changed: PropertyValues) {\n // A new URL deserves a new attempt, so forget the earlier failure.\n if (changed.has('image')) {\n this._hasImageError = false;\n }\n }\n\n protected updated(changed: PropertyValues) {\n if (changed.has('width')) {\n this._avatar.style.inlineSize = this.width;\n }\n if (changed.has('height')) {\n this._avatar.style.blockSize = this.height;\n }\n }\n\n private _onImageError = (): void => {\n this._hasImageError = true;\n };\n\n private _renderContent() {\n const label = this.label || nothing;\n const role = this.label ? 'img' : nothing;\n\n if (this.image && !this._hasImageError) {\n return html`<img\n class=\"${blockClass}__image\"\n src=${this.image}\n alt=${this.label}\n @error=${this._onImageError} />`;\n }\n\n const hidden = this.label ? nothing : 'true';\n\n if (INITIAL_PATTERN.test(this.name)) {\n return html`<div\n class=\"${blockClass}__initial\"\n role=${role}\n aria-label=${label}\n aria-hidden=${hidden}>\n <div class=\"${blockClass}__letter\">${this.name.trim().charAt(0)}</div>\n </div>`;\n }\n\n return html`<div\n class=\"${blockClass}__icon\"\n role=${role}\n aria-label=${label}\n aria-hidden=${hidden}>\n ${iconLoader(UserAvatar32, {\n class: `${blockClass}__icon-svg`,\n 'aria-hidden': 'true',\n })}\n </div>`;\n }\n\n render() {\n return html`<div class=\"${blockClass}__avatar\">\n ${this._renderContent()}\n </div>`;\n }\n}\n\nexport { CDSAIChatUserAvatar };\nexport default CDSAIChatUserAvatar;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAWH,MAAM,UAAU,GAAG,CAAA,EAAG,MAAM,cAAc;AAE1C;;;;AAIG;AACH,MAAM,eAAe,GAAG,gBAAgB;AAExC;;;;;;;;AAQG;AAEH,IAAM,mBAAmB,GAAzB,MAAM,mBAAoB,SAAQ,UAAU,CAAA;AAA5C,IAAA,WAAA,GAAA;;AAGE;;;;AAIG;QAEH,IAAA,CAAA,IAAI,GAAG,EAAE;AAET;;;AAGG;QAEH,IAAA,CAAA,KAAK,GAAG,EAAE;AAEV;;AAEG;QAEH,IAAA,CAAA,KAAK,GAAG,EAAE;AAEV;;AAEG;QAEH,IAAA,CAAA,KAAK,GAAG,EAAE;AAEV;;AAEG;QAEH,IAAA,CAAA,MAAM,GAAG,EAAE;;QAIH,IAAA,CAAA,cAAc,GAAG,KAAK;QAqBtB,IAAA,CAAA,aAAa,GAAG,MAAW;AACjC,YAAA,IAAI,CAAC,cAAc,GAAG,IAAI;AAC5B,QAAA,CAAC;IA2CH;AA7DY,IAAA,UAAU,CAAC,OAAuB,EAAA;;AAE1C,QAAA,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;AACxB,YAAA,IAAI,CAAC,cAAc,GAAG,KAAK;QAC7B;IACF;AAEU,IAAA,OAAO,CAAC,OAAuB,EAAA;AACvC,QAAA,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,EAAE;YACxB,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,UAAU,GAAG,IAAI,CAAC,KAAK;QAC5C;AACA,QAAA,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE;YACzB,IAAI,CAAC,OAAO,CAAC,KAA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QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AAChB,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAOV,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AACf,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAMX,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AACf,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAMX,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AACf,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAMX,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE;AACd,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,QAAA,EAAA,MAAA,CAAA;AAIJ,UAAA,CAAA;AADP,IAAA,KAAK;AACyB,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,gBAAA,EAAA,MAAA,CAAA;AAGd,UAAA,CAAA;AADhB,IAAA,KAAK,CAAC,CAAA,CAAA,EAAI,UAAU,CAAA,QAAA,CAAU;AACQ,CAAA,EAAA,mBAAA,CAAA,SAAA,EAAA,SAAA,EAAA,MAAA,CAAA;AAzCnC,mBAAmB,GAAA,UAAA,CAAA;IADxB,aAAa,CAAC,UAAU;AACnB,CAAA,EAAA,mBAAmB,CAwGxB;AAGD,4BAAe,mBAAmB;;"}
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Copyright IBM Corp. 2025
3
+ *
4
+ * This source code is licensed under the Apache-2.0 license found in the
5
+ * LICENSE file in the root directory of this source tree.
6
+ */
7
+
8
+ import { css } from 'lit';
9
+
10
+ var styles = css([":host(cds-custom-aichat-user-avatar){display:inline-block;flex-shrink:0;font-size:var(--cds-body-01-font-size,.875rem);font-weight:var(--cds-body-01-font-weight,400);letter-spacing:var(--cds-body-01-letter-spacing,.16px);line-height:var(--cds-body-01-line-height,1.42857);vertical-align:middle}.cds-custom-aichat-user-avatar__avatar{align-items:center;block-size:2rem;border-radius:50%;display:flex;inline-size:2rem;justify-content:center;overflow:hidden}.cds-custom-aichat-user-avatar__image{block-size:100%;inline-size:100%;-o-object-fit:cover;object-fit:cover}.cds-custom-aichat-user-avatar__initial{background-color:transparent;block-size:100%;border:2px solid;border-radius:50%;box-sizing:border-box;font-weight:700;inline-size:100%;padding:.125rem}.cds-custom-aichat-user-avatar__letter{line-height:1;text-align:center}.cds-custom-aichat-user-avatar__icon,.cds-custom-aichat-user-avatar__letter{align-items:center;block-size:100%;display:flex;justify-content:center}.cds-custom-aichat-user-avatar__icon{inline-size:100%}.cds-custom-aichat-user-avatar__icon-svg{block-size:100%;fill:currentcolor;inline-size:100%}"]);
11
+
12
+ export { styles as default };
13
+ //# sourceMappingURL=user-avatar.scss.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"user-avatar.scss.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;"}
@@ -186,6 +186,7 @@ function carbonIconToReact(icon) {
186
186
  height: icon.attrs.height || 16,
187
187
  fill: icon.attrs.fill || 'currentColor',
188
188
  focusable: 'false',
189
+ tabIndex: -1,
189
190
  style: { pointerEvents: 'none' },
190
191
  ...props,
191
192
  }, icon.content.map((child, i) => React.createElement(child.elem, { key: i, ...(child.attrs || {}) })));