@sbb-esta/lyne-elements-experimental 2.6.0 → 2.7.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/core/datetime/date-helper.js +191 -0
- package/core/datetime.d.ts +3 -0
- package/core/datetime.d.ts.map +1 -1
- package/core/datetime.js +3 -189
- package/core/timetable/access-leg-helper.js +94 -0
- package/core/timetable/timetable-helper.js +13 -0
- package/core/timetable/timetable-properties.js +1 -0
- package/core/timetable.d.ts +3 -0
- package/core/timetable.d.ts.map +1 -1
- package/core/timetable.js +6 -102
- package/custom-elements.json +598 -439
- package/development/core/datetime/date-helper.js +285 -0
- package/development/core/datetime.d.ts +3 -0
- package/development/core/datetime.d.ts.map +1 -1
- package/development/core/datetime.js +2 -281
- package/development/core/timetable/access-leg-helper.js +128 -0
- package/development/core/timetable/timetable-helper.js +21 -0
- package/development/core/timetable/timetable-properties.js +2 -0
- package/development/core/timetable.d.ts +3 -0
- package/development/core/timetable.d.ts.map +1 -1
- package/development/core/timetable.js +3 -139
- package/development/{differenceInMinutes-Cmyza6nm.js → differenceInMinutes-CHSyWiQs.js} +2 -2
- package/development/{format-BU7bjY-L.js → format-D0-yhzi4.js} +3 -3
- package/development/{isValid-DO_pHwcW.js → isValid-Bo4R7iA7.js} +2 -2
- package/development/journey-summary/journey-summary.js +297 -0
- package/development/journey-summary.d.ts +3 -0
- package/development/journey-summary.d.ts.map +1 -1
- package/development/journey-summary.js +2 -294
- package/development/pearl-chain/pearl-chain.js +649 -0
- package/development/pearl-chain-time/pearl-chain-time.js +315 -0
- package/development/pearl-chain-time.d.ts +3 -0
- package/development/pearl-chain-time.d.ts.map +1 -1
- package/development/pearl-chain-time.js +2 -312
- package/development/pearl-chain-vertical/pearl-chain-vertical.js +45 -0
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.js +395 -0
- package/development/pearl-chain-vertical-item.d.ts +3 -0
- package/development/pearl-chain-vertical-item.d.ts.map +1 -1
- package/development/pearl-chain-vertical-item.js +2 -392
- package/development/pearl-chain-vertical.d.ts +3 -0
- package/development/pearl-chain-vertical.d.ts.map +1 -1
- package/development/pearl-chain-vertical.js +2 -42
- package/development/pearl-chain.d.ts +3 -0
- package/development/pearl-chain.d.ts.map +1 -1
- package/development/pearl-chain.js +2 -646
- package/development/timetable-duration/timetable-duration.js +119 -0
- package/development/timetable-duration.d.ts +3 -0
- package/development/timetable-duration.d.ts.map +1 -1
- package/development/timetable-duration.js +2 -116
- package/development/timetable-row/timetable-row.js +820 -0
- package/development/timetable-row.d.ts +3 -0
- package/development/timetable-row.d.ts.map +1 -1
- package/development/timetable-row.js +2 -810
- package/development/{toDate-B6IBgPYH.js → toDate-D_Vjps95.js} +5 -5
- package/{differenceInMinutes-BI2zjbtS.js → differenceInMinutes-BMqUZdhj.js} +1 -1
- package/{format-CUYwLzoN.js → format-Dg8rkk7h.js} +2 -2
- package/index.d.ts +7 -7
- package/index.js +7 -7
- package/{isValid-mroh13Xp.js → isValid-DJ69OMZJ.js} +6 -6
- package/journey-summary/journey-summary.js +190 -0
- package/journey-summary.d.ts +3 -0
- package/journey-summary.d.ts.map +1 -1
- package/journey-summary.js +2 -188
- package/package.json +3 -3
- package/pearl-chain/pearl-chain.js +177 -0
- package/pearl-chain-time/pearl-chain-time.js +153 -0
- package/pearl-chain-time.d.ts +3 -0
- package/pearl-chain-time.d.ts.map +1 -1
- package/pearl-chain-time.js +2 -151
- package/pearl-chain-vertical/pearl-chain-vertical.js +23 -0
- package/pearl-chain-vertical-item/pearl-chain-vertical-item.js +71 -0
- package/pearl-chain-vertical-item.d.ts +3 -0
- package/pearl-chain-vertical-item.d.ts.map +1 -1
- package/pearl-chain-vertical-item.js +2 -69
- package/pearl-chain-vertical.d.ts +3 -0
- package/pearl-chain-vertical.d.ts.map +1 -1
- package/pearl-chain-vertical.js +2 -21
- package/pearl-chain.d.ts +3 -0
- package/pearl-chain.d.ts.map +1 -1
- package/pearl-chain.js +2 -175
- package/timetable-duration/timetable-duration.js +55 -0
- package/timetable-duration.d.ts +3 -0
- package/timetable-duration.d.ts.map +1 -1
- package/timetable-duration.js +2 -53
- package/timetable-row/timetable-row.js +462 -0
- package/timetable-row.d.ts +3 -0
- package/timetable-row.d.ts.map +1 -1
- package/timetable-row.js +9 -460
- package/{toDate-DQg4ZFnf.js → toDate-BCXKL_wM.js} +4 -4
- package/development/pearl-chain/pearl-chain.sample-data.d.ts +0 -141
- package/development/pearl-chain/pearl-chain.sample-data.d.ts.map +0 -1
- package/development/timetable-duration/timetable-duration.sample-data.d.ts +0 -6
- package/development/timetable-duration/timetable-duration.sample-data.d.ts.map +0 -1
- package/development/timetable-row/timetable-row.sample-data.d.ts +0 -25
- package/development/timetable-row/timetable-row.sample-data.d.ts.map +0 -1
- package/pearl-chain/pearl-chain.sample-data.d.ts +0 -141
- package/pearl-chain/pearl-chain.sample-data.d.ts.map +0 -1
- package/timetable-duration/timetable-duration.sample-data.d.ts +0 -6
- package/timetable-duration/timetable-duration.sample-data.d.ts.map +0 -1
- package/timetable-row/timetable-row.sample-data.d.ts +0 -25
- package/timetable-row/timetable-row.sample-data.d.ts.map +0 -1
|
@@ -0,0 +1,462 @@
|
|
|
1
|
+
var Ke = (e) => {
|
|
2
|
+
throw TypeError(e);
|
|
3
|
+
};
|
|
4
|
+
var Ye = (e, i, s) => i.has(e) || Ke("Cannot " + s);
|
|
5
|
+
var T = (e, i, s) => (Ye(e, i, "read from private field"), s ? s.call(e) : i.get(e)), A = (e, i, s) => i.has(e) ? Ke("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(e) : i.set(e, s), h = (e, i, s, n) => (Ye(e, i, "write to private field"), n ? n.call(e, s) : i.set(e, s), s);
|
|
6
|
+
import { __runInitializers as d, __esDecorate as w } from "tslib";
|
|
7
|
+
import { SbbLanguageController as yt } from "@sbb-esta/lyne-elements/core/controllers.js";
|
|
8
|
+
import { defaultDateAdapter as Xe } from "@sbb-esta/lyne-elements/core/datetime.js";
|
|
9
|
+
import { forceType as I } from "@sbb-esta/lyne-elements/core/decorators.js";
|
|
10
|
+
import { setOrRemoveAttribute as vt } from "@sbb-esta/lyne-elements/core/dom.js";
|
|
11
|
+
import { i18nFromPlatform as xt, i18nDeparture as Ze, i18nMeansOfTransport as G, i18nDirection as Ge, i18nRealTimeInfo as Ve, i18nSupersaver as et, i18nTransferProcedures as wt, i18nTransferProcedure as $t, i18nArrival as Tt, i18nClass as tt, i18nOccupancy as at, i18nTravelhints as At, i18nTripDuration as it, i18nNew as st, i18nTripQuayChange as Nt } from "@sbb-esta/lyne-elements/core/i18n.js";
|
|
12
|
+
import { css as Ct, LitElement as kt, nothing as u, html as m } from "lit";
|
|
13
|
+
import { customElement as zt, property as N } from "lit/decorators.js";
|
|
14
|
+
import { removeTimezoneFromISOTimeString as rt, durationToTime as nt } from "../core/datetime.js";
|
|
15
|
+
import { isRideLeg as dt, getDepartureArrivalTimeAttribute as It } from "../core/timetable.js";
|
|
16
|
+
import "@sbb-esta/lyne-elements/card.js";
|
|
17
|
+
import "@sbb-esta/lyne-elements/icon.js";
|
|
18
|
+
import "@sbb-esta/lyne-elements/timetable-occupancy.js";
|
|
19
|
+
import "../pearl-chain-time.js";
|
|
20
|
+
import { f as lt } from "../format-Dg8rkk7h.js";
|
|
21
|
+
const Lt = Ct`*,:before,:after{box-sizing:border-box}:host{--sbb-timetable-row-gap: var(--sbb-spacing-fixed-2x);--sbb-timetable-row-height: 1.5625rem;--sbb-timetable-row-height-header: 1.25rem;--sbb-timetable-row-height-footer: 1rem;--sbb-timetable-row-skeleton-pulse-duration: 1.8s;display:block}:host([disable-animation]){--sbb-timetable-row-skeleton-pulse-duration: 0}.sbb-timetable__row-transport-icon{--sbb-icon-svg-width: 1.25rem;--sbb-icon-svg-height: 1.25rem}.sbb-travel-hints__item{--sbb-icon-svg-height: .875rem}.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}.sbb-timetable__row--quay{margin-inline-end:var(--sbb-spacing-fixed-1x)}.sbb-timetable__row--quay-type{float:left}ul{list-style:none;margin:0;padding:0;font-size:inherit;display:inline-flex}li,.sbb-timetable__row-transport{display:inline-flex;align-self:center}.sbb-timetable__row-transportnumber,.sbb-timetable__row-time{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);font-weight:700;line-height:unset;white-space:nowrap;align-self:center}.sbb-timetable__row{--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);display:flex;flex-direction:column;gap:var(--sbb-timetable-row-gap)}.sbb-timetable__row-header,.sbb-timetable__row-footer{animation:none}.sbb-timetable__row-header{display:flex;gap:var(--sbb-spacing-fixed-2x);align-items:center;line-height:var(--sbb-timetable-row-height-header)}.sbb-timetable__row-details,.sbb-timetable__row-hints{display:inline-flex;gap:var(--sbb-spacing-fixed-1x);align-items:center}.sbb-timetable__row-header p{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin:0;align-self:center}.sbb-timetable__row-footer{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;gap:var(--sbb-spacing-fixed-2x);line-height:var(--sbb-timetable-row-height-footer)}.sbb-timetable__row-footer>span{align-self:center}.sbb-timetable__row-footer :only-child{margin-inline-start:auto}.sbb-timetable__row-quay--changed{color:var(--sbb-color-red)}.sbb-timetable__row-transport-wrapper,.sbb-timetable__row-warning{display:inline-flex}.sbb-loading{pointer-events:none}.sbb-loading__wrapper{display:flex;flex-direction:column;gap:var(--sbb-spacing-fixed-2x)}.sbb-loading__row{width:100%;border-radius:var(--sbb-border-radius-1x);height:var(--sbb-timetable-row-height)}@media (min-width: 52.5rem){.sbb-loading__row{height:1.75rem}}@media (forced-colors: active){.sbb-loading__row{border:var(--sbb-border-width-1x) solid ButtonBorder!important}}.sbb-loading__row,.sbb-loading__badge{background:var(--sbb-color-cloud);animation:skeleton-pulse var(--sbb-timetable-row-skeleton-pulse-duration) ease-out infinite}.sbb-loading__row:first-of-type{height:var(--sbb-timetable-row-height-header);width:50%}.sbb-loading__row:last-of-type{height:var(--sbb-timetable-row-height-footer)}.sbb-loading__badge{margin-inline:auto calc(var(--sbb-spacing-fixed-3x) * -1);padding-inline-end:var(--sbb-spacing-fixed-6x);border-end-start-radius:var(--sbb-border-radius-4x);transform:skew(16deg);width:7.1875rem;height:1.25rem}@keyframes skeleton-pulse{0%{background:var(--sbb-color-cloud)}17%{background:var(--sbb-color-cloud)}50%{background:var(--sbb-color-milk)}67%{background:var(--sbb-color-milk)}to{background:var(--sbb-color-cloud)}}`, Rt = (e, i) => m`<span class="sbb-timetable__row-transport">
|
|
22
|
+
<sbb-icon name=${e}></sbb-icon>
|
|
23
|
+
<span class="sbb-screen-reader-only">${i}</span>
|
|
24
|
+
</span>`, Mt = (e, i) => {
|
|
25
|
+
const s = ["M", "B", "T"].includes(e) ? " " : "";
|
|
26
|
+
return m`<span class="sbb-timetable__row-transportnumber">
|
|
27
|
+
${i !== null ? e + s + i : e}
|
|
28
|
+
</span>`;
|
|
29
|
+
}, ot = (e) => {
|
|
30
|
+
var i, s, n;
|
|
31
|
+
return (n = (s = (i = e == null ? void 0 : e.find((b) => {
|
|
32
|
+
var r, p;
|
|
33
|
+
return (p = (r = b.serviceJourney) == null ? void 0 : r.serviceAlteration) == null ? void 0 : p.reachableText;
|
|
34
|
+
})) == null ? void 0 : i.serviceJourney) == null ? void 0 : s.serviceAlteration) == null ? void 0 : n.reachableText;
|
|
35
|
+
}, Et = (e) => {
|
|
36
|
+
var i, s, n;
|
|
37
|
+
return (n = (s = (i = e == null ? void 0 : e.find((b) => {
|
|
38
|
+
var r, p;
|
|
39
|
+
return (p = (r = b.serviceJourney) == null ? void 0 : r.serviceAlteration) == null ? void 0 : p.delayText;
|
|
40
|
+
})) == null ? void 0 : i.serviceJourney) == null ? void 0 : s.serviceAlteration) == null ? void 0 : n.delayText;
|
|
41
|
+
}, ct = (e) => {
|
|
42
|
+
var i, s, n;
|
|
43
|
+
return (n = (s = (i = e == null ? void 0 : e.find((b) => {
|
|
44
|
+
var r, p;
|
|
45
|
+
return !!((p = (r = b.serviceJourney) == null ? void 0 : r.serviceAlteration) != null && p.redirectedText);
|
|
46
|
+
})) == null ? void 0 : i.serviceJourney) == null ? void 0 : s.serviceAlteration) == null ? void 0 : n.redirectedText;
|
|
47
|
+
}, bt = (e) => {
|
|
48
|
+
var i, s, n;
|
|
49
|
+
return (n = (s = (i = e == null ? void 0 : e.find((b) => {
|
|
50
|
+
var r, p;
|
|
51
|
+
return !!((p = (r = b.serviceJourney) == null ? void 0 : r.serviceAlteration) != null && p.unplannedStopPointsText);
|
|
52
|
+
})) == null ? void 0 : i.serviceJourney) == null ? void 0 : s.serviceAlteration) == null ? void 0 : n.unplannedStopPointsText;
|
|
53
|
+
}, St = (e) => {
|
|
54
|
+
const i = {
|
|
55
|
+
DISTURBANCE: 0,
|
|
56
|
+
INFORMATION: 1,
|
|
57
|
+
DELAY: 2,
|
|
58
|
+
TRAIN_REPLACEMENT_BY_BUS: 3,
|
|
59
|
+
CONSTRUCTION_SITE: 4,
|
|
60
|
+
END_MESSAGE: 5
|
|
61
|
+
};
|
|
62
|
+
return [...e].sort((s, n) => i[s.cause] - i[n.cause]);
|
|
63
|
+
}, Ot = (e) => {
|
|
64
|
+
var i;
|
|
65
|
+
switch (e == null ? void 0 : e.cause) {
|
|
66
|
+
case "DISTURBANCE":
|
|
67
|
+
return {
|
|
68
|
+
name: "disruption",
|
|
69
|
+
text: (i = e == null ? void 0 : e.broadcastMessages) != null && i.length ? e == null ? void 0 : e.broadcastMessages[0].title : ""
|
|
70
|
+
};
|
|
71
|
+
case "INFORMATION":
|
|
72
|
+
return {
|
|
73
|
+
name: "info",
|
|
74
|
+
text: e != null && e.broadcastMessages.length ? e == null ? void 0 : e.broadcastMessages[0].title : ""
|
|
75
|
+
};
|
|
76
|
+
case "DELAY":
|
|
77
|
+
return {
|
|
78
|
+
name: "delay",
|
|
79
|
+
text: e != null && e.broadcastMessages.length ? e == null ? void 0 : e.broadcastMessages[0].title : ""
|
|
80
|
+
};
|
|
81
|
+
case "TRAIN_REPLACEMENT_BY_BUS":
|
|
82
|
+
return {
|
|
83
|
+
name: "replacementbus",
|
|
84
|
+
text: e != null && e.broadcastMessages.length ? e == null ? void 0 : e.broadcastMessages[0].title : ""
|
|
85
|
+
};
|
|
86
|
+
case "CONSTRUCTION_SITE":
|
|
87
|
+
return {
|
|
88
|
+
name: "construction",
|
|
89
|
+
text: e != null && e.broadcastMessages.length ? e == null ? void 0 : e.broadcastMessages[0].title : ""
|
|
90
|
+
};
|
|
91
|
+
default:
|
|
92
|
+
return {
|
|
93
|
+
name: "info",
|
|
94
|
+
text: e != null && e.broadcastMessages.length ? e == null ? void 0 : e.broadcastMessages[0].title : ""
|
|
95
|
+
};
|
|
96
|
+
}
|
|
97
|
+
}, Pt = (e, i) => {
|
|
98
|
+
const { summary: s, legs: n } = e || {}, b = n == null ? void 0 : n.filter((p) => dt(p)), { tripStatus: r } = s || {};
|
|
99
|
+
if (r != null && r.cancelled || r != null && r.partiallyCancelled)
|
|
100
|
+
return { name: "cancellation", text: r == null ? void 0 : r.cancelledText };
|
|
101
|
+
if (ot(b))
|
|
102
|
+
return { name: "missed-connection", text: ot(b) };
|
|
103
|
+
if (r != null && r.alternative)
|
|
104
|
+
return { name: "alternative", text: r.alternativeText };
|
|
105
|
+
if (ct(b))
|
|
106
|
+
return { name: "reroute", text: ct(b) };
|
|
107
|
+
if (bt(b))
|
|
108
|
+
return { name: "add-stop", text: bt(b) };
|
|
109
|
+
if (r != null && r.delayed || r != null && r.delayedUnknown)
|
|
110
|
+
return { name: "delay", text: Et(b) };
|
|
111
|
+
if (r != null && r.quayChanged) {
|
|
112
|
+
const p = b[0].departure;
|
|
113
|
+
return {
|
|
114
|
+
name: "platform-change",
|
|
115
|
+
text: p.quayChanged ? p.quayChangedText : Nt[i]
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
return {};
|
|
119
|
+
}, Dt = (e) => {
|
|
120
|
+
const i = ["RR", "RK", "RC", "RL", "RM", "RS", "RU", "XP", "XR", "XT"];
|
|
121
|
+
return e.reduce((s, n) => {
|
|
122
|
+
if (s)
|
|
123
|
+
return s;
|
|
124
|
+
if (i.includes(n.name))
|
|
125
|
+
return { ...n, name: "RR" };
|
|
126
|
+
}, void 0);
|
|
127
|
+
}, Ft = (e) => {
|
|
128
|
+
const i = ["Z", "SB", "SZ", "VR", "TG"];
|
|
129
|
+
return e.filter((n, b) => e.findIndex((r) => r.name === n.name) === b).filter((n) => i.includes(n.name)).sort((n, b) => i.indexOf(n.name) - i.indexOf(b.name));
|
|
130
|
+
}, ae = (e) => {
|
|
131
|
+
const i = Dt(e), s = Ft(e);
|
|
132
|
+
return i === void 0 ? s : s.length ? s[0].name === "Z" && s[1] ? [s[0], i, s[1]].concat(s.slice(2)) : [i, ...s] : [i];
|
|
133
|
+
};
|
|
134
|
+
let ia = (() => {
|
|
135
|
+
var L, R, M, E, S, O, P, D, F, B, _;
|
|
136
|
+
let e = [zt("sbb-timetable-row")], i, s = [], n, b = kt, r = [], p, ie = [], se = [], re, ne = [], le = [], oe, ce = [], be = [], de, he = [], ge = [], me, pe = [], _e = [], ue, fe = [], ye = [], ve, xe = [], we = [], $e, Te = [], Ae = [], Ne, Ce = [], ke = [], ze, Ie = [], Le = [], Re;
|
|
137
|
+
return _ = class extends b {
|
|
138
|
+
constructor() {
|
|
139
|
+
super(...arguments);
|
|
140
|
+
A(this, L);
|
|
141
|
+
A(this, R);
|
|
142
|
+
A(this, M);
|
|
143
|
+
A(this, E);
|
|
144
|
+
A(this, S);
|
|
145
|
+
A(this, O);
|
|
146
|
+
A(this, P);
|
|
147
|
+
A(this, D);
|
|
148
|
+
A(this, F);
|
|
149
|
+
A(this, B);
|
|
150
|
+
h(this, L, (d(this, r), d(this, ie, null))), h(this, R, (d(this, se), d(this, ne, null))), h(this, M, (d(this, le), d(this, ce, !1))), h(this, E, (d(this, be), d(this, he, null))), h(this, S, (d(this, ge), d(this, pe, !1))), h(this, O, (d(this, _e), d(this, fe, !1))), h(this, P, (d(this, ye), d(this, xe, !1))), h(this, D, (d(this, we), d(this, Te, ""))), h(this, F, (d(this, Ae), d(this, Ce, !1))), h(this, B, (d(this, ke), d(this, Ie, !1))), this._now = (d(this, Le), null), this._language = new yt(this);
|
|
151
|
+
}
|
|
152
|
+
/** The trip Prop. */
|
|
153
|
+
get trip() {
|
|
154
|
+
return T(this, L);
|
|
155
|
+
}
|
|
156
|
+
set trip(a) {
|
|
157
|
+
h(this, L, a);
|
|
158
|
+
}
|
|
159
|
+
/** The price Prop, which consists of the data for the badge. */
|
|
160
|
+
get price() {
|
|
161
|
+
return T(this, R);
|
|
162
|
+
}
|
|
163
|
+
set price(a) {
|
|
164
|
+
h(this, R, a);
|
|
165
|
+
}
|
|
166
|
+
/** This will be forwarded to the sbb-pearl-chain component - if true the position won't be animated. */
|
|
167
|
+
get disableAnimation() {
|
|
168
|
+
return T(this, M);
|
|
169
|
+
}
|
|
170
|
+
set disableAnimation(a) {
|
|
171
|
+
h(this, M, a);
|
|
172
|
+
}
|
|
173
|
+
/** This will be forwarded to the notices section */
|
|
174
|
+
get boarding() {
|
|
175
|
+
return T(this, E);
|
|
176
|
+
}
|
|
177
|
+
set boarding(a) {
|
|
178
|
+
h(this, E, a);
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* The loading state -
|
|
182
|
+
* when this is true it will be render skeleton with an idling animation
|
|
183
|
+
*/
|
|
184
|
+
get loadingTrip() {
|
|
185
|
+
return T(this, S);
|
|
186
|
+
}
|
|
187
|
+
set loadingTrip(a) {
|
|
188
|
+
h(this, S, a);
|
|
189
|
+
}
|
|
190
|
+
/**
|
|
191
|
+
* The Footpath attribute for rendering different icons
|
|
192
|
+
* true: render a11y-icon
|
|
193
|
+
* false: render walk-icon
|
|
194
|
+
* default: render walk-icon
|
|
195
|
+
*/
|
|
196
|
+
get a11yFootpath() {
|
|
197
|
+
return T(this, O);
|
|
198
|
+
}
|
|
199
|
+
set a11yFootpath(a) {
|
|
200
|
+
h(this, O, a);
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* The loading state -
|
|
204
|
+
* when this is true it will be render skeleton with an idling animation
|
|
205
|
+
*/
|
|
206
|
+
get loadingPrice() {
|
|
207
|
+
return T(this, P);
|
|
208
|
+
}
|
|
209
|
+
set loadingPrice(a) {
|
|
210
|
+
h(this, P, a);
|
|
211
|
+
}
|
|
212
|
+
/**
|
|
213
|
+
* Hidden label for the card action. It overrides the automatically generated accessibility text for the component. Use this prop to provide custom accessibility information for the component.
|
|
214
|
+
*/
|
|
215
|
+
get cardActionLabel() {
|
|
216
|
+
return T(this, D);
|
|
217
|
+
}
|
|
218
|
+
set cardActionLabel(a) {
|
|
219
|
+
h(this, D, a);
|
|
220
|
+
}
|
|
221
|
+
/** This will be forwarded to the sbb-card component as aria-expanded. */
|
|
222
|
+
get accessibilityExpanded() {
|
|
223
|
+
return T(this, F);
|
|
224
|
+
}
|
|
225
|
+
set accessibilityExpanded(a) {
|
|
226
|
+
h(this, F, a);
|
|
227
|
+
}
|
|
228
|
+
/** When this prop is true the sbb-card will be in the active state. */
|
|
229
|
+
get active() {
|
|
230
|
+
return T(this, B);
|
|
231
|
+
}
|
|
232
|
+
set active(a) {
|
|
233
|
+
h(this, B, a);
|
|
234
|
+
}
|
|
235
|
+
/** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */
|
|
236
|
+
set now(a) {
|
|
237
|
+
this._now = Xe.getValidDateOrNull(Xe.deserialize(a));
|
|
238
|
+
}
|
|
239
|
+
get now() {
|
|
240
|
+
return this._now ?? /* @__PURE__ */ new Date();
|
|
241
|
+
}
|
|
242
|
+
willUpdate(a) {
|
|
243
|
+
super.willUpdate(a), a.has("loadingTrip") && vt(this, "role", this.loadingTrip ? null : "rowgroup");
|
|
244
|
+
}
|
|
245
|
+
/** The skeleton render function for the loading state */
|
|
246
|
+
_renderSkeleton() {
|
|
247
|
+
return m`
|
|
248
|
+
<sbb-card size="l" class="sbb-loading">
|
|
249
|
+
${this.loadingPrice ? m`<sbb-card-badge class="sbb-loading__badge"></sbb-card-badge>` : u}
|
|
250
|
+
<div class="sbb-loading__wrapper">
|
|
251
|
+
<div class="sbb-loading__row"></div>
|
|
252
|
+
<div class="sbb-loading__row"></div>
|
|
253
|
+
<div class="sbb-loading__row"></div>
|
|
254
|
+
</div>
|
|
255
|
+
</sbb-card>
|
|
256
|
+
`;
|
|
257
|
+
}
|
|
258
|
+
_getRideLegs() {
|
|
259
|
+
var a, t;
|
|
260
|
+
return ((t = (a = this.trip) == null ? void 0 : a.legs) == null ? void 0 : t.filter((l) => dt(l))) ?? [];
|
|
261
|
+
}
|
|
262
|
+
_getQuayTypeStrings() {
|
|
263
|
+
var $, o;
|
|
264
|
+
if (!(($ = this.trip.summary) != null && $.product))
|
|
265
|
+
return null;
|
|
266
|
+
const a = this._getRideLegs(), l = ((o = this.trip.summary.product) == null ? void 0 : o.vehicleMode) === "TRAIN" ? a[0].serviceJourney.quayTypeShortName || "" : a[0].serviceJourney.quayTypeName || "";
|
|
267
|
+
return {
|
|
268
|
+
long: xt[this._language.current] + " " + l,
|
|
269
|
+
short: l
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/** map Quay */
|
|
273
|
+
_renderQuayType() {
|
|
274
|
+
var t;
|
|
275
|
+
if (!((t = this.trip.summary) != null && t.product))
|
|
276
|
+
return;
|
|
277
|
+
const a = this._getQuayTypeStrings();
|
|
278
|
+
return m`
|
|
279
|
+
<span class="sbb-timetable__row--quay">
|
|
280
|
+
<span class="sbb-screen-reader-only">${a == null ? void 0 : a.long} </span>
|
|
281
|
+
<span class="sbb-timetable__row--quay-type" aria-hidden="true"
|
|
282
|
+
>${a == null ? void 0 : a.short}</span
|
|
283
|
+
>
|
|
284
|
+
</span>
|
|
285
|
+
`;
|
|
286
|
+
}
|
|
287
|
+
_handleHimCus(a) {
|
|
288
|
+
var o;
|
|
289
|
+
const { situations: t } = a || {}, l = t && St(t), $ = Pt(a, this._language.current);
|
|
290
|
+
return {
|
|
291
|
+
cus: (o = Object.keys($)) != null && o.length ? $ : null,
|
|
292
|
+
him: t != null && t.length ? Ot(l[0]) : null
|
|
293
|
+
};
|
|
294
|
+
}
|
|
295
|
+
_getAccessibilityText(a) {
|
|
296
|
+
var Se, Oe, Pe, De, Fe, Be, qe, Ue, We, je, Je, He;
|
|
297
|
+
const { summary: t, legs: l, notices: $ } = a || {}, { departureWalk: o, arrivalWalk: j, departure: f, arrival: g, product: y, direction: V, occupancy: c, duration: k } = t || {}, { departureTimeAttribute: v, arrivalTimeAttribute: q } = It(l, o || 0, j || 0, this._language.current, this.a11yFootpath), C = this._getRideLegs(), U = f != null && f.time ? rt(f.time) : void 0, W = g != null && g.time ? rt(g.time) : void 0, J = v ? `${v.text} ${v.duration}, ` : "", H = q ? `${q.text} ${q.duration}, ` : "", Q = U ? `${Ze[this._language.current]}: ${lt(U, "HH:mm")}, ` : "", K = () => {
|
|
298
|
+
var Z;
|
|
299
|
+
return f != null && f.quayFormatted ? `${f != null && f.quayChanged ? `${st[this._language.current]} ` : ""}${(Z = this._getQuayTypeStrings()) == null ? void 0 : Z.long} ${f == null ? void 0 : f.quayFormatted}, ` : "";
|
|
300
|
+
}, ee = y && y.vehicleMode ? G[y.vehicleMode.toLowerCase()] && `${G[y.vehicleMode.toLowerCase()][this._language.current]}, ` : "", Y = y != null && y.vehicleSubModeShortName ? `${y.vehicleSubModeShortName} ${y.line || ""}, ` : "", X = `${Ge[this._language.current]} ${V}, `, x = this._handleHimCus(a), Me = (Se = x == null ? void 0 : x.cus) != null && Se.text ? `${Ve[this._language.current]}: ${(Oe = x == null ? void 0 : x.cus) == null ? void 0 : Oe.text}, ` : "", ht = (Pe = x == null ? void 0 : x.him) != null && Pe.text ? `${Ve[this._language.current]}: ${(De = x == null ? void 0 : x.him) == null ? void 0 : De.text}, ` : "", gt = this.boarding ? `${this.boarding.text}, ` : "", mt = `${(Fe = this.price) != null && Fe.isDiscount ? et[this._language.current] : ""} ${(Be = this.price) != null && Be.text && ((qe = this.price) != null && qe.price) ? (((Ue = this.price) == null ? void 0 : Ue.text) || "") + " " + (((We = this.price) == null ? void 0 : We.price) || "") + ", " : ""}`, pt = C.length > 2 ? `${C.length - 1} ${wt[this._language.current]}, ` : C.length > 1 ? `${C.length - 1} ${$t[this._language.current]}, ` : "", _t = W ? `${Tt[this._language.current]}: ${lt(W, "HH:mm")}, ` : "";
|
|
301
|
+
let te = "";
|
|
302
|
+
c && (c.firstClass && c.firstClass !== "UNKNOWN" && (te += `${tt.first[this._language.current]} ${(je = at[c.firstClass.toLowerCase()]) == null ? void 0 : je[this._language.current]}.`), c.secondClass && c.secondClass !== "UNKNOWN" && (te += ` ${tt.second[this._language.current]} ${(Je = at[c.secondClass.toLowerCase()]) == null ? void 0 : Je[this._language.current]}.`));
|
|
303
|
+
const Ee = $ && ae($).length && ((He = ae($)) == null ? void 0 : He.map((z, Z) => {
|
|
304
|
+
var Qe;
|
|
305
|
+
return Z < 4 && ((Qe = z.text) == null ? void 0 : Qe.template);
|
|
306
|
+
}).join(", ")) + ", ", ut = Ee ? `${At[this._language.current]}: ${Ee}` : "", ft = k && k > 0 ? `${it[this._language.current]} ${nt(k, this._language.current).long}, ` : "";
|
|
307
|
+
return [
|
|
308
|
+
J,
|
|
309
|
+
Q,
|
|
310
|
+
K(),
|
|
311
|
+
ee,
|
|
312
|
+
Y,
|
|
313
|
+
X,
|
|
314
|
+
Me,
|
|
315
|
+
gt,
|
|
316
|
+
mt,
|
|
317
|
+
Me ? "" : ht,
|
|
318
|
+
_t,
|
|
319
|
+
H,
|
|
320
|
+
ft,
|
|
321
|
+
pt,
|
|
322
|
+
te,
|
|
323
|
+
ut
|
|
324
|
+
].map((z) => z.trim()).filter((z) => z && z.length > 0).join(" ");
|
|
325
|
+
}
|
|
326
|
+
render() {
|
|
327
|
+
var W, J, H, Q;
|
|
328
|
+
if (this.loadingTrip)
|
|
329
|
+
return this._renderSkeleton();
|
|
330
|
+
const { legs: a, id: t, notices: l, summary: $ } = this.trip || {}, { product: o, direction: j, departureWalk: f, departure: g, arrival: y, arrivalWalk: V, occupancy: c, duration: k } = $ || {}, v = this._handleHimCus(this.trip), q = !!v.cus || !!v.him, C = l && ae(l), U = k ? nt(k, this._language.current) : null;
|
|
331
|
+
return m`
|
|
332
|
+
<sbb-card size="l" id=${t}>
|
|
333
|
+
<sbb-card-button
|
|
334
|
+
?active=${this.active}
|
|
335
|
+
aria-expanded=${this.accessibilityExpanded ? "true" : u}
|
|
336
|
+
>
|
|
337
|
+
${this.cardActionLabel ? this.cardActionLabel : this._getAccessibilityText(this.trip)}
|
|
338
|
+
</sbb-card-button>
|
|
339
|
+
${this.loadingPrice ? m`<sbb-card-badge class="sbb-loading__badge"></sbb-card-badge>` : u}
|
|
340
|
+
${this.price && !this.loadingPrice ? m`<sbb-card-badge color=${this.price.isDiscount ? "charcoal" : "white"}>
|
|
341
|
+
${this.price.isDiscount ? m`<span aria-hidden="true">
|
|
342
|
+
%<span class="sbb-screen-reader-only"
|
|
343
|
+
>${et[this._language.current]}</span
|
|
344
|
+
>
|
|
345
|
+
</span>` : u}
|
|
346
|
+
${this.price.text ? m`<span>${this.price.text}</span>` : u}
|
|
347
|
+
${this.price.price ? m`<span>${this.price.price}</span>` : u}
|
|
348
|
+
</sbb-card-badge>` : u}
|
|
349
|
+
<div class="sbb-timetable__row" role="row">
|
|
350
|
+
<div class="sbb-timetable__row-header" role="gridcell">
|
|
351
|
+
<div class="sbb-timetable__row-details">
|
|
352
|
+
${(o == null ? void 0 : o.corporateIdentityPictogram) && m`<span class="sbb-timetable__row-transport-wrapper">
|
|
353
|
+
<sbb-icon
|
|
354
|
+
class="sbb-timetable__row-transport-icon"
|
|
355
|
+
name="picto:${o.corporateIdentityPictogram}"
|
|
356
|
+
></sbb-icon>
|
|
357
|
+
<span class="sbb-screen-reader-only">
|
|
358
|
+
${o && o.vehicleMode && G[o.vehicleMode.toLowerCase()] && G[o.vehicleMode.toLowerCase()][this._language.current]}
|
|
359
|
+
|
|
360
|
+
</span>
|
|
361
|
+
</span>`}
|
|
362
|
+
${o && (o.corporateIdentityIcon ? Rt(o.corporateIdentityIcon, o.name) : o.vehicleSubModeShortName && Mt(o.vehicleSubModeShortName, o == null ? void 0 : o.line))}
|
|
363
|
+
</div>
|
|
364
|
+
${j ? m`<p>${`${Ge[this._language.current]} ${j}`}</p>` : u}
|
|
365
|
+
</div>
|
|
366
|
+
<sbb-pearl-chain-time
|
|
367
|
+
role="gridcell"
|
|
368
|
+
.legs=${a}
|
|
369
|
+
.departureTime=${g == null ? void 0 : g.time}
|
|
370
|
+
.arrivalTime=${y == null ? void 0 : y.time}
|
|
371
|
+
.departureWalk=${f}
|
|
372
|
+
.arrivalWalk=${V}
|
|
373
|
+
?disable-animation=${this.disableAnimation}
|
|
374
|
+
?a11y-footpath=${this.a11yFootpath}
|
|
375
|
+
.now=${this.now}
|
|
376
|
+
></sbb-pearl-chain-time>
|
|
377
|
+
<div class="sbb-timetable__row-footer" role="gridcell">
|
|
378
|
+
${o && (g != null && g.quayFormatted) ? m`<span
|
|
379
|
+
class=${g != null && g.quayChanged ? "sbb-timetable__row-quay--changed" : u}
|
|
380
|
+
>
|
|
381
|
+
<span class="sbb-screen-reader-only">
|
|
382
|
+
${`${Ze[this._language.current]} ${g != null && g.quayChanged ? st[this._language.current] : ""}`}
|
|
383
|
+
|
|
384
|
+
</span>
|
|
385
|
+
${this._renderQuayType()} ${g == null ? void 0 : g.quayFormatted}
|
|
386
|
+
</span>` : u}
|
|
387
|
+
${c != null && c.firstClass && (c == null ? void 0 : c.firstClass) !== "UNKNOWN" || c != null && c.secondClass && c.secondClass !== "UNKNOWN" ? m`<sbb-timetable-occupancy
|
|
388
|
+
.firstClassOccupancy=${(W = c == null ? void 0 : c.firstClass) == null ? void 0 : W.toLowerCase()}
|
|
389
|
+
.secondClassOccupancy=${(J = c == null ? void 0 : c.secondClass) == null ? void 0 : J.toLowerCase()}
|
|
390
|
+
></sbb-timetable-occupancy>` : u}
|
|
391
|
+
${C && C.length || this.boarding ? m`<ul class="sbb-timetable__row-hints" role="list">
|
|
392
|
+
${C == null ? void 0 : C.map((K, ee) => {
|
|
393
|
+
var Y, X;
|
|
394
|
+
return ee < 4 ? m`<li>
|
|
395
|
+
<sbb-icon
|
|
396
|
+
class="sbb-travel-hints__item"
|
|
397
|
+
name=${"sa-" + ((Y = K.name) == null ? void 0 : Y.toLowerCase())}
|
|
398
|
+
></sbb-icon>
|
|
399
|
+
<span class="sbb-screen-reader-only">${(X = K.text) == null ? void 0 : X.template}</span>
|
|
400
|
+
</li>` : u;
|
|
401
|
+
})}
|
|
402
|
+
${this.boarding ? m`<li>
|
|
403
|
+
<sbb-icon
|
|
404
|
+
class="sbb-travel-hints__item"
|
|
405
|
+
name=${(H = this.boarding) == null ? void 0 : H.name}
|
|
406
|
+
aria-label=${(Q = this.boarding) == null ? void 0 : Q.text}
|
|
407
|
+
aria-hidden="false"
|
|
408
|
+
></sbb-icon>
|
|
409
|
+
</li>` : u}
|
|
410
|
+
</ul>` : u}
|
|
411
|
+
${k && k > 0 ? m`<time>
|
|
412
|
+
<span class="sbb-screen-reader-only">
|
|
413
|
+
${`${it[this._language.current]} ${U.long}`}
|
|
414
|
+
</span>
|
|
415
|
+
<span aria-hidden="true">${U.short}</span>
|
|
416
|
+
</time>` : u}
|
|
417
|
+
${q && (v.cus || v.him) ? m`<span class="sbb-timetable__row-warning">
|
|
418
|
+
<sbb-icon name=${(v.cus || v.him).name}></sbb-icon>
|
|
419
|
+
<span class="sbb-screen-reader-only">${(v.cus || v.him).text}</span>
|
|
420
|
+
</span>` : u}
|
|
421
|
+
</div>
|
|
422
|
+
</div>
|
|
423
|
+
</sbb-card>
|
|
424
|
+
`;
|
|
425
|
+
}
|
|
426
|
+
}, L = new WeakMap(), R = new WeakMap(), M = new WeakMap(), E = new WeakMap(), S = new WeakMap(), O = new WeakMap(), P = new WeakMap(), D = new WeakMap(), F = new WeakMap(), B = new WeakMap(), n = _, (() => {
|
|
427
|
+
const a = typeof Symbol == "function" && Symbol.metadata ? Object.create(b[Symbol.metadata] ?? null) : void 0;
|
|
428
|
+
p = [N({ type: Object })], re = [N({ type: Object })], oe = [I(), N({ attribute: "disable-animation", reflect: !0, type: Boolean })], de = [N({ type: Object })], me = [I(), N({ attribute: "loading-trip", type: Boolean })], ue = [I(), N({ attribute: "a11y-footpath", type: Boolean })], ve = [I(), N({ attribute: "loading-price", type: Boolean })], $e = [I(), N({ attribute: "card-action-label" })], Ne = [I(), N({ attribute: "accessibility-expanded", type: Boolean })], ze = [I(), N({ type: Boolean })], Re = [N()], w(_, null, p, { kind: "accessor", name: "trip", static: !1, private: !1, access: { has: (t) => "trip" in t, get: (t) => t.trip, set: (t, l) => {
|
|
429
|
+
t.trip = l;
|
|
430
|
+
} }, metadata: a }, ie, se), w(_, null, re, { kind: "accessor", name: "price", static: !1, private: !1, access: { has: (t) => "price" in t, get: (t) => t.price, set: (t, l) => {
|
|
431
|
+
t.price = l;
|
|
432
|
+
} }, metadata: a }, ne, le), w(_, null, oe, { kind: "accessor", name: "disableAnimation", static: !1, private: !1, access: { has: (t) => "disableAnimation" in t, get: (t) => t.disableAnimation, set: (t, l) => {
|
|
433
|
+
t.disableAnimation = l;
|
|
434
|
+
} }, metadata: a }, ce, be), w(_, null, de, { kind: "accessor", name: "boarding", static: !1, private: !1, access: { has: (t) => "boarding" in t, get: (t) => t.boarding, set: (t, l) => {
|
|
435
|
+
t.boarding = l;
|
|
436
|
+
} }, metadata: a }, he, ge), w(_, null, me, { kind: "accessor", name: "loadingTrip", static: !1, private: !1, access: { has: (t) => "loadingTrip" in t, get: (t) => t.loadingTrip, set: (t, l) => {
|
|
437
|
+
t.loadingTrip = l;
|
|
438
|
+
} }, metadata: a }, pe, _e), w(_, null, ue, { kind: "accessor", name: "a11yFootpath", static: !1, private: !1, access: { has: (t) => "a11yFootpath" in t, get: (t) => t.a11yFootpath, set: (t, l) => {
|
|
439
|
+
t.a11yFootpath = l;
|
|
440
|
+
} }, metadata: a }, fe, ye), w(_, null, ve, { kind: "accessor", name: "loadingPrice", static: !1, private: !1, access: { has: (t) => "loadingPrice" in t, get: (t) => t.loadingPrice, set: (t, l) => {
|
|
441
|
+
t.loadingPrice = l;
|
|
442
|
+
} }, metadata: a }, xe, we), w(_, null, $e, { kind: "accessor", name: "cardActionLabel", static: !1, private: !1, access: { has: (t) => "cardActionLabel" in t, get: (t) => t.cardActionLabel, set: (t, l) => {
|
|
443
|
+
t.cardActionLabel = l;
|
|
444
|
+
} }, metadata: a }, Te, Ae), w(_, null, Ne, { kind: "accessor", name: "accessibilityExpanded", static: !1, private: !1, access: { has: (t) => "accessibilityExpanded" in t, get: (t) => t.accessibilityExpanded, set: (t, l) => {
|
|
445
|
+
t.accessibilityExpanded = l;
|
|
446
|
+
} }, metadata: a }, Ce, ke), w(_, null, ze, { kind: "accessor", name: "active", static: !1, private: !1, access: { has: (t) => "active" in t, get: (t) => t.active, set: (t, l) => {
|
|
447
|
+
t.active = l;
|
|
448
|
+
} }, metadata: a }, Ie, Le), w(_, null, Re, { kind: "setter", name: "now", static: !1, private: !1, access: { has: (t) => "now" in t, set: (t, l) => {
|
|
449
|
+
t.now = l;
|
|
450
|
+
} }, metadata: a }, null, r), w(null, i = { value: n }, e, { kind: "class", name: n.name, metadata: a }, null, s), n = i.value, a && Object.defineProperty(n, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: a });
|
|
451
|
+
})(), _.styles = Lt, d(n, s), n;
|
|
452
|
+
})();
|
|
453
|
+
export {
|
|
454
|
+
ia as SbbTimetableRowElement,
|
|
455
|
+
Ft as filterNotices,
|
|
456
|
+
Pt as getCus,
|
|
457
|
+
Ot as getHimIcon,
|
|
458
|
+
ae as handleNotices,
|
|
459
|
+
Rt as renderIconProduct,
|
|
460
|
+
Mt as renderStringProduct,
|
|
461
|
+
St as sortSituation
|
|
462
|
+
};
|
package/timetable-row.d.ts
CHANGED
package/timetable-row.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"timetable-row.d.ts","sourceRoot":"","sources":["../../src/elements-experimental/timetable-row.ts"],"names":[],"mappings":"AAAA,cAAc,kCAAkC,CAAC"}
|
|
1
|
+
{"version":3,"file":"timetable-row.d.ts","sourceRoot":"","sources":["../../src/elements-experimental/timetable-row.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,cAAc,kCAAkC,CAAC"}
|