@spectrum-web-components/tabs 1.7.0 → 1.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +61 -53
- package/package.json +7 -7
- package/sp-tab-panel.d.ts +11 -0
- package/sp-tab-panel.dev.js.map +1 -1
- package/sp-tab-panel.js.map +1 -1
- package/sp-tab.d.ts +11 -0
- package/sp-tab.dev.js.map +1 -1
- package/sp-tab.js.map +1 -1
- package/sp-tabs-overflow.d.ts +11 -0
- package/sp-tabs-overflow.dev.js.map +1 -1
- package/sp-tabs-overflow.js.map +1 -1
- package/sp-tabs.d.ts +11 -0
- package/sp-tabs.dev.js.map +1 -1
- package/sp-tabs.js.map +1 -1
- package/src/Tab.d.ts +11 -0
- package/src/Tab.dev.js.map +1 -1
- package/src/Tab.js.map +1 -1
- package/src/TabPanel.d.ts +11 -0
- package/src/TabPanel.dev.js.map +1 -1
- package/src/TabPanel.js.map +1 -1
- package/src/Tabs.d.ts +11 -0
- package/src/Tabs.dev.js.map +1 -1
- package/src/Tabs.js.map +1 -1
- package/src/TabsOverflow.d.ts +11 -0
- package/src/TabsOverflow.dev.js.map +1 -1
- package/src/TabsOverflow.js.map +1 -1
- package/src/index.d.ts +11 -0
- package/src/index.dev.js.map +1 -1
- package/src/index.js.map +1 -1
- package/src/spectrum-tab.css.dev.js.map +1 -1
- package/src/spectrum-tab.css.js.map +1 -1
- package/src/spectrum-tabs-sizes.css.dev.js.map +1 -1
- package/src/spectrum-tabs-sizes.css.js.map +1 -1
- package/src/spectrum-tabs.css.dev.js.map +1 -1
- package/src/spectrum-tabs.css.js.map +1 -1
- package/src/tab-overrides.css.dev.js.map +1 -1
- package/src/tab-overrides.css.js.map +1 -1
- package/src/tab-panel.css.dev.js.map +1 -1
- package/src/tab-panel.css.js.map +1 -1
- package/src/tab.css.dev.js.map +1 -1
- package/src/tab.css.js.map +1 -1
- package/src/tabs-overflow.css.dev.js.map +1 -1
- package/src/tabs-overflow.css.js.map +1 -1
- package/src/tabs-overrides.css.dev.js.map +1 -1
- package/src/tabs-overrides.css.js.map +1 -1
- package/src/tabs-sizes-overrides.css.dev.js.map +1 -1
- package/src/tabs-sizes-overrides.css.js.map +1 -1
- package/src/tabs-sizes.css.dev.js.map +1 -1
- package/src/tabs-sizes.css.js.map +1 -1
- package/src/tabs.css.dev.js.map +1 -1
- package/src/tabs.css.js.map +1 -1
package/src/Tabs.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Tabs.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n css,\n CSSResult,\n CSSResultArray,\n html,\n PropertyValueMap,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport {\n classMap,\n ifDefined,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { IntersectionController } from '@lit-labs/observers/intersection-controller.js';\nimport { ResizeController } from '@lit-labs/observers/resize-controller.js';\nimport { Tab } from './Tab.dev.js'\nimport { Focusable } from '@spectrum-web-components/shared';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\n\nimport tabStyles from './tabs.css.js';\nimport tabSizes from './tabs-sizes.css.js';\nimport { TabPanel } from './TabPanel.dev.js'\n\n// Encapsulated for use both here and in TopNav\nexport const ScaledIndicator = {\n baseSize: 100 as const,\n noSelectionStyle: 'transform: translateX(0px) scaleX(0) scaleY(0)',\n\n transformX(left: number, width: number): string {\n const scale = width / this.baseSize;\n return `transform: translateX(${left}px) scaleX(${scale});`;\n },\n\n transformY(top: number, height: number): string {\n const scale = height / this.baseSize;\n return `transform: translateY(${top}px) scaleY(${scale});`;\n },\n\n baseStyles(): CSSResult {\n return css`\n :host([direction='vertical-right']) #selection-indicator,\n :host([direction='vertical']) #selection-indicator {\n height: ${this.baseSize}px;\n }\n :host([dir][direction='horizontal']) #selection-indicator {\n width: ${this.baseSize}px;\n }\n `;\n },\n};\n\n/**\n * Given that the scroll needs to be on the right side of the viewport.\n * Returns the coordonate x it needs to scroll so that the tab with given index is visible.\n */\nexport function calculateScrollTargetForRightSide(\n index: number,\n direction: 'rtl' | 'ltr',\n tabs: Tab[],\n container: HTMLDivElement\n): number {\n const nextIndex = index + (direction === 'rtl' ? -1 : 1);\n const nextTab = tabs[nextIndex];\n const viewportEnd = container.scrollLeft + container.offsetWidth;\n return nextTab ? nextTab.offsetLeft - container.offsetWidth : viewportEnd;\n}\n\n/**\n * Given that the scroll needs to be on the left side of the viewport.\n * Returns the coordonate x it needs to scroll so that the tab with given index is visible.\n */\nexport function calculateScrollTargetForLeftSide(\n index: number,\n direction: 'rtl' | 'ltr',\n tabs: Tab[],\n container: HTMLDivElement\n): number {\n const prevIndex = index + (direction === 'rtl' ? 1 : -1);\n const prevTab = tabs[prevIndex];\n const leftmostElement = direction === 'rtl' ? -container.offsetWidth : 0;\n return prevTab ? prevTab.offsetLeft + prevTab.offsetWidth : leftmostElement;\n}\n\n/**\n * @element sp-tabs\n *\n * @slot - Tab elements to manage as a group\n * @slot tab-panel - Tab Panel elements related to the listed Tab elements\n * @csspart tablist - Container element for the slotted sp-tab elements\n *\n * @fires change - The selected Tab child has changed.\n */\nexport class Tabs extends SizedMixin(Focusable, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [tabSizes, tabStyles, ScaledIndicator.baseStyles()];\n }\n\n /**\n * Whether to activate a tab on keyboard focus or not.\n *\n * By default a tab is activated via a \"click\" interaction. This is specifically intended for when\n * tab content cannot be displayed instantly, e.g. not all of the DOM content is available, etc.\n * To learn more about \"Deciding When to Make Selection Automatically Follow Focus\", visit:\n * https://w3c.github.io/aria-practices/#kbd_selection_follows_focus\n */\n @property({ type: Boolean })\n public auto = false;\n\n /**\n * The tab items are displayed closer together.\n */\n @property({ type: Boolean, reflect: true })\n public compact = false;\n\n @property({ reflect: true })\n public override dir!: 'ltr' | 'rtl';\n\n @property({ reflect: true })\n public direction: 'vertical' | 'vertical-right' | 'horizontal' =\n 'horizontal';\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n @property()\n public label = '';\n\n @property({ type: Boolean })\n public enableTabsScroll = false;\n\n /**\n * The tab list is displayed without a border.\n */\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n\n @property({ attribute: false })\n public selectionIndicatorStyle = ScaledIndicator.noSelectionStyle;\n\n @property({ attribute: false })\n public shouldAnimate = false;\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n @query('#list')\n private tabList!: HTMLDivElement;\n\n @property({ reflect: true })\n selected = '';\n\n private set tabs(tabs: Tab[]) {\n if (tabs === this.tabs) return;\n this._tabs.forEach((tab) => {\n this.resizeController.unobserve(tab);\n });\n tabs.forEach((tab) => {\n this.resizeController.observe(tab);\n });\n this._tabs = tabs;\n this.rovingTabindexController.clearElementCache();\n }\n\n private get tabs(): Tab[] {\n return this._tabs;\n }\n\n private _tabs: Tab[] = [];\n\n constructor() {\n super();\n new IntersectionController(this, {\n config: {\n root: null,\n rootMargin: '0px',\n threshold: [0, 1],\n },\n callback: () => {\n this.updateSelectionIndicator();\n },\n });\n }\n\n protected resizeController = new ResizeController(this, {\n callback: () => {\n this.updateSelectionIndicator();\n },\n });\n\n rovingTabindexController = new RovingTabindexController<Tab>(this, {\n focusInIndex: (elements) => {\n let focusInIndex = 0;\n const firstFocusableElement = elements.find((el, index) => {\n const focusInElement = this.selected\n ? el.value === this.selected\n : !el.disabled;\n focusInIndex = index;\n return focusInElement;\n });\n return firstFocusableElement ? focusInIndex : -1;\n },\n direction: () => 'both',\n elementEnterAction: (el) => {\n if (!this.auto) return;\n\n this.shouldAnimate = true;\n this.selectTarget(el);\n },\n elements: () => this.tabs,\n isFocusableElement: (el) => !this.disabled && !el.disabled,\n listenerScope: () => this.tabList,\n });\n\n /**\n * @private\n */\n public override get focusElement(): Tab | this {\n return this.rovingTabindexController.focusInElement || this;\n }\n\n private limitDeltaToInterval(min: number, max: number) {\n return (delta: number): number => {\n if (delta < min) return min;\n if (delta > max) return max;\n return delta;\n };\n }\n\n /**\n * Scrolls through the tabs component, on the X-axis, by a given ammount of pixels/ delta. The given delta is limited to the scrollable area of the tabs component.\n * @param {number} delta - The ammount of pixels to scroll by. If the value is positive, the tabs will scroll to the right. If the value is negative, the tabs will scroll to the left.\n * @param {ScrollBehavior} behavior - The scroll behavior to use. Defaults to 'smooth'.\n */\n public scrollTabs(\n delta: number,\n behavior: ScrollBehavior = 'smooth'\n ): void {\n if (delta === 0) return;\n\n const { scrollLeft, clientWidth, scrollWidth } = this.tabList;\n const dirLimit = scrollWidth - clientWidth - Math.abs(scrollLeft);\n\n const limitDelta =\n this.dir === 'ltr'\n ? this.limitDeltaToInterval(-scrollLeft, dirLimit)\n : this.limitDeltaToInterval(-dirLimit, Math.abs(scrollLeft));\n\n this.tabList?.scrollBy({\n left: limitDelta(delta),\n top: 0,\n behavior,\n });\n }\n\n public get scrollState(): Record<string, boolean> {\n if (this.tabList) {\n const { scrollLeft, clientWidth, scrollWidth } = this.tabList;\n const canScrollLeft = Math.abs(scrollLeft) > 0;\n const canScrollRight =\n Math.ceil(Math.abs(scrollLeft)) < scrollWidth - clientWidth;\n return {\n canScrollLeft:\n this.dir === 'ltr' ? canScrollLeft : canScrollRight,\n canScrollRight:\n this.dir === 'ltr' ? canScrollRight : canScrollLeft,\n };\n }\n return {};\n }\n\n override async getUpdateComplete(): Promise<boolean> {\n const complete = await super.getUpdateComplete();\n\n const tabs = [...this.children] as Tab[];\n const tabUpdateCompletes = tabs.map((tab) => {\n if (typeof tab.updateComplete !== 'undefined') {\n return tab.updateComplete;\n }\n return Promise.resolve(true);\n });\n\n await Promise.all(tabUpdateCompletes);\n return complete;\n }\n\n private getNecessaryAutoScroll(index: number): number {\n const selectedTab = this.tabs[index];\n const selectionEnd = selectedTab.offsetLeft + selectedTab.offsetWidth;\n const viewportEnd = this.tabList.scrollLeft + this.tabList.offsetWidth;\n const selectionStart = selectedTab.offsetLeft;\n const viewportStart = this.tabList.scrollLeft;\n\n if (selectionEnd > viewportEnd) {\n // Selection is on the right side, not visible.\n return calculateScrollTargetForRightSide(\n index,\n this.dir,\n this.tabs,\n this.tabList\n );\n } else if (selectionStart < viewportStart) {\n // Selection is on the left side, not visible.\n return calculateScrollTargetForLeftSide(\n index,\n this.dir,\n this.tabs,\n this.tabList\n );\n }\n\n return -1;\n }\n\n public async scrollToSelection(): Promise<void> {\n if (!this.enableTabsScroll || !this.selected) {\n return;\n }\n\n await this.updateComplete;\n\n const selectedIndex = this.tabs.findIndex(\n (tab) => tab.value === this.selected\n );\n\n if (selectedIndex !== -1 && this.tabList) {\n // We have a selection, calculate the scroll needed to bring it into view\n const scrollTarget = this.getNecessaryAutoScroll(selectedIndex);\n\n // scrollTarget = -1 means it is already into view.\n if (scrollTarget !== -1) {\n this.tabList.scrollTo({ left: scrollTarget });\n }\n }\n }\n\n protected override updated(\n changedProperties: PropertyValueMap<this>\n ): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('selected')) {\n this.scrollToSelection();\n }\n }\n\n protected managePanels({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n const panels = target.assignedElements() as TabPanel[];\n panels.map((panel) => {\n const { value, id } = panel;\n const tab = this.querySelector(`[role=\"tab\"][value=\"${value}\"]`);\n if (tab) {\n tab.setAttribute('aria-controls', id);\n panel.setAttribute('aria-labelledby', tab.id);\n }\n panel.selected = value === this.selected;\n });\n }\n\n protected override render(): TemplateResult {\n return html`\n <div\n class=${classMap({ scroll: this.enableTabsScroll })}\n aria-label=${ifDefined(this.label ? this.label : undefined)}\n @click=${this.onClick}\n @keydown=${this.onKeyDown}\n @scroll=${this.onTabsScroll}\n id=\"list\"\n role=\"tablist\"\n part=\"tablist\"\n >\n <slot @slotchange=${this.onSlotChange}></slot>\n <div\n id=\"selection-indicator\"\n class=${ifDefined(\n this.shouldAnimate ? undefined : 'first-position'\n )}\n style=${this.selectionIndicatorStyle}\n role=\"presentation\"\n ></div>\n </div>\n <slot name=\"tab-panel\" @slotchange=${this.managePanels}></slot>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues): void {\n if (!this.hasUpdated) {\n const selectedChild = this.querySelector(\n ':scope > [selected]'\n ) as Tab;\n if (selectedChild) {\n this.selectTarget(selectedChild);\n }\n }\n\n super.willUpdate(changes);\n if (changes.has('selected')) {\n if (this.tabs.length) {\n this.updateCheckedState();\n }\n if (changes.get('selected')) {\n const previous = this.querySelector(\n `[role=\"tabpanel\"][value=\"${changes.get('selected')}\"]`\n ) as TabPanel;\n if (previous) previous.selected = false;\n }\n const next = this.querySelector(\n `[role=\"tabpanel\"][value=\"${this.selected}\"]`\n ) as TabPanel;\n if (next) next.selected = true;\n }\n if (changes.has('direction')) {\n if (this.direction === 'horizontal') {\n this.removeAttribute('aria-orientation');\n } else {\n this.setAttribute('aria-orientation', 'vertical');\n }\n }\n if (changes.has('dir')) {\n this.updateSelectionIndicator();\n }\n if (changes.has('disabled')) {\n if (this.disabled) {\n this.setAttribute('aria-disabled', 'true');\n } else {\n this.removeAttribute('aria-disabled');\n }\n }\n if (\n !this.shouldAnimate &&\n typeof changes.get('shouldAnimate') !== 'undefined'\n ) {\n this.shouldAnimate = true;\n }\n }\n\n private onTabsScroll = (): void => {\n this.dispatchEvent(\n new Event('sp-tabs-scroll', {\n bubbles: true,\n composed: true,\n })\n );\n };\n\n private onClick = (event: Event): void => {\n if (this.disabled) {\n return;\n }\n const target = event\n .composedPath()\n .find((el) => (el as Tab).parentElement === this) as Tab;\n if (!target || target.disabled) {\n return;\n }\n this.shouldAnimate = true;\n this.selectTarget(target);\n };\n\n private onKeyDown = (event: KeyboardEvent): void => {\n if (event.code === 'Enter' || event.code === 'Space') {\n event.preventDefault();\n const target = event.target as HTMLElement;\n if (target) {\n this.selectTarget(target);\n }\n }\n };\n\n private selectTarget(target: HTMLElement): void {\n const value = target.getAttribute('value');\n if (value) {\n const selected = this.selected;\n this.selected = value;\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n })\n );\n if (!applyDefault) {\n this.selected = selected;\n }\n }\n }\n\n private onSlotChange(): void {\n this.tabs = this.slotEl\n .assignedElements()\n .filter((el) => el.getAttribute('role') === 'tab') as Tab[];\n this.updateCheckedState();\n }\n\n private updateCheckedState = (): void => {\n this.tabs.forEach((element) => {\n element.removeAttribute('selected');\n });\n\n if (this.selected) {\n const currentChecked = this.tabs.find(\n (el) => el.value === this.selected\n );\n\n if (currentChecked) {\n currentChecked.selected = true;\n } else {\n this.selected = '';\n }\n } else {\n const firstTab = this.tabs[0];\n if (firstTab) {\n firstTab.setAttribute('tabindex', '0');\n }\n }\n\n this.updateSelectionIndicator();\n };\n\n private updateSelectionIndicator = async (): Promise<void> => {\n const selectedElement = this.tabs.find((el) => el.selected);\n if (!selectedElement) {\n this.selectionIndicatorStyle = ScaledIndicator.noSelectionStyle;\n return;\n }\n await Promise.all([\n selectedElement.updateComplete,\n document.fonts ? document.fonts.ready : Promise.resolve(),\n ]);\n const { width, height } = selectedElement.getBoundingClientRect();\n\n this.selectionIndicatorStyle =\n this.direction === 'horizontal'\n ? ScaledIndicator.transformX(selectedElement.offsetLeft, width)\n : ScaledIndicator.transformY(selectedElement.offsetTop, height);\n };\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n (\n document as unknown as {\n fonts: {\n addEventListener: (\n name: string,\n callback: () => void\n ) => void;\n };\n }\n ).fonts.addEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n }\n\n public override disconnectedCallback(): void {\n window.removeEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n (\n document as unknown as {\n fonts: {\n removeEventListener: (\n name: string,\n callback: () => void\n ) => void;\n };\n }\n ).fonts.removeEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n super.disconnectedCallback();\n }\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n css,\n CSSResult,\n CSSResultArray,\n html,\n PropertyValueMap,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport {\n classMap,\n ifDefined,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { IntersectionController } from '@lit-labs/observers/intersection-controller.js';\nimport { ResizeController } from '@lit-labs/observers/resize-controller.js';\nimport { Tab } from './Tab.dev.js'\nimport { Focusable } from '@spectrum-web-components/shared';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\n\nimport tabStyles from './tabs.css.js';\nimport tabSizes from './tabs-sizes.css.js';\nimport { TabPanel } from './TabPanel.dev.js'\n\n// Encapsulated for use both here and in TopNav\nexport const ScaledIndicator = {\n baseSize: 100 as const,\n noSelectionStyle: 'transform: translateX(0px) scaleX(0) scaleY(0)',\n\n transformX(left: number, width: number): string {\n const scale = width / this.baseSize;\n return `transform: translateX(${left}px) scaleX(${scale});`;\n },\n\n transformY(top: number, height: number): string {\n const scale = height / this.baseSize;\n return `transform: translateY(${top}px) scaleY(${scale});`;\n },\n\n baseStyles(): CSSResult {\n return css`\n :host([direction='vertical-right']) #selection-indicator,\n :host([direction='vertical']) #selection-indicator {\n height: ${this.baseSize}px;\n }\n :host([dir][direction='horizontal']) #selection-indicator {\n width: ${this.baseSize}px;\n }\n `;\n },\n};\n\n/**\n * Given that the scroll needs to be on the right side of the viewport.\n * Returns the coordonate x it needs to scroll so that the tab with given index is visible.\n */\nexport function calculateScrollTargetForRightSide(\n index: number,\n direction: 'rtl' | 'ltr',\n tabs: Tab[],\n container: HTMLDivElement\n): number {\n const nextIndex = index + (direction === 'rtl' ? -1 : 1);\n const nextTab = tabs[nextIndex];\n const viewportEnd = container.scrollLeft + container.offsetWidth;\n return nextTab ? nextTab.offsetLeft - container.offsetWidth : viewportEnd;\n}\n\n/**\n * Given that the scroll needs to be on the left side of the viewport.\n * Returns the coordonate x it needs to scroll so that the tab with given index is visible.\n */\nexport function calculateScrollTargetForLeftSide(\n index: number,\n direction: 'rtl' | 'ltr',\n tabs: Tab[],\n container: HTMLDivElement\n): number {\n const prevIndex = index + (direction === 'rtl' ? 1 : -1);\n const prevTab = tabs[prevIndex];\n const leftmostElement = direction === 'rtl' ? -container.offsetWidth : 0;\n return prevTab ? prevTab.offsetLeft + prevTab.offsetWidth : leftmostElement;\n}\n\n/**\n * @element sp-tabs\n *\n * @slot - Tab elements to manage as a group\n * @slot tab-panel - Tab Panel elements related to the listed Tab elements\n * @csspart tablist - Container element for the slotted sp-tab elements\n *\n * @fires change - The selected Tab child has changed.\n */\nexport class Tabs extends SizedMixin(Focusable, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [tabSizes, tabStyles, ScaledIndicator.baseStyles()];\n }\n\n /**\n * Whether to activate a tab on keyboard focus or not.\n *\n * By default a tab is activated via a \"click\" interaction. This is specifically intended for when\n * tab content cannot be displayed instantly, e.g. not all of the DOM content is available, etc.\n * To learn more about \"Deciding When to Make Selection Automatically Follow Focus\", visit:\n * https://w3c.github.io/aria-practices/#kbd_selection_follows_focus\n */\n @property({ type: Boolean })\n public auto = false;\n\n /**\n * The tab items are displayed closer together.\n */\n @property({ type: Boolean, reflect: true })\n public compact = false;\n\n @property({ reflect: true })\n public override dir!: 'ltr' | 'rtl';\n\n @property({ reflect: true })\n public direction: 'vertical' | 'vertical-right' | 'horizontal' =\n 'horizontal';\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n @property()\n public label = '';\n\n @property({ type: Boolean })\n public enableTabsScroll = false;\n\n /**\n * The tab list is displayed without a border.\n */\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n\n @property({ attribute: false })\n public selectionIndicatorStyle = ScaledIndicator.noSelectionStyle;\n\n @property({ attribute: false })\n public shouldAnimate = false;\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n @query('#list')\n private tabList!: HTMLDivElement;\n\n @property({ reflect: true })\n selected = '';\n\n private set tabs(tabs: Tab[]) {\n if (tabs === this.tabs) return;\n this._tabs.forEach((tab) => {\n this.resizeController.unobserve(tab);\n });\n tabs.forEach((tab) => {\n this.resizeController.observe(tab);\n });\n this._tabs = tabs;\n this.rovingTabindexController.clearElementCache();\n }\n\n private get tabs(): Tab[] {\n return this._tabs;\n }\n\n private _tabs: Tab[] = [];\n\n constructor() {\n super();\n new IntersectionController(this, {\n config: {\n root: null,\n rootMargin: '0px',\n threshold: [0, 1],\n },\n callback: () => {\n this.updateSelectionIndicator();\n },\n });\n }\n\n protected resizeController = new ResizeController(this, {\n callback: () => {\n this.updateSelectionIndicator();\n },\n });\n\n rovingTabindexController = new RovingTabindexController<Tab>(this, {\n focusInIndex: (elements) => {\n let focusInIndex = 0;\n const firstFocusableElement = elements.find((el, index) => {\n const focusInElement = this.selected\n ? el.value === this.selected\n : !el.disabled;\n focusInIndex = index;\n return focusInElement;\n });\n return firstFocusableElement ? focusInIndex : -1;\n },\n direction: () => 'both',\n elementEnterAction: (el) => {\n if (!this.auto) return;\n\n this.shouldAnimate = true;\n this.selectTarget(el);\n },\n elements: () => this.tabs,\n isFocusableElement: (el) => !this.disabled && !el.disabled,\n listenerScope: () => this.tabList,\n });\n\n /**\n * @private\n */\n public override get focusElement(): Tab | this {\n return this.rovingTabindexController.focusInElement || this;\n }\n\n private limitDeltaToInterval(min: number, max: number) {\n return (delta: number): number => {\n if (delta < min) return min;\n if (delta > max) return max;\n return delta;\n };\n }\n\n /**\n * Scrolls through the tabs component, on the X-axis, by a given ammount of pixels/ delta. The given delta is limited to the scrollable area of the tabs component.\n * @param {number} delta - The ammount of pixels to scroll by. If the value is positive, the tabs will scroll to the right. If the value is negative, the tabs will scroll to the left.\n * @param {ScrollBehavior} behavior - The scroll behavior to use. Defaults to 'smooth'.\n */\n public scrollTabs(\n delta: number,\n behavior: ScrollBehavior = 'smooth'\n ): void {\n if (delta === 0) return;\n\n const { scrollLeft, clientWidth, scrollWidth } = this.tabList;\n const dirLimit = scrollWidth - clientWidth - Math.abs(scrollLeft);\n\n const limitDelta =\n this.dir === 'ltr'\n ? this.limitDeltaToInterval(-scrollLeft, dirLimit)\n : this.limitDeltaToInterval(-dirLimit, Math.abs(scrollLeft));\n\n this.tabList?.scrollBy({\n left: limitDelta(delta),\n top: 0,\n behavior,\n });\n }\n\n public get scrollState(): Record<string, boolean> {\n if (this.tabList) {\n const { scrollLeft, clientWidth, scrollWidth } = this.tabList;\n const canScrollLeft = Math.abs(scrollLeft) > 0;\n const canScrollRight =\n Math.ceil(Math.abs(scrollLeft)) < scrollWidth - clientWidth;\n return {\n canScrollLeft:\n this.dir === 'ltr' ? canScrollLeft : canScrollRight,\n canScrollRight:\n this.dir === 'ltr' ? canScrollRight : canScrollLeft,\n };\n }\n return {};\n }\n\n override async getUpdateComplete(): Promise<boolean> {\n const complete = await super.getUpdateComplete();\n\n const tabs = [...this.children] as Tab[];\n const tabUpdateCompletes = tabs.map((tab) => {\n if (typeof tab.updateComplete !== 'undefined') {\n return tab.updateComplete;\n }\n return Promise.resolve(true);\n });\n\n await Promise.all(tabUpdateCompletes);\n return complete;\n }\n\n private getNecessaryAutoScroll(index: number): number {\n const selectedTab = this.tabs[index];\n const selectionEnd = selectedTab.offsetLeft + selectedTab.offsetWidth;\n const viewportEnd = this.tabList.scrollLeft + this.tabList.offsetWidth;\n const selectionStart = selectedTab.offsetLeft;\n const viewportStart = this.tabList.scrollLeft;\n\n if (selectionEnd > viewportEnd) {\n // Selection is on the right side, not visible.\n return calculateScrollTargetForRightSide(\n index,\n this.dir,\n this.tabs,\n this.tabList\n );\n } else if (selectionStart < viewportStart) {\n // Selection is on the left side, not visible.\n return calculateScrollTargetForLeftSide(\n index,\n this.dir,\n this.tabs,\n this.tabList\n );\n }\n\n return -1;\n }\n\n public async scrollToSelection(): Promise<void> {\n if (!this.enableTabsScroll || !this.selected) {\n return;\n }\n\n await this.updateComplete;\n\n const selectedIndex = this.tabs.findIndex(\n (tab) => tab.value === this.selected\n );\n\n if (selectedIndex !== -1 && this.tabList) {\n // We have a selection, calculate the scroll needed to bring it into view\n const scrollTarget = this.getNecessaryAutoScroll(selectedIndex);\n\n // scrollTarget = -1 means it is already into view.\n if (scrollTarget !== -1) {\n this.tabList.scrollTo({ left: scrollTarget });\n }\n }\n }\n\n protected override updated(\n changedProperties: PropertyValueMap<this>\n ): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('selected')) {\n this.scrollToSelection();\n }\n }\n\n protected managePanels({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n const panels = target.assignedElements() as TabPanel[];\n panels.map((panel) => {\n const { value, id } = panel;\n const tab = this.querySelector(`[role=\"tab\"][value=\"${value}\"]`);\n if (tab) {\n tab.setAttribute('aria-controls', id);\n panel.setAttribute('aria-labelledby', tab.id);\n }\n panel.selected = value === this.selected;\n });\n }\n\n protected override render(): TemplateResult {\n return html`\n <div\n class=${classMap({ scroll: this.enableTabsScroll })}\n aria-label=${ifDefined(this.label ? this.label : undefined)}\n @click=${this.onClick}\n @keydown=${this.onKeyDown}\n @scroll=${this.onTabsScroll}\n id=\"list\"\n role=\"tablist\"\n part=\"tablist\"\n >\n <slot @slotchange=${this.onSlotChange}></slot>\n <div\n id=\"selection-indicator\"\n class=${ifDefined(\n this.shouldAnimate ? undefined : 'first-position'\n )}\n style=${this.selectionIndicatorStyle}\n role=\"presentation\"\n ></div>\n </div>\n <slot name=\"tab-panel\" @slotchange=${this.managePanels}></slot>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues): void {\n if (!this.hasUpdated) {\n const selectedChild = this.querySelector(\n ':scope > [selected]'\n ) as Tab;\n if (selectedChild) {\n this.selectTarget(selectedChild);\n }\n }\n\n super.willUpdate(changes);\n if (changes.has('selected')) {\n if (this.tabs.length) {\n this.updateCheckedState();\n }\n if (changes.get('selected')) {\n const previous = this.querySelector(\n `[role=\"tabpanel\"][value=\"${changes.get('selected')}\"]`\n ) as TabPanel;\n if (previous) previous.selected = false;\n }\n const next = this.querySelector(\n `[role=\"tabpanel\"][value=\"${this.selected}\"]`\n ) as TabPanel;\n if (next) next.selected = true;\n }\n if (changes.has('direction')) {\n if (this.direction === 'horizontal') {\n this.removeAttribute('aria-orientation');\n } else {\n this.setAttribute('aria-orientation', 'vertical');\n }\n }\n if (changes.has('dir')) {\n this.updateSelectionIndicator();\n }\n if (changes.has('disabled')) {\n if (this.disabled) {\n this.setAttribute('aria-disabled', 'true');\n } else {\n this.removeAttribute('aria-disabled');\n }\n }\n if (\n !this.shouldAnimate &&\n typeof changes.get('shouldAnimate') !== 'undefined'\n ) {\n this.shouldAnimate = true;\n }\n }\n\n private onTabsScroll = (): void => {\n this.dispatchEvent(\n new Event('sp-tabs-scroll', {\n bubbles: true,\n composed: true,\n })\n );\n };\n\n private onClick = (event: Event): void => {\n if (this.disabled) {\n return;\n }\n const target = event\n .composedPath()\n .find((el) => (el as Tab).parentElement === this) as Tab;\n if (!target || target.disabled) {\n return;\n }\n this.shouldAnimate = true;\n this.selectTarget(target);\n };\n\n private onKeyDown = (event: KeyboardEvent): void => {\n if (event.code === 'Enter' || event.code === 'Space') {\n event.preventDefault();\n const target = event.target as HTMLElement;\n if (target) {\n this.selectTarget(target);\n }\n }\n };\n\n private selectTarget(target: HTMLElement): void {\n const value = target.getAttribute('value');\n if (value) {\n const selected = this.selected;\n this.selected = value;\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n })\n );\n if (!applyDefault) {\n this.selected = selected;\n }\n }\n }\n\n private onSlotChange(): void {\n this.tabs = this.slotEl\n .assignedElements()\n .filter((el) => el.getAttribute('role') === 'tab') as Tab[];\n this.updateCheckedState();\n }\n\n private updateCheckedState = (): void => {\n this.tabs.forEach((element) => {\n element.removeAttribute('selected');\n });\n\n if (this.selected) {\n const currentChecked = this.tabs.find(\n (el) => el.value === this.selected\n );\n\n if (currentChecked) {\n currentChecked.selected = true;\n } else {\n this.selected = '';\n }\n } else {\n const firstTab = this.tabs[0];\n if (firstTab) {\n firstTab.setAttribute('tabindex', '0');\n }\n }\n\n this.updateSelectionIndicator();\n };\n\n private updateSelectionIndicator = async (): Promise<void> => {\n const selectedElement = this.tabs.find((el) => el.selected);\n if (!selectedElement) {\n this.selectionIndicatorStyle = ScaledIndicator.noSelectionStyle;\n return;\n }\n await Promise.all([\n selectedElement.updateComplete,\n document.fonts ? document.fonts.ready : Promise.resolve(),\n ]);\n const { width, height } = selectedElement.getBoundingClientRect();\n\n this.selectionIndicatorStyle =\n this.direction === 'horizontal'\n ? ScaledIndicator.transformX(selectedElement.offsetLeft, width)\n : ScaledIndicator.transformY(selectedElement.offsetTop, height);\n };\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n (\n document as unknown as {\n fonts: {\n addEventListener: (\n name: string,\n callback: () => void\n ) => void;\n };\n }\n ).fonts.addEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n }\n\n public override disconnectedCallback(): void {\n window.removeEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n (\n document as unknown as {\n fonts: {\n removeEventListener: (\n name: string,\n callback: () => void\n ) => void;\n };\n }\n ).fonts.removeEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n super.disconnectedCallback();\n }\n}\n"],
|
|
5
5
|
"mappings": ";;;;;;;;;;;AAYA;AAAA,EACI;AAAA,EAGA;AAAA,EAGA;AAAA,OAEG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP;AAAA,EACI;AAAA,EACA;AAAA,OACG;AACP,SAAS,8BAA8B;AACvC,SAAS,wBAAwB;AAEjC,SAAS,iBAAiB;AAC1B,SAAS,gCAAgC;AAEzC,OAAO,eAAe;AACtB,OAAO,cAAc;AAId,aAAM,kBAAkB;AAAA,EAC3B,UAAU;AAAA,EACV,kBAAkB;AAAA,EAElB,WAAW,MAAc,OAAuB;AAC5C,UAAM,QAAQ,QAAQ,KAAK;AAC3B,WAAO,yBAAyB,IAAI,cAAc,KAAK;AAAA,EAC3D;AAAA,EAEA,WAAW,KAAa,QAAwB;AAC5C,UAAM,QAAQ,SAAS,KAAK;AAC5B,WAAO,yBAAyB,GAAG,cAAc,KAAK;AAAA,EAC1D;AAAA,EAEA,aAAwB;AACpB,WAAO;AAAA;AAAA;AAAA,0BAGW,KAAK,QAAQ;AAAA;AAAA;AAAA,yBAGd,KAAK,QAAQ;AAAA;AAAA;AAAA,EAGlC;AACJ;AAMO,gBAAS,kCACZ,OACA,WACA,MACA,WACM;AACN,QAAM,YAAY,SAAS,cAAc,QAAQ,KAAK;AACtD,QAAM,UAAU,KAAK,SAAS;AAC9B,QAAM,cAAc,UAAU,aAAa,UAAU;AACrD,SAAO,UAAU,QAAQ,aAAa,UAAU,cAAc;AAClE;AAMO,gBAAS,iCACZ,OACA,WACA,MACA,WACM;AACN,QAAM,YAAY,SAAS,cAAc,QAAQ,IAAI;AACrD,QAAM,UAAU,KAAK,SAAS;AAC9B,QA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,KAuBO;AAGT;AAAA,EADN,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAzBlB,KA0BF;AAIA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GA7BjC,KA8BF;AAGA;AAAA,EADN,SAAS;AAAA,GAhCD,KAiCF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,CAAC;AAAA,GAnClB,KAoCF;AAMA;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GAzCjC,KA0CF;AAGA;AAAA,EADN,SAAS,EAAE,WAAW,MAAM,CAAC;AAAA,GA5CrB,KA6CF;AAGA;AAAA,EADN,SAAS,EAAE,WAAW,MAAM,CAAC;AAAA,GA/CrB,KAgDF;AAGC;AAAA,EADP,MAAM,MAAM;AAAA,GAlDJ,KAmDD;AAGA;AAAA,EADP,MAAM,OAAO;AAAA,GArDL,KAsDD;AAGR;AAAA,EADC,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAxDlB,KAyDT;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/Tabs.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["Tabs.ts"],
|
|
4
|
-
"sourcesContent": ["/*\nCopyright 2020 Adobe. All rights reserved.\nThis file is licensed to you under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License. You may obtain a copy\nof the License at http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software distributed under\nthe License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\nOF ANY KIND, either express or implied. See the License for the specific language\ngoverning permissions and limitations under the License.\n*/\n\nimport {\n css,\n CSSResult,\n CSSResultArray,\n html,\n PropertyValueMap,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport {\n classMap,\n ifDefined,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { IntersectionController } from '@lit-labs/observers/intersection-controller.js';\nimport { ResizeController } from '@lit-labs/observers/resize-controller.js';\nimport { Tab } from './Tab.js';\nimport { Focusable } from '@spectrum-web-components/shared';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\n\nimport tabStyles from './tabs.css.js';\nimport tabSizes from './tabs-sizes.css.js';\nimport { TabPanel } from './TabPanel.js';\n\n// Encapsulated for use both here and in TopNav\nexport const ScaledIndicator = {\n baseSize: 100 as const,\n noSelectionStyle: 'transform: translateX(0px) scaleX(0) scaleY(0)',\n\n transformX(left: number, width: number): string {\n const scale = width / this.baseSize;\n return `transform: translateX(${left}px) scaleX(${scale});`;\n },\n\n transformY(top: number, height: number): string {\n const scale = height / this.baseSize;\n return `transform: translateY(${top}px) scaleY(${scale});`;\n },\n\n baseStyles(): CSSResult {\n return css`\n :host([direction='vertical-right']) #selection-indicator,\n :host([direction='vertical']) #selection-indicator {\n height: ${this.baseSize}px;\n }\n :host([dir][direction='horizontal']) #selection-indicator {\n width: ${this.baseSize}px;\n }\n `;\n },\n};\n\n/**\n * Given that the scroll needs to be on the right side of the viewport.\n * Returns the coordonate x it needs to scroll so that the tab with given index is visible.\n */\nexport function calculateScrollTargetForRightSide(\n index: number,\n direction: 'rtl' | 'ltr',\n tabs: Tab[],\n container: HTMLDivElement\n): number {\n const nextIndex = index + (direction === 'rtl' ? -1 : 1);\n const nextTab = tabs[nextIndex];\n const viewportEnd = container.scrollLeft + container.offsetWidth;\n return nextTab ? nextTab.offsetLeft - container.offsetWidth : viewportEnd;\n}\n\n/**\n * Given that the scroll needs to be on the left side of the viewport.\n * Returns the coordonate x it needs to scroll so that the tab with given index is visible.\n */\nexport function calculateScrollTargetForLeftSide(\n index: number,\n direction: 'rtl' | 'ltr',\n tabs: Tab[],\n container: HTMLDivElement\n): number {\n const prevIndex = index + (direction === 'rtl' ? 1 : -1);\n const prevTab = tabs[prevIndex];\n const leftmostElement = direction === 'rtl' ? -container.offsetWidth : 0;\n return prevTab ? prevTab.offsetLeft + prevTab.offsetWidth : leftmostElement;\n}\n\n/**\n * @element sp-tabs\n *\n * @slot - Tab elements to manage as a group\n * @slot tab-panel - Tab Panel elements related to the listed Tab elements\n * @csspart tablist - Container element for the slotted sp-tab elements\n *\n * @fires change - The selected Tab child has changed.\n */\nexport class Tabs extends SizedMixin(Focusable, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [tabSizes, tabStyles, ScaledIndicator.baseStyles()];\n }\n\n /**\n * Whether to activate a tab on keyboard focus or not.\n *\n * By default a tab is activated via a \"click\" interaction. This is specifically intended for when\n * tab content cannot be displayed instantly, e.g. not all of the DOM content is available, etc.\n * To learn more about \"Deciding When to Make Selection Automatically Follow Focus\", visit:\n * https://w3c.github.io/aria-practices/#kbd_selection_follows_focus\n */\n @property({ type: Boolean })\n public auto = false;\n\n /**\n * The tab items are displayed closer together.\n */\n @property({ type: Boolean, reflect: true })\n public compact = false;\n\n @property({ reflect: true })\n public override dir!: 'ltr' | 'rtl';\n\n @property({ reflect: true })\n public direction: 'vertical' | 'vertical-right' | 'horizontal' =\n 'horizontal';\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n @property()\n public label = '';\n\n @property({ type: Boolean })\n public enableTabsScroll = false;\n\n /**\n * The tab list is displayed without a border.\n */\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n\n @property({ attribute: false })\n public selectionIndicatorStyle = ScaledIndicator.noSelectionStyle;\n\n @property({ attribute: false })\n public shouldAnimate = false;\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n @query('#list')\n private tabList!: HTMLDivElement;\n\n @property({ reflect: true })\n selected = '';\n\n private set tabs(tabs: Tab[]) {\n if (tabs === this.tabs) return;\n this._tabs.forEach((tab) => {\n this.resizeController.unobserve(tab);\n });\n tabs.forEach((tab) => {\n this.resizeController.observe(tab);\n });\n this._tabs = tabs;\n this.rovingTabindexController.clearElementCache();\n }\n\n private get tabs(): Tab[] {\n return this._tabs;\n }\n\n private _tabs: Tab[] = [];\n\n constructor() {\n super();\n new IntersectionController(this, {\n config: {\n root: null,\n rootMargin: '0px',\n threshold: [0, 1],\n },\n callback: () => {\n this.updateSelectionIndicator();\n },\n });\n }\n\n protected resizeController = new ResizeController(this, {\n callback: () => {\n this.updateSelectionIndicator();\n },\n });\n\n rovingTabindexController = new RovingTabindexController<Tab>(this, {\n focusInIndex: (elements) => {\n let focusInIndex = 0;\n const firstFocusableElement = elements.find((el, index) => {\n const focusInElement = this.selected\n ? el.value === this.selected\n : !el.disabled;\n focusInIndex = index;\n return focusInElement;\n });\n return firstFocusableElement ? focusInIndex : -1;\n },\n direction: () => 'both',\n elementEnterAction: (el) => {\n if (!this.auto) return;\n\n this.shouldAnimate = true;\n this.selectTarget(el);\n },\n elements: () => this.tabs,\n isFocusableElement: (el) => !this.disabled && !el.disabled,\n listenerScope: () => this.tabList,\n });\n\n /**\n * @private\n */\n public override get focusElement(): Tab | this {\n return this.rovingTabindexController.focusInElement || this;\n }\n\n private limitDeltaToInterval(min: number, max: number) {\n return (delta: number): number => {\n if (delta < min) return min;\n if (delta > max) return max;\n return delta;\n };\n }\n\n /**\n * Scrolls through the tabs component, on the X-axis, by a given ammount of pixels/ delta. The given delta is limited to the scrollable area of the tabs component.\n * @param {number} delta - The ammount of pixels to scroll by. If the value is positive, the tabs will scroll to the right. If the value is negative, the tabs will scroll to the left.\n * @param {ScrollBehavior} behavior - The scroll behavior to use. Defaults to 'smooth'.\n */\n public scrollTabs(\n delta: number,\n behavior: ScrollBehavior = 'smooth'\n ): void {\n if (delta === 0) return;\n\n const { scrollLeft, clientWidth, scrollWidth } = this.tabList;\n const dirLimit = scrollWidth - clientWidth - Math.abs(scrollLeft);\n\n const limitDelta =\n this.dir === 'ltr'\n ? this.limitDeltaToInterval(-scrollLeft, dirLimit)\n : this.limitDeltaToInterval(-dirLimit, Math.abs(scrollLeft));\n\n this.tabList?.scrollBy({\n left: limitDelta(delta),\n top: 0,\n behavior,\n });\n }\n\n public get scrollState(): Record<string, boolean> {\n if (this.tabList) {\n const { scrollLeft, clientWidth, scrollWidth } = this.tabList;\n const canScrollLeft = Math.abs(scrollLeft) > 0;\n const canScrollRight =\n Math.ceil(Math.abs(scrollLeft)) < scrollWidth - clientWidth;\n return {\n canScrollLeft:\n this.dir === 'ltr' ? canScrollLeft : canScrollRight,\n canScrollRight:\n this.dir === 'ltr' ? canScrollRight : canScrollLeft,\n };\n }\n return {};\n }\n\n override async getUpdateComplete(): Promise<boolean> {\n const complete = await super.getUpdateComplete();\n\n const tabs = [...this.children] as Tab[];\n const tabUpdateCompletes = tabs.map((tab) => {\n if (typeof tab.updateComplete !== 'undefined') {\n return tab.updateComplete;\n }\n return Promise.resolve(true);\n });\n\n await Promise.all(tabUpdateCompletes);\n return complete;\n }\n\n private getNecessaryAutoScroll(index: number): number {\n const selectedTab = this.tabs[index];\n const selectionEnd = selectedTab.offsetLeft + selectedTab.offsetWidth;\n const viewportEnd = this.tabList.scrollLeft + this.tabList.offsetWidth;\n const selectionStart = selectedTab.offsetLeft;\n const viewportStart = this.tabList.scrollLeft;\n\n if (selectionEnd > viewportEnd) {\n // Selection is on the right side, not visible.\n return calculateScrollTargetForRightSide(\n index,\n this.dir,\n this.tabs,\n this.tabList\n );\n } else if (selectionStart < viewportStart) {\n // Selection is on the left side, not visible.\n return calculateScrollTargetForLeftSide(\n index,\n this.dir,\n this.tabs,\n this.tabList\n );\n }\n\n return -1;\n }\n\n public async scrollToSelection(): Promise<void> {\n if (!this.enableTabsScroll || !this.selected) {\n return;\n }\n\n await this.updateComplete;\n\n const selectedIndex = this.tabs.findIndex(\n (tab) => tab.value === this.selected\n );\n\n if (selectedIndex !== -1 && this.tabList) {\n // We have a selection, calculate the scroll needed to bring it into view\n const scrollTarget = this.getNecessaryAutoScroll(selectedIndex);\n\n // scrollTarget = -1 means it is already into view.\n if (scrollTarget !== -1) {\n this.tabList.scrollTo({ left: scrollTarget });\n }\n }\n }\n\n protected override updated(\n changedProperties: PropertyValueMap<this>\n ): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('selected')) {\n this.scrollToSelection();\n }\n }\n\n protected managePanels({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n const panels = target.assignedElements() as TabPanel[];\n panels.map((panel) => {\n const { value, id } = panel;\n const tab = this.querySelector(`[role=\"tab\"][value=\"${value}\"]`);\n if (tab) {\n tab.setAttribute('aria-controls', id);\n panel.setAttribute('aria-labelledby', tab.id);\n }\n panel.selected = value === this.selected;\n });\n }\n\n protected override render(): TemplateResult {\n return html`\n <div\n class=${classMap({ scroll: this.enableTabsScroll })}\n aria-label=${ifDefined(this.label ? this.label : undefined)}\n @click=${this.onClick}\n @keydown=${this.onKeyDown}\n @scroll=${this.onTabsScroll}\n id=\"list\"\n role=\"tablist\"\n part=\"tablist\"\n >\n <slot @slotchange=${this.onSlotChange}></slot>\n <div\n id=\"selection-indicator\"\n class=${ifDefined(\n this.shouldAnimate ? undefined : 'first-position'\n )}\n style=${this.selectionIndicatorStyle}\n role=\"presentation\"\n ></div>\n </div>\n <slot name=\"tab-panel\" @slotchange=${this.managePanels}></slot>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues): void {\n if (!this.hasUpdated) {\n const selectedChild = this.querySelector(\n ':scope > [selected]'\n ) as Tab;\n if (selectedChild) {\n this.selectTarget(selectedChild);\n }\n }\n\n super.willUpdate(changes);\n if (changes.has('selected')) {\n if (this.tabs.length) {\n this.updateCheckedState();\n }\n if (changes.get('selected')) {\n const previous = this.querySelector(\n `[role=\"tabpanel\"][value=\"${changes.get('selected')}\"]`\n ) as TabPanel;\n if (previous) previous.selected = false;\n }\n const next = this.querySelector(\n `[role=\"tabpanel\"][value=\"${this.selected}\"]`\n ) as TabPanel;\n if (next) next.selected = true;\n }\n if (changes.has('direction')) {\n if (this.direction === 'horizontal') {\n this.removeAttribute('aria-orientation');\n } else {\n this.setAttribute('aria-orientation', 'vertical');\n }\n }\n if (changes.has('dir')) {\n this.updateSelectionIndicator();\n }\n if (changes.has('disabled')) {\n if (this.disabled) {\n this.setAttribute('aria-disabled', 'true');\n } else {\n this.removeAttribute('aria-disabled');\n }\n }\n if (\n !this.shouldAnimate &&\n typeof changes.get('shouldAnimate') !== 'undefined'\n ) {\n this.shouldAnimate = true;\n }\n }\n\n private onTabsScroll = (): void => {\n this.dispatchEvent(\n new Event('sp-tabs-scroll', {\n bubbles: true,\n composed: true,\n })\n );\n };\n\n private onClick = (event: Event): void => {\n if (this.disabled) {\n return;\n }\n const target = event\n .composedPath()\n .find((el) => (el as Tab).parentElement === this) as Tab;\n if (!target || target.disabled) {\n return;\n }\n this.shouldAnimate = true;\n this.selectTarget(target);\n };\n\n private onKeyDown = (event: KeyboardEvent): void => {\n if (event.code === 'Enter' || event.code === 'Space') {\n event.preventDefault();\n const target = event.target as HTMLElement;\n if (target) {\n this.selectTarget(target);\n }\n }\n };\n\n private selectTarget(target: HTMLElement): void {\n const value = target.getAttribute('value');\n if (value) {\n const selected = this.selected;\n this.selected = value;\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n })\n );\n if (!applyDefault) {\n this.selected = selected;\n }\n }\n }\n\n private onSlotChange(): void {\n this.tabs = this.slotEl\n .assignedElements()\n .filter((el) => el.getAttribute('role') === 'tab') as Tab[];\n this.updateCheckedState();\n }\n\n private updateCheckedState = (): void => {\n this.tabs.forEach((element) => {\n element.removeAttribute('selected');\n });\n\n if (this.selected) {\n const currentChecked = this.tabs.find(\n (el) => el.value === this.selected\n );\n\n if (currentChecked) {\n currentChecked.selected = true;\n } else {\n this.selected = '';\n }\n } else {\n const firstTab = this.tabs[0];\n if (firstTab) {\n firstTab.setAttribute('tabindex', '0');\n }\n }\n\n this.updateSelectionIndicator();\n };\n\n private updateSelectionIndicator = async (): Promise<void> => {\n const selectedElement = this.tabs.find((el) => el.selected);\n if (!selectedElement) {\n this.selectionIndicatorStyle = ScaledIndicator.noSelectionStyle;\n return;\n }\n await Promise.all([\n selectedElement.updateComplete,\n document.fonts ? document.fonts.ready : Promise.resolve(),\n ]);\n const { width, height } = selectedElement.getBoundingClientRect();\n\n this.selectionIndicatorStyle =\n this.direction === 'horizontal'\n ? ScaledIndicator.transformX(selectedElement.offsetLeft, width)\n : ScaledIndicator.transformY(selectedElement.offsetTop, height);\n };\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n (\n document as unknown as {\n fonts: {\n addEventListener: (\n name: string,\n callback: () => void\n ) => void;\n };\n }\n ).fonts.addEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n }\n\n public override disconnectedCallback(): void {\n window.removeEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n (\n document as unknown as {\n fonts: {\n removeEventListener: (\n name: string,\n callback: () => void\n ) => void;\n };\n }\n ).fonts.removeEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n super.disconnectedCallback();\n }\n}\n"],
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nimport {\n css,\n CSSResult,\n CSSResultArray,\n html,\n PropertyValueMap,\n PropertyValues,\n SizedMixin,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport {\n classMap,\n ifDefined,\n} from '@spectrum-web-components/base/src/directives.js';\nimport { IntersectionController } from '@lit-labs/observers/intersection-controller.js';\nimport { ResizeController } from '@lit-labs/observers/resize-controller.js';\nimport { Tab } from './Tab.js';\nimport { Focusable } from '@spectrum-web-components/shared';\nimport { RovingTabindexController } from '@spectrum-web-components/reactive-controllers/src/RovingTabindex.js';\n\nimport tabStyles from './tabs.css.js';\nimport tabSizes from './tabs-sizes.css.js';\nimport { TabPanel } from './TabPanel.js';\n\n// Encapsulated for use both here and in TopNav\nexport const ScaledIndicator = {\n baseSize: 100 as const,\n noSelectionStyle: 'transform: translateX(0px) scaleX(0) scaleY(0)',\n\n transformX(left: number, width: number): string {\n const scale = width / this.baseSize;\n return `transform: translateX(${left}px) scaleX(${scale});`;\n },\n\n transformY(top: number, height: number): string {\n const scale = height / this.baseSize;\n return `transform: translateY(${top}px) scaleY(${scale});`;\n },\n\n baseStyles(): CSSResult {\n return css`\n :host([direction='vertical-right']) #selection-indicator,\n :host([direction='vertical']) #selection-indicator {\n height: ${this.baseSize}px;\n }\n :host([dir][direction='horizontal']) #selection-indicator {\n width: ${this.baseSize}px;\n }\n `;\n },\n};\n\n/**\n * Given that the scroll needs to be on the right side of the viewport.\n * Returns the coordonate x it needs to scroll so that the tab with given index is visible.\n */\nexport function calculateScrollTargetForRightSide(\n index: number,\n direction: 'rtl' | 'ltr',\n tabs: Tab[],\n container: HTMLDivElement\n): number {\n const nextIndex = index + (direction === 'rtl' ? -1 : 1);\n const nextTab = tabs[nextIndex];\n const viewportEnd = container.scrollLeft + container.offsetWidth;\n return nextTab ? nextTab.offsetLeft - container.offsetWidth : viewportEnd;\n}\n\n/**\n * Given that the scroll needs to be on the left side of the viewport.\n * Returns the coordonate x it needs to scroll so that the tab with given index is visible.\n */\nexport function calculateScrollTargetForLeftSide(\n index: number,\n direction: 'rtl' | 'ltr',\n tabs: Tab[],\n container: HTMLDivElement\n): number {\n const prevIndex = index + (direction === 'rtl' ? 1 : -1);\n const prevTab = tabs[prevIndex];\n const leftmostElement = direction === 'rtl' ? -container.offsetWidth : 0;\n return prevTab ? prevTab.offsetLeft + prevTab.offsetWidth : leftmostElement;\n}\n\n/**\n * @element sp-tabs\n *\n * @slot - Tab elements to manage as a group\n * @slot tab-panel - Tab Panel elements related to the listed Tab elements\n * @csspart tablist - Container element for the slotted sp-tab elements\n *\n * @fires change - The selected Tab child has changed.\n */\nexport class Tabs extends SizedMixin(Focusable, { noDefaultSize: true }) {\n public static override get styles(): CSSResultArray {\n return [tabSizes, tabStyles, ScaledIndicator.baseStyles()];\n }\n\n /**\n * Whether to activate a tab on keyboard focus or not.\n *\n * By default a tab is activated via a \"click\" interaction. This is specifically intended for when\n * tab content cannot be displayed instantly, e.g. not all of the DOM content is available, etc.\n * To learn more about \"Deciding When to Make Selection Automatically Follow Focus\", visit:\n * https://w3c.github.io/aria-practices/#kbd_selection_follows_focus\n */\n @property({ type: Boolean })\n public auto = false;\n\n /**\n * The tab items are displayed closer together.\n */\n @property({ type: Boolean, reflect: true })\n public compact = false;\n\n @property({ reflect: true })\n public override dir!: 'ltr' | 'rtl';\n\n @property({ reflect: true })\n public direction: 'vertical' | 'vertical-right' | 'horizontal' =\n 'horizontal';\n\n @property({ type: Boolean, reflect: true })\n public emphasized = false;\n\n @property()\n public label = '';\n\n @property({ type: Boolean })\n public enableTabsScroll = false;\n\n /**\n * The tab list is displayed without a border.\n */\n @property({ type: Boolean, reflect: true })\n public quiet = false;\n\n @property({ attribute: false })\n public selectionIndicatorStyle = ScaledIndicator.noSelectionStyle;\n\n @property({ attribute: false })\n public shouldAnimate = false;\n\n @query('slot')\n private slotEl!: HTMLSlotElement;\n\n @query('#list')\n private tabList!: HTMLDivElement;\n\n @property({ reflect: true })\n selected = '';\n\n private set tabs(tabs: Tab[]) {\n if (tabs === this.tabs) return;\n this._tabs.forEach((tab) => {\n this.resizeController.unobserve(tab);\n });\n tabs.forEach((tab) => {\n this.resizeController.observe(tab);\n });\n this._tabs = tabs;\n this.rovingTabindexController.clearElementCache();\n }\n\n private get tabs(): Tab[] {\n return this._tabs;\n }\n\n private _tabs: Tab[] = [];\n\n constructor() {\n super();\n new IntersectionController(this, {\n config: {\n root: null,\n rootMargin: '0px',\n threshold: [0, 1],\n },\n callback: () => {\n this.updateSelectionIndicator();\n },\n });\n }\n\n protected resizeController = new ResizeController(this, {\n callback: () => {\n this.updateSelectionIndicator();\n },\n });\n\n rovingTabindexController = new RovingTabindexController<Tab>(this, {\n focusInIndex: (elements) => {\n let focusInIndex = 0;\n const firstFocusableElement = elements.find((el, index) => {\n const focusInElement = this.selected\n ? el.value === this.selected\n : !el.disabled;\n focusInIndex = index;\n return focusInElement;\n });\n return firstFocusableElement ? focusInIndex : -1;\n },\n direction: () => 'both',\n elementEnterAction: (el) => {\n if (!this.auto) return;\n\n this.shouldAnimate = true;\n this.selectTarget(el);\n },\n elements: () => this.tabs,\n isFocusableElement: (el) => !this.disabled && !el.disabled,\n listenerScope: () => this.tabList,\n });\n\n /**\n * @private\n */\n public override get focusElement(): Tab | this {\n return this.rovingTabindexController.focusInElement || this;\n }\n\n private limitDeltaToInterval(min: number, max: number) {\n return (delta: number): number => {\n if (delta < min) return min;\n if (delta > max) return max;\n return delta;\n };\n }\n\n /**\n * Scrolls through the tabs component, on the X-axis, by a given ammount of pixels/ delta. The given delta is limited to the scrollable area of the tabs component.\n * @param {number} delta - The ammount of pixels to scroll by. If the value is positive, the tabs will scroll to the right. If the value is negative, the tabs will scroll to the left.\n * @param {ScrollBehavior} behavior - The scroll behavior to use. Defaults to 'smooth'.\n */\n public scrollTabs(\n delta: number,\n behavior: ScrollBehavior = 'smooth'\n ): void {\n if (delta === 0) return;\n\n const { scrollLeft, clientWidth, scrollWidth } = this.tabList;\n const dirLimit = scrollWidth - clientWidth - Math.abs(scrollLeft);\n\n const limitDelta =\n this.dir === 'ltr'\n ? this.limitDeltaToInterval(-scrollLeft, dirLimit)\n : this.limitDeltaToInterval(-dirLimit, Math.abs(scrollLeft));\n\n this.tabList?.scrollBy({\n left: limitDelta(delta),\n top: 0,\n behavior,\n });\n }\n\n public get scrollState(): Record<string, boolean> {\n if (this.tabList) {\n const { scrollLeft, clientWidth, scrollWidth } = this.tabList;\n const canScrollLeft = Math.abs(scrollLeft) > 0;\n const canScrollRight =\n Math.ceil(Math.abs(scrollLeft)) < scrollWidth - clientWidth;\n return {\n canScrollLeft:\n this.dir === 'ltr' ? canScrollLeft : canScrollRight,\n canScrollRight:\n this.dir === 'ltr' ? canScrollRight : canScrollLeft,\n };\n }\n return {};\n }\n\n override async getUpdateComplete(): Promise<boolean> {\n const complete = await super.getUpdateComplete();\n\n const tabs = [...this.children] as Tab[];\n const tabUpdateCompletes = tabs.map((tab) => {\n if (typeof tab.updateComplete !== 'undefined') {\n return tab.updateComplete;\n }\n return Promise.resolve(true);\n });\n\n await Promise.all(tabUpdateCompletes);\n return complete;\n }\n\n private getNecessaryAutoScroll(index: number): number {\n const selectedTab = this.tabs[index];\n const selectionEnd = selectedTab.offsetLeft + selectedTab.offsetWidth;\n const viewportEnd = this.tabList.scrollLeft + this.tabList.offsetWidth;\n const selectionStart = selectedTab.offsetLeft;\n const viewportStart = this.tabList.scrollLeft;\n\n if (selectionEnd > viewportEnd) {\n // Selection is on the right side, not visible.\n return calculateScrollTargetForRightSide(\n index,\n this.dir,\n this.tabs,\n this.tabList\n );\n } else if (selectionStart < viewportStart) {\n // Selection is on the left side, not visible.\n return calculateScrollTargetForLeftSide(\n index,\n this.dir,\n this.tabs,\n this.tabList\n );\n }\n\n return -1;\n }\n\n public async scrollToSelection(): Promise<void> {\n if (!this.enableTabsScroll || !this.selected) {\n return;\n }\n\n await this.updateComplete;\n\n const selectedIndex = this.tabs.findIndex(\n (tab) => tab.value === this.selected\n );\n\n if (selectedIndex !== -1 && this.tabList) {\n // We have a selection, calculate the scroll needed to bring it into view\n const scrollTarget = this.getNecessaryAutoScroll(selectedIndex);\n\n // scrollTarget = -1 means it is already into view.\n if (scrollTarget !== -1) {\n this.tabList.scrollTo({ left: scrollTarget });\n }\n }\n }\n\n protected override updated(\n changedProperties: PropertyValueMap<this>\n ): void {\n super.updated(changedProperties);\n\n if (changedProperties.has('selected')) {\n this.scrollToSelection();\n }\n }\n\n protected managePanels({\n target,\n }: Event & { target: HTMLSlotElement }): void {\n const panels = target.assignedElements() as TabPanel[];\n panels.map((panel) => {\n const { value, id } = panel;\n const tab = this.querySelector(`[role=\"tab\"][value=\"${value}\"]`);\n if (tab) {\n tab.setAttribute('aria-controls', id);\n panel.setAttribute('aria-labelledby', tab.id);\n }\n panel.selected = value === this.selected;\n });\n }\n\n protected override render(): TemplateResult {\n return html`\n <div\n class=${classMap({ scroll: this.enableTabsScroll })}\n aria-label=${ifDefined(this.label ? this.label : undefined)}\n @click=${this.onClick}\n @keydown=${this.onKeyDown}\n @scroll=${this.onTabsScroll}\n id=\"list\"\n role=\"tablist\"\n part=\"tablist\"\n >\n <slot @slotchange=${this.onSlotChange}></slot>\n <div\n id=\"selection-indicator\"\n class=${ifDefined(\n this.shouldAnimate ? undefined : 'first-position'\n )}\n style=${this.selectionIndicatorStyle}\n role=\"presentation\"\n ></div>\n </div>\n <slot name=\"tab-panel\" @slotchange=${this.managePanels}></slot>\n `;\n }\n\n protected override willUpdate(changes: PropertyValues): void {\n if (!this.hasUpdated) {\n const selectedChild = this.querySelector(\n ':scope > [selected]'\n ) as Tab;\n if (selectedChild) {\n this.selectTarget(selectedChild);\n }\n }\n\n super.willUpdate(changes);\n if (changes.has('selected')) {\n if (this.tabs.length) {\n this.updateCheckedState();\n }\n if (changes.get('selected')) {\n const previous = this.querySelector(\n `[role=\"tabpanel\"][value=\"${changes.get('selected')}\"]`\n ) as TabPanel;\n if (previous) previous.selected = false;\n }\n const next = this.querySelector(\n `[role=\"tabpanel\"][value=\"${this.selected}\"]`\n ) as TabPanel;\n if (next) next.selected = true;\n }\n if (changes.has('direction')) {\n if (this.direction === 'horizontal') {\n this.removeAttribute('aria-orientation');\n } else {\n this.setAttribute('aria-orientation', 'vertical');\n }\n }\n if (changes.has('dir')) {\n this.updateSelectionIndicator();\n }\n if (changes.has('disabled')) {\n if (this.disabled) {\n this.setAttribute('aria-disabled', 'true');\n } else {\n this.removeAttribute('aria-disabled');\n }\n }\n if (\n !this.shouldAnimate &&\n typeof changes.get('shouldAnimate') !== 'undefined'\n ) {\n this.shouldAnimate = true;\n }\n }\n\n private onTabsScroll = (): void => {\n this.dispatchEvent(\n new Event('sp-tabs-scroll', {\n bubbles: true,\n composed: true,\n })\n );\n };\n\n private onClick = (event: Event): void => {\n if (this.disabled) {\n return;\n }\n const target = event\n .composedPath()\n .find((el) => (el as Tab).parentElement === this) as Tab;\n if (!target || target.disabled) {\n return;\n }\n this.shouldAnimate = true;\n this.selectTarget(target);\n };\n\n private onKeyDown = (event: KeyboardEvent): void => {\n if (event.code === 'Enter' || event.code === 'Space') {\n event.preventDefault();\n const target = event.target as HTMLElement;\n if (target) {\n this.selectTarget(target);\n }\n }\n };\n\n private selectTarget(target: HTMLElement): void {\n const value = target.getAttribute('value');\n if (value) {\n const selected = this.selected;\n this.selected = value;\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n })\n );\n if (!applyDefault) {\n this.selected = selected;\n }\n }\n }\n\n private onSlotChange(): void {\n this.tabs = this.slotEl\n .assignedElements()\n .filter((el) => el.getAttribute('role') === 'tab') as Tab[];\n this.updateCheckedState();\n }\n\n private updateCheckedState = (): void => {\n this.tabs.forEach((element) => {\n element.removeAttribute('selected');\n });\n\n if (this.selected) {\n const currentChecked = this.tabs.find(\n (el) => el.value === this.selected\n );\n\n if (currentChecked) {\n currentChecked.selected = true;\n } else {\n this.selected = '';\n }\n } else {\n const firstTab = this.tabs[0];\n if (firstTab) {\n firstTab.setAttribute('tabindex', '0');\n }\n }\n\n this.updateSelectionIndicator();\n };\n\n private updateSelectionIndicator = async (): Promise<void> => {\n const selectedElement = this.tabs.find((el) => el.selected);\n if (!selectedElement) {\n this.selectionIndicatorStyle = ScaledIndicator.noSelectionStyle;\n return;\n }\n await Promise.all([\n selectedElement.updateComplete,\n document.fonts ? document.fonts.ready : Promise.resolve(),\n ]);\n const { width, height } = selectedElement.getBoundingClientRect();\n\n this.selectionIndicatorStyle =\n this.direction === 'horizontal'\n ? ScaledIndicator.transformX(selectedElement.offsetLeft, width)\n : ScaledIndicator.transformY(selectedElement.offsetTop, height);\n };\n\n public override connectedCallback(): void {\n super.connectedCallback();\n window.addEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n (\n document as unknown as {\n fonts: {\n addEventListener: (\n name: string,\n callback: () => void\n ) => void;\n };\n }\n ).fonts.addEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n }\n\n public override disconnectedCallback(): void {\n window.removeEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n (\n document as unknown as {\n fonts: {\n removeEventListener: (\n name: string,\n callback: () => void\n ) => void;\n };\n }\n ).fonts.removeEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n super.disconnectedCallback();\n }\n}\n"],
|
|
5
5
|
"mappings": "qNAYA,OACI,OAAAA,EAGA,QAAAC,EAGA,cAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,MACG,kDACP,OACI,YAAAC,EACA,aAAAC,MACG,kDACP,OAAS,0BAAAC,MAA8B,iDACvC,OAAS,oBAAAC,MAAwB,2CAEjC,OAAS,aAAAC,MAAiB,kCAC1B,OAAS,4BAAAC,MAAgC,sEAEzC,OAAOC,MAAe,gBACtB,OAAOC,MAAc,sBAId,aAAM,gBAAkB,CAC3B,SAAU,IACV,iBAAkB,iDAElB,WAAWC,EAAcC,EAAuB,CAC5C,MAAMC,EAAQD,EAAQ,KAAK,SAC3B,MAAO,yBAAyBD,CAAI,cAAcE,CAAK,IAC3D,EAEA,WAAWC,EAAaC,EAAwB,CAC5C,MAAMF,EAAQE,EAAS,KAAK,SAC5B,MAAO,yBAAyBD,CAAG,cAAcD,CAAK,IAC1D,EAEA,YAAwB,CACpB,OAAOf;AAAA;AAAA;AAAA,0BAGW,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,KAcF,oBAMAiE,EAAA,CADNjE,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAnBjC,KAoBF,uBAGSiE,EAAA,CADfjE,EAAS,CAAE,QAAS,EAAK,CAAC,GAtBlB,KAuBO,mBAGTiE,EAAA,CADNjE,EAAS,CAAE,QAAS,EAAK,CAAC,GAzBlB,KA0BF,yBAIAiE,EAAA,CADNjE,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GA7BjC,KA8BF,0BAGAiE,EAAA,CADNjE,EAAS,GAhCD,KAiCF,qBAGAiE,EAAA,CADNjE,EAAS,CAAE,KAAM,OAAQ,CAAC,GAnClB,KAoCF,gCAMAiE,EAAA,CADNjE,EAAS,CAAE,KAAM,QAAS,QAAS,EAAK,CAAC,GAzCjC,KA0CF,qBAGAiE,EAAA,CADNjE,EAAS,CAAE,UAAW,EAAM,CAAC,GA5CrB,KA6CF,uCAGAiE,EAAA,CADNjE,EAAS,CAAE,UAAW,EAAM,CAAC,GA/CrB,KAgDF,6BAGCiE,EAAA,CADPhE,EAAM,MAAM,GAlDJ,KAmDD,sBAGAgE,EAAA,CADPhE,EAAM,OAAO,GArDL,KAsDD,uBAGRgE,EAAA,CADCjE,EAAS,CAAE,QAAS,EAAK,CAAC,GAxDlB,KAyDT",
|
|
6
6
|
"names": ["css", "html", "SizedMixin", "property", "query", "classMap", "ifDefined", "IntersectionController", "ResizeController", "Focusable", "RovingTabindexController", "tabStyles", "tabSizes", "left", "width", "scale", "top", "height", "index", "direction", "tabs", "container", "nextIndex", "nextTab", "viewportEnd", "prevIndex", "prevTab", "leftmostElement", "elements", "focusInIndex", "el", "focusInElement", "event", "target", "element", "currentChecked", "firstTab", "selectedElement", "tab", "min", "max", "delta", "behavior", "_a", "scrollLeft", "clientWidth", "scrollWidth", "dirLimit", "limitDelta", "canScrollLeft", "canScrollRight", "complete", "tabUpdateCompletes", "selectedTab", "selectionEnd", "selectionStart", "viewportStart", "selectedIndex", "scrollTarget", "changedProperties", "panel", "value", "id", "changes", "selectedChild", "previous", "next", "selected", "__decorateClass"]
|
|
7
7
|
}
|
package/src/TabsOverflow.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
1
12
|
import { CSSResultArray, PropertyValueMap, PropertyValues, SpectrumElement, TemplateResult } from '@spectrum-web-components/base';
|
|
2
13
|
import { ResizeController } from '@lit-labs/observers/resize-controller.js';
|
|
3
14
|
import { Tabs } from './Tabs.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["TabsOverflow.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n PropertyValueMap,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n queryAssignedElements,\n state,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\nimport { ResizeController } from '@lit-labs/observers/resize-controller.js';\nimport { Tabs } from './Tabs.dev.js'\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron100.js';\nimport chevronIconStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport tabSizes from './tabs-sizes.css.js';\nimport styles from './tabs-overflow.css.js';\n\ninterface TabsOverflowState {\n canScrollLeft: boolean;\n canScrollRight: boolean;\n}\n/**\n * @element sp-tabs-overflow\n */\nexport class TabsOverflow extends SizedMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [styles, tabSizes, chevronIconStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public compact = false;\n\n @property({ type: String, attribute: 'label-previous' })\n public labelPrevious = 'Scroll to previous tabs';\n\n @property({ type: String, attribute: 'label-next' })\n public labelNext = 'Scroll to next tabs';\n\n @property({ reflect: true })\n public override dir!: 'ltr' | 'rtl';\n\n @state()\n private overflowState: TabsOverflowState = {\n canScrollLeft: false,\n canScrollRight: false,\n };\n\n @queryAssignedElements({ selector: 'sp-tabs', flatten: true })\n private tabs!: Tabs[];\n\n @query('.tabs-overflow-container')\n private overflowContainer!: HTMLDivElement;\n\n resizeController!: ResizeController;\n\n protected get scrollContent(): Tabs[] {\n return this.tabs;\n }\n\n public constructor() {\n super();\n this.resizeController = new ResizeController(this, {\n target: this,\n callback: (): void => {\n this._updateScrollState();\n },\n });\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n // enable scroll event\n const [tabs] = this.scrollContent;\n if (tabs) {\n tabs.enableTabsScroll = true;\n }\n this.resizeController.observe(this.overflowContainer);\n }\n\n private async _handleSlotChange(): Promise<void> {\n const [tabsElement] = this.scrollContent;\n await tabsElement?.updateComplete;\n this._updateScrollState();\n }\n\n private _updateScrollState(): void {\n const { scrollContent, overflowState } = this;\n\n if (scrollContent) {\n const [tabsElement] = this.scrollContent;\n const { canScrollLeft, canScrollRight } =\n tabsElement?.scrollState || {\n canScrollLeft: false,\n canScrollRight: false,\n };\n\n this.overflowState = {\n ...overflowState,\n canScrollLeft,\n canScrollRight,\n };\n }\n }\n\n private scrollFactor = 0.5;\n private _handleScrollClick(event: MouseEvent): void {\n const currentTarget = event.currentTarget as HTMLElement;\n const [tabsElement] = this.scrollContent;\n\n const dist = tabsElement.clientWidth * this.scrollFactor;\n const left = currentTarget.classList.contains('left-scroll')\n ? -dist\n : dist;\n tabsElement.scrollTabs(left, 'smooth');\n }\n\n protected override updated(\n changedProperties: PropertyValueMap<this>\n ): void {\n super.updated(changedProperties);\n if (changedProperties.has('dir')) {\n this._updateScrollState();\n }\n }\n\n protected override render(): TemplateResult {\n const { canScrollRight, canScrollLeft } = this.overflowState;\n const ariaLabelPrevious = this.labelPrevious;\n const ariaLabelNext = this.labelNext;\n return html`\n <div\n class=${classMap({\n 'tabs-overflow-container': true,\n 'left-shadow': canScrollLeft,\n 'right-shadow': canScrollRight,\n })}\n >\n <sp-action-button\n class=${classMap({\n 'left-scroll': true,\n show: canScrollLeft,\n })}\n aria-label=${ariaLabelPrevious}\n quiet\n dir=\"rtl\"\n tabindex=\"-1\"\n @click=${this._handleScrollClick}\n >\n <sp-icon-chevron100\n slot=\"icon\"\n class=\"spectrum-UIIcon-ChevronLeft300\"\n ></sp-icon-chevron100>\n </sp-action-button>\n <sp-action-button\n class=${classMap({\n 'right-scroll': true,\n show: canScrollRight,\n })}\n aria-label=${ariaLabelNext}\n quiet\n tabindex=\"-1\"\n @click=${this._handleScrollClick}\n >\n <sp-icon-chevron100\n slot=\"icon\"\n class=\"spectrum-UIIcon-ChevronRight300\"\n ></sp-icon-chevron100>\n </sp-action-button>\n <slot\n @slotchange=${this._handleSlotChange}\n @sp-tabs-scroll=${this._updateScrollState}\n ></slot>\n </div>\n `;\n }\n}\n"],
|
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A,EAIzD;AACJ;AAjJW;AAAA,EADN,SAAS,EAAE,MAAM,SAAS,SAAS,KAAK,CAAC;AAAA,GALjC,aAMF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,iBAAiB,CAAC;AAAA,GAR9C,aASF;AAGA;AAAA,EADN,SAAS,EAAE,MAAM,QAAQ,WAAW,aAAa,CAAC;AAAA,GAX1C,aAYF;AAGS;AAAA,EADf,SAAS,EAAE,SAAS,KAAK,CAAC;AAAA,GAdlB,aAeO;AAGR;AAAA,EADP,MAAM;AAAA,GAjBE,aAkBD;AAMA;AAAA,EADP,sBAAsB,EAAE,UAAU,WAAW,SAAS,KAAK,CAAC;AAAA,GAvBpD,aAwBD;AAGA;AAAA,EADP,MAAM,0BAA0B;AAAA,GA1BxB,aA2BD;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/TabsOverflow.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["TabsOverflow.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport {\n CSSResultArray,\n html,\n PropertyValueMap,\n PropertyValues,\n SizedMixin,\n SpectrumElement,\n TemplateResult,\n} from '@spectrum-web-components/base';\nimport {\n property,\n query,\n queryAssignedElements,\n state,\n} from '@spectrum-web-components/base/src/decorators.js';\nimport { classMap } from '@spectrum-web-components/base/src/directives.js';\nimport { ResizeController } from '@lit-labs/observers/resize-controller.js';\nimport { Tabs } from './Tabs.js';\nimport '@spectrum-web-components/action-button/sp-action-button.js';\nimport '@spectrum-web-components/icons-ui/icons/sp-icon-chevron100.js';\nimport chevronIconStyles from '@spectrum-web-components/icon/src/spectrum-icon-chevron.css.js';\nimport tabSizes from './tabs-sizes.css.js';\nimport styles from './tabs-overflow.css.js';\n\ninterface TabsOverflowState {\n canScrollLeft: boolean;\n canScrollRight: boolean;\n}\n/**\n * @element sp-tabs-overflow\n */\nexport class TabsOverflow extends SizedMixin(SpectrumElement) {\n public static override get styles(): CSSResultArray {\n return [styles, tabSizes, chevronIconStyles];\n }\n\n @property({ type: Boolean, reflect: true })\n public compact = false;\n\n @property({ type: String, attribute: 'label-previous' })\n public labelPrevious = 'Scroll to previous tabs';\n\n @property({ type: String, attribute: 'label-next' })\n public labelNext = 'Scroll to next tabs';\n\n @property({ reflect: true })\n public override dir!: 'ltr' | 'rtl';\n\n @state()\n private overflowState: TabsOverflowState = {\n canScrollLeft: false,\n canScrollRight: false,\n };\n\n @queryAssignedElements({ selector: 'sp-tabs', flatten: true })\n private tabs!: Tabs[];\n\n @query('.tabs-overflow-container')\n private overflowContainer!: HTMLDivElement;\n\n resizeController!: ResizeController;\n\n protected get scrollContent(): Tabs[] {\n return this.tabs;\n }\n\n public constructor() {\n super();\n this.resizeController = new ResizeController(this, {\n target: this,\n callback: (): void => {\n this._updateScrollState();\n },\n });\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n // enable scroll event\n const [tabs] = this.scrollContent;\n if (tabs) {\n tabs.enableTabsScroll = true;\n }\n this.resizeController.observe(this.overflowContainer);\n }\n\n private async _handleSlotChange(): Promise<void> {\n const [tabsElement] = this.scrollContent;\n await tabsElement?.updateComplete;\n this._updateScrollState();\n }\n\n private _updateScrollState(): void {\n const { scrollContent, overflowState } = this;\n\n if (scrollContent) {\n const [tabsElement] = this.scrollContent;\n const { canScrollLeft, canScrollRight } =\n tabsElement?.scrollState || {\n canScrollLeft: false,\n canScrollRight: false,\n };\n\n this.overflowState = {\n ...overflowState,\n canScrollLeft,\n canScrollRight,\n };\n }\n }\n\n private scrollFactor = 0.5;\n private _handleScrollClick(event: MouseEvent): void {\n const currentTarget = event.currentTarget as HTMLElement;\n const [tabsElement] = this.scrollContent;\n\n const dist = tabsElement.clientWidth * this.scrollFactor;\n const left = currentTarget.classList.contains('left-scroll')\n ? -dist\n : dist;\n tabsElement.scrollTabs(left, 'smooth');\n }\n\n protected override updated(\n changedProperties: PropertyValueMap<this>\n ): void {\n super.updated(changedProperties);\n if (changedProperties.has('dir')) {\n this._updateScrollState();\n }\n }\n\n protected override render(): TemplateResult {\n const { canScrollRight, canScrollLeft } = this.overflowState;\n const ariaLabelPrevious = this.labelPrevious;\n const ariaLabelNext = this.labelNext;\n return html`\n <div\n class=${classMap({\n 'tabs-overflow-container': true,\n 'left-shadow': canScrollLeft,\n 'right-shadow': canScrollRight,\n })}\n >\n <sp-action-button\n class=${classMap({\n 'left-scroll': true,\n show: canScrollLeft,\n })}\n aria-label=${ariaLabelPrevious}\n quiet\n dir=\"rtl\"\n tabindex=\"-1\"\n @click=${this._handleScrollClick}\n >\n <sp-icon-chevron100\n slot=\"icon\"\n class=\"spectrum-UIIcon-ChevronLeft300\"\n ></sp-icon-chevron100>\n </sp-action-button>\n <sp-action-button\n class=${classMap({\n 'right-scroll': true,\n show: canScrollRight,\n })}\n aria-label=${ariaLabelNext}\n quiet\n tabindex=\"-1\"\n @click=${this._handleScrollClick}\n >\n <sp-icon-chevron100\n slot=\"icon\"\n class=\"spectrum-UIIcon-ChevronRight300\"\n ></sp-icon-chevron100>\n </sp-action-button>\n <slot\n @slotchange=${this._handleSlotChange}\n @sp-tabs-scroll=${this._updateScrollState}\n ></slot>\n </div>\n `;\n }\n}\n"],
|
|
5
5
|
"mappings": "qNAWA,OAEI,QAAAA,EAGA,cAAAC,EACA,mBAAAC,MAEG,gCACP,OACI,YAAAC,EACA,SAAAC,EACA,yBAAAC,EACA,SAAAC,M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,aAkBD,6BAMAoB,EAAA,CADPrB,EAAsB,CAAE,SAAU,UAAW,QAAS,EAAK,CAAC,GAvBpD,aAwBD,oBAGAqB,EAAA,CADPtB,EAAM,0BAA0B,GA1BxB,aA2BD",
|
|
6
6
|
"names": ["html", "SizedMixin", "SpectrumElement", "property", "query", "queryAssignedElements", "state", "classMap", "ResizeController", "chevronIconStyles", "tabSizes", "styles", "changes", "tabs", "tabsElement", "scrollContent", "overflowState", "canScrollLeft", "canScrollRight", "event", "currentTarget", "dist", "left", "changedProperties", "ariaLabelPrevious", "ariaLabelNext", "__decorateClass"]
|
|
7
7
|
}
|
package/src/index.d.ts
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2025 Adobe. All rights reserved.
|
|
3
|
+
* This file is licensed to you under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
* you may not use this file except in compliance with the License. You may obtain a copy
|
|
5
|
+
* of the License at http://www.apache.org/licenses/LICENSE-2.0
|
|
6
|
+
*
|
|
7
|
+
* Unless required by applicable law or agreed to in writing, software distributed under
|
|
8
|
+
* the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
|
|
9
|
+
* OF ANY KIND, either express or implied. See the License for the specific language
|
|
10
|
+
* governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
1
12
|
export * from './Tabs.js';
|
|
2
13
|
export * from './Tab.js';
|
|
3
14
|
export * from './TabPanel.js';
|
package/src/index.dev.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './Tabs.dev.js'\nexport * from './Tab.dev.js'\nexport * from './TabPanel.dev.js'\nexport * from './TabsOverflow.dev.js'\n"],
|
|
5
5
|
"mappings": ";AAYA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
package/src/index.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["index.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\n\nexport * from './Tabs.js';\nexport * from './Tab.js';\nexport * from './TabPanel.js';\nexport * from './TabsOverflow.js';\n"],
|
|
5
5
|
"mappings": "aAYA,WAAc,YACd,WAAc,WACd,WAAc,gBACd,WAAc",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-tab.css.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{box-sizing:border-box;block-size:calc(var(--mod-tabs-item-height,var(--spectrum-tabs-item-height)) - var(--mod-tabs-divider-size,var(--spectrum-tabs-divider-size)));z-index:1;white-space:nowrap;color:var(--highcontrast-tabs-color,var(--mod-tabs-color,var(--spectrum-tabs-color)));transition:color var(--mod-tabs-animation-duration,var(--spectrum-tabs-animation-duration))ease-out;cursor:pointer;outline:none;-webkit-text-decoration:none;text-decoration:none;position:relative}::slotted([slot=icon]){block-size:var(--mod-tabs-icon-size,var(--spectrum-tabs-icon-size));inline-size:var(--mod-tabs-icon-size,var(--spectrum-tabs-icon-size));margin-block-start:var(--mod-tabs-top-to-icon,var(--spectrum-tabs-top-to-icon))}[name=icon]+#item-label{margin-inline-start:var(--mod-tabs-icon-to-text,var(--spectrum-tabs-icon-to-text))}:host:before{content:\"\";box-sizing:border-box;block-size:calc(100% - var(--mod-tabs-top-to-text,var(--spectrum-tabs-top-to-text)));inline-size:calc(100% + var(--mod-tabs-focus-indicator-gap,var(--spectrum-tabs-focus-indicator-gap))*2);border:var(--mod-tabs-focus-indicator-width,var(--spectrum-tabs-focus-indicator-width))solid transparent;border-radius:var(--mod-tabs-focus-indicator-border-radius,var(--spectrum-tabs-focus-indicator-border-radius));pointer-events:none;position:absolute;inset-block-start:calc(var(--mod-tabs-top-to-text,var(--spectrum-tabs-top-to-text))/2);inset-inline-start:calc(var(--mod-tabs-focus-indicator-gap,var(--spectrum-tabs-focus-indicator-gap))*-1);inset-inline-end:calc(var(--mod-tabs-focus-indicator-gap,var(--spectrum-tabs-focus-indicator-gap))*-1)}@media (hover:hover){:host(:hover){color:var(--highcontrast-tabs-color-hover,var(--mod-tabs-color-hover,var(--spectrum-tabs-color-hover)))}}:host([selected]){color:var(--highcontrast-tabs-color-selected,var(--mod-tabs-color-selected,var(--spectrum-tabs-color-selected)))}:host([disabled]){cursor:default;color:var(--highcontrast-tabs-color-disabled,var(--mod-tabs-color-disabled,var(--spectrum-tabs-color-disabled)))}:host([disabled]) #item-label{cursor:default}:host(:focus-visible){color:var(--highcontrast-tabs-color-key-focus,var(--mod-tabs-color-key-focus,var(--spectrum-tabs-color-key-focus)))}:host(:focus-visible):before{border-color:var(--highcontrast-tabs-focus-indicator-color,var(--mod-tabs-focus-indicator-color,var(--spectrum-tabs-focus-indicator-color)))}#item-label{cursor:pointer;vertical-align:top;font-family:var(--mod-tabs-font-family,var(--spectrum-tabs-font-family));font-style:var(--mod-tabs-font-style,var(--spectrum-tabs-font-style));font-size:var(--mod-tabs-font-size,var(--spectrum-tabs-font-size));font-weight:var(--mod-tabs-font-weight,var(--spectrum-tabs-font-weight));line-height:var(--mod-tabs-line-height,var(--spectrum-tabs-line-height));margin-block-start:var(--mod-tabs-top-to-text,var(--spectrum-tabs-top-to-text));margin-block-end:var(--mod-tabs-bottom-to-text,var(--spectrum-tabs-bottom-to-text));-webkit-text-decoration:none;text-decoration:none;display:inline-block}#item-label:empty{display:none}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-tab.css.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host{box-sizing:border-box;block-size:calc(var(--mod-tabs-item-height,var(--spectrum-tabs-item-height)) - var(--mod-tabs-divider-size,var(--spectrum-tabs-divider-size)));z-index:1;white-space:nowrap;color:var(--highcontrast-tabs-color,var(--mod-tabs-color,var(--spectrum-tabs-color)));transition:color var(--mod-tabs-animation-duration,var(--spectrum-tabs-animation-duration))ease-out;cursor:pointer;outline:none;-webkit-text-decoration:none;text-decoration:none;position:relative}::slotted([slot=icon]){block-size:var(--mod-tabs-icon-size,var(--spectrum-tabs-icon-size));inline-size:var(--mod-tabs-icon-size,var(--spectrum-tabs-icon-size));margin-block-start:var(--mod-tabs-top-to-icon,var(--spectrum-tabs-top-to-icon))}[name=icon]+#item-label{margin-inline-start:var(--mod-tabs-icon-to-text,var(--spectrum-tabs-icon-to-text))}:host:before{content:\"\";box-sizing:border-box;block-size:calc(100% - var(--mod-tabs-top-to-text,var(--spectrum-tabs-top-to-text)));inline-size:calc(100% + var(--mod-tabs-focus-indicator-gap,var(--spectrum-tabs-focus-indicator-gap))*2);border:var(--mod-tabs-focus-indicator-width,var(--spectrum-tabs-focus-indicator-width))solid transparent;border-radius:var(--mod-tabs-focus-indicator-border-radius,var(--spectrum-tabs-focus-indicator-border-radius));pointer-events:none;position:absolute;inset-block-start:calc(var(--mod-tabs-top-to-text,var(--spectrum-tabs-top-to-text))/2);inset-inline-start:calc(var(--mod-tabs-focus-indicator-gap,var(--spectrum-tabs-focus-indicator-gap))*-1);inset-inline-end:calc(var(--mod-tabs-focus-indicator-gap,var(--spectrum-tabs-focus-indicator-gap))*-1)}@media (hover:hover){:host(:hover){color:var(--highcontrast-tabs-color-hover,var(--mod-tabs-color-hover,var(--spectrum-tabs-color-hover)))}}:host([selected]){color:var(--highcontrast-tabs-color-selected,var(--mod-tabs-color-selected,var(--spectrum-tabs-color-selected)))}:host([disabled]){cursor:default;color:var(--highcontrast-tabs-color-disabled,var(--mod-tabs-color-disabled,var(--spectrum-tabs-color-disabled)))}:host([disabled]) #item-label{cursor:default}:host(:focus-visible){color:var(--highcontrast-tabs-color-key-focus,var(--mod-tabs-color-key-focus,var(--spectrum-tabs-color-key-focus)))}:host(:focus-visible):before{border-color:var(--highcontrast-tabs-focus-indicator-color,var(--mod-tabs-focus-indicator-color,var(--spectrum-tabs-focus-indicator-color)))}#item-label{cursor:pointer;vertical-align:top;font-family:var(--mod-tabs-font-family,var(--spectrum-tabs-font-family));font-style:var(--mod-tabs-font-style,var(--spectrum-tabs-font-style));font-size:var(--mod-tabs-font-size,var(--spectrum-tabs-font-size));font-weight:var(--mod-tabs-font-weight,var(--spectrum-tabs-font-weight));line-height:var(--mod-tabs-line-height,var(--spectrum-tabs-line-height));margin-block-start:var(--mod-tabs-top-to-text,var(--spectrum-tabs-top-to-text));margin-block-end:var(--mod-tabs-bottom-to-text,var(--spectrum-tabs-bottom-to-text));-webkit-text-decoration:none;text-decoration:none;display:inline-block}#item-label:empty{display:none}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-tabs-sizes.css.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host([size=s]) #list{--spectrum-tabs-item-height:var(--spectrum-tab-item-height-small);--spectrum-tabs-item-horizontal-spacing:var(--spectrum-tab-item-to-tab-item-horizontal-small);--spectrum-tabs-item-vertical-spacing:var(--spectrum-tab-item-to-tab-item-vertical-small);--spectrum-tabs-start-to-edge:var(--spectrum-tab-item-start-to-edge-small);--spectrum-tabs-top-to-text:var(--spectrum-tab-item-top-to-text-small);--spectrum-tabs-bottom-to-text:var(--spectrum-tab-item-bottom-to-text-small);--spectrum-tabs-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-tabs-icon-to-text:var(--spectrum-text-to-visual-75);--spectrum-tabs-top-to-icon:var(--spectrum-tab-item-top-to-workflow-icon-small);--spectrum-tabs-focus-indicator-gap:var(--spectrum-tab-item-focus-indicator-gap-small);--spectrum-tabs-font-size:var(--spectrum-font-size-75)}:host([size=l]) #list{--spectrum-tabs-item-height:var(--spectrum-tab-item-height-large);--spectrum-tabs-item-horizontal-spacing:var(--spectrum-tab-item-to-tab-item-horizontal-large);--spectrum-tabs-item-vertical-spacing:var(--spectrum-tab-item-to-tab-item-vertical-large);--spectrum-tabs-start-to-edge:var(--spectrum-tab-item-start-to-edge-large);--spectrum-tabs-top-to-text:var(--spectrum-tab-item-top-to-text-large);--spectrum-tabs-bottom-to-text:var(--spectrum-tab-item-bottom-to-text-large);--spectrum-tabs-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-tabs-icon-to-text:var(--spectrum-text-to-visual-200);--spectrum-tabs-top-to-icon:var(--spectrum-tab-item-top-to-workflow-icon-large);--spectrum-tabs-focus-indicator-gap:var(--spectrum-tab-item-focus-indicator-gap-large);--spectrum-tabs-font-size:var(--spectrum-font-size-200)}:host([size=xl]) #list{--spectrum-tabs-item-height:var(--spectrum-tab-item-height-extra-large);--spectrum-tabs-item-horizontal-spacing:var(--spectrum-tab-item-to-tab-item-horizontal-extra-large);--spectrum-tabs-item-vertical-spacing:var(--spectrum-tab-item-to-tab-item-vertical-extra-large);--spectrum-tabs-start-to-edge:var(--spectrum-tab-item-start-to-edge-extra-large);--spectrum-tabs-top-to-text:var(--spectrum-tab-item-top-to-text-extra-large);--spectrum-tabs-bottom-to-text:var(--spectrum-tab-item-bottom-to-text-extra-large);--spectrum-tabs-icon-size:var(--spectrum-workflow-icon-size-200);--spectrum-tabs-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-tabs-top-to-icon:var(--spectrum-tab-item-top-to-workflow-icon-extra-large);--spectrum-tabs-focus-indicator-gap:var(--spectrum-tab-item-focus-indicator-gap-extra-large);--spectrum-tabs-font-size:var(--spectrum-font-size-300)}:host([size=s]) #list.spectrum-Tabs--compact{--mod-tabs-item-height:var(--mod-tabs-item-height-compact,var(--spectrum-tab-item-compact-height-small));--mod-tabs-top-to-text:var(--mod-tabs-top-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-small));--mod-tabs-bottom-to-text:var(--mod-tabs-bottom-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-small));--mod-tabs-top-to-icon:var(--mod-tabs-top-to-icon-compact,var(--spectrum-tab-item-top-to-workflow-icon-compact-small))}:host([size=l]) #list.spectrum-Tabs--compact{--mod-tabs-item-height:var(--mod-tabs-item-height-compact,var(--spectrum-tab-item-compact-height-large));--mod-tabs-top-to-text:var(--mod-tabs-top-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-large));--mod-tabs-bottom-to-text:var(--mod-tabs-bottom-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-large));--mod-tabs-top-to-icon:var(--mod-tabs-top-to-icon-compact,var(--spectrum-tab-item-top-to-workflow-icon-compact-large))}:host([size=xl]) #list.spectrum-Tabs--compact{--mod-tabs-item-height:var(--mod-tabs-item-height-compact,var(--spectrum-tab-item-compact-height-extra-large));--mod-tabs-top-to-text:var(--mod-tabs-top-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-extra-large));--mod-tabs-bottom-to-text:var(--mod-tabs-bottom-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-extra-large));--mod-tabs-top-to-icon:var(--mod-tabs-top-to-icon-compact,var(--spectrum-tab-item-top-to-workflow-icon-compact-extra-large))}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-tabs-sizes.css.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n :host([size=s]) #list{--spectrum-tabs-item-height:var(--spectrum-tab-item-height-small);--spectrum-tabs-item-horizontal-spacing:var(--spectrum-tab-item-to-tab-item-horizontal-small);--spectrum-tabs-item-vertical-spacing:var(--spectrum-tab-item-to-tab-item-vertical-small);--spectrum-tabs-start-to-edge:var(--spectrum-tab-item-start-to-edge-small);--spectrum-tabs-top-to-text:var(--spectrum-tab-item-top-to-text-small);--spectrum-tabs-bottom-to-text:var(--spectrum-tab-item-bottom-to-text-small);--spectrum-tabs-icon-size:var(--spectrum-workflow-icon-size-50);--spectrum-tabs-icon-to-text:var(--spectrum-text-to-visual-75);--spectrum-tabs-top-to-icon:var(--spectrum-tab-item-top-to-workflow-icon-small);--spectrum-tabs-focus-indicator-gap:var(--spectrum-tab-item-focus-indicator-gap-small);--spectrum-tabs-font-size:var(--spectrum-font-size-75)}:host([size=l]) #list{--spectrum-tabs-item-height:var(--spectrum-tab-item-height-large);--spectrum-tabs-item-horizontal-spacing:var(--spectrum-tab-item-to-tab-item-horizontal-large);--spectrum-tabs-item-vertical-spacing:var(--spectrum-tab-item-to-tab-item-vertical-large);--spectrum-tabs-start-to-edge:var(--spectrum-tab-item-start-to-edge-large);--spectrum-tabs-top-to-text:var(--spectrum-tab-item-top-to-text-large);--spectrum-tabs-bottom-to-text:var(--spectrum-tab-item-bottom-to-text-large);--spectrum-tabs-icon-size:var(--spectrum-workflow-icon-size-100);--spectrum-tabs-icon-to-text:var(--spectrum-text-to-visual-200);--spectrum-tabs-top-to-icon:var(--spectrum-tab-item-top-to-workflow-icon-large);--spectrum-tabs-focus-indicator-gap:var(--spectrum-tab-item-focus-indicator-gap-large);--spectrum-tabs-font-size:var(--spectrum-font-size-200)}:host([size=xl]) #list{--spectrum-tabs-item-height:var(--spectrum-tab-item-height-extra-large);--spectrum-tabs-item-horizontal-spacing:var(--spectrum-tab-item-to-tab-item-horizontal-extra-large);--spectrum-tabs-item-vertical-spacing:var(--spectrum-tab-item-to-tab-item-vertical-extra-large);--spectrum-tabs-start-to-edge:var(--spectrum-tab-item-start-to-edge-extra-large);--spectrum-tabs-top-to-text:var(--spectrum-tab-item-top-to-text-extra-large);--spectrum-tabs-bottom-to-text:var(--spectrum-tab-item-bottom-to-text-extra-large);--spectrum-tabs-icon-size:var(--spectrum-workflow-icon-size-200);--spectrum-tabs-icon-to-text:var(--spectrum-text-to-visual-300);--spectrum-tabs-top-to-icon:var(--spectrum-tab-item-top-to-workflow-icon-extra-large);--spectrum-tabs-focus-indicator-gap:var(--spectrum-tab-item-focus-indicator-gap-extra-large);--spectrum-tabs-font-size:var(--spectrum-font-size-300)}:host([size=s]) #list.spectrum-Tabs--compact{--mod-tabs-item-height:var(--mod-tabs-item-height-compact,var(--spectrum-tab-item-compact-height-small));--mod-tabs-top-to-text:var(--mod-tabs-top-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-small));--mod-tabs-bottom-to-text:var(--mod-tabs-bottom-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-small));--mod-tabs-top-to-icon:var(--mod-tabs-top-to-icon-compact,var(--spectrum-tab-item-top-to-workflow-icon-compact-small))}:host([size=l]) #list.spectrum-Tabs--compact{--mod-tabs-item-height:var(--mod-tabs-item-height-compact,var(--spectrum-tab-item-compact-height-large));--mod-tabs-top-to-text:var(--mod-tabs-top-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-large));--mod-tabs-bottom-to-text:var(--mod-tabs-bottom-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-large));--mod-tabs-top-to-icon:var(--mod-tabs-top-to-icon-compact,var(--spectrum-tab-item-top-to-workflow-icon-compact-large))}:host([size=xl]) #list.spectrum-Tabs--compact{--mod-tabs-item-height:var(--mod-tabs-item-height-compact,var(--spectrum-tab-item-compact-height-extra-large));--mod-tabs-top-to-text:var(--mod-tabs-top-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-extra-large));--mod-tabs-bottom-to-text:var(--mod-tabs-bottom-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-extra-large));--mod-tabs-top-to-icon:var(--mod-tabs-top-to-icon-compact,var(--spectrum-tab-item-top-to-workflow-icon-compact-extra-large))}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": "aAWA,OAAS,OAAAA,MAAW,gCACpB,MAAMC,EAASD;AAAA;AAAA,EAGf,eAAeC",
|
|
6
6
|
"names": ["css", "styles"]
|
|
7
7
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["spectrum-tabs.css.ts"],
|
|
4
|
-
"sourcesContent": ["
|
|
4
|
+
"sourcesContent": ["/**\n * Copyright 2025 Adobe. All rights reserved.\n * This file is licensed to you under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License. You may obtain a copy\n * of the License at http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under\n * the License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS\n * OF ANY KIND, either express or implied. See the License for the specific language\n * governing permissions and limitations under the License.\n */\nimport { css } from '@spectrum-web-components/base';\nconst styles = css`\n #list{--spectrum-tabs-item-height:var(--spectrum-tab-item-height-medium);--spectrum-tabs-item-horizontal-spacing:var(--spectrum-tab-item-to-tab-item-horizontal-medium);--spectrum-tabs-item-vertical-spacing:var(--spectrum-tab-item-to-tab-item-vertical-medium);--spectrum-tabs-start-to-edge:var(--spectrum-tab-item-start-to-edge-medium);--spectrum-tabs-top-to-text:var(--spectrum-tab-item-top-to-text-medium);--spectrum-tabs-bottom-to-text:var(--spectrum-tab-item-bottom-to-text-medium);--spectrum-tabs-icon-size:var(--spectrum-workflow-icon-size-75);--spectrum-tabs-icon-to-text:var(--spectrum-text-to-visual-100);--spectrum-tabs-top-to-icon:var(--spectrum-tab-item-top-to-workflow-icon-medium);--spectrum-tabs-color:var(--spectrum-neutral-subdued-content-color-default);--spectrum-tabs-color-selected:var(--spectrum-neutral-subdued-content-color-down);--spectrum-tabs-color-hover:var(--spectrum-neutral-subdued-content-color-hover);--spectrum-tabs-color-key-focus:var(--spectrum-neutral-subdued-content-color-key-focus);--spectrum-tabs-color-disabled:var(--spectrum-gray-500);--spectrum-tabs-font-family:var(--spectrum-sans-font-family-stack);--spectrum-tabs-font-style:var(--spectrum-default-font-style);--spectrum-tabs-font-size:var(--spectrum-font-size-100);--spectrum-tabs-line-height:var(--spectrum-line-height-100);--spectrum-tabs-focus-indicator-width:var(--spectrum-focus-indicator-thickness);--spectrum-tabs-focus-indicator-border-radius:var(--spectrum-corner-radius-100);--spectrum-tabs-focus-indicator-gap:var(--spectrum-tab-item-focus-indicator-gap-medium);--spectrum-tabs-focus-indicator-color:var(--spectrum-focus-indicator-color);--spectrum-tabs-selection-indicator-color:var(--spectrum-neutral-subdued-content-color-down);--spectrum-tabs-list-background-direction:top;--spectrum-tabs-divider-size:var(--spectrum-border-width-200);--spectrum-tabs-divider-border-radius:1px;--spectrum-tabs-animation-duration:var(--spectrum-animation-duration-100);--spectrum-tabs-animation-ease:var(--spectrum-animation-ease-in-out)}:host([emphasized]) #list{--mod-tabs-color-selected:var(--mod-tabs-color-selected-emphasized,var(--spectrum-accent-content-color-default));--mod-tabs-color-hover:var(--mod-tabs-color-hover-emphasized,var(--spectrum-accent-content-color-hover));--mod-tabs-color-key-focus:var(--mod-tabs-color-key-focus-emphasized,var(--spectrum-accent-content-color-key-focus));--mod-tabs-selection-indicator-color:var(--mod-tabs-selection-indicator-color-emphasized,var(--spectrum-accent-content-color-default))}:host([direction^=vertical]) #list{--mod-tabs-list-background-direction:var(--mod-tabs-list-background-direction-vertical,right)}:host([direction^=vertical-right]) #list{--mod-tabs-list-background-direction:var(--mod-tabs-list-background-direction-vertical-right,left)}:host([direction^=vertical]) #list:dir(rtl),:host([dir=rtl][direction^=vertical]) #list{--mod-tabs-list-background-direction:var(--mod-tabs-list-background-direction-vertical,left)}:host([direction^=vertical-right]) #list:dir(rtl),:host([dir=rtl][direction^=vertical-right]) #list{--mod-tabs-list-background-direction:var(--mod-tabs-list-background-direction-vertical,right)}:host([compact]) #list{--mod-tabs-item-height:var(--mod-tabs-item-height-compact,var(--spectrum-tab-item-compact-height-medium));--mod-tabs-top-to-text:var(--mod-tabs-top-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-medium));--mod-tabs-bottom-to-text:var(--mod-tabs-bottom-to-text-compact,var(--spectrum-tab-item-top-to-text-compact-medium));--mod-tabs-top-to-icon:var(--mod-tabs-top-to-icon-compact,var(--spectrum-tab-item-top-to-workflow-icon-compact-medium))}#list{z-index:0;vertical-align:top;background:linear-gradient(to var(--mod-tabs-list-background-direction,var(--spectrum-tabs-list-background-direction)),var(--highcontrast-tabs-divider-background-color,var(--mod-tabs-divider-background-color,var(--spectrum-tabs-divider-background-color)))0 var(--mod-tabs-divider-size,var(--spectrum-tabs-divider-size)),transparent var(--mod-tabs-divider-size,var(--spectrum-tabs-divider-size)));margin:0;padding-block:0;display:flex;position:relative}::slotted([selected]:not([slot])){color:var(--highcontrast-tabs-color-selected,var(--mod-tabs-color-selected,var(--spectrum-tabs-color-selected)))}::slotted([disabled]:not([slot])){cursor:default;color:var(--highcontrast-tabs-color-disabled,var(--mod-tabs-color-disabled,var(--spectrum-tabs-color-disabled)))}#selection-indicator{background-color:var(--highcontrast-tabs-selection-indicator-color,var(--mod-tabs-selection-indicator-color,var(--spectrum-tabs-selection-indicator-color)));z-index:0;transition:transform var(--mod-tabs-animation-duration,var(--spectrum-tabs-animation-duration))var(--mod-tabs-animation-ease,var(--spectrum-tabs-animation-ease));transform-origin:0 0;border-radius:var(--mod-tabs-divider-border-radius,var(--spectrum-tabs-divider-border-radius));position:absolute;inset-inline-start:0}:host([direction^=horizontal]) #list{align-items:center}:host([direction^=horizontal]) #list ::slotted(:not([slot])){vertical-align:top}:host([direction^=horizontal]) ::slotted(:not(:first-child)){margin-inline-start:var(--mod-tabs-item-horizontal-spacing,var(--spectrum-tabs-item-horizontal-spacing))}:host([direction^=horizontal]) #list #selection-indicator{block-size:var(--mod-tabs-divider-size,var(--spectrum-tabs-divider-size));position:absolute;inset-block-end:0}:host([direction^=horizontal][compact]) #list{box-sizing:initial;align-items:end}:host([quiet]) #list{background:0 0;border-color:#0000;display:inline-flex}:host([quiet]) #selection-indicator{padding-inline-start:var(--mod-tabs-start-to-item-quiet)}:host([direction^=vertical]) #list,:host([direction^=vertical-right]) #list{flex-direction:column;padding:0;display:inline-flex}:host([direction^=vertical-right][quiet]) #list,:host([direction^=vertical][quiet]) #list{border-color:#0000}:host([direction^=vertical]) #list ::slotted(:not([slot])),:host([direction^=vertical-right]) #list ::slotted(:not([slot])){block-size:var(--mod-tabs-item-height,var(--spectrum-tabs-item-height));line-height:var(--mod-tabs-item-height,var(--spectrum-tabs-item-height));margin-block-end:var(--mod-tabs-item-vertical-spacing,var(--spectrum-tabs-item-vertical-spacing));margin-inline-start:var(--mod-tabs-start-to-edge,var(--spectrum-tabs-start-to-edge));margin-inline-end:var(--mod-tabs-start-to-edge,var(--spectrum-tabs-start-to-edge));padding-block:0}:host([direction^=vertical]) #list ::slotted(:not([slot])):before,:host([direction^=vertical-right]) #list ::slotted(:not([slot])):before{inset-inline-start:calc(var(--mod-tabs-focus-indicator-gap,var(--spectrum-tabs-focus-indicator-gap))*-1)}:host([direction^=vertical]) #list #selection-indicator,:host([direction^=vertical-right]) #list #selection-indicator{inline-size:var(--mod-tabs-divider-size,var(--spectrum-tabs-divider-size));position:absolute;inset-block-start:0;inset-inline-start:0}:host([direction^=vertical-right]) #list #selection-indicator{inset-inline:auto 0}@media (forced-colors:active){#list{--highcontrast-tabs-divider-background-color:var(--spectrum-gray-500);--highcontrast-tabs-selection-indicator-color:Highlight;--highcontrast-tabs-focus-indicator-color:CanvasText;--highcontrast-tabs-focus-indicator-background-color:Highlight;--highcontrast-tabs-color:ButtonText;--highcontrast-tabs-color-hover:ButtonText;--highcontrast-tabs-color-selected:HighlightText;--highcontrast-tabs-color-key-focus:ButtonText;--highcontrast-tabs-color-disabled:GrayText;forced-color-adjust:none}#list ::slotted([selected]:not([slot])):before{background-color:var(--highcontrast-tabs-focus-indicator-background-color)}:host([direction^=vertical][compact]) #list #list ::slotted(:not([slot])):before{block-size:100%;inset-block-start:0}:host([quiet]) #list{background:linear-gradient(to var(--mod-tabs-list-background-direction,var(--spectrum-tabs-list-background-direction)),var(--highcontrast-tabs-divider-background-color,var(--mod-tabs-divider-background-color,var(--spectrum-tabs-divider-background-color)))0 var(--mod-tabs-divider-size,var(--spectrum-tabs-divider-size)),transparent var(--mod-tabs-divider-size,var(--spectrum-tabs-divider-size)))}}\n`;\nexport default styles;"],
|
|
5
5
|
"mappings": ";AAWA,SAAS,WAAW;AACpB,MAAM,SAAS;AAAA;AAAA;AAGf,eAAe;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|