@sbb-esta/lyne-elements 3.8.0 → 3.9.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/core/base-elements/open-close-base-element.d.ts +2 -0
- package/core/base-elements/open-close-base-element.d.ts.map +1 -1
- package/core/base-elements/open-close-base-element.js +4 -0
- package/core/controllers/escapable-overlay-controller.js +3 -3
- package/core/controllers/inert-controller.d.ts +8 -1
- package/core/controllers/inert-controller.d.ts.map +1 -1
- package/core/controllers/inert-controller.js +25 -13
- package/core/overlay/position.d.ts +20 -0
- package/core/overlay/position.d.ts.map +1 -1
- package/core/overlay/position.js +34 -23
- package/core/overlay.js +11 -10
- package/core/styles/core.scss +7 -0
- package/core.css +6 -0
- package/custom-elements.json +612 -138
- package/development/core/base-elements/open-close-base-element.d.ts +2 -0
- package/development/core/base-elements/open-close-base-element.d.ts.map +1 -1
- package/development/core/base-elements/open-close-base-element.js +5 -1
- package/development/core/controllers/escapable-overlay-controller.js +2 -2
- package/development/core/controllers/inert-controller.d.ts +8 -1
- package/development/core/controllers/inert-controller.d.ts.map +1 -1
- package/development/core/controllers/inert-controller.js +49 -30
- package/development/core/overlay/position.d.ts +20 -0
- package/development/core/overlay/position.d.ts.map +1 -1
- package/development/core/overlay/position.js +41 -1
- package/development/core/overlay.js +2 -1
- package/development/menu/common/menu-action-common.d.ts.map +1 -1
- package/development/menu/common/menu-action-common.js +20 -3
- package/development/menu/menu/menu.component.d.ts +21 -10
- package/development/menu/menu/menu.component.d.ts.map +1 -1
- package/development/menu/menu/menu.component.js +203 -61
- package/development/option/option/option.component.js +4 -2
- package/development/tabs/tab/tab.component.d.ts +10 -4
- package/development/tabs/tab/tab.component.d.ts.map +1 -1
- package/development/tabs/tab/tab.component.js +15 -16
- package/development/tabs/tab-group/tab-group.component.d.ts +15 -14
- package/development/tabs/tab-group/tab-group.component.d.ts.map +1 -1
- package/development/tabs/tab-group/tab-group.component.js +46 -175
- package/development/tabs/tab-label/tab-label.component.d.ts +21 -2
- package/development/tabs/tab-label/tab-label.component.d.ts.map +1 -1
- package/development/tabs/tab-label/tab-label.component.js +91 -6
- package/development/tooltip/tooltip.component.d.ts +6 -6
- package/development/tooltip/tooltip.component.d.ts.map +1 -1
- package/development/tooltip/tooltip.component.js +14 -7
- package/menu/common/menu-action-common.d.ts.map +1 -1
- package/menu/common/menu-action-common.js +15 -12
- package/menu/menu/menu.component.d.ts +21 -10
- package/menu/menu/menu.component.d.ts.map +1 -1
- package/menu/menu/menu.component.js +144 -80
- package/off-brand-theme.css +6 -0
- package/option/option/option.component.js +1 -1
- package/package.json +1 -1
- package/safety-theme.css +6 -0
- package/standard-theme.css +6 -0
- package/tabs/tab/tab.component.d.ts +10 -4
- package/tabs/tab/tab.component.d.ts.map +1 -1
- package/tabs/tab/tab.component.js +22 -24
- package/tabs/tab-group/tab-group.component.d.ts +15 -14
- package/tabs/tab-group/tab-group.component.d.ts.map +1 -1
- package/tabs/tab-group/tab-group.component.js +68 -122
- package/tabs/tab-label/tab-label.component.d.ts +21 -2
- package/tabs/tab-label/tab-label.component.d.ts.map +1 -1
- package/tabs/tab-label/tab-label.component.js +88 -46
- package/tooltip/tooltip.component.d.ts +6 -6
- package/tooltip/tooltip.component.d.ts.map +1 -1
- package/tooltip/tooltip.component.js +59 -54
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var x = (s) => {
|
|
2
|
+
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __esDecorate as
|
|
7
|
-
import { css as
|
|
8
|
-
import { customElement as B, property as
|
|
9
|
-
import { ref as
|
|
4
|
+
var C = (s, i, r) => i.has(s) || x("Cannot " + r);
|
|
5
|
+
var m = (s, i, r) => (C(s, i, "read from private field"), r ? r.call(s) : i.get(s)), g = (s, i, r) => i.has(s) ? x("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, r), h = (s, i, r, o) => (C(s, i, "write to private field"), o ? o.call(s, r) : i.set(s, r), r);
|
|
6
|
+
import { __esDecorate as _, __runInitializers as u } from "tslib";
|
|
7
|
+
import { css as L, isServer as O, html as M } from "lit";
|
|
8
|
+
import { customElement as B, property as S } from "lit/decorators.js";
|
|
9
|
+
import { ref as T } from "lit/directives/ref.js";
|
|
10
10
|
import { SbbFocusTrapController as I, isArrowKeyOrPageKeysPressed as P, interactivityChecker as D, getNextElementIndex as U } from "../../core/a11y.js";
|
|
11
11
|
import { SbbOpenCloseBaseElement as z } from "../../core/base-elements.js";
|
|
12
|
-
import { SbbEscapableOverlayController as
|
|
13
|
-
import { idReference as
|
|
14
|
-
import { SbbScrollHandler as
|
|
15
|
-
import { forwardEvent as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
12
|
+
import { SbbEscapableOverlayController as R, SbbInertController as K, SbbMediaQueryBreakpointSmallAndBelow as $, SbbMediaMatcherController as H, SbbDarkModeController as q, SbbLanguageController as F } from "../../core/controllers.js";
|
|
13
|
+
import { idReference as Z, forceType as j } from "../../core/decorators.js";
|
|
14
|
+
import { SbbScrollHandler as V, isZeroAnimationDuration as W } from "../../core/dom.js";
|
|
15
|
+
import { forwardEvent as G } from "../../core/eventing.js";
|
|
16
|
+
import { i18nGoBack as Q } from "../../core/i18n/i18n.js";
|
|
17
|
+
import { SbbNamedSlotListMixin as J } from "../../core/mixins.js";
|
|
18
|
+
import { isEventOnElement as A, removeAriaOverlayTriggerAttributes as X, setAriaOverlayTriggerAttributes as Y, getElementPosition as ee, getElementPositionHorizontal as te } from "../../core/overlay.js";
|
|
19
|
+
import "../../divider.js";
|
|
20
|
+
import "../menu-button.js";
|
|
21
|
+
const se = L`*,:before,:after{box-sizing:border-box}:host{display:contents;--sbb-menu-position-x: 0;--sbb-menu-position-y: 0;--sbb-menu-animation-duration: var( --sbb-disable-animation-duration, var(--sbb-animation-duration-6x) );--sbb-menu-animation-easing: ease;--sbb-menu-transform-y: 100%;--sbb-menu-transform-x: 0%;--sbb-menu-max-width: 100%;--sbb-menu-min-width: 100%;--sbb-menu-inset: 0 auto auto 0;--sbb-menu-container-height: 100dvh;--sbb-menu-max-height: calc(85vh - var(--sbb-spacing-fixed-8x));--sbb-menu-min-height: 3.03125rem;--sbb-menu-border-radius: var(--sbb-border-radius-4x);--sbb-menu-visibility: hidden;--sbb-menu-backdrop-color: transparent;--sbb-menu-color: var(--sbb-color-2-inverted);--sbb-menu-background-color: var(--sbb-background-color-1-inverted);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark);--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: color-mix(in srgb, var(--sbb-color-white) 30%, transparent);--sbb-scrollbar-color-hover: color-mix(in srgb, var(--sbb-color-white) 60%, transparent);--sbb-scrollbar-track-color: transparent}@media (min-width: 52.5rem){:host{--sbb-menu-transform-y: var(--sbb-spacing-fixed-2x);--sbb-menu-max-width: 20rem;--sbb-menu-min-width: 11.25rem;--sbb-menu-back-button-display: none}}:host(:is([data-state=opened],[data-state=opening])){--sbb-menu-visibility: visible;--sbb-menu-backdrop-color: color-mix(in srgb, var(--sbb-color-black) 20%, transparent)}@media (min-width: 52.5rem){:host(:is([data-state=opened],[data-state=opening])){--sbb-menu-backdrop-color: transparent}}:host(:not(:is(:state(nested),[state--nested]))){--sbb-menu-back-button-display: none}:host(:not([data-state=closed])){--sbb-menu-inset: 0}:host(:is(:state(dark),[state--dark])){--sbb-focus-outline-color: var(--sbb-focus-outline-color-default);--sbb-scrollbar-color: color-mix(in srgb, var(--sbb-color-black) 30%, transparent);--sbb-scrollbar-color-hover: color-mix(in srgb, var(--sbb-color-black) 60%, transparent)}@media (max-width: 52.4375rem){:host(:is(:state(skip-animation),[state--skip-animation])){--sbb-menu-animation-duration: 0ms}:host(:is(:state(nested-child),[state--nested-child])){--sbb-menu-transform-x: -100%}:host(:is(:state(nested),[state--nested])[data-state]:not([data-state=closed])){--sbb-menu-open-animation-name: open-sideways}:host([data-state][data-state=closing]:is(:state(nested),[state--nested]):not(:is(:state(close-all),[state--close-all]))){--sbb-menu-close-animation-name: close-sideways}}::slotted(:not(sbb-menu-button,sbb-menu-link,sbb-divider)){display:block;padding-inline:var(--sbb-spacing-fixed-5x)}sbb-divider,::slotted(sbb-divider){--sbb-divider-color: var(--sbb-background-color-4-inverted);margin-block:var(--sbb-spacing-fixed-2x)}sbb-divider,#sbb-menu__back-button{display:var(--sbb-menu-back-button-display, block)}.sbb-menu__container{position:fixed;pointer-events:none;inset:var(--sbb-menu-inset);height:var(--sbb-menu-container-height);z-index:var(--sbb-menu-z-index, var(--sbb-overlay-default-z-index))}.sbb-menu__container:before{content:"";visibility:var(--sbb-menu-visibility);pointer-events:all;position:fixed;inset:var(--sbb-menu-inset);height:var(--sbb-menu-container-height);background-color:var(--sbb-menu-backdrop-color);transition-duration:var(--sbb-menu-animation-duration);transition-timing-function:var(--sbb-menu-animation-easing);transition-property:background-color,visibility}:host(:is(:state(nested),[state--nested])) .sbb-menu__container:before{display:none}.sbb-menu{display:none;opacity:0;pointer-events:none;max-width:var(--sbb-menu-max-width);min-width:var(--sbb-menu-min-width);text-align:start;position:absolute;inset-inline-start:0;inset-block-start:unset;inset-block-end:0;inset-inline-end:unset;color:var(--sbb-menu-color);border:none;border-radius:var(--sbb-menu-border-radius) var(--sbb-menu-border-radius) 0 0;background-color:var(--sbb-menu-background-color);padding:0;overflow:hidden;translate:var(--sbb-menu-transform-x) 0;transition:translate var(--sbb-menu-animation-duration)}:host([data-state]:not([data-state=closed])) .sbb-menu{display:block;opacity:1;pointer-events:all;animation-name:var(--sbb-menu-open-animation-name, open);animation-duration:var(--sbb-menu-animation-duration);animation-timing-function:var(--sbb-menu-animation-easing)}:host([data-state][data-state=closing]) .sbb-menu{pointer-events:none;animation-name:var(--sbb-menu-close-animation-name, close)}@media (forced-colors: active){.sbb-menu{outline:var(--sbb-border-width-1x) solid CanvasText}}@media (min-width: 52.5rem){.sbb-menu{top:0;bottom:unset;left:0;right:unset;max-height:fit-content;border-radius:var(--sbb-menu-border-radius)}:host(:not([data-state=closed])) .sbb-menu{top:var(--sbb-menu-position-y);left:var(--sbb-menu-position-x);max-height:var(--sbb-menu-max-height);min-height:var(--sbb-menu-min-height)}}.sbb-menu__content{--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-menu__content::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-menu__content::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-menu__content::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-menu__content::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-menu__content::-webkit-scrollbar-button,.sbb-menu__content::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-menu__content{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-menu__content{max-height:var(--sbb-menu-max-height);padding-block:var(--sbb-spacing-fixed-1x);overflow:auto;outline:none}.sbb-menu__content:after{content:"";display:block;height:var(--sbb-spacing-fixed-8x)}@media (min-width: 52.5rem){.sbb-menu__content{max-height:fit-content}:host(:not([data-state=closed])) .sbb-menu__content{max-height:var(--sbb-menu-max-height);min-height:var(--sbb-menu-min-height)}.sbb-menu__content:after{display:none}}.sbb-menu-list{list-style:none;margin:0;padding:0;font-size:inherit}::slotted(:is([data-sbb-link],[data-sbb-button])){color-scheme:only light}@keyframes open{0%{opacity:0;translate:0 var(--sbb-menu-transform-y)}to{opacity:1;translate:0 0}}@keyframes close{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 var(--sbb-menu-transform-y)}}@keyframes open-sideways{0%{translate:100% 0}to{translate:0 0}}@keyframes close-sideways{0%{translate:0 0}to{translate:100% 0}}`, N = 8, ie = -4, ne = [
|
|
19
22
|
"A",
|
|
20
23
|
"BUTTON",
|
|
21
24
|
"SBB-BUTTON",
|
|
@@ -23,25 +26,29 @@ const J = T`*,:before,:after{box-sizing:border-box}:host{display:contents;--sbb-
|
|
|
23
26
|
"SBB-LINK",
|
|
24
27
|
"SBB-BLOCK-LINK",
|
|
25
28
|
"SBB-LINK-BUTTON",
|
|
26
|
-
"SBB-BLOCK-LINK-BUTTON"
|
|
29
|
+
"SBB-BLOCK-LINK-BUTTON",
|
|
30
|
+
"SBB-MENU-BUTTON",
|
|
31
|
+
"SBB-MENU-LINK"
|
|
27
32
|
];
|
|
28
|
-
let
|
|
29
|
-
var l, b,
|
|
30
|
-
let
|
|
31
|
-
return
|
|
33
|
+
let re = 0, Ee = (() => {
|
|
34
|
+
var l, b, a;
|
|
35
|
+
let s = [B("sbb-menu")], i, r = [], o, p = J(z), v, f = [], w = [], y, k = [], E = [];
|
|
36
|
+
return a = class extends p {
|
|
32
37
|
constructor() {
|
|
33
38
|
super();
|
|
34
39
|
g(this, l);
|
|
35
40
|
g(this, b);
|
|
36
|
-
this.listChildLocalNames = ["sbb-menu-button", "sbb-menu-link"], h(this, l,
|
|
37
|
-
[
|
|
41
|
+
this.listChildLocalNames = ["sbb-menu-button", "sbb-menu-link"], h(this, l, u(this, f, null)), h(this, b, (u(this, w), u(this, k, ""))), this._menu = u(this, E), this._triggerElement = null, this._isPointerDownEventOnMenu = !1, this._escapableOverlayController = new R(this), this._focusTrapController = new I(this), this._scrollHandler = new V(), this._inertController = new K(this), this._mobileBreakpoint = $, this._mediaMatcher = new H(this, {
|
|
42
|
+
[this._mobileBreakpoint]: (e) => {
|
|
38
43
|
e && (this.state === "opening" || this.state === "opened") ? this._scrollHandler.disableScroll() : this._scrollHandler.enableScroll();
|
|
39
44
|
}
|
|
40
|
-
}), this._darkModeController = new
|
|
41
|
-
|
|
45
|
+
}), this._darkModeController = new q(this, () => this._syncNegative()), this._language = new F(this), this._nestedMenu = null, this._pointerDownListener = (e) => {
|
|
46
|
+
const t = e.target.closest("sbb-menu");
|
|
47
|
+
this._isPointerDownEventOnMenu = A(this._menu, e) || this._nestedMenus().some((n) => t === n);
|
|
42
48
|
}, this._closeOnBackdropClick = (e) => {
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
const t = e.target;
|
|
50
|
+
!this._isPointerDownEventOnMenu && !A(this._menu, e) && !this._nestedMenus().some((n) => n === t) && this.closeAll();
|
|
51
|
+
}, this.addEventListener?.("keydown", (e) => this._handleKeyDown(e));
|
|
45
52
|
}
|
|
46
53
|
/**
|
|
47
54
|
* The element that will trigger the menu overlay.
|
|
@@ -49,7 +56,7 @@ let te = 0, pe = (() => {
|
|
|
49
56
|
* For attribute usage, provide an id reference.
|
|
50
57
|
*/
|
|
51
58
|
get trigger() {
|
|
52
|
-
return
|
|
59
|
+
return m(this, l);
|
|
53
60
|
}
|
|
54
61
|
set trigger(e) {
|
|
55
62
|
h(this, l, e);
|
|
@@ -59,54 +66,75 @@ let te = 0, pe = (() => {
|
|
|
59
66
|
* Used only if the menu automatically renders the actions inside as a list.
|
|
60
67
|
*/
|
|
61
68
|
get listAccessibilityLabel() {
|
|
62
|
-
return
|
|
69
|
+
return m(this, b);
|
|
63
70
|
}
|
|
64
71
|
set listAccessibilityLabel(e) {
|
|
65
72
|
h(this, b, e);
|
|
66
73
|
}
|
|
74
|
+
firstUpdated(e) {
|
|
75
|
+
super.firstUpdated(e), this._configureTrigger();
|
|
76
|
+
}
|
|
77
|
+
escapeStrategy() {
|
|
78
|
+
this.closeAll();
|
|
79
|
+
}
|
|
67
80
|
/**
|
|
68
81
|
* Opens the menu on trigger click.
|
|
69
82
|
*/
|
|
70
83
|
open() {
|
|
71
|
-
this.state === "closing" ||
|
|
84
|
+
if (!(this.state === "closing" || this.state === "opened" || !this._menu || !this.dispatchBeforeOpenEvent())) {
|
|
85
|
+
if (this._isNested()) {
|
|
86
|
+
const e = this._parentMenu();
|
|
87
|
+
e.toggleState("nested-child", !0), e._nestedMenu !== this && e._nestedMenu?.close(), e._nestedMenu = this;
|
|
88
|
+
}
|
|
89
|
+
this.showPopover?.(), this.state = "opening", this._setMenuPosition(), this._triggerElement?.setAttribute("aria-expanded", "true"), this._isMobile() && this._scrollHandler.disableScroll(), this._isZeroAnimationDuration() && this._handleOpening();
|
|
90
|
+
}
|
|
72
91
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Closes the menu.
|
|
75
|
-
*/
|
|
92
|
+
/** Closes the menu and all its nested menus. */
|
|
76
93
|
close() {
|
|
77
|
-
this.
|
|
94
|
+
this._close();
|
|
95
|
+
}
|
|
96
|
+
/** Closes the menu and all related menus nested and parent menus). */
|
|
97
|
+
closeAll() {
|
|
98
|
+
this._mainMenu()._close(!0);
|
|
99
|
+
}
|
|
100
|
+
/** @param [closeAll='false'] - If true, it ensures animations are correct by toggling some states when closing all related menus at once. */
|
|
101
|
+
_close(e = !1) {
|
|
102
|
+
if (!(this.state === "opening" && !this._isNested() || !this.dispatchBeforeCloseEvent())) {
|
|
103
|
+
if (this._nestedMenu?._close(e), this._isNested()) {
|
|
104
|
+
const t = this._parentMenu();
|
|
105
|
+
this.toggleState("close-all", e), t.toggleState("skip-animation", e), t.toggleState("nested-child", !1), t._nestedMenu = null;
|
|
106
|
+
}
|
|
107
|
+
this.state = "closing", this._triggerElement?.setAttribute("aria-expanded", "false"), this._isZeroAnimationDuration() && this._handleClosing();
|
|
108
|
+
}
|
|
78
109
|
}
|
|
79
110
|
_isZeroAnimationDuration() {
|
|
80
|
-
return
|
|
111
|
+
return W(this, "--sbb-menu-animation-duration");
|
|
81
112
|
}
|
|
82
113
|
_handleOpening() {
|
|
83
|
-
this.state = "opened", this._inertController.activate(), this._escapableOverlayController.connect(), this._focusTrapController.focusInitialElement(), this._focusTrapController.enabled = !0, this._attachWindowEvents(), this.dispatchOpenEvent();
|
|
114
|
+
this.state = "opened", this._isNested() ? this._updateNestedInert() : this._inertController.activate(), this._escapableOverlayController.connect(), this._focusTrapController.focusInitialElement(), this._focusTrapController.enabled = !0, this._attachWindowEvents(), this.dispatchOpenEvent();
|
|
84
115
|
}
|
|
85
116
|
_handleClosing() {
|
|
86
|
-
this.state = "closed", this.hidePopover?.(), this._menu?.firstElementChild?.scrollTo(0, 0), this._inertController.deactivate(), this._triggerElement?.focus({
|
|
117
|
+
this.state = "closed", this.toggleState("skip-animation", !1), this.toggleState("close-all", !1), this.hidePopover?.(), this._menu?.firstElementChild?.scrollTo(0, 0), this._isNested() ? this._updateNestedInert() : this._inertController.deactivate(), this._triggerElement?.focus({
|
|
87
118
|
// When inside the sbb-header, we prevent the scroll to avoid the snapping to the top of the page
|
|
88
|
-
preventScroll:
|
|
119
|
+
preventScroll: ["sbb-header-button", "sbb-header-link"].includes(this._triggerElement.localName)
|
|
89
120
|
}), this._escapableOverlayController.disconnect(), this.dispatchCloseEvent(), this._windowEventsController?.abort(), this._focusTrapController.enabled = !1, this._scrollHandler.enableScroll();
|
|
90
121
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Handles click and checks if its target is a sbb-menu-button/sbb-menu-link.
|
|
93
|
-
*/
|
|
94
|
-
_onClick(e) {
|
|
95
|
-
const t = e.target;
|
|
96
|
-
(t?.localName === "sbb-menu-button" || t?.localName === "sbb-menu-link") && this.close();
|
|
97
|
-
}
|
|
98
122
|
_handleKeyDown(e) {
|
|
99
123
|
if (!P(e))
|
|
100
124
|
return;
|
|
101
125
|
e.preventDefault();
|
|
102
|
-
const t = Array.from(this.querySelectorAll("sbb-menu-button, sbb-menu-link")).filter((d) => (!d.disabled || d.disabledInteractive) && D.isVisible(d)),
|
|
126
|
+
const t = Array.from(this.querySelectorAll("sbb-menu-button, sbb-menu-link")).concat(this.shadowRoot.querySelector("sbb-menu-button")).filter((d) => (!d.disabled || d.disabledInteractive) && D.isVisible(d)), n = t.findIndex((d) => d === e.target);
|
|
103
127
|
let c;
|
|
104
128
|
switch (e.key) {
|
|
105
129
|
case "ArrowUp":
|
|
106
130
|
case "ArrowDown":
|
|
131
|
+
c = U(e, n, t.length);
|
|
132
|
+
break;
|
|
107
133
|
case "ArrowLeft":
|
|
134
|
+
this._isNested() && this.close();
|
|
135
|
+
break;
|
|
108
136
|
case "ArrowRight":
|
|
109
|
-
|
|
137
|
+
e.target.hasAttribute("data-sbb-menu-trigger") && e.target.click();
|
|
110
138
|
break;
|
|
111
139
|
case "PageUp":
|
|
112
140
|
case "Home":
|
|
@@ -116,11 +144,8 @@ let te = 0, pe = (() => {
|
|
|
116
144
|
case "PageDown":
|
|
117
145
|
c = t.length - 1;
|
|
118
146
|
break;
|
|
119
|
-
// this should never happen since all the case allowed by `isArrowKeyOrPageKeysPressed` should be covered
|
|
120
|
-
default:
|
|
121
|
-
c = 0;
|
|
122
147
|
}
|
|
123
|
-
t[c].focus();
|
|
148
|
+
c !== void 0 && t[c].focus();
|
|
124
149
|
}
|
|
125
150
|
// Removes trigger click listener on trigger change.
|
|
126
151
|
createRenderRoot() {
|
|
@@ -132,25 +157,22 @@ let te = 0, pe = (() => {
|
|
|
132
157
|
}), e;
|
|
133
158
|
}
|
|
134
159
|
connectedCallback() {
|
|
135
|
-
this.popover = "manual", super.connectedCallback(), this.id ||= `sbb-menu-${
|
|
160
|
+
this.popover = "manual", super.connectedCallback(), this.id ||= `sbb-menu-${re++}`, this.hasUpdated && this._configureTrigger();
|
|
136
161
|
}
|
|
137
162
|
disconnectedCallback() {
|
|
138
163
|
super.disconnectedCallback(), this._triggerElement = null, this._triggerAbortController?.abort(), this._windowEventsController?.abort(), this._scrollHandler.enableScroll();
|
|
139
164
|
}
|
|
140
|
-
requestUpdate(e, t,
|
|
141
|
-
super.requestUpdate(e, t,
|
|
142
|
-
}
|
|
143
|
-
firstUpdated(e) {
|
|
144
|
-
super.firstUpdated(e), this._configureTrigger();
|
|
165
|
+
requestUpdate(e, t, n) {
|
|
166
|
+
super.requestUpdate(e, t, n), !O && (!e || e === "trigger") && this.hasUpdated && this._configureTrigger();
|
|
145
167
|
}
|
|
146
168
|
_checkListCase(e) {
|
|
147
169
|
this.children?.length && Array.from(this.children ?? []).every((t) => t.localName === "sbb-menu-button" || t.localName === "sbb-menu-link") || (e.stopImmediatePropagation(), this.listChildren.length && (this.listChildren.forEach((t) => t.removeAttribute("slot")), this.listChildren = []));
|
|
148
170
|
}
|
|
149
171
|
// Check if the trigger is valid and attach click event listeners.
|
|
150
172
|
_configureTrigger() {
|
|
151
|
-
this.trigger !== this._triggerElement && (this._triggerAbortController?.abort(),
|
|
173
|
+
this.trigger !== this._triggerElement && (this._triggerAbortController?.abort(), X(this._triggerElement), this._triggerElement = this.trigger, this._triggerElement && (Y(this._triggerElement, "menu", this.id, this.state), this._triggerAbortController = new AbortController(), this._triggerElement.addEventListener("click", () => this.open(), {
|
|
152
174
|
signal: this._triggerAbortController.signal
|
|
153
|
-
})));
|
|
175
|
+
}), this.toggleState("nested", ["sbb-menu-button", "sbb-menu-link"].includes(this._triggerElement.localName)), this._triggerElement.toggleAttribute("data-sbb-menu-trigger", !0)));
|
|
154
176
|
}
|
|
155
177
|
_attachWindowEvents() {
|
|
156
178
|
this._windowEventsController = new AbortController(), document.addEventListener("scroll", () => this._setMenuPosition(), {
|
|
@@ -162,30 +184,60 @@ let te = 0, pe = (() => {
|
|
|
162
184
|
}), window.addEventListener("resize", () => this._setMenuPosition(), {
|
|
163
185
|
passive: !0,
|
|
164
186
|
signal: this._windowEventsController.signal
|
|
165
|
-
}), window.addEventListener("pointerdown", this._pointerDownListener, {
|
|
187
|
+
}), this._isNested() || (window.addEventListener("pointerdown", this._pointerDownListener, {
|
|
166
188
|
signal: this._windowEventsController.signal
|
|
167
189
|
}), window.addEventListener("pointerup", this._closeOnBackdropClick, {
|
|
168
190
|
signal: this._windowEventsController.signal
|
|
169
|
-
});
|
|
191
|
+
}));
|
|
170
192
|
}
|
|
171
193
|
// Close menu at any click on an interactive element inside the <sbb-menu> that bubbles to the container.
|
|
172
|
-
|
|
194
|
+
_interactiveElementClick(e) {
|
|
173
195
|
const t = e.target;
|
|
174
|
-
|
|
196
|
+
ne.includes(t.nodeName) && !t.hasAttribute("disabled") && !t.hasAttribute("data-sbb-menu-trigger") && t.id !== "sbb-menu__back-button" && this.closeAll();
|
|
197
|
+
}
|
|
198
|
+
/** Converts the linked list into an array of SbbMenuElement. */
|
|
199
|
+
_nestedMenus() {
|
|
200
|
+
const e = [];
|
|
201
|
+
let t = this._nestedMenu;
|
|
202
|
+
for (; t; )
|
|
203
|
+
e.push(t), t = t._nestedMenu;
|
|
204
|
+
return e;
|
|
205
|
+
}
|
|
206
|
+
_parentMenu() {
|
|
207
|
+
return this._triggerElement?.closest("sbb-menu") ?? null;
|
|
208
|
+
}
|
|
209
|
+
/** The outermost menu. */
|
|
210
|
+
_mainMenu() {
|
|
211
|
+
return this._isNested() ? this._parentMenu()?._mainMenu() ?? this : this;
|
|
212
|
+
}
|
|
213
|
+
_isNested() {
|
|
214
|
+
return !!this._parentMenu();
|
|
215
|
+
}
|
|
216
|
+
_updateNestedInert() {
|
|
217
|
+
this._inertController.restoreAllExempted(), this._mainMenu()._nestedMenus().forEach((e) => this._inertController.exempt(e));
|
|
218
|
+
}
|
|
219
|
+
// Check if nested menu should be closed.
|
|
220
|
+
_handleMouseOver(e) {
|
|
221
|
+
const t = e.target, n = this._isMobile();
|
|
222
|
+
!n && this._nestedMenu && !t.classList.contains("sbb-menu__content") && t.getAttribute("aria-expanded") !== "true" && this._nestedMenu.close(), t.hasAttribute("data-sbb-menu-trigger") && !n && t.click();
|
|
175
223
|
}
|
|
176
224
|
// Set menu position (x, y) to '0' once the menu is closed and the transition ended to prevent the
|
|
177
225
|
// viewport from overflowing. And set the focus to the first focusable element once the menu is open.
|
|
178
226
|
// In rare cases it can be that the animationEnd event is triggered twice.
|
|
179
227
|
// To avoid entering a corrupt state, exit when state is not expected.
|
|
180
228
|
_onMenuAnimationEnd(e) {
|
|
181
|
-
e.animationName === "open" && this.state === "opening" ? this._handleOpening() : e.animationName === "close" && this.state === "closing" && this._handleClosing();
|
|
229
|
+
(e.animationName === "open" || e.animationName === "open-sideways") && this.state === "opening" ? this._handleOpening() : (e.animationName === "close" || e.animationName === "close-sideways") && this.state === "closing" && this._handleClosing();
|
|
182
230
|
}
|
|
183
231
|
// Set menu position and max height if the breakpoint is medium-ultra.
|
|
184
232
|
_setMenuPosition() {
|
|
185
|
-
if (
|
|
233
|
+
if (this._isMobile() || !this._menu || !this._triggerElement || this.state === "closing")
|
|
186
234
|
return;
|
|
187
|
-
const e =
|
|
188
|
-
|
|
235
|
+
const e = this._isNested() ? te(this.shadowRoot.querySelector(".sbb-menu__content"), this._triggerElement, this.shadowRoot.querySelector(".sbb-menu__container"), {
|
|
236
|
+
horizontalOffset: N,
|
|
237
|
+
verticalOffset: ie,
|
|
238
|
+
contentSelector: ".sbb-menu__content"
|
|
239
|
+
}) : ee(this.shadowRoot.querySelector(".sbb-menu__content"), this._triggerElement, this.shadowRoot.querySelector(".sbb-menu__container"), {
|
|
240
|
+
verticalOffset: N
|
|
189
241
|
});
|
|
190
242
|
this.style.setProperty("--sbb-menu-position-x", `${e.left}px`), this.style.setProperty("--sbb-menu-position-y", `${e.top}px`), this.style.setProperty("--sbb-menu-max-height", e.maxHeight);
|
|
191
243
|
}
|
|
@@ -194,34 +246,46 @@ let te = 0, pe = (() => {
|
|
|
194
246
|
customElements.upgrade(e), e.negative = !this._darkModeController.matches();
|
|
195
247
|
});
|
|
196
248
|
}
|
|
249
|
+
_isMobile() {
|
|
250
|
+
return this._mediaMatcher.matches(this._mobileBreakpoint) ?? !0;
|
|
251
|
+
}
|
|
197
252
|
render() {
|
|
198
|
-
return
|
|
253
|
+
return M`
|
|
199
254
|
<div class="sbb-menu__container">
|
|
200
255
|
<div
|
|
201
256
|
@animationend=${this._onMenuAnimationEnd}
|
|
257
|
+
@mouseover=${(e) => this._handleMouseOver(e)}
|
|
202
258
|
class="sbb-menu"
|
|
203
|
-
${
|
|
259
|
+
${T((e) => this._menu = e)}
|
|
204
260
|
>
|
|
205
261
|
<div
|
|
206
|
-
@click=${(e) => this.
|
|
207
|
-
@scroll=${(e) =>
|
|
262
|
+
@click=${(e) => this._interactiveElementClick(e)}
|
|
263
|
+
@scroll=${(e) => G(e, document)}
|
|
208
264
|
class="sbb-menu__content"
|
|
209
265
|
>
|
|
210
|
-
${this.listChildren.length ? this.renderList({ class: "sbb-menu-list", ariaLabel: this.listAccessibilityLabel }) :
|
|
266
|
+
${this.listChildren.length ? this.renderList({ class: "sbb-menu-list", ariaLabel: this.listAccessibilityLabel }) : M`<slot></slot>`}
|
|
267
|
+
<sbb-divider></sbb-divider>
|
|
268
|
+
<sbb-menu-button
|
|
269
|
+
id="sbb-menu__back-button"
|
|
270
|
+
@click=${() => this.close()}
|
|
271
|
+
icon-name="chevron-small-left-small"
|
|
272
|
+
>
|
|
273
|
+
${Q[this._language.current]}
|
|
274
|
+
</sbb-menu-button>
|
|
211
275
|
</div>
|
|
212
276
|
</div>
|
|
213
277
|
</div>
|
|
214
278
|
`;
|
|
215
279
|
}
|
|
216
|
-
}, l = new WeakMap(), b = new WeakMap(),
|
|
217
|
-
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
218
|
-
|
|
219
|
-
t.trigger =
|
|
220
|
-
} }, metadata: e },
|
|
221
|
-
t.listAccessibilityLabel =
|
|
222
|
-
} }, metadata: e },
|
|
223
|
-
})(),
|
|
280
|
+
}, l = new WeakMap(), b = new WeakMap(), o = a, (() => {
|
|
281
|
+
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(p[Symbol.metadata] ?? null) : void 0;
|
|
282
|
+
v = [Z(), S()], y = [j(), S({ attribute: "list-accessibility-label" })], _(a, null, v, { kind: "accessor", name: "trigger", static: !1, private: !1, access: { has: (t) => "trigger" in t, get: (t) => t.trigger, set: (t, n) => {
|
|
283
|
+
t.trigger = n;
|
|
284
|
+
} }, metadata: e }, f, w), _(a, null, y, { kind: "accessor", name: "listAccessibilityLabel", static: !1, private: !1, access: { has: (t) => "listAccessibilityLabel" in t, get: (t) => t.listAccessibilityLabel, set: (t, n) => {
|
|
285
|
+
t.listAccessibilityLabel = n;
|
|
286
|
+
} }, metadata: e }, k, E), _(null, i = { value: o }, s, { kind: "class", name: o.name, metadata: e }, null, r), o = i.value, e && Object.defineProperty(o, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
287
|
+
})(), a.styles = se, a.role = "menu", u(o, r), o;
|
|
224
288
|
})();
|
|
225
289
|
export {
|
|
226
|
-
|
|
290
|
+
Ee as SbbMenuElement
|
|
227
291
|
};
|
package/off-brand-theme.css
CHANGED
|
@@ -2015,6 +2015,12 @@ sbb-status:has(sbb-title) {
|
|
|
2015
2015
|
pointer-events: none;
|
|
2016
2016
|
}
|
|
2017
2017
|
|
|
2018
|
+
.sbb-options-nowrap {
|
|
2019
|
+
--sbb-option-text-overflow: ellipsis;
|
|
2020
|
+
--sbb-option-overflow: hidden;
|
|
2021
|
+
--sbb-option-white-space: nowrap;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2018
2024
|
sub {
|
|
2019
2025
|
bottom: -0.36em;
|
|
2020
2026
|
}
|
|
@@ -3,7 +3,7 @@ import { css as d, nothing as e, html as s } from "lit";
|
|
|
3
3
|
import { customElement as p } from "lit/decorators.js";
|
|
4
4
|
import { SbbOptionBaseElement as u } from "./option-base-element.js";
|
|
5
5
|
import "../../visual-checkbox.js";
|
|
6
|
-
const h = d`*,:before,:after{box-sizing:border-box}:host{--sbb-option-color: var(--sbb-color-3);--sbb-option-background-color: inherit;--sbb-option-background-color-hover: var(--sbb-background-color-3);--sbb-option-background-color-active: var(--sbb-background-color-4);--sbb-option-disabled-border-color: var(--sbb-color-graphite);--sbb-option-disabled-border-color: light-dark(var(--sbb-color-graphite), var(--sbb-color-smoke));--sbb-option-disabled-background-color: var(--sbb-background-color-3);--sbb-option-padding-inline: var(--sbb-spacing-responsive-xxxs);--sbb-option-min-height: var(--sbb-size-element-s);--sbb-option-column-gap: var(--sbb-spacing-responsive-xxxs);--sbb-option-justify-content: start;--sbb-option-cursor: pointer;--sbb-option-border-radius: var(--sbb-border-radius-4x);--sbb-option-icon-color: var(--sbb-color-metal);--sbb-option-icon-color: light-dark(var(--sbb-color-metal), var(--sbb-color-smoke));--sbb-option-focus-outline-color: transparent;--sbb-option-focus-outline-inset: var(--sbb-spacing-fixed-1x);display:block}:host([data-negative]){--sbb-option-color: var(--sbb-color-3-negative);--sbb-option-icon-color: var(--sbb-color-5);--sbb-option-background-color-hover: var(--sbb-background-color-3-negative);--sbb-option-background-color-active: var(--sbb-background-color-4-negative);--sbb-option-disabled-border-color: var(--sbb-border-color-5);--sbb-option-disabled-background-color: var(--sbb-background-color-3-negative);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark)}@media (any-hover: hover){:host(:hover:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-hover)}}:host(:active:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-active)}:host(:not([data-disable-highlight])) .sbb-option__label slot{display:none}:host(:is([data-group-disabled],[disabled])){--sbb-option-cursor: default}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled])){--sbb-option-color: GrayText}}:host([data-variant=select]){--sbb-option-column-gap: var(--sbb-spacing-fixed-2x);--sbb-option-justify-content: space-between}:host([data-variant=select][data-multiple]){--sbb-option-justify-content: start}:host([data-active]){--sbb-option-focus-outline-color: var(--sbb-focus-outline-color)}:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{font-weight:700}@media (forced-colors: active){:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{color:Highlight}}.sbb-option__container{background-color:var(--sbb-option-background-color)}.sbb-option{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);position:relative;display:flex;min-height:var(--sbb-option-min-height);align-items:center;column-gap:var(--sbb-option-column-gap);padding-inline:var(--sbb-option-padding-inline);justify-content:var(--sbb-option-justify-content);color:var(--sbb-option-color);cursor:var(--sbb-option-cursor);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--sbb-option-color)}.sbb-option:after{content:"";display:block;position:absolute;inset:var(--sbb-option-focus-outline-inset);pointer-events:none;border:var(--sbb-focus-outline-width) solid var(--sbb-option-focus-outline-color);border-radius:var(--sbb-option-border-radius)}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option{position:relative;z-index:0}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{content:"";display:block;position:absolute;inset:.375rem;border:var(--sbb-border-width-1x) dashed var(--sbb-option-disabled-border-color);border-radius:var(--sbb-border-radius-2x);background-color:var(--sbb-option-disabled-background-color);z-index:-1}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{border-color:GrayText}}.sbb-option__icon{display:flex;min-width:var(--sbb-size-icon-ui-small);min-height:var(--sbb-size-icon-ui-small);color:var(--sbb-option-icon-color)}:host(:not([data-slot-names~=icon],[icon-name])) .sbb-option__icon{display:var(--sbb-option-icon-container-display, none)}.sbb-option__label{white-space:initial}`;
|
|
6
|
+
const h = d`*,:before,:after{box-sizing:border-box}:host{--sbb-option-color: var(--sbb-color-3);--sbb-option-background-color: inherit;--sbb-option-background-color-hover: var(--sbb-background-color-3);--sbb-option-background-color-active: var(--sbb-background-color-4);--sbb-option-disabled-border-color: var(--sbb-color-graphite);--sbb-option-disabled-border-color: light-dark(var(--sbb-color-graphite), var(--sbb-color-smoke));--sbb-option-disabled-background-color: var(--sbb-background-color-3);--sbb-option-padding-inline: var(--sbb-spacing-responsive-xxxs);--sbb-option-min-height: var(--sbb-size-element-s);--sbb-option-column-gap: var(--sbb-spacing-responsive-xxxs);--sbb-option-justify-content: start;--sbb-option-cursor: pointer;--sbb-option-border-radius: var(--sbb-border-radius-4x);--sbb-option-icon-color: var(--sbb-color-metal);--sbb-option-icon-color: light-dark(var(--sbb-color-metal), var(--sbb-color-smoke));--sbb-option-focus-outline-color: transparent;--sbb-option-focus-outline-inset: var(--sbb-spacing-fixed-1x);display:block}:host([data-negative]){--sbb-option-color: var(--sbb-color-3-negative);--sbb-option-icon-color: var(--sbb-color-5);--sbb-option-background-color-hover: var(--sbb-background-color-3-negative);--sbb-option-background-color-active: var(--sbb-background-color-4-negative);--sbb-option-disabled-border-color: var(--sbb-border-color-5);--sbb-option-disabled-background-color: var(--sbb-background-color-3-negative);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark)}@media (any-hover: hover){:host(:hover:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-hover)}}:host(:active:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-active)}:host(:not([data-disable-highlight])) .sbb-option__label slot{display:none}:host(:is([data-group-disabled],[disabled])){--sbb-option-cursor: default}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled])){--sbb-option-color: GrayText}}:host([data-variant=select]){--sbb-option-column-gap: var(--sbb-spacing-fixed-2x);--sbb-option-justify-content: space-between}:host([data-variant=select][data-multiple]){--sbb-option-justify-content: start}:host([data-active]){--sbb-option-focus-outline-color: var(--sbb-focus-outline-color)}:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{font-weight:700}@media (forced-colors: active){:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{color:Highlight}}.sbb-option__container{background-color:var(--sbb-option-background-color)}.sbb-option{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);position:relative;display:flex;min-height:var(--sbb-option-min-height);align-items:center;column-gap:var(--sbb-option-column-gap);padding-inline:var(--sbb-option-padding-inline);justify-content:var(--sbb-option-justify-content);color:var(--sbb-option-color);cursor:var(--sbb-option-cursor);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--sbb-option-color)}.sbb-option:after{content:"";display:block;position:absolute;inset:var(--sbb-option-focus-outline-inset);pointer-events:none;border:var(--sbb-focus-outline-width) solid var(--sbb-option-focus-outline-color);border-radius:var(--sbb-option-border-radius)}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option{position:relative;z-index:0}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{content:"";display:block;position:absolute;inset:.375rem;border:var(--sbb-border-width-1x) dashed var(--sbb-option-disabled-border-color);border-radius:var(--sbb-border-radius-2x);background-color:var(--sbb-option-disabled-background-color);z-index:-1}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{border-color:GrayText}}.sbb-option__icon{display:flex;min-width:var(--sbb-size-icon-ui-small);min-height:var(--sbb-size-icon-ui-small);color:var(--sbb-option-icon-color)}:host(:not([data-slot-names~=icon],[icon-name])) .sbb-option__icon{display:var(--sbb-option-icon-container-display, none)}.sbb-option__label{text-overflow:var(--sbb-option-text-overflow);overflow:var(--sbb-option-overflow);white-space:var(--sbb-option-white-space, initial)}`;
|
|
7
7
|
let k = (() => {
|
|
8
8
|
var o;
|
|
9
9
|
let n = [p("sbb-option")], a, b = [], i, r = u;
|
package/package.json
CHANGED
package/safety-theme.css
CHANGED
|
@@ -2015,6 +2015,12 @@ sbb-status:has(sbb-title) {
|
|
|
2015
2015
|
pointer-events: none;
|
|
2016
2016
|
}
|
|
2017
2017
|
|
|
2018
|
+
.sbb-options-nowrap {
|
|
2019
|
+
--sbb-option-text-overflow: ellipsis;
|
|
2020
|
+
--sbb-option-overflow: hidden;
|
|
2021
|
+
--sbb-option-white-space: nowrap;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2018
2024
|
sub {
|
|
2019
2025
|
bottom: -0.36em;
|
|
2020
2026
|
}
|
package/standard-theme.css
CHANGED
|
@@ -2015,6 +2015,12 @@ sbb-status:has(sbb-title) {
|
|
|
2015
2015
|
pointer-events: none;
|
|
2016
2016
|
}
|
|
2017
2017
|
|
|
2018
|
+
.sbb-options-nowrap {
|
|
2019
|
+
--sbb-option-text-overflow: ellipsis;
|
|
2020
|
+
--sbb-option-overflow: hidden;
|
|
2021
|
+
--sbb-option-white-space: nowrap;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2018
2024
|
sub {
|
|
2019
2025
|
bottom: -0.36em;
|
|
2020
2026
|
}
|
|
@@ -2,19 +2,25 @@ import { CSSResultGroup, TemplateResult, LitElement } from 'lit';
|
|
|
2
2
|
import { SbbTabLabelElement } from '../tab-label.js';
|
|
3
3
|
declare const SbbTabElement_base: import('../../core/mixins.js').AbstractConstructor<import('../../core/mixins.js').SbbElementInternalsMixinType> & typeof LitElement & import('../../core/mixins.js').SbbElementInternalsConstructor;
|
|
4
4
|
/**
|
|
5
|
-
* Combined with a `sbb-tab-group`, it displays a tab's content.
|
|
5
|
+
* Combined with a `sbb-tab-group` and `sbb-tab-label`, it displays a tab's content.
|
|
6
6
|
*
|
|
7
7
|
* @slot - Use the unnamed slot to provide content.
|
|
8
|
+
* @event {Event} active - The `active` event fires when the sbb-tab has been activated via user selection on the sbb-tab-label.
|
|
8
9
|
*/
|
|
9
10
|
export declare class SbbTabElement extends SbbTabElement_base {
|
|
10
11
|
static role: string;
|
|
11
12
|
static styles: CSSResultGroup;
|
|
13
|
+
static readonly events: {
|
|
14
|
+
readonly active: "active";
|
|
15
|
+
};
|
|
12
16
|
/** The `sbb-tab-label` associated with the tab. */
|
|
13
17
|
get label(): SbbTabLabelElement | null;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
/**
|
|
19
|
+
* @internal
|
|
20
|
+
* @deprecated
|
|
21
|
+
*/
|
|
17
22
|
configure(): void;
|
|
23
|
+
connectedCallback(): void;
|
|
18
24
|
protected render(): TemplateResult;
|
|
19
25
|
}
|
|
20
26
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab.component.d.ts","sourceRoot":"","sources":["../../../../src/elements/tabs/tab/tab.component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAIvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;;
|
|
1
|
+
{"version":3,"file":"tab.component.d.ts","sourceRoot":"","sources":["../../../../src/elements/tabs/tab/tab.component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAIvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;;AAM1D;;;;;GAKG;AACH,qBAEM,aAAc,SAAQ,kBAAoC;IAC9D,OAAuB,IAAI,SAAc;IACzC,OAAuB,MAAM,EAAE,cAAc,CAAS;IACtD,gBAAuB,MAAM;;MAElB;IAEX,mDAAmD;IACnD,IAAW,KAAK,IAAI,kBAAkB,GAAG,IAAI,CAI5C;IAED;;;OAGG;IACI,SAAS,IAAI,IAAI;IAER,iBAAiB,IAAI,IAAI;cAOtB,MAAM,IAAI,cAAc;CAO5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,SAAS,EAAE,aAAa,CAAC;KAC1B;CACF"}
|
|
@@ -1,28 +1,24 @@
|
|
|
1
|
-
import { __esDecorate as
|
|
2
|
-
import { css as
|
|
3
|
-
import { customElement as
|
|
4
|
-
import { SbbElementInternalsMixin as
|
|
5
|
-
const h =
|
|
6
|
-
let
|
|
1
|
+
import { __esDecorate as n, __runInitializers as o } from "tslib";
|
|
2
|
+
import { css as b, LitElement as c, html as m } from "lit";
|
|
3
|
+
import { customElement as d } from "lit/decorators.js";
|
|
4
|
+
import { SbbElementInternalsMixin as u } from "../../core/mixins.js";
|
|
5
|
+
const h = b`@charset "UTF-8";*,:before,:after{box-sizing:border-box}:host{display:block}:host:after,:host:before{content:" ";display:block;visibility:hidden;height:0;overflow:hidden}`;
|
|
6
|
+
let f = 0, S = (() => {
|
|
7
7
|
var t;
|
|
8
|
-
let r = [
|
|
8
|
+
let r = [d("sbb-tab")], l, s = [], e, i = u(c);
|
|
9
9
|
return t = class extends i {
|
|
10
|
-
constructor() {
|
|
11
|
-
super(...arguments), this._label = null;
|
|
12
|
-
}
|
|
13
10
|
/** The `sbb-tab-label` associated with the tab. */
|
|
14
11
|
get label() {
|
|
15
|
-
return this.
|
|
16
|
-
}
|
|
17
|
-
_getTabLabel() {
|
|
18
|
-
let e = this.previousElementSibling;
|
|
19
|
-
for (; e && e.localName !== "sbb-tab-label"; )
|
|
20
|
-
e = e.previousElementSibling;
|
|
21
|
-
return e;
|
|
12
|
+
return this.previousElementSibling?.localName === "sbb-tab-label" ? this.previousElementSibling : null;
|
|
22
13
|
}
|
|
23
|
-
/**
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
* @deprecated
|
|
17
|
+
*/
|
|
24
18
|
configure() {
|
|
25
|
-
|
|
19
|
+
}
|
|
20
|
+
connectedCallback() {
|
|
21
|
+
super.connectedCallback(), this.id ||= `sbb-tab-${f++}`, this.tabIndex = 0;
|
|
26
22
|
}
|
|
27
23
|
render() {
|
|
28
24
|
return m`
|
|
@@ -31,11 +27,13 @@ let v = (() => {
|
|
|
31
27
|
</div>
|
|
32
28
|
`;
|
|
33
29
|
}
|
|
34
|
-
},
|
|
35
|
-
const
|
|
36
|
-
|
|
37
|
-
})(), t.role = "tabpanel", t.styles = h,
|
|
30
|
+
}, e = t, (() => {
|
|
31
|
+
const a = typeof Symbol == "function" && Symbol.metadata ? Object.create(i[Symbol.metadata] ?? null) : void 0;
|
|
32
|
+
n(null, l = { value: e }, r, { kind: "class", name: e.name, metadata: a }, null, s), e = l.value, a && Object.defineProperty(e, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: a });
|
|
33
|
+
})(), t.role = "tabpanel", t.styles = h, t.events = {
|
|
34
|
+
active: "active"
|
|
35
|
+
}, o(e, s), e;
|
|
38
36
|
})();
|
|
39
37
|
export {
|
|
40
|
-
|
|
38
|
+
S as SbbTabElement
|
|
41
39
|
};
|