@sbb-esta/lyne-elements 1.0.0 → 1.2.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/button/common/button-common.d.ts.map +1 -1
- package/button/mini-button.js +5 -5
- package/calendar/calendar.d.ts +3 -1
- package/calendar/calendar.d.ts.map +1 -1
- package/calendar.js +62 -52
- package/card/common/card-action-common.d.ts.map +1 -1
- package/checkbox/common/checkbox-common.d.ts.map +1 -1
- package/clock/clock.d.ts.map +1 -1
- package/clock.js +45 -50
- package/core/decorators/host-attributes.d.ts.map +1 -1
- package/core/eventing/throttle.d.ts.map +1 -1
- package/core/i18n/i18n.d.ts +1 -3
- package/core/i18n/i18n.d.ts.map +1 -1
- package/core/i18n.js +91 -127
- package/core/mixins/disabled-mixin.d.ts.map +1 -1
- package/core/mixins/form-associated-checkbox-mixin.d.ts.map +1 -1
- package/core/mixins/form-associated-mixin.d.ts.map +1 -1
- package/core/mixins/hydration-mixin.d.ts +2 -8
- package/core/mixins/hydration-mixin.d.ts.map +1 -1
- package/core/mixins/named-slot-list-mixin.d.ts.map +1 -1
- package/core/mixins/negative-mixin.d.ts.map +1 -1
- package/core/mixins/panel-mixin.d.ts.map +1 -1
- package/core/mixins/required-mixin.d.ts.map +1 -1
- package/core/mixins/update-scheduler-mixin.d.ts.map +1 -1
- package/core/mixins.js +90 -99
- package/core/observers/intersection-observer.d.ts +1 -1
- package/core/styles/_index.scss +1 -0
- package/core/styles/mixins/buttons.scss +1 -1
- package/core/styles/mixins/table.scss +148 -0
- package/core/styles/standard-theme.scss +1 -0
- package/core/styles/table.scss +56 -0
- package/core/testing/private.d.ts +0 -1
- package/core/testing/private.d.ts.map +1 -1
- package/core/testing/wait-for-render.d.ts +1 -1
- package/core/testing/wait-for-render.d.ts.map +1 -1
- package/core/testing.js +40 -37
- package/custom-elements.json +557 -864
- package/datepicker/datepicker-next-day.js +5 -5
- package/datepicker/datepicker-previous-day.js +1 -1
- package/datepicker/datepicker-toggle.js +7 -7
- package/development/accordion.js +7 -1
- package/development/action-group.js +7 -1
- package/development/alert/alert-group.js +7 -1
- package/development/alert/alert.js +7 -1
- package/development/autocomplete.js +7 -1
- package/development/breadcrumb/breadcrumb-group.js +7 -1
- package/development/breadcrumb/breadcrumb.js +7 -1
- package/development/button/common/button-common.d.ts.map +1 -1
- package/development/button/common.js +7 -1
- package/development/button/mini-button.js +8 -2
- package/development/calendar/calendar.d.ts +3 -1
- package/development/calendar/calendar.d.ts.map +1 -1
- package/development/calendar.js +18 -2
- package/development/card/card-badge.js +7 -1
- package/development/card/card.js +7 -1
- package/development/card/common/card-action-common.d.ts.map +1 -1
- package/development/card/common.js +7 -1
- package/development/checkbox/checkbox-group.js +7 -1
- package/development/checkbox/checkbox.js +7 -1
- package/development/checkbox/common/checkbox-common.d.ts.map +1 -1
- package/development/checkbox/common.js +7 -1
- package/development/chip.js +7 -1
- package/development/clock/clock.d.ts.map +1 -1
- package/development/clock.js +35 -31
- package/development/container/container.js +7 -1
- package/development/container/sticky-bar.js +7 -1
- package/development/core/decorators/host-attributes.d.ts.map +1 -1
- package/development/core/eventing/throttle.d.ts.map +1 -1
- package/development/core/i18n/i18n.d.ts +1 -3
- package/development/core/i18n/i18n.d.ts.map +1 -1
- package/development/core/i18n.js +5 -43
- package/development/core/mixins/disabled-mixin.d.ts.map +1 -1
- package/development/core/mixins/form-associated-checkbox-mixin.d.ts.map +1 -1
- package/development/core/mixins/form-associated-mixin.d.ts.map +1 -1
- package/development/core/mixins/hydration-mixin.d.ts +2 -8
- package/development/core/mixins/hydration-mixin.d.ts.map +1 -1
- package/development/core/mixins/named-slot-list-mixin.d.ts.map +1 -1
- package/development/core/mixins/negative-mixin.d.ts.map +1 -1
- package/development/core/mixins/panel-mixin.d.ts.map +1 -1
- package/development/core/mixins/required-mixin.d.ts.map +1 -1
- package/development/core/mixins/update-scheduler-mixin.d.ts.map +1 -1
- package/development/core/mixins.js +26 -36
- package/development/core/observers/intersection-observer.d.ts +1 -1
- package/development/core/testing/private.d.ts +0 -1
- package/development/core/testing/private.d.ts.map +1 -1
- package/development/core/testing/wait-for-render.d.ts +1 -1
- package/development/core/testing/wait-for-render.d.ts.map +1 -1
- package/development/core/testing.js +6 -2
- package/development/datepicker/datepicker-next-day.js +8 -2
- package/development/datepicker/datepicker-previous-day.js +8 -2
- package/development/datepicker/datepicker-toggle.js +7 -2
- package/development/datepicker/datepicker.js +7 -1
- package/development/dialog/dialog-actions.js +7 -1
- package/development/dialog/dialog-content.js +7 -1
- package/development/dialog/dialog-title.js +7 -1
- package/development/dialog/dialog.js +7 -1
- package/development/divider.js +7 -1
- package/development/expansion-panel/expansion-panel-content.js +7 -1
- package/development/expansion-panel/expansion-panel-header.js +7 -1
- package/development/expansion-panel/expansion-panel.js +7 -1
- package/development/file-selector.js +7 -1
- package/development/footer.js +7 -1
- package/development/form-error.js +7 -1
- package/development/form-field/form-field-clear.js +8 -2
- package/development/form-field/form-field.js +7 -1
- package/development/header/common/header-action-common.d.ts.map +1 -1
- package/development/header/common.js +7 -1
- package/development/header/header.js +7 -1
- package/development/icon/icon-name-mixin.d.ts.map +1 -1
- package/development/icon/icon-request.d.ts.map +1 -1
- package/development/icon.js +7 -1
- package/development/image.js +7 -1
- package/development/journey-header.js +7 -1
- package/development/lead-container.js +7 -1
- package/development/link/common/block-link-common.d.ts.map +1 -1
- package/development/link/common/inline-link-common.d.ts.map +1 -1
- package/development/link/common/link-common.d.ts.map +1 -1
- package/development/link/common.js +19 -1
- package/development/link-list.js +7 -1
- package/development/loading-indicator.js +7 -1
- package/development/logo.js +7 -1
- package/development/map-container.js +7 -1
- package/development/menu/common/menu-action-common.d.ts.map +1 -1
- package/development/menu/common.js +7 -1
- package/development/menu/menu.js +7 -1
- package/development/message.js +7 -1
- package/development/navigation/common/navigation-action-common.d.ts.map +1 -1
- package/development/navigation/common.js +7 -1
- package/development/navigation/navigation-list.js +7 -1
- package/development/navigation/navigation-marker.js +7 -1
- package/development/navigation/navigation-section.js +7 -1
- package/development/navigation/navigation.js +7 -1
- package/development/notification.js +8 -1
- package/development/option/optgroup/optgroup.d.ts +2 -0
- package/development/option/optgroup/optgroup.d.ts.map +1 -1
- package/development/option/optgroup.js +21 -4
- package/development/option/option/option.d.ts +6 -5
- package/development/option/option/option.d.ts.map +1 -1
- package/development/option/option.js +53 -29
- package/development/overlay.js +7 -1
- package/development/popover/popover-trigger.js +8 -2
- package/development/popover/popover.js +7 -1
- package/development/radio-button/common/radio-button-common.d.ts.map +1 -1
- package/development/radio-button/common.js +7 -1
- package/development/radio-button/radio-button-group.js +7 -1
- package/development/radio-button/radio-button.js +7 -1
- package/development/screen-reader-only.js +7 -1
- package/development/select.js +7 -1
- package/development/selection-expansion-panel.js +7 -1
- package/development/signet.js +7 -1
- package/development/skiplink-list.js +7 -1
- package/development/slider.js +7 -1
- package/development/status.js +7 -1
- package/development/stepper/step-label.js +7 -1
- package/development/stepper/step.js +7 -1
- package/development/stepper/stepper.js +7 -1
- package/development/table/table-wrapper/table-wrapper.d.ts +24 -0
- package/development/table/table-wrapper/table-wrapper.d.ts.map +1 -0
- package/development/table/table-wrapper.d.ts +2 -0
- package/development/table/table-wrapper.d.ts.map +1 -0
- package/development/table/table-wrapper.js +130 -0
- package/development/table.d.ts +2 -0
- package/development/table.d.ts.map +1 -0
- package/development/table.js +2 -0
- package/development/tabs/tab-group/tab-group.d.ts +4 -7
- package/development/tabs/tab-group/tab-group.d.ts.map +1 -1
- package/development/tabs/tab-group.js +69 -73
- package/development/tabs/tab-label.js +7 -1
- package/development/tabs/tab.js +7 -1
- package/development/tag/tag-group.js +7 -1
- package/development/tag/tag.js +7 -1
- package/development/teaser.js +7 -1
- package/development/time-input.js +7 -1
- package/development/timetable-occupancy-icon.js +7 -1
- package/development/timetable-occupancy.js +7 -1
- package/development/title.js +13 -1
- package/development/toast.js +7 -1
- package/development/toggle/toggle-option.js +7 -1
- package/development/toggle/toggle.js +7 -1
- package/development/toggle-check.js +7 -1
- package/development/train/train-blocked-passage.js +7 -1
- package/development/train/train-formation.js +7 -1
- package/development/train/train-wagon.js +7 -1
- package/development/train/train.js +7 -1
- package/development/visual-checkbox.js +7 -1
- package/form-field/form-field-clear.js +1 -1
- package/header/common/header-action-common.d.ts.map +1 -1
- package/icon/icon-name-mixin.d.ts.map +1 -1
- package/icon/icon-request.d.ts.map +1 -1
- package/index.d.ts +2 -0
- package/index.js +2 -0
- package/link/common/block-link-common.d.ts.map +1 -1
- package/link/common/inline-link-common.d.ts.map +1 -1
- package/link/common/link-common.d.ts.map +1 -1
- package/menu/common/menu-action-common.d.ts.map +1 -1
- package/navigation/common/navigation-action-common.d.ts.map +1 -1
- package/notification.js +1 -1
- package/option/optgroup/optgroup.d.ts +2 -0
- package/option/optgroup/optgroup.d.ts.map +1 -1
- package/option/optgroup.js +24 -21
- package/option/option/option.d.ts +6 -5
- package/option/option/option.d.ts.map +1 -1
- package/option/option.js +72 -69
- package/package.json +11 -1
- package/popover/popover-trigger.js +1 -1
- package/radio-button/common/radio-button-common.d.ts.map +1 -1
- package/standard-theme.css +196 -0
- package/table/table-wrapper/table-wrapper.d.ts +24 -0
- package/table/table-wrapper/table-wrapper.d.ts.map +1 -0
- package/table/table-wrapper.d.ts +2 -0
- package/table/table-wrapper.d.ts.map +1 -0
- package/table/table-wrapper.js +39 -0
- package/table.d.ts +2 -0
- package/table.d.ts.map +1 -0
- package/table.js +1 -0
- package/tabs/tab-group/tab-group.d.ts +4 -7
- package/tabs/tab-group/tab-group.d.ts.map +1 -1
- package/tabs/tab-group.js +80 -81
|
@@ -2,7 +2,6 @@ import { CSSResultGroup, PropertyValues, TemplateResult, LitElement } from 'lit'
|
|
|
2
2
|
import { SbbTabLabelElement } from '../tab-label.js';
|
|
3
3
|
import { SbbTabElement } from '../tab.js';
|
|
4
4
|
|
|
5
|
-
export type SbbTabSupportedContentType = SbbTabElement | SbbTabGroupElement;
|
|
6
5
|
export type SbbTabChangedEventDetails = {
|
|
7
6
|
activeIndex: number;
|
|
8
7
|
activeTabLabel: SbbTabLabelElement;
|
|
@@ -21,18 +20,16 @@ export interface InterfaceSbbTabGroupActions {
|
|
|
21
20
|
export interface InterfaceSbbTabGroupTab extends SbbTabLabelElement {
|
|
22
21
|
active?: boolean;
|
|
23
22
|
disabled: boolean;
|
|
24
|
-
|
|
23
|
+
tab?: SbbTabElement;
|
|
25
24
|
index?: number;
|
|
26
25
|
tabGroupActions?: InterfaceSbbTabGroupActions;
|
|
27
26
|
size: 's' | 'l' | 'xl';
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
30
|
-
* It displays one or more
|
|
29
|
+
* It displays one or more tabs, each one with a label and a content.
|
|
31
30
|
*
|
|
32
|
-
* @slot - Use the unnamed slot to add
|
|
33
|
-
*
|
|
34
|
-
* @slot tab-bar - When you provide the `sbb-tab-label` tag through the unnamed slot,
|
|
35
|
-
* it will be automatically moved to this slot. You do not need to use it directly.
|
|
31
|
+
* @slot - Use the unnamed slot to add content to the `sbb-tab-group` via
|
|
32
|
+
* `sbb-tab-label` and `sbb-tab` instances.
|
|
36
33
|
* @event {CustomEvent<SbbTabChangedEventDetails>} didChange - Emits an event on selected tab change.
|
|
37
34
|
*/
|
|
38
35
|
export declare class SbbTabGroupElement extends LitElement {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tab-group.d.ts","sourceRoot":"","sources":["../../../../src/elements/tabs/tab-group/tab-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAQ,UAAU,EAAE,MAAM,KAAK,CAAC;AAQvC,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,WAAW,CAAC;AAI1C,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"tab-group.d.ts","sourceRoot":"","sources":["../../../../src/elements/tabs/tab-group/t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h, LitElement as u, html as f } from "lit";
|
|
2
|
-
import { property as
|
|
2
|
+
import { property as d, customElement as v } from "lit/decorators.js";
|
|
3
3
|
import { ref as p } from "lit/directives/ref.js";
|
|
4
|
-
import { isArrowKeyPressed as
|
|
4
|
+
import { isArrowKeyPressed as _, getNextElementIndex as g } from "../core/a11y.js";
|
|
5
5
|
import { SbbConnectedAbortController as m } from "../core/controllers.js";
|
|
6
|
-
import { EventEmitter as A, throttle as
|
|
7
|
-
import { AgnosticMutationObserver as
|
|
8
|
-
import { SbbTabElement as
|
|
9
|
-
const
|
|
10
|
-
var E = Object.defineProperty, z = Object.getOwnPropertyDescriptor, b = (t,
|
|
11
|
-
for (var
|
|
12
|
-
(
|
|
13
|
-
return
|
|
6
|
+
import { EventEmitter as A, throttle as T } from "../core/eventing.js";
|
|
7
|
+
import { AgnosticMutationObserver as x, AgnosticResizeObserver as c } from "../core/observers.js";
|
|
8
|
+
import { SbbTabElement as y } from "./tab.js";
|
|
9
|
+
const C = h`@charset "UTF-8";*,:before,:after{box-sizing:border-box}:host{--sbb-tab-group-animation-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-4x) );display:block}.tab-group{display:flex;flex-wrap:wrap}.tab-content{margin-block-start:var(--sbb-spacing-responsive-m);transition:height var(--sbb-tab-group-animation-duration) var(--sbb-animation-easing)}.tab-content:after,.tab-content:before{content:" ";display:block;visibility:hidden;height:0}.tab-content ::slotted(*){visibility:hidden;opacity:0;height:0;overflow:hidden;position:relative}.tab-content ::slotted(*[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}.tab-content ::slotted([role=tabpanel]:focus-visible){outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}`;
|
|
10
|
+
var E = Object.defineProperty, z = Object.getOwnPropertyDescriptor, b = (t, i, e, n) => {
|
|
11
|
+
for (var s = n > 1 ? void 0 : n ? z(i, e) : i, o = t.length - 1, r; o >= 0; o--)
|
|
12
|
+
(r = t[o]) && (s = (n ? r(i, e, s) : r(s)) || s);
|
|
13
|
+
return n && s && E(i, e, s), s;
|
|
14
14
|
};
|
|
15
15
|
const G = {
|
|
16
16
|
attributeFilter: ["active", "disabled"]
|
|
17
|
-
}
|
|
18
|
-
let I = 0,
|
|
17
|
+
};
|
|
18
|
+
let I = 0, a = class extends u {
|
|
19
19
|
constructor() {
|
|
20
|
-
super(...arguments), this._tabs = [], this._abort = new m(this), this._tabAttributeObserver = new
|
|
20
|
+
super(...arguments), this._tabs = [], this._abort = new m(this), this._tabAttributeObserver = new x(
|
|
21
21
|
(t) => this._onTabAttributesChange(t)
|
|
22
|
-
), this._tabGroupResizeObserver = new
|
|
22
|
+
), this._tabGroupResizeObserver = new c(
|
|
23
23
|
(t) => this._onTabGroupElementResize(t)
|
|
24
|
-
), this._tabContentResizeObserver = new
|
|
24
|
+
), this._tabContentResizeObserver = new c(
|
|
25
25
|
(t) => this._onTabContentElementResize(t)
|
|
26
26
|
), this._size = "l", this.initialSelectedIndex = 0, this._selectedTabChanged = new A(
|
|
27
27
|
this,
|
|
28
|
-
|
|
28
|
+
a.events.didChange
|
|
29
29
|
), this._onContentSlotChange = () => {
|
|
30
30
|
this._tabContentElement = this.shadowRoot.querySelector("div.tab-content");
|
|
31
|
-
const t = this._getTabs().filter((
|
|
32
|
-
t.length && (t.forEach((
|
|
31
|
+
const t = this._getTabs().filter((i) => !this._tabs.includes(i));
|
|
32
|
+
t.length && (t.forEach((i) => this._configure(i)), this._tabs = this._tabs.concat(t));
|
|
33
33
|
}, this._onTabsSlotChange = () => {
|
|
34
34
|
const t = this._getTabs();
|
|
35
|
-
t.length < this._tabs.length && (this._tabs.filter((
|
|
36
|
-
var
|
|
37
|
-
(
|
|
38
|
-
}), this._tabs = t), this._tabs.forEach((
|
|
35
|
+
t.length < this._tabs.length && (this._tabs.filter((e) => !t.includes(e)).forEach((e) => {
|
|
36
|
+
var n;
|
|
37
|
+
(n = e.tab) == null || n.remove();
|
|
38
|
+
}), this._tabs = t), this._tabs.forEach((i) => i.setAttribute("data-size", this.size));
|
|
39
39
|
};
|
|
40
40
|
}
|
|
41
41
|
set size(t) {
|
|
@@ -53,24 +53,24 @@ let I = 0, r = class extends u {
|
|
|
53
53
|
* @param tabIndex The index of the tab you want to disable.
|
|
54
54
|
*/
|
|
55
55
|
disableTab(t) {
|
|
56
|
-
var
|
|
57
|
-
(
|
|
56
|
+
var i, e;
|
|
57
|
+
(e = (i = this._tabs[t]) == null ? void 0 : i.tabGroupActions) == null || e.disable();
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* Enables a tab by index.
|
|
61
61
|
* @param tabIndex The index of the tab you want to enable.
|
|
62
62
|
*/
|
|
63
63
|
enableTab(t) {
|
|
64
|
-
var
|
|
65
|
-
(
|
|
64
|
+
var i, e;
|
|
65
|
+
(e = (i = this._tabs[t]) == null ? void 0 : i.tabGroupActions) == null || e.enable();
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Activates a tab by index.
|
|
69
69
|
* @param tabIndex The index of the tab you want to activate.
|
|
70
70
|
*/
|
|
71
71
|
activateTab(t) {
|
|
72
|
-
var
|
|
73
|
-
(
|
|
72
|
+
var i, e;
|
|
73
|
+
(e = (i = this._tabs[t]) == null ? void 0 : i.tabGroupActions) == null || e.select();
|
|
74
74
|
}
|
|
75
75
|
_getTabs() {
|
|
76
76
|
return Array.from(this.children ?? []).filter(
|
|
@@ -81,13 +81,12 @@ let I = 0, r = class extends u {
|
|
|
81
81
|
return this._tabs.filter((t) => !t.hasAttribute("disabled"));
|
|
82
82
|
}
|
|
83
83
|
connectedCallback() {
|
|
84
|
-
var e;
|
|
85
84
|
super.connectedCallback();
|
|
86
85
|
const t = this._abort.signal;
|
|
87
|
-
this.addEventListener("keydown", (i) => this._handleKeyDown(i), { signal: t })
|
|
86
|
+
this.addEventListener("keydown", (i) => this._handleKeyDown(i), { signal: t });
|
|
88
87
|
}
|
|
89
88
|
firstUpdated(t) {
|
|
90
|
-
super.firstUpdated(t), this._tabs = this._getTabs(), this._tabs.forEach((
|
|
89
|
+
super.firstUpdated(t), this._tabs = this._getTabs(), this._tabs.forEach((i) => this._configure(i)), this._initSelection(), this._tabGroupResizeObserver.observe(this._tabGroupElement);
|
|
91
90
|
}
|
|
92
91
|
disconnectedCallback() {
|
|
93
92
|
super.disconnectedCallback(), this._tabAttributeObserver.disconnect(), this._tabContentResizeObserver.disconnect(), this._tabGroupResizeObserver.disconnect();
|
|
@@ -96,80 +95,80 @@ let I = 0, r = class extends u {
|
|
|
96
95
|
return `sbb-tab-panel-${++I}`;
|
|
97
96
|
}
|
|
98
97
|
_initSelection() {
|
|
99
|
-
var t,
|
|
100
|
-
this.initialSelectedIndex >= 0 && this.initialSelectedIndex < this._tabs.length && !this._tabs[this.initialSelectedIndex].disabled ? (t = this._tabs[this.initialSelectedIndex].tabGroupActions) == null || t.select() : (
|
|
98
|
+
var t, i, e;
|
|
99
|
+
this.initialSelectedIndex >= 0 && this.initialSelectedIndex < this._tabs.length && !this._tabs[this.initialSelectedIndex].disabled ? (t = this._tabs[this.initialSelectedIndex].tabGroupActions) == null || t.select() : (e = (i = this._enabledTabs[0]) == null ? void 0 : i.tabGroupActions) == null || e.select();
|
|
101
100
|
}
|
|
102
101
|
_onTabAttributesChange(t) {
|
|
103
|
-
var
|
|
104
|
-
for (const
|
|
105
|
-
if (
|
|
102
|
+
var i, e, n;
|
|
103
|
+
for (const s of t) {
|
|
104
|
+
if (s.type !== "attributes")
|
|
106
105
|
return;
|
|
107
|
-
const
|
|
108
|
-
|
|
106
|
+
const o = s.target;
|
|
107
|
+
s.attributeName === "disabled" && (o.hasAttribute("disabled") && o !== this._selectedTab ? (i = o.tabGroupActions) == null || i.disable() : o.disabled && ((e = o.tabGroupActions) == null || e.enable())), s.attributeName === "active" && (o.hasAttribute("active") && !o.disabled ? (n = o.tabGroupActions) == null || n.select() : o === this._selectedTab && o.toggleAttribute("active", !0));
|
|
109
108
|
}
|
|
110
109
|
}
|
|
111
110
|
_onTabGroupElementResize(t) {
|
|
112
|
-
for (const
|
|
113
|
-
const
|
|
114
|
-
for (const
|
|
115
|
-
|
|
111
|
+
for (const i of t) {
|
|
112
|
+
const e = i.target.firstElementChild.assignedElements();
|
|
113
|
+
for (const n of e)
|
|
114
|
+
n.toggleAttribute(
|
|
116
115
|
"data-has-divider",
|
|
117
|
-
|
|
116
|
+
n === e[0] || n.offsetLeft === e[0].offsetLeft
|
|
118
117
|
), this.style.setProperty("--sbb-tab-group-width", `${this._tabGroupElement.clientWidth}px`);
|
|
119
118
|
}
|
|
120
119
|
}
|
|
121
120
|
_onTabContentElementResize(t) {
|
|
122
|
-
for (const
|
|
123
|
-
const
|
|
124
|
-
this._tabContentElement.style.height = `${
|
|
121
|
+
for (const i of t) {
|
|
122
|
+
const e = Math.floor(i.contentRect.height);
|
|
123
|
+
this._tabContentElement.style.height = `${e}px`;
|
|
125
124
|
}
|
|
126
125
|
}
|
|
127
126
|
_configure(t) {
|
|
128
|
-
var
|
|
127
|
+
var i;
|
|
129
128
|
t.tabGroupActions = {
|
|
130
129
|
activate: () => {
|
|
131
|
-
var
|
|
132
|
-
t.toggleAttribute("active", !0), t.active = !0, t.tabIndex = 0, t.setAttribute("aria-selected", "true"), (
|
|
130
|
+
var e;
|
|
131
|
+
t.toggleAttribute("active", !0), t.active = !0, t.tabIndex = 0, t.setAttribute("aria-selected", "true"), (e = t.tab) == null || e.toggleAttribute("active", !0);
|
|
133
132
|
},
|
|
134
133
|
deactivate: () => {
|
|
135
|
-
var
|
|
136
|
-
t.removeAttribute("active"), t.active = !1, t.tabIndex = -1, t.setAttribute("aria-selected", "false"), (
|
|
134
|
+
var e;
|
|
135
|
+
t.removeAttribute("active"), t.active = !1, t.tabIndex = -1, t.setAttribute("aria-selected", "false"), (e = t.tab) == null || e.removeAttribute("active");
|
|
137
136
|
},
|
|
138
137
|
disable: () => {
|
|
139
|
-
var
|
|
140
|
-
t.disabled || (t.hasAttribute("disabled") || t.toggleAttribute("disabled", !0), t.disabled = !0, t.tabIndex = -1, t.setAttribute("aria-selected", "false"), (
|
|
138
|
+
var e, n, s;
|
|
139
|
+
t.disabled || (t.hasAttribute("disabled") || t.toggleAttribute("disabled", !0), t.disabled = !0, t.tabIndex = -1, t.setAttribute("aria-selected", "false"), (e = t.tab) == null || e.removeAttribute("active"), t.active && (t.removeAttribute("active"), t.active = !1, (s = (n = this._enabledTabs[0]) == null ? void 0 : n.tabGroupActions) == null || s.select()));
|
|
141
140
|
},
|
|
142
141
|
enable: () => {
|
|
143
142
|
t.disabled && (t.removeAttribute("disabled"), t.disabled = !1);
|
|
144
143
|
},
|
|
145
144
|
select: () => {
|
|
146
|
-
var
|
|
145
|
+
var e, n;
|
|
147
146
|
if (t !== this._selectedTab && !t.disabled) {
|
|
148
|
-
const
|
|
149
|
-
|
|
147
|
+
const s = this._selectedTab;
|
|
148
|
+
s && ((e = s.tabGroupActions) == null || e.deactivate(), this._tabContentResizeObserver.unobserve(s.tab)), (n = t.tabGroupActions) == null || n.activate(), this._selectedTab = t, this._tabContentResizeObserver.observe(t.tab);
|
|
150
149
|
const o = this._tabs;
|
|
151
150
|
this._selectedTabChanged.emit({
|
|
152
|
-
activeIndex: o.findIndex((
|
|
151
|
+
activeIndex: o.findIndex((r) => r === t),
|
|
153
152
|
activeTabLabel: t,
|
|
154
|
-
activeTab: t.
|
|
155
|
-
previousIndex: o.findIndex((
|
|
156
|
-
previousTabLabel:
|
|
157
|
-
previousTab:
|
|
153
|
+
activeTab: t.tab,
|
|
154
|
+
previousIndex: o.findIndex((r) => r === s),
|
|
155
|
+
previousTabLabel: s,
|
|
156
|
+
previousTab: s == null ? void 0 : s.tab
|
|
158
157
|
});
|
|
159
158
|
}
|
|
160
159
|
}
|
|
161
|
-
}, (
|
|
162
|
-
var
|
|
163
|
-
(
|
|
164
|
-
}), t.
|
|
160
|
+
}, ((i = t.nextElementSibling) == null ? void 0 : i.localName) === "sbb-tab" && (t.tab = t.nextElementSibling, t.tab.id = this._assignId(), t.tab instanceof y && (t.tab.tabIndex = 0, t.tab.configure())), t.tabIndex = -1, t.disabled = t.hasAttribute("disabled"), t.active = t.hasAttribute("active") && !t.disabled, t.setAttribute("role", "tab"), t.setAttribute("aria-selected", "false"), t.addEventListener("click", () => {
|
|
161
|
+
var e;
|
|
162
|
+
(e = t.tabGroupActions) == null || e.select();
|
|
163
|
+
}), t.tab && (t.setAttribute("aria-controls", t.tab.id), t.tab.setAttribute("role", "tabpanel"), t.tab.toggleAttribute("active", t.active)), this._tabAttributeObserver.observe(t, G), t.slot = "tab-bar";
|
|
165
164
|
}
|
|
166
165
|
_handleKeyDown(t) {
|
|
167
|
-
var
|
|
168
|
-
const
|
|
169
|
-
if (!(!
|
|
170
|
-
t.target !== this && t.target.parentElement !== this) &&
|
|
171
|
-
const
|
|
172
|
-
(
|
|
166
|
+
var e, n, s;
|
|
167
|
+
const i = this._enabledTabs;
|
|
168
|
+
if (!(!i || // don't trap nested handling
|
|
169
|
+
t.target !== this && t.target.parentElement !== this) && _(t)) {
|
|
170
|
+
const o = i.findIndex((l) => l.active), r = g(t, o, i.length);
|
|
171
|
+
(n = (e = i[r]) == null ? void 0 : e.tabGroupActions) == null || n.select(), (s = i[r]) == null || s.focus(), t.preventDefault();
|
|
173
172
|
}
|
|
174
173
|
}
|
|
175
174
|
render() {
|
|
@@ -183,24 +182,24 @@ let I = 0, r = class extends u {
|
|
|
183
182
|
</div>
|
|
184
183
|
|
|
185
184
|
<div class="tab-content">
|
|
186
|
-
<slot @slotchange=${
|
|
185
|
+
<slot @slotchange=${T(this._onContentSlotChange, 150)}></slot>
|
|
187
186
|
</div>
|
|
188
187
|
`;
|
|
189
188
|
}
|
|
190
189
|
};
|
|
191
|
-
|
|
192
|
-
|
|
190
|
+
a.styles = C;
|
|
191
|
+
a.events = {
|
|
193
192
|
didChange: "didChange"
|
|
194
193
|
};
|
|
195
194
|
b([
|
|
196
|
-
|
|
197
|
-
],
|
|
195
|
+
d()
|
|
196
|
+
], a.prototype, "size", 1);
|
|
198
197
|
b([
|
|
199
|
-
|
|
200
|
-
],
|
|
201
|
-
|
|
198
|
+
d({ attribute: "initial-selected-index", type: Number })
|
|
199
|
+
], a.prototype, "initialSelectedIndex", 2);
|
|
200
|
+
a = b([
|
|
202
201
|
v("sbb-tab-group")
|
|
203
|
-
],
|
|
202
|
+
], a);
|
|
204
203
|
export {
|
|
205
|
-
|
|
204
|
+
a as SbbTabGroupElement
|
|
206
205
|
};
|