@sbb-esta/lyne-elements 0.52.1 → 0.52.2
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/accordion.js +54 -54
- package/action-group.js +3 -3
- package/alert/alert-group.js +22 -22
- package/alert/alert.js +22 -22
- package/autocomplete.js +126 -126
- package/breadcrumb/breadcrumb-group.js +60 -60
- package/breadcrumb/breadcrumb.js +17 -17
- package/calendar.js +423 -423
- package/card/card-badge.js +17 -17
- package/card/card.js +2 -2
- package/card/common.js +30 -30
- package/checkbox/checkbox-group.js +17 -17
- package/checkbox/checkbox.js +34 -34
- package/clock.js +83 -83
- package/container/sticky-bar.js +16 -16
- package/core/a11y.js +91 -91
- package/core/base-elements.js +86 -86
- package/core/controllers.js +40 -40
- package/core/datetime.js +32 -32
- package/core/dom.js +26 -26
- package/core/eventing.js +33 -33
- package/core/mixins.js +122 -122
- package/core/testing.js +29 -29
- package/datepicker/common.js +55 -55
- package/datepicker/datepicker-toggle.js +94 -94
- package/datepicker/datepicker.js +144 -144
- package/dialog/dialog-title.js +20 -20
- package/dialog/dialog.js +66 -66
- package/expansion-panel/expansion-panel-header.js +20 -20
- package/expansion-panel/expansion-panel.js +60 -60
- package/file-selector.js +91 -91
- package/form-field/form-field-clear.js +12 -12
- package/form-field/form-field.js +111 -111
- package/header/header.js +53 -53
- package/icon.js +107 -107
- package/image.js +87 -87
- package/journey-header.js +29 -29
- package/map-container.js +23 -23
- package/menu/menu.js +91 -91
- package/navigation/common.js +16 -16
- package/navigation/navigation-marker.js +34 -34
- package/navigation/navigation-section.js +83 -83
- package/navigation/navigation.js +87 -87
- package/notification.js +52 -52
- package/option/optgroup.js +45 -45
- package/option/option.js +108 -108
- package/overlay.js +5 -5
- package/package.json +1 -1
- package/popover/popover.js +110 -110
- package/radio-button/radio-button-group.js +93 -93
- package/radio-button/radio-button.js +84 -84
- package/select.js +178 -178
- package/selection-panel.js +44 -44
- package/slider.js +58 -58
- package/status.js +6 -6
- package/stepper/step-label.js +19 -19
- package/stepper/step.js +31 -31
- package/stepper/stepper.js +46 -46
- package/tabs/tab-group.js +67 -67
- package/tag/tag-group.js +8 -8
- package/tag/tag.js +27 -27
- package/teaser-paid.js +12 -12
- package/time-input.js +73 -73
- package/timetable-occupancy-icon.js +26 -26
- package/timetable-occupancy.js +9 -9
- package/toast.js +38 -38
- package/toggle/toggle-option.js +33 -33
- package/toggle/toggle.js +46 -46
- package/train/train-formation.js +36 -36
- package/train/train-wagon.js +30 -30
- package/train/train.js +13 -13
package/toast.js
CHANGED
|
@@ -2,28 +2,28 @@ import { css as m, html as d, nothing as p } from "lit";
|
|
|
2
2
|
import { property as b, customElement as h } from "lit/decorators.js";
|
|
3
3
|
import { SbbOpenCloseBaseElement as f } from "./core/base-elements.js";
|
|
4
4
|
import { SbbConnectedAbortController as v, SbbLanguageController as g, SbbSlotStateController as u } from "./core/controllers.js";
|
|
5
|
-
import { isFirefox as
|
|
6
|
-
import { composedPathHasAttribute as
|
|
7
|
-
import { i18nCloseAlert as
|
|
8
|
-
import { SbbIconNameMixin as
|
|
5
|
+
import { isFirefox as _ } from "./core/dom.js";
|
|
6
|
+
import { composedPathHasAttribute as x } from "./core/eventing.js";
|
|
7
|
+
import { i18nCloseAlert as y } from "./core/i18n.js";
|
|
8
|
+
import { SbbIconNameMixin as T } from "./icon.js";
|
|
9
9
|
import "./button/transparent-button.js";
|
|
10
10
|
const k = m`*,:before,:after{box-sizing:border-box}:host{--sbb-toast-max-width: 25rem;--sbb-toast-animation-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-6x) );--sbb-toast-animation-timing-function: ease;--sbb-toast-color: var(--sbb-color-white);--sbb-toast-text-color: var(--sbb-color-milk);--sbb-toast-background-color: var(--sbb-color-midnight);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark);--sbb-toast-margin: var(--sbb-spacing-responsive-s);--sbb-toast-padding-block: var(--sbb-spacing-responsive-xxxs);--sbb-toast-padding-inline: var(--sbb-spacing-responsive-xs);--sbb-toast-border-radius: var(--sbb-border-radius-4x);--sbb-toast-container-display: flex;--sbb-toast-container-position: fixed;--sbb-toast-horizontal-position: initial;--sbb-toast-vertical-position: initial;display:block}:host(:not([data-state])),:host([data-state=closed]){--sbb-toast-container-display: none}:host([position=bottom-left]),:host([position=bottom-start]){--sbb-toast-horizontal-position: flex-start;--sbb-toast-vertical-position: flex-end}:host([position=bottom-center]){--sbb-toast-horizontal-position: center;--sbb-toast-vertical-position: flex-end}:host([position=bottom-right]),:host([position=bottom-end]){--sbb-toast-horizontal-position: flex-end;--sbb-toast-vertical-position: flex-end}:host([position=top-left]),:host([position=top-start]){--sbb-toast-horizontal-position: flex-start;--sbb-toast-vertical-position: flex-start}:host([position=top-center]){--sbb-toast-horizontal-position: center;--sbb-toast-vertical-position: flex-start}:host([position=top-right]),:host([position=top-end]){--sbb-toast-horizontal-position: flex-end;--sbb-toast-vertical-position: flex-start}.sbb-toast__overlay-container{position:var(--sbb-toast-container-position);pointer-events:none;top:0;right:0;bottom:0;left:0;display:var(--sbb-toast-container-display);justify-content:var(--sbb-toast-horizontal-position);align-items:var(--sbb-toast-vertical-position)}.sbb-toast{z-index:var(--sbb-toast-z-index, var(--sbb-overlay-default-z-index));pointer-events:auto;margin:var(--sbb-toast-margin);padding-block:var(--sbb-toast-padding-block);padding-inline:var(--sbb-toast-padding-inline);border-radius:var(--sbb-toast-border-radius);max-width:var(--sbb-toast-max-width);display:flex;color:var(--sbb-toast-color);background-color:var(--sbb-toast-background-color)}:host([data-state=opening]) .sbb-toast{animation-name:open;animation-duration:var(--sbb-toast-animation-duration);animation-timing-function:var(--sbb-toast-animation-timing-function)}:host([data-state=closing]) .sbb-toast{animation-name:close;animation-duration:var(--sbb-toast-animation-duration);animation-timing-function:var(--sbb-toast-animation-timing-function)}.sbb-toast__icon{margin-inline-end:var(--sbb-spacing-fixed-2x);line-height:initial}:host(:not([data-slot-names~=icon],[icon-name])) .sbb-toast__icon{display:none}.sbb-toast__content{--sbb-title-line-height: var(--sbb-typo-line-height-titles);--sbb-title-margin-block-start: 0;--sbb-title-margin-block-end: 0;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale;margin:0;margin-block:var(--sbb-title-margin-block-start) var(--sbb-title-margin-block-end);font-family:var(--sbb-typo-font-family);font-weight:700;line-height:var(--sbb-title-line-height);letter-spacing:var(--sbb-typo-letter-spacing-titles);font-size:var(--sbb-title-font-size);--sbb-title-font-size: var(--sbb-font-size-title-6);--sbb-title-line-height: var(--sbb-typo-line-height-body-text);color:var(--sbb-toast-text-color);flex:1 1 0}.sbb-toast__action{position:relative;min-width:2.5rem}:host(:not([data-slot-names~=action],[dismissible])) .sbb-toast__action{display:none}::slotted([data-sbb-button]),.sbb-toast__action-button{margin-inline:var(--sbb-spacing-fixed-2x);position:absolute;top:-.625rem}::slotted(:is(sbb-link,sbb-link-button,sbb-link-static)){margin-inline-start:var(--sbb-spacing-fixed-4x)}@keyframes open{0%{visibility:hidden;opacity:0;transform:translateY(var(--sbb-spacing-fixed-2x))}to{visibility:visible;opacity:1;transform:translateY(0)}}@keyframes close{0%{visibility:visible;opacity:1;transform:translateY(0)}to{visibility:hidden;opacity:0;transform:translateY(var(--sbb-spacing-fixed-2x))}}`;
|
|
11
|
-
var
|
|
12
|
-
for (var t = a > 1 ? void 0 : a ?
|
|
13
|
-
(l =
|
|
14
|
-
return a && t &&
|
|
11
|
+
var N = Object.defineProperty, C = Object.getOwnPropertyDescriptor, n = (o, s, i, a) => {
|
|
12
|
+
for (var t = a > 1 ? void 0 : a ? C(s, i) : s, r = o.length - 1, l; r >= 0; r--)
|
|
13
|
+
(l = o[r]) && (t = (a ? l(s, i, t) : l(t)) || t);
|
|
14
|
+
return a && t && N(s, i, t), t;
|
|
15
15
|
};
|
|
16
16
|
const c = /* @__PURE__ */ new Set();
|
|
17
|
-
let e = class extends
|
|
17
|
+
let e = class extends T(f) {
|
|
18
18
|
constructor() {
|
|
19
|
-
super(), this.timeout = 6e3, this.position = "bottom-center", this.dismissible = !1, this.politeness = "polite", this.
|
|
19
|
+
super(), this.timeout = 6e3, this.position = "bottom-center", this.dismissible = !1, this.politeness = "polite", this._abort = new v(this), this._language = new g(this), new u(this);
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Role of the live region. This is only for Firefox as there is a known issue where Firefox +
|
|
23
23
|
* JAWS does not read out aria-live message.
|
|
24
24
|
*/
|
|
25
|
-
get
|
|
26
|
-
if (
|
|
25
|
+
get _role() {
|
|
26
|
+
if (_) {
|
|
27
27
|
if (this.politeness === "polite")
|
|
28
28
|
return "status";
|
|
29
29
|
if (this.politeness === "assertive")
|
|
@@ -35,46 +35,46 @@ let e = class extends N(f) {
|
|
|
35
35
|
* If there are other opened toasts in the page, close them first.
|
|
36
36
|
*/
|
|
37
37
|
open() {
|
|
38
|
-
this.state === "closed" && this.willOpen.emit() && (this.state = "opening", this.
|
|
38
|
+
this.state === "closed" && this.willOpen.emit() && (this.state = "opening", this._closeOtherToasts());
|
|
39
39
|
}
|
|
40
40
|
/**
|
|
41
41
|
* Close the toast.
|
|
42
42
|
*/
|
|
43
43
|
close() {
|
|
44
|
-
this.state === "opened" && this.willClose.emit() && (clearTimeout(this.
|
|
44
|
+
this.state === "opened" && this.willClose.emit() && (clearTimeout(this._closeTimeout), this.state = "closing");
|
|
45
45
|
}
|
|
46
46
|
// Close the toast on click of any element that has the 'sbb-toast-close' attribute.
|
|
47
|
-
|
|
48
|
-
const
|
|
49
|
-
|
|
47
|
+
_onClick(o) {
|
|
48
|
+
const s = x(o, "sbb-toast-close", this);
|
|
49
|
+
s && !s.hasAttribute("disabled") && this.close();
|
|
50
50
|
}
|
|
51
51
|
connectedCallback() {
|
|
52
52
|
super.connectedCallback();
|
|
53
|
-
const
|
|
54
|
-
this.addEventListener("click", (
|
|
53
|
+
const o = this._abort.signal;
|
|
54
|
+
this.addEventListener("click", (s) => this._onClick(s), { signal: o }), c.add(this);
|
|
55
55
|
}
|
|
56
56
|
disconnectedCallback() {
|
|
57
|
-
super.disconnectedCallback(), clearTimeout(this.
|
|
57
|
+
super.disconnectedCallback(), clearTimeout(this._closeTimeout), c.delete(this);
|
|
58
58
|
}
|
|
59
59
|
/**
|
|
60
60
|
* Slotted text nodes are not read correctly by screen readers on Chrome.
|
|
61
61
|
* To address the problem, if there is at least a root text node,
|
|
62
62
|
* we wrap the whole content in a <span> tag
|
|
63
63
|
*/
|
|
64
|
-
|
|
65
|
-
const
|
|
66
|
-
if (
|
|
64
|
+
_onContentSlotChange(o) {
|
|
65
|
+
const s = o.target.assignedNodes();
|
|
66
|
+
if (s.some((i) => i.nodeType === Node.TEXT_NODE)) {
|
|
67
67
|
const i = document.createElement("span");
|
|
68
|
-
this.appendChild(i), i.append(...
|
|
68
|
+
this.appendChild(i), i.append(...s);
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
const
|
|
73
|
-
|
|
71
|
+
_onActionSlotChange(o) {
|
|
72
|
+
const s = o.target.assignedNodes();
|
|
73
|
+
s.filter(
|
|
74
74
|
(t) => t.nodeName === "SBB-TRANSPARENT-BUTTON" || t.nodeName === "SBB-TRANSPARENT-BUTTON-LINK"
|
|
75
75
|
).forEach((t) => {
|
|
76
76
|
t.negative = !0, t.size = "m";
|
|
77
|
-
}),
|
|
77
|
+
}), s.filter(
|
|
78
78
|
(t) => ["SBB-LINK", "SBB-LINK-BUTTON", "SBB-LINK-STATIC"].includes(t.nodeName)
|
|
79
79
|
).forEach((t) => {
|
|
80
80
|
t.negative = !0;
|
|
@@ -82,15 +82,15 @@ let e = class extends N(f) {
|
|
|
82
82
|
}
|
|
83
83
|
// In rare cases it can be that the animationEnd event is triggered twice.
|
|
84
84
|
// To avoid entering a corrupt state, exit when state is not expected.
|
|
85
|
-
|
|
86
|
-
|
|
85
|
+
_onToastAnimationEnd(o) {
|
|
86
|
+
o.animationName === "open" && this.state === "opening" && (this.state = "opened", this.didOpen.emit(), this.timeout && (this._closeTimeout = setTimeout(() => this.close(), this.timeout))), o.animationName === "close" && this.state === "closing" && (this.state = "closed", this.didClose.emit());
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
89
|
* Since we do not stack toasts, we force the closing on other existing opened ones
|
|
90
90
|
*/
|
|
91
|
-
|
|
92
|
-
c.forEach((
|
|
93
|
-
|
|
91
|
+
_closeOtherToasts() {
|
|
92
|
+
c.forEach((o) => {
|
|
93
|
+
o.getAttribute("data-state") === "opened" && o.close();
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
render() {
|
|
@@ -100,23 +100,23 @@ let e = class extends N(f) {
|
|
|
100
100
|
class="sbb-toast"
|
|
101
101
|
${/* Firefox needs 'role' to enable screen readers */
|
|
102
102
|
""}
|
|
103
|
-
role=${this.
|
|
104
|
-
@animationend=${this.
|
|
103
|
+
role=${this._role ?? p}
|
|
104
|
+
@animationend=${this._onToastAnimationEnd}
|
|
105
105
|
>
|
|
106
106
|
<div class="sbb-toast__icon">${this.renderIconSlot()}</div>
|
|
107
107
|
|
|
108
108
|
<div class="sbb-toast__content" aria-live=${this.politeness}>
|
|
109
|
-
<slot @slotchange=${this.
|
|
109
|
+
<slot @slotchange=${this._onContentSlotChange}></slot>
|
|
110
110
|
</div>
|
|
111
111
|
|
|
112
112
|
<div class="sbb-toast__action">
|
|
113
|
-
<slot name="action" @slotchange=${this.
|
|
113
|
+
<slot name="action" @slotchange=${this._onActionSlotChange}>
|
|
114
114
|
${this.dismissible ? d` <sbb-transparent-button
|
|
115
115
|
class="sbb-toast__action-button"
|
|
116
116
|
icon-name="cross-small"
|
|
117
117
|
negative
|
|
118
118
|
size="m"
|
|
119
|
-
aria-label=${
|
|
119
|
+
aria-label=${y[this._language.current]}
|
|
120
120
|
sbb-toast-close
|
|
121
121
|
></sbb-transparent-button>` : p}
|
|
122
122
|
</slot>
|
package/toggle/toggle-option.js
CHANGED
|
@@ -1,50 +1,50 @@
|
|
|
1
|
-
import { css as
|
|
1
|
+
import { css as h, LitElement as c, html as g, nothing as d } from "lit";
|
|
2
2
|
import { property as a, customElement as p } from "lit/decorators.js";
|
|
3
3
|
import { SbbConnectedAbortController as u, SbbSlotStateController as f } from "../core/controllers.js";
|
|
4
4
|
import { hostAttributes as v } from "../core/decorators.js";
|
|
5
5
|
import { setOrRemoveAttribute as m } from "../core/dom.js";
|
|
6
|
-
import { SbbIconNameMixin as
|
|
7
|
-
const
|
|
8
|
-
var x = Object.defineProperty,
|
|
9
|
-
for (var o =
|
|
10
|
-
(
|
|
11
|
-
return
|
|
6
|
+
import { SbbIconNameMixin as _ } from "../icon.js";
|
|
7
|
+
const y = h`*,:before,:after{box-sizing:border-box}:host{--sbb-toggle-option-cursor: pointer;--sbb-toggle-option-color: var(--sbb-color-anthracite);--sbb-toggle-option-icon-min-size: var(--sbb-size-icon-ui-small);--sbb-toggle-option-border-radius: var(--sbb-border-radius-infinity);--sbb-toggle-option-line-height: calc(1em * var(--sbb-typo-line-height-body-text));display:inline-block;min-width:var(--sbb-toggle-min-width);overflow:hidden;z-index:1}:host(:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch])){outline:none!important}:host([checked]){--sbb-toggle-option-color: var(--sbb-color-charcoal)}:host([disabled]){--sbb-toggle-option-cursor: unset;--sbb-toggle-option-color: var(--sbb-color-granite)}input[type=radio]{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.sbb-toggle-option{--sbb-text-font-size: var(--sbb-font-size-text-xs);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;cursor:var(--sbb-toggle-option-cursor);display:flex;justify-content:center;align-items:center;height:var(--sbb-toggle-height);padding-inline:var(--sbb-toggle-padding-inline);border-radius:var(--sbb-toggle-option-border-radius);color:var(--sbb-toggle-option-color)}:host([data-slot-names~=unnamed]:where([data-slot-names~=icon],[icon-name])) .sbb-toggle-option{gap:var(--sbb-spacing-fixed-1x)}.sbb-toggle-option__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch])) .sbb-toggle-option__label:before{content:"";position:absolute;pointer-events:none;inset:calc(var(--sbb-focus-outline-offset) * -2);border:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width);border-radius:var(--sbb-toggle-option-border-radius)}sbb-icon,::slotted(sbb-icon){min-width:var(--sbb-toggle-option-icon-min-size);min-height:var(--sbb-toggle-option-icon-min-size)}`;
|
|
8
|
+
var x = Object.defineProperty, w = Object.getOwnPropertyDescriptor, n = (e, t, i, l) => {
|
|
9
|
+
for (var o = l > 1 ? void 0 : l ? w(t, i) : t, r = e.length - 1, b; r >= 0; r--)
|
|
10
|
+
(b = e[r]) && (o = (l ? b(t, i, o) : b(o)) || o);
|
|
11
|
+
return l && o && x(t, i, o), o;
|
|
12
12
|
};
|
|
13
|
-
let s = class extends
|
|
13
|
+
let s = class extends _(c) {
|
|
14
14
|
constructor() {
|
|
15
|
-
super(), this.checked = !1, this.disabled = !1, this.
|
|
15
|
+
super(), this.checked = !1, this.disabled = !1, this._value = "", this._abort = new u(this), new f(this);
|
|
16
16
|
}
|
|
17
|
-
set value(
|
|
18
|
-
this.
|
|
17
|
+
set value(e) {
|
|
18
|
+
this._value = `${e}`;
|
|
19
19
|
}
|
|
20
20
|
get value() {
|
|
21
|
-
return this.
|
|
21
|
+
return this._value;
|
|
22
22
|
}
|
|
23
23
|
connectedCallback() {
|
|
24
|
-
var
|
|
24
|
+
var t;
|
|
25
25
|
super.connectedCallback();
|
|
26
|
-
const
|
|
27
|
-
this.addEventListener("input", () => this.
|
|
26
|
+
const e = this._abort.signal;
|
|
27
|
+
this.addEventListener("input", () => this._handleInput(), { signal: e }), this.addEventListener("click", () => {
|
|
28
28
|
var i;
|
|
29
29
|
return (i = this.shadowRoot.querySelector("label")) == null ? void 0 : i.click();
|
|
30
30
|
}, {
|
|
31
|
-
signal:
|
|
32
|
-
}), this.
|
|
31
|
+
signal: e
|
|
32
|
+
}), this._toggle = ((t = this.closest) == null ? void 0 : t.call(this, "sbb-toggle")) ?? void 0, this._verifyTabindex();
|
|
33
33
|
}
|
|
34
|
-
willUpdate(
|
|
35
|
-
super.willUpdate(
|
|
34
|
+
willUpdate(e) {
|
|
35
|
+
super.willUpdate(e), e.has("checked") && (this.setAttribute("aria-checked", `${this.checked}`), this._verifyTabindex(), this.checked && this._uncheckOtherOptions()), e.has("disabled") && this._handleDisabledChange();
|
|
36
36
|
}
|
|
37
|
-
|
|
38
|
-
var
|
|
39
|
-
(
|
|
37
|
+
_uncheckOtherOptions() {
|
|
38
|
+
var e;
|
|
39
|
+
(e = this._toggle) == null || e.options.filter((t) => t !== this).forEach((t) => t.checked = !1);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
this.
|
|
41
|
+
_handleDisabledChange() {
|
|
42
|
+
this._toggle && (this._toggle.disabled && !this.disabled ? this.disabled = !0 : !this._toggle.disabled && this.disabled && (this.disabled = !1)), m(this, "aria-disabled", this.disabled ? "true" : null), this._verifyTabindex();
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
this.disabled || (this.checked = !0, this.
|
|
44
|
+
_handleInput() {
|
|
45
|
+
this.disabled || (this.checked = !0, this._uncheckOtherOptions());
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
_verifyTabindex() {
|
|
48
48
|
this.tabIndex = this.checked && !this.disabled ? 0 : -1;
|
|
49
49
|
}
|
|
50
50
|
render() {
|
|
@@ -57,7 +57,7 @@ let s = class extends y(h) {
|
|
|
57
57
|
?disabled=${this.disabled}
|
|
58
58
|
.checked=${this.checked || d}
|
|
59
59
|
.value=${this.value || d}
|
|
60
|
-
@click=${(
|
|
60
|
+
@click=${(e) => e.stopPropagation()}
|
|
61
61
|
/>
|
|
62
62
|
<label class="sbb-toggle-option" for="sbb-toggle-option-id">
|
|
63
63
|
${this.renderIconSlot()}
|
|
@@ -68,17 +68,17 @@ let s = class extends y(h) {
|
|
|
68
68
|
`;
|
|
69
69
|
}
|
|
70
70
|
};
|
|
71
|
-
s.styles =
|
|
72
|
-
|
|
71
|
+
s.styles = y;
|
|
72
|
+
n([
|
|
73
73
|
a({ reflect: !0, type: Boolean })
|
|
74
74
|
], s.prototype, "checked", 2);
|
|
75
|
-
|
|
75
|
+
n([
|
|
76
76
|
a({ reflect: !0, type: Boolean })
|
|
77
77
|
], s.prototype, "disabled", 2);
|
|
78
|
-
|
|
78
|
+
n([
|
|
79
79
|
a()
|
|
80
80
|
], s.prototype, "value", 1);
|
|
81
|
-
s =
|
|
81
|
+
s = n([
|
|
82
82
|
p("sbb-toggle-option"),
|
|
83
83
|
v({
|
|
84
84
|
role: "radio"
|
package/toggle/toggle.js
CHANGED
|
@@ -1,126 +1,126 @@
|
|
|
1
|
-
import { css as
|
|
1
|
+
import { css as u, LitElement as v, isServer as c, html as m } from "lit";
|
|
2
2
|
import { property as a, customElement as f } from "lit/decorators.js";
|
|
3
|
-
import { interactivityChecker as y, isArrowKeyPressed as
|
|
4
|
-
import { SbbConnectedAbortController as
|
|
5
|
-
import { hostAttributes as
|
|
3
|
+
import { interactivityChecker as y, isArrowKeyPressed as _, getNextElementIndex as w } from "../core/a11y.js";
|
|
4
|
+
import { SbbConnectedAbortController as x } from "../core/controllers.js";
|
|
5
|
+
import { hostAttributes as k } from "../core/decorators.js";
|
|
6
6
|
import { EventEmitter as p } from "../core/eventing.js";
|
|
7
7
|
import { AgnosticResizeObserver as C } from "../core/observers.js";
|
|
8
|
-
const
|
|
9
|
-
var
|
|
10
|
-
for (var o = i > 1 ? void 0 : i ?
|
|
11
|
-
(
|
|
12
|
-
return i && o &&
|
|
8
|
+
const z = u`*,:before,:after{box-sizing:border-box}:host{--sbb-toggle-width: fit-content;--sbb-toggle-min-width: calc( var(--sbb-toggle-padding-inline) * 2 + var(--sbb-size-icon-ui-small) );--sbb-toggle-selected-option-border-color: var(--sbb-color-smoke);--sbb-toggle-padding-inline: var(--sbb-spacing-responsive-xxxs);--sbb-toggle-animation-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-6x) );--sbb-toggle-height: 1.75rem;--sbb-toggle-border-width: var(--sbb-border-width-1x);--sbb-toggle-border-style: solid;--sbb-toggle-border-radius: var(--sbb-border-radius-infinity);display:block}@media (min-width: 52.5rem){:host{--sbb-toggle-height: 2rem}}@media (forced-colors: active){:host{--sbb-toggle-selected-option-border-color: Highlight;--sbb-toggle-border-width: var(--sbb-border-width-2x)}}:host([even]){--sbb-toggle-width: 100%}:host([even]) ::slotted(sbb-toggle-option){width:50%}:host([disabled]){--sbb-toggle-selected-option-border-color: var(--sbb-color-graphite);--sbb-toggle-border-style: dashed}@media (forced-colors: active){:host([disabled]){--sbb-toggle-border-style: solid;--sbb-toggle-selected-option-border-color: GrayText}}:host([size=m]){--sbb-toggle-padding-inline: var(--sbb-spacing-responsive-s);--sbb-toggle-height: 2.75rem}@media (min-width: 52.5rem){:host([size=m]){--sbb-toggle-height: 3.25rem}}:host([data-disable-animation-on-resizing]){--sbb-disable-animation-time: .1ms;--sbb-disable-animation-zero-time: 0s}.sbb-toggle{--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);position:relative;display:flex;align-items:center;width:var(--sbb-toggle-width);max-width:100%;min-width:calc(var(--sbb-toggle-min-width) * 2);height:var(--sbb-toggle-height);-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;background:var(--sbb-color-cloud);border-radius:var(--sbb-toggle-border-radius)}.sbb-toggle:after{content:"";padding-inline:var(--sbb-toggle-padding-inline);display:inline-block;opacity:1;background-color:var(--sbb-color-white);border:var(--sbb-toggle-border-width) var(--sbb-toggle-border-style) var(--sbb-toggle-selected-option-border-color);border-radius:var(--sbb-toggle-border-radius);position:absolute;max-width:100%;min-width:var(--sbb-toggle-min-width);inset-block:calc(-2 * var(--sbb-toggle-border-width));inset-inline:calc(var(--sbb-toggle-option-left) - .125rem) calc(var(--sbb-toggle-option-right) - .125rem);transition-duration:var(--sbb-toggle-animation-duration);transition-timing-function:ease;transition-property:opacity,inset-inline-end,inset-inline-start}@media (forced-colors: active){.sbb-toggle{outline:var(--sbb-toggle-border-width) solid CanvasText}}`;
|
|
9
|
+
var P = Object.defineProperty, E = Object.getOwnPropertyDescriptor, b = (e, t, s, i) => {
|
|
10
|
+
for (var o = i > 1 ? void 0 : i ? E(t, s) : t, n = e.length - 1, l; n >= 0; n--)
|
|
11
|
+
(l = e[n]) && (o = (i ? l(t, s, o) : l(o)) || o);
|
|
12
|
+
return i && o && P(t, s, o), o;
|
|
13
13
|
};
|
|
14
|
-
let r = class extends
|
|
14
|
+
let r = class extends v {
|
|
15
15
|
constructor() {
|
|
16
|
-
super(...arguments), this.
|
|
17
|
-
() => this.
|
|
18
|
-
), this.
|
|
16
|
+
super(...arguments), this._disabled = !1, this.even = !1, this.size = "m", this._value = null, this._loaded = !1, this._toggleResizeObserver = new C(
|
|
17
|
+
() => this._setCheckedPillPosition(!0)
|
|
18
|
+
), this._didChange = new p(this, r.events.didChange, {
|
|
19
19
|
bubbles: !0,
|
|
20
20
|
composed: !0
|
|
21
|
-
}), this.
|
|
21
|
+
}), this._change = new p(this, r.events.change, {
|
|
22
22
|
bubbles: !0,
|
|
23
23
|
composed: !0
|
|
24
|
-
}), this.
|
|
24
|
+
}), this._abort = new x(this);
|
|
25
25
|
}
|
|
26
26
|
set disabled(e) {
|
|
27
|
-
this.
|
|
27
|
+
this._disabled = e, this._updateDisabled();
|
|
28
28
|
}
|
|
29
29
|
get disabled() {
|
|
30
|
-
return this.
|
|
30
|
+
return this._disabled;
|
|
31
31
|
}
|
|
32
32
|
set value(e) {
|
|
33
|
-
c ? this.
|
|
33
|
+
c ? this._value = e : this._valueChanged(e);
|
|
34
34
|
}
|
|
35
35
|
get value() {
|
|
36
36
|
var e, t;
|
|
37
|
-
return c ? this.
|
|
37
|
+
return c ? this._value ?? "" : ((e = this.options.find((s) => s.checked)) == null ? void 0 : e.value) ?? ((t = this.options[0]) == null ? void 0 : t.value) ?? "";
|
|
38
38
|
}
|
|
39
39
|
/** The child instances of sbb-toggle-option as an array. */
|
|
40
40
|
get options() {
|
|
41
41
|
var e;
|
|
42
42
|
return Array.from(((e = this.querySelectorAll) == null ? void 0 : e.call(this, "sbb-toggle-option")) ?? []);
|
|
43
43
|
}
|
|
44
|
-
|
|
44
|
+
_valueChanged(e) {
|
|
45
45
|
const t = this.options, s = t.find(
|
|
46
46
|
(i) => e === ("value" in i ? i.value : i.getAttribute("value"))
|
|
47
47
|
) ?? t.find((i) => i.checked) ?? t[0];
|
|
48
|
-
s && (s.checked || (s.checked = !0), this.
|
|
48
|
+
s && (s.checked || (s.checked = !0), this._setCheckedPillPosition(!1));
|
|
49
49
|
}
|
|
50
|
-
|
|
50
|
+
_updateDisabled() {
|
|
51
51
|
for (const e of this.options)
|
|
52
52
|
e.disabled = this.disabled;
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
_setCheckedPillPosition(e) {
|
|
55
55
|
var g, h;
|
|
56
|
-
if (!this.
|
|
56
|
+
if (!this._loaded)
|
|
57
57
|
return;
|
|
58
58
|
const t = this.options, s = this.shadowRoot.querySelector(".sbb-toggle");
|
|
59
59
|
if (t.every((d) => !d.checked) || t.every((d) => !d.clientWidth) || !s)
|
|
60
60
|
return;
|
|
61
61
|
this.toggleAttribute("data-disable-animation-on-resizing", e);
|
|
62
|
-
const i = t[0], o = i.checked, n = i.checked ? "0px" : `${i.clientWidth}px`,
|
|
63
|
-
(g = this.style) == null || g.setProperty("--sbb-toggle-option-left", n), (h = this.style) == null || h.setProperty("--sbb-toggle-option-right",
|
|
62
|
+
const i = t[0], o = i.checked, n = i.checked ? "0px" : `${i.clientWidth}px`, l = o ? `${s.clientWidth - i.clientWidth}px` : "0px";
|
|
63
|
+
(g = this.style) == null || g.setProperty("--sbb-toggle-option-left", n), (h = this.style) == null || h.setProperty("--sbb-toggle-option-right", l);
|
|
64
64
|
}
|
|
65
65
|
connectedCallback() {
|
|
66
66
|
super.connectedCallback();
|
|
67
|
-
const e = this.
|
|
68
|
-
this.addEventListener("input", () => this.
|
|
67
|
+
const e = this._abort.signal;
|
|
68
|
+
this.addEventListener("input", () => this._handleInput(), { signal: e, passive: !0 }), this.addEventListener("keydown", (t) => this._handleKeyDown(t), { signal: e }), this.options.forEach((t) => this._toggleResizeObserver.observe(t)), this._updateToggle();
|
|
69
69
|
}
|
|
70
70
|
async firstUpdated(e) {
|
|
71
|
-
super.firstUpdated(e), await this.updateComplete, this.
|
|
71
|
+
super.firstUpdated(e), await this.updateComplete, this._loaded = !0;
|
|
72
72
|
}
|
|
73
73
|
disconnectedCallback() {
|
|
74
|
-
super.disconnectedCallback(), this.
|
|
74
|
+
super.disconnectedCallback(), this._toggleResizeObserver.disconnect();
|
|
75
75
|
}
|
|
76
|
-
|
|
77
|
-
this.
|
|
76
|
+
_updateToggle() {
|
|
77
|
+
this._valueChanged(this.value), this._updateDisabled();
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
this.
|
|
79
|
+
_handleInput() {
|
|
80
|
+
this._setCheckedPillPosition(!1), this._change.emit(), this._didChange.emit();
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
_handleKeyDown(e) {
|
|
83
83
|
const t = this.options.filter(
|
|
84
84
|
(s) => !s.disabled && y.isVisible(s)
|
|
85
85
|
);
|
|
86
86
|
if (!(!t || // don't trap nested handling
|
|
87
|
-
e.target !== this && e.target.parentElement !== this) &&
|
|
87
|
+
e.target !== this && e.target.parentElement !== this) && _(e)) {
|
|
88
88
|
const s = t.findIndex(
|
|
89
89
|
(o) => o.checked
|
|
90
|
-
), i =
|
|
90
|
+
), i = w(e, s, t.length);
|
|
91
91
|
t[i].checked || (t[i].checked = !0, t[i].focus(), t[i].dispatchEvent(
|
|
92
92
|
new InputEvent("input", { bubbles: !0, composed: !0 })
|
|
93
93
|
)), e.preventDefault();
|
|
94
94
|
}
|
|
95
95
|
}
|
|
96
96
|
render() {
|
|
97
|
-
return
|
|
97
|
+
return m`
|
|
98
98
|
<div class="sbb-toggle">
|
|
99
|
-
<slot @slotchange=${this.
|
|
99
|
+
<slot @slotchange=${this._updateToggle}></slot>
|
|
100
100
|
</div>
|
|
101
101
|
`;
|
|
102
102
|
}
|
|
103
103
|
};
|
|
104
|
-
r.styles =
|
|
104
|
+
r.styles = z;
|
|
105
105
|
r.events = {
|
|
106
106
|
didChange: "didChange",
|
|
107
107
|
change: "change"
|
|
108
108
|
};
|
|
109
|
-
|
|
109
|
+
b([
|
|
110
110
|
a({ reflect: !0, type: Boolean })
|
|
111
111
|
], r.prototype, "disabled", 1);
|
|
112
|
-
|
|
112
|
+
b([
|
|
113
113
|
a({ reflect: !0, type: Boolean })
|
|
114
114
|
], r.prototype, "even", 2);
|
|
115
|
-
|
|
115
|
+
b([
|
|
116
116
|
a({ reflect: !0 })
|
|
117
117
|
], r.prototype, "size", 2);
|
|
118
|
-
|
|
118
|
+
b([
|
|
119
119
|
a()
|
|
120
120
|
], r.prototype, "value", 1);
|
|
121
|
-
r =
|
|
121
|
+
r = b([
|
|
122
122
|
f("sbb-toggle"),
|
|
123
|
-
|
|
123
|
+
k({
|
|
124
124
|
role: "radiogroup"
|
|
125
125
|
})
|
|
126
126
|
], r);
|
package/train/train-formation.js
CHANGED
|
@@ -1,70 +1,70 @@
|
|
|
1
1
|
import { css as c, LitElement as d, html as l } from "lit";
|
|
2
|
-
import { property as f, state as
|
|
3
|
-
import { ref as
|
|
2
|
+
import { property as f, state as p, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import { ref as h } from "lit/directives/ref.js";
|
|
4
4
|
import { SbbConnectedAbortController as u, SbbLanguageController as g } from "../core/controllers.js";
|
|
5
|
-
import { i18nSectorShort as v, i18nSector as w, i18nTrains as
|
|
6
|
-
import { SbbNamedSlotListMixin as
|
|
7
|
-
import { AgnosticResizeObserver as
|
|
8
|
-
const
|
|
9
|
-
var C = Object.defineProperty,
|
|
10
|
-
for (var o =
|
|
11
|
-
(b = r[s]) && (o = (
|
|
12
|
-
return
|
|
5
|
+
import { i18nSectorShort as v, i18nSector as w, i18nTrains as _ } from "../core/i18n.js";
|
|
6
|
+
import { SbbNamedSlotListMixin as k } from "../core/mixins.js";
|
|
7
|
+
import { AgnosticResizeObserver as y } from "../core/observers.js";
|
|
8
|
+
const x = c`*,:before,:after{box-sizing:border-box}:host{--sbb-train-formation-inline-padding: var(--sbb-spacing-fixed-4x);--sbb-train-formation-background-color: var(--sbb-color-white);--sbb-train-formation-sector-label-color: var(--sbb-color-metal);--sbb-train-formation-sector-line-color: var(--sbb-color-smoke);--sbb-train-formation-blocked-passage-width: 1rem;display:block}@media (forced-colors: active){:host{--sbb-train-formation-sector-line-color: CanvasText}}:host([hide-wagon-label]){--sbb-train-formation-wagon-label-display: none}.sbb-train-formation{--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: var(--sbb-color-black-alpha-30);--sbb-scrollbar-color-hover: var(--sbb-color-black-alpha-60);--sbb-scrollbar-track-color: transparent;--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x);display:grid;grid-template:"start sectors end" auto "start trains end" auto/auto 1fr auto;position:relative;overflow-x:auto;background-color:var(--sbb-train-formation-background-color)}.sbb-train-formation::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-train-formation::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-train-formation::-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-train-formation::-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-train-formation::-webkit-scrollbar-button,.sbb-train-formation::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-train-formation{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-train-formation:before,.sbb-train-formation:after{content:"";display:block;width:var(--sbb-train-formation-inline-padding);background-color:var(--sbb-train-formation-background-color)}.sbb-train-formation:before{grid-area:start}.sbb-train-formation:after{grid-area:end}.sbb-train-formation__sectors{display:flex;grid-area:sectors;gap:var(--sbb-train-formation-wagon-gap)}.sbb-train-formation__sector{--_wagon-sum: var(--sbb-train-formation-wagon-count) * var(--sbb-train-formation-wagon-width);--_blocked-passage-sum: var(--sbb-train-formation-wagon-blocked-passage-count) * var(--sbb-train-formation-blocked-passage-width);--_total-count: calc( var(--sbb-train-formation-wagon-count) + var(--sbb-train-formation-wagon-blocked-passage-count) );--_gap-sum: calc((var(--_total-count) - 1) * var(--sbb-train-formation-wagon-gap));--_sector-width: calc(var(--_wagon-sum) + var(--_blocked-passage-sum) + var(--_gap-sum));--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);flex:0 0 var(--_sector-width);color:var(--sbb-train-formation-sector-label-color);text-align:center;position:relative;display:inline-block;margin-block-end:var(--sbb-spacing-fixed-4x);max-width:var(--_sector-width)}.sbb-train-formation__sector:before{content:"";position:absolute;top:50%;right:0;bottom:50%;left:0;height:1px;background-color:var(--sbb-train-formation-sector-line-color)}.sbb-train-formation__sector-sticky-wrapper{background-color:var(--sbb-train-formation-background-color);position:sticky;inset:auto 0;padding:0 var(--sbb-spacing-fixed-1x);margin:0 var(--sbb-spacing-fixed-2x);overflow:hidden;white-space:nowrap}.sbb-train-formation__trains{grid-area:trains}.sbb-train-formation__train-list{list-style:none;margin:0;padding:0;font-size:inherit;display:flex;gap:var(--sbb-train-formation-wagon-gap)}.sbb-train-formation__train-list>:is(li,span){display:inline-flex}`;
|
|
9
|
+
var C = Object.defineProperty, z = Object.getOwnPropertyDescriptor, e = (r, t, i, a) => {
|
|
10
|
+
for (var o = a > 1 ? void 0 : a ? z(t, i) : t, s = r.length - 1, b; s >= 0; s--)
|
|
11
|
+
(b = r[s]) && (o = (a ? b(t, i, o) : b(o)) || o);
|
|
12
|
+
return a && o && C(t, i, o), o;
|
|
13
13
|
};
|
|
14
|
-
let n = class extends
|
|
14
|
+
let n = class extends k(d) {
|
|
15
15
|
constructor() {
|
|
16
|
-
super(...arguments), this.listChildLocalNames = ["sbb-train"], this.hideWagonLabel = !1, this.
|
|
16
|
+
super(...arguments), this.listChildLocalNames = ["sbb-train"], this.hideWagonLabel = !1, this._sectors = [], this._contentResizeObserver = new y(() => this._applyCssWidth()), this._abort = new u(this), this._language = new g(this);
|
|
17
17
|
}
|
|
18
18
|
connectedCallback() {
|
|
19
19
|
super.connectedCallback();
|
|
20
|
-
const r = this.
|
|
21
|
-
this.addEventListener("trainSlotChange", (
|
|
20
|
+
const r = this._abort.signal;
|
|
21
|
+
this.addEventListener("trainSlotChange", (t) => this._readSectors(t), { signal: r }), this.addEventListener("sectorChange", (t) => this._readSectors(t), { signal: r });
|
|
22
22
|
}
|
|
23
23
|
disconnectedCallback() {
|
|
24
|
-
super.disconnectedCallback(), this.
|
|
24
|
+
super.disconnectedCallback(), this._contentResizeObserver.disconnect();
|
|
25
25
|
}
|
|
26
26
|
/**
|
|
27
27
|
* Apply width of the scrollable space of the formation as a css variable. This will be used from
|
|
28
28
|
* every slotted sbb-train for the direction-label
|
|
29
29
|
*/
|
|
30
|
-
|
|
31
|
-
const r = this.
|
|
32
|
-
this.
|
|
30
|
+
_applyCssWidth() {
|
|
31
|
+
const r = this._formationDiv.getBoundingClientRect().width;
|
|
32
|
+
this._formationDiv.style.setProperty("--sbb-train-direction-width", `${r}px`);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
r == null || r.stopPropagation(), this.
|
|
37
|
-
((
|
|
34
|
+
_readSectors(r) {
|
|
35
|
+
var t;
|
|
36
|
+
r == null || r.stopPropagation(), this._sectors = Array.from(
|
|
37
|
+
((t = this.querySelectorAll) == null ? void 0 : t.call(
|
|
38
38
|
this,
|
|
39
39
|
"sbb-train-wagon,sbb-train-blocked-passage"
|
|
40
40
|
)) ?? []
|
|
41
41
|
).reduce(
|
|
42
|
-
(i,
|
|
42
|
+
(i, a) => {
|
|
43
43
|
const o = i[i.length - 1];
|
|
44
|
-
if (
|
|
45
|
-
const s =
|
|
44
|
+
if (a.localName === "sbb-train-wagon") {
|
|
45
|
+
const s = a.sector ?? a.getAttribute("sector");
|
|
46
46
|
!o.label && s && (o.label = s), !s || o.label === s ? o.wagonCount++ : i.push({
|
|
47
47
|
label: s,
|
|
48
48
|
wagonCount: 1,
|
|
49
49
|
blockedPassageCount: 0
|
|
50
50
|
});
|
|
51
|
-
} else
|
|
51
|
+
} else a.localName === "sbb-train-blocked-passage" && o.blockedPassageCount++;
|
|
52
52
|
return i;
|
|
53
53
|
},
|
|
54
54
|
[{ wagonCount: 0, blockedPassageCount: 0 }]
|
|
55
55
|
);
|
|
56
56
|
}
|
|
57
|
-
async
|
|
58
|
-
r && (this.
|
|
57
|
+
async _updateFormationDiv(r) {
|
|
58
|
+
r && (this._contentResizeObserver.disconnect(), this._formationDiv = r, this._contentResizeObserver.observe(this._formationDiv), await this.updateComplete, this._applyCssWidth());
|
|
59
59
|
}
|
|
60
60
|
willUpdate(r) {
|
|
61
|
-
super.willUpdate(r), r.has("listChildren") && this.
|
|
61
|
+
super.willUpdate(r), r.has("listChildren") && this._readSectors();
|
|
62
62
|
}
|
|
63
63
|
render() {
|
|
64
64
|
return l`
|
|
65
|
-
<div class="sbb-train-formation" ${
|
|
65
|
+
<div class="sbb-train-formation" ${h(this._updateFormationDiv)}>
|
|
66
66
|
<div class="sbb-train-formation__sectors" aria-hidden="true">
|
|
67
|
-
${this.
|
|
67
|
+
${this._sectors.map(
|
|
68
68
|
(r) => l`<span
|
|
69
69
|
class="sbb-train-formation__sector"
|
|
70
70
|
style="
|
|
@@ -72,7 +72,7 @@ let n = class extends _(d) {
|
|
|
72
72
|
--sbb-train-formation-wagon-blocked-passage-count: ${r.blockedPassageCount}"
|
|
73
73
|
>
|
|
74
74
|
<span class="sbb-train-formation__sector-sticky-wrapper">
|
|
75
|
-
${`${r.wagonCount === 1 && r.label ? v[this.
|
|
75
|
+
${`${r.wagonCount === 1 && r.label ? v[this._language.current] : w[this._language.current]} ${r.label ? r.label : ""}`}
|
|
76
76
|
</span>
|
|
77
77
|
</span>`
|
|
78
78
|
)}
|
|
@@ -81,20 +81,20 @@ let n = class extends _(d) {
|
|
|
81
81
|
<div class="sbb-train-formation__trains">
|
|
82
82
|
${this.renderList({
|
|
83
83
|
class: "sbb-train-formation__train-list",
|
|
84
|
-
ariaLabel:
|
|
84
|
+
ariaLabel: _[this._language.current]
|
|
85
85
|
})}
|
|
86
86
|
</div>
|
|
87
87
|
</div>
|
|
88
88
|
`;
|
|
89
89
|
}
|
|
90
90
|
};
|
|
91
|
-
n.styles =
|
|
91
|
+
n.styles = x;
|
|
92
92
|
e([
|
|
93
93
|
f({ attribute: "hide-wagon-label", reflect: !0, type: Boolean })
|
|
94
94
|
], n.prototype, "hideWagonLabel", 2);
|
|
95
95
|
e([
|
|
96
|
-
|
|
97
|
-
], n.prototype, "
|
|
96
|
+
p()
|
|
97
|
+
], n.prototype, "_sectors", 2);
|
|
98
98
|
n = e([
|
|
99
99
|
m("sbb-train-formation")
|
|
100
100
|
], n);
|