@carbon/web-components 2.43.0 → 2.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (217) hide show
  1. package/custom-elements.json +8 -15
  2. package/dist/accordion.min.js +3 -3
  3. package/dist/ai-label.min.js +3 -3
  4. package/dist/ai-skeleton.min.js +3 -3
  5. package/dist/badge-indicator.min.js +3 -3
  6. package/dist/breadcrumb.min.js +6 -6
  7. package/dist/{button-eTloXzqX.js → button-CKgb4gp4.js} +4 -3
  8. package/dist/{button-skeleton-Dk3chlBc.js → button-skeleton-CXiEp3M8.js} +3 -3
  9. package/dist/button.min.js +3 -3
  10. package/dist/chat-button.min.js +3 -3
  11. package/dist/{checkbox-cr5-wvt1.js → checkbox-cQAHKwqU.js} +3 -3
  12. package/dist/checkbox.min.js +3 -3
  13. package/dist/{class-map-CJoc5JjN.js → class-map-warKt-hW.js} +3 -3
  14. package/dist/code-snippet.min.js +3 -3
  15. package/dist/combo-box.min.js +20 -9
  16. package/dist/combo-button.min.js +3 -3
  17. package/dist/{content-switcher-item-3fTDI2Aq.js → content-switcher-item-Cvkk1snv.js} +3 -3
  18. package/dist/content-switcher.min.js +3 -3
  19. package/dist/copy-button.min.js +3 -3
  20. package/dist/data-table.min.js +3 -3
  21. package/dist/date-picker.min.js +3 -3
  22. package/dist/dropdown-item-BHkaXms6.js +100 -0
  23. package/dist/dropdown.min.js +6 -10
  24. package/dist/feature-flags.min.js +3 -3
  25. package/dist/file-uploader.min.js +3 -3
  26. package/dist/floating-menu.min.js +3 -3
  27. package/dist/fluid-search.min.js +3 -3
  28. package/dist/fluid-select.min.js +3 -3
  29. package/dist/fluid-text-input.min.js +3 -3
  30. package/dist/fluid-textarea.min.js +3 -3
  31. package/dist/{focus-yD1Q_pDt.js → focus-Bwk_lgHl.js} +3 -3
  32. package/dist/{form-BaYTr2z0.js → form-CfvlKX6g.js} +3 -3
  33. package/dist/form-group.min.js +3 -3
  34. package/dist/form.min.js +3 -3
  35. package/dist/grid.min.js +3 -3
  36. package/dist/heading.min.js +3 -3
  37. package/dist/{host-listener-BJsBtsIt.js → host-listener-DJH6yN4y.js} +3 -3
  38. package/dist/icon-button.min.js +3 -3
  39. package/dist/icon-indicator.min.js +3 -3
  40. package/dist/{icon-loader-CqB9WRMP.js → icon-loader-pxyCrZwZ.js} +3 -3
  41. package/dist/{icon-loader-utils-DUl0vwdh.js → icon-loader-utils-lPqg1iFP.js} +3 -3
  42. package/dist/icon.min.js +3 -3
  43. package/dist/{if-defined-IxozbDOJ.js → if-defined-zhGxRN9M.js} +3 -3
  44. package/dist/{if-non-empty-CqQHBHdQ.js → if-non-empty-CTDui88C.js} +3 -3
  45. package/dist/inline-loading.min.js +4 -4
  46. package/dist/layer.min.js +3 -3
  47. package/dist/link.min.js +3 -3
  48. package/dist/list.min.js +3 -3
  49. package/dist/{loading-icon-CSgLYhyw.js → loading-icon-DfL1aC0N.js} +3 -3
  50. package/dist/loading.min.js +3 -3
  51. package/dist/menu-button.min.js +3 -3
  52. package/dist/menu.min.js +3 -3
  53. package/dist/modal.min.js +3 -3
  54. package/dist/multi-select.min.js +4 -3
  55. package/dist/notification.min.js +3 -3
  56. package/dist/number-input.min.js +3 -3
  57. package/dist/overflow-menu.min.js +3 -3
  58. package/dist/page-header.min.js +3 -3
  59. package/dist/pagination.min.js +3 -3
  60. package/dist/password-input.min.js +3 -3
  61. package/dist/popover.min.js +3 -3
  62. package/dist/progress-bar.min.js +3 -3
  63. package/dist/progress-indicator.min.js +3 -3
  64. package/dist/{property-B_F7V5eB.js → property-CoShOfqo.js} +3 -3
  65. package/dist/{query-assigned-elements-DeMmXVMb.js → query-assigned-elements-DvdLJjH_.js} +3 -3
  66. package/dist/radio-button.min.js +3 -3
  67. package/dist/{search-DhwzN9sI.js → search-mXlboHWm.js} +3 -3
  68. package/dist/search.min.js +3 -3
  69. package/dist/{select-BIi12O8B.js → select-BLrQXy2c.js} +4 -3
  70. package/dist/{select-item-Be7OL9mD.js → select-item-CMDCy7c6.js} +3 -3
  71. package/dist/{select-skeleton-8uIIQzNt.js → select-skeleton-D_qjQ9lZ.js} +3 -3
  72. package/dist/select.min.js +3 -3
  73. package/dist/shape-indicator.min.js +3 -3
  74. package/dist/side-panel.min.js +3 -3
  75. package/dist/skeleton-icon.min.js +3 -3
  76. package/dist/skeleton-placeholder.min.js +3 -3
  77. package/dist/skeleton-text.min.js +3 -3
  78. package/dist/skip-to-content.min.js +3 -3
  79. package/dist/slider.min.js +3 -3
  80. package/dist/slug.min.js +3 -3
  81. package/dist/stack.min.js +3 -3
  82. package/dist/{state-CJQmj6wG.js → state-D7rtIkB2.js} +3 -3
  83. package/dist/structured-list.min.js +3 -3
  84. package/dist/tabs.min.js +3 -3
  85. package/dist/tag.min.js +3 -3
  86. package/dist/tearsheet.min.js +3 -3
  87. package/dist/{text-input-C0qeKR9e.js → text-input-CIM-jSOC.js} +3 -3
  88. package/dist/text-input.min.js +3 -3
  89. package/dist/textarea.min.js +3 -3
  90. package/dist/tile.min.js +3 -3
  91. package/dist/time-picker.min.js +3 -3
  92. package/dist/toggle-tip.min.js +3 -3
  93. package/dist/toggle.min.js +3 -3
  94. package/dist/{tooltip-content-CMbdEoxb.js → tooltip-content-D25Rgp9z.js} +3 -3
  95. package/dist/tooltip.min.js +3 -3
  96. package/dist/tree-view.min.js +3 -3
  97. package/dist/ui-shell.min.js +3 -3
  98. package/dist/{unsafe-html-Dqv0UqC_.js → unsafe-html-C26Gpb7O.js} +3 -3
  99. package/es/components/ai-label/ai-label.scss.js +1 -1
  100. package/es/components/breadcrumb/breadcrumb.scss.js +1 -1
  101. package/es/components/button/button.js +1 -0
  102. package/es/components/button/button.js.map +1 -1
  103. package/es/components/combo-box/combo-box-item.d.ts +10 -1
  104. package/es/components/combo-box/combo-box-item.js +65 -1
  105. package/es/components/combo-box/combo-box-item.js.map +1 -1
  106. package/es/components/combo-box/combo-box.d.ts +6 -9
  107. package/es/components/combo-box/combo-box.js +108 -65
  108. package/es/components/combo-box/combo-box.js.map +1 -1
  109. package/es/components/combo-box/combo-box.scss.js +1 -1
  110. package/es/components/data-table/data-table.scss.js +1 -1
  111. package/es/components/dropdown/dropdown-skeleton.d.ts +10 -1
  112. package/es/components/dropdown/dropdown-skeleton.js +31 -7
  113. package/es/components/dropdown/dropdown-skeleton.js.map +1 -1
  114. package/es/components/dropdown/dropdown.d.ts +41 -7
  115. package/es/components/dropdown/dropdown.js +438 -65
  116. package/es/components/dropdown/dropdown.js.map +1 -1
  117. package/es/components/dropdown/dropdown.scss.js +1 -1
  118. package/es/components/icon-button/icon-button.scss.js +1 -1
  119. package/es/components/inline-loading/inline-loading.js +1 -1
  120. package/es/components/inline-loading/inline-loading.js.map +1 -1
  121. package/es/components/inline-loading/inline-loading.scss.js +1 -1
  122. package/es/components/multi-select/multi-select.d.ts +13 -1
  123. package/es/components/multi-select/multi-select.js +53 -0
  124. package/es/components/multi-select/multi-select.js.map +1 -1
  125. package/es/components/multi-select/multi-select.scss.js +1 -1
  126. package/es/components/popover/popover.scss.js +1 -1
  127. package/es/components/select/select.js +1 -0
  128. package/es/components/select/select.js.map +1 -1
  129. package/es/components/slug/slug.scss.js +1 -1
  130. package/es/components/toggle-tip/toggletip.scss.js +1 -1
  131. package/es/components/tooltip/tooltip.js +1 -1
  132. package/es/components/tooltip/tooltip.js.map +1 -1
  133. package/es/components/tooltip/tooltip.scss.js +1 -1
  134. package/es-custom/components/ai-label/ai-label.scss.js +1 -1
  135. package/es-custom/components/breadcrumb/breadcrumb.scss.js +1 -1
  136. package/es-custom/components/button/button.js +1 -0
  137. package/es-custom/components/button/button.js.map +1 -1
  138. package/es-custom/components/combo-box/combo-box-item.d.ts +10 -1
  139. package/es-custom/components/combo-box/combo-box-item.js +65 -1
  140. package/es-custom/components/combo-box/combo-box-item.js.map +1 -1
  141. package/es-custom/components/combo-box/combo-box.d.ts +6 -9
  142. package/es-custom/components/combo-box/combo-box.js +108 -65
  143. package/es-custom/components/combo-box/combo-box.js.map +1 -1
  144. package/es-custom/components/combo-box/combo-box.scss.js +1 -1
  145. package/es-custom/components/data-table/data-table.scss.js +1 -1
  146. package/es-custom/components/dropdown/dropdown-skeleton.d.ts +10 -1
  147. package/es-custom/components/dropdown/dropdown-skeleton.js +31 -7
  148. package/es-custom/components/dropdown/dropdown-skeleton.js.map +1 -1
  149. package/es-custom/components/dropdown/dropdown.d.ts +41 -7
  150. package/es-custom/components/dropdown/dropdown.js +438 -65
  151. package/es-custom/components/dropdown/dropdown.js.map +1 -1
  152. package/es-custom/components/dropdown/dropdown.scss.js +1 -1
  153. package/es-custom/components/icon-button/icon-button.scss.js +1 -1
  154. package/es-custom/components/inline-loading/inline-loading.js +1 -1
  155. package/es-custom/components/inline-loading/inline-loading.js.map +1 -1
  156. package/es-custom/components/inline-loading/inline-loading.scss.js +1 -1
  157. package/es-custom/components/multi-select/multi-select.d.ts +13 -1
  158. package/es-custom/components/multi-select/multi-select.js +53 -0
  159. package/es-custom/components/multi-select/multi-select.js.map +1 -1
  160. package/es-custom/components/multi-select/multi-select.scss.js +1 -1
  161. package/es-custom/components/popover/popover.scss.js +1 -1
  162. package/es-custom/components/select/select.js +1 -0
  163. package/es-custom/components/select/select.js.map +1 -1
  164. package/es-custom/components/slug/slug.scss.js +1 -1
  165. package/es-custom/components/toggle-tip/toggletip.scss.js +1 -1
  166. package/es-custom/components/tooltip/tooltip.js +1 -1
  167. package/es-custom/components/tooltip/tooltip.js.map +1 -1
  168. package/es-custom/components/tooltip/tooltip.scss.js +1 -1
  169. package/lib/components/combo-box/combo-box-item.d.ts +10 -1
  170. package/lib/components/combo-box/combo-box.d.ts +6 -9
  171. package/lib/components/dropdown/dropdown-skeleton.d.ts +10 -1
  172. package/lib/components/dropdown/dropdown.d.ts +41 -7
  173. package/lib/components/multi-select/multi-select.d.ts +13 -1
  174. package/package.json +6 -6
  175. package/scss/components/breadcrumb/breadcrumb.scss +1 -3
  176. package/scss/components/combo-box/combo-box.scss +72 -3
  177. package/scss/components/data-table/_table-core.scss +10 -0
  178. package/scss/components/data-table/_table-expandable.scss +6 -0
  179. package/scss/components/data-table/_table-selection.scss +7 -0
  180. package/scss/components/data-table/_table-sizes.scss +4 -0
  181. package/scss/components/data-table/data-table.scss +6 -9
  182. package/scss/components/dropdown/dropdown.scss +174 -22
  183. package/scss/components/menu/menu-variables.scss +0 -2
  184. package/scss/components/menu/menu.scss +1 -1
  185. package/scss/components/multi-select/multi-select.scss +7 -0
  186. package/scss/components/overflow-menu/overflow-menu.scss +0 -2
  187. package/scss/components/popover/popover.scss +58 -11
  188. package/scss/components/tooltip/tooltip-story.scss +8 -4
  189. package/telemetry.yml +0 -1
  190. package/dist/dropdown-item-BO7AhHPd.js +0 -96
  191. package/dist/{16-DhAznVKm.js → 16-5c5jFrXp.js} +2 -2
  192. package/dist/{16-B7MRS_3W.js → 16-B9Uo1cvh.js} +2 -2
  193. package/dist/{16-BWlgPBcu.js → 16-BMXNUlRI.js} +2 -2
  194. package/dist/{16-CdxGkvXO.js → 16-C-j0eQg7.js} +2 -2
  195. package/dist/{16-CJNlj_0b.js → 16-CZiCF7iO.js} +2 -2
  196. package/dist/{16-DoN7q01_.js → 16-CmZExt83.js} +2 -2
  197. package/dist/{16-DTvjc9uv.js → 16-DbvtK9-e.js} +2 -2
  198. package/dist/{16-GKRs-ALp.js → 16-INlZq7cB.js} +2 -2
  199. package/dist/{16-B46MLj4i.js → 16-dlAJdf7K.js} +2 -2
  200. package/dist/{16-B3Yskhl0.js → 16-tP236nqZ.js} +2 -2
  201. package/dist/{16-Bf2P7KMJ.js → 16-u6yXz6wM.js} +2 -2
  202. package/dist/{16-Bxm7Omxq.js → 16-vHbYZhS2.js} +2 -2
  203. package/dist/{20-CuEbZLGA.js → 20-ClE5EQkn.js} +2 -2
  204. package/dist/{20-DlknbFYR.js → 20-seUgpuwc.js} +2 -2
  205. package/dist/{carbon-element-DDrYm3XO.js → carbon-element-sn5DFO1t.js} +2 -2
  206. package/dist/{collection-helpers-C5emLOnk.js → collection-helpers-DwvpKeJx.js} +2 -2
  207. package/dist/{consume-BeeFGGfo.js → consume-C6px77x6.js} +2 -2
  208. package/dist/{directive-Dlo2OKiC.js → directive-CwtBJVHj.js} +2 -2
  209. package/dist/{floating-controller-DLpRVhGd.js → floating-controller-qGN47tO7.js} +2 -2
  210. package/dist/{host-listener-BCnAWDV7.js → host-listener-6VuJ4xzb.js} +2 -2
  211. package/dist/{lit-element-eFlPHqE1.js → lit-element-ljyXx2IF.js} +2 -2
  212. package/dist/{on-DvnWS_DB.js → on-CsYzs_5y.js} +2 -2
  213. package/dist/{query-BdmT5Ln1.js → query-BpyCOA3I.js} +2 -2
  214. package/dist/{radio-group-manager-B_pENWmT.js → radio-group-manager-DCfD4e6U.js} +2 -2
  215. package/dist/{settings-BBN_bDP6.js → settings-BYFrjJ1N.js} +2 -2
  216. package/dist/{shared-enums-D8TrS6Ts.js → shared-enums-BhRvRKoR.js} +2 -2
  217. package/dist/{validity-BUGyJDQ6.js → validity-wk0CEz9X.js} +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"button.js","sources":["../../../src/components/button/button.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 2023\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 { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport {\n BUTTON_KIND,\n BUTTON_TYPE,\n BUTTON_SIZE,\n BUTTON_TOOLTIP_ALIGNMENT,\n BUTTON_TOOLTIP_POSITION,\n} from './defs';\nimport styles from './button.scss?lit';\nimport HostListener from '../../globals/decorators/host-listener';\nimport HostListenerMixin from '../../globals/mixins/host-listener';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport {\n BUTTON_KIND,\n BUTTON_TYPE,\n BUTTON_SIZE,\n BUTTON_TOOLTIP_ALIGNMENT,\n BUTTON_TOOLTIP_POSITION,\n};\n\n/**\n * Button.\n *\n * @element cds-button\n * @csspart button The button.\n */\n@customElement(`${prefix}-button`)\nclass CDSButton extends HostListenerMixin(FocusMixin(LitElement)) {\n /**\n * `true` if there is an icon.\n */\n private _hasIcon = false;\n\n /**\n * Handles `slotchange` event.\n */\n private _handleSlotChange({ target }: Event) {\n const { name } = target as HTMLSlotElement;\n const hasContent = (target as HTMLSlotElement).assignedNodes().some(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n (node) => node.nodeType !== Node.TEXT_NODE || node!.textContent!.trim()\n );\n this[name === 'icon' ? '_hasIcon' : 'hasMainContent'] = hasContent;\n this.requestUpdate();\n }\n\n @HostListener('click', { capture: true })\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore\n private _handleDisabledClick(event: Event) {\n const { disabled } = this;\n if (disabled) {\n event.stopPropagation();\n }\n }\n\n private _checkBadgeWarning() {\n const hasBadgeIndicator = this.querySelector(`${prefix}-badge-indicator`);\n if (\n hasBadgeIndicator &&\n (this.kind !== BUTTON_KIND.GHOST || this.size !== BUTTON_SIZE.LARGE)\n ) {\n // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452\n console.warn(\n `The badge indicator must be used with kind='ghost' and size='lg'`\n );\n }\n }\n updated(changedProperties) {\n super.updated?.(changedProperties);\n this._checkBadgeWarning();\n }\n\n @HostListener('mouseover')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleOver = () => {\n this.openTooltip = true;\n };\n\n /**\n * Handles `keydown` event on this element.\n */\n @HostListener('mouseout')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleHoverOut = async () => {\n this.openTooltip = false;\n };\n\n /**\n * Handles `keydown` event on this element.\n * Space & enter will toggle state, Escape will only close.\n */\n @HostListener('focus')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleFocus = async () => {\n this.openTooltip = true;\n };\n\n /**\n * Handles `keydown` event on this element.\n * Space & enter will toggle state, Escape will only close.\n */\n @HostListener('focusout')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleFocusout = async () => {\n this.openTooltip = false;\n };\n\n /**\n * `true` if the button should have input focus when the page loads.\n */\n @property({ type: Boolean, reflect: true })\n autofocus = false;\n\n /**\n * `true` if the button is being used within a data table batch action toolbar\n */\n @property({ type: Boolean, reflect: true, attribute: 'batch-action' })\n batchAction = false;\n\n /**\n * Specify an optional className to be added to your Button\n */\n @property({ reflect: true, attribute: 'button-class-name' })\n buttonClassName;\n\n /**\n * Specify the message read by screen readers for the danger button variant\n */\n @property({ reflect: true, attribute: 'danger-description' })\n dangerDescription;\n\n /**\n * `true` if the button should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * The default file name, used if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n download!: string;\n\n /**\n * `true` if there is a non-icon content.\n */\n @property({ reflect: true, attribute: 'has-main-content', type: Boolean })\n hasMainContent = false;\n\n /**\n * Link `href`. If present, this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n href!: string;\n\n /**\n * The language of what `href` points to, if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n hreflang!: string;\n\n /**\n * `true` if expressive theme enabled.\n */\n @property({ type: Boolean, reflect: true })\n isExpressive = false;\n\n /**\n * Specify whether the Button is currently selected.\n * Only applies to the Ghost variant.\n */\n @property({ type: Boolean, reflect: true })\n isSelected = false;\n\n /**\n * Button kind.\n */\n @property({ reflect: true })\n kind = BUTTON_KIND.PRIMARY;\n\n /**\n * The a11y role for `<a>`.\n */\n @property({ attribute: 'link-role' })\n linkRole = 'button';\n\n /**\n * Boolean to determine if tooltip is open.\n */\n @property({ type: Boolean })\n openTooltip = false;\n\n /**\n * URLs to ping, if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n ping!: string;\n\n /**\n * The link type, if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n rel!: string;\n\n /**\n * Button size.\n */\n @property({ reflect: true })\n size = 'lg';\n\n /**\n * Specify the tabIndex of the button.\n */\n @property({ type: Number, attribute: 'tab-index', reflect: true })\n tabIndex = 0;\n\n /**\n * The link target, if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n target!: string;\n\n /**\n * Specify the alignment of the tooltip to the icon-only button.\n * Can be one of: start, center, or end.\n */\n @property({ reflect: true, attribute: 'tooltip-alignment' })\n tooltipAlignment = BUTTON_TOOLTIP_ALIGNMENT.CENTER;\n\n /**\n * Specify the direction of the tooltip for icon-only buttons.\n * Can be either top, right, bottom, or left.\n */\n @property({ reflect: true, attribute: 'tooltip-position' })\n tooltipPosition = BUTTON_TOOLTIP_POSITION.TOP;\n\n /**\n * Specify the text to be rendered in the tooltip. If using\n * \"cds-badge-indicator\" with no count prop then the text\n * should include describing there is a new notification.\n */\n @property({ reflect: true, attribute: 'tooltip-text' })\n tooltipText!: string;\n\n /**\n * Button type.\n */\n @property({ reflect: true })\n type = BUTTON_TYPE.BUTTON;\n\n render() {\n const {\n autofocus,\n buttonClassName,\n dangerDescription,\n disabled,\n download,\n href,\n hreflang,\n kind,\n isExpressive,\n isSelected,\n linkRole,\n openTooltip,\n ping,\n rel,\n size,\n tabIndex,\n target,\n tooltipAlignment,\n tooltipPosition,\n tooltipText,\n type,\n _hasIcon: hasIcon,\n hasMainContent,\n _handleSlotChange: handleSlotChange,\n } = this;\n\n let defaultClasses = {\n [`${prefix}--btn`]: true,\n [`${prefix}--btn--${kind}`]: kind,\n [`${prefix}--btn--danger--tertiary`]:\n kind === BUTTON_KIND.DANGER_TERTIARY,\n [`${prefix}--btn--danger--ghost`]: kind === BUTTON_KIND.DANGER_GHOST,\n [`${prefix}--btn--disabled`]: disabled,\n [`${prefix}--btn--icon-only`]: hasIcon && !hasMainContent,\n [`${prefix}--btn--${size}`]: size,\n [`${prefix}--layout--size-${size}`]: size,\n [`${prefix}-ce--btn--has-icon`]: hasIcon,\n [`${prefix}--btn--expressive`]: isExpressive,\n [`${prefix}--btn--selected`]: isSelected && kind === 'ghost',\n };\n\n if (buttonClassName) {\n const outputObject = {};\n buttonClassName?.split(' ').forEach((element) => {\n outputObject[element] = true;\n });\n defaultClasses = { ...defaultClasses, ...outputObject };\n }\n const classes = classMap(defaultClasses);\n\n const isDanger = kind.includes('danger');\n\n if (href) {\n return disabled\n ? html`\n <p id=\"button\" part=\"button\" class=\"${classes}\">\n <slot @slotchange=\"${handleSlotChange}\"></slot>\n <slot name=\"icon\" @slotchange=\"${handleSlotChange}\"></slot>\n </p>\n `\n : html`\n <a\n id=\"button\"\n part=\"button\"\n role=\"${ifDefined(linkRole)}\"\n class=\"${classes}\"\n download=\"${ifDefined(download)}\"\n href=\"${ifDefined(href)}\"\n hreflang=\"${ifDefined(hreflang)}\"\n ping=\"${ifDefined(ping)}\"\n rel=\"${ifDefined(rel)}\"\n target=\"${ifDefined(target)}\"\n type=\"${ifDefined(type)}\"\n tabindex=\"${tabIndex}\"\n aria-describedby=\"badge-indicator\">\n <slot @slotchange=\"${handleSlotChange}\"></slot>\n <slot name=\"icon\" @slotchange=\"${handleSlotChange}\"></slot>\n </a>\n ${html`<slot id=\"badge-indicator\" name=\"badge-indicator\"></slot>` ??\n !disabled}\n `;\n }\n\n const alignmentClass =\n tooltipAlignment &&\n (tooltipPosition === BUTTON_TOOLTIP_POSITION.TOP ||\n tooltipPosition === BUTTON_TOOLTIP_POSITION.BOTTOM)\n ? `-${tooltipAlignment}`\n : '';\n\n const tooltipClasses = classMap({\n [`${prefix}--popover-container`]: true,\n [`${prefix}--popover--caret`]: true,\n [`${prefix}--popover--high-contrast`]: true,\n [`${prefix}--tooltip`]: true,\n [`${prefix}--icon-tooltip`]: hasIcon,\n [`${prefix}--popover--open`]: openTooltip,\n [`${prefix}--popover--${tooltipPosition}${alignmentClass}`]: tooltipText,\n });\n\n return tooltipText && !disabled\n ? html`\n <span class=\"${tooltipClasses}\">\n <button\n id=\"button\"\n part=\"button\"\n class=\"${classes}\"\n ?autofocus=\"${autofocus}\"\n ?disabled=\"${disabled}\"\n tabindex=\"${tabIndex}\"\n type=\"${ifDefined(type)}\"\n aria-label=\"${ifDefined(tooltipText)}\"\n aria-describedby=\"badge-indicator\">\n <slot @slotchange=\"${handleSlotChange}\"></slot>\n <slot name=\"icon\" @slotchange=\"${handleSlotChange}\"></slot>\n </button>\n <span class=\"${prefix}--popover\">\n <span\n class=\"${prefix}--popover-content ${prefix}--tooltip-content\">\n ${tooltipText}\n </span>\n <span class=\"${prefix}--popover-caret\"></span>\n </span>\n ${html`<slot id=\"badge-indicator\" name=\"badge-indicator\"></slot>` ??\n !disabled}\n </span>\n `\n : html`\n <button\n id=\"button\"\n part=\"button\"\n class=\"${classes}\"\n ?autofocus=\"${autofocus}\"\n ?disabled=\"${disabled}\"\n tabindex=\"${tabIndex}\"\n type=\"${ifDefined(type)}\"\n aria-describedby=\"badge-indicator\">\n ${isDanger\n ? html`<span class=\"${prefix}--visually-hidden\"\n >${dangerDescription}</span\n >`\n : ``}\n <slot @slotchange=\"${handleSlotChange}\"></slot>\n <slot name=\"icon\" @slotchange=\"${handleSlotChange}\"></slot>\n </button>\n ${html`<slot id=\"badge-indicator\" name=\"badge-indicator\"></slot>` ??\n !disabled}\n `;\n }\n\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n static styles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CAAA,OAAA,CAAS;AAC3B,CAAA,EAAA,SAAS,CAiYd;AAED,kBAAe,SAAS;;;;"}
1
+ {"version":3,"file":"button.js","sources":["../../../src/components/button/button.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 2023\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 { classMap } from 'lit/directives/class-map.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { LitElement, html } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { prefix } from '../../globals/settings';\nimport FocusMixin from '../../globals/mixins/focus';\nimport {\n BUTTON_KIND,\n BUTTON_TYPE,\n BUTTON_SIZE,\n BUTTON_TOOLTIP_ALIGNMENT,\n BUTTON_TOOLTIP_POSITION,\n} from './defs';\nimport styles from './button.scss?lit';\nimport HostListener from '../../globals/decorators/host-listener';\nimport HostListenerMixin from '../../globals/mixins/host-listener';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport {\n BUTTON_KIND,\n BUTTON_TYPE,\n BUTTON_SIZE,\n BUTTON_TOOLTIP_ALIGNMENT,\n BUTTON_TOOLTIP_POSITION,\n};\n\n/**\n * Button.\n *\n * @element cds-button\n * @csspart button The button.\n */\n@customElement(`${prefix}-button`)\nclass CDSButton extends HostListenerMixin(FocusMixin(LitElement)) {\n /**\n * `true` if there is an icon.\n */\n private _hasIcon = false;\n\n /**\n * Handles `slotchange` event.\n */\n private _handleSlotChange({ target }: Event) {\n const { name } = target as HTMLSlotElement;\n const hasContent = (target as HTMLSlotElement).assignedNodes().some(\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n (node) => node.nodeType !== Node.TEXT_NODE || node!.textContent!.trim()\n );\n this[name === 'icon' ? '_hasIcon' : 'hasMainContent'] = hasContent;\n this.requestUpdate();\n }\n\n @HostListener('click', { capture: true })\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore\n private _handleDisabledClick(event: Event) {\n const { disabled } = this;\n if (disabled) {\n event.stopPropagation();\n }\n }\n\n private _checkBadgeWarning() {\n const hasBadgeIndicator = this.querySelector(`${prefix}-badge-indicator`);\n if (\n hasBadgeIndicator &&\n (this.kind !== BUTTON_KIND.GHOST || this.size !== BUTTON_SIZE.LARGE)\n ) {\n // eslint-disable-next-line no-console -- https://github.com/carbon-design-system/carbon/issues/20452\n console.warn(\n `The badge indicator must be used with kind='ghost' and size='lg'`\n );\n }\n }\n updated(changedProperties) {\n super.updated?.(changedProperties);\n this._checkBadgeWarning();\n }\n\n @HostListener('mouseover')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleOver = () => {\n this.openTooltip = true;\n };\n\n /**\n * Handles `keydown` event on this element.\n */\n @HostListener('mouseout')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleHoverOut = async () => {\n this.openTooltip = false;\n };\n\n /**\n * Handles `keydown` event on this element.\n * Space & enter will toggle state, Escape will only close.\n */\n @HostListener('focus')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleFocus = async () => {\n this.openTooltip = true;\n };\n\n /**\n * Handles `keydown` event on this element.\n * Space & enter will toggle state, Escape will only close.\n */\n @HostListener('focusout')\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: The decorator refers to this method but TS thinks this method is not referred to\n private _handleFocusout = async () => {\n this.openTooltip = false;\n };\n\n /**\n * `true` if the button should have input focus when the page loads.\n */\n @property({ type: Boolean, reflect: true })\n autofocus = false;\n\n /**\n * `true` if the button is being used within a data table batch action toolbar\n */\n @property({ type: Boolean, reflect: true, attribute: 'batch-action' })\n batchAction = false;\n\n /**\n * Specify an optional className to be added to your Button\n */\n @property({ reflect: true, attribute: 'button-class-name' })\n buttonClassName;\n\n /**\n * Specify the message read by screen readers for the danger button variant\n */\n @property({ reflect: true, attribute: 'danger-description' })\n dangerDescription;\n\n /**\n * `true` if the button should be disabled.\n */\n @property({ type: Boolean, reflect: true })\n disabled = false;\n\n /**\n * The default file name, used if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n download!: string;\n\n /**\n * `true` if there is a non-icon content.\n */\n @property({ reflect: true, attribute: 'has-main-content', type: Boolean })\n hasMainContent = false;\n\n /**\n * Link `href`. If present, this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n href!: string;\n\n /**\n * The language of what `href` points to, if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n hreflang!: string;\n\n /**\n * `true` if expressive theme enabled.\n */\n @property({ type: Boolean, reflect: true })\n isExpressive = false;\n\n /**\n * Specify whether the Button is currently selected.\n * Only applies to the Ghost variant.\n */\n @property({ type: Boolean, reflect: true })\n isSelected = false;\n\n /**\n * Button kind.\n */\n @property({ reflect: true })\n kind = BUTTON_KIND.PRIMARY;\n\n /**\n * The a11y role for `<a>`.\n */\n @property({ attribute: 'link-role' })\n linkRole = 'button';\n\n /**\n * Boolean to determine if tooltip is open.\n */\n @property({ type: Boolean })\n openTooltip = false;\n\n /**\n * URLs to ping, if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n ping!: string;\n\n /**\n * The link type, if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n rel!: string;\n\n /**\n * Button size.\n */\n @property({ reflect: true })\n size = 'lg';\n\n /**\n * Specify the tabIndex of the button.\n */\n @property({ type: Number, attribute: 'tab-index', reflect: true })\n tabIndex = 0;\n\n /**\n * The link target, if this button is rendered as `<a>`.\n */\n @property({ reflect: true })\n target!: string;\n\n /**\n * Specify the alignment of the tooltip to the icon-only button.\n * Can be one of: start, center, or end.\n */\n @property({ reflect: true, attribute: 'tooltip-alignment' })\n tooltipAlignment = BUTTON_TOOLTIP_ALIGNMENT.CENTER;\n\n /**\n * Specify the direction of the tooltip for icon-only buttons.\n * Can be either top, right, bottom, or left.\n */\n @property({ reflect: true, attribute: 'tooltip-position' })\n tooltipPosition = BUTTON_TOOLTIP_POSITION.TOP;\n\n /**\n * Specify the text to be rendered in the tooltip. If using\n * \"cds-badge-indicator\" with no count prop then the text\n * should include describing there is a new notification.\n */\n @property({ reflect: true, attribute: 'tooltip-text' })\n tooltipText!: string;\n\n /**\n * Button type.\n */\n @property({ reflect: true })\n type = BUTTON_TYPE.BUTTON;\n\n render() {\n const {\n autofocus,\n buttonClassName,\n dangerDescription,\n disabled,\n download,\n href,\n hreflang,\n kind,\n isExpressive,\n isSelected,\n linkRole,\n openTooltip,\n ping,\n rel,\n size,\n tabIndex,\n target,\n tooltipAlignment,\n tooltipPosition,\n tooltipText,\n type,\n _hasIcon: hasIcon,\n hasMainContent,\n _handleSlotChange: handleSlotChange,\n } = this;\n\n let defaultClasses = {\n [`${prefix}--btn`]: true,\n [`${prefix}--btn--${kind}`]: kind,\n [`${prefix}--btn--danger--tertiary`]:\n kind === BUTTON_KIND.DANGER_TERTIARY,\n [`${prefix}--btn--danger--ghost`]: kind === BUTTON_KIND.DANGER_GHOST,\n [`${prefix}--btn--disabled`]: disabled,\n [`${prefix}--btn--icon-only`]: hasIcon && !hasMainContent,\n [`${prefix}--btn--${size}`]: size,\n [`${prefix}--layout--size-${size}`]: size,\n [`${prefix}-ce--btn--has-icon`]: hasIcon,\n [`${prefix}--btn--expressive`]: isExpressive,\n [`${prefix}--btn--selected`]: isSelected && kind === 'ghost',\n };\n\n if (buttonClassName) {\n const outputObject = {};\n buttonClassName?.split(' ').forEach((element) => {\n outputObject[element] = true;\n });\n defaultClasses = { ...defaultClasses, ...outputObject };\n }\n const classes = classMap(defaultClasses);\n\n const isDanger = kind.includes('danger');\n\n if (href) {\n return disabled\n ? html`\n <p id=\"button\" part=\"button\" class=\"${classes}\">\n <slot @slotchange=\"${handleSlotChange}\"></slot>\n <slot name=\"icon\" @slotchange=\"${handleSlotChange}\"></slot>\n </p>\n `\n : html`\n <a\n id=\"button\"\n part=\"button\"\n role=\"${ifDefined(linkRole)}\"\n class=\"${classes}\"\n download=\"${ifDefined(download)}\"\n href=\"${ifDefined(href)}\"\n hreflang=\"${ifDefined(hreflang)}\"\n ping=\"${ifDefined(ping)}\"\n rel=\"${ifDefined(rel)}\"\n target=\"${ifDefined(target)}\"\n type=\"${ifDefined(type)}\"\n tabindex=\"${tabIndex}\"\n aria-describedby=\"badge-indicator\">\n <slot @slotchange=\"${handleSlotChange}\"></slot>\n <slot name=\"icon\" @slotchange=\"${handleSlotChange}\"></slot>\n </a>\n ${html`<slot id=\"badge-indicator\" name=\"badge-indicator\"></slot>` ??\n !disabled}\n `;\n }\n\n const alignmentClass =\n tooltipAlignment &&\n (tooltipPosition === BUTTON_TOOLTIP_POSITION.TOP ||\n tooltipPosition === BUTTON_TOOLTIP_POSITION.BOTTOM)\n ? `-${tooltipAlignment}`\n : '';\n\n const tooltipClasses = classMap({\n [`${prefix}--popover-container`]: true,\n [`${prefix}--popover--caret`]: true,\n [`${prefix}--popover--high-contrast`]: true,\n [`${prefix}--tooltip`]: true,\n [`${prefix}--icon-tooltip`]: hasIcon,\n [`${prefix}--popover--open`]: openTooltip,\n [`${prefix}--popover--${tooltipPosition}${alignmentClass}`]: tooltipText,\n });\n\n return tooltipText && !disabled\n ? html`\n <span class=\"${tooltipClasses}\">\n <button\n id=\"button\"\n part=\"button\"\n class=\"${classes}\"\n ?autofocus=\"${autofocus}\"\n ?disabled=\"${disabled}\"\n tabindex=\"${tabIndex}\"\n type=\"${ifDefined(type)}\"\n aria-label=\"${ifDefined(tooltipText)}\"\n aria-describedby=\"badge-indicator\">\n <slot @slotchange=\"${handleSlotChange}\"></slot>\n <slot name=\"icon\" @slotchange=\"${handleSlotChange}\"></slot>\n </button>\n <span class=\"${prefix}--popover\">\n <span\n class=\"${prefix}--popover-content ${prefix}--tooltip-content\">\n ${tooltipText}\n </span>\n <span class=\"${prefix}--popover-caret\"></span>\n </span>\n ${html`<slot id=\"badge-indicator\" name=\"badge-indicator\"></slot>` ??\n !disabled}\n </span>\n `\n : html`\n <button\n id=\"button\"\n part=\"button\"\n class=\"${classes}\"\n ?autofocus=\"${autofocus}\"\n ?disabled=\"${disabled}\"\n tabindex=\"${tabIndex}\"\n type=\"${ifDefined(type)}\"\n aria-label=\"${ifDefined(tooltipText)}\"\n aria-describedby=\"badge-indicator\">\n ${isDanger\n ? html`<span class=\"${prefix}--visually-hidden\"\n >${dangerDescription}</span\n >`\n : ``}\n <slot @slotchange=\"${handleSlotChange}\"></slot>\n <slot name=\"icon\" @slotchange=\"${handleSlotChange}\"></slot>\n </button>\n ${html`<slot id=\"badge-indicator\" name=\"badge-indicator\"></slot>` ??\n !disabled}\n `;\n }\n\n static shadowRootOptions = {\n ...LitElement.shadowRootOptions,\n delegatesFocus: true,\n };\n static styles = styles;\n}\n\nexport default CDSButton;\n"],"names":["styles","customElement"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;;;;;AAKG;AA4BH;;;;;AAKG;AAEH,IAAM,SAAS,GAAf,MAAM,SAAU,SAAQ,iBAAiB,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC,CAAA;AAAjE,IAAA,WAAA,GAAA;;AACE;;AAEG;QACK,IAAQ,CAAA,QAAA,GAAG,KAAK;QA6ChB,IAAW,CAAA,WAAA,GAAG,MAAK;AACzB,YAAA,IAAI,CAAC,WAAW,GAAG,IAAI;AACzB,SAAC;AAED;;AAEG;QAIK,IAAe,CAAA,eAAA,GAAG,YAAW;AACnC,YAAA,IAAI,CAAC,WAAW,GAAG,KAAK;AAC1B,SAAC;AAED;;;AAGG;QAIK,IAAY,CAAA,YAAA,GAAG,YAAW;AAChC,YAAA,IAAI,CAAC,WAAW,GAA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,EAAA,MAAA,CAAA;AAOhB,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,mBAAmB,EAAE;AACR,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,kBAAA,EAAA,MAAA,CAAA;AAOnD,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,kBAAkB,EAAE;AACZ,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,iBAAA,EAAA,MAAA,CAAA;AAQ9C,UAAA,CAAA;IADC,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE,cAAc,EAAE;AACjC,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,aAAA,EAAA,MAAA,CAAA;AAMrB,UAAA,CAAA;AADC,IAAA,QAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AACD,CAAA,EAAA,SAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AAlOtB,SAAS,GAAA,UAAA,CAAA;AADd,IAAAC,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,OAAA,CAAS;AAC3B,CAAA,EAAA,SAAS,CAkYd;AAED,kBAAe,SAAS;;;;"}
@@ -1,9 +1,10 @@
1
1
  /**
2
- * Copyright IBM Corp. 2019, 2023
2
+ * Copyright IBM Corp. 2019, 2025
3
3
  *
4
4
  * This source code is licensed under the Apache-2.0 license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  */
7
+ import type { PropertyValues } from 'lit';
7
8
  import CDSDropdownItem from '../dropdown/dropdown-item';
8
9
  /**
9
10
  * Combo box item.
@@ -11,6 +12,14 @@ import CDSDropdownItem from '../dropdown/dropdown-item';
11
12
  * @element cds-combo-box-item
12
13
  */
13
14
  declare class CDSComboBoxItem extends CDSDropdownItem {
15
+ private _nextSiblingRefs;
16
+ private _handleMouseEnter;
17
+ private _handleMouseLeave;
18
+ connectedCallback(): void;
19
+ disconnectedCallback(): void;
20
+ private _getNextItem;
21
+ private _syncNextSibling;
22
+ protected updated(changedProperties: PropertyValues): void;
14
23
  static styles: any;
15
24
  }
16
25
  export default CDSComboBoxItem;
@@ -12,7 +12,7 @@ import styles from './combo-box.scss.js';
12
12
  import { carbonElement } from '../../globals/decorators/carbon-element.js';
13
13
 
14
14
  /**
15
- * Copyright IBM Corp. 2019, 2023
15
+ * Copyright IBM Corp. 2019, 2025
16
16
  *
17
17
  * This source code is licensed under the Apache-2.0 license found in the
18
18
  * LICENSE file in the root directory of this source tree.
@@ -23,6 +23,70 @@ import { carbonElement } from '../../globals/decorators/carbon-element.js';
23
23
  * @element cds-combo-box-item
24
24
  */
25
25
  let CDSComboBoxItem = class CDSComboBoxItem extends CDSDropdownItem {
26
+ constructor() {
27
+ super(...arguments);
28
+ this._nextSiblingRefs = {
29
+ 'hovered-next-sibling': null,
30
+ 'highlighted-next-sibling': null,
31
+ 'selected-next-sibling': null,
32
+ };
33
+ this._handleMouseEnter = () => {
34
+ if (this.hasAttribute('disabled')) {
35
+ return;
36
+ }
37
+ this._syncNextSibling('hovered-next-sibling', true);
38
+ };
39
+ this._handleMouseLeave = () => {
40
+ this._syncNextSibling('hovered-next-sibling', false);
41
+ };
42
+ }
43
+ connectedCallback() {
44
+ super.connectedCallback();
45
+ this.classList.add(`${prefix}--list-box__menu-item`);
46
+ this.addEventListener('mouseenter', this._handleMouseEnter);
47
+ this.addEventListener('mouseleave', this._handleMouseLeave);
48
+ }
49
+ disconnectedCallback() {
50
+ this.removeEventListener('mouseenter', this._handleMouseEnter);
51
+ this.removeEventListener('mouseleave', this._handleMouseLeave);
52
+ this._syncNextSibling('hovered-next-sibling', false);
53
+ this._syncNextSibling('highlighted-next-sibling', false);
54
+ this._syncNextSibling('selected-next-sibling', false);
55
+ super.disconnectedCallback();
56
+ }
57
+ _getNextItem() {
58
+ let next = this.nextElementSibling;
59
+ while (next) {
60
+ if (next instanceof HTMLElement &&
61
+ next.tagName.toLowerCase() === `${prefix}-combo-box-item`) {
62
+ return next;
63
+ }
64
+ next = next.nextElementSibling;
65
+ }
66
+ return null;
67
+ }
68
+ _syncNextSibling(attribute, shouldSet) {
69
+ const currentSibling = this._nextSiblingRefs[attribute];
70
+ currentSibling === null || currentSibling === void 0 ? void 0 : currentSibling.removeAttribute(attribute);
71
+ if (shouldSet) {
72
+ const next = this._getNextItem();
73
+ if (next) {
74
+ next.setAttribute(attribute, '');
75
+ this._nextSiblingRefs[attribute] = next;
76
+ return;
77
+ }
78
+ }
79
+ this._nextSiblingRefs[attribute] = null;
80
+ }
81
+ updated(changedProperties) {
82
+ super.updated(changedProperties);
83
+ if (changedProperties.has('highlighted')) {
84
+ this._syncNextSibling('highlighted-next-sibling', this.highlighted);
85
+ }
86
+ if (changedProperties.has('selected')) {
87
+ this._syncNextSibling('selected-next-sibling', this.selected);
88
+ }
89
+ }
26
90
  };
27
91
  CDSComboBoxItem.styles = styles;
28
92
  CDSComboBoxItem = __decorate([
@@ -1 +1 @@
1
- {"version":3,"file":"combo-box-item.js","sources":["../../../src/components/combo-box/combo-box-item.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 2023\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 { prefix } from '../../globals/settings';\nimport CDSDropdownItem from '../dropdown/dropdown-item';\nimport styles from './combo-box.scss?lit';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\n/**\n * Combo box item.\n *\n * @element cds-combo-box-item\n */\n@customElement(`${prefix}-combo-box-item`)\nclass CDSComboBoxItem extends CDSDropdownItem {\n static styles = styles;\n}\n\nexport default CDSComboBoxItem;\n"],"names":["customElement"],"mappings":";;;;;;;;;;;;;AAAA;;;;;AAKG;AAOH;;;;AAIG;AAEH,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,eAAe,CAAA;;AACpC,eAAM,CAAA,MAAA,GAAG,MAAH;AADT,eAAe,GAAA,UAAA,CAAA;AADpB,IAAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,eAAA,CAAiB;AACnC,CAAA,EAAA,eAAe,CAEpB;AAED,wBAAe,eAAe;;;;"}
1
+ {"version":3,"file":"combo-box-item.js","sources":["../../../src/components/combo-box/combo-box-item.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 2025\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 type { PropertyValues } from 'lit';\nimport { prefix } from '../../globals/settings';\nimport CDSDropdownItem from '../dropdown/dropdown-item';\nimport styles from './combo-box.scss?lit';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\ntype NextSiblingAttribute =\n | 'hovered-next-sibling'\n | 'highlighted-next-sibling'\n | 'selected-next-sibling';\n\n/**\n * Combo box item.\n *\n * @element cds-combo-box-item\n */\n@customElement(`${prefix}-combo-box-item`)\nclass CDSComboBoxItem extends CDSDropdownItem {\n private _nextSiblingRefs: Record<NextSiblingAttribute, Element | null> = {\n 'hovered-next-sibling': null,\n 'highlighted-next-sibling': null,\n 'selected-next-sibling': null,\n };\n\n private _handleMouseEnter = () => {\n if (this.hasAttribute('disabled')) {\n return;\n }\n this._syncNextSibling('hovered-next-sibling', true);\n };\n\n private _handleMouseLeave = () => {\n this._syncNextSibling('hovered-next-sibling', false);\n };\n\n connectedCallback() {\n super.connectedCallback();\n this.classList.add(`${prefix}--list-box__menu-item`);\n this.addEventListener('mouseenter', this._handleMouseEnter);\n this.addEventListener('mouseleave', this._handleMouseLeave);\n }\n\n disconnectedCallback() {\n this.removeEventListener('mouseenter', this._handleMouseEnter);\n this.removeEventListener('mouseleave', this._handleMouseLeave);\n this._syncNextSibling('hovered-next-sibling', false);\n this._syncNextSibling('highlighted-next-sibling', false);\n this._syncNextSibling('selected-next-sibling', false);\n super.disconnectedCallback();\n }\n\n private _getNextItem(): Element | null {\n let next = this.nextElementSibling;\n while (next) {\n if (\n next instanceof HTMLElement &&\n next.tagName.toLowerCase() === `${prefix}-combo-box-item`\n ) {\n return next;\n }\n next = next.nextElementSibling;\n }\n return null;\n }\n\n private _syncNextSibling(\n attribute: NextSiblingAttribute,\n shouldSet: boolean\n ) {\n const currentSibling = this._nextSiblingRefs[attribute];\n currentSibling?.removeAttribute(attribute);\n if (shouldSet) {\n const next = this._getNextItem();\n if (next) {\n next.setAttribute(attribute, '');\n this._nextSiblingRefs[attribute] = next;\n return;\n }\n }\n this._nextSiblingRefs[attribute] = null;\n }\n\n protected updated(changedProperties: PropertyValues) {\n super.updated(changedProperties);\n if (changedProperties.has('highlighted')) {\n this._syncNextSibling('highlighted-next-sibling', this.highlighted);\n }\n if (changedProperties.has('selected')) {\n this._syncNextSibling('selected-next-sibling', this.selected);\n }\n }\n\n static styles = styles;\n}\n\nexport default CDSComboBoxItem;\n"],"names":["customElement"],"mappings":";;;;;;;;;;;;;AAAA;;;;;AAKG;AAaH;;;;AAIG;AAEH,IAAM,eAAe,GAArB,MAAM,eAAgB,SAAQ,eAAe,CAAA;AAA7C,IAAA,WAAA,GAAA;;AACU,QAAA,IAAA,CAAA,gBAAgB,GAAiD;AACvE,YAAA,sBAAsB,EAAE,IAAI;AAC5B,YAAA,0BAA0B,EAAE,IAAI;AAChC,YAAA,uBAAuB,EAAE,IAAI;SAC9B;QAEO,IAAiB,CAAA,iBAAA,GAAG,MAAK;AAC/B,YAAA,IAAI,IAAI,CAAC,YAAY,CAAC,UAAU,CAAC,EAAE;gBACjC;;AAEF,YAAA,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,IAAI,CAAC;AACrD,SAAC;QAEO,IAAiB,CAAA,iBAAA,GAAG,MAAK;AAC/B,YAAA,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,EAAE,KAAK,CAAC;AACtD,SAAC;;IAED,iBAAiB,GAAA;QACf,KAAK,CAAC,iBAAiB,EAAE;QACzB,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,CAAG,EAAA,MAA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SAAS,EAAE,EAAE,CAAC;AAChC,gBAAA,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,GAAG,IAAI;gBACvC;;;AAGJ,QAAA,IAAI,CAAC,gBAAgB,CAAC,SAAS,CAAC,GAAG,IAAI;;AAG/B,IAAA,OAAO,CAAC,iBAAiC,EAAA;AACjD,QAAA,KAAK,CAAC,OAAO,CAAC,iBAAiB,CAAC;AAChC,QAAA,IAAI,iBAAiB,CAAC,GAAG,CAAC,aAAa,CAAC,EAAE;YACxC,IAAI,CAAC,gBAAgB,CAAC,0BAA0B,EAAE,IAAI,CAAC,WAAW,CAAC;;AAErE,QAAA,IAAI,iBAAiB,CAAC,GAAG,CAAC,UAAU,CAAC,EAAE;YACrC,IAAI,CAAC,gBAAgB,CAAC,uBAAuB,EAAE,IAAI,CAAC,QAAQ,CAAC;;;;AAI1D,eAAM,CAAA,MAAA,GAAG,MAAH;AA3ET,eAAe,GAAA,UAAA,CAAA;AADpB,IAAAA,aAAa,CAAC,CAAA,EAAG,MAAM,CAAA,eAAA,CAAiB;AACnC,CAAA,EAAA,eAAe,CA4EpB;AAED,wBAAe,eAAe;;;;"}
@@ -57,14 +57,14 @@ declare class CDSComboBox extends CDSDropdown {
57
57
  * @returns `true` if the given combo box item matches the given query text.
58
58
  */
59
59
  protected _defaultItemMatches(item: CDSComboBoxItem, queryText: string): boolean;
60
- connectedCallback(): void;
61
60
  /**
62
61
  * Handles `input` event on the `<input>` for filtering.
63
62
  */
64
- protected _handleInput(event: InputEvent): void;
65
- protected _removeAutoCompleteSuggestion(): void;
63
+ protected _handleInput(): void;
66
64
  protected _filterItems(items: NodeListOf<Element>, queryText: string, rawQueryText: string): number;
67
65
  protected _scrollItemIntoView(item: HTMLElement): void;
66
+ protected _getSelectedItem(): CDSComboBoxItem | null;
67
+ protected _revertInputToSelected(focus?: boolean): void;
68
68
  protected _handleInputKeydown(event: KeyboardEvent): void;
69
69
  protected _handleClickInner(event: MouseEvent): void;
70
70
  protected _handleKeypressInner(event: KeyboardEvent): void;
@@ -76,6 +76,7 @@ declare class CDSComboBox extends CDSDropdown {
76
76
  protected _selectionDidChange(itemToSelect?: CDSComboBoxItem): void;
77
77
  protected _renderLabel(): TemplateResult;
78
78
  protected _renderFollowingLabel(): TemplateResult | void;
79
+ protected _renderTitleLabel(): TemplateResult;
79
80
  /**
80
81
  * The `aria-label` attribute for the icon to clear selection.
81
82
  */
@@ -89,15 +90,11 @@ declare class CDSComboBox extends CDSDropdown {
89
90
  */
90
91
  itemMatches: (item: CDSComboBoxItem, queryText: string) => boolean;
91
92
  /**
92
- * Provide custom filtering behavior. This attribute will be ignored if
93
- * `typeahead` is enabled and will default to `true`
93
+ * Provide custom filtering behavior.
94
94
  */
95
95
  shouldFilterItem: boolean | ShouldFilterItem;
96
- /**
97
- * **Experimental**: will enable autocomplete and typeahead for the input field
98
- */
99
- typeahead: boolean;
100
96
  shouldUpdate(changedProperties: any): boolean;
97
+ protected _clearInputWithoutSelecting(focus?: boolean): void;
101
98
  updated(changedProperties: any): void;
102
99
  protected _resetFilteredItems(): void;
103
100
  static TRIGGER_KEYS: Set<string>;
@@ -57,14 +57,9 @@ let CDSComboBox = class CDSComboBox extends CDSDropdown {
57
57
  */
58
58
  this.inputLabel = '';
59
59
  /**
60
- * Provide custom filtering behavior. This attribute will be ignored if
61
- * `typeahead` is enabled and will default to `true`
60
+ * Provide custom filtering behavior.
62
61
  */
63
62
  this.shouldFilterItem = false;
64
- /**
65
- * **Experimental**: will enable autocomplete and typeahead for the input field
66
- */
67
- this.typeahead = false;
68
63
  }
69
64
  /**
70
65
  * @param item A combo box item.
@@ -85,18 +80,10 @@ let CDSComboBox = class CDSComboBox extends CDSDropdown {
85
80
  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452
86
81
  item.textContent.toLowerCase().indexOf(queryText.toLowerCase()) >= 0);
87
82
  }
88
- connectedCallback() {
89
- super.connectedCallback();
90
- if (this.typeahead) {
91
- this.shouldFilterItem = true;
92
- this.setAttribute('should-filter-item', '');
93
- }
94
- }
95
83
  /**
96
84
  * Handles `input` event on the `<input>` for filtering.
97
85
  */
98
- _handleInput(event) {
99
- var _a, _b, _c;
86
+ _handleInput() {
100
87
  const rawQueryText = this._filterInputNode.value;
101
88
  const queryText = rawQueryText.trim().toLowerCase();
102
89
  if (rawQueryText.length !== 0) {
@@ -112,36 +99,11 @@ let CDSComboBox = class CDSComboBox extends CDSDropdown {
112
99
  if (highlightedItem) {
113
100
  this._scrollItemIntoView(highlightedItem);
114
101
  }
115
- if (this.typeahead && ((_a = event === null || event === void 0 ? void 0 : event.inputType) === null || _a === void 0 ? void 0 : _a.startsWith('insert'))) {
116
- const suggestedItem = (_c = (_b = highlightedItem.textContent) === null || _b === void 0 ? void 0 : _b.trim()) !== null && _c !== void 0 ? _c : '';
117
- if (suggestedItem.toLowerCase().startsWith(rawQueryText.toLowerCase()) &&
118
- suggestedItem.length > rawQueryText.length) {
119
- const suggestionText = rawQueryText + suggestedItem.slice(rawQueryText.length);
120
- this._filterInputNode.value = suggestionText;
121
- this._filterInputNode.setSelectionRange(rawQueryText.length, suggestionText.length);
122
- this._filterInputValue = suggestionText;
123
- this.open = true;
124
- this.requestUpdate();
125
- return;
126
- }
127
- }
128
102
  }
129
103
  this._filterInputValue = rawQueryText;
130
104
  this.open = true;
131
105
  this.requestUpdate();
132
106
  }
133
- // removes the autocomplete suggestion
134
- _removeAutoCompleteSuggestion() {
135
- if (!this._filterInputNode)
136
- return;
137
- const { selectionStart, selectionEnd, value } = this._filterInputNode;
138
- if (selectionStart && selectionEnd && selectionEnd > selectionStart) {
139
- const cleanInput = value.slice(0, selectionStart);
140
- this._filterInputNode.value = cleanInput;
141
- this._filterInputNode.setSelectionRange(cleanInput.length, cleanInput.length);
142
- return;
143
- }
144
- }
145
107
  // Applies filtering/highlighting to all slotted items.
146
108
  _filterItems(items, queryText, rawQueryText) {
147
109
  let firstMatchIndex = -1;
@@ -154,9 +116,9 @@ let CDSComboBox = class CDSComboBox extends CDSDropdown {
154
116
  comboItem.highlighted = false;
155
117
  return;
156
118
  }
157
- const matches = this.typeahead
158
- ? (comboItem.textContent || '').toLowerCase().startsWith(queryText)
159
- : (comboItem.textContent || '').toLowerCase().includes(queryText);
119
+ const matches = (comboItem.textContent || '')
120
+ .toLowerCase()
121
+ .includes(queryText);
160
122
  const filterFunction = typeof this.shouldFilterItem === 'function'
161
123
  ? this.shouldFilterItem
162
124
  : null;
@@ -205,21 +167,47 @@ let CDSComboBox = class CDSComboBox extends CDSDropdown {
205
167
  this._itemMenu.scrollTop +=
206
168
  Math.abs(scrollTop) < Math.abs(scrollBottom) ? scrollTop : scrollBottom;
207
169
  }
208
- // Clear the query and selection when Escape is pressed.
209
- _handleInputKeydown(event) {
210
- // remove the autocomplete suggestion when navigating away from the suggested item
211
- if (this.typeahead &&
212
- (event.key === 'ArrowDown' || event.key === 'ArrowUp')) {
213
- this._removeAutoCompleteSuggestion();
170
+ _getSelectedItem() {
171
+ var _a;
172
+ if (!this.value)
173
+ return null;
174
+ const items = Array.from(this.querySelectorAll(this.constructor.selectorItem));
175
+ return (_a = items.find((it) => String(it.value) === String(this.value))) !== null && _a !== void 0 ? _a : null;
176
+ }
177
+ _revertInputToSelected(focus = true) {
178
+ var _a;
179
+ const selected = this._getSelectedItem();
180
+ const text = (_a = selected === null || selected === void 0 ? void 0 : selected.textContent) !== null && _a !== void 0 ? _a : '';
181
+ this._filterInputValue = text;
182
+ if (this._filterInputNode) {
183
+ this._filterInputNode.value = text;
184
+ if (focus) {
185
+ try {
186
+ this._filterInputNode.focus();
187
+ const len = text.length;
188
+ this._filterInputNode.setSelectionRange(len, len);
189
+ }
190
+ catch (_b) {
191
+ /* ignore */
192
+ }
193
+ }
214
194
  }
195
+ this._resetFilteredItems();
196
+ this.removeAttribute('isClosable');
197
+ this.requestUpdate();
198
+ }
199
+ _handleInputKeydown(event) {
215
200
  if (event.key !== 'Escape') {
216
201
  return;
217
202
  }
218
203
  if (!this._filterInputNode) {
219
204
  return;
220
205
  }
221
- if (this._filterInputNode.value || this.value) {
222
- this._handleUserInitiatedClearInput();
206
+ if (this.value) {
207
+ this._revertInputToSelected(true);
208
+ }
209
+ else if (this._filterInputNode.value) {
210
+ this._clearInputWithoutSelecting(true);
223
211
  }
224
212
  }
225
213
  _handleClickInner(event) {
@@ -277,7 +265,6 @@ let CDSComboBox = class CDSComboBox extends CDSDropdown {
277
265
  super._handleUserInitiatedSelectItem(item);
278
266
  }
279
267
  _selectionDidChange(itemToSelect) {
280
- var _a, _b;
281
268
  this.value = !itemToSelect ? '' : itemToSelect.value;
282
269
  forEach(this.querySelectorAll(this.constructor.selectorItemSelected), (item) => {
283
270
  item.selected = false;
@@ -288,10 +275,15 @@ let CDSComboBox = class CDSComboBox extends CDSDropdown {
288
275
  itemToSelect.setAttribute('aria-selected', 'true');
289
276
  }
290
277
  this._handleUserInitiatedToggle(false);
291
- if (this.typeahead && this._filterInputNode) {
292
- this._filterInputValue = (_b = (_a = itemToSelect === null || itemToSelect === void 0 ? void 0 : itemToSelect.textContent) === null || _a === void 0 ? void 0 : _a.trim()) !== null && _b !== void 0 ? _b : '';
293
- const length = this._filterInputValue.length;
294
- this._filterInputNode.setSelectionRange(length, length);
278
+ if (this._filterInputNode) {
279
+ try {
280
+ this._filterInputNode.focus();
281
+ const val = this._filterInputNode.value || '';
282
+ this._filterInputNode.setSelectionRange(val.length, val.length);
283
+ }
284
+ catch (_a) {
285
+ /* ignore browsers that prevent setSelectionRange */
286
+ }
295
287
  }
296
288
  }
297
289
  _renderLabel() {
@@ -316,6 +308,7 @@ let CDSComboBox = class CDSComboBox extends CDSDropdown {
316
308
  .value=${filterInputValue}
317
309
  role="combobox"
318
310
  aria-label="${ifNonEmpty(inputLabel)}"
311
+ aria-labelledby="dropdown-label"
319
312
  aria-controls="menu-body"
320
313
  aria-haspopup="listbox"
321
314
  aria-autocomplete="list"
@@ -348,27 +341,80 @@ let CDSComboBox = class CDSComboBox extends CDSDropdown {
348
341
  </div>
349
342
  `;
350
343
  }
344
+ _renderTitleLabel() {
345
+ const { disabled, hideLabel, titleText, _slotTitleTextNode: slotTitleTextNode, _handleSlotchangeLabelText: handleSlotchangeLabelText, } = this;
346
+ const labelClasses = classMap({
347
+ [`${prefix}--label`]: true,
348
+ [`${prefix}--label--disabled`]: disabled,
349
+ [`${prefix}--visually-hidden`]: hideLabel,
350
+ });
351
+ const hasTitleText = titleText ||
352
+ (slotTitleTextNode && slotTitleTextNode.assignedNodes().length > 0);
353
+ return html `
354
+ <label
355
+ id="dropdown-label"
356
+ part="title-text"
357
+ class="${labelClasses}"
358
+ ?hidden="${!hasTitleText}">
359
+ <slot name="title-text" @slotchange="${handleSlotchangeLabelText}"
360
+ >${titleText}</slot
361
+ >
362
+ </label>
363
+ `;
364
+ }
351
365
  shouldUpdate(changedProperties) {
352
366
  super.shouldUpdate(changedProperties);
353
367
  const { _selectedItemContent: selectedItemContent } = this;
354
368
  if (selectedItemContent && changedProperties.has('value')) {
355
- this._filterInputValue = (selectedItemContent === null || selectedItemContent === void 0 ? void 0 : selectedItemContent.textContent) || '';
369
+ const selectedText = (selectedItemContent === null || selectedItemContent === void 0 ? void 0 : selectedItemContent.textContent) || '';
370
+ if (!this._filterInputValue || this._filterInputValue === selectedText) {
371
+ this._filterInputValue = selectedText;
372
+ }
356
373
  }
357
374
  return true;
358
375
  }
376
+ _clearInputWithoutSelecting(focus = true) {
377
+ this._filterInputValue = '';
378
+ if (this._filterInputNode) {
379
+ this._filterInputNode.value = '';
380
+ if (focus) {
381
+ try {
382
+ this._filterInputNode.focus();
383
+ this._filterInputNode.setSelectionRange(0, 0);
384
+ }
385
+ catch (_a) {
386
+ /* ignore */
387
+ }
388
+ }
389
+ }
390
+ this._resetFilteredItems();
391
+ this.removeAttribute('isClosable');
392
+ this.requestUpdate();
393
+ }
359
394
  updated(changedProperties) {
360
395
  super.updated(changedProperties);
361
396
  if (changedProperties.has('open')) {
362
397
  if (this.open && this._filterInputNode) {
363
- this._handleInput(changedProperties);
398
+ this._handleInput();
364
399
  }
365
400
  else if (!this.open) {
366
- // remove the autocomplete suggestion when closing the combobox
367
- this._removeAutoCompleteSuggestion();
368
401
  this._resetFilteredItems();
369
- if (this._filterInputNode.value == '') {
370
- this.value = '';
402
+ if (this.value) {
403
+ this._revertInputToSelected(false);
404
+ if (this._filterInputNode &&
405
+ document.activeElement === this._filterInputNode) {
406
+ this._filterInputNode.blur();
407
+ }
371
408
  }
409
+ else if (this._filterInputValue &&
410
+ this._filterInputValue.length > 0) {
411
+ this._clearInputWithoutSelecting(false);
412
+ if (this._filterInputNode &&
413
+ document.activeElement === this._filterInputNode) {
414
+ this._filterInputNode.blur();
415
+ }
416
+ }
417
+ else ;
372
418
  }
373
419
  }
374
420
  const { _listBoxNode: listBoxNode } = this;
@@ -459,9 +505,6 @@ __decorate([
459
505
  },
460
506
  })
461
507
  ], CDSComboBox.prototype, "shouldFilterItem", void 0);
462
- __decorate([
463
- property({ type: Boolean })
464
- ], CDSComboBox.prototype, "typeahead", void 0);
465
508
  CDSComboBox = __decorate([
466
509
  carbonElement(`${prefix}-combo-box`)
467
510
  ], CDSComboBox);