@carbon/web-components 2.55.0-rc.0 → 2.55.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 (100) hide show
  1. package/custom-elements.json +133 -30
  2. package/es/components/button/button.d.ts.map +1 -1
  3. package/es/components/button/button.js +6 -4
  4. package/es/components/button/button.js.map +1 -1
  5. package/es/components/menu/menu-item.d.ts.map +1 -1
  6. package/es/components/menu/menu-item.js +3 -3
  7. package/es/components/menu/menu-item.js.map +1 -1
  8. package/es/components/multi-select/multi-select.d.ts +4 -0
  9. package/es/components/multi-select/multi-select.d.ts.map +1 -1
  10. package/es/components/multi-select/multi-select.js +4 -1
  11. package/es/components/multi-select/multi-select.js.map +1 -1
  12. package/es/components/overflow-menu/overflow-menu-item.d.ts.map +1 -1
  13. package/es/components/overflow-menu/overflow-menu-item.js +4 -3
  14. package/es/components/overflow-menu/overflow-menu-item.js.map +1 -1
  15. package/es/components/tabs/defs.d.ts +26 -0
  16. package/es/components/tabs/defs.d.ts.map +1 -1
  17. package/es/components/tabs/defs.js +28 -1
  18. package/es/components/tabs/defs.js.map +1 -1
  19. package/es/components/tabs/index.d.ts +1 -0
  20. package/es/components/tabs/index.d.ts.map +1 -1
  21. package/es/components/tabs/index.js +1 -0
  22. package/es/components/tabs/stories/tabs-wrapper.d.ts +5 -0
  23. package/es/components/tabs/stories/tabs-wrapper.d.ts.map +1 -1
  24. package/es/components/tabs/stories/tabs-wrapper.js +2 -0
  25. package/es/components/tabs/stories/tabs-wrapper.js.map +1 -1
  26. package/es/components/tabs/tab.d.ts +26 -0
  27. package/es/components/tabs/tab.d.ts.map +1 -1
  28. package/es/components/tabs/tab.js +41 -7
  29. package/es/components/tabs/tab.js.map +1 -1
  30. package/es/components/tabs/tabs-vertical.d.ts +29 -0
  31. package/es/components/tabs/tabs-vertical.d.ts.map +1 -0
  32. package/es/components/tabs/tabs-vertical.js +113 -0
  33. package/es/components/tabs/tabs-vertical.js.map +1 -0
  34. package/es/components/tabs/tabs.d.ts +22 -4
  35. package/es/components/tabs/tabs.d.ts.map +1 -1
  36. package/es/components/tabs/tabs.js +50 -9
  37. package/es/components/tabs/tabs.js.map +1 -1
  38. package/es/components/tabs/tabs.scss.js +1 -1
  39. package/es/components/tabs/tabs.scss.js.map +1 -1
  40. package/es-custom/components/button/button.d.ts.map +1 -1
  41. package/es-custom/components/button/button.js +6 -4
  42. package/es-custom/components/button/button.js.map +1 -1
  43. package/es-custom/components/menu/menu-item.d.ts.map +1 -1
  44. package/es-custom/components/menu/menu-item.js +3 -3
  45. package/es-custom/components/menu/menu-item.js.map +1 -1
  46. package/es-custom/components/multi-select/multi-select.d.ts +4 -0
  47. package/es-custom/components/multi-select/multi-select.d.ts.map +1 -1
  48. package/es-custom/components/multi-select/multi-select.js +4 -1
  49. package/es-custom/components/multi-select/multi-select.js.map +1 -1
  50. package/es-custom/components/overflow-menu/overflow-menu-item.d.ts.map +1 -1
  51. package/es-custom/components/overflow-menu/overflow-menu-item.js +4 -3
  52. package/es-custom/components/overflow-menu/overflow-menu-item.js.map +1 -1
  53. package/es-custom/components/tabs/defs.d.ts +26 -0
  54. package/es-custom/components/tabs/defs.d.ts.map +1 -1
  55. package/es-custom/components/tabs/defs.js +28 -1
  56. package/es-custom/components/tabs/defs.js.map +1 -1
  57. package/es-custom/components/tabs/index.d.ts +1 -0
  58. package/es-custom/components/tabs/index.d.ts.map +1 -1
  59. package/es-custom/components/tabs/index.js +1 -0
  60. package/es-custom/components/tabs/stories/tabs-wrapper.d.ts +5 -0
  61. package/es-custom/components/tabs/stories/tabs-wrapper.d.ts.map +1 -1
  62. package/es-custom/components/tabs/stories/tabs-wrapper.js +2 -0
  63. package/es-custom/components/tabs/stories/tabs-wrapper.js.map +1 -1
  64. package/es-custom/components/tabs/tab.d.ts +26 -0
  65. package/es-custom/components/tabs/tab.d.ts.map +1 -1
  66. package/es-custom/components/tabs/tab.js +41 -7
  67. package/es-custom/components/tabs/tab.js.map +1 -1
  68. package/es-custom/components/tabs/tabs-vertical.d.ts +29 -0
  69. package/es-custom/components/tabs/tabs-vertical.d.ts.map +1 -0
  70. package/es-custom/components/tabs/tabs-vertical.js +113 -0
  71. package/es-custom/components/tabs/tabs-vertical.js.map +1 -0
  72. package/es-custom/components/tabs/tabs.d.ts +22 -4
  73. package/es-custom/components/tabs/tabs.d.ts.map +1 -1
  74. package/es-custom/components/tabs/tabs.js +50 -9
  75. package/es-custom/components/tabs/tabs.js.map +1 -1
  76. package/es-custom/components/tabs/tabs.scss.js +1 -1
  77. package/es-custom/components/tabs/tabs.scss.js.map +1 -1
  78. package/lib/components/button/button.d.ts.map +1 -1
  79. package/lib/components/menu/menu-item.d.ts.map +1 -1
  80. package/lib/components/multi-select/multi-select.d.ts +4 -0
  81. package/lib/components/multi-select/multi-select.d.ts.map +1 -1
  82. package/lib/components/overflow-menu/overflow-menu-item.d.ts.map +1 -1
  83. package/lib/components/tabs/defs.d.ts +26 -0
  84. package/lib/components/tabs/defs.d.ts.map +1 -1
  85. package/lib/components/tabs/defs.js +29 -0
  86. package/lib/components/tabs/defs.js.map +1 -1
  87. package/lib/components/tabs/index.d.ts +1 -0
  88. package/lib/components/tabs/index.d.ts.map +1 -1
  89. package/lib/components/tabs/stories/tabs-wrapper.d.ts +5 -0
  90. package/lib/components/tabs/stories/tabs-wrapper.d.ts.map +1 -1
  91. package/lib/components/tabs/tab.d.ts +26 -0
  92. package/lib/components/tabs/tab.d.ts.map +1 -1
  93. package/lib/components/tabs/tabs-vertical.d.ts +29 -0
  94. package/lib/components/tabs/tabs-vertical.d.ts.map +1 -0
  95. package/lib/components/tabs/tabs.d.ts +22 -4
  96. package/lib/components/tabs/tabs.d.ts.map +1 -1
  97. package/package.json +7 -7
  98. package/scss/components/tabs/tabs-story.scss +5 -0
  99. package/scss/components/tabs/tabs.scss +168 -5
  100. package/telemetry.yml +2 -0
@@ -1 +1 @@
1
- {"version":3,"file":"tabs.js","names":["CDSContentSwitcher","styles","customElement"],"sources":["../../../src/components/tabs/tabs.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 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 { TemplateResult, html } from 'lit';\nimport { property, state, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { prefix } from '../../globals/settings';\nimport { iconLoader } from '../../globals/internal/icon-loader';\nimport HostListenerMixin from '../../globals/mixins/host-listener';\nimport HostListener from '../../globals/decorators/host-listener';\nimport { forEach } from '../../globals/internal/collection-helpers';\nimport ChevronLeft16 from '@carbon/icons/es/chevron--left/16.js';\nimport ChevronRight16 from '@carbon/icons/es/chevron--right/16.js';\nimport CDSContentSwitcher, {\n NAVIGATION_DIRECTION,\n} from '../content-switcher/content-switcher';\nimport { TABS_ICON_SIZE, TABS_KEYBOARD_ACTION, TABS_TYPE } from './defs';\nimport CDSTab from './tab';\nimport styles from './tabs.scss?lit';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport {\n NAVIGATION_DIRECTION,\n TABS_ICON_SIZE,\n TABS_KEYBOARD_ACTION,\n TABS_TYPE,\n};\n\n/**\n * Tabs.\n *\n * @element cds-tabs\n * @fires cds-tabs-beingselected\n * The custom event fired before a tab is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires cds-tabs-selected - The custom event fired after a a tab is selected upon a user gesture.\n */\n@customElement(`${prefix}-tabs`)\nexport default class CDSTabs extends HostListenerMixin(CDSContentSwitcher) {\n /**\n * The latest status of this dropdown, for screen reader to accounce.\n */\n private _assistiveStatusText?: string;\n\n /**\n * The currently selected index\n */\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: TS thinks this method is not referred to\n private _currentIndex = 0;\n\n /**\n * Total number of tabs in the component\n */\n private _totalTabs = 0;\n\n /**\n * `true` if the tablist is scrollable\n */\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: TS thinks this method is not referred to\n private _isScrollable = false;\n\n /**\n * The DOM element for the tablist.\n */\n private tablist: Element | null = null;\n\n /**\n * The width of the overflow scroll buttons.\n */\n private BUTTON_WIDTH = 44;\n\n /**\n * Navigates through tabs.\n *\n * @param direction `-1` to navigate backward, `1` to navigate forward.\n * @param [options] The options.\n * @param [options.immediate]\n * Defaults to `true`\n * `true` to make it \"immediate selection change\" mode, which does:\n *\n * Starts with the selected item\n * Going prev/next item immediately changes the selection\n */\n protected _navigate(direction: number) {\n const immediate = this.selectionMode === 'automatic';\n const { selectorItemHighlighted, selectorItemSelected } = this\n .constructor as typeof CDSTabs;\n const nextItem = this._getNextItem(\n this.querySelector(\n immediate ? selectorItemSelected : selectorItemHighlighted\n ) as CDSTab,\n direction\n );\n if (!nextItem) {\n return;\n }\n this._handleUserInitiatedSelectItem(nextItem as CDSTab, 'keyboard');\n if (!immediate) {\n this.resetHighlighted(nextItem as CDSTab);\n }\n\n // Using `{ block: 'nearest' }` to prevent scrolling unless scrolling is absolutely necessary.\n // `scrollIntoViewOptions` seems to work in latest Safari despite of MDN/caniuse table.\n // IE falls back to the old behavior.\n nextItem.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n\n const nextItemText = nextItem.textContent;\n if (nextItemText) {\n this._assistiveStatusText = nextItemText;\n }\n this._currentIndex += direction;\n this.requestUpdate();\n }\n\n /**\n * Resets the highlighted state of all tabs, setting only the specified tab as highlighted.\n *\n * @param nextItem The tab item to be highlighted. If provided, only this item will be highlighted.\n * If null or undefined, all tabs will have their highlighted state set to false.\n */\n protected resetHighlighted(nextItem?: CDSTab | null) {\n const { selectorItem } = this.constructor as typeof CDSTabs;\n forEach(this.querySelectorAll(selectorItem), (item) => {\n (item as CDSTab)['highlighted'] = nextItem === item;\n });\n }\n\n /**\n * Resets the selected state of all tabs, setting only the specified tab as selected.\n *\n * @param nextItem The tab item to be selected. If provided, only this item will be selected.\n * If null or undefined, all tabs will have their selected state set to false.\n */\n protected resetSelected(nextItem?: CDSTab | null) {\n const { selectorItem } = this.constructor as typeof CDSTabs;\n forEach(this.querySelectorAll(selectorItem), (item) => {\n (item as CDSTab)['selected'] = nextItem === item;\n });\n }\n\n @HostListener('click')\n protected _handleClick(event: MouseEvent) {\n super._handleClick(event);\n const currentItem = this._getCurrentItem(event.target as HTMLElement);\n if (currentItem) {\n this.resetHighlighted(currentItem as CDSTab);\n }\n }\n\n @HostListener('keydown')\n protected _handleKeydown(event: KeyboardEvent) {\n const { key } = event;\n const action = (this.constructor as typeof CDSTabs).getAction(key);\n const enabledTabs = this.querySelectorAll(`${prefix}-tab:not([disabled])`);\n switch (action) {\n case TABS_KEYBOARD_ACTION.HOME:\n {\n const [firstEnabledTab] = enabledTabs;\n firstEnabledTab.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n if (this.selectionMode === 'manual') {\n this.resetHighlighted(firstEnabledTab as CDSTab);\n }\n this._handleUserInitiatedSelectItem(\n firstEnabledTab as CDSTab,\n this.selectionMode !== 'manual' ? 'activation' : 'keyboard'\n );\n this.requestUpdate();\n }\n break;\n case TABS_KEYBOARD_ACTION.END:\n {\n const lastEnabledTab = enabledTabs[enabledTabs.length - 1];\n lastEnabledTab.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n if (this.selectionMode === 'manual') {\n this.resetHighlighted(lastEnabledTab as CDSTab);\n }\n this._handleUserInitiatedSelectItem(\n lastEnabledTab as CDSTab,\n this.selectionMode !== 'manual' ? 'activation' : 'keyboard'\n );\n this.requestUpdate();\n }\n break;\n case TABS_KEYBOARD_ACTION.NAVIGATING:\n {\n const direction = NAVIGATION_DIRECTION[key];\n if (direction) {\n this._navigate(direction);\n }\n }\n break;\n case TABS_KEYBOARD_ACTION.ACTIVATING:\n {\n const focusedTab: CDSTab | null = this.querySelector(\n `${prefix}-tab[highlighted]`\n );\n if (focusedTab) {\n this._handleUserInitiatedSelectItem(\n focusedTab as CDSTab,\n 'activation'\n );\n this.requestUpdate();\n }\n }\n break;\n default:\n break;\n }\n }\n\n @HostListener('cds-tab-closed')\n protected _handleTabClosed(event: CustomEvent) {\n const {\n selectorItem,\n selectorItemEnabled,\n selectorItemSelected,\n selectorItemHighlighted,\n } = this.constructor as typeof CDSTabs;\n const { index } = event.detail;\n const allTabs = this.querySelectorAll<CDSTab>(selectorItem);\n const enabledTabsBeforeRemoval =\n this.querySelectorAll<CDSTab>(selectorItemEnabled);\n const indexInEnabledTabs = Array.from(enabledTabsBeforeRemoval).indexOf(\n allTabs[index]\n );\n const activeItem = this.querySelector<CDSTab>(selectorItemSelected);\n const activeItemId = activeItem?.id;\n const highlightedItem = this.querySelector<CDSTab>(selectorItemHighlighted);\n const highlightedItemId = highlightedItem?.id;\n requestAnimationFrame(() => {\n const enabledTabs = Array.from(\n this.querySelectorAll<CDSTab>(selectorItemEnabled)\n );\n\n const tabWithActiveId = enabledTabs.find(\n (tab) => tab.id === activeItemId\n );\n const tabWithHighlightedId = enabledTabs.find(\n (tab) => tab.id === highlightedItemId\n );\n const nextHighlightedIndex =\n !tabWithActiveId && !tabWithHighlightedId && indexInEnabledTabs - 1 >= 0\n ? indexInEnabledTabs - 1\n : 0;\n if (enabledTabs.length > 0) {\n const nextSelectedItem = tabWithActiveId || enabledTabs[0];\n const nextHighlightedItem =\n tabWithHighlightedId || enabledTabs[nextHighlightedIndex];\n this.resetSelected(nextSelectedItem);\n this.resetHighlighted(nextHighlightedItem);\n this.value = nextSelectedItem.value;\n\n nextHighlightedItem.shadowRoot\n ?.querySelector<HTMLElement>(\n `.${prefix}--tabs__nav-link--dismissable`\n )\n ?.focus();\n nextHighlightedItem.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n } else {\n this.value = '';\n return;\n }\n });\n }\n\n /**\n * Handles click on overflow scroll buttons.\n *\n * @param _ Event object\n * @param [options] The options.\n * @param [options.direction] `-1` to scroll forward, `1` to scroll backward.\n */\n protected _handleScrollButtonClick(_, { direction }) {\n if (!this.tablist) {\n return;\n }\n const { scrollLeft, clientWidth, scrollWidth } =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this._contentContainerNode!;\n switch (direction) {\n case -1:\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this._contentContainerNode!.scrollLeft = Math.max(\n scrollLeft - (scrollWidth / this._totalTabs) * 1.5,\n 0\n );\n break;\n case 1:\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this._contentContainerNode!.scrollLeft =\n Math.min(\n scrollLeft + (scrollWidth / this._totalTabs) * 1.5,\n scrollWidth - clientWidth\n ) + 1;\n break;\n default:\n break;\n }\n }\n\n private _syncSecondaryLabels() {\n const hasSecondaryLabels = Array.from(\n this.querySelectorAll(`${prefix}-tab`)\n ).some((tab) => tab.hasAttribute('secondary-label'));\n if (hasSecondaryLabels) {\n this.setAttribute('has-secondary-labels', '');\n } else {\n this.removeAttribute('has-secondary-labels');\n }\n }\n\n _handleSlotchange() {\n // Call super to preserve content-switcher slot handling\n super._handleSlotchange?.();\n const { selectorItemSelected } = this.constructor as typeof CDSTabs;\n const selectedItem = this.querySelector(selectorItemSelected);\n const nextItem = this._getNextItem(selectedItem as CDSTab, 1);\n\n // Specifies child `<cds-tab>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n if (nextItem) {\n (nextItem as CDSTab).hideDivider = true;\n }\n\n this._syncSecondaryLabels();\n this._updateTabsState();\n }\n\n protected _selectionDidChange(\n itemToSelect: CDSTab,\n interactionType?: 'mouse' | 'keyboard' | undefined\n ) {\n super._selectionDidChange(itemToSelect, interactionType);\n this._assistiveStatusText = this.selectedItemAssistiveText;\n }\n\n /**\n * The scrolling container.\n */\n @query(`.${prefix}--tabs-nav-content-container`)\n private _contentContainerNode?: HTMLElement;\n\n /**\n * The scrolling content.\n */\n @query(`.${prefix}--tabs-nav-content`)\n private _contentNode?: HTMLElement;\n\n /**\n * The current scroll position.\n */\n @state()\n private _currentScrollPosition = 0;\n\n /**\n * The left-hand sentinel to track intersection with the host element.\n * If they intersect, the left-hand paginator button should be hidden.\n */\n @query(`.${prefix}--sub-content-left`)\n private _intersectionLeftSentinelNode?: HTMLElement;\n\n /**\n * The right-hand sentinel to track intersection with the host element.\n * If they intersect, the right-hand paginator button should be hidden.\n */\n @query(`.${prefix}--sub-content-right`)\n private _intersectionRightSentinelNode?: HTMLElement;\n\n /**\n * An assistive text for screen reader to announce, telling the open state.\n */\n @property({ attribute: 'selecting-items-assistive-text' })\n selectingItemsAssistiveText =\n 'Selecting items. Use up and down arrow keys to navigate.';\n\n /**\n * An assistive text for screen reader to announce, telling that an item is selected.\n */\n @property({ attribute: 'selected-item-assistive-text' })\n selectedItemAssistiveText = 'Selected an item.';\n\n /**\n * The content of the trigger button for narrow mode.\n */\n @property({ attribute: 'trigger-content' })\n triggerContent = '';\n\n /**\n * Tabs type.\n */\n @property({ reflect: true })\n type = TABS_TYPE.REGULAR;\n\n /**\n * Whether the rendered Tab children should be dismissable.\n */\n @property({ type: Boolean, reflect: true })\n dismissable;\n\n /**\n * Specify the icon size used by icon-only tabs.\n */\n @property({ attribute: 'icon-size', reflect: true })\n iconSize?: TABS_ICON_SIZE;\n\n /**\n * Used for tabs within a grid, this makes it so tabs span the full container width and have the same width. Only available on contained tabs with <9 children\n */\n @property({ type: Boolean, attribute: 'full-width', reflect: true })\n fullWidth = false;\n\n /**\n * `true` if left-hand scroll intersection sentinel intersects with the host element.\n * In this condition, the left-hand paginator button should be hidden.\n */\n @state()\n private _isIntersectionLeftTrackerInContent = true;\n\n /**\n * `true` if right-hand scroll intersection sentinel intersects with the host element.\n * In this condition, the right-hand paginator button should be hidden.\n */\n @state()\n private _isIntersectionRightTrackerInContent = true;\n\n /**\n * The observer for the intersection of left-side content edge.\n */\n private _observerIntersection: IntersectionObserver | null = null;\n\n /**\n * The intersection observer callback for the scrolling container.\n *\n * @param records The intersection observer records.\n */\n private _observeIntersectionContainer = (records) => {\n const {\n _intersectionLeftSentinelNode: intersectionLeftSentinelNode,\n _intersectionRightSentinelNode: intersectionRightSentinelNode,\n } = this;\n\n records.forEach(({ isIntersecting, target }) => {\n if (target === intersectionLeftSentinelNode) {\n this._isIntersectionLeftTrackerInContent = isIntersecting;\n }\n if (target === intersectionRightSentinelNode) {\n this._isIntersectionRightTrackerInContent = isIntersecting;\n }\n });\n };\n\n /**\n * Cleans-up and creates the intersection observer for the scrolling container.\n *\n * @param [options] The options.\n * @param [options.create] `true` to create the new intersection observer.\n */\n private _cleanAndCreateIntersectionObserverContainer({\n create,\n }: { create?: boolean } = {}) {\n const {\n _intersectionLeftSentinelNode: intersectionLeftSentinelNode,\n _intersectionRightSentinelNode: intersectionRightSentinelNode,\n } = this;\n\n if (this._observerIntersection) {\n this._observerIntersection.disconnect();\n this._observerIntersection = null;\n }\n\n if (create) {\n this._observerIntersection = new IntersectionObserver(\n this._observeIntersectionContainer,\n {\n root: this,\n threshold: 0,\n }\n );\n\n if (intersectionLeftSentinelNode) {\n this._observerIntersection.observe(intersectionLeftSentinelNode);\n }\n if (intersectionRightSentinelNode) {\n this._observerIntersection.observe(intersectionRightSentinelNode);\n }\n }\n }\n\n disconnectedCallback() {\n this._cleanAndCreateIntersectionObserverContainer();\n super.disconnectedCallback();\n }\n\n shouldUpdate(changedProperties) {\n super.shouldUpdate(changedProperties);\n if (this.tablist) {\n const { clientWidth, scrollWidth } = this.tablist;\n this._isScrollable = scrollWidth > clientWidth;\n }\n const { selectorItem } = this.constructor as typeof CDSTabs;\n if (changedProperties.has('type') || changedProperties.has('iconSize')) {\n this._totalTabs = 0;\n forEach(this.querySelectorAll(selectorItem), (elem) => {\n this._totalTabs++;\n (elem as CDSTab).type = this.type;\n (elem as CDSTab).iconSize = this.iconSize;\n });\n }\n return true;\n }\n\n firstUpdated() {\n // Call super to run content-switcher init logic (initial selection)\n super.firstUpdated();\n this._tabInitialLoad();\n this._cleanAndCreateIntersectionObserverContainer({ create: true });\n this._syncSecondaryLabels();\n }\n\n updated(changedProperties) {\n // Call super to keep selection/value in sync\n super.updated?.(changedProperties);\n\n if (changedProperties.has('value')) {\n const tab = this.querySelector(\n `${prefix}-tab[value=\"${this.value}\"]`\n ) as HTMLElement;\n if (tab) {\n const { width: tabWidth } = tab?.getBoundingClientRect() ?? {};\n const start = tab.offsetLeft ?? 0;\n const end = tab.offsetLeft + tabWidth;\n\n // The start and end of the visible area of the tablist\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n const visibleStart = this.tablist!.scrollLeft + this.BUTTON_WIDTH;\n const visibleEnd =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this.tablist!.scrollLeft +\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this.tablist!.clientWidth -\n this.BUTTON_WIDTH;\n\n // The beginning of the tab is clipped and not visible\n if (start < visibleStart) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this.tablist!.scrollLeft = start - this.BUTTON_WIDTH;\n }\n\n // The end of the tab is clipped and not visible\n if (end > visibleEnd) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this.tablist!.scrollLeft =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n end + this.BUTTON_WIDTH - this.tablist!.clientWidth;\n }\n }\n }\n\n if (changedProperties.has('_currentScrollPosition')) {\n if (this._contentNode) {\n this._contentNode.style.insetInlineStart = `-${this._currentScrollPosition}px`;\n }\n }\n\n if (changedProperties.has('dismissable')) {\n this._updateTabsState();\n }\n }\n\n /**\n * Render the previous button if tablist is wider than container.\n */\n protected renderPreviousButton(): TemplateResult | null {\n const {\n _isIntersectionLeftTrackerInContent: isIntersectionLeftTrackerInContent,\n } = this;\n const previousButtonClasses = classMap({\n [`${prefix}--tab--overflow-nav-button`]: true,\n [`${prefix}--tabs__nav-caret-left`]: true,\n [`${prefix}--tab--overflow-nav-button--previous`]: true,\n [`${prefix}--tab--overflow-nav-button--hidden`]:\n isIntersectionLeftTrackerInContent,\n });\n return html`\n <button\n part=\"prev-button\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n class=\"${previousButtonClasses}\"\n @click=${(_) =>\n this._handleScrollButtonClick(_, {\n direction: NAVIGATION_DIRECTION.Left,\n })}>\n ${iconLoader(ChevronLeft16)}\n </button>\n `;\n }\n\n /**\n * Render the next button if tablist is wider than container.\n */\n protected renderNextButton(): TemplateResult | null {\n const {\n _isIntersectionRightTrackerInContent: isIntersectionRightTrackerInContent,\n } = this;\n const nextButtonClasses = classMap({\n [`${prefix}--tab--overflow-nav-button`]: true,\n [`${prefix}--tabs__nav-caret-right`]: true,\n [`${prefix}--tab--overflow-nav-button--next`]: true,\n [`${prefix}--tab--overflow-nav-button--hidden`]:\n isIntersectionRightTrackerInContent,\n });\n return html`\n <button\n part=\"next-button\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n class=\"${nextButtonClasses}\"\n @click=${(_) =>\n this._handleScrollButtonClick(_, {\n direction: NAVIGATION_DIRECTION.Right,\n })}>\n ${iconLoader(ChevronRight16)}\n </button>\n `;\n }\n\n render() {\n const {\n _assistiveStatusText: assistiveStatusText,\n _handleSlotchange: handleSlotchange,\n } = this;\n\n return html`\n ${this.renderPreviousButton()}\n <div class=\"${prefix}--tabs-nav-content-container\">\n <div class=\"${prefix}--tabs-nav-content\">\n <div class=\"${prefix}--tabs-nav\">\n <div id=\"tablist\" role=\"tablist\" class=\"${prefix}--tab--list\">\n <div class=\"${prefix}--sub-content-left\"></div>\n <slot @slotchange=${handleSlotchange}></slot>\n <div class=\"${prefix}--sub-content-right\"></div>\n </div>\n </div>\n </div>\n </div>\n ${this.renderNextButton()}\n <div\n class=\"${prefix}--assistive-text\"\n role=\"status\"\n aria-live=\"assertive\"\n aria-relevant=\"additions text\">\n ${assistiveStatusText}\n </div>\n `;\n }\n\n protected _updateTabsState() {\n const { selectorItem } = this.constructor as typeof CDSTabs;\n const tabs = this.querySelectorAll<CDSTab>(selectorItem);\n tabs.forEach((tab, index) => {\n tab._dismissable = this.dismissable;\n tab._index = index;\n });\n }\n\n protected _tabInitialLoad() {\n const { selectorTablist, selectorItemEnabled } = this\n .constructor as typeof CDSTabs;\n const { selectionMode, selectedIndex } = this;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n const tablist = this.shadowRoot!.querySelector(selectorTablist)!;\n this.tablist = tablist;\n const firstItem =\n this.querySelectorAll<CDSTab>(selectorItemEnabled)[selectedIndex];\n if (firstItem) {\n if (selectionMode === 'manual') {\n firstItem.highlighted = true;\n }\n firstItem.selected = true;\n this.value = firstItem.value;\n }\n }\n /**\n * Symbols of keys that triggers opening/closing menu and selecting/deselecting menu item.\n */\n static TRIGGER_KEYS = new Set([' ', 'Enter']);\n\n /**\n * A selector that will return tabs.\n */\n static get selectorItem() {\n return `${prefix}-tab`;\n }\n\n /**\n * A selector that will return enabled tabs.\n */\n static get selectorItemEnabled() {\n return `${prefix}-tab:not([disabled])`;\n }\n\n /**\n * A selector that will return highlighted tabs.\n */\n static get selectorItemHighlighted() {\n return `${prefix}-tab[highlighted]`;\n }\n\n /**\n * A selector that will return selected tabs.\n */\n static get selectorItemSelected() {\n return `${prefix}-tab[selected]`;\n }\n\n /**\n * A selector that returns the tablist\n */\n static get selectorTablist() {\n return `.${prefix}--tab--list`;\n }\n\n /**\n * The name of the custom event fired before a tab is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-tabs-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a tab is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-tabs-selected`;\n }\n\n static styles = styles;\n\n /**\n * @param key The key symbol.\n * @returns A action for dropdown for the given key symbol.\n */\n static getAction(key: string) {\n if (key === 'Home') {\n return TABS_KEYBOARD_ACTION.HOME;\n }\n if (key === 'End') {\n return TABS_KEYBOARD_ACTION.END;\n }\n if (key in NAVIGATION_DIRECTION) {\n return TABS_KEYBOARD_ACTION.NAVIGATING;\n }\n if (key === 'Enter' || key === ' ') {\n return TABS_KEYBOARD_ACTION.ACTIVATING;\n }\n return TABS_KEYBOARD_ACTION.NONE;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0Ce,IAAA,UAAA,MAAM,gBAAgB,kBAAkBA,yBAAmB,CAAC;;;uBAWjD;oBAKH;uBAOG;iBAKU;sBAKX;gCAoSU;qCAqB/B;mCAM0B;wBAMX;;mBAwBL;6CAOkC;8CAOC;+BAKc;wCAOpB,YAAY;GACnD,MAAM,EACJ,+BAA+B,8BAC/B,gCAAgC,kCAC9B;AAEJ,WAAQ,SAAS,EAAE,gBAAgB,aAAa;AAC9C,QAAI,WAAW,6BACb,MAAK,sCAAsC;AAE7C,QAAI,WAAW,8BACb,MAAK,uCAAuC;KAE9C;;;;;;;;;;;;;;;CAtXJ,UAAoB,WAAmB;EACrC,MAAM,YAAY,KAAK,kBAAkB;EACzC,MAAM,EAAE,yBAAyB,yBAAyB,KACvD;EACH,MAAM,WAAW,KAAK,aACpB,KAAK,cACH,YAAY,uBAAuB,wBACpC,EACD,UACD;AACD,MAAI,CAAC,SACH;AAEF,OAAK,+BAA+B,UAAoB,WAAW;AACnE,MAAI,CAAC,UACH,MAAK,iBAAiB,SAAmB;AAM3C,WAAS,eAAe;GAAE,OAAO;GAAW,QAAQ;GAAW,CAAC;EAEhE,MAAM,eAAe,SAAS;AAC9B,MAAI,aACF,MAAK,uBAAuB;AAE9B,OAAK,iBAAiB;AACtB,OA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,SAAS;CAAM,CAAC,CAAA,EAAA,QAAA,WAAA,aAAA,KAAA,EAAA;YAOnE,OAAO,CAAA,EAAA,QAAA,WAAA,uCAAA,KAAA,EAAA;YAOP,OAAO,CAAA,EAAA,QAAA,WAAA,wCAAA,KAAA,EAAA;sBA5YTC,cAAc,WAAiB,CAAA,EAAA,QAAA"}
1
+ {"version":3,"file":"tabs.js","names":["CDSContentSwitcher","styles","customElement"],"sources":["../../../src/components/tabs/tabs.ts"],"sourcesContent":["/**\n * Copyright IBM Corp. 2019, 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 { TemplateResult, html } from 'lit';\nimport { property, state, query } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { prefix } from '../../globals/settings';\nimport { iconLoader } from '../../globals/internal/icon-loader';\nimport HostListenerMixin from '../../globals/mixins/host-listener';\nimport HostListener from '../../globals/decorators/host-listener';\nimport { forEach } from '../../globals/internal/collection-helpers';\nimport ChevronLeft16 from '@carbon/icons/es/chevron--left/16.js';\nimport ChevronRight16 from '@carbon/icons/es/chevron--right/16.js';\nimport CDSContentSwitcher, {\n NAVIGATION_DIRECTION,\n} from '../content-switcher/content-switcher';\nimport {\n VERTICAL_NAVIGATION_DIRECTION,\n TABS_ICON_SIZE,\n TABS_KEYBOARD_ACTION,\n TABS_TYPE,\n TABS_SIZE,\n} from './defs';\nimport CDSTab from './tab';\nimport styles from './tabs.scss?lit';\nimport { carbonElement as customElement } from '../../globals/decorators/carbon-element';\n\nexport {\n NAVIGATION_DIRECTION,\n VERTICAL_NAVIGATION_DIRECTION,\n TABS_ICON_SIZE,\n TABS_KEYBOARD_ACTION,\n TABS_TYPE,\n TABS_SIZE,\n};\n\n/**\n * Tabs.\n *\n * @element cds-tabs\n * @fires cds-tabs-beingselected\n * The custom event fired before a tab is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n * @fires cds-tabs-selected - The custom event fired after a a tab is selected upon a user gesture.\n */\n@customElement(`${prefix}-tabs`)\nexport default class CDSTabs extends HostListenerMixin(CDSContentSwitcher) {\n /**\n * The latest status of this dropdown, for screen reader to accounce.\n */\n private _assistiveStatusText?: string;\n\n /**\n * The currently selected index\n */\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: TS thinks this method is not referred to\n private _currentIndex = 0;\n\n /**\n * Total number of tabs in the component\n */\n private _totalTabs = 0;\n\n /**\n * `true` if the tablist is scrollable\n */\n // eslint-disable-next-line @typescript-eslint/ban-ts-comment -- https://github.com/carbon-design-system/carbon/issues/20452\n // @ts-ignore: TS thinks this method is not referred to\n private _isScrollable = false;\n\n /**\n * The DOM element for the tablist.\n */\n private tablist: Element | null = null;\n\n /**\n * The width of the overflow scroll buttons.\n */\n private BUTTON_WIDTH = 44;\n\n /**\n * Propagates the layout size token to the host and all child tabs.\n */\n private _syncSizeToTabs() {\n if (this.type === TABS_TYPE.CONTAINED) {\n const size = this.getAttribute('size');\n if (size) {\n const value = `var(--${prefix}-layout-size-height-${size})`;\n this.style.setProperty(`--${prefix}-layout-size-height`, value);\n this.querySelectorAll(`${prefix}-tab`).forEach((tab) => {\n (tab as HTMLElement).style.setProperty(\n `--${prefix}-layout-size-height`,\n value\n );\n });\n } else {\n this.style.removeProperty(`--${prefix}-layout-size-height`);\n this.querySelectorAll(`${prefix}-tab`).forEach((tab) => {\n (tab as HTMLElement).style.removeProperty(\n `--${prefix}-layout-size-height`\n );\n });\n }\n }\n }\n\n /**\n * Navigates through tabs.\n *\n * @param direction `-1` to navigate backward, `1` to navigate forward.\n * @param [options] The options.\n * @param [options.immediate]\n * Defaults to `true`\n * `true` to make it \"immediate selection change\" mode, which does:\n *\n * Starts with the selected item\n * Going prev/next item immediately changes the selection\n */\n protected _navigate(direction: number) {\n const immediate = this.selectionMode === 'automatic';\n const { selectorItemHighlighted, selectorItemSelected } = this\n .constructor as typeof CDSTabs;\n const nextItem = this._getNextItem(\n this.querySelector(\n immediate ? selectorItemSelected : selectorItemHighlighted\n ) as CDSTab,\n direction\n );\n if (!nextItem) {\n return;\n }\n this._handleUserInitiatedSelectItem(nextItem as CDSTab, 'keyboard');\n if (!immediate) {\n this.resetHighlighted(nextItem as CDSTab);\n }\n\n // Using `{ block: 'nearest' }` to prevent scrolling unless scrolling is absolutely necessary.\n // `scrollIntoViewOptions` seems to work in latest Safari despite of MDN/caniuse table.\n // IE falls back to the old behavior.\n nextItem.scrollIntoView({ block: 'nearest', inline: 'nearest' });\n\n const nextItemText = nextItem.textContent;\n if (nextItemText) {\n this._assistiveStatusText = nextItemText;\n }\n this._currentIndex += direction;\n this.requestUpdate();\n }\n\n /**\n * Resets the highlighted state of all tabs, setting only the specified tab as highlighted.\n *\n * @param nextItem The tab item to be highlighted. If provided, only this item will be highlighted.\n * If null or undefined, all tabs will have their highlighted state set to false.\n */\n protected resetHighlighted(nextItem?: CDSTab | null) {\n const { selectorItem } = this.constructor as typeof CDSTabs;\n forEach(this.querySelectorAll(selectorItem), (item) => {\n (item as CDSTab)['highlighted'] = nextItem === item;\n });\n }\n\n /**\n * Resets the selected state of all tabs, setting only the specified tab as selected.\n *\n * @param nextItem The tab item to be selected. If provided, only this item will be selected.\n * If null or undefined, all tabs will have their selected state set to false.\n */\n protected resetSelected(nextItem?: CDSTab | null) {\n const { selectorItem } = this.constructor as typeof CDSTabs;\n forEach(this.querySelectorAll(selectorItem), (item) => {\n (item as CDSTab)['selected'] = nextItem === item;\n });\n }\n\n @HostListener('click')\n protected _handleClick(event: MouseEvent) {\n super._handleClick(event);\n const currentItem = this._getCurrentItem(event.target as HTMLElement);\n if (currentItem) {\n this.resetHighlighted(currentItem as CDSTab);\n }\n }\n\n @HostListener('keydown')\n protected _handleKeydown(event: KeyboardEvent) {\n const { key } = event;\n const { selectorItemEnabled } = this.constructor as typeof CDSTabs;\n const action = (this.constructor as typeof CDSTabs).getAction(\n key,\n this.vertical\n );\n const enabledTabs = this.querySelectorAll(selectorItemEnabled);\n switch (action) {\n case TABS_KEYBOARD_ACTION.HOME:\n {\n const [firstEnabledTab] = enabledTabs;\n firstEnabledTab.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n if (this.selectionMode === 'manual') {\n this.resetHighlighted(firstEnabledTab as CDSTab);\n }\n this._handleUserInitiatedSelectItem(\n firstEnabledTab as CDSTab,\n this.selectionMode !== 'manual' ? 'activation' : 'keyboard'\n );\n this.requestUpdate();\n }\n break;\n case TABS_KEYBOARD_ACTION.END:\n {\n const lastEnabledTab = enabledTabs[enabledTabs.length - 1];\n lastEnabledTab.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n if (this.selectionMode === 'manual') {\n this.resetHighlighted(lastEnabledTab as CDSTab);\n }\n this._handleUserInitiatedSelectItem(\n lastEnabledTab as CDSTab,\n this.selectionMode !== 'manual' ? 'activation' : 'keyboard'\n );\n this.requestUpdate();\n }\n break;\n case TABS_KEYBOARD_ACTION.NAVIGATING:\n {\n event.preventDefault();\n // Get direction based on orientation\n const direction = this.vertical\n ? VERTICAL_NAVIGATION_DIRECTION[key]\n : NAVIGATION_DIRECTION[key];\n if (direction) {\n this._navigate(direction);\n }\n }\n break;\n case TABS_KEYBOARD_ACTION.ACTIVATING:\n {\n const focusedTab: CDSTab | null = this.querySelector(\n `${prefix}-tab[highlighted]`\n );\n if (focusedTab) {\n this._handleUserInitiatedSelectItem(\n focusedTab as CDSTab,\n 'activation'\n );\n this.requestUpdate();\n }\n }\n break;\n default:\n break;\n }\n }\n\n @HostListener('cds-tab-closed')\n protected _handleTabClosed(event: CustomEvent) {\n const {\n selectorItem,\n selectorItemEnabled,\n selectorItemSelected,\n selectorItemHighlighted,\n } = this.constructor as typeof CDSTabs;\n const { index } = event.detail;\n const allTabs = this.querySelectorAll<CDSTab>(selectorItem);\n const enabledTabsBeforeRemoval =\n this.querySelectorAll<CDSTab>(selectorItemEnabled);\n const indexInEnabledTabs = Array.from(enabledTabsBeforeRemoval).indexOf(\n allTabs[index]\n );\n const activeItem = this.querySelector<CDSTab>(selectorItemSelected);\n const activeItemId = activeItem?.id;\n const highlightedItem = this.querySelector<CDSTab>(selectorItemHighlighted);\n const highlightedItemId = highlightedItem?.id;\n requestAnimationFrame(() => {\n const enabledTabs = Array.from(\n this.querySelectorAll<CDSTab>(selectorItemEnabled)\n );\n\n const tabWithActiveId = enabledTabs.find(\n (tab) => tab.id === activeItemId\n );\n const tabWithHighlightedId = enabledTabs.find(\n (tab) => tab.id === highlightedItemId\n );\n const nextHighlightedIndex =\n !tabWithActiveId && !tabWithHighlightedId && indexInEnabledTabs - 1 >= 0\n ? indexInEnabledTabs - 1\n : 0;\n if (enabledTabs.length > 0) {\n const nextSelectedItem = tabWithActiveId || enabledTabs[0];\n const nextHighlightedItem =\n tabWithHighlightedId || enabledTabs[nextHighlightedIndex];\n this.resetSelected(nextSelectedItem);\n this.resetHighlighted(nextHighlightedItem);\n this.value = nextSelectedItem.value;\n\n nextHighlightedItem.shadowRoot\n ?.querySelector<HTMLElement>(\n `.${prefix}--tabs__nav-link--dismissable`\n )\n ?.focus();\n nextHighlightedItem.scrollIntoView({\n block: 'nearest',\n inline: 'nearest',\n });\n } else {\n this.value = '';\n return;\n }\n });\n }\n\n /**\n * Handles click on overflow scroll buttons.\n *\n * @param _ Event object\n * @param [options] The options.\n * @param [options.direction] `-1` to scroll forward, `1` to scroll backward.\n */\n protected _handleScrollButtonClick(_, { direction }) {\n if (!this.tablist) {\n return;\n }\n const { scrollLeft, clientWidth, scrollWidth } =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this._contentContainerNode!;\n switch (direction) {\n case -1:\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this._contentContainerNode!.scrollLeft = Math.max(\n scrollLeft - (scrollWidth / this._totalTabs) * 1.5,\n 0\n );\n break;\n case 1:\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this._contentContainerNode!.scrollLeft =\n Math.min(\n scrollLeft + (scrollWidth / this._totalTabs) * 1.5,\n scrollWidth - clientWidth\n ) + 1;\n break;\n default:\n break;\n }\n }\n\n private _syncSecondaryLabels() {\n const hasSecondaryLabels = Array.from(\n this.querySelectorAll(`${prefix}-tab`)\n ).some((tab) => tab.hasAttribute('secondary-label'));\n if (hasSecondaryLabels) {\n this.setAttribute('has-secondary-labels', '');\n } else {\n this.removeAttribute('has-secondary-labels');\n }\n }\n\n _handleSlotchange() {\n // Call super to preserve content-switcher slot handling\n super._handleSlotchange?.();\n const { selectorItemSelected } = this.constructor as typeof CDSTabs;\n const selectedItem = this.querySelector(selectorItemSelected);\n const nextItem = this._getNextItem(selectedItem as CDSTab, 1);\n\n // Specifies child `<cds-tab>` to hide its divider instead of using CSS,\n // until `:host-context()` gets supported in all major browsers\n if (nextItem) {\n (nextItem as CDSTab).hideDivider = true;\n }\n\n // Set vertical attribute on all tabs if this tabs component is vertical\n this._updateTabsVerticalAttribute();\n this._syncSecondaryLabels();\n this._updateTabsState();\n this._syncSizeToTabs();\n }\n\n /**\n * Updates the vertical attribute on all child tabs based on the vertical property.\n */\n private _updateTabsVerticalAttribute() {\n const { selectorItem } = this.constructor as typeof CDSTabs;\n forEach(this.querySelectorAll(selectorItem), (tab) => {\n if (this.vertical) {\n (tab as CDSTab).setAttribute('vertical', '');\n } else {\n (tab as CDSTab).removeAttribute('vertical');\n }\n });\n }\n\n protected _selectionDidChange(\n itemToSelect: CDSTab,\n interactionType?: 'mouse' | 'keyboard' | undefined\n ) {\n super._selectionDidChange(itemToSelect, interactionType);\n this._assistiveStatusText = this.selectedItemAssistiveText;\n }\n\n /**\n * The scrolling container.\n */\n @query(`.${prefix}--tabs-nav-content-container`)\n private _contentContainerNode?: HTMLElement;\n\n /**\n * The scrolling content.\n */\n @query(`.${prefix}--tabs-nav-content`)\n private _contentNode?: HTMLElement;\n\n /**\n * The current scroll position.\n */\n @state()\n private _currentScrollPosition = 0;\n\n /**\n * The left-hand sentinel to track intersection with the host element.\n * If they intersect, the left-hand paginator button should be hidden.\n */\n @query(`.${prefix}--sub-content-left`)\n private _intersectionLeftSentinelNode?: HTMLElement;\n\n /**\n * The right-hand sentinel to track intersection with the host element.\n * If they intersect, the right-hand paginator button should be hidden.\n */\n @query(`.${prefix}--sub-content-right`)\n private _intersectionRightSentinelNode?: HTMLElement;\n\n /**\n * An assistive text for screen reader to announce, telling the open state.\n */\n @property({ attribute: 'selecting-items-assistive-text' })\n selectingItemsAssistiveText =\n 'Selecting items. Use up and down arrow keys to navigate.';\n\n /**\n * An assistive text for screen reader to announce, telling that an item is selected.\n */\n @property({ attribute: 'selected-item-assistive-text' })\n selectedItemAssistiveText = 'Selected an item.';\n\n /**\n * The content of the trigger button for narrow mode.\n */\n @property({ attribute: 'trigger-content' })\n triggerContent = '';\n\n /**\n * Tabs type.\n */\n @property({ reflect: true })\n type = TABS_TYPE.REGULAR;\n\n /**\n * `true` if the tabs are in vertical orientation.\n * This is automatically set by `cds-tabs-vertical`.\n */\n @property({ type: Boolean })\n vertical = false;\n /**\n * Whether the rendered Tab children should be dismissable.\n */\n @property({ type: Boolean, reflect: true })\n dismissable;\n\n /**\n * Specify the size of contained tabs.\n */\n @property({ reflect: true })\n size?: TABS_SIZE;\n\n /**\n * Specify the icon size used by icon-only tabs.\n */\n @property({ attribute: 'icon-size', reflect: true })\n iconSize?: TABS_ICON_SIZE;\n\n /**\n * Used for tabs within a grid, this makes it so tabs span the full container width and have the same width. Only available on contained tabs with <9 children\n */\n @property({ type: Boolean, attribute: 'full-width', reflect: true })\n fullWidth = false;\n\n /**\n * `true` if left-hand scroll intersection sentinel intersects with the host element.\n * In this condition, the left-hand paginator button should be hidden.\n */\n @state()\n private _isIntersectionLeftTrackerInContent = true;\n\n /**\n * `true` if right-hand scroll intersection sentinel intersects with the host element.\n * In this condition, the right-hand paginator button should be hidden.\n */\n @state()\n private _isIntersectionRightTrackerInContent = true;\n\n /**\n * The observer for the intersection of left-side content edge.\n */\n private _observerIntersection: IntersectionObserver | null = null;\n\n /**\n * The intersection observer callback for the scrolling container.\n *\n * @param records The intersection observer records.\n */\n private _observeIntersectionContainer = (records) => {\n const {\n _intersectionLeftSentinelNode: intersectionLeftSentinelNode,\n _intersectionRightSentinelNode: intersectionRightSentinelNode,\n } = this;\n\n records.forEach(({ isIntersecting, target }) => {\n if (target === intersectionLeftSentinelNode) {\n this._isIntersectionLeftTrackerInContent = isIntersecting;\n }\n if (target === intersectionRightSentinelNode) {\n this._isIntersectionRightTrackerInContent = isIntersecting;\n }\n });\n };\n\n /**\n * Cleans-up and creates the intersection observer for the scrolling container.\n *\n * @param [options] The options.\n * @param [options.create] `true` to create the new intersection observer.\n */\n private _cleanAndCreateIntersectionObserverContainer({\n create,\n }: { create?: boolean } = {}) {\n const {\n _intersectionLeftSentinelNode: intersectionLeftSentinelNode,\n _intersectionRightSentinelNode: intersectionRightSentinelNode,\n } = this;\n\n if (this._observerIntersection) {\n this._observerIntersection.disconnect();\n this._observerIntersection = null;\n }\n\n if (create) {\n this._observerIntersection = new IntersectionObserver(\n this._observeIntersectionContainer,\n {\n root: this,\n threshold: 0,\n }\n );\n\n if (intersectionLeftSentinelNode) {\n this._observerIntersection.observe(intersectionLeftSentinelNode);\n }\n if (intersectionRightSentinelNode) {\n this._observerIntersection.observe(intersectionRightSentinelNode);\n }\n }\n }\n\n disconnectedCallback() {\n this._cleanAndCreateIntersectionObserverContainer();\n super.disconnectedCallback();\n }\n\n shouldUpdate(changedProperties) {\n super.shouldUpdate(changedProperties);\n if (this.tablist) {\n const { clientWidth, scrollWidth } = this.tablist;\n this._isScrollable = scrollWidth > clientWidth;\n }\n const { selectorItem } = this.constructor as typeof CDSTabs;\n if (\n changedProperties.has('type') ||\n changedProperties.has('iconSize') ||\n changedProperties.has('size')\n ) {\n this._totalTabs = 0;\n forEach(this.querySelectorAll(selectorItem), (elem) => {\n this._totalTabs++;\n (elem as CDSTab).type = this.type;\n (elem as CDSTab).iconSize = this.iconSize;\n });\n }\n return true;\n }\n\n firstUpdated() {\n // Call super to run content-switcher init logic (initial selection)\n super.firstUpdated();\n this._tabInitialLoad();\n this._cleanAndCreateIntersectionObserverContainer({ create: true });\n this._syncSecondaryLabels();\n this._syncSizeToTabs();\n }\n\n updated(changedProperties) {\n // Call super to keep selection/value in sync\n super.updated?.(changedProperties);\n if (changedProperties.has('size') || changedProperties.has('type')) {\n this._syncSizeToTabs();\n }\n\n if (changedProperties.has('vertical')) {\n this._updateTabsVerticalAttribute();\n }\n\n if (changedProperties.has('value')) {\n const tab = this.querySelector(\n `${prefix}-tab[value=\"${this.value}\"]`\n ) as HTMLElement;\n if (tab) {\n const { width: tabWidth } = tab?.getBoundingClientRect() ?? {};\n const start = tab.offsetLeft ?? 0;\n const end = tab.offsetLeft + tabWidth;\n\n // The start and end of the visible area of the tablist\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n const visibleStart = this.tablist!.scrollLeft + this.BUTTON_WIDTH;\n const visibleEnd =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this.tablist!.scrollLeft +\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this.tablist!.clientWidth -\n this.BUTTON_WIDTH;\n\n // The beginning of the tab is clipped and not visible\n if (start < visibleStart) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this.tablist!.scrollLeft = start - this.BUTTON_WIDTH;\n }\n\n // The end of the tab is clipped and not visible\n if (end > visibleEnd) {\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n this.tablist!.scrollLeft =\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n end + this.BUTTON_WIDTH - this.tablist!.clientWidth;\n }\n }\n }\n\n if (changedProperties.has('_currentScrollPosition')) {\n if (this._contentNode) {\n this._contentNode.style.insetInlineStart = `-${this._currentScrollPosition}px`;\n }\n }\n\n if (changedProperties.has('dismissable')) {\n this._updateTabsState();\n }\n }\n\n /**\n * Render the previous button if tablist is wider than container.\n */\n protected renderPreviousButton(): TemplateResult | null {\n const {\n _isIntersectionLeftTrackerInContent: isIntersectionLeftTrackerInContent,\n } = this;\n const previousButtonClasses = classMap({\n [`${prefix}--tab--overflow-nav-button`]: true,\n [`${prefix}--tabs__nav-caret-left`]: true,\n [`${prefix}--tab--overflow-nav-button--previous`]: true,\n [`${prefix}--tab--overflow-nav-button--hidden`]:\n isIntersectionLeftTrackerInContent,\n });\n return html`\n <button\n part=\"prev-button\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n class=\"${previousButtonClasses}\"\n @click=${(_) =>\n this._handleScrollButtonClick(_, {\n direction: NAVIGATION_DIRECTION.Left,\n })}>\n ${iconLoader(ChevronLeft16)}\n </button>\n `;\n }\n\n /**\n * Render the next button if tablist is wider than container.\n */\n protected renderNextButton(): TemplateResult | null {\n const {\n _isIntersectionRightTrackerInContent: isIntersectionRightTrackerInContent,\n } = this;\n const nextButtonClasses = classMap({\n [`${prefix}--tab--overflow-nav-button`]: true,\n [`${prefix}--tabs__nav-caret-right`]: true,\n [`${prefix}--tab--overflow-nav-button--next`]: true,\n [`${prefix}--tab--overflow-nav-button--hidden`]:\n isIntersectionRightTrackerInContent,\n });\n return html`\n <button\n part=\"next-button\"\n tabindex=\"-1\"\n aria-hidden=\"true\"\n class=\"${nextButtonClasses}\"\n @click=${(_) =>\n this._handleScrollButtonClick(_, {\n direction: NAVIGATION_DIRECTION.Right,\n })}>\n ${iconLoader(ChevronRight16)}\n </button>\n `;\n }\n\n render() {\n const {\n _assistiveStatusText: assistiveStatusText,\n _handleSlotchange: handleSlotchange,\n } = this;\n\n return html`\n ${this.renderPreviousButton()}\n <div class=\"${prefix}--tabs-nav-content-container\">\n <div class=\"${prefix}--tabs-nav-content\">\n <div class=\"${prefix}--tabs-nav\">\n <div id=\"tablist\" role=\"tablist\" class=\"${prefix}--tab--list\">\n <div class=\"${prefix}--sub-content-left\"></div>\n <slot @slotchange=${handleSlotchange}></slot>\n <div class=\"${prefix}--sub-content-right\"></div>\n </div>\n </div>\n </div>\n </div>\n ${this.renderNextButton()}\n <div\n class=\"${prefix}--assistive-text\"\n role=\"status\"\n aria-live=\"assertive\"\n aria-relevant=\"additions text\">\n ${assistiveStatusText}\n </div>\n `;\n }\n\n protected _updateTabsState() {\n const { selectorItem } = this.constructor as typeof CDSTabs;\n const tabs = this.querySelectorAll<CDSTab>(selectorItem);\n tabs.forEach((tab, index) => {\n tab._dismissable = this.dismissable;\n tab._index = index;\n });\n }\n\n protected _tabInitialLoad() {\n const { selectorTablist, selectorItemEnabled } = this\n .constructor as typeof CDSTabs;\n const { selectionMode, selectedIndex } = this;\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion -- https://github.com/carbon-design-system/carbon/issues/20452\n const tablist = this.shadowRoot!.querySelector(selectorTablist)!;\n this.tablist = tablist;\n const firstItem =\n this.querySelectorAll<CDSTab>(selectorItemEnabled)[selectedIndex];\n if (firstItem) {\n if (selectionMode === 'manual') {\n firstItem.highlighted = true;\n }\n firstItem.selected = true;\n this.value = firstItem.value;\n }\n }\n /**\n * Symbols of keys that triggers opening/closing menu and selecting/deselecting menu item.\n */\n static TRIGGER_KEYS = new Set([' ', 'Enter']);\n\n /**\n * A selector that will return tabs.\n */\n static get selectorItem() {\n return `${prefix}-tab`;\n }\n\n /**\n * A selector that will return enabled tabs.\n */\n static get selectorItemEnabled() {\n return `${prefix}-tab:not([disabled])`;\n }\n\n /**\n * A selector that will return highlighted tabs.\n */\n static get selectorItemHighlighted() {\n return `${prefix}-tab[highlighted]`;\n }\n\n /**\n * A selector that will return selected tabs.\n */\n static get selectorItemSelected() {\n return `${prefix}-tab[selected]`;\n }\n\n /**\n * A selector that returns the tablist\n */\n static get selectorTablist() {\n return `.${prefix}--tab--list`;\n }\n\n /**\n * The name of the custom event fired before a tab is selected upon a user gesture.\n * Cancellation of this event stops changing the user-initiated selection.\n */\n static get eventBeforeSelect() {\n return `${prefix}-tabs-beingselected`;\n }\n\n /**\n * The name of the custom event fired after a a tab is selected upon a user gesture.\n */\n static get eventSelect() {\n return `${prefix}-tabs-selected`;\n }\n\n static styles = styles;\n\n /**\n * @param key The key symbol.\n * @param isVertical Whether the tabs are in vertical orientation.\n * @returns A action for tabs for the given key symbol.\n */\n static getAction(key: string, isVertical = false) {\n if (key === 'Home') {\n return TABS_KEYBOARD_ACTION.HOME;\n }\n if (key === 'End') {\n return TABS_KEYBOARD_ACTION.END;\n }\n // Check for navigation keys based on orientation\n const navigationKeys = isVertical\n ? VERTICAL_NAVIGATION_DIRECTION\n : NAVIGATION_DIRECTION;\n if (key in navigationKeys) {\n return TABS_KEYBOARD_ACTION.NAVIGATING;\n }\n if (key === 'Enter' || key === ' ') {\n return TABS_KEYBOARD_ACTION.ACTIVATING;\n }\n return TABS_KEYBOARD_ACTION.NONE;\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkDe,IAAA,UAAA,MAAM,gBAAgB,kBAAkBA,yBAAmB,CAAC;;;uBAWjD;oBAKH;uBAOG;iBAKU;sBAKX;gCAuVU;qCAqB/B;mCAM0B;wBAMX;;kBAaN;mBAuBC;6CAOkC;8CAOC;+BAKc;wCAOpB,YAAY;GACnD,MAAM,EACJ,+BAA+B,8BAC/B,gCAAgC,kCAC9B;AAEJ,WAAQ,SAAS,EAAE,gBAAgB,aAAa;AAC9C,QAAI,WAAW,6BACb,MAAK,sCAAsC;AAE7C,QAAI,WAAW,8BACb,MAAK,uCAAuC;KAE9C;;;;;;CA9bJ,kBAA0B;AACxB,MAAI,KAAK,SAAA,aAA8B;GACrC,MAAM,OAAO,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