@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
|
@@ -9,6 +9,9 @@ export type SbbTabChangedEventDetails = {
|
|
|
9
9
|
previousTabLabel: SbbTabLabelElement | undefined;
|
|
10
10
|
previousTab: SbbTabElement | undefined;
|
|
11
11
|
};
|
|
12
|
+
/**
|
|
13
|
+
* @deprecated
|
|
14
|
+
*/
|
|
12
15
|
export interface InterfaceSbbTabGroupActions {
|
|
13
16
|
activate(): void;
|
|
14
17
|
deactivate(): void;
|
|
@@ -16,45 +19,47 @@ export interface InterfaceSbbTabGroupActions {
|
|
|
16
19
|
disable(): void;
|
|
17
20
|
select(): void;
|
|
18
21
|
}
|
|
22
|
+
/**
|
|
23
|
+
* @deprecated
|
|
24
|
+
*/
|
|
19
25
|
export interface InterfaceSbbTabGroupTab extends SbbTabLabelElement {
|
|
20
26
|
active: boolean;
|
|
21
27
|
disabled: boolean;
|
|
22
|
-
tab
|
|
28
|
+
tab: SbbTabElement | null;
|
|
23
29
|
index?: number;
|
|
24
30
|
tabGroupActions?: InterfaceSbbTabGroupActions;
|
|
25
31
|
size: 's' | 'l' | 'xl';
|
|
26
32
|
}
|
|
27
33
|
declare const SbbTabGroupElement_base: import('../../core/mixins.js').AbstractConstructor<import('../../core/mixins.js').SbbHydrationMixinType> & typeof LitElement;
|
|
28
34
|
/**
|
|
29
|
-
* It displays one or more tabs, each one with a label and
|
|
35
|
+
* It displays one or more tabs, each one with a label and some content.
|
|
30
36
|
*
|
|
31
|
-
* @slot - Use the unnamed slot to add content to the `sbb-tab-group` via
|
|
32
|
-
*
|
|
37
|
+
* @slot - Use the unnamed slot to add content to the `sbb-tab-group` via `sbb-tab-label` and `sbb-tab` instances.
|
|
38
|
+
* @event {CustomEvent<SbbTabChangedEventDetails>} tabchange - The tabchange event is dispatched when a tab is selected.
|
|
33
39
|
*/
|
|
34
40
|
export declare class SbbTabGroupElement extends SbbTabGroupElement_base {
|
|
35
41
|
static styles: CSSResultGroup;
|
|
36
42
|
static readonly events: {
|
|
37
43
|
readonly tabchange: "tabchange";
|
|
38
44
|
};
|
|
39
|
-
private _tabs;
|
|
40
|
-
private _selectedTab?;
|
|
41
45
|
private _tabGroupElement;
|
|
42
46
|
private _tabContentElement;
|
|
43
|
-
private _tabAttributeObserver;
|
|
44
47
|
private _tabGroupResizeObserver;
|
|
45
48
|
private _tabContentResizeObserver;
|
|
46
49
|
/**
|
|
47
50
|
* Size variant, either s, l or xl.
|
|
48
51
|
* @default 'l' / 's' (lean)
|
|
49
52
|
*/
|
|
50
|
-
set size(value:
|
|
51
|
-
get size():
|
|
53
|
+
set size(value: 's' | 'l' | 'xl');
|
|
54
|
+
get size(): 's' | 'l' | 'xl';
|
|
52
55
|
private _size;
|
|
53
56
|
/**
|
|
54
57
|
* Sets the initial tab. If it matches a disabled tab or exceeds the length of
|
|
55
58
|
* the tab group, the first enabled tab will be selected.
|
|
56
59
|
*/
|
|
57
60
|
accessor initialSelectedIndex: number;
|
|
61
|
+
/** Gets the slotted `sbb-tab-label`s. */
|
|
62
|
+
get labels(): SbbTabLabelElement[];
|
|
58
63
|
constructor();
|
|
59
64
|
protected firstUpdated(changedProperties: PropertyValues<this>): void;
|
|
60
65
|
/**
|
|
@@ -72,17 +77,13 @@ export declare class SbbTabGroupElement extends SbbTabGroupElement_base {
|
|
|
72
77
|
* @param tabIndex The index of the tab you want to activate.
|
|
73
78
|
*/
|
|
74
79
|
activateTab(tabIndex: number): void;
|
|
75
|
-
private _getTabs;
|
|
76
80
|
private _enabledTabs;
|
|
77
81
|
private _updateSize;
|
|
78
82
|
private _onContentSlotChange;
|
|
79
|
-
private
|
|
80
|
-
private _assignId;
|
|
83
|
+
private _onLabelSlotChange;
|
|
81
84
|
private _initSelection;
|
|
82
|
-
private _onTabAttributesChange;
|
|
83
85
|
private _onTabGroupElementResize;
|
|
84
86
|
private _onTabContentElementResize;
|
|
85
|
-
private _configure;
|
|
86
87
|
private _handleKeyDown;
|
|
87
88
|
protected render(): TemplateResult;
|
|
88
89
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-group.component.d.ts","sourceRoot":"","sources":["../../../../src/elements/tabs/tab-group/tab-group.component.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"tab-group.component.d.ts","sourceRoot":"","sources":["../../../../src/elements/tabs/tab-group/tab-group.component.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AASvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI/C,MAAM,MAAM,yBAAyB,GAAG;IACtC,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc,EAAE,kBAAkB,CAAC;IACnC,SAAS,EAAE,aAAa,CAAC;IACzB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,EAAE,kBAAkB,GAAG,SAAS,CAAC;IACjD,WAAW,EAAE,aAAa,GAAG,SAAS,CAAC;CACxC,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,2BAA2B;IAC1C,QAAQ,IAAI,IAAI,CAAC;IACjB,UAAU,IAAI,IAAI,CAAC;IACnB,MAAM,IAAI,IAAI,CAAC;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,MAAM,IAAI,IAAI,CAAC;CAChB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAwB,SAAQ,kBAAkB;IACjE,MAAM,EAAE,OAAO,CAAC;IAChB,QAAQ,EAAE,OAAO,CAAC;IAClB,GAAG,EAAE,aAAa,GAAG,IAAI,CAAC;IAC1B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,eAAe,CAAC,EAAE,2BAA2B,CAAC;IAC9C,IAAI,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI,CAAC;CACxB;;AAED;;;;;GAKG;AACH,qBAEM,kBAAmB,SAAQ,uBAA6B;IAC5D,OAAuB,MAAM,EAAE,cAAc,CAAS;IACtD,gBAAuB,MAAM;;MAElB;IAEX,OAAO,CAAC,gBAAgB,CAAe;IACvC,OAAO,CAAC,kBAAkB,CAAe;IACzC,OAAO,CAAC,uBAAuB,CAI5B;IACH,OAAO,CAAC,yBAAyB,CAI9B;IAEH;;;OAGG;IACH,IACW,IAAI,CAAC,KAAK,EAAE,GAAG,GAAG,GAAG,GAAG,IAAI,EAGtC;IACD,IAAW,IAAI,IAAI,GAAG,GAAG,GAAG,GAAG,IAAI,CAElC;IACD,OAAO,CAAC,KAAK,CAA0C;IAEvD;;;OAGG;IACH,SAEgB,oBAAoB,EAAE,MAAM,CAAK;IAEjD,yCAAyC;IACzC,IAAW,MAAM,IAAI,kBAAkB,EAAE,CAQxC;;cAOkB,YAAY,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAS9E;;;OAGG;IACI,UAAU,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMzC;;;OAGG;IACI,SAAS,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAMxC;;;OAGG;IACI,WAAW,CAAC,QAAQ,EAAE,MAAM,GAAG,IAAI;IAI1C,OAAO,CAAC,YAAY;IAOpB,OAAO,CAAC,WAAW;IAMnB,OAAO,CAAC,oBAAoB,CAG1B;IAEF,OAAO,CAAC,kBAAkB,CAGxB;IAEF,OAAO,CAAC,cAAc;IAgBtB,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,0BAA0B;IAWlC,OAAO,CAAC,cAAc;cAoBH,MAAM,IAAI,cAAc;CAiB5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,eAAe,EAAE,kBAAkB,CAAC;KACrC;CACF"}
|
|
@@ -1,51 +1,38 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var v = (i) => {
|
|
2
|
+
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __esDecorate as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import { isArrowKeyPressed as R, getNextElementIndex as O } from "../../core/a11y.js";
|
|
4
|
+
var y = (i, a, s) => a.has(i) || v("Cannot " + s);
|
|
5
|
+
var x = (i, a, s) => (y(i, a, "read from private field"), s ? s.call(i) : a.get(i)), z = (i, a, s) => a.has(i) ? v("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(i) : a.set(i, s), d = (i, a, s, l) => (y(i, a, "write to private field"), l ? l.call(i, s) : a.set(i, s), s);
|
|
6
|
+
import { __esDecorate as h, __runInitializers as c } from "tslib";
|
|
7
|
+
import { ResizeController as E } from "@lit-labs/observers/resize-controller.js";
|
|
8
|
+
import { css as C, LitElement as k, html as w } from "lit";
|
|
9
|
+
import { customElement as R, property as S } from "lit/decorators.js";
|
|
10
|
+
import { ref as T } from "lit/directives/ref.js";
|
|
11
|
+
import { isArrowKeyPressed as G, getNextElementIndex as L } from "../../core/a11y.js";
|
|
13
12
|
import { forceType as $ } from "../../core/decorators.js";
|
|
14
13
|
import { isLean as D } from "../../core/dom.js";
|
|
15
|
-
import { throttle as
|
|
16
|
-
import { SbbHydrationMixin as
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
var c, o;
|
|
23
|
-
let s = [w("sbb-tab-group")], a, n = [], r, h = K(G), f = [], m, _, v = [], p = [];
|
|
24
|
-
return o = class extends h {
|
|
14
|
+
import { throttle as O } from "../../core/eventing.js";
|
|
15
|
+
import { SbbHydrationMixin as A } from "../../core/mixins.js";
|
|
16
|
+
const K = C`*,:before,:after{box-sizing:border-box}:host{--sbb-tab-group-animation-duration: var( --sbb-disable-animation-duration, var(--sbb-animation-duration-4x) );display:block}.sbb-tab-group{display:flex;flex-wrap:wrap}.sbb-tab-group-content{margin-block-start:var(--sbb-spacing-responsive-m);transition:height var(--sbb-tab-group-animation-duration) var(--sbb-animation-easing)}.sbb-tab-group-content ::slotted(sbb-tab){visibility:hidden;opacity:0;height:0;overflow:hidden}.sbb-tab-group-content ::slotted(sbb-tab[data-active]){visibility:visible;opacity:1;height:fit-content;overflow:unset;transition-duration:var(--sbb-tab-group-animation-duration);transition-delay:var(--sbb-tab-group-animation-duration);transition-timing-function:var(--sbb-animation-easing);transition-property:opacity,visibility}.sbb-tab-group-content ::slotted(sbb-tab:focus-visible){outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, solid) var(--sbb-focus-outline-width)}`;
|
|
17
|
+
let V = (() => {
|
|
18
|
+
var r, o;
|
|
19
|
+
let i = [R("sbb-tab-group")], a, s = [], l, u = A(k), m = [], f, p, _ = [], g = [];
|
|
20
|
+
return o = class extends u {
|
|
25
21
|
constructor() {
|
|
26
22
|
super();
|
|
27
|
-
|
|
28
|
-
this.
|
|
29
|
-
target: null,
|
|
30
|
-
config: j,
|
|
31
|
-
callback: (t) => this._onTabAttributesChange(t)
|
|
32
|
-
}), this._tabGroupResizeObserver = new y(this, {
|
|
23
|
+
z(this, r);
|
|
24
|
+
this._tabGroupElement = c(this, m), this._tabGroupResizeObserver = new E(this, {
|
|
33
25
|
target: null,
|
|
34
26
|
skipInitial: !0,
|
|
35
27
|
callback: (t) => this._onTabGroupElementResize(t)
|
|
36
|
-
}), this._tabContentResizeObserver = new
|
|
28
|
+
}), this._tabContentResizeObserver = new E(this, {
|
|
37
29
|
target: null,
|
|
38
30
|
skipInitial: !0,
|
|
39
31
|
callback: (t) => this._onTabContentElementResize(t)
|
|
40
|
-
}), this._size = D() ? "s" : "l", d(this,
|
|
41
|
-
this.
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
}), this._onTabsSlotChange = () => {
|
|
45
|
-
const t = this._getTabs();
|
|
46
|
-
t.length < this._tabs.length && (this._tabs.filter((i) => !t.includes(i)).forEach((i) => {
|
|
47
|
-
i.tab?.remove();
|
|
48
|
-
}), this._tabs = t), this._tabs.forEach((e) => e.setAttribute("data-size", this.size));
|
|
32
|
+
}), this._size = D() ? "s" : "l", d(this, r, c(this, _, 0)), this._onContentSlotChange = (c(this, g), () => {
|
|
33
|
+
this.labels.forEach((t) => t.linkToTab()), this.labels.find((t) => t.active)?.activate();
|
|
34
|
+
}), this._onLabelSlotChange = () => {
|
|
35
|
+
this._updateSize(), this.labels.forEach((t) => t.linkToTab());
|
|
49
36
|
}, this.addEventListener?.("keydown", (t) => this._handleKeyDown(t));
|
|
50
37
|
}
|
|
51
38
|
/**
|
|
@@ -63,144 +50,103 @@ let H = 0, it = (() => {
|
|
|
63
50
|
* the tab group, the first enabled tab will be selected.
|
|
64
51
|
*/
|
|
65
52
|
get initialSelectedIndex() {
|
|
66
|
-
return
|
|
53
|
+
return x(this, r);
|
|
67
54
|
}
|
|
68
55
|
set initialSelectedIndex(t) {
|
|
69
|
-
d(this,
|
|
56
|
+
d(this, r, t);
|
|
57
|
+
}
|
|
58
|
+
/** Gets the slotted `sbb-tab-label`s. */
|
|
59
|
+
get labels() {
|
|
60
|
+
return Array.from(this.children ?? []).filter((t) => /^sbb-tab-label$/u.test(t.localName));
|
|
70
61
|
}
|
|
71
62
|
firstUpdated(t) {
|
|
72
|
-
super.firstUpdated(t), this.
|
|
63
|
+
super.firstUpdated(t), this.labels.forEach((e) => e.linkToTab()), this._initSelection(), this._tabGroupResizeObserver.observe(this._tabGroupElement), this._tabContentResizeObserver.observe(this._tabContentElement);
|
|
73
64
|
}
|
|
74
65
|
/**
|
|
75
66
|
* Disables a tab by index.
|
|
76
67
|
* @param tabIndex The index of the tab you want to disable.
|
|
77
68
|
*/
|
|
78
69
|
disableTab(t) {
|
|
79
|
-
this.
|
|
70
|
+
this.labels[t] && (this.labels[t].disabled = !0);
|
|
80
71
|
}
|
|
81
72
|
/**
|
|
82
73
|
* Enables a tab by index.
|
|
83
74
|
* @param tabIndex The index of the tab you want to enable.
|
|
84
75
|
*/
|
|
85
76
|
enableTab(t) {
|
|
86
|
-
this.
|
|
77
|
+
this.labels[t] && (this.labels[t].disabled = !1);
|
|
87
78
|
}
|
|
88
79
|
/**
|
|
89
80
|
* Activates a tab by index.
|
|
90
81
|
* @param tabIndex The index of the tab you want to activate.
|
|
91
82
|
*/
|
|
92
83
|
activateTab(t) {
|
|
93
|
-
this.
|
|
94
|
-
}
|
|
95
|
-
_getTabs() {
|
|
96
|
-
return Array.from(this.children ?? []).filter((t) => /^sbb-tab-label$/u.test(t.localName));
|
|
84
|
+
this.labels[t]?.activate();
|
|
97
85
|
}
|
|
98
86
|
_enabledTabs() {
|
|
99
|
-
return this.
|
|
87
|
+
return this.labels.filter((t) => (customElements.upgrade(t), !t.disabled));
|
|
100
88
|
}
|
|
101
89
|
_updateSize() {
|
|
102
|
-
|
|
103
|
-
t.setAttribute("data-size", this.size);
|
|
104
|
-
}
|
|
105
|
-
_assignId() {
|
|
106
|
-
return `sbb-tab-panel-${++H}`;
|
|
90
|
+
this.labels.forEach((t) => t.setAttribute("data-size", this.size));
|
|
107
91
|
}
|
|
108
92
|
_initSelection() {
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
if (e.type !== "attributes")
|
|
114
|
-
return;
|
|
115
|
-
const i = e.target;
|
|
116
|
-
e.attributeName === "disabled" && (i.hasAttribute("disabled") && i !== this._selectedTab ? i.tabGroupActions?.disable() : i.disabled && i.tabGroupActions?.enable()), e.attributeName === "active" && (i.hasAttribute("active") && !i.disabled ? i.tabGroupActions?.select() : i === this._selectedTab && i.toggleAttribute("active", !0));
|
|
93
|
+
const t = this.labels[this.initialSelectedIndex];
|
|
94
|
+
if (t && (customElements.upgrade(t), this.initialSelectedIndex >= 0 && this.initialSelectedIndex < this.labels.length && !t.disabled)) {
|
|
95
|
+
t.activate();
|
|
96
|
+
return;
|
|
117
97
|
}
|
|
98
|
+
this._enabledTabs()[0]?.activate();
|
|
118
99
|
}
|
|
119
100
|
_onTabGroupElementResize(t) {
|
|
120
101
|
for (const e of t) {
|
|
121
|
-
const
|
|
122
|
-
for (const
|
|
123
|
-
|
|
102
|
+
const n = e.target.firstElementChild.assignedElements();
|
|
103
|
+
for (const b of n)
|
|
104
|
+
b.toggleAttribute("data-has-divider", b === n[0] || b.offsetLeft === n[0].offsetLeft), this.style.setProperty("--sbb-tab-group-width", `${this._tabGroupElement.clientWidth}px`);
|
|
124
105
|
}
|
|
125
106
|
}
|
|
126
107
|
_onTabContentElementResize(t) {
|
|
127
108
|
if (this._tabContentElement)
|
|
128
109
|
for (const e of t) {
|
|
129
|
-
const
|
|
130
|
-
this._tabContentElement.style.height = `${
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
_configure(t) {
|
|
134
|
-
t.tabGroupActions = {
|
|
135
|
-
activate: () => {
|
|
136
|
-
t.toggleAttribute("active", !0), t.active = !0, t.tabIndex = 0, t.setAttribute("aria-selected", "true"), t.tab?.toggleAttribute("active", !0);
|
|
137
|
-
},
|
|
138
|
-
deactivate: () => {
|
|
139
|
-
t.removeAttribute("active"), t.active = !1, t.tabIndex = -1, t.setAttribute("aria-selected", "false"), t.tab?.removeAttribute("active");
|
|
140
|
-
},
|
|
141
|
-
disable: () => {
|
|
142
|
-
t.disabled || (t.hasAttribute("disabled") || t.toggleAttribute("disabled", !0), t.disabled = !0, t.tabIndex = -1, t.setAttribute("aria-selected", "false"), t.tab?.removeAttribute("active"), t.active && (t.removeAttribute("active"), t.active = !1, this._enabledTabs()[0]?.tabGroupActions?.select()));
|
|
143
|
-
},
|
|
144
|
-
enable: () => {
|
|
145
|
-
t.disabled && (t.removeAttribute("disabled"), t.disabled = !1);
|
|
146
|
-
},
|
|
147
|
-
select: () => {
|
|
148
|
-
if (t !== this._selectedTab && !t.disabled) {
|
|
149
|
-
const e = this._selectedTab;
|
|
150
|
-
e && (e.tabGroupActions?.deactivate(), this._tabContentResizeObserver.unobserve(e.tab)), t.tabGroupActions?.activate(), this._selectedTab = t, this._tabContentResizeObserver.observe(t.tab);
|
|
151
|
-
const i = this._tabs;
|
|
152
|
-
this.dispatchEvent(new CustomEvent("tabchange", {
|
|
153
|
-
bubbles: !0,
|
|
154
|
-
composed: !0,
|
|
155
|
-
detail: {
|
|
156
|
-
activeIndex: i.findIndex((l) => l === t),
|
|
157
|
-
activeTabLabel: t,
|
|
158
|
-
activeTab: t.tab,
|
|
159
|
-
previousIndex: i.findIndex((l) => l === e),
|
|
160
|
-
previousTabLabel: e,
|
|
161
|
-
previousTab: e?.tab
|
|
162
|
-
}
|
|
163
|
-
}));
|
|
164
|
-
}
|
|
110
|
+
const n = Math.floor(e.contentRect.height);
|
|
111
|
+
this._tabContentElement.style.height = `${n}px`;
|
|
165
112
|
}
|
|
166
|
-
}, t.nextElementSibling?.localName === "sbb-tab" && (t.tab = t.nextElementSibling, t.tab.id = this._assignId(), t.tab instanceof M && (t.tab.tabIndex = 0, t.tab.configure())), t.tabIndex = -1, t.disabled = t.hasAttribute("disabled"), t.active = t.hasAttribute("active") && !t.disabled, t.setAttribute("aria-selected", String(t.active)), t.addEventListener("click", () => {
|
|
167
|
-
t.tabGroupActions?.select();
|
|
168
|
-
}), t.tab && (t.setAttribute("aria-controls", t.tab.id), t.tab.toggleAttribute("active", t.active)), this._tabAttributeObserver.observe(t), t.slot = "tab-bar";
|
|
169
113
|
}
|
|
170
114
|
_handleKeyDown(t) {
|
|
171
115
|
const e = this._enabledTabs();
|
|
172
116
|
if (!(!e || // don't trap nested handling
|
|
173
|
-
t.target !== this && t.target.parentElement !== this) &&
|
|
174
|
-
const
|
|
175
|
-
e[
|
|
117
|
+
t.target !== this && t.target.parentElement !== this) && G(t)) {
|
|
118
|
+
const n = e.findIndex((I) => I.active), b = L(t, n, e.length);
|
|
119
|
+
e[b]?.activate(), e[b]?.focus(), t.preventDefault();
|
|
176
120
|
}
|
|
177
121
|
}
|
|
178
122
|
render() {
|
|
179
|
-
return
|
|
123
|
+
return w`
|
|
180
124
|
<div
|
|
181
|
-
class="tab-group"
|
|
125
|
+
class="sbb-tab-group"
|
|
182
126
|
role="tablist"
|
|
183
|
-
${
|
|
127
|
+
${T((t) => this._tabGroupElement = t)}
|
|
184
128
|
>
|
|
185
|
-
<slot name="tab-bar" @slotchange=${this.
|
|
129
|
+
<slot name="tab-bar" @slotchange=${this._onLabelSlotChange}></slot>
|
|
186
130
|
</div>
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
131
|
+
<div
|
|
132
|
+
class="sbb-tab-group-content"
|
|
133
|
+
${T((t) => this._tabContentElement = t)}
|
|
134
|
+
>
|
|
135
|
+
<slot @slotchange=${O(this._onContentSlotChange, 150)}></slot>
|
|
190
136
|
</div>
|
|
191
137
|
`;
|
|
192
138
|
}
|
|
193
|
-
},
|
|
194
|
-
const t = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
195
|
-
|
|
196
|
-
e.size =
|
|
197
|
-
} }, metadata: t }, null,
|
|
198
|
-
e.initialSelectedIndex =
|
|
199
|
-
} }, metadata: t },
|
|
200
|
-
})(), o.styles =
|
|
139
|
+
}, r = new WeakMap(), l = o, (() => {
|
|
140
|
+
const t = typeof Symbol == "function" && Symbol.metadata ? Object.create(u[Symbol.metadata] ?? null) : void 0;
|
|
141
|
+
f = [S()], p = [$(), S({ attribute: "initial-selected-index", type: Number })], h(o, null, f, { kind: "setter", name: "size", static: !1, private: !1, access: { has: (e) => "size" in e, set: (e, n) => {
|
|
142
|
+
e.size = n;
|
|
143
|
+
} }, metadata: t }, null, m), h(o, null, p, { kind: "accessor", name: "initialSelectedIndex", static: !1, private: !1, access: { has: (e) => "initialSelectedIndex" in e, get: (e) => e.initialSelectedIndex, set: (e, n) => {
|
|
144
|
+
e.initialSelectedIndex = n;
|
|
145
|
+
} }, metadata: t }, _, g), h(null, a = { value: l }, i, { kind: "class", name: l.name, metadata: t }, null, s), l = a.value, t && Object.defineProperty(l, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: t });
|
|
146
|
+
})(), o.styles = K, o.events = {
|
|
201
147
|
tabchange: "tabchange"
|
|
202
|
-
},
|
|
148
|
+
}, c(l, s), l;
|
|
203
149
|
})();
|
|
204
150
|
export {
|
|
205
|
-
|
|
151
|
+
V as SbbTabGroupElement
|
|
206
152
|
};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
import { CSSResultGroup, TemplateResult, LitElement } from 'lit';
|
|
1
|
+
import { CSSResultGroup, PropertyValues, TemplateResult, LitElement } from 'lit';
|
|
2
2
|
import { SbbTitleLevel } from '../../title.js';
|
|
3
|
+
import { SbbTabElement } from '../tab/tab.component.js';
|
|
4
|
+
import { SbbTabGroupElement } from '../tab-group.js';
|
|
3
5
|
declare const SbbTabLabelElement_base: import('../../core/mixins.js').AbstractConstructor<import('../../core/mixins.js').SbbDisabledMixinType> & import('../../core/mixins.js').AbstractConstructor<import('../../icon.js').SbbIconNameMixinType> & import('../../core/mixins.js').AbstractConstructor<import('../../core/mixins.js').SbbElementInternalsMixinType> & typeof LitElement & import('../../core/mixins.js').SbbElementInternalsConstructor;
|
|
4
6
|
/**
|
|
5
7
|
* Combined with a `sbb-tab-group`, it displays a tab's title.
|
|
@@ -11,15 +13,32 @@ declare const SbbTabLabelElement_base: import('../../core/mixins.js').AbstractCo
|
|
|
11
13
|
export declare class SbbTabLabelElement extends SbbTabLabelElement_base {
|
|
12
14
|
static role: string;
|
|
13
15
|
static styles: CSSResultGroup;
|
|
16
|
+
/** Whether the tab is selected. */
|
|
17
|
+
private _selected;
|
|
14
18
|
/**
|
|
15
19
|
* The level will correspond to the heading tag generated in the title.
|
|
16
20
|
* Use this property to generate the appropriate header tag, taking SEO into consideration.
|
|
17
21
|
*/
|
|
18
22
|
accessor level: SbbTitleLevel;
|
|
19
|
-
/** Active tab state */
|
|
23
|
+
/** Active tab state. */
|
|
20
24
|
accessor active: boolean;
|
|
21
25
|
/** Amount displayed inside the tab. */
|
|
22
26
|
accessor amount: string;
|
|
27
|
+
/** Get the `sbb-tab` related to the `sbb-tab-label`. */
|
|
28
|
+
get tab(): SbbTabElement | null;
|
|
29
|
+
/** Get the parent `sbb-tab-group`. */
|
|
30
|
+
get group(): SbbTabGroupElement | null;
|
|
31
|
+
constructor();
|
|
32
|
+
connectedCallback(): void;
|
|
33
|
+
protected willUpdate(changedProperties: PropertyValues<this>): void;
|
|
34
|
+
/** Deactivate the tab. */
|
|
35
|
+
deactivate(): void;
|
|
36
|
+
/** Select the tab, deactivating the current selected one, and dispatch the tabchange event. */
|
|
37
|
+
activate(): void;
|
|
38
|
+
/**
|
|
39
|
+
* @internal
|
|
40
|
+
*/
|
|
41
|
+
protected linkToTab(): void;
|
|
23
42
|
protected render(): TemplateResult;
|
|
24
43
|
}
|
|
25
44
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-label.component.d.ts","sourceRoot":"","sources":["../../../../src/elements/tabs/tab-label/tab-label.component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"tab-label.component.d.ts","sourceRoot":"","sources":["../../../../src/elements/tabs/tab-label/tab-label.component.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAOjC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,yBAAyB,CAAC;AAC7D,OAAO,KAAK,EAA6B,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;;AAIrF;;;;;;GAMG;AACH,qBAGM,kBAAmB,SAAQ,uBAEhC;IACC,OAAuB,IAAI,SAAS;IACpC,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD,mCAAmC;IACnC,OAAO,CAAC,SAAS,CAAkB;IAEnC;;;OAGG;IACH,SAA4B,KAAK,EAAE,aAAa,CAAO;IAEvD,wBAAwB;IACxB,SAEgB,MAAM,EAAE,OAAO,CAAS;IAExC,uCAAuC;IACvC,SAEgB,MAAM,EAAE,MAAM,CAAM;IAEpC,wDAAwD;IACxD,IAAW,GAAG,IAAI,aAAa,GAAG,IAAI,CAIrC;IAED,sCAAsC;IACtC,IAAW,KAAK,IAAI,kBAAkB,GAAG,IAAI,CAE5C;;IAQe,iBAAiB,IAAI,IAAI;cAMtB,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAuB5E,0BAA0B;IACnB,UAAU,IAAI,IAAI;IAMzB,+FAA+F;IACxF,QAAQ,IAAI,IAAI;IAiCvB;;OAEG;IACH,SAAS,CAAC,SAAS,IAAI,IAAI;cAYR,MAAM,IAAI,cAAc;CAoB5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,eAAe,EAAE,kBAAkB,CAAC;KACrC;CACF"}
|
|
@@ -1,56 +1,98 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var E = (a) => {
|
|
2
|
+
throw TypeError(a);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __esDecorate as
|
|
7
|
-
import { css as
|
|
8
|
-
import { customElement as
|
|
9
|
-
import { unsafeStatic as
|
|
10
|
-
import { slotState as
|
|
11
|
-
import { SbbDisabledMixin as
|
|
12
|
-
import { SbbIconNameMixin as
|
|
13
|
-
const
|
|
14
|
-
let
|
|
15
|
-
var
|
|
16
|
-
let
|
|
17
|
-
return
|
|
4
|
+
var S = (a, b, s) => b.has(a) || E("Cannot " + s);
|
|
5
|
+
var h = (a, b, s) => (S(a, b, "read from private field"), s ? s.call(a) : b.get(a)), m = (a, b, s) => b.has(a) ? E("Cannot add the same private member more than once") : b instanceof WeakSet ? b.add(a) : b.set(a, s), n = (a, b, s, o) => (S(a, b, "write to private field"), o ? o.call(a, s) : b.set(a, s), s);
|
|
6
|
+
import { __esDecorate as u, __runInitializers as r } from "tslib";
|
|
7
|
+
import { css as B, LitElement as C } from "lit";
|
|
8
|
+
import { customElement as A, property as f } from "lit/decorators.js";
|
|
9
|
+
import { unsafeStatic as L, html as D } from "lit/static-html.js";
|
|
10
|
+
import { slotState as M, forceType as $, omitEmptyConverter as N } from "../../core/decorators.js";
|
|
11
|
+
import { SbbDisabledMixin as G, SbbElementInternalsMixin as j } from "../../core/mixins.js";
|
|
12
|
+
import { SbbIconNameMixin as O } from "../../icon.js";
|
|
13
|
+
const U = B`*,:before,:after{box-sizing:border-box}:host{--sbb-tab-label-height: var(--sbb-size-element-m);--sbb-tab-label-color: var(--sbb-color-granite);--sbb-tab-label-color: light-dark(var(--sbb-color-granite), var(--sbb-color-graphite));--sbb-tab-label-line-color: var(--sbb-border-color-4-inverted);--sbb-tab-label-cursor: pointer;--sbb-tab-label-pointer-events: unset;--sbb-tab-label-inset: 0;--sbb-tab-label-inline-padding: var(--sbb-spacing-responsive-xs);--sbb-tab-label-marker-transform: scale(0);--sbb-tab-label-text-decoration: none;--sbb-tab-label-animation-duration: var( --sbb-disable-animation-duration, var(--sbb-animation-duration-2x) );--sbb-tab-label-animation-easing: var(--sbb-animation-easing);--sbb-tab-label-amount-color: var(--sbb-color-metal);--sbb-tab-label-amount-color: light-dark(var(--sbb-color-metal), var(--sbb-color-smoke));display:inline-block;max-width:100%;pointer-events:var(--sbb-tab-label-pointer-events);-webkit-tap-highlight-color:transparent;outline:none!important}@media (forced-colors: active){:host{--sbb-tab-label-color: ButtonText;--sbb-tab-label-amount-color: ButtonText}}:host([data-size=s]){--sbb-tab-label-height: var(--sbb-size-element-xs);--sbb-tab-label-inline-padding: var(--sbb-spacing-responsive-xxxs)}:host([disabled]){--sbb-tab-label-cursor: unset;--sbb-tab-label-pointer-events: none;--sbb-tab-label-text-decoration: line-through}@media (forced-colors: active){:host([disabled]){--sbb-tab-label-color: GrayText;--sbb-tab-label-amount-color: GrayText}}:host([active]:not([disabled])){--sbb-tab-label-color: var(--sbb-color-3);--sbb-tab-label-cursor: unset;--sbb-tab-label-pointer-events: none;--sbb-tab-label-marker-transform: scale(1)}@media (forced-colors: active){:host([active]:not([disabled])){--sbb-tab-label-color: ButtonText;--sbb-tab-label-amount-color: ButtonText}}@media (any-hover: hover){:host(:hover:not([disabled])){--sbb-tab-label-marker-transform: scale(1)}}:host(:is([data-active],:active)){--sbb-tab-label-color: var(--sbb-color-3)}.sbb-tab-label__wrapper{position:relative}:host(:focus-visible) .sbb-tab-label__wrapper:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, solid) var(--sbb-focus-outline-width);content:"";position:absolute;display:block;inset:0;z-index:1;border-radius:calc(var(--sbb-border-radius-2x) - var(--sbb-focus-outline-offset))}.sbb-tab-label{position:relative;margin:0;min-height:var(--sbb-tab-label-height);display:flex;align-items:center;padding-inline:var(--sbb-tab-label-inline-padding);gap:var(--sbb-spacing-fixed-2x);-webkit-user-select:none;user-select:none;cursor:var(--sbb-tab-label-cursor);transition:color var(--sbb-tab-label-animation-duration) var(--sbb-tab-label-animation-easing)}:host([data-has-divider]) .sbb-tab-label:after{content:"";position:absolute;inset-inline-start:0;inset-block-end:0;width:var(--sbb-tab-group-width);height:var(--sbb-border-width-1x);background-color:var(--sbb-tab-label-line-color)}.sbb-tab-label:before{position:absolute;content:"";inset-inline:0;inset-block-end:0;height:var(--sbb-border-width-3x);background-color:var(--sbb-tab-label-color);transform:var(--sbb-tab-label-marker-transform);transition-duration:var(--sbb-tab-label-animation-duration);transition-timing-function:var(--sbb-tab-label-animation-easing);transition-property:transform,background-color;z-index:1}.sbb-tab-label__icon,.sbb-tab-label__text,.sbb-tab-label__amount{text-decoration:var(--sbb-tab-label-text-decoration)}.sbb-tab-label__icon{display:flex;flex-shrink:0;color:var(--sbb-tab-label-color);transition:color var(--sbb-tab-label-animation-duration) var(--sbb-tab-label-animation-easing)}:host(:not([data-slot-names~=icon],[icon-name])) .sbb-tab-label__icon{display:none}.sbb-tab-label__text{color:var(--sbb-tab-label-color);transition:color var(--sbb-tab-label-animation-duration) var(--sbb-tab-label-animation-easing);overflow:hidden;white-space:nowrap;text-overflow:ellipsis;--sbb-text-font-size: var(--sbb-font-size-text-m);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);font-weight:700}:host([data-size=s]) .sbb-tab-label__text{--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);font-weight:700}:host([data-size=xl]) .sbb-tab-label__text{--sbb-text-font-size: var(--sbb-font-size-text-xl);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);font-weight:700}:host(:not([data-slot-names~=unnamed])) .sbb-tab-label__text{display:none}.sbb-tab-label__amount{display:flex;color:var(--sbb-tab-label-amount-color);transition:color var(--sbb-tab-label-animation-duration) var(--sbb-tab-label-animation-easing);--sbb-text-font-size: var(--sbb-font-size-text-m);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)}:host(:not([data-slot-names~=amount],[amount])) .sbb-tab-label__amount{display:none}:host([data-size=s]) .sbb-tab-label__amount{--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)}:host([data-size=xl]) .sbb-tab-label__amount{--sbb-text-font-size: var(--sbb-font-size-text-xl);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)}`;
|
|
14
|
+
let X = (() => {
|
|
15
|
+
var c, v, d, i;
|
|
16
|
+
let a = [A("sbb-tab-label"), M()], b, s = [], o, p = G(O(j(C))), g, x = [], _ = [], y, z = [], w = [], k, T = [], I = [];
|
|
17
|
+
return i = class extends p {
|
|
18
18
|
constructor() {
|
|
19
|
-
super(
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
19
|
+
super();
|
|
20
|
+
m(this, c);
|
|
21
|
+
m(this, v);
|
|
22
|
+
m(this, d);
|
|
23
|
+
this._selected = !1, n(this, c, r(this, x, "1")), n(this, v, (r(this, _), r(this, z, !1))), n(this, d, (r(this, w), r(this, T, ""))), r(this, I), this.addEventListener("click", () => this.activate());
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
26
|
* The level will correspond to the heading tag generated in the title.
|
|
27
27
|
* Use this property to generate the appropriate header tag, taking SEO into consideration.
|
|
28
28
|
*/
|
|
29
29
|
get level() {
|
|
30
|
-
return
|
|
30
|
+
return h(this, c);
|
|
31
31
|
}
|
|
32
|
-
set level(
|
|
33
|
-
|
|
32
|
+
set level(t) {
|
|
33
|
+
n(this, c, t);
|
|
34
34
|
}
|
|
35
|
-
/** Active tab state */
|
|
35
|
+
/** Active tab state. */
|
|
36
36
|
get active() {
|
|
37
|
-
return
|
|
37
|
+
return h(this, v);
|
|
38
38
|
}
|
|
39
|
-
set active(
|
|
40
|
-
|
|
39
|
+
set active(t) {
|
|
40
|
+
n(this, v, t);
|
|
41
41
|
}
|
|
42
42
|
/** Amount displayed inside the tab. */
|
|
43
43
|
get amount() {
|
|
44
|
-
return
|
|
44
|
+
return h(this, d);
|
|
45
45
|
}
|
|
46
|
-
set amount(
|
|
47
|
-
|
|
46
|
+
set amount(t) {
|
|
47
|
+
n(this, d, t);
|
|
48
|
+
}
|
|
49
|
+
/** Get the `sbb-tab` related to the `sbb-tab-label`. */
|
|
50
|
+
get tab() {
|
|
51
|
+
return this.nextElementSibling?.localName === "sbb-tab" ? this.nextElementSibling : null;
|
|
52
|
+
}
|
|
53
|
+
/** Get the parent `sbb-tab-group`. */
|
|
54
|
+
get group() {
|
|
55
|
+
return this.closest("sbb-tab-group");
|
|
56
|
+
}
|
|
57
|
+
connectedCallback() {
|
|
58
|
+
super.connectedCallback(), this.slot = "tab-bar", this.tabIndex = this.active ? 0 : -1;
|
|
59
|
+
}
|
|
60
|
+
willUpdate(t) {
|
|
61
|
+
super.willUpdate(t), t.has("active") && (this.internals.ariaSelected = `${this.active}`, this.tab?.toggleAttribute("data-active", this.active), this.active && !this.disabled ? this.activate() : this.deactivate()), t.has("disabled") && this.disabled && (this.tabIndex = -1, this.active && (this.deactivate(), this.group?.activateTab(0)));
|
|
62
|
+
}
|
|
63
|
+
/** Deactivate the tab. */
|
|
64
|
+
deactivate() {
|
|
65
|
+
this.active = !1, this._selected = !1, this.tabIndex = -1;
|
|
66
|
+
}
|
|
67
|
+
/** Select the tab, deactivating the current selected one, and dispatch the tabchange event. */
|
|
68
|
+
activate() {
|
|
69
|
+
if (this.disabled)
|
|
70
|
+
return;
|
|
71
|
+
const t = this.group?.labels || [], e = t.find((l) => l._selected);
|
|
72
|
+
e !== this && (e?.deactivate(), this.active = !0, this._selected = !0, this.tabIndex = 0, this.tab?.dispatchEvent(new Event("active", { bubbles: !0, composed: !0 })), this.group?.dispatchEvent(new CustomEvent("tabchange", {
|
|
73
|
+
bubbles: !0,
|
|
74
|
+
composed: !0,
|
|
75
|
+
detail: {
|
|
76
|
+
activeIndex: t.findIndex((l) => l === this),
|
|
77
|
+
activeTabLabel: this,
|
|
78
|
+
activeTab: this.tab,
|
|
79
|
+
previousIndex: t.findIndex((l) => l === e),
|
|
80
|
+
previousTabLabel: e,
|
|
81
|
+
previousTab: e?.tab
|
|
82
|
+
}
|
|
83
|
+
})));
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* @internal
|
|
87
|
+
*/
|
|
88
|
+
linkToTab() {
|
|
89
|
+
this.tab && (this.internals.ariaControlsElements = [this.tab]);
|
|
48
90
|
}
|
|
49
91
|
render() {
|
|
50
|
-
const
|
|
51
|
-
return
|
|
92
|
+
const t = `h${Number(this.level) < 7 ? this.level : "1"}`;
|
|
93
|
+
return D`
|
|
52
94
|
<div class="sbb-tab-label__wrapper">
|
|
53
|
-
<${
|
|
95
|
+
<${L(t)} class="sbb-tab-label">
|
|
54
96
|
<span class="sbb-tab-label__icon">
|
|
55
97
|
${this.renderIconSlot()}
|
|
56
98
|
</span>
|
|
@@ -60,21 +102,21 @@ let W = (() => {
|
|
|
60
102
|
<span class="sbb-tab-label__amount">
|
|
61
103
|
<slot name="amount">${this.amount}</slot>
|
|
62
104
|
</span>
|
|
63
|
-
</${
|
|
105
|
+
</${L(t)}>
|
|
64
106
|
</div>
|
|
65
107
|
`;
|
|
66
108
|
}
|
|
67
|
-
},
|
|
68
|
-
const
|
|
69
|
-
g = [
|
|
70
|
-
e.level =
|
|
71
|
-
} }, metadata:
|
|
72
|
-
e.active =
|
|
73
|
-
} }, metadata:
|
|
74
|
-
e.amount =
|
|
75
|
-
} }, metadata:
|
|
76
|
-
})(),
|
|
109
|
+
}, c = new WeakMap(), v = new WeakMap(), d = new WeakMap(), o = i, (() => {
|
|
110
|
+
const t = typeof Symbol == "function" && Symbol.metadata ? Object.create(p[Symbol.metadata] ?? null) : void 0;
|
|
111
|
+
g = [f()], y = [$(), f({ reflect: !0, type: Boolean })], k = [$(), f({ reflect: !0, converter: N })], u(i, null, g, { kind: "accessor", name: "level", static: !1, private: !1, access: { has: (e) => "level" in e, get: (e) => e.level, set: (e, l) => {
|
|
112
|
+
e.level = l;
|
|
113
|
+
} }, metadata: t }, x, _), u(i, null, y, { kind: "accessor", name: "active", static: !1, private: !1, access: { has: (e) => "active" in e, get: (e) => e.active, set: (e, l) => {
|
|
114
|
+
e.active = l;
|
|
115
|
+
} }, metadata: t }, z, w), u(i, null, k, { kind: "accessor", name: "amount", static: !1, private: !1, access: { has: (e) => "amount" in e, get: (e) => e.amount, set: (e, l) => {
|
|
116
|
+
e.amount = l;
|
|
117
|
+
} }, metadata: t }, T, I), u(null, b = { value: o }, a, { kind: "class", name: o.name, metadata: t }, null, s), o = b.value, t && Object.defineProperty(o, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: t });
|
|
118
|
+
})(), i.role = "tab", i.styles = U, r(o, s), o;
|
|
77
119
|
})();
|
|
78
120
|
export {
|
|
79
|
-
|
|
121
|
+
X as SbbTabLabelElement
|
|
80
122
|
};
|