@sbb-esta/lyne-elements 0.52.0 → 0.52.1
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/breadcrumb-group.d.ts.map +1 -1
- package/breadcrumb/breadcrumb-group.js +70 -69
- 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 +87 -88
- package/core/controllers.js +40 -40
- package/core/datetime.js +34 -36
- package/core/dom.js +26 -26
- package/core/eventing.js +33 -33
- package/core/mixins.js +122 -122
- package/core/overlay/overlay.d.ts.map +1 -1
- package/core/overlay.js +55 -50
- package/core/testing/event-spy.d.ts +1 -1
- package/core/testing/wait-for-image-ready.d.ts +4 -0
- package/core/testing/wait-for-image-ready.d.ts.map +1 -0
- package/core/testing.d.ts +1 -0
- package/core/testing.d.ts.map +1 -1
- package/core/testing.js +42 -31
- package/custom-elements.json +70 -4
- package/datepicker/common.js +55 -55
- package/datepicker/datepicker-toggle.js +94 -94
- package/datepicker/datepicker.js +144 -144
- package/development/accordion.js +2 -3
- package/development/action-group.js +2 -3
- package/development/alert/alert-group.js +2 -3
- package/development/alert/alert.js +2 -3
- package/development/autocomplete.js +2 -3
- package/development/breadcrumb/breadcrumb-group/breadcrumb-group.d.ts.map +1 -1
- package/development/breadcrumb/breadcrumb-group.js +5 -5
- package/development/breadcrumb/breadcrumb.js +2 -3
- package/development/button/button-link.js +2 -3
- package/development/button/button-static.js +2 -3
- package/development/button/button.js +2 -3
- package/development/button/common.js +2 -3
- package/development/button/mini-button.js +2 -3
- package/development/button/secondary-button-link.js +2 -3
- package/development/button/secondary-button-static.js +2 -3
- package/development/button/secondary-button.js +2 -3
- package/development/button/tertiary-button-link.js +2 -3
- package/development/button/tertiary-button-static.js +2 -3
- package/development/button/tertiary-button.js +2 -3
- package/development/button/transparent-button-link.js +2 -3
- package/development/button/transparent-button-static.js +2 -3
- package/development/button/transparent-button.js +2 -3
- package/development/calendar.js +2 -3
- package/development/card/card-badge.js +2 -3
- package/development/card/card-button.js +2 -3
- package/development/card/card-link.js +2 -3
- package/development/card/card.js +2 -3
- package/development/card/common.js +2 -3
- package/development/checkbox/checkbox-group.js +2 -3
- package/development/checkbox/checkbox.js +2 -3
- package/development/chip.js +2 -3
- package/development/clock.js +2 -3
- package/development/container/container.js +2 -3
- package/development/container/sticky-bar.js +2 -3
- package/development/core/base-elements.js +4 -7
- package/development/core/mixins.js +7 -13
- package/development/core/overlay/overlay.d.ts.map +1 -1
- package/development/core/overlay.js +9 -3
- package/development/core/testing/event-spy.d.ts +1 -1
- package/development/core/testing/wait-for-image-ready.d.ts +4 -0
- package/development/core/testing/wait-for-image-ready.d.ts.map +1 -0
- package/development/core/testing.d.ts +1 -0
- package/development/core/testing.d.ts.map +1 -1
- package/development/core/testing.js +17 -1
- package/development/datepicker/common.js +2 -3
- package/development/datepicker/datepicker-next-day.js +2 -3
- package/development/datepicker/datepicker-previous-day.js +2 -3
- package/development/datepicker/datepicker-toggle.js +2 -3
- package/development/datepicker/datepicker.js +2 -3
- package/development/dialog/dialog-actions.js +2 -3
- package/development/dialog/dialog-content.js +2 -3
- package/development/dialog/dialog-title.js +2 -3
- package/development/dialog/dialog.js +2 -3
- package/development/divider.js +2 -3
- package/development/expansion-panel/expansion-panel-content.js +2 -3
- package/development/expansion-panel/expansion-panel-header.js +2 -3
- package/development/expansion-panel/expansion-panel.js +2 -3
- package/development/file-selector.js +2 -3
- package/development/footer.js +2 -3
- package/development/form-error.js +2 -3
- package/development/form-field/form-field-clear.js +2 -3
- package/development/form-field/form-field.js +2 -3
- package/development/header/common.js +2 -3
- package/development/header/header-button.js +2 -3
- package/development/header/header-link.js +2 -3
- package/development/header/header.js +2 -3
- package/development/icon.js +4 -7
- package/development/image/image.d.ts +12 -3
- package/development/image/image.d.ts.map +1 -1
- package/development/image.js +41 -24
- package/development/journey-header.js +2 -3
- package/development/lead-container.js +2 -3
- package/development/link/block-link-button.js +2 -3
- package/development/link/block-link-static.js +2 -3
- package/development/link/block-link.js +2 -3
- package/development/link/common.js +3 -5
- package/development/link/link-button.js +2 -3
- package/development/link/link-static.js +2 -3
- package/development/link/link.js +2 -3
- package/development/link-list.js +2 -3
- package/development/loading-indicator.js +2 -3
- package/development/logo.js +2 -3
- package/development/map-container.js +2 -3
- package/development/menu/common.js +2 -3
- package/development/menu/menu-button.js +2 -3
- package/development/menu/menu-link.js +2 -3
- package/development/menu/menu.js +2 -3
- package/development/message.js +2 -3
- package/development/navigation/common.js +2 -3
- package/development/navigation/navigation-button.js +2 -3
- package/development/navigation/navigation-link.js +2 -3
- package/development/navigation/navigation-list.js +2 -3
- package/development/navigation/navigation-marker.js +2 -3
- package/development/navigation/navigation-section.js +2 -3
- package/development/navigation/navigation.js +2 -3
- package/development/notification.js +2 -3
- package/development/option/optgroup.js +2 -3
- package/development/option/option.js +2 -3
- package/development/overlay.js +3 -5
- package/development/popover/popover-trigger.js +2 -3
- package/development/popover/popover.js +2 -3
- package/development/radio-button/radio-button-group.js +2 -3
- package/development/radio-button/radio-button.js +2 -3
- package/development/screen-reader-only.js +2 -3
- package/development/select.js +2 -3
- package/development/selection-panel.js +2 -3
- package/development/signet.js +2 -3
- package/development/skiplink-list.js +2 -3
- package/development/slider.js +2 -3
- package/development/status.js +2 -3
- package/development/stepper/step-label.js +2 -3
- package/development/stepper/step.js +2 -3
- package/development/stepper/stepper/stepper.d.ts +1 -1
- package/development/stepper/stepper/stepper.d.ts.map +1 -1
- package/development/stepper/stepper.js +5 -6
- package/development/tabs/tab-group.js +2 -3
- package/development/tabs/tab-title.js +2 -3
- package/development/tag/tag-group.js +2 -3
- package/development/tag/tag.js +2 -3
- package/development/teaser-hero.js +2 -3
- package/development/teaser-paid.js +2 -3
- package/development/teaser.js +2 -3
- package/development/time-input.js +2 -3
- package/development/timetable-occupancy-icon.js +2 -3
- package/development/timetable-occupancy.js +2 -3
- package/development/title.js +3 -5
- package/development/toast.js +2 -3
- package/development/toggle/toggle-option.js +3 -5
- package/development/toggle/toggle.js +2 -3
- package/development/toggle-check.js +10 -3
- package/development/train/train-blocked-passage.js +2 -3
- package/development/train/train-formation.js +2 -3
- package/development/train/train-wagon.js +2 -3
- package/development/train/train.js +2 -3
- package/development/visual-checkbox.js +2 -3
- 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/image.d.ts +12 -3
- package/image/image.d.ts.map +1 -1
- package/image.js +118 -105
- 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/stepper.d.ts +1 -1
- package/stepper/stepper/stepper.d.ts.map +1 -1
- package/stepper/stepper.js +48 -48
- 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/toggle-check.js +14 -14
- package/train/train-formation.js +36 -37
- package/train/train-wagon.js +30 -30
- package/train/train.js +13 -13
package/train/train-formation.js
CHANGED
|
@@ -1,71 +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 h, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import { ref as p } 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 k } from "../core/i18n.js";
|
|
6
|
+
import { SbbNamedSlotListMixin as _ } from "../core/mixins.js";
|
|
7
|
+
import { AgnosticResizeObserver as x } from "../core/observers.js";
|
|
8
|
+
const y = 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, L = Object.getOwnPropertyDescriptor, e = (r, a, i, t) => {
|
|
10
|
+
for (var o = t > 1 ? void 0 : t ? L(a, i) : a, s = r.length - 1, b; s >= 0; s--)
|
|
11
|
+
(b = r[s]) && (o = (t ? b(a, i, o) : b(o)) || o);
|
|
12
|
+
return t && o && C(a, i, o), o;
|
|
13
13
|
};
|
|
14
|
-
let n = class extends
|
|
14
|
+
let n = class extends _(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.e = [], this.b = new x(() => this.f()), this.g = new u(this), this.c = new g(this);
|
|
17
17
|
}
|
|
18
18
|
connectedCallback() {
|
|
19
19
|
super.connectedCallback();
|
|
20
|
-
const r = this.
|
|
21
|
-
this.addEventListener("trainSlotChange", (
|
|
20
|
+
const r = this.g.signal;
|
|
21
|
+
this.addEventListener("trainSlotChange", (a) => this.d(a), { signal: r }), this.addEventListener("sectorChange", (a) => this.d(a), { signal: r });
|
|
22
22
|
}
|
|
23
23
|
disconnectedCallback() {
|
|
24
|
-
super.disconnectedCallback(), this.
|
|
24
|
+
super.disconnectedCallback(), this.b.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
|
+
f() {
|
|
31
|
+
const r = this.a.getBoundingClientRect().width;
|
|
32
|
+
this.a.style.setProperty("--sbb-train-direction-width", `${r}px`);
|
|
33
33
|
}
|
|
34
|
-
|
|
35
|
-
var
|
|
36
|
-
r == null || r.stopPropagation(), this.
|
|
37
|
-
((
|
|
34
|
+
d(r) {
|
|
35
|
+
var a;
|
|
36
|
+
r == null || r.stopPropagation(), this.e = Array.from(
|
|
37
|
+
((a = this.querySelectorAll) == null ? void 0 : a.call(
|
|
38
38
|
this,
|
|
39
39
|
"sbb-train-wagon,sbb-train-blocked-passage"
|
|
40
40
|
)) ?? []
|
|
41
41
|
).reduce(
|
|
42
|
-
(i,
|
|
42
|
+
(i, t) => {
|
|
43
43
|
const o = i[i.length - 1];
|
|
44
|
-
if (
|
|
45
|
-
const s =
|
|
44
|
+
if (t.localName === "sbb-train-wagon") {
|
|
45
|
+
const s = t.sector ?? t.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
|
|
52
|
-
a.localName === "sbb-train-blocked-passage" && o.blockedPassageCount++;
|
|
51
|
+
} else t.localName === "sbb-train-blocked-passage" && o.blockedPassageCount++;
|
|
53
52
|
return i;
|
|
54
53
|
},
|
|
55
54
|
[{ wagonCount: 0, blockedPassageCount: 0 }]
|
|
56
55
|
);
|
|
57
56
|
}
|
|
58
|
-
async
|
|
59
|
-
r && (this.
|
|
57
|
+
async h(r) {
|
|
58
|
+
r && (this.b.disconnect(), this.a = r, this.b.observe(this.a), await this.updateComplete, this.f());
|
|
60
59
|
}
|
|
61
60
|
willUpdate(r) {
|
|
62
|
-
super.willUpdate(r), r.has("listChildren") && this.
|
|
61
|
+
super.willUpdate(r), r.has("listChildren") && this.d();
|
|
63
62
|
}
|
|
64
63
|
render() {
|
|
65
64
|
return l`
|
|
66
|
-
<div class="sbb-train-formation" ${
|
|
65
|
+
<div class="sbb-train-formation" ${p(this.h)}>
|
|
67
66
|
<div class="sbb-train-formation__sectors" aria-hidden="true">
|
|
68
|
-
${this.
|
|
67
|
+
${this.e.map(
|
|
69
68
|
(r) => l`<span
|
|
70
69
|
class="sbb-train-formation__sector"
|
|
71
70
|
style="
|
|
@@ -73,7 +72,7 @@ let n = class extends k(d) {
|
|
|
73
72
|
--sbb-train-formation-wagon-blocked-passage-count: ${r.blockedPassageCount}"
|
|
74
73
|
>
|
|
75
74
|
<span class="sbb-train-formation__sector-sticky-wrapper">
|
|
76
|
-
${`${r.wagonCount === 1 && r.label ? v[this.
|
|
75
|
+
${`${r.wagonCount === 1 && r.label ? v[this.c.current] : w[this.c.current]} ${r.label ? r.label : ""}`}
|
|
77
76
|
</span>
|
|
78
77
|
</span>`
|
|
79
78
|
)}
|
|
@@ -82,20 +81,20 @@ let n = class extends k(d) {
|
|
|
82
81
|
<div class="sbb-train-formation__trains">
|
|
83
82
|
${this.renderList({
|
|
84
83
|
class: "sbb-train-formation__train-list",
|
|
85
|
-
ariaLabel:
|
|
84
|
+
ariaLabel: k[this.c.current]
|
|
86
85
|
})}
|
|
87
86
|
</div>
|
|
88
87
|
</div>
|
|
89
88
|
`;
|
|
90
89
|
}
|
|
91
90
|
};
|
|
92
|
-
n.styles =
|
|
91
|
+
n.styles = y;
|
|
93
92
|
e([
|
|
94
93
|
f({ attribute: "hide-wagon-label", reflect: !0, type: Boolean })
|
|
95
94
|
], n.prototype, "hideWagonLabel", 2);
|
|
96
95
|
e([
|
|
97
|
-
|
|
98
|
-
], n.prototype, "
|
|
96
|
+
h()
|
|
97
|
+
], n.prototype, "e", 2);
|
|
99
98
|
n = e([
|
|
100
99
|
m("sbb-train-formation")
|
|
101
100
|
], n);
|
package/train/train-wagon.js
CHANGED
|
@@ -2,22 +2,22 @@ import { css as d, LitElement as w, nothing as t } from "lit";
|
|
|
2
2
|
import { property as b, customElement as m } from "lit/decorators.js";
|
|
3
3
|
import { html as s, unsafeStatic as p } from "lit/static-html.js";
|
|
4
4
|
import { SbbLanguageController as y } from "../core/controllers.js";
|
|
5
|
-
import { EventEmitter as
|
|
6
|
-
import { i18nSector as
|
|
5
|
+
import { EventEmitter as f } from "../core/eventing.js";
|
|
6
|
+
import { i18nSector as v, i18nWagonLabel as u, i18nClass as h, i18nBlockedPassage as _, i18nClosedCompartmentLabel as x, i18nLocomotiveLabel as $, i18nAdditionalWagonInformationHeading as C, i18nWagonLabelNumber as k } from "../core/i18n.js";
|
|
7
7
|
import { SbbNamedSlotListMixin as L } from "../core/mixins.js";
|
|
8
8
|
import "../icon.js";
|
|
9
9
|
import "../timetable-occupancy-icon.js";
|
|
10
10
|
const z = d`*,:before,:after{box-sizing:border-box}:host{--sbb-train-wagon-width: var(--sbb-train-formation-wagon-width);--sbb-train-wagon-height: var(--sbb-train-formation-wagon-height);--sbb-train-wagon-inner-padding: var(--sbb-spacing-fixed-3x);--sbb-train-wagon-shape-border-radius: var(--sbb-train-formation-wagon-border-radius);--sbb-train-wagon-shape-color: var(--sbb-color-charcoal);--sbb-train-wagon-shape-color-closed: var(--sbb-color-metal);--sbb-train-wagon-shape-width: var(--sbb-border-width-1x);--sbb-train-wagon-gap: var(--sbb-spacing-fixed-2x);--sbb-train-wagon-icons-gap: var(--sbb-spacing-fixed-1x);--sbb-train-wagon-icons-height: .875rem;display:block}@media (forced-colors: active){:host{--sbb-train-wagon-shape-color-closed: CanvasText}}.sbb-train-wagon{display:flex;flex-direction:column;align-items:center;width:var(--sbb-train-wagon-width);gap:var(--sbb-train-wagon-gap)}.sbb-train-wagon__compartment{list-style:none;margin:0;padding:0;font-size:inherit;display:grid;grid-template:"label label" auto "occupancy class" 1fr/1fr 1fr;position:relative;width:100%}:host([type=closed]) .sbb-train-wagon__compartment:before,:host(:not([data-has-visible-wagon-content])) .sbb-train-wagon__compartment:before{content:"";grid-area:occupancy/span 2;height:var(--sbb-train-wagon-height)}.sbb-train-wagon__compartment:after{content:"";display:block;position:absolute;inset-inline:0;inset-block:auto 0;width:var(--sbb-train-wagon-width);height:var(--sbb-train-wagon-height);border-radius:var(--sbb-train-wagon-shape-border-radius)}:host([type=wagon]) .sbb-train-wagon__compartment:after{border:var(--sbb-train-wagon-shape-width) solid var(--sbb-train-wagon-shape-color)}:host([type=closed]) .sbb-train-wagon__compartment:after{border:var(--sbb-train-wagon-shape-width) solid var(--sbb-train-wagon-shape-color-closed)}.sbb-train-wagon__occupancy,.sbb-train-wagon__class{height:var(--sbb-train-wagon-height);display:flex;align-items:center}.sbb-train-wagon__label{--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);grid-area:label;text-align:center;display:var(--sbb-train-formation-wagon-label-display, inline-block);min-height:calc(1em * var(--sbb-typo-line-height-body-text))}.sbb-train-wagon__occupancy{grid-area:occupancy;padding-inline-start:var(--sbb-train-wagon-inner-padding)}.sbb-train-wagon__class{--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);grid-area:class;padding-inline-end:var(--sbb-train-wagon-inner-padding);margin-inline-start:auto}.sbb-train-wagon__locomotive{grid-area:occupancy/span 2}.sbb-train-wagon__icons{--sbb-icon-svg-height: var(--sbb-train-wagon-icons-height);display:flex}.sbb-train-wagon__icons[hidden]{position:absolute}.sbb-train-wagon__icons-list{list-style:none;margin:0;padding:0;font-size:inherit;display:flex;flex-wrap:wrap;gap:var(--sbb-train-wagon-icons-gap);justify-content:center}.sbb-train-wagon__icons-list>:is(li,span){display:inline-flex}.sbb-screen-reader-only{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}`;
|
|
11
|
-
var S = Object.defineProperty, A = Object.getOwnPropertyDescriptor,
|
|
12
|
-
for (var r = o > 1 ? void 0 : o ? A(
|
|
13
|
-
(g = a[c]) && (r = (o ? g(
|
|
14
|
-
return o && r && S(
|
|
11
|
+
var S = Object.defineProperty, A = Object.getOwnPropertyDescriptor, e = (a, i, l, o) => {
|
|
12
|
+
for (var r = o > 1 ? void 0 : o ? A(i, l) : i, c = a.length - 1, g; c >= 0; c--)
|
|
13
|
+
(g = a[c]) && (r = (o ? g(i, l, r) : g(r)) || r);
|
|
14
|
+
return o && r && S(i, l, r), r;
|
|
15
15
|
};
|
|
16
16
|
let n = class extends L(
|
|
17
17
|
w
|
|
18
18
|
) {
|
|
19
19
|
constructor() {
|
|
20
|
-
super(...arguments), this.listChildLocalNames = ["sbb-icon"], this.type = "wagon", this.occupancy = "none", this.
|
|
20
|
+
super(...arguments), this.listChildLocalNames = ["sbb-icon"], this.type = "wagon", this.occupancy = "none", this.b = null, this.blockedPassage = "none", this.a = new y(this), this.d = new f(
|
|
21
21
|
this,
|
|
22
22
|
n.events.sectorChange,
|
|
23
23
|
{
|
|
@@ -27,10 +27,10 @@ let n = class extends L(
|
|
|
27
27
|
);
|
|
28
28
|
}
|
|
29
29
|
set sector(a) {
|
|
30
|
-
this.
|
|
30
|
+
this.b = a, this.c();
|
|
31
31
|
}
|
|
32
32
|
get sector() {
|
|
33
|
-
return this.
|
|
33
|
+
return this.b;
|
|
34
34
|
}
|
|
35
35
|
willUpdate(a) {
|
|
36
36
|
super.willUpdate(a), (a.has("type") || a.has("occupancy") || a.has("wagonClass")) && this.toggleAttribute(
|
|
@@ -38,8 +38,8 @@ let n = class extends L(
|
|
|
38
38
|
!!(this.type === "wagon" && this.occupancy || this.wagonClass)
|
|
39
39
|
);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
this.
|
|
41
|
+
c() {
|
|
42
|
+
this.d.emit();
|
|
43
43
|
}
|
|
44
44
|
render() {
|
|
45
45
|
const a = (l) => {
|
|
@@ -47,23 +47,23 @@ let n = class extends L(
|
|
|
47
47
|
return s`
|
|
48
48
|
<${p(o)} class="sbb-train-wagon__label" aria-hidden=${(!this.label).toString()}>
|
|
49
49
|
${this.label ? s` <span class="sbb-screen-reader-only">
|
|
50
|
-
${`${k[this.
|
|
50
|
+
${`${k[this.a.current]},`}
|
|
51
51
|
</span>
|
|
52
52
|
${this.label}` : t}
|
|
53
53
|
</${p(o)}>
|
|
54
54
|
`;
|
|
55
|
-
},
|
|
55
|
+
}, i = `${v[this.a.current]}, ${this.sector}`;
|
|
56
56
|
return s`
|
|
57
57
|
<div class="sbb-train-wagon">
|
|
58
58
|
${this.type === "wagon" ? s`<ul
|
|
59
|
-
aria-label=${
|
|
59
|
+
aria-label=${u[this.a.current]}
|
|
60
60
|
class="sbb-train-wagon__compartment"
|
|
61
61
|
>
|
|
62
|
-
${this.sector ? s`<li class="sbb-screen-reader-only">${
|
|
62
|
+
${this.sector ? s`<li class="sbb-screen-reader-only">${i}</li>` : t}
|
|
63
63
|
${a("li")}
|
|
64
64
|
${this.wagonClass ? s`<li class="sbb-train-wagon__class">
|
|
65
65
|
<span class="sbb-screen-reader-only">
|
|
66
|
-
${this.wagonClass === "1" ? h.first[this.
|
|
66
|
+
${this.wagonClass === "1" ? h.first[this.a.current] : h.second[this.a.current]}
|
|
67
67
|
</span>
|
|
68
68
|
<span aria-hidden="true">${this.wagonClass}</span>
|
|
69
69
|
</li>` : t}
|
|
@@ -73,20 +73,20 @@ let n = class extends L(
|
|
|
73
73
|
.occupancy=${this.occupancy}
|
|
74
74
|
></sbb-timetable-occupancy-icon>` : t}
|
|
75
75
|
${this.blockedPassage && this.blockedPassage !== "none" ? s`<li class="sbb-screen-reader-only">
|
|
76
|
-
${
|
|
76
|
+
${_[this.blockedPassage][this.a.current]}
|
|
77
77
|
</li>` : t}
|
|
78
78
|
</ul>` : t}
|
|
79
79
|
${this.type === "closed" ? s`<span class="sbb-train-wagon__compartment">
|
|
80
80
|
<span class="sbb-screen-reader-only">
|
|
81
|
-
${x(this.label ? parseInt(this.label) : void 0)[this.
|
|
82
|
-
${this.sector ? `, ${
|
|
81
|
+
${x(this.label ? parseInt(this.label) : void 0)[this.a.current]}
|
|
82
|
+
${this.sector ? `, ${i}` : t}
|
|
83
83
|
</span>
|
|
84
84
|
${a("span")}
|
|
85
85
|
</span>` : t}
|
|
86
86
|
${this.type === "locomotive" ? s`<span class="sbb-train-wagon__compartment">
|
|
87
87
|
<span class="sbb-screen-reader-only">
|
|
88
|
-
${$[this.
|
|
89
|
-
${this.sector ? `, ${
|
|
88
|
+
${$[this.a.current]}
|
|
89
|
+
${this.sector ? `, ${i}` : t}
|
|
90
90
|
</span>
|
|
91
91
|
${a("span")}
|
|
92
92
|
<svg
|
|
@@ -108,7 +108,7 @@ let n = class extends L(
|
|
|
108
108
|
${this.type === "wagon" ? s`<span class="sbb-train-wagon__icons" ?hidden=${this.listChildren.length === 0}>
|
|
109
109
|
${this.renderList({
|
|
110
110
|
class: "sbb-train-wagon__icons-list",
|
|
111
|
-
ariaLabel: C[this.
|
|
111
|
+
ariaLabel: C[this.a.current]
|
|
112
112
|
})}
|
|
113
113
|
</span>` : t}
|
|
114
114
|
</div>
|
|
@@ -119,28 +119,28 @@ n.styles = z;
|
|
|
119
119
|
n.events = {
|
|
120
120
|
sectorChange: "sectorChange"
|
|
121
121
|
};
|
|
122
|
-
|
|
122
|
+
e([
|
|
123
123
|
b({ reflect: !0 })
|
|
124
124
|
], n.prototype, "type", 2);
|
|
125
|
-
|
|
125
|
+
e([
|
|
126
126
|
b()
|
|
127
127
|
], n.prototype, "occupancy", 2);
|
|
128
|
-
|
|
128
|
+
e([
|
|
129
129
|
b({ reflect: !0 })
|
|
130
130
|
], n.prototype, "sector", 1);
|
|
131
|
-
|
|
131
|
+
e([
|
|
132
132
|
b({ attribute: "blocked-passage" })
|
|
133
133
|
], n.prototype, "blockedPassage", 2);
|
|
134
|
-
|
|
134
|
+
e([
|
|
135
135
|
b({ attribute: "wagon-class" })
|
|
136
136
|
], n.prototype, "wagonClass", 2);
|
|
137
|
-
|
|
137
|
+
e([
|
|
138
138
|
b()
|
|
139
139
|
], n.prototype, "label", 2);
|
|
140
|
-
|
|
140
|
+
e([
|
|
141
141
|
b({ attribute: "additional-accessibility-text" })
|
|
142
142
|
], n.prototype, "additionalAccessibilityText", 2);
|
|
143
|
-
n =
|
|
143
|
+
n = e([
|
|
144
144
|
m("sbb-train-wagon")
|
|
145
145
|
], n);
|
|
146
146
|
export {
|
package/train/train.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { css as p, LitElement as
|
|
2
|
-
import { property as n, customElement as
|
|
1
|
+
import { css as p, LitElement as f, nothing as d } from "lit";
|
|
2
|
+
import { property as n, customElement as v } from "lit/decorators.js";
|
|
3
3
|
import { html as c, unsafeStatic as h } from "lit/static-html.js";
|
|
4
|
-
import { SbbLanguageController as
|
|
5
|
-
import { EventEmitter as
|
|
6
|
-
import { i18nTrain as
|
|
4
|
+
import { SbbLanguageController as g } from "../core/controllers.js";
|
|
5
|
+
import { EventEmitter as m } from "../core/eventing.js";
|
|
6
|
+
import { i18nTrain as _, i18nWagonsLabel as w } from "../core/i18n.js";
|
|
7
7
|
import { SbbNamedSlotListMixin as x } from "../core/mixins.js";
|
|
8
8
|
import "../icon.js";
|
|
9
9
|
const y = p`*,:before,:after{box-sizing:border-box}:host{--sbb-train-direction-spacing: var(--sbb-spacing-fixed-4x);--sbb-train-direction-label-padding: var(--sbb-spacing-fixed-1x);--sbb-train-direction-station-padding: var(--sbb-spacing-fixed-3x);--sbb-train-direction-line-width: var(--sbb-border-width-1x);--sbb-train-direction-line-color: var(--sbb-color-smoke);--sbb-train-direction-label-color: var(--sbb-color-metal);--sbb-train-direction-label-background: var(--sbb-color-white);--sbb-train-direction-indicator-end-height: .75rem;--sbb-train-direction-indicator-arrow-offset-end: .5625rem;--sbb-train-direction-indicator-arrow-offset-start: calc( var(--sbb-train-direction-indicator-arrow-offset-end) * -1 );display:block}@media (forced-colors: active){:host{--sbb-train-direction-line-color: CanvasText}}.sbb-train{display:flex;flex-direction:column;position:relative;height:100%}.sbb-train__wagons{list-style:none;margin:0;padding:0;font-size:inherit;display:flex;gap:var(--sbb-train-formation-wagon-gap)}.sbb-train__direction{--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);padding-block-start:var(--sbb-train-direction-spacing);margin-block:auto var(--sbb-train-direction-spacing);display:flex;position:relative;width:100%}.sbb-train__direction-heading{z-index:1;display:flex;position:sticky;inset:auto 0;flex-direction:column;width:100%;max-width:var(--sbb-train-direction-width);margin:0;color:var(--sbb-train-direction-label-color);font-size:inherit;font-weight:inherit}.sbb-train__direction-indicator{z-index:0;position:absolute;top:calc(.5em * var(--sbb-typo-line-height-body-text) + var(--sbb-train-direction-spacing));inset-inline:0;height:var(--sbb-train-direction-line-width);background-color:var(--sbb-train-direction-line-color)}.sbb-train__direction-arrow{color:var(--sbb-train-direction-line-color)}:host([direction=right]) .sbb-train__direction-arrow{transform:translate(var(--sbb-train-direction-indicator-arrow-offset-end));order:1}:host([direction=left]) .sbb-train__direction-arrow{transform:translate(var(--sbb-train-direction-indicator-arrow-offset-start))}.sbb-train__sticky-wrapper{position:sticky;inset:auto 0;width:100%;max-width:var(--sbb-train-direction-width);height:var(--sbb-train-direction-line-width);display:flex;align-items:center;justify-content:space-between}.sbb-train__sticky-wrapper:after{content:"";width:var(--sbb-train-direction-line-width);height:var(--sbb-train-direction-indicator-end-height);background-color:var(--sbb-train-direction-line-color);display:block}.sbb-train__direction-label,.sbb-train__direction-station{margin:0 auto}.sbb-train__direction-label{padding:0 var(--sbb-train-direction-label-padding);background-color:var(--sbb-train-direction-label-background)}.sbb-train__direction-station{--sbb-text-font-size: var(--sbb-font-size-text-xxs);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);max-width:100%;text-overflow:ellipsis;overflow:hidden;padding:0 var(--sbb-train-direction-station-padding)}.sbb-train__direction-label-sr{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}`;
|
|
@@ -12,12 +12,12 @@ var u = Object.defineProperty, L = Object.getOwnPropertyDescriptor, e = (i, a, s
|
|
|
12
12
|
(l = i[b]) && (r = (o ? l(a, s, r) : l(r)) || r);
|
|
13
13
|
return o && r && u(a, s, r), r;
|
|
14
14
|
};
|
|
15
|
-
let t = class extends x(
|
|
15
|
+
let t = class extends x(f) {
|
|
16
16
|
constructor() {
|
|
17
17
|
super(...arguments), this.listChildLocalNames = [
|
|
18
18
|
"sbb-train-wagon",
|
|
19
19
|
"sbb-train-blocked-passage"
|
|
20
|
-
], this.directionLabelLevel = "6", this.direction = "left", this.
|
|
20
|
+
], this.directionLabelLevel = "6", this.direction = "left", this.a = new g(this), this.b = new m(
|
|
21
21
|
this,
|
|
22
22
|
t.events.trainSlotChange,
|
|
23
23
|
{
|
|
@@ -29,23 +29,23 @@ let t = class extends x(g) {
|
|
|
29
29
|
/**
|
|
30
30
|
* Create the aria-label text out of the direction label, station and the accessibility label.
|
|
31
31
|
*/
|
|
32
|
-
|
|
33
|
-
const i = [
|
|
32
|
+
c() {
|
|
33
|
+
const i = [_[this.a.current]];
|
|
34
34
|
return this.directionLabel && this.station && i.push(`${this.directionLabel} ${this.station}`), this.accessibilityLabel && i.push(this.accessibilityLabel), `${i.join(", ")}.`;
|
|
35
35
|
}
|
|
36
36
|
willUpdate(i) {
|
|
37
|
-
super.willUpdate(i), i.has("listChildren") && this.
|
|
37
|
+
super.willUpdate(i), i.has("listChildren") && this.b.emit();
|
|
38
38
|
}
|
|
39
39
|
render() {
|
|
40
40
|
const i = `h${this.directionLabelLevel}`;
|
|
41
41
|
return c`
|
|
42
42
|
<div class="sbb-train">
|
|
43
43
|
<${h(i)} class="sbb-train__direction-label-sr">
|
|
44
|
-
${this.
|
|
44
|
+
${this.c()}
|
|
45
45
|
</${h(i)}>
|
|
46
46
|
${this.renderList({
|
|
47
47
|
class: "sbb-train__wagons",
|
|
48
|
-
ariaLabel: w[this.
|
|
48
|
+
ariaLabel: w[this.a.current]
|
|
49
49
|
})}
|
|
50
50
|
|
|
51
51
|
${this.directionLabel ? c`<div class="sbb-train__direction" aria-hidden="true">
|
|
@@ -86,7 +86,7 @@ e([
|
|
|
86
86
|
n({ reflect: !0 })
|
|
87
87
|
], t.prototype, "direction", 2);
|
|
88
88
|
t = e([
|
|
89
|
-
|
|
89
|
+
v("sbb-train")
|
|
90
90
|
], t);
|
|
91
91
|
export {
|
|
92
92
|
t as SbbTrainElement
|