@adobe/spectrum-wc-core 0.0.0-snapshot.20260922095923
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 +39 -0
- package/dist/_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js +9 -0
- package/dist/components/accordion/Accordion.base.d.ts +59 -0
- package/dist/components/accordion/Accordion.base.js +69 -0
- package/dist/components/accordion/Accordion.base.js.map +1 -0
- package/dist/components/accordion/Accordion.types.d.ts +22 -0
- package/dist/components/accordion/Accordion.types.js +21 -0
- package/dist/components/accordion/Accordion.types.js.map +1 -0
- package/dist/components/accordion/AccordionItem.base.d.ts +96 -0
- package/dist/components/accordion/AccordionItem.base.js +93 -0
- package/dist/components/accordion/AccordionItem.base.js.map +1 -0
- package/dist/components/accordion/index.d.ts +14 -0
- package/dist/components/accordion/index.js +4 -0
- package/dist/components/action-button/ActionButton.types.d.ts +15 -0
- package/dist/components/action-button/ActionButton.types.js +12 -0
- package/dist/components/action-button/ActionButton.types.js.map +1 -0
- package/dist/components/action-button/index.d.ts +12 -0
- package/dist/components/action-button/index.js +2 -0
- package/dist/components/action-group/ActionGroup.base.d.ts +108 -0
- package/dist/components/action-group/ActionGroup.base.js +53 -0
- package/dist/components/action-group/ActionGroup.base.js.map +1 -0
- package/dist/components/action-group/ActionGroup.types.d.ts +17 -0
- package/dist/components/action-group/ActionGroup.types.js +12 -0
- package/dist/components/action-group/ActionGroup.types.js.map +1 -0
- package/dist/components/action-group/index.d.ts +13 -0
- package/dist/components/action-group/index.js +3 -0
- package/dist/components/alert-banner/AlertBanner.base.d.ts +36 -0
- package/dist/components/alert-banner/AlertBanner.base.js +57 -0
- package/dist/components/alert-banner/AlertBanner.base.js.map +1 -0
- package/dist/components/alert-banner/AlertBanner.types.d.ts +13 -0
- package/dist/components/alert-banner/AlertBanner.types.js +10 -0
- package/dist/components/alert-banner/AlertBanner.types.js.map +1 -0
- package/dist/components/alert-banner/index.d.ts +13 -0
- package/dist/components/alert-banner/index.js +3 -0
- package/dist/components/asset/Asset.base.d.ts +101 -0
- package/dist/components/asset/Asset.base.js +130 -0
- package/dist/components/asset/Asset.base.js.map +1 -0
- package/dist/components/asset/Asset.types.d.ts +31 -0
- package/dist/components/asset/Asset.types.js +14 -0
- package/dist/components/asset/Asset.types.js.map +1 -0
- package/dist/components/asset/index.d.ts +13 -0
- package/dist/components/asset/index.js +3 -0
- package/dist/components/avatar/Avatar.base.d.ts +53 -0
- package/dist/components/avatar/Avatar.base.js +52 -0
- package/dist/components/avatar/Avatar.base.js.map +1 -0
- package/dist/components/avatar/Avatar.types.d.ts +19 -0
- package/dist/components/avatar/Avatar.types.js +24 -0
- package/dist/components/avatar/Avatar.types.js.map +1 -0
- package/dist/components/avatar/index.d.ts +13 -0
- package/dist/components/avatar/index.js +3 -0
- package/dist/components/badge/Badge.base.d.ts +114 -0
- package/dist/components/badge/Badge.base.js +49 -0
- package/dist/components/badge/Badge.base.js.map +1 -0
- package/dist/components/badge/Badge.types.d.ts +21 -0
- package/dist/components/badge/Badge.types.js +43 -0
- package/dist/components/badge/Badge.types.js.map +1 -0
- package/dist/components/badge/index.d.ts +13 -0
- package/dist/components/badge/index.js +3 -0
- package/dist/components/button/Button.base.d.ts +78 -0
- package/dist/components/button/Button.base.js +51 -0
- package/dist/components/button/Button.base.js.map +1 -0
- package/dist/components/button/Button.types.d.ts +19 -0
- package/dist/components/button/Button.types.js +16 -0
- package/dist/components/button/Button.types.js.map +1 -0
- package/dist/components/button/index.d.ts +13 -0
- package/dist/components/button/index.js +3 -0
- package/dist/components/button-group/ButtonGroup.base.d.ts +89 -0
- package/dist/components/button-group/ButtonGroup.base.js +60 -0
- package/dist/components/button-group/ButtonGroup.base.js.map +1 -0
- package/dist/components/button-group/ButtonGroup.types.d.ts +17 -0
- package/dist/components/button-group/ButtonGroup.types.js +15 -0
- package/dist/components/button-group/ButtonGroup.types.js.map +1 -0
- package/dist/components/button-group/index.d.ts +13 -0
- package/dist/components/button-group/index.js +3 -0
- package/dist/components/card/Card.base.d.ts +172 -0
- package/dist/components/card/Card.base.js +123 -0
- package/dist/components/card/Card.base.js.map +1 -0
- package/dist/components/card/Card.types.d.ts +18 -0
- package/dist/components/card/Card.types.js +21 -0
- package/dist/components/card/Card.types.js.map +1 -0
- package/dist/components/card/index.d.ts +13 -0
- package/dist/components/card/index.js +3 -0
- package/dist/components/color-handle/ColorHandle.base.d.ts +51 -0
- package/dist/components/color-handle/ColorHandle.base.js +39 -0
- package/dist/components/color-handle/ColorHandle.base.js.map +1 -0
- package/dist/components/color-handle/ColorHandle.types.d.ts +30 -0
- package/dist/components/color-handle/color-contrast.d.ts +55 -0
- package/dist/components/color-handle/color-contrast.js +49 -0
- package/dist/components/color-handle/color-contrast.js.map +1 -0
- package/dist/components/color-handle/index.d.ts +14 -0
- package/dist/components/color-handle/index.js +3 -0
- package/dist/components/color-loupe/ColorLoupe.base.d.ts +41 -0
- package/dist/components/color-loupe/ColorLoupe.base.js +21 -0
- package/dist/components/color-loupe/ColorLoupe.base.js.map +1 -0
- package/dist/components/color-loupe/index.d.ts +12 -0
- package/dist/components/color-loupe/index.js +2 -0
- package/dist/components/divider/Divider.base.d.ts +43 -0
- package/dist/components/divider/Divider.base.js +42 -0
- package/dist/components/divider/Divider.base.js.map +1 -0
- package/dist/components/divider/Divider.types.d.ts +15 -0
- package/dist/components/divider/Divider.types.js +10 -0
- package/dist/components/divider/Divider.types.js.map +1 -0
- package/dist/components/divider/index.d.ts +13 -0
- package/dist/components/divider/index.js +3 -0
- package/dist/components/dropzone/Dropzone.base.d.ts +74 -0
- package/dist/components/dropzone/Dropzone.base.js +82 -0
- package/dist/components/dropzone/Dropzone.base.js.map +1 -0
- package/dist/components/dropzone/Dropzone.types.d.ts +43 -0
- package/dist/components/dropzone/Dropzone.types.js +15 -0
- package/dist/components/dropzone/Dropzone.types.js.map +1 -0
- package/dist/components/dropzone/index.d.ts +13 -0
- package/dist/components/dropzone/index.js +3 -0
- package/dist/components/icon/Icon.base.d.ts +36 -0
- package/dist/components/icon/Icon.base.js +28 -0
- package/dist/components/icon/Icon.base.js.map +1 -0
- package/dist/components/icon/Icon.types.d.ts +13 -0
- package/dist/components/icon/Icon.types.js +12 -0
- package/dist/components/icon/Icon.types.js.map +1 -0
- package/dist/components/icon/index.d.ts +13 -0
- package/dist/components/icon/index.js +3 -0
- package/dist/components/illustrated-message/IllustratedMessage.base.d.ts +60 -0
- package/dist/components/illustrated-message/IllustratedMessage.base.js +59 -0
- package/dist/components/illustrated-message/IllustratedMessage.base.js.map +1 -0
- package/dist/components/illustrated-message/IllustratedMessage.types.d.ts +15 -0
- package/dist/components/illustrated-message/IllustratedMessage.types.js +10 -0
- package/dist/components/illustrated-message/IllustratedMessage.types.js.map +1 -0
- package/dist/components/illustrated-message/index.d.ts +13 -0
- package/dist/components/illustrated-message/index.js +3 -0
- package/dist/components/infield-button/InfieldButton.base.d.ts +28 -0
- package/dist/components/infield-button/InfieldButton.base.js +22 -0
- package/dist/components/infield-button/InfieldButton.base.js.map +1 -0
- package/dist/components/infield-button/InfieldButton.types.d.ts +13 -0
- package/dist/components/infield-button/InfieldButton.types.js +11 -0
- package/dist/components/infield-button/InfieldButton.types.js.map +1 -0
- package/dist/components/infield-button/index.d.ts +13 -0
- package/dist/components/infield-button/index.js +3 -0
- package/dist/components/meter/Meter.base.d.ts +40 -0
- package/dist/components/meter/Meter.base.js +32 -0
- package/dist/components/meter/Meter.base.js.map +1 -0
- package/dist/components/meter/Meter.types.d.ts +13 -0
- package/dist/components/meter/Meter.types.js +11 -0
- package/dist/components/meter/Meter.types.js.map +1 -0
- package/dist/components/meter/index.d.ts +13 -0
- package/dist/components/meter/index.js +3 -0
- package/dist/components/popover/Popover.base.d.ts +226 -0
- package/dist/components/popover/Popover.base.js +287 -0
- package/dist/components/popover/Popover.base.js.map +1 -0
- package/dist/components/popover/Popover.types.d.ts +39 -0
- package/dist/components/popover/Popover.types.js +24 -0
- package/dist/components/popover/Popover.types.js.map +1 -0
- package/dist/components/popover/index.d.ts +13 -0
- package/dist/components/popover/index.js +3 -0
- package/dist/components/progress-bar/ProgressBar.base.d.ts +34 -0
- package/dist/components/progress-bar/ProgressBar.base.js +21 -0
- package/dist/components/progress-bar/ProgressBar.base.js.map +1 -0
- package/dist/components/progress-bar/ProgressBar.types.d.ts +12 -0
- package/dist/components/progress-bar/index.d.ts +13 -0
- package/dist/components/progress-bar/index.js +2 -0
- package/dist/components/progress-circle/ProgressCircle.base.d.ts +83 -0
- package/dist/components/progress-circle/ProgressCircle.base.js +77 -0
- package/dist/components/progress-circle/ProgressCircle.base.js.map +1 -0
- package/dist/components/progress-circle/ProgressCircle.types.d.ts +15 -0
- package/dist/components/progress-circle/ProgressCircle.types.js +10 -0
- package/dist/components/progress-circle/ProgressCircle.types.js.map +1 -0
- package/dist/components/progress-circle/index.d.ts +13 -0
- package/dist/components/progress-circle/index.js +3 -0
- package/dist/components/status-light/StatusLight.base.d.ts +69 -0
- package/dist/components/status-light/StatusLight.base.js +32 -0
- package/dist/components/status-light/StatusLight.base.js.map +1 -0
- package/dist/components/status-light/StatusLight.types.d.ts +19 -0
- package/dist/components/status-light/StatusLight.types.js +32 -0
- package/dist/components/status-light/StatusLight.types.js.map +1 -0
- package/dist/components/status-light/index.d.ts +13 -0
- package/dist/components/status-light/index.js +3 -0
- package/dist/components/tabs/Tab.base.d.ts +49 -0
- package/dist/components/tabs/Tab.base.js +39 -0
- package/dist/components/tabs/Tab.base.js.map +1 -0
- package/dist/components/tabs/Tab.types.d.ts +17 -0
- package/dist/components/tabs/TabPanel.base.d.ts +49 -0
- package/dist/components/tabs/TabPanel.base.js +36 -0
- package/dist/components/tabs/TabPanel.base.js.map +1 -0
- package/dist/components/tabs/TabPanel.types.d.ts +17 -0
- package/dist/components/tabs/Tabs.base.d.ts +221 -0
- package/dist/components/tabs/Tabs.base.js +213 -0
- package/dist/components/tabs/Tabs.base.js.map +1 -0
- package/dist/components/tabs/Tabs.types.d.ts +55 -0
- package/dist/components/tabs/Tabs.types.js +6 -0
- package/dist/components/tabs/Tabs.types.js.map +1 -0
- package/dist/components/tabs/index.d.ts +17 -0
- package/dist/components/tabs/index.js +5 -0
- package/dist/components/tooltip/Tooltip.base.d.ts +159 -0
- package/dist/components/tooltip/Tooltip.base.js +198 -0
- package/dist/components/tooltip/Tooltip.base.js.map +1 -0
- package/dist/components/tooltip/Tooltip.types.d.ts +18 -0
- package/dist/components/tooltip/Tooltip.types.js +15 -0
- package/dist/components/tooltip/Tooltip.types.js.map +1 -0
- package/dist/components/tooltip/index.d.ts +13 -0
- package/dist/components/tooltip/index.js +3 -0
- package/dist/controllers/color-controller/index.d.ts +12 -0
- package/dist/controllers/color-controller/index.js +2 -0
- package/dist/controllers/color-controller/src/color-controller.d.ts +226 -0
- package/dist/controllers/color-controller/src/color-controller.js +253 -0
- package/dist/controllers/color-controller/src/color-controller.js.map +1 -0
- package/dist/controllers/drag-and-drop-controller/index.d.ts +12 -0
- package/dist/controllers/drag-and-drop-controller/index.js +2 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.d.ts +68 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js +56 -0
- package/dist/controllers/drag-and-drop-controller/src/drag-and-drop-controller.js.map +1 -0
- package/dist/controllers/focusgroup-navigation-controller/index.d.ts +12 -0
- package/dist/controllers/focusgroup-navigation-controller/index.js +2 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.d.ts +496 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.js +345 -0
- package/dist/controllers/focusgroup-navigation-controller/src/focusgroup-navigation-controller.js.map +1 -0
- package/dist/controllers/hover-controller/index.d.ts +12 -0
- package/dist/controllers/hover-controller/index.js +2 -0
- package/dist/controllers/hover-controller/src/hover-controller.d.ts +118 -0
- package/dist/controllers/hover-controller/src/hover-controller.js +90 -0
- package/dist/controllers/hover-controller/src/hover-controller.js.map +1 -0
- package/dist/controllers/index.d.ts +26 -0
- package/dist/controllers/index.js +18 -0
- package/dist/controllers/language-resolution.d.ts +87 -0
- package/dist/controllers/language-resolution.js +56 -0
- package/dist/controllers/language-resolution.js.map +1 -0
- package/dist/controllers/live-selection-controller/index.d.ts +12 -0
- package/dist/controllers/live-selection-controller/index.js +2 -0
- package/dist/controllers/live-selection-controller/src/live-selection-controller.d.ts +144 -0
- package/dist/controllers/live-selection-controller/src/live-selection-controller.js +36 -0
- package/dist/controllers/live-selection-controller/src/live-selection-controller.js.map +1 -0
- package/dist/controllers/page-scroll-lock-controller/index.d.ts +12 -0
- package/dist/controllers/page-scroll-lock-controller/index.js +2 -0
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.d.ts +20 -0
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.js +30 -0
- package/dist/controllers/page-scroll-lock-controller/src/page-scroll-lock.js.map +1 -0
- package/dist/controllers/pending-controller/index.d.ts +12 -0
- package/dist/controllers/pending-controller/index.js +2 -0
- package/dist/controllers/pending-controller/src/pending-controller.d.ts +95 -0
- package/dist/controllers/pending-controller/src/pending-controller.js +55 -0
- package/dist/controllers/pending-controller/src/pending-controller.js.map +1 -0
- package/dist/controllers/placement-controller/index.d.ts +12 -0
- package/dist/controllers/placement-controller/index.js +4 -0
- package/dist/controllers/placement-controller/src/fallback-placements.d.ts +9 -0
- package/dist/controllers/placement-controller/src/fallback-placements.js +71 -0
- package/dist/controllers/placement-controller/src/fallback-placements.js.map +1 -0
- package/dist/controllers/placement-controller/src/placement-controller.d.ts +152 -0
- package/dist/controllers/placement-controller/src/placement-controller.js +129 -0
- package/dist/controllers/placement-controller/src/placement-controller.js.map +1 -0
- package/dist/controllers/placement-controller/src/placement-conversion.d.ts +35 -0
- package/dist/controllers/placement-controller/src/placement-conversion.js +54 -0
- package/dist/controllers/placement-controller/src/placement-conversion.js.map +1 -0
- package/dist/controllers/placement-controller/src/types.d.ts +128 -0
- package/dist/controllers/placement-controller/src/types.js +29 -0
- package/dist/controllers/placement-controller/src/types.js.map +1 -0
- package/dist/controllers/slot-attribute-propagation-controller/index.d.ts +12 -0
- package/dist/controllers/slot-attribute-propagation-controller/index.js +2 -0
- package/dist/controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.d.ts +65 -0
- package/dist/controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.js +33 -0
- package/dist/controllers/slot-attribute-propagation-controller/src/slot-attribute-propagation-controller.js.map +1 -0
- package/dist/controllers/slot-presence-controller/index.d.ts +12 -0
- package/dist/controllers/slot-presence-controller/index.js +2 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.d.ts +57 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js +44 -0
- package/dist/controllers/slot-presence-controller/src/slot-presence-controller.js.map +1 -0
- package/dist/controllers/slot-text-controller/index.d.ts +12 -0
- package/dist/controllers/slot-text-controller/index.js +2 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.d.ts +92 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.js +53 -0
- package/dist/controllers/slot-text-controller/src/slot-text-controller.js.map +1 -0
- package/dist/directives/index.d.ts +15 -0
- package/dist/directives/index.js +3 -0
- package/dist/directives/pending-spinner/index.d.ts +12 -0
- package/dist/directives/pending-spinner/index.js +1 -0
- package/dist/directives/pending-spinner/src/pending-spinner.d.ts +22 -0
- package/dist/directives/pending-spinner/src/pending-spinner.js +39 -0
- package/dist/directives/pending-spinner/src/pending-spinner.js.map +1 -0
- package/dist/element/define-element.d.ts +16 -0
- package/dist/element/define-element.js +8 -0
- package/dist/element/define-element.js.map +1 -0
- package/dist/element/index.d.ts +14 -0
- package/dist/element/index.js +4 -0
- package/dist/element/spectrum-element.d.ts +69 -0
- package/dist/element/spectrum-element.js +85 -0
- package/dist/element/spectrum-element.js.map +1 -0
- package/dist/element/version.d.ts +19 -0
- package/dist/element/version.js +6 -0
- package/dist/element/version.js.map +1 -0
- package/dist/mixins/disabled-mixin.d.ts +30 -0
- package/dist/mixins/disabled-mixin.js +27 -0
- package/dist/mixins/disabled-mixin.js.map +1 -0
- package/dist/mixins/index.d.ts +16 -0
- package/dist/mixins/index.js +5 -0
- package/dist/mixins/linear-progress-mixin.d.ts +41 -0
- package/dist/mixins/linear-progress-mixin.js +115 -0
- package/dist/mixins/linear-progress-mixin.js.map +1 -0
- package/dist/mixins/pending-mixin.d.ts +45 -0
- package/dist/mixins/pending-mixin.js +50 -0
- package/dist/mixins/pending-mixin.js.map +1 -0
- package/dist/mixins/sized-mixin.d.ts +49 -0
- package/dist/mixins/sized-mixin.js +42 -0
- package/dist/mixins/sized-mixin.js.map +1 -0
- package/dist/utils/actual-placement.d.ts +10 -0
- package/dist/utils/actual-placement.js +8 -0
- package/dist/utils/actual-placement.js.map +1 -0
- package/dist/utils/capitalize.d.ts +26 -0
- package/dist/utils/capitalize.js +8 -0
- package/dist/utils/capitalize.js.map +1 -0
- package/dist/utils/deep-contains.d.ts +26 -0
- package/dist/utils/deep-contains.js +14 -0
- package/dist/utils/deep-contains.js.map +1 -0
- package/dist/utils/dev-validation.d.ts +88 -0
- package/dist/utils/dev-validation.js +33 -0
- package/dist/utils/dev-validation.js.map +1 -0
- package/dist/utils/dismissible-stack.d.ts +26 -0
- package/dist/utils/dismissible-stack.js +16 -0
- package/dist/utils/dismissible-stack.js.map +1 -0
- package/dist/utils/focusable-selectors.d.ts +43 -0
- package/dist/utils/focusable-selectors.js +18 -0
- package/dist/utils/focusable-selectors.js.map +1 -0
- package/dist/utils/get-active-element.d.ts +31 -0
- package/dist/utils/get-active-element.js +11 -0
- package/dist/utils/get-active-element.js.map +1 -0
- package/dist/utils/get-label-from-slot.d.ts +12 -0
- package/dist/utils/get-label-from-slot.js +10 -0
- package/dist/utils/get-label-from-slot.js.map +1 -0
- package/dist/utils/index.d.ts +22 -0
- package/dist/utils/index.js +12 -0
- package/dist/utils/is-focus-visible-in-tree.d.ts +33 -0
- package/dist/utils/is-focus-visible-in-tree.js +11 -0
- package/dist/utils/is-focus-visible-in-tree.js.map +1 -0
- package/dist/utils/resolve-trigger.d.ts +42 -0
- package/dist/utils/resolve-trigger.js +23 -0
- package/dist/utils/resolve-trigger.js.map +1 -0
- package/dist/utils/transition.d.ts +53 -0
- package/dist/utils/transition.js +26 -0
- package/dist/utils/transition.js.map +1 -0
- package/package.json +644 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
2
|
+
import { property as t } from "lit/decorators.js";
|
|
3
|
+
import { SpectrumElement as n } from "@adobe/spectrum-wc-core/element/index.js";
|
|
4
|
+
//#region components/tabs/TabPanel.base.ts
|
|
5
|
+
var r = 0, i = class extends n {
|
|
6
|
+
constructor(...e) {
|
|
7
|
+
super(...e), this.selected = !1, this.tabId = "";
|
|
8
|
+
}
|
|
9
|
+
handleFocusin() {
|
|
10
|
+
this.removeAttribute("tabindex");
|
|
11
|
+
}
|
|
12
|
+
handleFocusout() {
|
|
13
|
+
this.tabIndex = this.selected ? 0 : -1;
|
|
14
|
+
}
|
|
15
|
+
firstUpdated(e) {
|
|
16
|
+
super.firstUpdated(e), this.slot = "tab-panel", this.setAttribute("role", "tabpanel"), this.tabIndex = 0, this.hasAttribute("id") || (this.id = `swc-tab-panel-${r++}`);
|
|
17
|
+
}
|
|
18
|
+
updated(e) {
|
|
19
|
+
super.updated(e), e.has("selected") && this.syncVisibility();
|
|
20
|
+
}
|
|
21
|
+
syncVisibility() {
|
|
22
|
+
this.selected ? (this.removeAttribute("aria-hidden"), this.tabIndex = 0) : (this.setAttribute("aria-hidden", "true"), this.tabIndex = -1);
|
|
23
|
+
}
|
|
24
|
+
};
|
|
25
|
+
e([t({
|
|
26
|
+
type: Boolean,
|
|
27
|
+
reflect: !0
|
|
28
|
+
})], i.prototype, "selected", void 0), e([t({
|
|
29
|
+
type: String,
|
|
30
|
+
reflect: !0,
|
|
31
|
+
attribute: "tab-id"
|
|
32
|
+
})], i.prototype, "tabId", void 0);
|
|
33
|
+
//#endregion
|
|
34
|
+
export { i as TabPanelBase };
|
|
35
|
+
|
|
36
|
+
//# sourceMappingURL=TabPanel.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TabPanel.base.js","names":[],"sources":["../../../components/tabs/TabPanel.base.ts"],"sourcesContent":["/**\n * Copyright 2026 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 { PropertyValues } from 'lit';\nimport { property } from 'lit/decorators.js';\n\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\n\nlet panelIdCounter = 0;\n\n/**\n * Base class for a tab panel that displays content associated with\n * a tab.\n *\n * Manages visibility, ARIA hidden state, tabindex, and the\n * focus-in/out behavior that prevents Tab-key trapping inside panel\n * content.\n *\n * In 1st-gen, `slot=\"tab-panel\"` was\n * assigned programmatically in `firstUpdated` so consumers never\n * wrote it in markup. This behavior is preserved in gen2.\n *\n * The panel removes its own\n * `tabindex` on `focusin` so that Tab presses inside the panel\n * move to the next interactive element rather than being trapped.\n * On `focusout`, `tabindex` is restored so the panel remains\n * focusable from the tablist.\n *\n * @slot - Content displayed when the associated tab is selected\n */\nexport abstract class TabPanelBase extends SpectrumElement {\n // ──────────────────\n // SHARED API\n // ──────────────────\n\n /**\n * Whether this panel is currently visible (its associated tab is\n * selected). Managed by the parent `swc-tabs` — consumers should\n * not set this directly.\n */\n @property({ type: Boolean, reflect: true })\n public selected = false;\n\n /**\n * Unique identifier linking this panel to its corresponding tab.\n * Must match the `tab-id` attribute on the associated `swc-tab`.\n */\n @property({ type: String, reflect: true, attribute: 'tab-id' })\n public tabId = '';\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n /**\n * Removes the panel's `tabindex` while focus is inside the panel\n * so that Tab presses navigate to the next interactive element\n * rather than the panel container itself.\n */\n protected handleFocusin(): void {\n this.removeAttribute('tabindex');\n }\n\n /**\n * Restores `tabindex` when focus leaves the panel so the panel\n * remains directly focusable from the tablist via Tab key.\n */\n protected handleFocusout(): void {\n this.tabIndex = this.selected ? 0 : -1;\n }\n\n protected override firstUpdated(_changes: PropertyValues): void {\n super.firstUpdated(_changes);\n\n this.slot = 'tab-panel';\n this.setAttribute('role', 'tabpanel');\n this.tabIndex = 0;\n\n if (!this.hasAttribute('id')) {\n this.id = `swc-tab-panel-${panelIdCounter++}`;\n }\n }\n\n protected override updated(changes: PropertyValues): void {\n super.updated(changes);\n\n if (changes.has('selected')) {\n this.syncVisibility();\n }\n }\n\n private syncVisibility(): void {\n if (this.selected) {\n this.removeAttribute('aria-hidden');\n this.tabIndex = 0;\n } else {\n this.setAttribute('aria-hidden', 'true');\n this.tabIndex = -1;\n }\n }\n}\n"],"mappings":";;;;AAgBA,IAAI,IAAiB,GAsBC,IAAtB,cAA2C,EAAgB;;+BAWvC,iBAOH;;CAWf,gBAAgC;AAC9B,OAAK,gBAAgB,WAAW;;CAOlC,iBAAiC;AAC/B,OAAK,WAAW,KAAK,WAAW,IAAI;;CAGtC,aAAgC,GAAgC;AAO9D,EANA,MAAM,aAAa,EAAS,EAE5B,KAAK,OAAO,aACZ,KAAK,aAAa,QAAQ,WAAW,EACrC,KAAK,WAAW,GAEX,KAAK,aAAa,KAAK,KAC1B,KAAK,KAAK,iBAAiB;;CAI/B,QAA2B,GAA+B;AAGxD,EAFA,MAAM,QAAQ,EAAQ,EAElB,EAAQ,IAAI,WAAW,IACzB,KAAK,gBAAgB;;CAIzB,iBAA+B;AAC7B,EAAI,KAAK,YACP,KAAK,gBAAgB,cAAc,EACnC,KAAK,WAAW,MAEhB,KAAK,aAAa,eAAe,OAAO,EACxC,KAAK,WAAW;;;GAzDnB,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAO1C,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,WAAW;CAAU,CAAC,CAAA,EAAA,EAAA,WAAA,SAAA,KAAA,EAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 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
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Reserved for future tab-panel-specific type definitions.
|
|
14
|
+
* The file is scaffolded now so imports are stable when implementation
|
|
15
|
+
* work begins.
|
|
16
|
+
*/
|
|
17
|
+
export {};
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { PropertyValues } from 'lit';
|
|
2
|
+
import { SpectrumElement } from '../../element/index.js';
|
|
3
|
+
import { KeyboardActivation, TabDensity, TabsDirection } from './Tabs.types.js';
|
|
4
|
+
/**
|
|
5
|
+
* Base class for a tabbed interface container.
|
|
6
|
+
*
|
|
7
|
+
* Manages selection state, tab/panel association, ARIA wiring,
|
|
8
|
+
* keyboard navigation, and event dispatching. Concrete classes
|
|
9
|
+
* supply the stylesheet, render template, and visual behaviors
|
|
10
|
+
* such as the selection indicator.
|
|
11
|
+
*
|
|
12
|
+
* Public API follows the Spectrum 2 / Spectrum Design–aligned surface
|
|
13
|
+
* from the tabs migration plan: `keyboard-activation` and `density`
|
|
14
|
+
* instead of legacy `auto`, `compact`, `quiet`, `emphasized`, and
|
|
15
|
+
* t-shirt `size` attributes.
|
|
16
|
+
*
|
|
17
|
+
* @slot - Tab items (elements with `role="tab"`)
|
|
18
|
+
* @slot tab-panel - Tab panel content (elements with `role="tabpanel"`)
|
|
19
|
+
*
|
|
20
|
+
* @fires change - The selected tab has changed. Cancelable —
|
|
21
|
+
* calling `preventDefault()` reverts the selection.
|
|
22
|
+
*/
|
|
23
|
+
export declare abstract class TabsBase extends SpectrumElement {
|
|
24
|
+
/**
|
|
25
|
+
* @internal
|
|
26
|
+
*
|
|
27
|
+
* Valid direction values for validation and CEM/stories.
|
|
28
|
+
*/
|
|
29
|
+
static readonly VALID_DIRECTIONS: readonly TabsDirection[];
|
|
30
|
+
/**
|
|
31
|
+
* @internal
|
|
32
|
+
*/
|
|
33
|
+
static readonly VALID_KEYBOARD_ACTIVATIONS: readonly KeyboardActivation[];
|
|
34
|
+
/**
|
|
35
|
+
* @internal
|
|
36
|
+
*/
|
|
37
|
+
static readonly VALID_DENSITIES: readonly TabDensity[];
|
|
38
|
+
/**
|
|
39
|
+
* Whether selection follows keyboard focus (`automatic`, default) or the
|
|
40
|
+
* user must press Enter or Space to activate (`manual`). Prefer `manual`
|
|
41
|
+
* when tab panels are expensive to render or not fully present in the DOM.
|
|
42
|
+
*
|
|
43
|
+
* @see https://w3c.github.io/aria-practices/#kbd_selection_follows_focus
|
|
44
|
+
*/
|
|
45
|
+
get keyboardActivation(): KeyboardActivation;
|
|
46
|
+
set keyboardActivation(value: string);
|
|
47
|
+
/** @internal */
|
|
48
|
+
private _keyboardActivation;
|
|
49
|
+
/**
|
|
50
|
+
* Layout density: `regular` (default) or `compact` (reduced tab spacing).
|
|
51
|
+
*/
|
|
52
|
+
get density(): TabDensity;
|
|
53
|
+
set density(value: string);
|
|
54
|
+
/** @internal */
|
|
55
|
+
private _density;
|
|
56
|
+
/**
|
|
57
|
+
* The layout direction of the tab list: `horizontal` (default) or `vertical`.
|
|
58
|
+
*
|
|
59
|
+
* @default 'horizontal'
|
|
60
|
+
*/
|
|
61
|
+
get direction(): TabsDirection;
|
|
62
|
+
set direction(value: TabsDirection);
|
|
63
|
+
/** @internal */
|
|
64
|
+
private _direction;
|
|
65
|
+
/**
|
|
66
|
+
* Whether the entire tab list is disabled. When `true`,
|
|
67
|
+
* `aria-disabled="true"` is applied to the tablist element and
|
|
68
|
+
* all interaction is suppressed.
|
|
69
|
+
*/
|
|
70
|
+
disabled: boolean;
|
|
71
|
+
/**
|
|
72
|
+
* Accessible label for the tablist. Rendered as `aria-label` on the
|
|
73
|
+
* element with `role="tablist"` in the concrete template.
|
|
74
|
+
*/
|
|
75
|
+
accessibleLabel: string;
|
|
76
|
+
/**
|
|
77
|
+
* The `tab-id` of the currently selected tab. Setting this property
|
|
78
|
+
* updates which tab appears selected and which panel is visible.
|
|
79
|
+
*/
|
|
80
|
+
selected: string;
|
|
81
|
+
/** @internal */
|
|
82
|
+
private static readonly INDICATOR_BASE_SIZE;
|
|
83
|
+
/**
|
|
84
|
+
* @internal
|
|
85
|
+
*
|
|
86
|
+
* Inline style applied to the selection indicator element.
|
|
87
|
+
* Computed from the selected tab's position and dimensions.
|
|
88
|
+
*/
|
|
89
|
+
protected selectionIndicatorStyle: string;
|
|
90
|
+
/**
|
|
91
|
+
* @internal
|
|
92
|
+
*
|
|
93
|
+
* Suppresses the transition on the very first indicator placement
|
|
94
|
+
* so it doesn't animate from the origin.
|
|
95
|
+
*/
|
|
96
|
+
protected shouldAnimate: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* @internal
|
|
99
|
+
*
|
|
100
|
+
* Cached list of tab elements managed by this container. Updated
|
|
101
|
+
* via `handleTabSlotChange`.
|
|
102
|
+
*/
|
|
103
|
+
private _tabs;
|
|
104
|
+
/**
|
|
105
|
+
* @internal
|
|
106
|
+
*
|
|
107
|
+
* Manages roving tabindex and arrow-key / Home / End focus movement within
|
|
108
|
+
* the tab list. Direction is kept in sync with `this.direction` via
|
|
109
|
+
* `setOptions` in `willUpdate`. Disabled tabs remain in the navigation
|
|
110
|
+
* sequence (per APG) but are not activatable.
|
|
111
|
+
*
|
|
112
|
+
* `getItems` returns an empty array when the container is disabled so all
|
|
113
|
+
* tabs lose their tab stop, matching the `aria-disabled` tablist behavior.
|
|
114
|
+
*/
|
|
115
|
+
private readonly _navigation;
|
|
116
|
+
/**
|
|
117
|
+
* Handles `focusgroupNavigationActiveChange` events dispatched by
|
|
118
|
+
* `_navigation`. In automatic activation mode, selects the newly focused
|
|
119
|
+
* tab (unless it is disabled).
|
|
120
|
+
*
|
|
121
|
+
* Only `source: 'keyboard'` (arrow keys, Home/End) and `source: 'focus'`
|
|
122
|
+
* (pointer click, Tab-key entry) represent a real focus move that
|
|
123
|
+
* "selection follows focus" should react to. `'refresh'` and
|
|
124
|
+
* `'programmatic'` fire when `_navigation` re-parks the roving tab stop
|
|
125
|
+
* without anyone actually moving focus there — for example on mount or when
|
|
126
|
+
* re-enabling after `disabled` — and must not trigger a spurious selection
|
|
127
|
+
* or `change` event.
|
|
128
|
+
*/
|
|
129
|
+
private readonly _handleNavigationActiveChange;
|
|
130
|
+
/**
|
|
131
|
+
* Whether an assigned node is treated as a tab. `role="tab"` is set in
|
|
132
|
+
* each tab's `firstUpdated`, so `slotchange` may run before that — accept
|
|
133
|
+
* known tab host tag names so the tab list and selection indicator sync.
|
|
134
|
+
*/
|
|
135
|
+
private static isTabSlotNode;
|
|
136
|
+
/**
|
|
137
|
+
* Called by the concrete class when the default slot's content
|
|
138
|
+
* changes. Rebuilds the internal tab list and syncs selection
|
|
139
|
+
* state.
|
|
140
|
+
*/
|
|
141
|
+
protected handleTabSlotChange(event: Event): void;
|
|
142
|
+
/**
|
|
143
|
+
* Called by the concrete class when the `tab-panel` slot's content
|
|
144
|
+
* changes. Wires up `aria-controls` / `aria-labelledby` between
|
|
145
|
+
* each tab and its panel.
|
|
146
|
+
*/
|
|
147
|
+
protected handlePanelSlotChange(event: Event): void;
|
|
148
|
+
/**
|
|
149
|
+
* Click handler bound to the tablist wrapper in the concrete
|
|
150
|
+
* template. Activates the clicked tab.
|
|
151
|
+
*/
|
|
152
|
+
protected handleClick(event: Event): void;
|
|
153
|
+
/**
|
|
154
|
+
* Keyboard handler for Enter and Space activation. Arrow-key, Home, and
|
|
155
|
+
* End navigation is handled by `FocusgroupNavigationController` in capture
|
|
156
|
+
* phase on the host element.
|
|
157
|
+
*/
|
|
158
|
+
protected handleKeyDown(event: KeyboardEvent): void;
|
|
159
|
+
/**
|
|
160
|
+
* Attempts to select the given tab element. Dispatches a cancelable
|
|
161
|
+
* `change` event — if the consumer calls `preventDefault()`, the
|
|
162
|
+
* selection reverts to the previous value.
|
|
163
|
+
*/
|
|
164
|
+
private selectTarget;
|
|
165
|
+
/**
|
|
166
|
+
* Synchronizes the `selected` property on each child tab to match
|
|
167
|
+
* `this.selected`, then parks the roving tab stop on the selected tab via
|
|
168
|
+
* `_navigation.setActiveItem`. Tabindex management is otherwise owned by
|
|
169
|
+
* `FocusgroupNavigationController` — for example, `_navigation.refresh()`
|
|
170
|
+
* resets all tabindex values when the tab list or `disabled` state changes.
|
|
171
|
+
*/
|
|
172
|
+
private updateCheckedState;
|
|
173
|
+
/**
|
|
174
|
+
* Wires up cross-element ARIA relationships between tabs and
|
|
175
|
+
* panels. Each tab gets `aria-controls` pointing at its panel's
|
|
176
|
+
* `id`, and each panel gets `aria-labelledby` pointing at its
|
|
177
|
+
* tab's `id`.
|
|
178
|
+
*/
|
|
179
|
+
private managePanels;
|
|
180
|
+
/**
|
|
181
|
+
* @internal
|
|
182
|
+
*
|
|
183
|
+
* Recalculates the selection indicator's position and size based
|
|
184
|
+
* on the currently selected tab element. Uses CSS transforms for
|
|
185
|
+
* smooth animation between tab positions.
|
|
186
|
+
*
|
|
187
|
+
* The indicator is a fixed-size element (100px base) that gets
|
|
188
|
+
* `scaleX`/`scaleY` to match the selected tab's width/height,
|
|
189
|
+
* and `translateX`/`translateY` to match its offset position.
|
|
190
|
+
*/
|
|
191
|
+
protected updateSelectionIndicator: () => Promise<void>;
|
|
192
|
+
/** @internal */
|
|
193
|
+
private _resizeObserver?;
|
|
194
|
+
/**
|
|
195
|
+
* @internal
|
|
196
|
+
*
|
|
197
|
+
* Watches for `dir` attribute changes so the indicator recalculates
|
|
198
|
+
* when writing direction flips at runtime. `getComputedStyle` in
|
|
199
|
+
* `updateSelectionIndicator` resolves inherited direction correctly,
|
|
200
|
+
* but nothing else observes it: a `dir` flip on the document root or
|
|
201
|
+
* an ancestor doesn't resize this element, so the `ResizeObserver`
|
|
202
|
+
* below won't catch it. Mirrors the `dir`-watching pattern in
|
|
203
|
+
* `placement-controller.ts`.
|
|
204
|
+
*/
|
|
205
|
+
private _directionObserver?;
|
|
206
|
+
protected willUpdate(changes: PropertyValues): void;
|
|
207
|
+
connectedCallback(): void;
|
|
208
|
+
disconnectedCallback(): void;
|
|
209
|
+
/**
|
|
210
|
+
* Focuses the selected tab, or the first tab when none is selected yet.
|
|
211
|
+
* Slotted tabs live in the light DOM; this is more reliable than relying
|
|
212
|
+
* only on shadow `delegatesFocus` across browsers and test harnesses.
|
|
213
|
+
*/
|
|
214
|
+
focus(options?: FocusOptions): void;
|
|
215
|
+
protected firstUpdated(changes: PropertyValues): void;
|
|
216
|
+
/**
|
|
217
|
+
* Waits for all child tab elements to finish their update cycle
|
|
218
|
+
* before resolving so layout-dependent callers see stable geometry.
|
|
219
|
+
*/
|
|
220
|
+
getUpdateComplete(): Promise<boolean>;
|
|
221
|
+
}
|
|
@@ -0,0 +1,213 @@
|
|
|
1
|
+
import { __decorate as e } from "../../_virtual/_@oxc-project_runtime@0.124.0/helpers/decorate.js";
|
|
2
|
+
import { KEYBOARD_ACTIVATIONS as t, KEYBOARD_ACTIVATION_DEFAULT as n, TABS_DEFAULT_DIRECTION as r, TABS_DIRECTIONS as i, TAB_DENSITIES as a, TAB_DENSITY_DEFAULT as o } from "./Tabs.types.js";
|
|
3
|
+
import { property as s, state as c } from "lit/decorators.js";
|
|
4
|
+
import { FocusgroupNavigationController as l, focusgroupNavigationActiveChange as u } from "@adobe/spectrum-wc-core/controllers/index.js";
|
|
5
|
+
import { SpectrumElement as d } from "@adobe/spectrum-wc-core/element/index.js";
|
|
6
|
+
import { validateEnum as f, warnIf as p } from "@adobe/spectrum-wc-core/utils/index.js";
|
|
7
|
+
//#region components/tabs/Tabs.base.ts
|
|
8
|
+
var m, h = class e extends d {
|
|
9
|
+
constructor(...t) {
|
|
10
|
+
super(...t), this._keyboardActivation = n, this._density = o, this._direction = r, this.disabled = !1, this.accessibleLabel = "", this.selected = "", this.selectionIndicatorStyle = "", this.shouldAnimate = !1, this._tabs = [], this._navigation = new l(this, {
|
|
11
|
+
direction: this._direction,
|
|
12
|
+
wrap: !0,
|
|
13
|
+
memory: !0,
|
|
14
|
+
getItems: () => this.disabled ? [] : this._tabs
|
|
15
|
+
}), this._handleNavigationActiveChange = (e) => {
|
|
16
|
+
if (this._keyboardActivation !== "automatic") return;
|
|
17
|
+
let { activeElement: t, source: n } = e.detail;
|
|
18
|
+
if (n !== "keyboard" && n !== "focus" || !t) return;
|
|
19
|
+
let r = t;
|
|
20
|
+
r.disabled || this.selectTarget(r);
|
|
21
|
+
}, this.updateSelectionIndicator = async () => {
|
|
22
|
+
var t, n;
|
|
23
|
+
let r = this._tabs.find((e) => e.selected);
|
|
24
|
+
if (!r) {
|
|
25
|
+
this.selectionIndicatorStyle = "transform: translateX(0px) scaleX(0) scaleY(0)";
|
|
26
|
+
return;
|
|
27
|
+
}
|
|
28
|
+
let i = (t = this.renderRoot) == null ? void 0 : t.querySelector(".tablist");
|
|
29
|
+
if (!i) return;
|
|
30
|
+
await Promise.all([(n = r.updateComplete) == null ? Promise.resolve() : n, document.fonts ? document.fonts.ready : Promise.resolve()]);
|
|
31
|
+
let a = r.getBoundingClientRect(), o = i.getBoundingClientRect();
|
|
32
|
+
this._direction === "horizontal" ? this.selectionIndicatorStyle = `transform: translateX(${getComputedStyle(this).direction === "rtl" ? a.right - o.right : a.left - o.left}px) scaleX(${a.width / e.INDICATOR_BASE_SIZE})` : this.selectionIndicatorStyle = `transform: translateY(${a.top - o.top}px) scaleY(${a.height / e.INDICATOR_BASE_SIZE})`, this.shouldAnimate || (await this.updateComplete, this.shouldAnimate = !0);
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
get keyboardActivation() {
|
|
36
|
+
return this._keyboardActivation;
|
|
37
|
+
}
|
|
38
|
+
set keyboardActivation(e) {
|
|
39
|
+
let r = t.includes(e);
|
|
40
|
+
f(this, {
|
|
41
|
+
prop: "keyboard-activation",
|
|
42
|
+
value: e,
|
|
43
|
+
valid: t,
|
|
44
|
+
url: "https://spectrum-web-components.adobe.com/?path=/docs/components-tabs--docs"
|
|
45
|
+
});
|
|
46
|
+
let i = r ? e : n;
|
|
47
|
+
if (this._keyboardActivation === i) return;
|
|
48
|
+
let a = this._keyboardActivation;
|
|
49
|
+
this._keyboardActivation = i, this.requestUpdate("keyboardActivation", a);
|
|
50
|
+
}
|
|
51
|
+
get density() {
|
|
52
|
+
return this._density;
|
|
53
|
+
}
|
|
54
|
+
set density(e) {
|
|
55
|
+
let t = a.includes(e);
|
|
56
|
+
f(this, {
|
|
57
|
+
prop: "density",
|
|
58
|
+
value: e,
|
|
59
|
+
valid: a,
|
|
60
|
+
url: "https://spectrum-web-components.adobe.com/?path=/docs/components-tabs--docs"
|
|
61
|
+
});
|
|
62
|
+
let n = t ? e : o;
|
|
63
|
+
if (this._density === n) return;
|
|
64
|
+
let r = this._density;
|
|
65
|
+
this._density = n, this.requestUpdate("density", r);
|
|
66
|
+
}
|
|
67
|
+
get direction() {
|
|
68
|
+
return this._direction;
|
|
69
|
+
}
|
|
70
|
+
set direction(e) {
|
|
71
|
+
let t = i.includes(e);
|
|
72
|
+
f(this, {
|
|
73
|
+
prop: "direction",
|
|
74
|
+
value: e,
|
|
75
|
+
valid: i,
|
|
76
|
+
url: "https://spectrum-web-components.adobe.com/?path=/docs/components-tabs--docs"
|
|
77
|
+
});
|
|
78
|
+
let n = t ? e : r;
|
|
79
|
+
if (this._direction === n) return;
|
|
80
|
+
let a = this._direction;
|
|
81
|
+
this._direction = n, this.requestUpdate("direction", a);
|
|
82
|
+
}
|
|
83
|
+
static isTabSlotNode(e) {
|
|
84
|
+
return e instanceof HTMLElement ? e.getAttribute("role") === "tab" ? !0 : e.localName === "swc-tab" : !1;
|
|
85
|
+
}
|
|
86
|
+
handleTabSlotChange(t) {
|
|
87
|
+
this._tabs = t.target.assignedElements().filter(e.isTabSlotNode), this._navigation.refresh(), this.updateCheckedState(), this.updateSelectionIndicator();
|
|
88
|
+
}
|
|
89
|
+
handlePanelSlotChange(e) {
|
|
90
|
+
let t = e.target.assignedElements();
|
|
91
|
+
this.managePanels(t);
|
|
92
|
+
}
|
|
93
|
+
handleClick(e) {
|
|
94
|
+
if (this.disabled) return;
|
|
95
|
+
let t = e.composedPath().find((e) => e.parentElement === this);
|
|
96
|
+
!t || t.disabled || this.selectTarget(t);
|
|
97
|
+
}
|
|
98
|
+
handleKeyDown(e) {
|
|
99
|
+
if (this.disabled) return;
|
|
100
|
+
let { code: t } = e;
|
|
101
|
+
if (t === "Enter" || t === "Space") {
|
|
102
|
+
e.preventDefault();
|
|
103
|
+
let t = e.target;
|
|
104
|
+
t && !t.disabled && this.selectTarget(t);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
selectTarget(e) {
|
|
108
|
+
let t = e.tabId;
|
|
109
|
+
if (!t || t === this.selected) return;
|
|
110
|
+
let n = this.selected;
|
|
111
|
+
this.selected = t, this.updateCheckedState(), this.dispatchEvent(new Event("change", { cancelable: !0 })) || (this.selected = n);
|
|
112
|
+
}
|
|
113
|
+
updateCheckedState() {
|
|
114
|
+
for (let e of this._tabs) e.selected = !1;
|
|
115
|
+
if (this.selected) {
|
|
116
|
+
let e = this._tabs.find((e) => e.tabId === this.selected);
|
|
117
|
+
e ? (e.selected = !0, this._navigation.setActiveItem(e)) : this.selected = "";
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
managePanels(e) {
|
|
121
|
+
for (let t of e) {
|
|
122
|
+
let { tabId: e, id: n } = t, r = this.querySelector(`[role="tab"][tab-id="${e}"]`);
|
|
123
|
+
r && (r.setAttribute("aria-controls", n), t.setAttribute("aria-labelledby", r.id)), t.selected = e === this.selected;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
willUpdate(e) {
|
|
127
|
+
if (!this.hasUpdated) {
|
|
128
|
+
let e = this.querySelector(":scope > [selected]");
|
|
129
|
+
e && this.selectTarget(e);
|
|
130
|
+
}
|
|
131
|
+
if (super.willUpdate(e), e.has("selected")) {
|
|
132
|
+
this._tabs.length && this.updateCheckedState();
|
|
133
|
+
let t = e.get("selected");
|
|
134
|
+
if (t) {
|
|
135
|
+
let e = this.querySelector(`[role="tabpanel"][tab-id="${t}"]`);
|
|
136
|
+
e && (e.selected = !1);
|
|
137
|
+
}
|
|
138
|
+
let n = this.querySelector(`[role="tabpanel"][tab-id="${this.selected}"]`);
|
|
139
|
+
n && (n.selected = !0), this.updateSelectionIndicator();
|
|
140
|
+
}
|
|
141
|
+
if (e.has("disabled") && this._tabs.length) if (this._navigation.refresh(), this.disabled) for (let e of this._tabs) e.tabIndex = -1;
|
|
142
|
+
else this.updateCheckedState();
|
|
143
|
+
e.has("direction") && (this._navigation.setOptions({ direction: this.direction }), this.updateSelectionIndicator());
|
|
144
|
+
}
|
|
145
|
+
connectedCallback() {
|
|
146
|
+
super.connectedCallback(), this.addEventListener(u, this._handleNavigationActiveChange), window.addEventListener("resize", this.updateSelectionIndicator), "fonts" in document && document.fonts.addEventListener("loadingdone", this.updateSelectionIndicator), this._resizeObserver = new ResizeObserver(() => {
|
|
147
|
+
this.updateSelectionIndicator();
|
|
148
|
+
}), this._resizeObserver.observe(this), this._directionObserver = new MutationObserver(() => {
|
|
149
|
+
this.updateSelectionIndicator();
|
|
150
|
+
});
|
|
151
|
+
let e = (e) => {
|
|
152
|
+
if (e) {
|
|
153
|
+
var t;
|
|
154
|
+
(t = this._directionObserver) == null || t.observe(e, {
|
|
155
|
+
attributes: !0,
|
|
156
|
+
attributeFilter: ["dir"]
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
};
|
|
160
|
+
e(this.ownerDocument.documentElement), e(this.closest("[dir]"));
|
|
161
|
+
}
|
|
162
|
+
disconnectedCallback() {
|
|
163
|
+
var e, t;
|
|
164
|
+
this.removeEventListener(u, this._handleNavigationActiveChange), window.removeEventListener("resize", this.updateSelectionIndicator), "fonts" in document && document.fonts.removeEventListener("loadingdone", this.updateSelectionIndicator), (e = this._resizeObserver) == null || e.disconnect(), this._resizeObserver = void 0, (t = this._directionObserver) == null || t.disconnect(), this._directionObserver = void 0, super.disconnectedCallback();
|
|
165
|
+
}
|
|
166
|
+
focus(e) {
|
|
167
|
+
if (this.disabled) return;
|
|
168
|
+
let t = this._tabs.find((e) => e.selected);
|
|
169
|
+
if (t) {
|
|
170
|
+
t.focus(e);
|
|
171
|
+
return;
|
|
172
|
+
}
|
|
173
|
+
if (this._tabs.length) {
|
|
174
|
+
this._tabs[0].focus(e);
|
|
175
|
+
return;
|
|
176
|
+
}
|
|
177
|
+
super.focus(e);
|
|
178
|
+
}
|
|
179
|
+
firstUpdated(e) {
|
|
180
|
+
super.firstUpdated(e), this.hasAttribute("direction") || this.setAttribute("direction", this.direction), p(this, !this.accessibleLabel, `<${this.localName}> requires an "accessible-label" attribute to provide an accessible name for the tablist.`, "https://spectrum-web-components.adobe.com/?path=/docs/components-tabs--docs", {
|
|
181
|
+
type: "accessibility",
|
|
182
|
+
level: "high"
|
|
183
|
+
});
|
|
184
|
+
}
|
|
185
|
+
async getUpdateComplete() {
|
|
186
|
+
let e = await super.getUpdateComplete(), t = [...this.children].map((e) => "updateComplete" in e ? e.updateComplete : Promise.resolve(!0));
|
|
187
|
+
return await Promise.all(t), e;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
m = h, m.VALID_DIRECTIONS = i, m.VALID_KEYBOARD_ACTIVATIONS = t, m.VALID_DENSITIES = a, m.INDICATOR_BASE_SIZE = 100, e([s({
|
|
191
|
+
type: String,
|
|
192
|
+
reflect: !0,
|
|
193
|
+
attribute: "keyboard-activation"
|
|
194
|
+
})], h.prototype, "keyboardActivation", null), e([s({
|
|
195
|
+
type: String,
|
|
196
|
+
reflect: !0
|
|
197
|
+
})], h.prototype, "density", null), e([s({
|
|
198
|
+
type: String,
|
|
199
|
+
reflect: !0
|
|
200
|
+
})], h.prototype, "direction", null), e([s({
|
|
201
|
+
type: Boolean,
|
|
202
|
+
reflect: !0
|
|
203
|
+
})], h.prototype, "disabled", void 0), e([s({
|
|
204
|
+
type: String,
|
|
205
|
+
attribute: "accessible-label"
|
|
206
|
+
})], h.prototype, "accessibleLabel", void 0), e([s({
|
|
207
|
+
type: String,
|
|
208
|
+
reflect: !0
|
|
209
|
+
})], h.prototype, "selected", void 0), e([c()], h.prototype, "selectionIndicatorStyle", void 0), e([c()], h.prototype, "shouldAnimate", void 0);
|
|
210
|
+
//#endregion
|
|
211
|
+
export { h as TabsBase };
|
|
212
|
+
|
|
213
|
+
//# sourceMappingURL=Tabs.base.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.base.js","names":[],"sources":["../../../components/tabs/Tabs.base.ts"],"sourcesContent":["/**\n * Copyright 2026 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 { PropertyValues } from 'lit';\nimport { property, state } from 'lit/decorators.js';\n\nimport {\n focusgroupNavigationActiveChange,\n type FocusgroupNavigationActiveChangeDetail,\n FocusgroupNavigationController,\n} from '@adobe/spectrum-wc-core/controllers/index.js';\nimport { SpectrumElement } from '@adobe/spectrum-wc-core/element/index.js';\nimport { validateEnum, warnIf } from '@adobe/spectrum-wc-core/utils/index.js';\n\nimport {\n KEYBOARD_ACTIVATION_DEFAULT,\n KEYBOARD_ACTIVATIONS,\n type KeyboardActivation,\n TAB_DENSITIES,\n TAB_DENSITY_DEFAULT,\n type TabDensity,\n type TabLike,\n type TabPanelLike,\n TABS_DEFAULT_DIRECTION,\n TABS_DIRECTIONS,\n type TabsDirection,\n} from './Tabs.types.js';\n\n/**\n * Base class for a tabbed interface container.\n *\n * Manages selection state, tab/panel association, ARIA wiring,\n * keyboard navigation, and event dispatching. Concrete classes\n * supply the stylesheet, render template, and visual behaviors\n * such as the selection indicator.\n *\n * Public API follows the Spectrum 2 / Spectrum Design–aligned surface\n * from the tabs migration plan: `keyboard-activation` and `density`\n * instead of legacy `auto`, `compact`, `quiet`, `emphasized`, and\n * t-shirt `size` attributes.\n *\n * @slot - Tab items (elements with `role=\"tab\"`)\n * @slot tab-panel - Tab panel content (elements with `role=\"tabpanel\"`)\n *\n * @fires change - The selected tab has changed. Cancelable —\n * calling `preventDefault()` reverts the selection.\n */\nexport abstract class TabsBase extends SpectrumElement {\n // ─────────────────────────\n // SHARED API\n // ─────────────────────────\n\n /**\n * @internal\n *\n * Valid direction values for validation and CEM/stories.\n */\n static readonly VALID_DIRECTIONS: readonly TabsDirection[] = TABS_DIRECTIONS;\n\n /**\n * @internal\n */\n static readonly VALID_KEYBOARD_ACTIVATIONS: readonly KeyboardActivation[] =\n KEYBOARD_ACTIVATIONS;\n\n /**\n * @internal\n */\n static readonly VALID_DENSITIES: readonly TabDensity[] = TAB_DENSITIES;\n\n /**\n * Whether selection follows keyboard focus (`automatic`, default) or the\n * user must press Enter or Space to activate (`manual`). Prefer `manual`\n * when tab panels are expensive to render or not fully present in the DOM.\n *\n * @see https://w3c.github.io/aria-practices/#kbd_selection_follows_focus\n */\n @property({ type: String, reflect: true, attribute: 'keyboard-activation' })\n public get keyboardActivation(): KeyboardActivation {\n return this._keyboardActivation;\n }\n\n public set keyboardActivation(value: string) {\n const isValid = (KEYBOARD_ACTIVATIONS as readonly string[]).includes(value);\n\n validateEnum(this, {\n prop: 'keyboard-activation',\n value,\n valid: KEYBOARD_ACTIVATIONS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-tabs--docs',\n });\n\n const valid = isValid\n ? (value as KeyboardActivation)\n : KEYBOARD_ACTIVATION_DEFAULT;\n\n if (this._keyboardActivation === valid) {\n return;\n }\n\n const old = this._keyboardActivation;\n this._keyboardActivation = valid;\n this.requestUpdate('keyboardActivation', old);\n }\n\n /** @internal */\n private _keyboardActivation: KeyboardActivation = KEYBOARD_ACTIVATION_DEFAULT;\n\n /**\n * Layout density: `regular` (default) or `compact` (reduced tab spacing).\n */\n @property({ type: String, reflect: true })\n public get density(): TabDensity {\n return this._density;\n }\n\n public set density(value: string) {\n const isValid = (TAB_DENSITIES as readonly string[]).includes(value);\n\n validateEnum(this, {\n prop: 'density',\n value,\n valid: TAB_DENSITIES,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-tabs--docs',\n });\n\n const valid = isValid ? (value as TabDensity) : TAB_DENSITY_DEFAULT;\n\n if (this._density === valid) {\n return;\n }\n\n const old = this._density;\n this._density = valid;\n this.requestUpdate('density', old);\n }\n\n /** @internal */\n private _density: TabDensity = TAB_DENSITY_DEFAULT;\n\n /**\n * The layout direction of the tab list: `horizontal` (default) or `vertical`.\n *\n * @default 'horizontal'\n */\n @property({ type: String, reflect: true })\n public get direction(): TabsDirection {\n return this._direction;\n }\n\n public set direction(value: TabsDirection) {\n const isValid = (TABS_DIRECTIONS as readonly string[]).includes(value);\n\n validateEnum(this, {\n prop: 'direction',\n value,\n valid: TABS_DIRECTIONS,\n url: 'https://spectrum-web-components.adobe.com/?path=/docs/components-tabs--docs',\n });\n\n const validDirection = isValid\n ? (value as TabsDirection)\n : TABS_DEFAULT_DIRECTION;\n\n if (this._direction === validDirection) {\n return;\n }\n\n const oldDirection = this._direction;\n this._direction = validDirection;\n this.requestUpdate('direction', oldDirection);\n }\n\n /** @internal */\n private _direction: TabsDirection = TABS_DEFAULT_DIRECTION;\n\n /**\n * Whether the entire tab list is disabled. When `true`,\n * `aria-disabled=\"true\"` is applied to the tablist element and\n * all interaction is suppressed.\n */\n @property({ type: Boolean, reflect: true })\n public disabled = false;\n\n /**\n * Accessible label for the tablist. Rendered as `aria-label` on the\n * element with `role=\"tablist\"` in the concrete template.\n */\n @property({ type: String, attribute: 'accessible-label' })\n public accessibleLabel = '';\n\n /**\n * The `tab-id` of the currently selected tab. Setting this property\n * updates which tab appears selected and which panel is visible.\n */\n @property({ type: String, reflect: true })\n public selected = '';\n\n // ──────────────────────\n // IMPLEMENTATION\n // ──────────────────────\n\n /** @internal */\n private static readonly INDICATOR_BASE_SIZE = 100;\n\n /**\n * @internal\n *\n * Inline style applied to the selection indicator element.\n * Computed from the selected tab's position and dimensions.\n */\n @state()\n protected selectionIndicatorStyle = '';\n\n /**\n * @internal\n *\n * Suppresses the transition on the very first indicator placement\n * so it doesn't animate from the origin.\n */\n @state()\n protected shouldAnimate = false;\n\n /**\n * @internal\n *\n * Cached list of tab elements managed by this container. Updated\n * via `handleTabSlotChange`.\n */\n private _tabs: TabLike[] = [];\n\n /**\n * @internal\n *\n * Manages roving tabindex and arrow-key / Home / End focus movement within\n * the tab list. Direction is kept in sync with `this.direction` via\n * `setOptions` in `willUpdate`. Disabled tabs remain in the navigation\n * sequence (per APG) but are not activatable.\n *\n * `getItems` returns an empty array when the container is disabled so all\n * tabs lose their tab stop, matching the `aria-disabled` tablist behavior.\n */\n private readonly _navigation = new FocusgroupNavigationController(this, {\n direction: this._direction,\n wrap: true,\n memory: true,\n getItems: () => (this.disabled ? [] : (this._tabs as HTMLElement[])),\n });\n\n /**\n * Handles `focusgroupNavigationActiveChange` events dispatched by\n * `_navigation`. In automatic activation mode, selects the newly focused\n * tab (unless it is disabled).\n *\n * Only `source: 'keyboard'` (arrow keys, Home/End) and `source: 'focus'`\n * (pointer click, Tab-key entry) represent a real focus move that\n * \"selection follows focus\" should react to. `'refresh'` and\n * `'programmatic'` fire when `_navigation` re-parks the roving tab stop\n * without anyone actually moving focus there — for example on mount or when\n * re-enabling after `disabled` — and must not trigger a spurious selection\n * or `change` event.\n */\n private readonly _handleNavigationActiveChange = (event: Event): void => {\n if (this._keyboardActivation !== 'automatic') {\n return;\n }\n const { activeElement, source } = (\n event as CustomEvent<FocusgroupNavigationActiveChangeDetail>\n ).detail;\n if (source !== 'keyboard' && source !== 'focus') {\n return;\n }\n if (!activeElement) {\n return;\n }\n const tab = activeElement as TabLike;\n if (tab.disabled) {\n return;\n }\n this.selectTarget(tab);\n };\n\n /**\n * Whether an assigned node is treated as a tab. `role=\"tab\"` is set in\n * each tab's `firstUpdated`, so `slotchange` may run before that — accept\n * known tab host tag names so the tab list and selection indicator sync.\n */\n private static isTabSlotNode(el: Element): el is TabLike {\n if (!(el instanceof HTMLElement)) {\n return false;\n }\n if (el.getAttribute('role') === 'tab') {\n return true;\n }\n return el.localName === 'swc-tab';\n }\n\n /**\n * Called by the concrete class when the default slot's content\n * changes. Rebuilds the internal tab list and syncs selection\n * state.\n */\n protected handleTabSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n this._tabs = slot\n .assignedElements()\n .filter(TabsBase.isTabSlotNode) as TabLike[];\n\n this._navigation.refresh();\n this.updateCheckedState();\n this.updateSelectionIndicator();\n }\n\n /**\n * Called by the concrete class when the `tab-panel` slot's content\n * changes. Wires up `aria-controls` / `aria-labelledby` between\n * each tab and its panel.\n */\n protected handlePanelSlotChange(event: Event): void {\n const slot = event.target as HTMLSlotElement;\n const panels = slot.assignedElements() as TabPanelLike[];\n this.managePanels(panels);\n }\n\n /**\n * Click handler bound to the tablist wrapper in the concrete\n * template. Activates the clicked tab.\n */\n protected handleClick(event: Event): void {\n if (this.disabled) {\n return;\n }\n\n const target = event\n .composedPath()\n .find((el) => (el as TabLike).parentElement === this) as\n | TabLike\n | undefined;\n\n if (!target || target.disabled) {\n return;\n }\n\n this.selectTarget(target);\n }\n\n /**\n * Keyboard handler for Enter and Space activation. Arrow-key, Home, and\n * End navigation is handled by `FocusgroupNavigationController` in capture\n * phase on the host element.\n */\n protected handleKeyDown(event: KeyboardEvent): void {\n if (this.disabled) {\n return;\n }\n\n const { code } = event;\n if (code === 'Enter' || code === 'Space') {\n event.preventDefault();\n const target = event.target as TabLike | null;\n if (target && !target.disabled) {\n this.selectTarget(target);\n }\n }\n }\n\n /**\n * Attempts to select the given tab element. Dispatches a cancelable\n * `change` event — if the consumer calls `preventDefault()`, the\n * selection reverts to the previous value.\n */\n private selectTarget(target: TabLike): void {\n const id = target.tabId;\n if (!id || id === this.selected) {\n return;\n }\n\n const previous = this.selected;\n this.selected = id;\n\n // Sync child tab.selected eagerly so that change-event handlers read the\n // correct state on individual tab elements without waiting for the next\n // Lit render cycle (tabs.selected is already updated synchronously above).\n this.updateCheckedState();\n\n const applyDefault = this.dispatchEvent(\n new Event('change', {\n cancelable: true,\n })\n );\n\n if (!applyDefault) {\n this.selected = previous;\n }\n }\n\n /**\n * Synchronizes the `selected` property on each child tab to match\n * `this.selected`, then parks the roving tab stop on the selected tab via\n * `_navigation.setActiveItem`. Tabindex management is otherwise owned by\n * `FocusgroupNavigationController` — for example, `_navigation.refresh()`\n * resets all tabindex values when the tab list or `disabled` state changes.\n */\n private updateCheckedState(): void {\n for (const tab of this._tabs) {\n tab.selected = false;\n }\n\n if (this.selected) {\n const currentTab = this._tabs.find((el) => el.tabId === this.selected);\n\n if (currentTab) {\n currentTab.selected = true;\n this._navigation.setActiveItem(currentTab as HTMLElement);\n } else {\n this.selected = '';\n }\n }\n }\n\n /**\n * Wires up cross-element ARIA relationships between tabs and\n * panels. Each tab gets `aria-controls` pointing at its panel's\n * `id`, and each panel gets `aria-labelledby` pointing at its\n * tab's `id`.\n */\n private managePanels(panels: TabPanelLike[]): void {\n for (const panel of panels) {\n const { tabId, id } = panel;\n const tab = this.querySelector(`[role=\"tab\"][tab-id=\"${tabId}\"]`);\n\n if (tab) {\n tab.setAttribute('aria-controls', id);\n panel.setAttribute('aria-labelledby', tab.id);\n }\n\n panel.selected = tabId === this.selected;\n }\n }\n\n // ───────────────────────────────────\n // SELECTION INDICATOR\n // ───────────────────────────────────\n\n /**\n * @internal\n *\n * Recalculates the selection indicator's position and size based\n * on the currently selected tab element. Uses CSS transforms for\n * smooth animation between tab positions.\n *\n * The indicator is a fixed-size element (100px base) that gets\n * `scaleX`/`scaleY` to match the selected tab's width/height,\n * and `translateX`/`translateY` to match its offset position.\n */\n protected updateSelectionIndicator = async (): Promise<void> => {\n const selectedElement = this._tabs.find((el) => el.selected);\n if (!selectedElement) {\n this.selectionIndicatorStyle =\n 'transform: translateX(0px) scaleX(0) scaleY(0)';\n return;\n }\n\n const tablist = this.renderRoot?.querySelector('.tablist');\n if (!tablist) {\n return;\n }\n\n await Promise.all([\n (selectedElement as HTMLElement & { updateComplete?: Promise<boolean> })\n .updateComplete ?? Promise.resolve(),\n document.fonts ? document.fonts.ready : Promise.resolve(),\n ]);\n\n const tabRect = selectedElement.getBoundingClientRect();\n const listRect = tablist.getBoundingClientRect();\n\n if (this._direction === 'horizontal') {\n const isRtl = getComputedStyle(this).direction === 'rtl';\n const offset = isRtl\n ? tabRect.right - listRect.right\n : tabRect.left - listRect.left;\n const scale = tabRect.width / TabsBase.INDICATOR_BASE_SIZE;\n this.selectionIndicatorStyle = `transform: translateX(${offset}px) scaleX(${scale})`;\n } else {\n const top = tabRect.top - listRect.top;\n const scale = tabRect.height / TabsBase.INDICATOR_BASE_SIZE;\n this.selectionIndicatorStyle = `transform: translateY(${top}px) scaleY(${scale})`;\n }\n\n if (!this.shouldAnimate) {\n await this.updateComplete;\n this.shouldAnimate = true;\n }\n };\n\n /** @internal */\n private _resizeObserver?: ResizeObserver;\n\n /**\n * @internal\n *\n * Watches for `dir` attribute changes so the indicator recalculates\n * when writing direction flips at runtime. `getComputedStyle` in\n * `updateSelectionIndicator` resolves inherited direction correctly,\n * but nothing else observes it: a `dir` flip on the document root or\n * an ancestor doesn't resize this element, so the `ResizeObserver`\n * below won't catch it. Mirrors the `dir`-watching pattern in\n * `placement-controller.ts`.\n */\n private _directionObserver?: MutationObserver;\n\n // ───────────────────────────────────\n // LIFECYCLE\n // ───────────────────────────────────\n\n protected override willUpdate(changes: PropertyValues): void {\n if (!this.hasUpdated) {\n const selectedChild = this.querySelector(\n ':scope > [selected]'\n ) as TabLike | null;\n\n if (selectedChild) {\n this.selectTarget(selectedChild);\n }\n }\n\n super.willUpdate(changes);\n\n if (changes.has('selected')) {\n if (this._tabs.length) {\n this.updateCheckedState();\n }\n\n const previousValue = changes.get('selected') as string | undefined;\n if (previousValue) {\n const previous = this.querySelector(\n `[role=\"tabpanel\"][tab-id=\"${previousValue}\"]`\n ) as TabPanelLike | null;\n\n if (previous) {\n previous.selected = false;\n }\n }\n\n const next = this.querySelector(\n `[role=\"tabpanel\"][tab-id=\"${this.selected}\"]`\n ) as TabPanelLike | null;\n\n if (next) {\n next.selected = true;\n }\n\n this.updateSelectionIndicator();\n }\n\n if (changes.has('disabled') && this._tabs.length) {\n this._navigation.refresh();\n if (this.disabled) {\n // When disabled, getItems() returns [] so the controller's cleanup\n // loop in refresh() iterates nothing. Explicitly remove all tabs from\n // the tab order so the tablist is fully inert.\n for (const tab of this._tabs) {\n (tab as HTMLElement).tabIndex = -1;\n }\n } else {\n // After re-enabling, restore the roving tab stop to the selected tab.\n this.updateCheckedState();\n }\n }\n\n if (changes.has('direction')) {\n this._navigation.setOptions({ direction: this.direction });\n this.updateSelectionIndicator();\n }\n }\n\n public override connectedCallback(): void {\n super.connectedCallback();\n this.addEventListener(\n focusgroupNavigationActiveChange,\n this._handleNavigationActiveChange\n );\n window.addEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n document.fonts.addEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n this._resizeObserver = new ResizeObserver(() => {\n this.updateSelectionIndicator();\n });\n this._resizeObserver.observe(this);\n\n this._directionObserver = new MutationObserver(() => {\n this.updateSelectionIndicator();\n });\n const observeDir = (node: Element | null | undefined) => {\n if (node) {\n this._directionObserver?.observe(node, {\n attributes: true,\n attributeFilter: ['dir'],\n });\n }\n };\n observeDir(this.ownerDocument.documentElement);\n observeDir(this.closest('[dir]'));\n }\n\n public override disconnectedCallback(): void {\n this.removeEventListener(\n focusgroupNavigationActiveChange,\n this._handleNavigationActiveChange\n );\n window.removeEventListener('resize', this.updateSelectionIndicator);\n if ('fonts' in document) {\n document.fonts.removeEventListener(\n 'loadingdone',\n this.updateSelectionIndicator\n );\n }\n this._resizeObserver?.disconnect();\n this._resizeObserver = undefined;\n this._directionObserver?.disconnect();\n this._directionObserver = undefined;\n super.disconnectedCallback();\n }\n\n /**\n * Focuses the selected tab, or the first tab when none is selected yet.\n * Slotted tabs live in the light DOM; this is more reliable than relying\n * only on shadow `delegatesFocus` across browsers and test harnesses.\n */\n public override focus(options?: FocusOptions): void {\n if (this.disabled) {\n return;\n }\n\n const selectedTab = this._tabs.find((tab) => tab.selected);\n if (selectedTab) {\n (selectedTab as HTMLElement).focus(options);\n return;\n }\n\n if (this._tabs.length) {\n (this._tabs[0] as HTMLElement).focus(options);\n return;\n }\n\n super.focus(options);\n }\n\n protected override firstUpdated(changes: PropertyValues): void {\n super.firstUpdated(changes);\n\n if (!this.hasAttribute('direction')) {\n this.setAttribute('direction', this.direction);\n }\n\n warnIf(\n this,\n !this.accessibleLabel,\n `<${this.localName}> requires an \"accessible-label\" attribute to provide an accessible name for the tablist.`,\n 'https://spectrum-web-components.adobe.com/?path=/docs/components-tabs--docs',\n { type: 'accessibility', level: 'high' }\n );\n }\n\n /**\n * Waits for all child tab elements to finish their update cycle\n * before resolving so layout-dependent callers see stable geometry.\n */\n public override async getUpdateComplete(): Promise<boolean> {\n const complete = await super.getUpdateComplete();\n\n const children = [...this.children] as HTMLElement[];\n const childUpdates = children.map((child) => {\n if ('updateComplete' in child) {\n return (child as unknown as { updateComplete: Promise<boolean> })\n .updateComplete;\n }\n return Promise.resolve(true);\n });\n\n await Promise.all(childUpdates);\n return complete;\n }\n}\n"],"mappings":";;;;;;;OAuDsB,IAAtB,MAAsB,UAAiB,EAAgB;;0CA2DH,mBAgCnB,qBAoCK,mBAQlB,2BAOO,oBAOP,mCAgBkB,yBASV,iBAQC,EAAE,qBAaE,IAAI,EAA+B,MAAM;GACtE,WAAW,KAAK;GAChB,MAAM;GACN,QAAQ;GACR,gBAAiB,KAAK,WAAW,EAAE,GAAI,KAAK;GAC7C,CAAC,wCAegD,MAAuB;AACvE,OAAI,KAAK,wBAAwB,YAC/B;GAEF,IAAM,EAAE,kBAAe,cACrB,EACA;AAIF,OAHI,MAAW,cAAc,MAAW,WAGpC,CAAC,EACH;GAEF,IAAM,IAAM;AACR,KAAI,YAGR,KAAK,aAAa,EAAI;qCAgLa,YAA2B;;GAC9D,IAAM,IAAkB,KAAK,MAAM,MAAM,MAAO,EAAG,SAAS;AAC5D,OAAI,CAAC,GAAiB;AACpB,SAAK,0BACH;AACF;;GAGF,IAAM,KAAA,IAAU,KAAK,eAAA,OAAA,KAAA,IAAA,EAAY,cAAc,WAAW;AAC1D,OAAI,CAAC,EACH;AAGF,SAAM,QAAQ,IAAI,EAAA,IACf,EACE,mBAAA,OAAkB,QAAQ,SAAS,GAAnC,GACH,SAAS,QAAQ,SAAS,MAAM,QAAQ,QAAQ,SAAS,CAC1D,CAAC;GAEF,IAAM,IAAU,EAAgB,uBAAuB,EACjD,IAAW,EAAQ,uBAAuB;AAehD,GAbI,KAAK,eAAe,eAMtB,KAAK,0BAA0B,yBALjB,iBAAiB,KAAK,CAAC,cAAc,QAE/C,EAAQ,QAAQ,EAAS,QACzB,EAAQ,OAAO,EAAS,KAEmC,aADjD,EAAQ,QAAQ,EAAS,oBAC2C,KAIlF,KAAK,0BAA0B,yBAFnB,EAAQ,MAAM,EAAS,IAEyB,aAD9C,EAAQ,SAAS,EAAS,oBACuC,IAG5E,KAAK,kBACR,MAAM,KAAK,gBACX,KAAK,gBAAgB;;;CA/ZzB,IACW,qBAAyC;AAClD,SAAO,KAAK;;CAGd,IAAW,mBAAmB,GAAe;EAC3C,IAAM,IAAW,EAA2C,SAAS,EAAM;AAE3E,IAAa,MAAM;GACjB,MAAM;GACN;GACA,OAAO;GACP,KAAK;GACN,CAAC;EAEF,IAAM,IAAQ,IACT,IACD;AAEJ,MAAI,KAAK,wBAAwB,EAC/B;EAGF,IAAM,IAAM,KAAK;AAEjB,EADA,KAAK,sBAAsB,GAC3B,KAAK,cAAc,sBAAsB,EAAI;;CAS/C,IACW,UAAsB;AAC/B,SAAO,KAAK;;CAGd,IAAW,QAAQ,GAAe;EAChC,IAAM,IAAW,EAAoC,SAAS,EAAM;AAEpE,IAAa,MAAM;GACjB,MAAM;GACN;GACA,OAAO;GACP,KAAK;GACN,CAAC;EAEF,IAAM,IAAQ,IAAW,IAAuB;AAEhD,MAAI,KAAK,aAAa,EACpB;EAGF,IAAM,IAAM,KAAK;AAEjB,EADA,KAAK,WAAW,GAChB,KAAK,cAAc,WAAW,EAAI;;CAWpC,IACW,YAA2B;AACpC,SAAO,KAAK;;CAGd,IAAW,UAAU,GAAsB;EACzC,IAAM,IAAW,EAAsC,SAAS,EAAM;AAEtE,IAAa,MAAM;GACjB,MAAM;GACN;GACA,OAAO;GACP,KAAK;GACN,CAAC;EAEF,IAAM,IAAiB,IAClB,IACD;AAEJ,MAAI,KAAK,eAAe,EACtB;EAGF,IAAM,IAAe,KAAK;AAE1B,EADA,KAAK,aAAa,GAClB,KAAK,cAAc,aAAa,EAAa;;CAqH/C,OAAe,cAAc,GAA4B;AAOvD,SANM,aAAc,cAGhB,EAAG,aAAa,OAAO,KAAK,QACvB,KAEF,EAAG,cAAc,YALf;;CAaX,oBAA8B,GAAoB;AAQhD,EANA,KAAK,QADQ,EAAM,OAEhB,kBAAkB,CAClB,OAAO,EAAS,cAAc,EAEjC,KAAK,YAAY,SAAS,EAC1B,KAAK,oBAAoB,EACzB,KAAK,0BAA0B;;CAQjC,sBAAgC,GAAoB;EAElD,IAAM,IADO,EAAM,OACC,kBAAkB;AACtC,OAAK,aAAa,EAAO;;CAO3B,YAAsB,GAAoB;AACxC,MAAI,KAAK,SACP;EAGF,IAAM,IAAS,EACZ,cAAc,CACd,MAAM,MAAQ,EAAe,kBAAkB,KAAK;AAInD,GAAC,KAAU,EAAO,YAItB,KAAK,aAAa,EAAO;;CAQ3B,cAAwB,GAA4B;AAClD,MAAI,KAAK,SACP;EAGF,IAAM,EAAE,YAAS;AACjB,MAAI,MAAS,WAAW,MAAS,SAAS;AACxC,KAAM,gBAAgB;GACtB,IAAM,IAAS,EAAM;AACrB,GAAI,KAAU,CAAC,EAAO,YACpB,KAAK,aAAa,EAAO;;;CAU/B,aAAqB,GAAuB;EAC1C,IAAM,IAAK,EAAO;AAClB,MAAI,CAAC,KAAM,MAAO,KAAK,SACrB;EAGF,IAAM,IAAW,KAAK;AActB,EAbA,KAAK,WAAW,GAKhB,KAAK,oBAAoB,EAEJ,KAAK,cACxB,IAAI,MAAM,UAAU,EAClB,YAAY,IACb,CAAC,CACH,KAGC,KAAK,WAAW;;CAWpB,qBAAmC;AACjC,OAAK,IAAM,KAAO,KAAK,MACrB,GAAI,WAAW;AAGjB,MAAI,KAAK,UAAU;GACjB,IAAM,IAAa,KAAK,MAAM,MAAM,MAAO,EAAG,UAAU,KAAK,SAAS;AAEtE,GAAI,KACF,EAAW,WAAW,IACtB,KAAK,YAAY,cAAc,EAA0B,IAEzD,KAAK,WAAW;;;CAWtB,aAAqB,GAA8B;AACjD,OAAK,IAAM,KAAS,GAAQ;GAC1B,IAAM,EAAE,UAAO,UAAO,GAChB,IAAM,KAAK,cAAc,wBAAwB,EAAM,IAAI;AAOjE,GALI,MACF,EAAI,aAAa,iBAAiB,EAAG,EACrC,EAAM,aAAa,mBAAmB,EAAI,GAAG,GAG/C,EAAM,WAAW,MAAU,KAAK;;;CAgFpC,WAA8B,GAA+B;AAC3D,MAAI,CAAC,KAAK,YAAY;GACpB,IAAM,IAAgB,KAAK,cACzB,sBACD;AAED,GAAI,KACF,KAAK,aAAa,EAAc;;AAMpC,MAFA,MAAM,WAAW,EAAQ,EAErB,EAAQ,IAAI,WAAW,EAAE;AAC3B,GAAI,KAAK,MAAM,UACb,KAAK,oBAAoB;GAG3B,IAAM,IAAgB,EAAQ,IAAI,WAAW;AAC7C,OAAI,GAAe;IACjB,IAAM,IAAW,KAAK,cACpB,6BAA6B,EAAc,IAC5C;AAED,IAAI,MACF,EAAS,WAAW;;GAIxB,IAAM,IAAO,KAAK,cAChB,6BAA6B,KAAK,SAAS,IAC5C;AAMD,GAJI,MACF,EAAK,WAAW,KAGlB,KAAK,0BAA0B;;AAGjC,MAAI,EAAQ,IAAI,WAAW,IAAI,KAAK,MAAM,OAExC,KADA,KAAK,YAAY,SAAS,EACtB,KAAK,SAIP,MAAK,IAAM,KAAO,KAAK,MACpB,GAAoB,WAAW;MAIlC,MAAK,oBAAoB;AAI7B,EAAI,EAAQ,IAAI,YAAY,KAC1B,KAAK,YAAY,WAAW,EAAE,WAAW,KAAK,WAAW,CAAC,EAC1D,KAAK,0BAA0B;;CAInC,oBAA0C;AAkBxC,EAjBA,MAAM,mBAAmB,EACzB,KAAK,iBACH,GACA,KAAK,8BACN,EACD,OAAO,iBAAiB,UAAU,KAAK,yBAAyB,EAC5D,WAAW,YACb,SAAS,MAAM,iBACb,eACA,KAAK,yBACN,EAEH,KAAK,kBAAkB,IAAI,qBAAqB;AAC9C,QAAK,0BAA0B;IAC/B,EACF,KAAK,gBAAgB,QAAQ,KAAK,EAElC,KAAK,qBAAqB,IAAI,uBAAuB;AACnD,QAAK,0BAA0B;IAC/B;EACF,IAAM,KAAc,MAAqC;AACvD,OAAI,GAAM;;AACR,KAAA,IAAA,KAAK,uBAAA,QAAA,EAAoB,QAAQ,GAAM;KACrC,YAAY;KACZ,iBAAiB,CAAC,MAAM;KACzB,CAAC;;;AAIN,EADA,EAAW,KAAK,cAAc,gBAAgB,EAC9C,EAAW,KAAK,QAAQ,QAAQ,CAAC;;CAGnC,uBAA6C;;AAgB3C,EAfA,KAAK,oBACH,GACA,KAAK,8BACN,EACD,OAAO,oBAAoB,UAAU,KAAK,yBAAyB,EAC/D,WAAW,YACb,SAAS,MAAM,oBACb,eACA,KAAK,yBACN,GAEH,IAAA,KAAK,oBAAA,QAAA,EAAiB,YAAY,EAClC,KAAK,kBAAkB,KAAA,IACvB,IAAA,KAAK,uBAAA,QAAA,EAAoB,YAAY,EACrC,KAAK,qBAAqB,KAAA,GAC1B,MAAM,sBAAsB;;CAQ9B,MAAsB,GAA8B;AAClD,MAAI,KAAK,SACP;EAGF,IAAM,IAAc,KAAK,MAAM,MAAM,MAAQ,EAAI,SAAS;AAC1D,MAAI,GAAa;AACd,KAA4B,MAAM,EAAQ;AAC3C;;AAGF,MAAI,KAAK,MAAM,QAAQ;AACpB,QAAK,MAAM,GAAmB,MAAM,EAAQ;AAC7C;;AAGF,QAAM,MAAM,EAAQ;;CAGtB,aAAgC,GAA+B;AAO7D,EANA,MAAM,aAAa,EAAQ,EAEtB,KAAK,aAAa,YAAY,IACjC,KAAK,aAAa,aAAa,KAAK,UAAU,EAGhD,EACE,MACA,CAAC,KAAK,iBACN,IAAI,KAAK,UAAU,4FACnB,+EACA;GAAE,MAAM;GAAiB,OAAO;GAAQ,CACzC;;CAOH,MAAsB,oBAAsC;EAC1D,IAAM,IAAW,MAAM,MAAM,mBAAmB,EAG1C,IADW,CAAC,GAAG,KAAK,SAAS,CACL,KAAK,MAC7B,oBAAoB,IACd,EACL,iBAEE,QAAQ,QAAQ,GAAK,CAC5B;AAGF,SADA,MAAM,QAAQ,IAAI,EAAa,EACxB;;;4BArnBoD,kCAM3D,uBAKuD,2BAuIX,QA9H7C,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,WAAW;CAAuB,CAAC,CAAA,EAAA,EAAA,WAAA,sBAAA,KAAA,KAkC3E,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,WAAA,KAAA,KAkCzC,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,aAAA,KAAA,KAoCzC,EAAS;CAAE,MAAM;CAAS,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAO1C,EAAS;CAAE,MAAM;CAAQ,WAAW;CAAoB,CAAC,CAAA,EAAA,EAAA,WAAA,mBAAA,KAAA,EAAA,KAOzD,EAAS;CAAE,MAAM;CAAQ,SAAS;CAAM,CAAC,CAAA,EAAA,EAAA,WAAA,YAAA,KAAA,EAAA,KAgBzC,GAAO,CAAA,EAAA,EAAA,WAAA,2BAAA,KAAA,EAAA,KASP,GAAO,CAAA,EAAA,EAAA,WAAA,iBAAA,KAAA,EAAA"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 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
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* Valid orientation directions for the tabs component.
|
|
14
|
+
*
|
|
15
|
+
* **`vertical-right`** was supported in 1st-gen but is not part of the
|
|
16
|
+
* S2-aligned `swc-tabs` surface; use `direction="vertical"` instead.
|
|
17
|
+
*/
|
|
18
|
+
export declare const TABS_DIRECTIONS: readonly ["horizontal", "vertical"];
|
|
19
|
+
export type TabsDirection = (typeof TABS_DIRECTIONS)[number];
|
|
20
|
+
export declare const TABS_DEFAULT_DIRECTION: "horizontal";
|
|
21
|
+
/**
|
|
22
|
+
* How keyboard focus interacts with selection (Spectrum Design / S2 naming).
|
|
23
|
+
*
|
|
24
|
+
* - **`automatic`**: Selection follows focus as the user arrows between tabs
|
|
25
|
+
* (default, matches React Spectrum/React Aria `Tabs`).
|
|
26
|
+
* - **`manual`**: Arrow keys move focus; Enter or Space activates. Prefer this
|
|
27
|
+
* for tab panels that are expensive to render or not fully present in the DOM.
|
|
28
|
+
*/
|
|
29
|
+
export declare const KEYBOARD_ACTIVATIONS: readonly ["manual", "automatic"];
|
|
30
|
+
export type KeyboardActivation = (typeof KEYBOARD_ACTIVATIONS)[number];
|
|
31
|
+
export declare const KEYBOARD_ACTIVATION_DEFAULT: "automatic";
|
|
32
|
+
/**
|
|
33
|
+
* Tab list density (Spectrum Design `density` naming).
|
|
34
|
+
*/
|
|
35
|
+
export declare const TAB_DENSITIES: readonly ["regular", "compact"];
|
|
36
|
+
export type TabDensity = (typeof TAB_DENSITIES)[number];
|
|
37
|
+
export declare const TAB_DENSITY_DEFAULT: "regular";
|
|
38
|
+
/**
|
|
39
|
+
* Structural interface for tab-like elements managed by the tabs
|
|
40
|
+
* container. Allows the base class to work with any element that
|
|
41
|
+
* satisfies this contract without coupling to a concrete class.
|
|
42
|
+
*/
|
|
43
|
+
export interface TabLike extends HTMLElement {
|
|
44
|
+
tabId: string;
|
|
45
|
+
selected: boolean;
|
|
46
|
+
disabled: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Structural interface for tab-panel-like elements managed by the
|
|
50
|
+
* tabs container.
|
|
51
|
+
*/
|
|
52
|
+
export interface TabPanelLike extends HTMLElement {
|
|
53
|
+
tabId: string;
|
|
54
|
+
selected: boolean;
|
|
55
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
//#region components/tabs/Tabs.types.ts
|
|
2
|
+
var e = ["horizontal", "vertical"], t = "horizontal", n = ["manual", "automatic"], r = "automatic", i = ["regular", "compact"], a = "regular";
|
|
3
|
+
//#endregion
|
|
4
|
+
export { n as KEYBOARD_ACTIVATIONS, r as KEYBOARD_ACTIVATION_DEFAULT, t as TABS_DEFAULT_DIRECTION, e as TABS_DIRECTIONS, i as TAB_DENSITIES, a as TAB_DENSITY_DEFAULT };
|
|
5
|
+
|
|
6
|
+
//# sourceMappingURL=Tabs.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tabs.types.js","names":[],"sources":["../../../components/tabs/Tabs.types.ts"],"sourcesContent":["/**\n * Copyright 2026 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\n/**\n * Valid orientation directions for the tabs component.\n *\n * **`vertical-right`** was supported in 1st-gen but is not part of the\n * S2-aligned `swc-tabs` surface; use `direction=\"vertical\"` instead.\n */\nexport const TABS_DIRECTIONS = ['horizontal', 'vertical'] as const;\n\nexport type TabsDirection = (typeof TABS_DIRECTIONS)[number];\n\nexport const TABS_DEFAULT_DIRECTION =\n 'horizontal' as const satisfies TabsDirection;\n\n/**\n * How keyboard focus interacts with selection (Spectrum Design / S2 naming).\n *\n * - **`automatic`**: Selection follows focus as the user arrows between tabs\n * (default, matches React Spectrum/React Aria `Tabs`).\n * - **`manual`**: Arrow keys move focus; Enter or Space activates. Prefer this\n * for tab panels that are expensive to render or not fully present in the DOM.\n */\nexport const KEYBOARD_ACTIVATIONS = ['manual', 'automatic'] as const;\n\nexport type KeyboardActivation = (typeof KEYBOARD_ACTIVATIONS)[number];\n\nexport const KEYBOARD_ACTIVATION_DEFAULT =\n 'automatic' as const satisfies KeyboardActivation;\n\n/**\n * Tab list density (Spectrum Design `density` naming).\n */\nexport const TAB_DENSITIES = ['regular', 'compact'] as const;\n\nexport type TabDensity = (typeof TAB_DENSITIES)[number];\n\nexport const TAB_DENSITY_DEFAULT = 'regular' as const satisfies TabDensity;\n\n/**\n * Structural interface for tab-like elements managed by the tabs\n * container. Allows the base class to work with any element that\n * satisfies this contract without coupling to a concrete class.\n */\nexport interface TabLike extends HTMLElement {\n tabId: string;\n selected: boolean;\n disabled: boolean;\n}\n\n/**\n * Structural interface for tab-panel-like elements managed by the\n * tabs container.\n */\nexport interface TabPanelLike extends HTMLElement {\n tabId: string;\n selected: boolean;\n}\n"],"mappings":";AAkBA,IAAa,IAAkB,CAAC,cAAc,WAAW,EAI5C,IACX,cAUW,IAAuB,CAAC,UAAU,YAAY,EAI9C,IACX,aAKW,IAAgB,CAAC,WAAW,UAAU,EAItC,IAAsB"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright 2026 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
|
+
*/
|
|
12
|
+
export * from './Tab.base.js';
|
|
13
|
+
export * from './Tab.types.js';
|
|
14
|
+
export * from './TabPanel.base.js';
|
|
15
|
+
export * from './TabPanel.types.js';
|
|
16
|
+
export * from './Tabs.base.js';
|
|
17
|
+
export * from './Tabs.types.js';
|