@sbb-esta/lyne-elements-experimental 0.52.1 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/core/timetable.js +17 -17
- package/custom-elements.json +184 -0
- package/development/teaser-hero/teaser-hero.d.ts +26 -0
- package/development/teaser-hero/teaser-hero.d.ts.map +1 -0
- package/development/teaser-hero.d.ts +2 -0
- package/development/teaser-hero.d.ts.map +1 -0
- package/development/teaser-hero.js +181 -0
- package/development/teaser-paid/teaser-paid.d.ts +20 -0
- package/development/teaser-paid/teaser-paid.d.ts.map +1 -0
- package/development/teaser-paid.d.ts +2 -0
- package/development/teaser-paid.d.ts.map +1 -0
- package/development/teaser-paid.js +91 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/journey-summary.js +57 -57
- package/package.json +12 -2
- package/pearl-chain-time.js +29 -29
- package/pearl-chain.js +69 -69
- package/teaser-hero/teaser-hero.d.ts +26 -0
- package/teaser-hero/teaser-hero.d.ts.map +1 -0
- package/teaser-hero.d.ts +2 -0
- package/teaser-hero.d.ts.map +1 -0
- package/teaser-hero.js +51 -0
- package/teaser-paid/teaser-paid.d.ts +20 -0
- package/teaser-paid/teaser-paid.d.ts.map +1 -0
- package/teaser-paid.d.ts +2 -0
- package/teaser-paid.d.ts.map +1 -0
- package/teaser-paid.js +28 -0
- package/timetable-duration.js +15 -15
- package/timetable-row.js +189 -189
package/index.js
CHANGED
|
@@ -3,6 +3,8 @@ import { SbbPearlChainElement } from "./pearl-chain.js";
|
|
|
3
3
|
import { SbbPearlChainTimeElement } from "./pearl-chain-time.js";
|
|
4
4
|
import { SbbPearlChainVerticalElement } from "./pearl-chain-vertical.js";
|
|
5
5
|
import { SbbPearlChainVerticalItemElement } from "./pearl-chain-vertical-item.js";
|
|
6
|
+
import { SbbTeaserHeroElement } from "./teaser-hero.js";
|
|
7
|
+
import { SbbTeaserPaidElement } from "./teaser-paid.js";
|
|
6
8
|
import { SbbTimetableDurationElement } from "./timetable-duration.js";
|
|
7
9
|
import { SbbTimetableRowElement } from "./timetable-row.js";
|
|
8
10
|
|
|
@@ -11,6 +13,8 @@ globalThis.SbbPearlChainElement = SbbPearlChainElement;
|
|
|
11
13
|
globalThis.SbbPearlChainTimeElement = SbbPearlChainTimeElement;
|
|
12
14
|
globalThis.SbbPearlChainVerticalElement = SbbPearlChainVerticalElement;
|
|
13
15
|
globalThis.SbbPearlChainVerticalItemElement = SbbPearlChainVerticalItemElement;
|
|
16
|
+
globalThis.SbbTeaserHeroElement = SbbTeaserHeroElement;
|
|
17
|
+
globalThis.SbbTeaserPaidElement = SbbTeaserPaidElement;
|
|
14
18
|
globalThis.SbbTimetableDurationElement = SbbTimetableDurationElement;
|
|
15
19
|
globalThis.SbbTimetableRowElement = SbbTimetableRowElement;
|
|
16
20
|
|
package/journey-summary.js
CHANGED
|
@@ -1,79 +1,79 @@
|
|
|
1
|
-
import { SbbLanguageController as
|
|
2
|
-
import { defaultDateAdapter as
|
|
3
|
-
import { i18nTripDuration as
|
|
4
|
-
import { css as
|
|
5
|
-
import { property as b, customElement as
|
|
1
|
+
import { SbbLanguageController as c } from "@sbb-esta/lyne-elements/core/controllers.js";
|
|
2
|
+
import { defaultDateAdapter as u } from "@sbb-esta/lyne-elements/core/datetime.js";
|
|
3
|
+
import { i18nTripDuration as h } from "@sbb-esta/lyne-elements/core/i18n.js";
|
|
4
|
+
import { css as v, LitElement as _, html as s, nothing as n } from "lit";
|
|
5
|
+
import { property as b, customElement as f } from "lit/decorators.js";
|
|
6
6
|
import { durationToTime as g, removeTimezoneFromISOTimeString as $ } from "./core/datetime.js";
|
|
7
7
|
import "@sbb-esta/lyne-elements/divider.js";
|
|
8
8
|
import "@sbb-esta/lyne-elements/screen-reader-only.js";
|
|
9
9
|
import "@sbb-esta/lyne-elements/journey-header.js";
|
|
10
10
|
import "./pearl-chain-time.js";
|
|
11
11
|
import { i as j } from "./isValid-Df_caLp4.js";
|
|
12
|
-
import { f as
|
|
13
|
-
const
|
|
14
|
-
var
|
|
15
|
-
for (var i =
|
|
16
|
-
(p = e[m]) && (i = (
|
|
17
|
-
return
|
|
12
|
+
import { f as d } from "./format-qHhIvnY8.js";
|
|
13
|
+
const w = v`*,:before,:after{box-sizing:border-box}:host{display:block}.sbb-journey-summary{--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);color:var(--sbb-color-iron);display:flex;flex-direction:column}.sbb-journey-summary__via-block{display:flex}.sbb-journey-summary__vias{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;margin-block:0;padding-inline-start:var(--sbb-spacing-fixed-1x)}.sbb-journey-summary__date{margin-block-end:var(--sbb-spacing-fixed-2x)}.sbb-journey-summary__via{white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.sbb-journey-summary__divider{margin-block:var(--sbb-spacing-fixed-6x)}ul li{list-style:none;display:inline}`;
|
|
14
|
+
var x = Object.defineProperty, k = Object.getOwnPropertyDescriptor, l = (e, r, o, t) => {
|
|
15
|
+
for (var i = t > 1 ? void 0 : t ? k(r, o) : r, m = e.length - 1, p; m >= 0; m--)
|
|
16
|
+
(p = e[m]) && (i = (t ? p(r, o, i) : p(i)) || i);
|
|
17
|
+
return t && i && x(r, o, i), i;
|
|
18
18
|
};
|
|
19
|
-
let
|
|
19
|
+
let a = class extends _ {
|
|
20
20
|
constructor() {
|
|
21
|
-
super(...arguments), this.headerLevel = "3", this.
|
|
21
|
+
super(...arguments), this.headerLevel = "3", this._now = null, this._hasContentSlot = !1, this._language = new c(this);
|
|
22
22
|
}
|
|
23
23
|
set now(e) {
|
|
24
|
-
this.
|
|
24
|
+
this._now = u.getValidDateOrNull(u.deserialize(e));
|
|
25
25
|
}
|
|
26
26
|
get now() {
|
|
27
|
-
return this.
|
|
27
|
+
return this._now ?? /* @__PURE__ */ new Date();
|
|
28
28
|
}
|
|
29
29
|
connectedCallback() {
|
|
30
30
|
var e;
|
|
31
|
-
super.connectedCallback(), this.
|
|
31
|
+
super.connectedCallback(), this._hasContentSlot = !!((e = this.querySelector) != null && e.call(this, '[slot="content"]'));
|
|
32
32
|
}
|
|
33
33
|
/** renders the date of the journey or if it is the current or next day */
|
|
34
|
-
|
|
35
|
-
const
|
|
34
|
+
_renderJourneyStart(e, r) {
|
|
35
|
+
const o = u, t = r ? g(r, this._language.current) : null;
|
|
36
36
|
if (j(e))
|
|
37
37
|
return s`
|
|
38
|
-
<time datetime=${
|
|
39
|
-
${
|
|
40
|
-
>${
|
|
38
|
+
<time datetime=${d(e, "d") + " " + d(e, "M")}>
|
|
39
|
+
${o.format(e).replace(",", ".")}</time
|
|
40
|
+
>${r && r > 0 ? s`,<time>
|
|
41
41
|
<sbb-screen-reader-only>
|
|
42
|
-
${
|
|
42
|
+
${h[this._language.current]} ${t.long}
|
|
43
43
|
</sbb-screen-reader-only>
|
|
44
|
-
<span aria-hidden="true">${
|
|
45
|
-
</time>` :
|
|
44
|
+
<span aria-hidden="true">${t.short}</span>
|
|
45
|
+
</time>` : n}
|
|
46
46
|
`;
|
|
47
47
|
}
|
|
48
|
-
|
|
49
|
-
const
|
|
48
|
+
_renderJourneyVias(e) {
|
|
49
|
+
const r = e.slice(0, 5);
|
|
50
50
|
return s`
|
|
51
51
|
<div class="sbb-journey-summary__via-block">
|
|
52
52
|
<span class="sbb-journey-summary__via-text">Via</span>
|
|
53
|
-
<ul class="sbb-journey-summary__vias" role=${e.length <= 1 ? "presentation" :
|
|
54
|
-
${
|
|
55
|
-
(
|
|
56
|
-
${
|
|
53
|
+
<ul class="sbb-journey-summary__vias" role=${e.length <= 1 ? "presentation" : n}>
|
|
54
|
+
${r.map(
|
|
55
|
+
(o, t) => s`<li class="sbb-journey-summary__via">
|
|
56
|
+
${o}${t !== r.length - 1 && t < 4 ? s`<span>,</span>` : n}
|
|
57
57
|
</li>`
|
|
58
58
|
)}
|
|
59
59
|
</ul>
|
|
60
60
|
</div>
|
|
61
61
|
`;
|
|
62
62
|
}
|
|
63
|
-
|
|
64
|
-
const { vias:
|
|
63
|
+
_renderJourneyInformation(e) {
|
|
64
|
+
const { vias: r, duration: o, departureWalk: t, departure: i, arrivalWalk: m, arrival: p, legs: y } = e || {};
|
|
65
65
|
return s`
|
|
66
66
|
<div>
|
|
67
|
-
${
|
|
67
|
+
${r && r.length > 0 ? this._renderJourneyVias(r) : n}
|
|
68
68
|
<div class="sbb-journey-summary__date">
|
|
69
|
-
${this.
|
|
69
|
+
${this._renderJourneyStart($(i), o)}
|
|
70
70
|
</div>
|
|
71
71
|
<sbb-pearl-chain-time
|
|
72
72
|
.arrivalTime=${p}
|
|
73
73
|
.departureTime=${i}
|
|
74
|
-
.departureWalk=${
|
|
74
|
+
.departureWalk=${t}
|
|
75
75
|
.arrivalWalk=${m}
|
|
76
|
-
.legs=${
|
|
76
|
+
.legs=${y}
|
|
77
77
|
.disableAnimation=${this.disableAnimation}
|
|
78
78
|
.now=${this.now}
|
|
79
79
|
></sbb-pearl-chain-time>
|
|
@@ -81,50 +81,50 @@ let n = class extends f {
|
|
|
81
81
|
`;
|
|
82
82
|
}
|
|
83
83
|
render() {
|
|
84
|
-
const { origin: e, destination:
|
|
84
|
+
const { origin: e, destination: r } = this.trip || {};
|
|
85
85
|
return s`
|
|
86
86
|
<div class="sbb-journey-summary">
|
|
87
87
|
${e ? s`<sbb-journey-header
|
|
88
88
|
size="l"
|
|
89
|
-
.level=${this.headerLevel ||
|
|
89
|
+
.level=${this.headerLevel || n}
|
|
90
90
|
.origin=${e}
|
|
91
|
-
.destination=${
|
|
92
|
-
.roundTrip=${this.roundTrip ??
|
|
93
|
-
></sbb-journey-header>` :
|
|
94
|
-
${this.
|
|
91
|
+
.destination=${r}
|
|
92
|
+
.roundTrip=${this.roundTrip ?? n}
|
|
93
|
+
></sbb-journey-header>` : n}
|
|
94
|
+
${this._renderJourneyInformation(this.trip)}
|
|
95
95
|
${this.tripBack ? s`<div>
|
|
96
96
|
<sbb-divider class="sbb-journey-summary__divider"></sbb-divider>
|
|
97
|
-
${this.
|
|
98
|
-
</div>` :
|
|
99
|
-
${this.
|
|
97
|
+
${this._renderJourneyInformation(this.tripBack)}
|
|
98
|
+
</div>` : n}
|
|
99
|
+
${this._hasContentSlot ? s` <div class="sbb-journey-summary__slot">
|
|
100
100
|
<slot name="content"></slot>
|
|
101
|
-
</div>` :
|
|
101
|
+
</div>` : n}
|
|
102
102
|
</div>
|
|
103
103
|
`;
|
|
104
104
|
}
|
|
105
105
|
};
|
|
106
|
-
|
|
106
|
+
a.styles = w;
|
|
107
107
|
l([
|
|
108
108
|
b({ type: Object })
|
|
109
|
-
],
|
|
109
|
+
], a.prototype, "trip", 2);
|
|
110
110
|
l([
|
|
111
111
|
b({ attribute: "trip-back", type: Object })
|
|
112
|
-
],
|
|
112
|
+
], a.prototype, "tripBack", 2);
|
|
113
113
|
l([
|
|
114
114
|
b({ attribute: "round-trip", type: Boolean })
|
|
115
|
-
],
|
|
115
|
+
], a.prototype, "roundTrip", 2);
|
|
116
116
|
l([
|
|
117
117
|
b({ attribute: "header-level" })
|
|
118
|
-
],
|
|
118
|
+
], a.prototype, "headerLevel", 2);
|
|
119
119
|
l([
|
|
120
120
|
b({ attribute: "disable-animation", type: Boolean })
|
|
121
|
-
],
|
|
121
|
+
], a.prototype, "disableAnimation", 2);
|
|
122
122
|
l([
|
|
123
123
|
b()
|
|
124
|
-
],
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
],
|
|
124
|
+
], a.prototype, "now", 1);
|
|
125
|
+
a = l([
|
|
126
|
+
f("sbb-journey-summary")
|
|
127
|
+
], a);
|
|
128
128
|
export {
|
|
129
|
-
|
|
129
|
+
a as SbbJourneySummaryElement
|
|
130
130
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sbb-esta/lyne-elements-experimental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.53.0",
|
|
4
4
|
"description": "Lyne Design System",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"design system",
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
"type": "module",
|
|
12
12
|
"customElements": "custom-elements.json",
|
|
13
13
|
"peerDependencies": {
|
|
14
|
-
"@sbb-esta/lyne-elements": "0.
|
|
14
|
+
"@sbb-esta/lyne-elements": "0.53.0"
|
|
15
15
|
},
|
|
16
16
|
"dependencies": {
|
|
17
17
|
"lit": "^3.0.0"
|
|
@@ -71,6 +71,16 @@
|
|
|
71
71
|
"development": "./development/pearl-chain-vertical-item.js",
|
|
72
72
|
"default": "./pearl-chain-vertical-item.js"
|
|
73
73
|
},
|
|
74
|
+
"./teaser-hero.js": {
|
|
75
|
+
"types": "./development/teaser-hero.d.ts",
|
|
76
|
+
"development": "./development/teaser-hero.js",
|
|
77
|
+
"default": "./teaser-hero.js"
|
|
78
|
+
},
|
|
79
|
+
"./teaser-paid.js": {
|
|
80
|
+
"types": "./development/teaser-paid.d.ts",
|
|
81
|
+
"development": "./development/teaser-paid.js",
|
|
82
|
+
"default": "./teaser-paid.js"
|
|
83
|
+
},
|
|
74
84
|
"./timetable-duration.js": {
|
|
75
85
|
"types": "./development/timetable-duration.d.ts",
|
|
76
86
|
"development": "./development/timetable-duration.js",
|
package/pearl-chain-time.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import { SbbLanguageController as
|
|
1
|
+
import { SbbLanguageController as f } from "@sbb-esta/lyne-elements/core/controllers.js";
|
|
2
2
|
import { defaultDateAdapter as h } from "@sbb-esta/lyne-elements/core/datetime.js";
|
|
3
|
-
import { i18nDeparture as
|
|
4
|
-
import { css as
|
|
5
|
-
import { property as
|
|
3
|
+
import { i18nDeparture as d, i18nTransferProcedures as u, i18nArrival as _ } from "@sbb-esta/lyne-elements/core/i18n.js";
|
|
4
|
+
import { css as v, LitElement as y, html as p, nothing as m } from "lit";
|
|
5
|
+
import { property as n, customElement as x } from "lit/decorators.js";
|
|
6
6
|
import { removeTimezoneFromISOTimeString as c } from "./core/datetime.js";
|
|
7
7
|
import { getDepartureArrivalTimeAttribute as w, isRideLeg as $ } from "./core/timetable.js";
|
|
8
8
|
import "./pearl-chain.js";
|
|
9
|
-
import { f } from "./format-qHhIvnY8.js";
|
|
10
|
-
const T =
|
|
11
|
-
var z = Object.defineProperty, A = Object.getOwnPropertyDescriptor, i = (r, a, b,
|
|
12
|
-
for (var e =
|
|
13
|
-
(o = r[l]) && (e = (
|
|
14
|
-
return
|
|
9
|
+
import { f as g } from "./format-qHhIvnY8.js";
|
|
10
|
+
const T = v`*,:before,:after{box-sizing:border-box}:host{--sbb-pearl-chain-time-height: auto;display:block}@media (min-width: 37.5rem){:host{--sbb-pearl-chain-time-height: 1.5625rem}}@media (min-width: 52.5rem){:host{--sbb-pearl-chain-time-height: 1.75rem}}.sbb-pearl-chain__time{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:center;height:var(--sbb-pearl-chain-time-height)}.sbb-pearl-chain__time-walktime,.sbb-pearl-chain__time-transfer{--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);display:inline-flex;align-items:center}.sbb-pearl-chain__time-walktime--left{transform:translate(-.4375rem);margin-inline-end:calc(var(--sbb-spacing-fixed-2x) - .4375rem)}.sbb-pearl-chain__time-walktime--right{margin-inline-start:calc(var(--sbb-spacing-fixed-2x) - .25rem)}.sbb-pearl-chain__time-walktime-prime-symbol{float:right}.sbb-pearl-chain__time-transfer{gap:var(--sbb-spacing-fixed-1x)}.sbb-pearl-chain__time-transfer--departure{margin-inline-end:var(--sbb-spacing-fixed-2x)}.sbb-pearl-chain__time-transfer--arrival{margin-inline-start:calc(var(--sbb-spacing-fixed-2x) - .25rem)}.sbb-pearl-chain__time-chain{flex:1 1 auto;align-self:center;margin-inline:var(--sbb-spacing-fixed-3x)}.sbb-pearl-chain__time-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;color:var(--sbb-color-charcoal)}.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 z = Object.defineProperty, A = Object.getOwnPropertyDescriptor, i = (r, a, b, s) => {
|
|
12
|
+
for (var e = s > 1 ? void 0 : s ? A(a, b) : a, l = r.length - 1, o; l >= 0; l--)
|
|
13
|
+
(o = r[l]) && (e = (s ? o(a, b, e) : o(e)) || e);
|
|
14
|
+
return s && e && z(a, b, e), e;
|
|
15
15
|
};
|
|
16
|
-
let t = class extends
|
|
16
|
+
let t = class extends y {
|
|
17
17
|
constructor() {
|
|
18
|
-
super(...arguments), this.
|
|
18
|
+
super(...arguments), this._now = null, this._language = new f(this);
|
|
19
19
|
}
|
|
20
20
|
set now(r) {
|
|
21
|
-
this.
|
|
21
|
+
this._now = h.getValidDateOrNull(h.deserialize(r));
|
|
22
22
|
}
|
|
23
23
|
get now() {
|
|
24
|
-
return this.
|
|
24
|
+
return this._now ?? /* @__PURE__ */ new Date();
|
|
25
25
|
}
|
|
26
26
|
render() {
|
|
27
27
|
var l;
|
|
28
|
-
const r = this.departureTime ? c(this.departureTime) : void 0, a = this.arrivalTime ? c(this.arrivalTime) : void 0, { renderDepartureTimeAttribute: b, renderArrivalTimeAttribute:
|
|
28
|
+
const r = this.departureTime ? c(this.departureTime) : void 0, a = this.arrivalTime ? c(this.arrivalTime) : void 0, { renderDepartureTimeAttribute: b, renderArrivalTimeAttribute: s } = w(
|
|
29
29
|
this.legs,
|
|
30
30
|
this.departureWalk || 0,
|
|
31
31
|
this.arrivalWalk || 0,
|
|
32
|
-
this.
|
|
32
|
+
this._language.current
|
|
33
33
|
), e = (l = this.legs) == null ? void 0 : l.filter((o) => $(o));
|
|
34
34
|
return p`
|
|
35
35
|
<div class="sbb-pearl-chain__time">
|
|
36
36
|
${b()}
|
|
37
37
|
${r ? p`<time class="sbb-pearl-chain__time-time" datetime=${this.departureTime}>
|
|
38
38
|
<span class="sbb-screen-reader-only"
|
|
39
|
-
>${
|
|
39
|
+
>${d[this._language.current]}: </span
|
|
40
40
|
>
|
|
41
|
-
${
|
|
41
|
+
${g(r, "HH:mm")}
|
|
42
42
|
</time>` : m}
|
|
43
43
|
${(e == null ? void 0 : e.length) > 1 ? p`<span class="sbb-screen-reader-only" role="paragraph">
|
|
44
|
-
${(e == null ? void 0 : e.length) - 1} ${u[this.
|
|
44
|
+
${(e == null ? void 0 : e.length) - 1} ${u[this._language.current]}
|
|
45
45
|
</span>` : m}
|
|
46
46
|
<sbb-pearl-chain
|
|
47
47
|
class="sbb-pearl-chain__time-chain"
|
|
@@ -51,36 +51,36 @@ let t = class extends _ {
|
|
|
51
51
|
></sbb-pearl-chain>
|
|
52
52
|
${a ? p`<time class="sbb-pearl-chain__time-time" datetime=${this.arrivalTime}>
|
|
53
53
|
<span class="sbb-screen-reader-only"
|
|
54
|
-
>${
|
|
54
|
+
>${_[this._language.current]}: </span
|
|
55
55
|
>
|
|
56
|
-
${
|
|
56
|
+
${g(a, "HH:mm")}
|
|
57
57
|
</time>` : m}
|
|
58
|
-
${
|
|
58
|
+
${s()}
|
|
59
59
|
</div>
|
|
60
60
|
`;
|
|
61
61
|
}
|
|
62
62
|
};
|
|
63
63
|
t.styles = T;
|
|
64
64
|
i([
|
|
65
|
-
|
|
65
|
+
n({ type: Array })
|
|
66
66
|
], t.prototype, "legs", 2);
|
|
67
67
|
i([
|
|
68
|
-
|
|
68
|
+
n({ attribute: "departure-time" })
|
|
69
69
|
], t.prototype, "departureTime", 2);
|
|
70
70
|
i([
|
|
71
|
-
|
|
71
|
+
n({ attribute: "arrival-time" })
|
|
72
72
|
], t.prototype, "arrivalTime", 2);
|
|
73
73
|
i([
|
|
74
|
-
|
|
74
|
+
n({ attribute: "departure-walk", type: Number })
|
|
75
75
|
], t.prototype, "departureWalk", 2);
|
|
76
76
|
i([
|
|
77
|
-
|
|
77
|
+
n({ attribute: "arrival-walk", type: Number })
|
|
78
78
|
], t.prototype, "arrivalWalk", 2);
|
|
79
79
|
i([
|
|
80
|
-
|
|
80
|
+
n({ attribute: "disable-animation", type: Boolean })
|
|
81
81
|
], t.prototype, "disableAnimation", 2);
|
|
82
82
|
i([
|
|
83
|
-
|
|
83
|
+
n()
|
|
84
84
|
], t.prototype, "now", 1);
|
|
85
85
|
t = i([
|
|
86
86
|
x("sbb-pearl-chain-time")
|
package/pearl-chain.js
CHANGED
|
@@ -1,129 +1,129 @@
|
|
|
1
1
|
import { defaultDateAdapter as O } from "@sbb-esta/lyne-elements/core/datetime.js";
|
|
2
|
-
import { css as q, LitElement as K, html as
|
|
2
|
+
import { css as q, LitElement as K, html as v, nothing as H } from "lit";
|
|
3
3
|
import { property as y, customElement as Q } from "lit/decorators.js";
|
|
4
4
|
import { styleMap as J } from "lit/directives/style-map.js";
|
|
5
5
|
import { removeTimezoneFromISOTimeString as n } from "./core/datetime.js";
|
|
6
6
|
import { isRideLeg as U } from "./core/timetable.js";
|
|
7
7
|
import { d as m } from "./differenceInMinutes-CDpgJIgL.js";
|
|
8
8
|
import { t as f } from "./constants-ClrwyPF-.js";
|
|
9
|
-
function W(
|
|
10
|
-
const
|
|
11
|
-
return
|
|
9
|
+
function W(e, r) {
|
|
10
|
+
const a = f(e), t = f(r);
|
|
11
|
+
return a.getTime() > t.getTime();
|
|
12
12
|
}
|
|
13
|
-
function
|
|
14
|
-
const
|
|
15
|
-
return +
|
|
13
|
+
function R(e, r) {
|
|
14
|
+
const a = f(e), t = f(r);
|
|
15
|
+
return +a < +t;
|
|
16
16
|
}
|
|
17
17
|
const Z = q`*,:before,:after{box-sizing:border-box}:host{--sbb-pearl-chain-height: var(--sbb-border-width-2x);--sbb-pearl-chain-spacing-small: var(--sbb-spacing-fixed-1x);--sbb-pearl-chain-color: var(--sbb-pearl-chain-bullet-color);--sbb-pearl-chain-color-disruption: var(--sbb-pearl-chain-bullet-color-disruption);--sbb-pearl-chain-color-past: var(--sbb-pearl-chain-bullet-color-past);--sbb-pearl-chain-leg-width: 100%;--sbb-pearl-chain-bullet-size-start-end: .625rem;--sbb-pearl-chain-bullet-size-stop: .5rem;--sbb-pearl-chain-bullet-color: var(--sbb-color-charcoal);--sbb-pearl-chain-bullet-color-past: var(--sbb-color-metal);--sbb-pearl-chain-bullet-color-irrelevant: var(--sbb-color-metal);--sbb-pearl-chain-bullet-color-disruption: var(--sbb-color-red);--sbb-pearl-chain-bullet-border-width: var(--sbb-border-width-2x);--sbb-pearl-chain-bullet-animation-duration: 1.92s;--sbb-pearl-chain-bullet-animation-easing: ease-out;--sbb-pearl-chain-bullet-crossed-width: .88375rem;--sbb-pearl-chain-bullet-crossed-height: .21875rem;--sbb-pearl-chain-bullet-crossed-border-width: .09375rem;display:block}.sbb-pearl-chain{position:relative;display:flex;justify-content:space-between;flex-wrap:nowrap;color:var(--sbb-pearl-chain-color);width:100%;padding-block:calc((var(--sbb-pearl-chain-bullet-size-start-end) - var(--sbb-pearl-chain-height)) / 2);padding-inline-end:var(--sbb-pearl-chain-bullet-size-start-end)}.sbb-pearl-chain__bullet{background:var(--sbb-pearl-chain-bullet-color);color:var(--sbb-pearl-chain-bullet-color);border-color:var(--sbb-pearl-chain-bullet-color);border-radius:100%;min-height:var(--sbb-pearl-chain-bullet-size-start-end);min-width:var(--sbb-pearl-chain-bullet-size-start-end);height:var(--sbb-pearl-chain-bullet-size-start-end);width:var(--sbb-pearl-chain-bullet-size-start-end);content:"";position:absolute;background-color:currentcolor;inset-block-start:0;z-index:3}@media (forced-colors: active){.sbb-pearl-chain__bullet{--sbb-pearl-chain-bullet-color: CanvasText}}.sbb-pearl-chain__bullet:first-of-type{inset-inline-start:0}.sbb-pearl-chain__bullet:last-of-type{inset-inline-end:0}.sbb-pearl-chain__leg{flex-shrink:0;flex-grow:0;position:relative;height:var(--sbb-pearl-chain-height);border-inline-end:var(--sbb-pearl-chain-spacing-small) solid Canvas;background-color:currentcolor;width:var(--sbb-pearl-chain-leg-width);display:flex;align-items:center}@media (forced-colors: active){.sbb-pearl-chain__leg{background-color:CanvasText}.sbb-pearl-chain--past .sbb-pearl-chain__leg{background-color:GrayText}}.sbb-pearl-chain__leg:last-of-type{border:none}.sbb-pearl-chain__stop{background:var(--sbb-pearl-chain-bullet-color);color:var(--sbb-pearl-chain-bullet-color);border-color:var(--sbb-pearl-chain-bullet-color);border-radius:100%;min-height:var(--sbb-pearl-chain-bullet-size-stop);min-width:var(--sbb-pearl-chain-bullet-size-stop);height:var(--sbb-pearl-chain-bullet-size-stop);width:var(--sbb-pearl-chain-bullet-size-stop);border:var(--sbb-pearl-chain-bullet-border-width) solid currentcolor;background:Canvas;position:relative;z-index:2}@media (forced-colors: active){.sbb-pearl-chain__stop{--sbb-pearl-chain-bullet-color: CanvasText}}.sbb-pearl-chain__bullet--future{background:var(--sbb-pearl-chain-bullet-color);color:var(--sbb-pearl-chain-bullet-color);border-color:var(--sbb-pearl-chain-bullet-color);border-radius:100%}@media (forced-colors: active){.sbb-pearl-chain__bullet--future{--sbb-pearl-chain-bullet-color: CanvasText}}.sbb-pearl-chain__leg--past,.sbb-pearl-chain--past,.sbb-pearl-chain__leg--past:after,.sbb-pearl-chain__leg--progress:after,.sbb-pearl-chain__leg--progress .sbb-pearl-chain__stop,.sbb-pearl-chain--progress,.sbb-pearl-chain__bullet--past{--sbb-pearl-chain-bullet-color: var(--sbb-pearl-chain-bullet-color-past);color:var(--sbb-pearl-chain-color-past)}@media (forced-colors: active){.sbb-pearl-chain__leg--past,.sbb-pearl-chain--past,.sbb-pearl-chain__leg--past:after,.sbb-pearl-chain__leg--progress:after,.sbb-pearl-chain__leg--progress .sbb-pearl-chain__stop,.sbb-pearl-chain--progress,.sbb-pearl-chain__bullet--past{--sbb-pearl-chain-bullet-color: GrayText !important}}@media (forced-colors: active){.sbb-pearl-chain__leg--past,.sbb-pearl-chain--past,.sbb-pearl-chain__leg--past:after,.sbb-pearl-chain__leg--progress:after,.sbb-pearl-chain__leg--progress .sbb-pearl-chain__stop,.sbb-pearl-chain--progress,.sbb-pearl-chain__bullet--past{background-color:GrayText!important}}.sbb-pearl-chain__bullet--progress{--sbb-pearl-chain-bullet-color: var(--sbb-pearl-chain-bullet-color-past);background:var(--sbb-pearl-chain-bullet-color)}@media (forced-colors: active){.sbb-pearl-chain__bullet--progress{--sbb-pearl-chain-bullet-color: GrayText !important}}.sbb-pearl-chain__bullet--departure-disruption,.sbb-pearl-chain--arrival-disruption,.sbb-pearl-chain--departure-disruption,.sbb-pearl-chain__leg--disruption{--sbb-pearl-chain-bullet-color: var(--sbb-pearl-chain-bullet-color-disruption);color:var(--sbb-pearl-chain-color-disruption)}@media (forced-colors: active){.sbb-pearl-chain__bullet--departure-disruption,.sbb-pearl-chain--arrival-disruption,.sbb-pearl-chain--departure-disruption,.sbb-pearl-chain__leg--disruption{--sbb-pearl-chain-bullet-color: Highlight}}@media (forced-colors: active){.sbb-pearl-chain__bullet--departure-disruption,.sbb-pearl-chain--arrival-disruption,.sbb-pearl-chain--departure-disruption,.sbb-pearl-chain__leg--disruption{color:Highlight;background:Highlight}}.sbb-pearl-chain__leg--disruption .sbb-pearl-chain__stop{--sbb-pearl-chain-bullet-color: var(--sbb-pearl-chain-bullet-color-disruption)}@media (forced-colors: active){.sbb-pearl-chain__leg--disruption .sbb-pearl-chain__stop{--sbb-pearl-chain-bullet-color: Highlight}}.sbb-pearl-chain__leg--past .sbb-pearl-chain__stop{--sbb-pearl-chain-bullet-color: var(--sbb-pearl-chain-bullet-color-past)}@media (forced-colors: active){.sbb-pearl-chain__leg--past .sbb-pearl-chain__stop{--sbb-pearl-chain-bullet-color: GrayText !important}}.sbb-pearl-chain__leg--disruption:after{background-color:unset;background-image:linear-gradient(to right,currentcolor 0%,currentcolor 50%,Canvas 50%);background-repeat:repeat-x;background-size:calc(2 * var(--sbb-pearl-chain-spacing-small)) var(--sbb-pearl-chain-height);inset-inline-end:var(--sbb-pearl-chain-height)}@media (forced-colors: active){.sbb-pearl-chain__leg--disruption:after{background:unset;border-block-start:.0625rem dashed Highlight;transform:translateY(.0625rem)}}.sbb-pearl-chain__leg--skipped{color:var(--sbb-pearl-chain-color-disruption)}.sbb-pearl-chain__leg--skipped:after{background-color:unset;background-image:linear-gradient(to right,currentcolor 0%,currentcolor 50%,Canvas 50%);background-repeat:repeat-x;background-size:calc(2 * var(--sbb-pearl-chain-spacing-small)) var(--sbb-pearl-chain-height);inset-inline-end:var(--sbb-pearl-chain-height)}@media (forced-colors: active){.sbb-pearl-chain__leg--skipped:after{background:unset;border-block-start:.0625rem dashed Highlight;transform:translateY(.0625rem)}}.sbb-pearl-chain__stop--departure-skipped{min-height:var(--sbb-pearl-chain-bullet-size-stop);min-width:var(--sbb-pearl-chain-bullet-size-stop);height:var(--sbb-pearl-chain-bullet-size-stop);width:var(--sbb-pearl-chain-bullet-size-stop);border:var(--sbb-pearl-chain-bullet-border-width) solid currentcolor;background:Canvas}.sbb-pearl-chain__stop--departure-skipped:before{content:"";position:absolute;inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%) rotate(45deg);border-block-start:var(--sbb-pearl-chain-bullet-crossed-border-width) solid canvas;background:var(--sbb-pearl-chain-bullet-color-disruption);height:var(--sbb-pearl-chain-bullet-crossed-height);width:var(--sbb-pearl-chain-bullet-crossed-width)}@media (forced-colors: active){.sbb-pearl-chain__stop--departure-skipped:before{background:Highlight}}.sbb-pearl-chain--arrival-skipped,.sbb-pearl-chain--departure-skipped{min-height:var(--sbb-pearl-chain-bullet-size-start-end);min-width:var(--sbb-pearl-chain-bullet-size-start-end);height:var(--sbb-pearl-chain-bullet-size-start-end);width:var(--sbb-pearl-chain-bullet-size-start-end);border:var(--sbb-pearl-chain-bullet-border-width) solid currentcolor;background:Canvas}.sbb-pearl-chain--arrival-skipped:before,.sbb-pearl-chain--departure-skipped:before{content:"";position:absolute;inset-block-start:50%;inset-inline-start:50%;transform:translate(-50%,-50%) rotate(45deg);border-block-start:var(--sbb-pearl-chain-bullet-crossed-border-width) solid canvas;background:var(--sbb-pearl-chain-bullet-color-disruption);height:var(--sbb-pearl-chain-bullet-crossed-height);width:var(--sbb-pearl-chain-bullet-crossed-width)}@media (forced-colors: active){.sbb-pearl-chain--arrival-skipped:before,.sbb-pearl-chain--departure-skipped:before{background:Highlight}}.sbb-pearl-chain__leg:after{content:"";position:absolute;inset-block:0;inset-inline-start:0;background-color:currentcolor;border-radius:var(--sbb-pearl-chain-height);z-index:1}@media (forced-colors: active){.sbb-pearl-chain__leg:after{background-color:CanvasText}.sbb-pearl-chain--past .sbb-pearl-chain__leg:after{background-color:GrayText}}.sbb-pearl-chain__leg:last-of-type:after{inset-inline-end:calc(-1 * var(--sbb-pearl-chain-height))}.sbb-pearl-chain__leg--progress:after{background-color:var(--sbb-pearl-chain-color-past);width:var(--sbb-pearl-chain-leg-status)}.sbb-pearl-chain__position{background:var(--sbb-pearl-chain-bullet-color);color:var(--sbb-pearl-chain-bullet-color);border-color:var(--sbb-pearl-chain-bullet-color);border-radius:100%;min-height:var(--sbb-pearl-chain-bullet-size-start-end);min-width:var(--sbb-pearl-chain-bullet-size-start-end);height:var(--sbb-pearl-chain-bullet-size-start-end);width:var(--sbb-pearl-chain-bullet-size-start-end);--sbb-pearl-chain-bullet-color: var(--sbb-pearl-chain-bullet-color-disruption);animation:pearl-chain-bullet-position-pulse var(--sbb-pearl-chain-bullet-animation-duration) var(--sbb-pearl-chain-bullet-animation-easing) infinite;position:absolute;inset-block-start:-200%;z-index:4;inset-inline-start:var(--sbb-pearl-chain-status-position)}@media (forced-colors: active){.sbb-pearl-chain__position{--sbb-pearl-chain-bullet-color: CanvasText}}@media (forced-colors: active){.sbb-pearl-chain__position{--sbb-pearl-chain-bullet-color: Highlight}}@keyframes pearl-chain-bullet-position-pulse{0%{box-shadow:0 0 0 0 var(--sbb-pearl-chain-bullet-color-disruption)}25%{box-shadow:0 0 0 0 var(--sbb-pearl-chain-bullet-color-disruption)}50%{box-shadow:0 0 0 .1875rem var(--sbb-color-red-alpha-20)}to{box-shadow:0 0 0 0 var(--sbb-pearl-chain-bullet-color-disruption)}}.sbb-pearl-chain__position--no-animation{animation:unset}.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}`;
|
|
18
|
-
var L = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, k = (
|
|
19
|
-
for (var
|
|
20
|
-
(c =
|
|
21
|
-
return
|
|
18
|
+
var L = Object.defineProperty, rr = Object.getOwnPropertyDescriptor, k = (e, r, a, t) => {
|
|
19
|
+
for (var i = t > 1 ? void 0 : t ? rr(r, a) : r, o = e.length - 1, c; o >= 0; o--)
|
|
20
|
+
(c = e[o]) && (i = (t ? c(r, a, i) : c(i)) || i);
|
|
21
|
+
return t && i && L(r, a, i), i;
|
|
22
22
|
};
|
|
23
23
|
let d = class extends K {
|
|
24
24
|
constructor() {
|
|
25
|
-
super(...arguments), this.
|
|
25
|
+
super(...arguments), this._now = null;
|
|
26
26
|
}
|
|
27
|
-
set now(
|
|
28
|
-
this.
|
|
27
|
+
set now(e) {
|
|
28
|
+
this._now = O.getValidDateOrNull(O.deserialize(e));
|
|
29
29
|
}
|
|
30
30
|
get now() {
|
|
31
|
-
return this.
|
|
31
|
+
return this._now;
|
|
32
32
|
}
|
|
33
|
-
|
|
34
|
-
return
|
|
33
|
+
_getAllDuration(e) {
|
|
34
|
+
return e == null ? void 0 : e.reduce((r, a) => {
|
|
35
35
|
var o, c;
|
|
36
|
-
const
|
|
37
|
-
return
|
|
38
|
-
n(
|
|
39
|
-
n(
|
|
36
|
+
const t = n((o = a.arrival) == null ? void 0 : o.time), i = n((c = a.departure) == null ? void 0 : c.time);
|
|
37
|
+
return t && i ? r + m(
|
|
38
|
+
n(a.arrival.time),
|
|
39
|
+
n(a.departure.time)
|
|
40
40
|
) : r;
|
|
41
41
|
}, 0);
|
|
42
42
|
}
|
|
43
|
-
e
|
|
44
|
-
return
|
|
45
|
-
var
|
|
46
|
-
return (
|
|
43
|
+
_isAllCancelled(e) {
|
|
44
|
+
return e == null ? void 0 : e.every((r) => {
|
|
45
|
+
var a, t;
|
|
46
|
+
return (t = (a = r == null ? void 0 : r.serviceJourney) == null ? void 0 : a.serviceAlteration) == null ? void 0 : t.cancelled;
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
var
|
|
51
|
-
const
|
|
52
|
-
if (
|
|
49
|
+
_getRelativeDuration(e, r) {
|
|
50
|
+
var i, o;
|
|
51
|
+
const a = n((i = r.arrival) == null ? void 0 : i.time), t = n((o = r.departure) == null ? void 0 : o.time);
|
|
52
|
+
if (a && t) {
|
|
53
53
|
const c = m(
|
|
54
54
|
n(r.arrival.time),
|
|
55
55
|
n(r.departure.time)
|
|
56
|
-
),
|
|
57
|
-
return
|
|
56
|
+
), _ = this._getAllDuration(e);
|
|
57
|
+
return _ === 0 ? 100 : c / _ * 100;
|
|
58
58
|
}
|
|
59
59
|
return 0;
|
|
60
60
|
}
|
|
61
|
-
|
|
62
|
-
if (!r || !
|
|
61
|
+
_getProgress(e, r, a) {
|
|
62
|
+
if (!r || !a)
|
|
63
63
|
return 0;
|
|
64
|
-
const
|
|
65
|
-
return
|
|
64
|
+
const t = m(a, r), i = m(e, r);
|
|
65
|
+
return t && i / t * 100;
|
|
66
66
|
}
|
|
67
|
-
|
|
68
|
-
return
|
|
67
|
+
_getStatus(e, r, a) {
|
|
68
|
+
return a && r && R(a, e) && W(r, e) ? "progress" : r && R(r, e) ? "past" : "future";
|
|
69
69
|
}
|
|
70
|
-
|
|
71
|
-
const
|
|
72
|
-
if (
|
|
73
|
-
const
|
|
74
|
-
"--sbb-pearl-chain-status-position": `${
|
|
75
|
-
...
|
|
70
|
+
_renderPosition(e, r, a) {
|
|
71
|
+
const t = this._getProgress(e, r, a);
|
|
72
|
+
if (t < 0 && t > 100) return;
|
|
73
|
+
const i = () => ({
|
|
74
|
+
"--sbb-pearl-chain-status-position": `${t}%`,
|
|
75
|
+
...t >= 50 ? { transform: "translateX(-100%)" } : {}
|
|
76
76
|
}), o = this.disableAnimation ? "sbb-pearl-chain__position--no-animation" : "";
|
|
77
|
-
return
|
|
78
|
-
style=${J(
|
|
77
|
+
return v`<span
|
|
78
|
+
style=${J(i())}
|
|
79
79
|
class="sbb-pearl-chain__position ${o}"
|
|
80
80
|
></span>`;
|
|
81
81
|
}
|
|
82
82
|
render() {
|
|
83
|
-
var z, x,
|
|
84
|
-
const
|
|
85
|
-
var
|
|
86
|
-
return r && ((b = (
|
|
83
|
+
var z, x, S, C;
|
|
84
|
+
const e = this.now ?? /* @__PURE__ */ new Date(), r = (z = this.legs) == null ? void 0 : z.filter((l) => U(l)), a = (r == null ? void 0 : r.length) && n((S = (x = r[0]) == null ? void 0 : x.departure) == null ? void 0 : S.time), t = (r == null ? void 0 : r.length) && n((C = r[(r == null ? void 0 : r.length) - 1].arrival) == null ? void 0 : C.time), i = (() => {
|
|
85
|
+
var l, b, s, p;
|
|
86
|
+
return r && ((b = (l = r[0]) == null ? void 0 : l.serviceJourney) != null && b.stopPoints) && ((p = (s = r[0]) == null ? void 0 : s.serviceJourney) == null ? void 0 : p.stopPoints[0].stopStatus) === "NOT_SERVICED" ? "sbb-pearl-chain--departure-skipped" : "";
|
|
87
87
|
})(), o = (() => {
|
|
88
|
-
var
|
|
89
|
-
const
|
|
88
|
+
var s;
|
|
89
|
+
const l = r && r[r.length - 1], b = l && ((s = l.serviceJourney) == null ? void 0 : s.stopPoints);
|
|
90
90
|
return b && b[b.length - 1].stopStatus === "NOT_SERVICED" ? "sbb-pearl-chain--arrival-skipped" : "";
|
|
91
91
|
})(), c = (() => {
|
|
92
|
-
var
|
|
93
|
-
return r && ((
|
|
94
|
-
})(),
|
|
95
|
-
var
|
|
96
|
-
return r && ((
|
|
97
|
-
})(),
|
|
98
|
-
return this.
|
|
92
|
+
var l, b, s;
|
|
93
|
+
return r && ((s = (b = (l = r[0]) == null ? void 0 : l.serviceJourney) == null ? void 0 : b.serviceAlteration) != null && s.cancelled) ? "sbb-pearl-chain--departure-disruption" : "";
|
|
94
|
+
})(), _ = (() => {
|
|
95
|
+
var l, b, s;
|
|
96
|
+
return r && ((s = (b = (l = r[r.length - 1]) == null ? void 0 : l.serviceJourney) == null ? void 0 : b.serviceAlteration) != null && s.cancelled) ? "sbb-pearl-chain--arrival-disruption" : "";
|
|
97
|
+
})(), I = r && a && t && !c ? "sbb-pearl-chain__bullet--" + this._getStatus(e, t, a) : "", G = r && t && !_ ? "sbb-pearl-chain__bullet--" + this._getStatus(e, t) : "";
|
|
98
|
+
return this._isAllCancelled(r) ? v`
|
|
99
99
|
<div class="sbb-pearl-chain">
|
|
100
100
|
<span class="sbb-pearl-chain__bullet sbb-pearl-chain--departure-disruption"></span>
|
|
101
101
|
<div class="sbb-pearl-chain__leg sbb-pearl-chain__leg--disruption"></div>
|
|
102
102
|
<span class="sbb-pearl-chain__bullet sbb-pearl-chain--departure-disruption"></span>
|
|
103
103
|
</div>
|
|
104
|
-
` :
|
|
104
|
+
` : v`
|
|
105
105
|
<div class="sbb-pearl-chain">
|
|
106
106
|
<span
|
|
107
|
-
class="sbb-pearl-chain__bullet ${
|
|
107
|
+
class="sbb-pearl-chain__bullet ${I} ${i} ${c}"
|
|
108
108
|
></span>
|
|
109
|
-
${r == null ? void 0 : r.map((
|
|
110
|
-
var $, N,
|
|
111
|
-
const { stopPoints:
|
|
112
|
-
return
|
|
109
|
+
${r == null ? void 0 : r.map((l, b) => {
|
|
110
|
+
var D, P, $, N, A, E;
|
|
111
|
+
const { stopPoints: s, serviceAlteration: p } = (l == null ? void 0 : l.serviceJourney) || {}, V = this._getRelativeDuration(r, l), h = n((D = l.departure) == null ? void 0 : D.time), u = n((P = l.arrival) == null ? void 0 : P.time), B = s && (($ = s[s.length - 1]) == null ? void 0 : $.stopStatus) === "NOT_SERVICED", j = s && ((N = s[s.length - 1]) == null ? void 0 : N.stopStatus) === "PLANNED", T = s && ((A = s[0]) == null ? void 0 : A.stopStatus) === "NOT_SERVICED", w = b > 0 && r[b - 1].serviceJourney.stopPoints, M = w && ((E = w[w.length - 1]) == null ? void 0 : E.stopStatus) === "NOT_SERVICED", Y = B || T && j ? "sbb-pearl-chain__leg--skipped" : "", F = T || M ? "sbb-pearl-chain__stop--departure-skipped" : "", g = p != null && p.cancelled ? "sbb-pearl-chain__leg--disruption" : "", X = !g && this._getStatus(e, h, u) && "sbb-pearl-chain__leg--" + this._getStatus(e, u, h);
|
|
112
|
+
return v` <div
|
|
113
113
|
class="sbb-pearl-chain__leg ${X} ${g} ${Y}"
|
|
114
114
|
style=${J({
|
|
115
115
|
"--sbb-pearl-chain-leg-width": `${V}%`,
|
|
116
|
-
...this.
|
|
117
|
-
"--sbb-pearl-chain-leg-status": `${this.
|
|
116
|
+
...this._getStatus(e, u, h) === "progress" && !g ? {
|
|
117
|
+
"--sbb-pearl-chain-leg-status": `${this._getProgress(e, h, u)}%`
|
|
118
118
|
} : {}
|
|
119
119
|
})}
|
|
120
120
|
>
|
|
121
|
-
${b > 0 && b < r.length ?
|
|
122
|
-
${this.
|
|
121
|
+
${b > 0 && b < r.length ? v`<span class="sbb-pearl-chain__stop ${F}"></span>` : H}
|
|
122
|
+
${this._getStatus(e, u, h) === "progress" && !g ? this._renderPosition(e, h, u) : H}
|
|
123
123
|
</div>`;
|
|
124
124
|
})}
|
|
125
125
|
<span
|
|
126
|
-
class="sbb-pearl-chain__bullet ${
|
|
126
|
+
class="sbb-pearl-chain__bullet ${G} ${o} ${_}"
|
|
127
127
|
></span>
|
|
128
128
|
</div>
|
|
129
129
|
`;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { SbbLinkBaseElement } from '@sbb-esta/lyne-elements/core/base-elements.js';
|
|
2
|
+
import { CSSResultGroup, TemplateResult } from 'lit';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* It displays an image and an action call within a panel.
|
|
6
|
+
*
|
|
7
|
+
* @slot - Use the unnamed slot to add text content to the panel
|
|
8
|
+
* @slot link-content - Link content of the panel
|
|
9
|
+
* @slot image - The background image that can be a `sbb-image`
|
|
10
|
+
*/
|
|
11
|
+
export declare class SbbTeaserHeroElement extends SbbLinkBaseElement {
|
|
12
|
+
static styles: CSSResultGroup;
|
|
13
|
+
/** Panel link text. */
|
|
14
|
+
linkContent?: string;
|
|
15
|
+
/** Image src will be passed to `sbb-image`. */
|
|
16
|
+
imageSrc?: string;
|
|
17
|
+
/** Image alt text will be passed to `sbb-image`. */
|
|
18
|
+
imageAlt?: string;
|
|
19
|
+
protected renderTemplate(): TemplateResult;
|
|
20
|
+
}
|
|
21
|
+
declare global {
|
|
22
|
+
interface HTMLElementTagNameMap {
|
|
23
|
+
'sbb-teaser-hero': SbbTeaserHeroElement;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
//# sourceMappingURL=teaser-hero.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"teaser-hero.d.ts","sourceRoot":"","sources":["../../../src/elements-experimental/teaser-hero/teaser-hero.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,+CAA+C,CAAC;AACnF,OAAO,EAAE,KAAK,cAAc,EAAW,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAMxE,OAAO,kCAAkC,CAAC;AAC1C,OAAO,mDAAmD,CAAC;AAE3D;;;;;;GAMG;AACH,qBACa,oBAAqB,SAAQ,kBAAkB;IAC1D,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD,uBAAuB;IACyB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErE,+CAA+C;IACF,QAAQ,CAAC,EAAE,MAAM,CAAC;IAE/D,oDAAoD;IACP,QAAQ,CAAC,EAAE,MAAM,CAAC;cAE5C,cAAc,IAAI,cAAc;CAyBpD;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,iBAAiB,EAAE,oBAAoB,CAAC;KACzC;CACF"}
|
package/teaser-hero.d.ts
ADDED