@carbon/ai-chat-components 1.12.0 → 1.13.0-rc.2

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 (153) hide show
  1. package/custom-elements.json +4456 -4079
  2. package/es/components/chat-button/src/chat-button.scss.js +1 -1
  3. package/es/components/chat-history/src/chat-history.scss.js +1 -1
  4. package/es/components/chat-history/src/history-panel-item.js +0 -1
  5. package/es/components/chat-history/src/history-panel-item.js.map +1 -1
  6. package/es/components/chat-shell/src/panel-manager.d.ts +10 -0
  7. package/es/components/chat-shell/src/panel-manager.js +116 -1
  8. package/es/components/chat-shell/src/panel-manager.js.map +1 -1
  9. package/es/components/chat-shell/src/panel.d.ts +5 -0
  10. package/es/components/chat-shell/src/panel.js +16 -2
  11. package/es/components/chat-shell/src/panel.js.map +1 -1
  12. package/es/components/chat-shell/src/shell.d.ts +4 -0
  13. package/es/components/chat-shell/src/shell.js +72 -4
  14. package/es/components/chat-shell/src/shell.js.map +1 -1
  15. package/es/components/code-snippet/src/code-snippet.d.ts +3 -4
  16. package/es/components/code-snippet/src/code-snippet.js +4 -6
  17. package/es/components/code-snippet/src/code-snippet.js.map +1 -1
  18. package/es/components/code-snippet/src/codemirror/theme.js +2 -6
  19. package/es/components/code-snippet/src/codemirror/theme.js.map +1 -1
  20. package/es/components/code-snippet/src/layout-utils.d.ts +1 -3
  21. package/es/components/code-snippet/src/layout-utils.js.map +1 -1
  22. package/es/components/conversational-search/index.d.ts +9 -0
  23. package/es/components/conversational-search/index.js +9 -0
  24. package/es/components/conversational-search/index.js.map +1 -0
  25. package/es/components/conversational-search/src/citation-utils.d.ts +24 -0
  26. package/es/components/conversational-search/src/citation-utils.js +46 -0
  27. package/es/components/conversational-search/src/citation-utils.js.map +1 -0
  28. package/es/components/conversational-search/src/conversational-search-shell.d.ts +41 -0
  29. package/es/components/conversational-search/src/conversational-search-shell.js +116 -0
  30. package/es/components/conversational-search/src/conversational-search-shell.js.map +1 -0
  31. package/es/components/conversational-search/src/conversational-search-shell.scss.js +13 -0
  32. package/es/components/conversational-search/src/conversational-search-shell.scss.js.map +1 -0
  33. package/es/components/file-uploads/src/file-upload-item.js +3 -3
  34. package/es/components/file-uploads/src/file-upload-item.js.map +1 -1
  35. package/es/components/launcher/src/launcher.scss.js +1 -1
  36. package/es/components/markdown/src/markdown-token-tree.d.ts +2 -2
  37. package/es/components/markdown/src/markdown-token-tree.js.map +1 -1
  38. package/es/components/prompt-line/index.js +0 -2
  39. package/es/components/prompt-line/index.js.map +1 -1
  40. package/es/components/prompt-line/src/autocomplete-controller.js +13 -7
  41. package/es/components/prompt-line/src/autocomplete-controller.js.map +1 -1
  42. package/es/components/prompt-line/src/prompt-line-controller.d.ts +1 -1
  43. package/es/components/prompt-line/src/prompt-line-rich-loader.d.ts +7 -0
  44. package/es/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -1
  45. package/es/components/prompt-line/src/prompt-line-rich-runtime.js +8 -2
  46. package/es/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  47. package/es/components/prompt-line/src/prompt-line-shell.d.ts +42 -0
  48. package/es/components/prompt-line/src/prompt-line-shell.js +43 -1
  49. package/es/components/prompt-line/src/prompt-line-shell.js.map +1 -1
  50. package/es/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  51. package/es/components/prompt-line/src/prompt-line.d.ts +8 -2
  52. package/es/components/prompt-line/src/prompt-line.js +70 -10
  53. package/es/components/prompt-line/src/prompt-line.js.map +1 -1
  54. package/es/components/prompt-line/src/tiptap/index.d.ts +0 -2
  55. package/es/components/prompt-line/src/tiptap/index.js +0 -2
  56. package/es/components/prompt-line/src/tiptap/index.js.map +1 -1
  57. package/es/components/prompt-line/src/tiptap/resolve-config-items.d.ts +5 -1
  58. package/es/components/prompt-line/src/tiptap/resolve-config-items.js +9 -0
  59. package/es/components/prompt-line/src/tiptap/resolve-config-items.js.map +1 -1
  60. package/es/components/reasoning-steps/src/reasoning-step.js +2 -2
  61. package/es/components/reasoning-steps/src/reasoning-step.js.map +1 -1
  62. package/es/components/reasoning-steps/src/reasoning-step.scss.js +1 -1
  63. package/es/components/shared/dynamic-css-var-sheet.js +7 -6
  64. package/es/components/shared/dynamic-css-var-sheet.js.map +1 -1
  65. package/es/components/table/src/table.js +5 -7
  66. package/es/components/table/src/table.js.map +1 -1
  67. package/es/components/workspace-shell/src/workspace-shell.js +15 -5
  68. package/es/components/workspace-shell/src/workspace-shell.js.map +1 -1
  69. package/es/components/workspace-shell/src/workspace-shell.scss.js +1 -1
  70. package/es/globals/utils/iconTransform.d.ts +1 -1
  71. package/es/globals/utils/iconTransform.js.map +1 -1
  72. package/es/react/chat-shell.js +3 -0
  73. package/es/react/chat-shell.js.map +1 -1
  74. package/es/react/conversational-search-shell.d.ts +12 -0
  75. package/es/react/conversational-search-shell.js +32 -0
  76. package/es/react/conversational-search-shell.js.map +1 -0
  77. package/es-custom/components/chat-button/src/chat-button.scss.js +1 -1
  78. package/es-custom/components/chat-history/src/chat-history.scss.js +1 -1
  79. package/es-custom/components/chat-history/src/history-panel-item.js +0 -1
  80. package/es-custom/components/chat-history/src/history-panel-item.js.map +1 -1
  81. package/es-custom/components/chat-shell/src/panel-manager.d.ts +10 -0
  82. package/es-custom/components/chat-shell/src/panel-manager.js +116 -1
  83. package/es-custom/components/chat-shell/src/panel-manager.js.map +1 -1
  84. package/es-custom/components/chat-shell/src/panel.d.ts +5 -0
  85. package/es-custom/components/chat-shell/src/panel.js +16 -2
  86. package/es-custom/components/chat-shell/src/panel.js.map +1 -1
  87. package/es-custom/components/chat-shell/src/shell.d.ts +4 -0
  88. package/es-custom/components/chat-shell/src/shell.js +72 -4
  89. package/es-custom/components/chat-shell/src/shell.js.map +1 -1
  90. package/es-custom/components/code-snippet/src/code-snippet.d.ts +3 -4
  91. package/es-custom/components/code-snippet/src/code-snippet.js +4 -6
  92. package/es-custom/components/code-snippet/src/code-snippet.js.map +1 -1
  93. package/es-custom/components/code-snippet/src/codemirror/theme.js +2 -6
  94. package/es-custom/components/code-snippet/src/codemirror/theme.js.map +1 -1
  95. package/es-custom/components/code-snippet/src/layout-utils.d.ts +1 -3
  96. package/es-custom/components/code-snippet/src/layout-utils.js.map +1 -1
  97. package/es-custom/components/conversational-search/index.d.ts +9 -0
  98. package/es-custom/components/conversational-search/index.js +9 -0
  99. package/es-custom/components/conversational-search/index.js.map +1 -0
  100. package/es-custom/components/conversational-search/src/citation-utils.d.ts +24 -0
  101. package/es-custom/components/conversational-search/src/citation-utils.js +46 -0
  102. package/es-custom/components/conversational-search/src/citation-utils.js.map +1 -0
  103. package/es-custom/components/conversational-search/src/conversational-search-shell.d.ts +41 -0
  104. package/es-custom/components/conversational-search/src/conversational-search-shell.js +116 -0
  105. package/es-custom/components/conversational-search/src/conversational-search-shell.js.map +1 -0
  106. package/es-custom/components/conversational-search/src/conversational-search-shell.scss.js +13 -0
  107. package/es-custom/components/conversational-search/src/conversational-search-shell.scss.js.map +1 -0
  108. package/es-custom/components/file-uploads/src/file-upload-item.js +3 -3
  109. package/es-custom/components/file-uploads/src/file-upload-item.js.map +1 -1
  110. package/es-custom/components/launcher/src/launcher.scss.js +1 -1
  111. package/es-custom/components/markdown/src/markdown-token-tree.d.ts +2 -2
  112. package/es-custom/components/markdown/src/markdown-token-tree.js.map +1 -1
  113. package/es-custom/components/prompt-line/index.js +0 -2
  114. package/es-custom/components/prompt-line/index.js.map +1 -1
  115. package/es-custom/components/prompt-line/src/autocomplete-controller.js +13 -7
  116. package/es-custom/components/prompt-line/src/autocomplete-controller.js.map +1 -1
  117. package/es-custom/components/prompt-line/src/prompt-line-controller.d.ts +1 -1
  118. package/es-custom/components/prompt-line/src/prompt-line-rich-loader.d.ts +7 -0
  119. package/es-custom/components/prompt-line/src/prompt-line-rich-loader.js.map +1 -1
  120. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js +8 -2
  121. package/es-custom/components/prompt-line/src/prompt-line-rich-runtime.js.map +1 -1
  122. package/es-custom/components/prompt-line/src/prompt-line-shell.d.ts +42 -0
  123. package/es-custom/components/prompt-line/src/prompt-line-shell.js +43 -1
  124. package/es-custom/components/prompt-line/src/prompt-line-shell.js.map +1 -1
  125. package/es-custom/components/prompt-line/src/prompt-line-shell.scss.js +1 -1
  126. package/es-custom/components/prompt-line/src/prompt-line.d.ts +8 -2
  127. package/es-custom/components/prompt-line/src/prompt-line.js +70 -10
  128. package/es-custom/components/prompt-line/src/prompt-line.js.map +1 -1
  129. package/es-custom/components/prompt-line/src/tiptap/index.d.ts +0 -2
  130. package/es-custom/components/prompt-line/src/tiptap/index.js +0 -2
  131. package/es-custom/components/prompt-line/src/tiptap/index.js.map +1 -1
  132. package/es-custom/components/prompt-line/src/tiptap/resolve-config-items.d.ts +5 -1
  133. package/es-custom/components/prompt-line/src/tiptap/resolve-config-items.js +9 -0
  134. package/es-custom/components/prompt-line/src/tiptap/resolve-config-items.js.map +1 -1
  135. package/es-custom/components/reasoning-steps/src/reasoning-step.js +2 -2
  136. package/es-custom/components/reasoning-steps/src/reasoning-step.js.map +1 -1
  137. package/es-custom/components/reasoning-steps/src/reasoning-step.scss.js +1 -1
  138. package/es-custom/components/shared/dynamic-css-var-sheet.js +7 -6
  139. package/es-custom/components/shared/dynamic-css-var-sheet.js.map +1 -1
  140. package/es-custom/components/table/src/table.js +5 -7
  141. package/es-custom/components/table/src/table.js.map +1 -1
  142. package/es-custom/components/workspace-shell/src/workspace-shell.js +15 -5
  143. package/es-custom/components/workspace-shell/src/workspace-shell.js.map +1 -1
  144. package/es-custom/components/workspace-shell/src/workspace-shell.scss.js +1 -1
  145. package/es-custom/globals/utils/iconTransform.d.ts +1 -1
  146. package/es-custom/globals/utils/iconTransform.js.map +1 -1
  147. package/es-custom/react/chat-shell.js +3 -0
  148. package/es-custom/react/chat-shell.js.map +1 -1
  149. package/es-custom/react/conversational-search-shell.d.ts +12 -0
  150. package/es-custom/react/conversational-search-shell.js +32 -0
  151. package/es-custom/react/conversational-search-shell.js.map +1 -0
  152. package/package.json +9 -9
  153. package/telemetry.yml +6 -4
@@ -1 +1 @@
1
- {"version":3,"file":"table.js","sources":["../../../../src/components/table/src/table.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 { type CDSTableRow } from '@carbon/web-components';\nimport { TemplateResult, LitElement, PropertyValues, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { carbonElement } from '../../../globals/decorators';\nimport { tableSkeletonTemplate } from './table-skeleton.template';\nimport { loadTableRuntime } from './table-loader.js';\nimport { stringifyCSV } from '../../../globals/utils/csv.js';\nimport commonStyles from '../../../globals/scss/common.scss?lit';\nimport styles from './table.scss?lit';\nimport prefix from '../../../globals/settings.js';\n\ntype TableRuntimeModule = Awaited<ReturnType<typeof loadTableRuntime>>;\n\nexport interface TableCellContent {\n text: string;\n template?: TemplateResult | null;\n}\n\nexport interface TableRowContent {\n cells: TableCellContent[];\n}\n\ninterface PageChangeEvent extends Event {\n detail: {\n page: number;\n pageSize: number;\n };\n}\n\ninterface FilterEvent extends Event {\n detail: {\n unfilteredRows: CDSTableRow[];\n };\n}\n\ninterface TableRowWithIDs extends TableRowContent {\n id: string;\n}\n\n// Width threshold for determining default page size. Tables wider than this get 10 rows, narrower get 5 rows.\nconst PAGE_SIZE_WIDTH_THRESHOLD = 400;\n\n/**\n * Class functionality for the Table custom element.\n * @element cds-custom-aichat-table\n */\n@carbonElement(`${prefix}-table`)\nclass CDSAIChatTable extends LitElement {\n /**\n * The optional table title.\n */\n @property({ type: String, attribute: 'table-title' })\n tableTitle?: string;\n\n /**\n * The optional table description.\n */\n @property({ type: String, attribute: 'table-description' })\n tableDescription?: string;\n\n /**\n * The array of cells for the header.\n */\n @property({ type: Array, attribute: false })\n headers: TableCellContent[] = [];\n\n /**\n * The array of rows. Each row includes an array of cells.\n */\n @property({ type: Array, attribute: false })\n rows: TableRowContent[] = [];\n\n /**\n * Whether or not the table content is loading. If it is then a skeleton state should be shown instead.\n */\n @property({ type: Boolean, attribute: 'loading' })\n loading = false;\n\n /**\n * The text used for the filter placeholder.\n */\n @property({ type: String, attribute: 'filter-placeholder-text' })\n filterPlaceholderText = 'Filter table...';\n\n /**\n * The text used for the pagination's previous button tooltip.\n */\n @property({ type: String, attribute: 'previous-page-text' })\n previousPageText = 'Previous page';\n\n /**\n * The text used for the pagination's next button tooltip.\n */\n @property({ type: String, attribute: 'next-page-text' })\n nextPageText = 'Next page';\n\n /**\n * The text used for the pagination's item pre page text.\n */\n @property({ type: String, attribute: 'items-per-page-text' })\n itemsPerPageText = 'Items per page:';\n\n /**\n * The text used for the download button's accessible label.\n */\n @property({ type: String, attribute: 'download-label-text' })\n downloadLabelText = 'Download table data';\n\n /**\n * The locale. Used by the carbon table component to change the collator for sorting.\n */\n @property({ type: String, attribute: 'locale' })\n locale = 'en';\n\n /**\n * The calculated default page size based on component width.\n * 10 for width > PAGE_SIZE_WIDTH_THRESHOLD, 5 for width <= PAGE_SIZE_WIDTH_THRESHOLD.\n *\n * @internal\n */\n @state()\n private _defaultPageSize = 5;\n\n @property({ type: Number, attribute: 'default-page-size' })\n get defaultPageSize(): number {\n return this._defaultPageSize;\n }\n\n set defaultPageSize(value: number) {\n this._defaultPageSize = value;\n if (!this._rowsPerPageChanged) {\n this._currentPageSize = value;\n }\n }\n\n /**\n * The function used to get the supplemental text for the pagination component.\n */\n @property({ type: Function, attribute: false })\n getPaginationSupplementalText = ({ count }: { count: number }) =>\n `${count} items`;\n\n /**\n * The function used to get the status text for the pagination component.\n */\n @property({ type: Function, attribute: false })\n getPaginationStatusText = ({\n start,\n end,\n count,\n }: {\n start: number;\n end: number;\n count: number;\n }) => `${start}–${end} of ${count} items`;\n\n /**\n * If the table is valid or not.\n *\n * @internal\n */\n @state()\n protected _isValid = true;\n\n /**\n * The current page of the table we're on.\n *\n * @internal\n */\n @state()\n public _currentPageNumber = 1;\n\n /**\n * How many rows are on each page of the table.\n *\n * @internal\n */\n @state()\n public _currentPageSize: number = this.defaultPageSize;\n\n /**\n * Whether or not the number of rows per page was changed with the pagination component. If the user used the\n * pagination controls to show all rows, the pagination component would normally hide itself because the number of is\n * no longer greater than the page size. However the pagination component needs to persist in this case, since the\n * user may want to change the page size again. This is used to keep track of whether the pagination controls were\n * used to change page size, and if they have, it forces pagination component to persist.\n *\n * @internal\n */\n @state()\n public _rowsPerPageChanged = false;\n\n /**\n * The rows that have not been filtered out.\n *\n * @internal\n */\n @state()\n public _filterVisibleRowIDs: Set<string> = new Set();\n\n /**\n * Flag to track when row visibility needs to be updated after the DOM has rendered.\n * This is necessary because _updateVisibleRows() queries the DOM for rendered rows,\n * which don't exist yet during willUpdate(). Setting this flag defers the visibility\n * update until the updated() lifecycle method runs after rendering is complete.\n *\n * @internal\n */\n @state()\n private _needsVisibilityUpdate = false;\n\n /**\n * All of the rows for the table with IDs.\n *\n * @internal\n */\n @state()\n public _rowsWithIDs: TableRowWithIDs[] = [];\n\n /**\n * Whether or not the table should be able to be filtered.\n *\n * @internal\n */\n @state()\n public _allowFiltering = true;\n\n static styles = [commonStyles, styles];\n\n /**\n * @internal\n */\n private tableRuntime: TableRuntimeModule | null = null;\n\n /**\n * @internal\n */\n private tableRuntimePromise: Promise<TableRuntimeModule> | null = null;\n private hasRenderedLoadingFrame = false;\n\n connectedCallback() {\n super.connectedCallback();\n void this.ensureTableRuntime();\n }\n\n /**\n * Called after the element's DOM has been updated for the first time.\n * Initializes the table page size.\n *\n * @param _changedProperties - Map of properties that changed during the update\n */\n protected async firstUpdated(\n _changedProperties: PropertyValues\n ): Promise<void> {\n await this.updateComplete;\n this._updateDefaultPageSize();\n this._setPageSize();\n }\n\n /**\n * While loading we only need to paint the skeleton once. Streaming updates can\n * mutate rows/headers rapidly, so skip subsequent updates until loading ends.\n */\n protected shouldUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('loading')) {\n if (this.loading) {\n this.hasRenderedLoadingFrame = false;\n }\n return true;\n }\n\n if (this.loading && this.hasRenderedLoadingFrame) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Updates the CSS custom property `--cds-chat-table-width` based on the parent element's width.\n * Also calculates the default page size on first run based on the measured width.\n * This method is called once during component initialization.\n *\n * @private\n */\n private _updateDefaultPageSize() {\n if (this.parentElement) {\n let parentWidth = this.parentElement.offsetWidth;\n\n // If parent width is 0, use fallback width that ensures 5-row default page size\n if (parentWidth === 0) {\n parentWidth = PAGE_SIZE_WIDTH_THRESHOLD - 1;\n }\n\n // Calculate default page size based on the width we just measured\n // Only set it once, don't recalculate on resize\n if (parentWidth > 0 && this._defaultPageSize === 5) {\n this._defaultPageSize =\n parentWidth > PAGE_SIZE_WIDTH_THRESHOLD ? 10 : 5;\n\n // Update _currentPageSize if it's still at the initial value\n if (this._currentPageSize === 5) {\n this._currentPageSize = this._defaultPageSize;\n }\n }\n }\n }\n\n /**\n * Called before the element updates to prepare state changes.\n * Handles validation and re-initialization of table data when headers or rows change.\n *\n * @param changedProperties - Map of properties that changed during the update\n * @protected\n */\n protected willUpdate(changedProperties: PropertyValues<this>) {\n // Calculate default page size on first render to ensure correct page size is set.\n // For streaming tables: happens when loading=true (before skeleton renders)\n // For non-streaming tables: happens when rows are first set\n if (\n (changedProperties.has('loading') && this.loading) ||\n (changedProperties.has('rows') &&\n this.rows !== undefined &&\n !this.loading)\n ) {\n this._updateDefaultPageSize();\n }\n\n const loadingJustFinished =\n changedProperties.has('loading') &&\n changedProperties.get('loading') === true &&\n this.loading === false;\n\n // If the headers or rows has recently updated and both are defined than we should validate the table\n // data. This will likely only happen on the web components first render cycle when the props go from undefined to\n // defined.\n if (\n (changedProperties.has('headers') ||\n changedProperties.has('rows') ||\n loadingJustFinished) &&\n !this.loading &&\n this.headers !== undefined &&\n this.rows !== undefined\n ) {\n this._calcIsTableValid();\n }\n\n // If the value of tableRows updated then initialize the internal rows arrays.\n if (\n (changedProperties.has('rows') || loadingJustFinished) &&\n !this.loading &&\n this.rows !== undefined\n ) {\n this._initializeRowsArrays();\n // Set flag to update visibility after DOM renders, rather than calling _setPageSize() here.\n // This is critical for streaming tables where rows don't exist in the DOM yet during willUpdate().\n this._needsVisibilityUpdate = true;\n }\n }\n\n /**\n * Called after the element's DOM has been updated.\n * Handles deferred visibility updates that require the DOM to be fully rendered.\n *\n * This is essential for streaming tables: when loading completes, willUpdate() sets\n * _needsVisibilityUpdate=true, but the actual row elements don't exist in the DOM yet.\n * By deferring _updateVisibleRows() to this lifecycle method, we ensure the rows are\n * rendered and can be properly queried and hidden/shown for pagination.\n *\n * We use requestAnimationFrame to ensure Carbon Web Components table rows are fully\n * rendered in the DOM before attempting to query and hide/show them.\n *\n * @param changedProperties - Map of properties that changed during the update\n * @protected\n */\n protected updated(changedProperties: PropertyValues<this>) {\n super.updated(changedProperties);\n\n if (this._needsVisibilityUpdate) {\n this._needsVisibilityUpdate = false;\n // Use requestAnimationFrame to ensure Carbon table rows are fully rendered\n requestAnimationFrame(() => {\n this._updateVisibleRows();\n });\n }\n }\n\n /**\n * Validates the table structure by checking if all rows have the same number of cells as the header.\n * Sets the internal `_isValid` state to false if any row has a mismatched cell count.\n *\n * A valid table requires:\n * - All rows must have the same number of cells as there are headers\n * - No rows can have more or fewer cells than the column count\n *\n * @private\n */\n private _calcIsTableValid() {\n const columnCount = this.headers.length;\n // If one of the rows has a different number of cells than the number of columns in the header then set our internal\n // valid state to false.\n this._isValid = !this.rows.some((row) => row.cells.length !== columnCount);\n // In the future, once we have an inlineError web component to use, we can render that when our table is not valid\n // (as well as throwing the below error). Until then our React container is rendering the error component and\n // throwing the error.\n\n // throw new Error(\n // `${WA_CONSOLE_PREFIX} Number of cells in the table header does not match the number of cells in one or more of the table rows. In order to render a table there needs to be the same number of columns in the table header and all of the table rows.`,\n // );\n }\n\n /**\n * Initializes internal arrays used for table functionality.\n * Creates a new array of rows with unique IDs and initializes the filter visibility tracking.\n *\n * This method:\n * 1. Resets the `_rowsWithIDs` array and `_filterVisibleRowIDs` set\n * 2. Assigns string-based IDs to each row for tracking purposes\n * 3. Marks all rows as initially visible (not filtered out)\n *\n * @private\n */\n private _initializeRowsArrays() {\n // Reset both arrays.\n this._rowsWithIDs = [];\n this._filterVisibleRowIDs = new Set();\n\n this.rows.forEach((row, index) => {\n const id = index.toString();\n this._rowsWithIDs.push({ ...row, id });\n this._filterVisibleRowIDs.add(id);\n });\n }\n\n /**\n * Configures the table's page size and filtering behavior.\n * Determines whether filtering/searching should be enabled based on the number of rows\n * relative to the current page size.\n *\n * Filtering is enabled when there are more rows than can fit on a single page,\n * allowing users to search and paginate through large datasets.\n *\n * This method is called from firstUpdated() for non-streaming tables where the DOM\n * is already rendered. For streaming tables, visibility updates are deferred via the\n * _needsVisibilityUpdate flag and handled in updated() lifecycle method.\n *\n * @private\n */\n private _setPageSize() {\n // If there are more rows than the page size then enable filtering.\n // this._allowFiltering = this.rows.length > this._currentPageSize;\n\n // Update visible rows. This is safe to call here because _setPageSize() is only\n // called from firstUpdated(), which runs after the DOM is rendered.\n this._updateVisibleRows();\n }\n\n private async ensureTableRuntime(): Promise<TableRuntimeModule | null> {\n if (this.tableRuntime) {\n return this.tableRuntime;\n }\n\n if (typeof window === 'undefined') {\n return null;\n }\n\n if (!this.tableRuntimePromise) {\n this.tableRuntimePromise = loadTableRuntime();\n }\n\n try {\n const runtime = await this.tableRuntimePromise;\n this.tableRuntime = runtime;\n // When runtime loads for the first time, we need to update row visibility\n // because we're transitioning from skeleton to actual table\n if (!this.loading && this.rows !== undefined && this.rows.length > 0) {\n this._needsVisibilityUpdate = true;\n }\n this.requestUpdate();\n return runtime;\n } catch (error) {\n console.error('Failed to load table runtime', error);\n this.tableRuntimePromise = null;\n return null;\n }\n }\n\n /**\n * Handles pagination events from the Carbon pagination component.\n * Updates the visible rows when the user navigates to a different page.\n *\n * Note: This event sometimes fires twice due to a Carbon framework quirk,\n * but since the page/size values are identical, it doesn't affect functionality.\n *\n * @param event - The page change event containing the new page number and size\n * @public\n *\n * @internal\n */\n public _handlePageChangeEvent = (event: PageChangeEvent) => {\n this._updateVisibleRows(event.detail?.page, event.detail?.pageSize);\n event.stopPropagation();\n };\n\n /**\n * Handles page size change events from the pagination component.\n * Updates the current page size and recalculates visible rows.\n * Marks that the page size has been manually changed by the user.\n *\n * @param event - The page size change event containing the new page size\n * @public\n *\n * @internal\n */\n public _handlePageSizeChangeEvent = (event: PageChangeEvent) => {\n this._rowsPerPageChanged = true;\n this._currentPageSize = event.detail?.pageSize;\n this._updateVisibleRows();\n event.stopPropagation();\n };\n\n /**\n * Handles filter and sort events from the Carbon table component.\n * Updates the set of visible rows based on filtering/sorting results and resets to the first page.\n *\n * This event is triggered by:\n * - Column sorting (clicking on sortable column headers)\n * - Table filtering (using the search bar)\n *\n * @param event - The filter event containing the array of unfiltered rows\n * @public\n *\n * @internal\n */\n public _handleFilterEvent = (event: FilterEvent) => {\n // Record the new set of unfiltered row ids.\n this._filterVisibleRowIDs = new Set(\n event?.detail?.unfilteredRows.map((row) => row.id)\n );\n\n // Go back to the first page.\n this._currentPageNumber = 1;\n\n // Update which rows are visible.\n this._updateVisibleRows();\n event.stopPropagation();\n };\n\n /**\n * Controls which table rows are visible based on pagination and filtering.\n * Uses CSS display properties to show/hide rows rather than DOM manipulation.\n *\n * This approach is necessary because Carbon's table component handles its own\n * sorting and we need to preserve the DOM order it creates. The method:\n * 1. Hides all rows initially\n * 2. Filters to only rows that haven't been filtered out\n * 3. Shows only the rows that belong to the current page\n *\n * @param page - The page number to display (1-based)\n * @param pageSize - Number of rows per page\n * @private\n */\n private _updateVisibleRows(\n page: number = this._currentPageNumber,\n pageSize: number = this._currentPageSize\n ) {\n // Set the current page number and only show the rows for that page.\n this._currentPageNumber = page;\n\n // Grab all the rows that have been rendered. It's necessary to grab them from the page because the cds-custom-table puts\n // the rows in a specific order when sorting and we want to preserve that order.\n const rows: HTMLElement[] = Array.from(\n this.renderRoot.querySelectorAll('cds-custom-table-row')\n );\n\n // This is similar to the carbon example here https://stackblitz.com/edit/github-kbd9xw-s3y3s6?file=index.html. I\n // originally tried creating and passing an array of the specific rows the template should render for the current\n // page. Unfortunately doing that doesn't work with the combination of the is-sortable prop for the table and\n // page-size prop for pagination. What would happen is old rows would persist if you were on the last page and there\n // weren't enough rows to fill the page (even though the old rows weren't included in the new rows provided to the\n // template). Using Carbon's example of hiding the rows with styling works so I'm extending that concept here even\n // though, ideally, render controls the view and reacts to the state that would be determined here.\n\n // Hide all the rows to start. Using a data attribute (not inline style)\n // so a strict CSP can drop style-src-attr 'unsafe-inline'; the matching\n // rule lives in table.scss.\n rows.forEach((row) => row.toggleAttribute('data-hidden', true));\n\n // Now filter the rows down to what is visible according to the filter.\n const filterVisibleRows = rows.filter((row) =>\n this._filterVisibleRowIDs.has(row.id)\n );\n\n // Now show all the rows that are within the current page.\n const pageStart = (page - 1) * pageSize;\n const pageEnd = page * pageSize - 1;\n for (let index = pageStart; index <= pageEnd; index++) {\n // If there is a row at that index then show it. If there aren't enough rows to fill the page then there won't be\n // a row at that index.\n filterVisibleRows[index]?.removeAttribute('data-hidden');\n }\n }\n\n /**\n * Handles the table download functionality by exporting all table data as a CSV file.\n *\n * This custom implementation is necessary because Carbon's default download feature:\n * - Only exports selected rows (we want all data)\n * - Only exports as JSON (we want CSV format)\n * - Doesn't include all the data we need\n *\n * The method creates a data URL to comply with CSP policies, and triggers a download.\n *\n * @public\n */\n public async _handleDownload() {\n // Don't save content from the expandable rows at this time. This could be added in the future but it's unclear how\n // this would look in the download.\n const tableArray: (string | number)[][] = [\n this.headers.map((cell) => cell.text),\n ...this.rows.map((row) => row.cells.map((cell) => cell.text)),\n ];\n\n try {\n const csvContent = stringifyCSV(tableArray);\n\n // Use data URL instead of Blob to avoid CSP issues with object-src\n const dataUrl = `data:text/csv;charset=utf-8,${encodeURIComponent(\n csvContent\n )}`;\n\n // Create and trigger download using anchor element. The native `hidden`\n // attribute is used (not an inline style) so a strict CSP can drop\n // style-src-attr 'unsafe-inline'; the link is removed synchronously\n // after click() so no flash is observed.\n const link = document.createElement('a');\n link.setAttribute('href', dataUrl);\n link.setAttribute('download', 'table-data.csv');\n link.hidden = true;\n document.body.appendChild(link);\n\n // Trigger download and cleanup\n link.click();\n document.body.removeChild(link);\n } catch (error) {\n console.error('Failed to download table data:', error);\n // Fallback: could show user notification or use alternative method\n }\n }\n\n /**\n * Renders the table component based on current state and data.\n *\n * The render logic follows this priority:\n * 1. Shows skeleton loading state if `loading` is true\n * 2. Shows table with pagination if there are more rows than the page size OR pagination was used\n * 3. Shows table only if all rows fit on one page\n *\n * The method also applies the appropriate Carbon theme class (cds-custom--g90 for dark, cds-custom--white for light)\n * to ensure proper styling based on the `dark` property.\n *\n * @returns The lit-html template for the table component\n * @public\n */\n render() {\n // TODO TABLE: Once we have a web component version of the inline error state we could render that here if\n // !this._isValid.\n\n // This could be used while we wait for a md stream containing a table to complete.\n const runtime = this.tableRuntime;\n if (this.loading || !runtime) {\n this.hasRenderedLoadingFrame = true;\n if (!runtime) {\n void this.ensureTableRuntime();\n }\n return tableSkeletonTemplate(this._currentPageSize);\n }\n this.hasRenderedLoadingFrame = false;\n\n const { tableTemplate, tablePaginationTemplate } = runtime;\n\n // If there are more rows than the page size then we need to add the pagination component. If the rows per page has\n // been changed by the pagination component then we need to keep the pagination component around so the user can\n // change the page size again, even if the current page size is the same as the number of table rows.\n if (this.rows.length > this._currentPageSize || this._rowsPerPageChanged) {\n return html`<div class=\"cds-custom-ai-chat-table-container\">\n ${tableTemplate(this)}\n ${tablePaginationTemplate({\n _currentPageSize: this._currentPageSize,\n _currentPageNumber: this._currentPageNumber,\n _filterVisibleRowIDs: this._filterVisibleRowIDs,\n rows: this.rows,\n previousPageText: this.previousPageText,\n nextPageText: this.nextPageText,\n itemsPerPageText: this.itemsPerPageText,\n getPaginationSupplementalText: this.getPaginationSupplementalText,\n getPaginationStatusText: this.getPaginationStatusText,\n _handlePageChangeEvent: this._handlePageChangeEvent,\n _handlePageSizeChangeEvent: this._handlePageSizeChangeEvent,\n })}\n </div>`;\n }\n\n // Otherwise, just render the table.\n return html`<div class=\"cds-custom-ai-chat-table-container\">\n ${tableTemplate(this)}\n </div>`;\n }\n}\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'cds-custom-aichat-table': CDSAIChatTable;\n }\n}\n\nexport { CDSAIChatTable };\nexport default CDSAIChatTable;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAyCH;AACA,MAAM,yBAAyB,GAAG,GAAG;AAErC;;;AAGG;AAEH,IAAM,cAAc,GAApB,MAAM,cAAe,SAAQ,UAAU,CAAA;AAAvC,IAAA,WAAA,GAAA;;AAaE;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAuB,EAAE;AAEhC;;AAEG;QAEH,IAAA,CAAA,IAAI,GAAsB,EAAE;AAE5B;;AAEG;QAEH,IAAA,CAAA,OAAO,GAAG,KAAK;AAEf;;AAEG;QAEH,IAAA,CAAA,qBAAqB,GAAG,iBAAiB;AAEzC;;AAEG;QAEH,IAAA,CAAA,gBAAgB,GAAG,eAAe;AAElC;;AAEG;QAEH,IAAA,CAAA,YAAY,GAAG,WAAW;AAE1B;;AAEG;QAEH,IAAA,CAAA,gBAAgB,GAAG,iBAAiB;AAEpC;;AAEG;QAEH,IAAA,CAAA,iBAAiB,GAAG,qBAAqB;AAEzC;;AAEG;QAEH,IAAA,CAAA,MAAM,GAAG,IAAI;AAEb;;;;;AAKG;QAEK,IAAA,CAAA,gBAAgB,GAAG,CAAC;AAc5B;;AAEG;QAEH,IAAA,CAAA,6BAA6B,GAAG,CAAC,EAAE,KAAK,EAAqB,KAC3D,CAAA,EAAG,KAAK,CAAA,MAAA,CAAQ;AAElB;;AAEG;AAEH,QAAA,IAAA,CAAA,uBAAuB,GAAG,CAAC,EACzB,KAAK,EACL,GAAG,EACH,KAAK,GAKN,KAAK,GAAG,KAAK,CAAA,CAAA,EAAI,GAAG,CAAA,IAAA,EAAO,KAAK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,"file":"table.js","sources":["../../../../src/components/table/src/table.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 type CDSTableRow from '@carbon/web-components/es-custom/components/data-table/table-row.js';\nimport { TemplateResult, LitElement, PropertyValues, html } from 'lit';\nimport { property, state } from 'lit/decorators.js';\nimport { carbonElement } from '../../../globals/decorators';\nimport { tableSkeletonTemplate } from './table-skeleton.template';\nimport { loadTableRuntime } from './table-loader.js';\nimport { stringifyCSV } from '../../../globals/utils/csv.js';\nimport commonStyles from '../../../globals/scss/common.scss?lit';\nimport styles from './table.scss?lit';\nimport prefix from '../../../globals/settings.js';\n\ntype TableRuntimeModule = Awaited<ReturnType<typeof loadTableRuntime>>;\n\nexport interface TableCellContent {\n text: string;\n template?: TemplateResult | null;\n}\n\nexport interface TableRowContent {\n cells: TableCellContent[];\n}\n\ninterface PageChangeEvent extends Event {\n detail: {\n page: number;\n pageSize: number;\n };\n}\n\ninterface FilterEvent extends Event {\n detail: {\n unfilteredRows: CDSTableRow[];\n };\n}\n\ninterface TableRowWithIDs extends TableRowContent {\n id: string;\n}\n\n// Width threshold for determining default page size. Tables wider than this get 10 rows, narrower get 5 rows.\nconst PAGE_SIZE_WIDTH_THRESHOLD = 400;\n\n/**\n * Class functionality for the Table custom element.\n * @element cds-custom-aichat-table\n */\n@carbonElement(`${prefix}-table`)\nclass CDSAIChatTable extends LitElement {\n /**\n * The optional table title.\n */\n @property({ type: String, attribute: 'table-title' })\n tableTitle?: string;\n\n /**\n * The optional table description.\n */\n @property({ type: String, attribute: 'table-description' })\n tableDescription?: string;\n\n /**\n * The array of cells for the header.\n */\n @property({ type: Array, attribute: false })\n headers: TableCellContent[] = [];\n\n /**\n * The array of rows. Each row includes an array of cells.\n */\n @property({ type: Array, attribute: false })\n rows: TableRowContent[] = [];\n\n /**\n * Whether or not the table content is loading. If it is then a skeleton state should be shown instead.\n */\n @property({ type: Boolean, attribute: 'loading' })\n loading = false;\n\n /**\n * The text used for the filter placeholder.\n */\n @property({ type: String, attribute: 'filter-placeholder-text' })\n filterPlaceholderText = 'Filter table...';\n\n /**\n * The text used for the pagination's previous button tooltip.\n */\n @property({ type: String, attribute: 'previous-page-text' })\n previousPageText = 'Previous page';\n\n /**\n * The text used for the pagination's next button tooltip.\n */\n @property({ type: String, attribute: 'next-page-text' })\n nextPageText = 'Next page';\n\n /**\n * The text used for the pagination's item pre page text.\n */\n @property({ type: String, attribute: 'items-per-page-text' })\n itemsPerPageText = 'Items per page:';\n\n /**\n * The text used for the download button's accessible label.\n */\n @property({ type: String, attribute: 'download-label-text' })\n downloadLabelText = 'Download table data';\n\n /**\n * The locale. Used by the carbon table component to change the collator for sorting.\n */\n @property({ type: String, attribute: 'locale' })\n locale = 'en';\n\n /**\n * The calculated default page size based on component width.\n * 10 for width > PAGE_SIZE_WIDTH_THRESHOLD, 5 for width <= PAGE_SIZE_WIDTH_THRESHOLD.\n *\n * @internal\n */\n @state()\n private _defaultPageSize = 5;\n\n @property({ type: Number, attribute: 'default-page-size' })\n get defaultPageSize(): number {\n return this._defaultPageSize;\n }\n\n set defaultPageSize(value: number) {\n this._defaultPageSize = value;\n if (!this._rowsPerPageChanged) {\n this._currentPageSize = value;\n }\n }\n\n /**\n * The function used to get the supplemental text for the pagination component.\n */\n @property({ type: Function, attribute: false })\n getPaginationSupplementalText = ({ count }: { count: number }) =>\n `${count} items`;\n\n /**\n * The function used to get the status text for the pagination component.\n */\n @property({ type: Function, attribute: false })\n getPaginationStatusText = ({\n start,\n end,\n count,\n }: {\n start: number;\n end: number;\n count: number;\n }) => `${start}–${end} of ${count} items`;\n\n /**\n * If the table is valid or not.\n *\n * @internal\n */\n @state()\n protected _isValid = true;\n\n /**\n * The current page of the table we're on.\n *\n * @internal\n */\n @state()\n public _currentPageNumber = 1;\n\n /**\n * How many rows are on each page of the table.\n *\n * @internal\n */\n @state()\n public _currentPageSize: number = this.defaultPageSize;\n\n /**\n * Whether or not the number of rows per page was changed with the pagination component. If the user used the\n * pagination controls to show all rows, the pagination component would normally hide itself because the number of is\n * no longer greater than the page size. However the pagination component needs to persist in this case, since the\n * user may want to change the page size again. This is used to keep track of whether the pagination controls were\n * used to change page size, and if they have, it forces pagination component to persist.\n *\n * @internal\n */\n @state()\n public _rowsPerPageChanged = false;\n\n /**\n * The rows that have not been filtered out.\n *\n * @internal\n */\n @state()\n public _filterVisibleRowIDs: Set<string> = new Set();\n\n /**\n * Flag to track when row visibility needs to be updated after the DOM has rendered.\n * This is necessary because _updateVisibleRows() queries the DOM for rendered rows,\n * which don't exist yet during willUpdate(). Setting this flag defers the visibility\n * update until the updated() lifecycle method runs after rendering is complete.\n *\n * @internal\n */\n @state()\n private _needsVisibilityUpdate = false;\n\n /**\n * All of the rows for the table with IDs.\n *\n * @internal\n */\n @state()\n public _rowsWithIDs: TableRowWithIDs[] = [];\n\n /**\n * Whether or not the table should be able to be filtered.\n *\n * @internal\n */\n @state()\n public _allowFiltering = true;\n\n static styles = [commonStyles, styles];\n\n /**\n * @internal\n */\n private tableRuntime: TableRuntimeModule | null = null;\n\n /**\n * @internal\n */\n private tableRuntimePromise: Promise<TableRuntimeModule> | null = null;\n private hasRenderedLoadingFrame = false;\n\n connectedCallback() {\n super.connectedCallback();\n void this.ensureTableRuntime();\n }\n\n /**\n * Called after the element's DOM has been updated for the first time.\n * Initializes the table page size.\n *\n * @param _changedProperties - Map of properties that changed during the update\n */\n protected async firstUpdated(\n _changedProperties: PropertyValues\n ): Promise<void> {\n await this.updateComplete;\n this._updateDefaultPageSize();\n this._setPageSize();\n }\n\n /**\n * While loading we only need to paint the skeleton once. Streaming updates can\n * mutate rows/headers rapidly, so skip subsequent updates until loading ends.\n */\n protected shouldUpdate(changedProperties: PropertyValues<this>) {\n if (changedProperties.has('loading')) {\n if (this.loading) {\n this.hasRenderedLoadingFrame = false;\n }\n return true;\n }\n\n if (this.loading && this.hasRenderedLoadingFrame) {\n return false;\n }\n\n return true;\n }\n\n /**\n * Updates the CSS custom property `--cds-chat-table-width` based on the parent element's width.\n * Also calculates the default page size on first run based on the measured width.\n * This method is called once during component initialization.\n *\n * @private\n */\n private _updateDefaultPageSize() {\n if (this.parentElement) {\n let parentWidth = this.parentElement.offsetWidth;\n\n // If parent width is 0, use fallback width that ensures 5-row default page size\n if (parentWidth === 0) {\n parentWidth = PAGE_SIZE_WIDTH_THRESHOLD - 1;\n }\n\n // Calculate default page size based on the width we just measured\n // Only set it once, don't recalculate on resize\n if (parentWidth > 0 && this._defaultPageSize === 5) {\n this._defaultPageSize =\n parentWidth > PAGE_SIZE_WIDTH_THRESHOLD ? 10 : 5;\n\n // Update _currentPageSize if it's still at the initial value\n if (this._currentPageSize === 5) {\n this._currentPageSize = this._defaultPageSize;\n }\n }\n }\n }\n\n /**\n * Called before the element updates to prepare state changes.\n * Handles validation and re-initialization of table data when headers or rows change.\n *\n * @param changedProperties - Map of properties that changed during the update\n * @protected\n */\n protected willUpdate(changedProperties: PropertyValues<this>) {\n // Calculate default page size on first render to ensure correct page size is set.\n // For streaming tables: happens when loading=true (before skeleton renders)\n // For non-streaming tables: happens when rows are first set\n if (\n (changedProperties.has('loading') && this.loading) ||\n (changedProperties.has('rows') &&\n this.rows !== undefined &&\n !this.loading)\n ) {\n this._updateDefaultPageSize();\n }\n\n const loadingJustFinished =\n changedProperties.has('loading') &&\n changedProperties.get('loading') === true &&\n this.loading === false;\n\n // If the headers or rows has recently updated and both are defined than we should validate the table\n // data. This will likely only happen on the web components first render cycle when the props go from undefined to\n // defined.\n if (\n (changedProperties.has('headers') ||\n changedProperties.has('rows') ||\n loadingJustFinished) &&\n !this.loading &&\n this.headers !== undefined &&\n this.rows !== undefined\n ) {\n this._calcIsTableValid();\n }\n\n // If the value of tableRows updated then initialize the internal rows arrays.\n if (\n (changedProperties.has('rows') || loadingJustFinished) &&\n !this.loading &&\n this.rows !== undefined\n ) {\n this._initializeRowsArrays();\n // Set flag to update visibility after DOM renders, rather than calling _setPageSize() here.\n // This is critical for streaming tables where rows don't exist in the DOM yet during willUpdate().\n this._needsVisibilityUpdate = true;\n }\n }\n\n /**\n * Called after the element's DOM has been updated.\n * Handles deferred visibility updates that require the DOM to be fully rendered.\n *\n * This is essential for streaming tables: when loading completes, willUpdate() sets\n * _needsVisibilityUpdate=true, but the actual row elements don't exist in the DOM yet.\n * By deferring _updateVisibleRows() to this lifecycle method, we ensure the rows are\n * rendered and can be properly queried and hidden/shown for pagination.\n *\n * We use requestAnimationFrame to ensure Carbon Web Components table rows are fully\n * rendered in the DOM before attempting to query and hide/show them.\n *\n * @param changedProperties - Map of properties that changed during the update\n * @protected\n */\n protected updated(changedProperties: PropertyValues<this>) {\n super.updated(changedProperties);\n\n if (this._needsVisibilityUpdate) {\n this._needsVisibilityUpdate = false;\n // Use requestAnimationFrame to ensure Carbon table rows are fully rendered\n requestAnimationFrame(() => {\n this._updateVisibleRows();\n });\n }\n }\n\n /**\n * Validates the table structure by checking if all rows have the same number of cells as the header.\n * Sets the internal `_isValid` state to false if any row has a mismatched cell count.\n *\n * A valid table requires:\n * - All rows must have the same number of cells as there are headers\n * - No rows can have more or fewer cells than the column count\n *\n * @private\n */\n private _calcIsTableValid() {\n const columnCount = this.headers.length;\n // If one of the rows has a different number of cells than the number of columns in the header then set our internal\n // valid state to false.\n this._isValid = !this.rows.some((row) => row.cells.length !== columnCount);\n // In the future, once we have an inlineError web component to use, we can render that when our table is not valid\n // (as well as throwing the below error). Until then our React container is rendering the error component and\n // throwing the error.\n\n // throw new Error(\n // `${WA_CONSOLE_PREFIX} Number of cells in the table header does not match the number of cells in one or more of the table rows. In order to render a table there needs to be the same number of columns in the table header and all of the table rows.`,\n // );\n }\n\n /**\n * Initializes internal arrays used for table functionality.\n * Creates a new array of rows with unique IDs and initializes the filter visibility tracking.\n *\n * This method:\n * 1. Resets the `_rowsWithIDs` array and `_filterVisibleRowIDs` set\n * 2. Assigns string-based IDs to each row for tracking purposes\n * 3. Marks all rows as initially visible (not filtered out)\n *\n * @private\n */\n private _initializeRowsArrays() {\n // Reset both arrays.\n this._rowsWithIDs = [];\n this._filterVisibleRowIDs = new Set();\n\n this.rows.forEach((row, index) => {\n const id = index.toString();\n this._rowsWithIDs.push({ ...row, id });\n this._filterVisibleRowIDs.add(id);\n });\n }\n\n /**\n * Configures the table's page size and filtering behavior.\n * Determines whether filtering/searching should be enabled based on the number of rows\n * relative to the current page size.\n *\n * Filtering is enabled when there are more rows than can fit on a single page,\n * allowing users to search and paginate through large datasets.\n *\n * This method is called from firstUpdated() for non-streaming tables where the DOM\n * is already rendered. For streaming tables, visibility updates are deferred via the\n * _needsVisibilityUpdate flag and handled in updated() lifecycle method.\n *\n * @private\n */\n private _setPageSize() {\n // If there are more rows than the page size then enable filtering.\n // this._allowFiltering = this.rows.length > this._currentPageSize;\n\n // Update visible rows. This is safe to call here because _setPageSize() is only\n // called from firstUpdated(), which runs after the DOM is rendered.\n this._updateVisibleRows();\n }\n\n private async ensureTableRuntime(): Promise<TableRuntimeModule | null> {\n if (this.tableRuntime) {\n return this.tableRuntime;\n }\n\n if (typeof window === 'undefined') {\n return null;\n }\n\n if (!this.tableRuntimePromise) {\n this.tableRuntimePromise = loadTableRuntime();\n }\n\n try {\n const runtime = await this.tableRuntimePromise;\n this.tableRuntime = runtime;\n // When runtime loads for the first time, we need to update row visibility\n // because we're transitioning from skeleton to actual table\n if (!this.loading && this.rows !== undefined && this.rows.length > 0) {\n this._needsVisibilityUpdate = true;\n }\n this.requestUpdate();\n return runtime;\n } catch (error) {\n console.error('Failed to load table runtime', error);\n this.tableRuntimePromise = null;\n return null;\n }\n }\n\n /**\n * Handles pagination events from the Carbon pagination component.\n * Updates the visible rows when the user navigates to a different page.\n *\n * Note: This event sometimes fires twice due to a Carbon framework quirk,\n * but since the page/size values are identical, it doesn't affect functionality.\n *\n * @param event - The page change event containing the new page number and size\n * @public\n *\n * @internal\n */\n public _handlePageChangeEvent = (event: PageChangeEvent) => {\n this._updateVisibleRows(event.detail?.page, event.detail?.pageSize);\n event.stopPropagation();\n };\n\n /**\n * Handles page size change events from the pagination component.\n * Updates the current page size and recalculates visible rows.\n * Marks that the page size has been manually changed by the user.\n *\n * @param event - The page size change event containing the new page size\n * @public\n *\n * @internal\n */\n public _handlePageSizeChangeEvent = (event: PageChangeEvent) => {\n this._rowsPerPageChanged = true;\n this._currentPageSize = event.detail?.pageSize;\n this._updateVisibleRows();\n event.stopPropagation();\n };\n\n /**\n * Handles filter and sort events from the Carbon table component.\n * Updates the set of visible rows based on filtering/sorting results and resets to the first page.\n *\n * This event is triggered by:\n * - Column sorting (clicking on sortable column headers)\n * - Table filtering (using the search bar)\n *\n * @param event - The filter event containing the array of unfiltered rows\n * @public\n *\n * @internal\n */\n public _handleFilterEvent = (event: FilterEvent) => {\n // Record the new set of unfiltered row ids.\n this._filterVisibleRowIDs = new Set(\n event?.detail?.unfilteredRows.map((row) => row.id)\n );\n\n // Go back to the first page.\n this._currentPageNumber = 1;\n\n // Update which rows are visible.\n this._updateVisibleRows();\n event.stopPropagation();\n };\n\n /**\n * Controls which table rows are visible based on pagination and filtering.\n * Uses CSS display properties to show/hide rows rather than DOM manipulation.\n *\n * This approach is necessary because Carbon's table component handles its own\n * sorting and we need to preserve the DOM order it creates. The method:\n * 1. Hides all rows initially\n * 2. Filters to only rows that haven't been filtered out\n * 3. Shows only the rows that belong to the current page\n *\n * @param page - The page number to display (1-based)\n * @param pageSize - Number of rows per page\n * @private\n */\n private _updateVisibleRows(\n page: number = this._currentPageNumber,\n pageSize: number = this._currentPageSize\n ) {\n // Set the current page number and only show the rows for that page.\n this._currentPageNumber = page;\n\n // Grab all the rows that have been rendered. It's necessary to grab them from the page because the cds-custom-table puts\n // the rows in a specific order when sorting and we want to preserve that order.\n const rows: HTMLElement[] = Array.from(\n this.renderRoot.querySelectorAll('cds-custom-table-row')\n );\n\n // This is similar to the carbon example here https://stackblitz.com/edit/github-kbd9xw-s3y3s6?file=index.html. I\n // originally tried creating and passing an array of the specific rows the template should render for the current\n // page. Unfortunately doing that doesn't work with the combination of the is-sortable prop for the table and\n // page-size prop for pagination. What would happen is old rows would persist if you were on the last page and there\n // weren't enough rows to fill the page (even though the old rows weren't included in the new rows provided to the\n // template). Using Carbon's example of hiding the rows with styling works so I'm extending that concept here even\n // though, ideally, render controls the view and reacts to the state that would be determined here.\n\n // Hide all the rows to start. Using a data attribute; the matching rule\n // lives in table.scss.\n rows.forEach((row) => row.toggleAttribute('data-hidden', true));\n\n // Now filter the rows down to what is visible according to the filter.\n const filterVisibleRows = rows.filter((row) =>\n this._filterVisibleRowIDs.has(row.id)\n );\n\n // Now show all the rows that are within the current page.\n const pageStart = (page - 1) * pageSize;\n const pageEnd = page * pageSize - 1;\n for (let index = pageStart; index <= pageEnd; index++) {\n // If there is a row at that index then show it. If there aren't enough rows to fill the page then there won't be\n // a row at that index.\n filterVisibleRows[index]?.removeAttribute('data-hidden');\n }\n }\n\n /**\n * Handles the table download functionality by exporting all table data as a CSV file.\n *\n * This custom implementation is necessary because Carbon's default download feature:\n * - Only exports selected rows (we want all data)\n * - Only exports as JSON (we want CSV format)\n * - Doesn't include all the data we need\n *\n * The method creates a data URL to comply with CSP policies, and triggers a download.\n *\n * @public\n */\n public async _handleDownload() {\n // Don't save content from the expandable rows at this time. This could be added in the future but it's unclear how\n // this would look in the download.\n const tableArray: (string | number)[][] = [\n this.headers.map((cell) => cell.text),\n ...this.rows.map((row) => row.cells.map((cell) => cell.text)),\n ];\n\n try {\n const csvContent = stringifyCSV(tableArray);\n\n // Use data URL instead of Blob to avoid CSP issues with object-src\n const dataUrl = `data:text/csv;charset=utf-8,${encodeURIComponent(\n csvContent\n )}`;\n\n // Create and trigger download using anchor element. The link is\n // `hidden` and removed synchronously after click() so no flash is\n // observed.\n const link = document.createElement('a');\n link.setAttribute('href', dataUrl);\n link.setAttribute('download', 'table-data.csv');\n link.hidden = true;\n document.body.appendChild(link);\n\n // Trigger download and cleanup\n link.click();\n document.body.removeChild(link);\n } catch (error) {\n console.error('Failed to download table data:', error);\n // Fallback: could show user notification or use alternative method\n }\n }\n\n /**\n * Renders the table component based on current state and data.\n *\n * The render logic follows this priority:\n * 1. Shows skeleton loading state if `loading` is true\n * 2. Shows table with pagination if there are more rows than the page size OR pagination was used\n * 3. Shows table only if all rows fit on one page\n *\n * The method also applies the appropriate Carbon theme class (cds-custom--g90 for dark, cds-custom--white for light)\n * to ensure proper styling based on the `dark` property.\n *\n * @returns The lit-html template for the table component\n * @public\n */\n render() {\n // TODO TABLE: Once we have a web component version of the inline error state we could render that here if\n // !this._isValid.\n\n // This could be used while we wait for a md stream containing a table to complete.\n const runtime = this.tableRuntime;\n if (this.loading || !runtime) {\n this.hasRenderedLoadingFrame = true;\n if (!runtime) {\n void this.ensureTableRuntime();\n }\n return tableSkeletonTemplate(this._currentPageSize);\n }\n this.hasRenderedLoadingFrame = false;\n\n const { tableTemplate, tablePaginationTemplate } = runtime;\n\n // If there are more rows than the page size then we need to add the pagination component. If the rows per page has\n // been changed by the pagination component then we need to keep the pagination component around so the user can\n // change the page size again, even if the current page size is the same as the number of table rows.\n if (this.rows.length > this._currentPageSize || this._rowsPerPageChanged) {\n return html`<div class=\"cds-custom-ai-chat-table-container\">\n ${tableTemplate(this)}\n ${tablePaginationTemplate({\n _currentPageSize: this._currentPageSize,\n _currentPageNumber: this._currentPageNumber,\n _filterVisibleRowIDs: this._filterVisibleRowIDs,\n rows: this.rows,\n previousPageText: this.previousPageText,\n nextPageText: this.nextPageText,\n itemsPerPageText: this.itemsPerPageText,\n getPaginationSupplementalText: this.getPaginationSupplementalText,\n getPaginationStatusText: this.getPaginationStatusText,\n _handlePageChangeEvent: this._handlePageChangeEvent,\n _handlePageSizeChangeEvent: this._handlePageSizeChangeEvent,\n })}\n </div>`;\n }\n\n // Otherwise, just render the table.\n return html`<div class=\"cds-custom-ai-chat-table-container\">\n ${tableTemplate(this)}\n </div>`;\n }\n}\n\ndeclare global {\n interface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EAAE,SAAS,EAAE,KAAK,EAAE;AASJ,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,yBAAA,EAAA,MAAA,CAAA;AAQhC,UAAA,CAAA;AADT,IAAA,KAAK;AACoB,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,UAAA,EAAA,MAAA,CAAA;AAQnB,UAAA,CAAA;AADN,IAAA,KAAK;AACwB,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,oBAAA,EAAA,MAAA,CAAA;AAQvB,UAAA,CAAA;AADN,IAAA,KAAK;AACiD,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,MAAA,CAAA;AAYhD,UAAA,CAAA;AADN,IAAA,KAAK;AAC6B,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,qBAAA,EAAA,MAAA,CAAA;AAQ5B,UAAA,CAAA;AADN,IAAA,KAAK;AAC+C,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,sBAAA,EAAA,MAAA,CAAA;AAW7C,UAAA,CAAA;AADP,IAAA,KAAK;AACiC,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,wBAAA,EAAA,MAAA,CAAA;AAQhC,UAAA,CAAA;AADN,IAAA,KAAK;AACsC,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,cAAA,EAAA,MAAA,CAAA;AAQrC,UAAA,CAAA;AADN,IAAA,KAAK;AACwB,CAAA,EAAA,cAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,MAAA,CAAA;AAlL1B,cAAc,GAAA,UAAA,CAAA;AADnB,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,MAAA,CAAQ;AAC1B,CAAA,EAAA,cAAc,CAmpBnB;AASD,uBAAe,cAAc;;"}
@@ -13,6 +13,7 @@ import prefix from '../../../globals/settings.js';
13
13
  import commonStyles from '../../../globals/scss/common.scss.js';
14
14
  import styles from './workspace-shell.scss.js';
15
15
  import { HeaderCollapsibleManager } from './header-collapsible-manager.js';
16
+ import { adoptOnRoot, setVarsForSelector } from '../../shared/dynamic-css-var-sheet.js';
16
17
 
17
18
  /*
18
19
  * Copyright IBM Corp. 2026
@@ -46,6 +47,13 @@ let CDSAIChatWorkspaceShell = class CDSAIChatWorkspaceShell extends LitElement {
46
47
  }
47
48
  connectedCallback() {
48
49
  super.connectedCallback();
50
+ // Carbon sets both minimum and maximum widths in the containing tree,
51
+ // where normal slotted rules cannot override them.
52
+ adoptOnRoot(this.getRootNode());
53
+ setVarsForSelector(`${prefix}-workspace-shell > [slot="notification"]`, {
54
+ 'min-inline-size': '0',
55
+ 'max-inline-size': '100%',
56
+ });
49
57
  this.setupHeaderCollapsibleManager();
50
58
  }
51
59
  disconnectedCallback() {
@@ -102,11 +110,13 @@ let CDSAIChatWorkspaceShell = class CDSAIChatWorkspaceShell extends LitElement {
102
110
  }
103
111
  render() {
104
112
  return html `
105
- <slot name="toolbar"></slot>
106
- <slot name="notification"></slot>
107
- <slot name="header"></slot>
108
- <slot name="body"></slot>
109
- <slot name="footer"></slot>
113
+ <div class="${prefix}-workspace-shell">
114
+ <slot name="toolbar"></slot>
115
+ <slot name="notification"></slot>
116
+ <slot name="header"></slot>
117
+ <slot name="body"></slot>
118
+ <slot name="footer"></slot>
119
+ </div>
110
120
  `;
111
121
  }
112
122
  };
@@ -1 +1 @@
1
- {"version":3,"file":"workspace-shell.js","sources":["../../../../src/components/workspace-shell/src/workspace-shell.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, PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.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 './workspace-shell.scss?lit';\nimport { HeaderCollapsibleManager } from './header-collapsible-manager.js';\n\n/**\n * Workspace Shell.\n *\n * @element cds-custom-aichat-workspace-shell\n * @slot toolbar - Represents the toolbar area of the workspace.\n * @slot header - Represents the header section, containing title, subtitle and actions.\n * @slot notification - Area for displaying workspace notifications.\n * @slot body - The main content area of the workspace.\n * @slot footer - Represents the footer section, usually containing action buttons.\n *\n */\n@carbonElement(`${prefix}-workspace-shell`)\nclass CDSAIChatWorkspaceShell extends LitElement {\n static styles = [commonStyles, styles];\n\n /**\n * Enable automatic header collapsible behavior based on available space.\n * When true, the header will automatically become collapsible when the\n * body would have less space than the header.\n *\n */\n @property({ type: Boolean, attribute: 'auto-collapsible-header' })\n autoCollapsibleHeader = false;\n\n /**\n * @internal\n */\n private headerCollapsibleManager?: HeaderCollapsibleManager;\n\n connectedCallback() {\n super.connectedCallback();\n this.setupHeaderCollapsibleManager();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.headerCollapsibleManager?.disconnect();\n }\n\n updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n\n // If autoCollapsibleHeader changes, setup or teardown manager\n if (changedProperties.has('autoCollapsibleHeader')) {\n if (this.autoCollapsibleHeader) {\n this.setupHeaderCollapsibleManager();\n } else {\n // Clean up: remove collapsible attribute from header before disconnecting\n this.cleanupHeaderCollapsible();\n this.headerCollapsibleManager?.disconnect();\n this.headerCollapsibleManager = undefined;\n }\n }\n }\n\n private cleanupHeaderCollapsible(): void {\n if (!this.shadowRoot) {\n return;\n }\n\n const headerSlot = this.shadowRoot.querySelector<HTMLSlotElement>(\n 'slot[name=\"header\"]'\n );\n const headerElement = headerSlot?.assignedElements()[0] as HTMLElement;\n\n if (headerElement) {\n headerElement.removeAttribute('collapsible');\n }\n }\n\n private setupHeaderCollapsibleManager(): void {\n // Only setup if feature is enabled\n if (!this.autoCollapsibleHeader) {\n return;\n }\n\n // Don't create a new manager if one already exists\n if (this.headerCollapsibleManager) {\n return;\n }\n\n this.updateComplete.then(() => {\n if (!this.shadowRoot) {\n return;\n }\n\n // Double-check in case manager was created while waiting for updateComplete\n if (this.headerCollapsibleManager) {\n return;\n }\n\n this.headerCollapsibleManager = new HeaderCollapsibleManager(\n this.shadowRoot,\n this\n );\n\n this.headerCollapsibleManager.connect((state) => {\n this.headerCollapsibleManager?.updateHeaderCollapsible(\n state.shouldCollapse\n );\n });\n });\n }\n\n render() {\n return html`\n <slot name=\"toolbar\"></slot>\n <slot name=\"notification\"></slot>\n <slot name=\"header\"></slot>\n <slot name=\"body\"></slot>\n <slot name=\"footer\"></slot>\n `;\n }\n}\n\nexport { CDSAIChatWorkspaceShell };\nexport default CDSAIChatWorkspaceShell;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAUH;;;;;;;;;;AAUG;AAEH,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,UAAU,CAAA;AAAhD,IAAA,WAAA,GAAA;;AAGE;;;;;AAKG;QAEH,IAAA,CAAA,qBAAqB,GAAG,KAAK;IA2F/B;IApFE,iBAAiB,GAAA;QACf,KAAK,CAAC,iBAAiB,EAAE;QACzB,IAAI,CAAC,6BAA6B,EAAE;IACtC;IAEA,oBAAoB,GAAA;QAClB,KAAK,CAAC,oBAAoB,EAAE;AAC5B,QAAA,IAAI,CAAC,wBAAwB,EAAE,UAAU,EAAE;IAC7C;AAEA,IAAA,OAAO,CAAC,iBAAiC,EAAA;AACvC,QAAA,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;;AAGhC,QAAA,IAAI,iBAAiB,CAAC,GAAG,CAAC,uBAAuB,CAAC,EAAE;AAClD,YAAA,IAAI,IAAI,CAAC,qBAAqB,EAAE;gBAC9B,IAAI,CAAC,6BAA6B,EAAE;YACtC;iBAAO;;gBAEL,IAAI,CAAC,wBAAwB,EAAE;AAC/B,gBAAA,IAAI,CAAC,wBAAwB,EAAE,UAAU,EAAE;AAC3C,gBAAA,IAAI,CAAC,wBAAwB,GAAG,SAAS;YAC3C;QACF;IACF;IAEQ,wBAAwB,GAAA;AAC9B,QAAA,IAAI,CAAC,IAAI,CA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A,CAAkB;AACpC,CAAA,EAAA,uBAAuB,CAqG5B;AAGD,gCAAe,uBAAuB;;"}
1
+ {"version":3,"file":"workspace-shell.js","sources":["../../../../src/components/workspace-shell/src/workspace-shell.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, PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.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 './workspace-shell.scss?lit';\nimport { HeaderCollapsibleManager } from './header-collapsible-manager.js';\nimport {\n adoptOnRoot,\n setVarsForSelector,\n} from '../../shared/dynamic-css-var-sheet.js';\n\n/**\n * Workspace Shell.\n *\n * @element cds-custom-aichat-workspace-shell\n * @slot toolbar - Represents the toolbar area of the workspace.\n * @slot header - Represents the header section, containing title, subtitle and actions.\n * @slot notification - Area for displaying workspace notifications.\n * @slot body - The main content area of the workspace.\n * @slot footer - Represents the footer section, usually containing action buttons.\n *\n */\n@carbonElement(`${prefix}-workspace-shell`)\nclass CDSAIChatWorkspaceShell extends LitElement {\n static styles = [commonStyles, styles];\n\n /**\n * Enable automatic header collapsible behavior based on available space.\n * When true, the header will automatically become collapsible when the\n * body would have less space than the header.\n *\n */\n @property({ type: Boolean, attribute: 'auto-collapsible-header' })\n autoCollapsibleHeader = false;\n\n /**\n * @internal\n */\n private headerCollapsibleManager?: HeaderCollapsibleManager;\n\n connectedCallback() {\n super.connectedCallback();\n // Carbon sets both minimum and maximum widths in the containing tree,\n // where normal slotted rules cannot override them.\n adoptOnRoot(this.getRootNode() as Document | ShadowRoot);\n setVarsForSelector(`${prefix}-workspace-shell > [slot=\"notification\"]`, {\n 'min-inline-size': '0',\n 'max-inline-size': '100%',\n });\n this.setupHeaderCollapsibleManager();\n }\n\n disconnectedCallback() {\n super.disconnectedCallback();\n this.headerCollapsibleManager?.disconnect();\n }\n\n updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n\n // If autoCollapsibleHeader changes, setup or teardown manager\n if (changedProperties.has('autoCollapsibleHeader')) {\n if (this.autoCollapsibleHeader) {\n this.setupHeaderCollapsibleManager();\n } else {\n // Clean up: remove collapsible attribute from header before disconnecting\n this.cleanupHeaderCollapsible();\n this.headerCollapsibleManager?.disconnect();\n this.headerCollapsibleManager = undefined;\n }\n }\n }\n\n private cleanupHeaderCollapsible(): void {\n if (!this.shadowRoot) {\n return;\n }\n\n const headerSlot = this.shadowRoot.querySelector<HTMLSlotElement>(\n 'slot[name=\"header\"]'\n );\n const headerElement = headerSlot?.assignedElements()[0] as HTMLElement;\n\n if (headerElement) {\n headerElement.removeAttribute('collapsible');\n }\n }\n\n private setupHeaderCollapsibleManager(): void {\n // Only setup if feature is enabled\n if (!this.autoCollapsibleHeader) {\n return;\n }\n\n // Don't create a new manager if one already exists\n if (this.headerCollapsibleManager) {\n return;\n }\n\n this.updateComplete.then(() => {\n if (!this.shadowRoot) {\n return;\n }\n\n // Double-check in case manager was created while waiting for updateComplete\n if (this.headerCollapsibleManager) {\n return;\n }\n\n this.headerCollapsibleManager = new HeaderCollapsibleManager(\n this.shadowRoot,\n this\n );\n\n this.headerCollapsibleManager.connect((state) => {\n this.headerCollapsibleManager?.updateHeaderCollapsible(\n state.shouldCollapse\n );\n });\n });\n }\n\n render() {\n return html`\n <div class=\"${prefix}-workspace-shell\">\n <slot name=\"toolbar\"></slot>\n <slot name=\"notification\"></slot>\n <slot name=\"header\"></slot>\n <slot name=\"body\"></slot>\n <slot name=\"footer\"></slot>\n </div>\n `;\n }\n}\n\nexport { CDSAIChatWorkspaceShell };\nexport default CDSAIChatWorkspaceShell;\n"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAcH;;;;;;;;;;AAUG;AAEH,IAAM,uBAAuB,GAA7B,MAAM,uBAAwB,SAAQ,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AEQ,6BAA6B,GAAA;;AAEnC,QAAA,IAAI,CAAC,IAAI,CAAC,qBAAqB,EAAE;YAC/B;QACF;;AAGA,QAAA,IAAI,IAAI,CAAC,wBAAwB,EAAE;YACjC;QACF;AAEA,QAAA,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,MAAK;AAC5B,YAAA,IAAI,CAAC,IAAI,CAAC,UAAU,EAAE;gBACpB;YACF;;AAGA,YAAA,IAAI,IAAI,CAAC,wBAAwB,EAAE;gBACjC;YACF;AAEA,YAAA,IAAI,CAAC,wBAAwB,GAAG,IAAI,wBAAwB,CAC1D,IAAI,CAAC,UAAU,EACf,IAAI,CACL;YAED,IAAI,CAAC,wBAAwB,CAAC,OAAO,CAAC,CAAC,KAAK,KAAI;gBAC9C,IAAI,CAAC,wBAAwB,EAAE,uBAAuB,CACpD,KAAK,CAAC,cAAc,CACrB;AACH,YAAA,CAAC,CAAC;AACJ,QAAA,CAAC,CAAC;IACJ;IAEA,MAAM,GAAA;AACJ,QAAA,OAAO,IAAI,CAAA;oBACK,MAAM,CAAA;;;;;;;KAOrB;IACH;;AA5GO,uBAAA,CAAA,MAAM,GAAG,CAAC,YAAY,EAAE,MAAM,CAAC;AAStC,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,yBAAyB,EAAE;AACnC,CAAA,EAAA,uBAAA,CAAA,SAAA,EAAA,uBAAA,EAAA,MAAA,CAAA;AAV1B,uBAAuB,GAAA,UAAA,CAAA;AAD5B,IAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,gBAAA,CAAkB;AACpC,CAAA,EAAA,uBAAuB,CA8G5B;AAGD,gCAAe,uBAAuB;;"}
@@ -7,7 +7,7 @@
7
7
 
8
8
  import { css } from 'lit';
9
9
 
10
- var styles = css([":host(cds-custom-aichat-workspace-shell){background-color:var(--cds-chat-shell-background);block-size:100%;border:.0625rem solid var(--cds-chat-bubble-border,#e0e0e0);border-radius:.5rem;box-shadow:-10px 0 100px -24px var(--cds-ai-popover-shadow-outer-01,rgba(0,67,206,.06)),0 10px 40px -24px var(--cds-ai-popover-shadow-outer-02,rgba(0,0,0,.04));box-sizing:border-box!important;color:var(--cds-text-secondary,#525252);display:flex;flex-direction:column;font-size:var(--cds-body-01-font-size,.875rem);font-weight:var(--cds-body-01-font-weight,400);inline-size:100%;letter-spacing:var(--cds-body-01-letter-spacing,.16px);line-height:var(--cds-body-01-line-height,1.42857);overflow:auto}:host(cds-custom-aichat-workspace-shell) slot[name=toolbar]{flex-shrink:0;min-inline-size:0}:host(cds-custom-aichat-workspace-shell) slot[name=notification]{flex-shrink:0}:host(cds-custom-aichat-workspace-shell) slot[name=header]{flex-shrink:0}:host(cds-custom-aichat-workspace-shell) slot[name=body]{flex:1 1 auto;min-block-size:0}:host(cds-custom-aichat-workspace-shell) slot[name=footer]{flex-shrink:0}::slotted([slot=notification]){box-sizing:border-box;margin-block-end:0;max-inline-size:100%!important}::slotted(cds-custom-aichat-toolbar){--cds-aichat-toolbar-title-padding-inline-start:2rem;border-block-end:.0625rem solid var(--cds-chat-bubble-border);box-sizing:border-box;font-size:var(--cds-heading-03-font-size,1.25rem);font-weight:var(--cds-heading-03-font-weight,400);inline-size:100%;letter-spacing:var(--cds-heading-03-letter-spacing,0);line-height:var(--cds-heading-03-line-height,1.4);max-inline-size:100%;min-inline-size:0}.cds-custom-aichat-workspace-shell__toolbar-action{display:grid;grid-auto-columns:2.5rem;grid-auto-flow:column}.cds-custom-aichat-workspace-shell__toolbar-action ::slotted(cds-custom-ai-label){block-size:2.5rem}:host(cds-custom-aichat-workspace-shell-body){display:flex;flex-direction:column;padding:1.5rem 2rem}"]);
10
+ var styles = css([":host(cds-custom-aichat-workspace-shell){block-size:100%;color:var(--cds-text-secondary,#525252);display:block;font-size:var(--cds-body-01-font-size,.875rem);font-weight:var(--cds-body-01-font-weight,400);inline-size:100%;letter-spacing:var(--cds-body-01-letter-spacing,.16px);line-height:var(--cds-body-01-line-height,1.42857);min-block-size:0;min-inline-size:0}.cds-custom-aichat-workspace-shell{background-color:var(--cds-chat-shell-background);block-size:100%;border:.0625rem solid var(--cds-chat-bubble-border,#e0e0e0);border-radius:.5rem;box-shadow:-10px 0 100px -24px var(--cds-ai-popover-shadow-outer-01,rgba(0,67,206,.06)),0 10px 40px -24px var(--cds-ai-popover-shadow-outer-02,rgba(0,0,0,.04));box-sizing:border-box;display:flex;flex-direction:column;inline-size:100%;overflow:auto}slot[name=toolbar]{flex-shrink:0;min-inline-size:0}slot[name=footer],slot[name=header],slot[name=notification]{flex-shrink:0}slot[name=body]{flex:1 1 auto;min-block-size:0}::slotted([slot=notification]){box-sizing:border-box;margin-block-end:0}::slotted(cds-custom-aichat-toolbar){--cds-aichat-toolbar-title-padding-inline-start:2rem;border-block-end:.0625rem solid var(--cds-chat-bubble-border);box-sizing:border-box;font-size:var(--cds-heading-03-font-size,1.25rem);font-weight:var(--cds-heading-03-font-weight,400);inline-size:100%;letter-spacing:var(--cds-heading-03-letter-spacing,0);line-height:var(--cds-heading-03-line-height,1.4);max-inline-size:100%;min-inline-size:0}.cds-custom-aichat-workspace-shell__toolbar-action{display:grid;grid-auto-columns:2.5rem;grid-auto-flow:column}.cds-custom-aichat-workspace-shell__toolbar-action ::slotted(cds-custom-ai-label){block-size:2.5rem}:host(cds-custom-aichat-workspace-shell-body){display:flex;flex-direction:column;padding:1.5rem 2rem}"]);
11
11
 
12
12
  export { styles as default };
13
13
  //# sourceMappingURL=workspace-shell.scss.js.map
@@ -23,7 +23,7 @@
23
23
  * ```
24
24
  */
25
25
  import React, { FunctionComponent } from 'react';
26
- import { CarbonIcon, CarbonIconDescriptor } from '@carbon/web-components/es-custom/globals/internal/icon-loader-utils';
26
+ import { CarbonIcon, CarbonIconDescriptor } from '@carbon/web-components/es-custom/globals/internal/icon-loader-utils.js';
27
27
  type CarbonIconProps = React.SVGProps<SVGSVGElement> & {
28
28
  slot?: string;
29
29
  [key: string]: unknown;
@@ -1 +1 @@
1
- {"version":3,"file":"iconTransform.js","sources":["../../../src/globals/utils/iconTransform.tsx"],"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\n/**\n * Icon Transformation Utility\n *\n * This module provides utilities to transform React icon components from @carbon/icons-react\n * into the CarbonIcon descriptor format used by @carbon/icons. This enables React developers\n * to use their familiar React icon components while maintaining compatibility with web components\n * that expect the plain JavaScript CarbonIcon format.\n *\n * Key features:\n * - Automatic transformation of React icon components to CarbonIcon descriptors\n * - No-op pass-through for CarbonIcon objects (already in correct format)\n * - Global caching to prevent redundant transformations\n * - Type guards for runtime icon format detection\n * - Support for forwardRef and memo-wrapped components\n *\n * Usage:\n * ```tsx\n * import { Add } from '@carbon/icons-react';\n * import { transformReactIconToCarbonIcon } from './iconTransform';\n *\n * const carbonIcon = transformReactIconToCarbonIcon(Add);\n * // carbonIcon is now in CarbonIcon format, ready for web components\n * ```\n */\n\nimport React, { FunctionComponent } from 'react';\nimport {\n CarbonIcon,\n CarbonIconDescriptor,\n} from '@carbon/web-components/es-custom/globals/internal/icon-loader-utils';\n\ntype CarbonIconProps = React.SVGProps<SVGSVGElement> & {\n slot?: string;\n [key: string]: unknown;\n};\n\n// Global cache for transformed icons using WeakMap to key by component reference\nconst iconCache = new WeakMap<\n React.ComponentType<any>,\n Map<number, CarbonIcon>\n>();\n\n/**\n * Type guard to detect if icon is already a CarbonIcon descriptor.\n * If true, the icon should be passed through unchanged (no-op).\n */\nexport function isCarbonIcon(icon: any): icon is CarbonIcon {\n return Boolean(\n icon &&\n typeof icon === 'object' &&\n 'elem' in icon &&\n 'attrs' in icon &&\n 'content' in icon &&\n icon.elem === 'svg'\n );\n}\n\n/**\n * Transforms a React icon component to CarbonIcon format.\n * Returns the icon unchanged if it's already a CarbonIcon (no-op).\n * Caches results to avoid repeated transformations.\n */\nexport function transformReactIconToCarbonIcon(\n icon: CarbonIcon | React.ComponentType<any>,\n size = 16\n): CarbonIcon {\n // No-op: If already a CarbonIcon, return unchanged\n if (isCarbonIcon(icon)) {\n return icon;\n }\n\n const ReactIcon = icon as React.ComponentType<any>;\n\n // Get or create size map for this component\n let sizeMap = iconCache.get(ReactIcon);\n if (!sizeMap) {\n sizeMap = new Map<number, CarbonIcon>();\n iconCache.set(ReactIcon, sizeMap);\n }\n\n // Return cached result if available for this size\n const cached = sizeMap.get(size);\n if (cached) {\n return cached;\n }\n\n try {\n // Call the React component to get the React element\n const element = React.createElement(ReactIcon, { size });\n\n // Extract CarbonIcon descriptor from React element\n const descriptor = extractCarbonIconFromReactElement(element, size);\n\n // Validate descriptor\n if (!isValidCarbonIcon(descriptor)) {\n throw new Error('Generated descriptor is invalid');\n }\n\n // Cache and return\n sizeMap.set(size, descriptor);\n return descriptor;\n } catch (error) {\n const iconName = ReactIcon.displayName || ReactIcon.name || 'Unknown';\n throw new Error(\n `Failed to transform React icon \"${iconName}\": ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n/**\n * Extracts CarbonIcon descriptor from a React element tree\n */\nfunction extractCarbonIconFromReactElement(\n element: React.ReactElement,\n size: number\n): CarbonIcon {\n // The element should be an SVG or Icon component\n // Navigate through forwardRef and other wrappers if needed\n let currentElement = element;\n\n // Handle forwardRef wrapper\n if (\n typeof currentElement.type === 'object' &&\n 'render' in currentElement.type\n ) {\n // This is a forwardRef, call the render function\n const renderFn = (currentElement.type as any).render;\n currentElement = renderFn(currentElement.props, null);\n }\n\n // Now we should have the actual Icon element\n const props = currentElement.props as any;\n\n if (!props) {\n throw new Error('Unable to extract props from React element');\n }\n\n // Extract SVG attributes from props\n const attrs: Record<string, string | number> = {\n xmlns: props.xmlns || 'http://www.w3.org/2000/svg',\n viewBox: props.viewBox || '0 0 32 32',\n fill: props.fill || 'currentColor',\n width: size,\n height: size,\n };\n\n // Extract children (paths, circles, etc.)\n const content: any[] = [];\n const children = React.Children.toArray(props.children);\n\n children.forEach((child) => {\n if (React.isValidElement(child)) {\n const childElement = child as React.ReactElement;\n const contentItem: any = {\n elem:\n typeof childElement.type === 'string' ? childElement.type : 'path',\n attrs: {},\n };\n\n // Copy all props as attributes\n if (childElement.props) {\n Object.entries(childElement.props).forEach(([key, value]) => {\n // Skip children and other React-specific props\n if (key !== 'children' && value !== undefined && value !== null) {\n contentItem.attrs[key] = value;\n }\n });\n }\n\n content.push(contentItem);\n }\n });\n\n return {\n elem: 'svg',\n attrs,\n content,\n name: extractIconName(props),\n size,\n };\n}\n\n/**\n * Validates that a descriptor has all required CarbonIcon fields\n */\nfunction isValidCarbonIcon(descriptor: any): descriptor is CarbonIcon {\n return (\n descriptor &&\n descriptor.elem === 'svg' &&\n descriptor.attrs &&\n typeof descriptor.attrs === 'object' &&\n Array.isArray(descriptor.content) &&\n descriptor.content.length > 0 &&\n typeof descriptor.name === 'string' &&\n typeof descriptor.size === 'number'\n );\n}\n\n/**\n * Attempts to extract icon name from props\n */\nfunction extractIconName(props: any): string {\n // Try various properties that might contain the icon name\n return props['data-icon-name'] || props['aria-label'] || props.name || 'icon';\n}\n\n/**\n * Creates a React component from a `CarbonIconDescriptor` (a raw `@carbon/icons` import).\n *\n * @example\n * import Launch16 from '@carbon/icons/es/launch/16';\n * const LaunchIcon = carbonIconToReact(Launch16);\n * <LaunchIcon aria-label=\"Launch\" className=\"icon\" />\n */\nexport function carbonIconToReact(\n icon: CarbonIconDescriptor\n): FunctionComponent<CarbonIconProps> {\n return function IconComponent(props: CarbonIconProps = {}) {\n return React.createElement(\n 'svg',\n {\n ...icon.attrs,\n width: icon.attrs.width || 16,\n height: icon.attrs.height || 16,\n fill: icon.attrs.fill || 'currentColor',\n focusable: 'false',\n style: { pointerEvents: 'none' },\n ...props,\n },\n icon.content.map((child, i) =>\n React.createElement(child.elem, { key: i, ...(child.attrs || {}) })\n )\n );\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;;;;;;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K,CAAC,gBAAgB,CAAC,IAAI,KAAK,CAAC,YAAY,CAAC,IAAI,KAAK,CAAC,IAAI,IAAI,MAAM;AAC/E;AAEA;;;;;;;AAOG;AACG,SAAU,iBAAiB,CAC/B,IAA0B,EAAA;AAE1B,IAAA,OAAO,SAAS,aAAa,CAAC,KAAA,GAAyB,EAAE,EAAA;AACvD,QAAA,OAAO,KAAK,CAAC,aAAa,CACxB,KAAK,EACL;YACE,GAAG,IAAI,CAAC,KAAK;AACb,YAAA,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,IAAI,EAAE;AAC7B,YAAA,MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE;AAC/B,YAAA,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,cAAc;AACvC,YAAA,SAAS,EAAE,OAAO;AAClB,YAAA,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE;AAChC,YAAA,GAAG,KAAK;AACT,SAAA,EACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KACxB,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,CACpE,CACF;AACH,IAAA,CAAC;AACH;;"}
1
+ {"version":3,"file":"iconTransform.js","sources":["../../../src/globals/utils/iconTransform.tsx"],"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\n/**\n * Icon Transformation Utility\n *\n * This module provides utilities to transform React icon components from @carbon/icons-react\n * into the CarbonIcon descriptor format used by @carbon/icons. This enables React developers\n * to use their familiar React icon components while maintaining compatibility with web components\n * that expect the plain JavaScript CarbonIcon format.\n *\n * Key features:\n * - Automatic transformation of React icon components to CarbonIcon descriptors\n * - No-op pass-through for CarbonIcon objects (already in correct format)\n * - Global caching to prevent redundant transformations\n * - Type guards for runtime icon format detection\n * - Support for forwardRef and memo-wrapped components\n *\n * Usage:\n * ```tsx\n * import { Add } from '@carbon/icons-react';\n * import { transformReactIconToCarbonIcon } from './iconTransform';\n *\n * const carbonIcon = transformReactIconToCarbonIcon(Add);\n * // carbonIcon is now in CarbonIcon format, ready for web components\n * ```\n */\n\nimport React, { FunctionComponent } from 'react';\nimport {\n CarbonIcon,\n CarbonIconDescriptor,\n} from '@carbon/web-components/es-custom/globals/internal/icon-loader-utils.js';\n\ntype CarbonIconProps = React.SVGProps<SVGSVGElement> & {\n slot?: string;\n [key: string]: unknown;\n};\n\n// Global cache for transformed icons using WeakMap to key by component reference\nconst iconCache = new WeakMap<\n React.ComponentType<any>,\n Map<number, CarbonIcon>\n>();\n\n/**\n * Type guard to detect if icon is already a CarbonIcon descriptor.\n * If true, the icon should be passed through unchanged (no-op).\n */\nexport function isCarbonIcon(icon: any): icon is CarbonIcon {\n return Boolean(\n icon &&\n typeof icon === 'object' &&\n 'elem' in icon &&\n 'attrs' in icon &&\n 'content' in icon &&\n icon.elem === 'svg'\n );\n}\n\n/**\n * Transforms a React icon component to CarbonIcon format.\n * Returns the icon unchanged if it's already a CarbonIcon (no-op).\n * Caches results to avoid repeated transformations.\n */\nexport function transformReactIconToCarbonIcon(\n icon: CarbonIcon | React.ComponentType<any>,\n size = 16\n): CarbonIcon {\n // No-op: If already a CarbonIcon, return unchanged\n if (isCarbonIcon(icon)) {\n return icon;\n }\n\n const ReactIcon = icon as React.ComponentType<any>;\n\n // Get or create size map for this component\n let sizeMap = iconCache.get(ReactIcon);\n if (!sizeMap) {\n sizeMap = new Map<number, CarbonIcon>();\n iconCache.set(ReactIcon, sizeMap);\n }\n\n // Return cached result if available for this size\n const cached = sizeMap.get(size);\n if (cached) {\n return cached;\n }\n\n try {\n // Call the React component to get the React element\n const element = React.createElement(ReactIcon, { size });\n\n // Extract CarbonIcon descriptor from React element\n const descriptor = extractCarbonIconFromReactElement(element, size);\n\n // Validate descriptor\n if (!isValidCarbonIcon(descriptor)) {\n throw new Error('Generated descriptor is invalid');\n }\n\n // Cache and return\n sizeMap.set(size, descriptor);\n return descriptor;\n } catch (error) {\n const iconName = ReactIcon.displayName || ReactIcon.name || 'Unknown';\n throw new Error(\n `Failed to transform React icon \"${iconName}\": ${error instanceof Error ? error.message : String(error)}`\n );\n }\n}\n\n/**\n * Extracts CarbonIcon descriptor from a React element tree\n */\nfunction extractCarbonIconFromReactElement(\n element: React.ReactElement,\n size: number\n): CarbonIcon {\n // The element should be an SVG or Icon component\n // Navigate through forwardRef and other wrappers if needed\n let currentElement = element;\n\n // Handle forwardRef wrapper\n if (\n typeof currentElement.type === 'object' &&\n 'render' in currentElement.type\n ) {\n // This is a forwardRef, call the render function\n const renderFn = (currentElement.type as any).render;\n currentElement = renderFn(currentElement.props, null);\n }\n\n // Now we should have the actual Icon element\n const props = currentElement.props as any;\n\n if (!props) {\n throw new Error('Unable to extract props from React element');\n }\n\n // Extract SVG attributes from props\n const attrs: Record<string, string | number> = {\n xmlns: props.xmlns || 'http://www.w3.org/2000/svg',\n viewBox: props.viewBox || '0 0 32 32',\n fill: props.fill || 'currentColor',\n width: size,\n height: size,\n };\n\n // Extract children (paths, circles, etc.)\n const content: any[] = [];\n const children = React.Children.toArray(props.children);\n\n children.forEach((child) => {\n if (React.isValidElement(child)) {\n const childElement = child as React.ReactElement;\n const contentItem: any = {\n elem:\n typeof childElement.type === 'string' ? childElement.type : 'path',\n attrs: {},\n };\n\n // Copy all props as attributes\n if (childElement.props) {\n Object.entries(childElement.props).forEach(([key, value]) => {\n // Skip children and other React-specific props\n if (key !== 'children' && value !== undefined && value !== null) {\n contentItem.attrs[key] = value;\n }\n });\n }\n\n content.push(contentItem);\n }\n });\n\n return {\n elem: 'svg',\n attrs,\n content,\n name: extractIconName(props),\n size,\n };\n}\n\n/**\n * Validates that a descriptor has all required CarbonIcon fields\n */\nfunction isValidCarbonIcon(descriptor: any): descriptor is CarbonIcon {\n return (\n descriptor &&\n descriptor.elem === 'svg' &&\n descriptor.attrs &&\n typeof descriptor.attrs === 'object' &&\n Array.isArray(descriptor.content) &&\n descriptor.content.length > 0 &&\n typeof descriptor.name === 'string' &&\n typeof descriptor.size === 'number'\n );\n}\n\n/**\n * Attempts to extract icon name from props\n */\nfunction extractIconName(props: any): string {\n // Try various properties that might contain the icon name\n return props['data-icon-name'] || props['aria-label'] || props.name || 'icon';\n}\n\n/**\n * Creates a React component from a `CarbonIconDescriptor` (a raw `@carbon/icons` import).\n *\n * @example\n * import Launch16 from '@carbon/icons/es/launch/16';\n * const LaunchIcon = carbonIconToReact(Launch16);\n * <LaunchIcon aria-label=\"Launch\" className=\"icon\" />\n */\nexport function carbonIconToReact(\n icon: CarbonIconDescriptor\n): FunctionComponent<CarbonIconProps> {\n return function IconComponent(props: CarbonIconProps = {}) {\n return React.createElement(\n 'svg',\n {\n ...icon.attrs,\n width: icon.attrs.width || 16,\n height: icon.attrs.height || 16,\n fill: icon.attrs.fill || 'currentColor',\n focusable: 'false',\n style: { pointerEvents: 'none' },\n ...props,\n },\n icon.content.map((child, i) =>\n React.createElement(child.elem, { key: i, ...(child.attrs || {}) })\n )\n );\n };\n}\n"],"names":[],"mappings":";;;;;;;;;AAAA;;;;;;;AAOG;AAEH;;;;;;;;;;;;;;;;;;;;;;;AAuBG;AAaH;AACA,MAAM,SAAS,GAAG,IAAI,OAAO,EAG1B;AAEH;;;AAGG;AACG,SAAU,YAAY,CAAC,IAAS,EAAA;IACpC,OAAO,OAAO,CACZ,IAAI;QACJ,OAAO,IAAI,KAAK,QAAQ;AACxB,QAAA,MAAM,IAAI,IAAI;AACd,QAAA,OAAO,IAAI,IAAI;AACf,QAAA,SAAS,IAAI,IAAI;AACjB,QAAA,IAAI,CAAC,IAAI,KAAK,KAAK,CACpB;AACH;AAEA;;;;AAIG;SACa,8BAA8B,CAC5C,IAA2C,EAC3C,IAAI,GAA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MAAM,EAAE,IAAI,CAAC,KAAK,CAAC,MAAM,IAAI,EAAE;AAC/B,YAAA,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,IAAI,cAAc;AACvC,YAAA,SAAS,EAAE,OAAO;AAClB,YAAA,KAAK,EAAE,EAAE,aAAa,EAAE,MAAM,EAAE;AAChC,YAAA,GAAG,KAAK;AACT,SAAA,EACD,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,KACxB,KAAK,CAAC,aAAa,CAAC,KAAK,CAAC,IAAI,EAAE,EAAE,GAAG,EAAE,CAAC,EAAE,IAAI,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC,EAAE,CAAC,CACpE,CACF;AACH,IAAA,CAAC;AACH;;"}
@@ -22,6 +22,9 @@ const CDSAIChatShell = withWebComponentBridge(createComponent({
22
22
  tagName: 'cds-custom-aichat-shell',
23
23
  elementClass: CDSChatShellElement,
24
24
  react: React,
25
+ events: {
26
+ onPanelFocusFallback: 'cds-custom-aichat-shell-panel-focus-fallback',
27
+ },
25
28
  }));
26
29
 
27
30
  export { CDSAIChatShell as default };
@@ -1 +1 @@
1
- {"version":3,"file":"chat-shell.js","sources":["../../src/react/chat-shell.ts"],"sourcesContent":["/**\n * @license\n *\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\nimport { createComponent } from '@lit/react';\nimport React from 'react';\nimport CDSChatShellElement from '../components/chat-shell/src/shell.js';\nimport { withWebComponentBridge } from './utils/withWebComponentBridge.js';\n\nconst CDSAIChatShell = withWebComponentBridge(\n createComponent({\n tagName: 'cds-custom-aichat-shell',\n elementClass: CDSChatShellElement,\n react: React,\n })\n);\n\nexport default CDSAIChatShell;\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAOH,MAAM,cAAc,GAAG,sBAAsB,CAC3C,eAAe,CAAC;AACd,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,YAAY,EAAE,mBAAmB;AACjC,IAAA,KAAK,EAAE,KAAK;AACb,CAAA,CAAC;;"}
1
+ {"version":3,"file":"chat-shell.js","sources":["../../src/react/chat-shell.ts"],"sourcesContent":["/**\n * @license\n *\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\nimport { createComponent } from '@lit/react';\nimport React from 'react';\nimport CDSChatShellElement from '../components/chat-shell/src/shell.js';\nimport { withWebComponentBridge } from './utils/withWebComponentBridge.js';\n\nconst CDSAIChatShell = withWebComponentBridge(\n createComponent({\n tagName: 'cds-custom-aichat-shell',\n elementClass: CDSChatShellElement,\n react: React,\n events: {\n onPanelFocusFallback: 'cds-custom-aichat-shell-panel-focus-fallback',\n },\n })\n);\n\nexport default CDSAIChatShell;\n"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;AAOG;AAOH,MAAM,cAAc,GAAG,sBAAsB,CAC3C,eAAe,CAAC;AACd,IAAA,OAAO,EAAE,kBAAkB;AAC3B,IAAA,YAAY,EAAE,mBAAmB;AACjC,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,MAAM,EAAE;AACN,QAAA,oBAAoB,EAAE,uCAAuC;AAC9D,KAAA;AACF,CAAA,CAAC;;"}
@@ -0,0 +1,12 @@
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 React from 'react';
10
+ declare const ConversationalSearchShell: React.ComponentType<any>;
11
+ export { ConversationalSearchShell };
12
+ export default ConversationalSearchShell;
@@ -0,0 +1,32 @@
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 { createComponent } from '@lit/react';
9
+ import React from 'react';
10
+ import ConversationalSearchShellElement from '../components/conversational-search/src/conversational-search-shell.js';
11
+ import prefix from '../globals/settings.js';
12
+ import { withWebComponentBridge } from './utils/withWebComponentBridge.js';
13
+
14
+ /**
15
+ * @license
16
+ *
17
+ * Copyright IBM Corp. 2026
18
+ *
19
+ * This source code is licensed under the Apache-2.0 license found in the
20
+ * LICENSE file in the root directory of this source tree.
21
+ */
22
+ const ConversationalSearchShell = withWebComponentBridge(createComponent({
23
+ tagName: `${prefix}-conversational-search-shell`,
24
+ elementClass: ConversationalSearchShellElement,
25
+ react: React,
26
+ events: {
27
+ onCitationsToggle: ConversationalSearchShellElement.eventCitationsToggle,
28
+ },
29
+ }));
30
+
31
+ export { ConversationalSearchShell, ConversationalSearchShell as default };
32
+ //# sourceMappingURL=conversational-search-shell.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"conversational-search-shell.js","sources":["../../src/react/conversational-search-shell.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 { createComponent, type EventName } from '@lit/react';\nimport React from 'react';\nimport ConversationalSearchShellElement, {\n type CitationToggleEventDetail,\n} from '../components/conversational-search/src/conversational-search-shell.js';\nimport prefix from '../globals/settings.js';\nimport { withWebComponentBridge } from './utils/withWebComponentBridge.js';\n\nconst ConversationalSearchShell = withWebComponentBridge(\n createComponent({\n tagName: `${prefix}-conversational-search-shell`,\n elementClass: ConversationalSearchShellElement,\n react: React,\n events: {\n onCitationsToggle:\n ConversationalSearchShellElement.eventCitationsToggle as EventName<\n CustomEvent<CitationToggleEventDetail>\n >,\n },\n })\n);\n\nexport { ConversationalSearchShell };\nexport default ConversationalSearchShell;\n"],"names":[],"mappings":";;;;;;;;;;;;;AAAA;;;;;;;AAOG;AAUH,MAAM,yBAAyB,GAAG,sBAAsB,CACtD,eAAe,CAAC;IACd,OAAO,EAAE,CAAA,EAAG,MAAM,CAAA,4BAAA,CAA8B;AAChD,IAAA,YAAY,EAAE,gCAAgC;AAC9C,IAAA,KAAK,EAAE,KAAK;AACZ,IAAA,MAAM,EAAE;QACN,iBAAiB,EACf,gCAAgC,CAAC,oBAEhC;AACJ,KAAA;AACF,CAAA,CAAC;;"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@carbon/ai-chat-components",
3
3
  "description": "AI Chat Components",
4
- "version": "1.12.0",
4
+ "version": "1.13.0-rc.2",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "repository": {
@@ -82,7 +82,7 @@
82
82
  "@codemirror/lint": "^6.9.2",
83
83
  "@codemirror/state": "^6.5.2",
84
84
  "@codemirror/view": "^6.38.5",
85
- "@ibm/telemetry-js": "^1.10.2",
85
+ "@ibm/telemetry-js": "^1.12.0",
86
86
  "@lezer/highlight": "^1.1.6",
87
87
  "@lit/react": "^1.0.8",
88
88
  "@tiptap/core": "^3.22.5",
@@ -133,12 +133,12 @@
133
133
  "@types/react": "^19.0.0",
134
134
  "@types/react-dom": "^19.0.0",
135
135
  "@vscode/markdown-it-katex": "^1.1.2",
136
- "@web/dev-server": "0.4.6",
137
- "@web/dev-server-esbuild": "1.0.5",
138
- "@web/test-runner": "0.19.0",
139
- "@web/test-runner-playwright": "^0.11.0",
136
+ "@web/dev-server": "1.0.0",
137
+ "@web/dev-server-esbuild": "2.0.0",
138
+ "@web/test-runner": "1.0.0",
139
+ "@web/test-runner-playwright": "^1.0.0",
140
140
  "autoprefixer": "^10.4.20",
141
- "babel-jest": "^30.0.0",
141
+ "babel-jest": "^30.5.2",
142
142
  "brace-expansion": "^5.0.8",
143
143
  "concurrently": "^10.0.0",
144
144
  "globby": "^16.0.0",
@@ -154,9 +154,9 @@
154
154
  "rollup-plugin-postcss": "^4.0.2",
155
155
  "rollup-plugin-postcss-lit": "^2.1.0",
156
156
  "storybook": "^10.2.8",
157
- "typescript": "^5.2.2",
157
+ "typescript": "^6.0.3",
158
158
  "vite": "^8.0.16",
159
159
  "web-dev-server-plugin-lit-css": "^4.0.0"
160
160
  },
161
- "gitHead": "b32b6269f10cd0e6187ecf6727b4a389da64a92b"
161
+ "gitHead": "14dac739774837ad3a8c8e1c3200aed907eaf34f"
162
162
  }
package/telemetry.yml CHANGED
@@ -131,6 +131,12 @@ collect:
131
131
  - oncontent-change
132
132
  - show-less-text
133
133
  - show-more-text
134
+ # cds-aichat-conversational-search-shell
135
+ - citations-label
136
+ - citations-open
137
+ - oncds-aichat-citations-toggle
138
+ - show-citations-toggle
139
+ - toggle-label
134
140
  # cds-aichat-error-message
135
141
  - description
136
142
  - fullscreen
@@ -313,10 +319,6 @@ collect:
313
319
  # General - type
314
320
  - expand
315
321
  - tooltip
316
- # cds-aichat-chain-of-thought-step - status
317
- - failure
318
- - processing
319
- - success
320
322
  # cds-aichat-chat-header - navigation-type
321
323
  - back
322
324
  - none