@sbb-esta/lyne-elements-experimental 0.0.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/README.md +55 -0
- package/constants-ClrwyPF-.js +12 -0
- package/core/datetime/date-helper.d.ts +27 -0
- package/core/datetime/date-helper.d.ts.map +1 -0
- package/core/datetime.d.ts +2 -0
- package/core/datetime.d.ts.map +1 -0
- package/core/datetime.js +193 -0
- package/core/timetable/access-leg-helper.d.ts +26 -0
- package/core/timetable/access-leg-helper.d.ts.map +1 -0
- package/core/timetable/timetable-helper.d.ts +9 -0
- package/core/timetable/timetable-helper.d.ts.map +1 -0
- package/core/timetable/timetable-properties.d.ts +308 -0
- package/core/timetable/timetable-properties.d.ts.map +1 -0
- package/core/timetable.d.ts +4 -0
- package/core/timetable.d.ts.map +1 -0
- package/core/timetable.js +123 -0
- package/custom-elements.json +1606 -0
- package/development/constants-D72r1E-c.js +22 -0
- package/development/core/datetime/date-helper.d.ts +27 -0
- package/development/core/datetime/date-helper.d.ts.map +1 -0
- package/development/core/datetime.d.ts +2 -0
- package/development/core/datetime.d.ts.map +1 -0
- package/development/core/datetime.js +290 -0
- package/development/core/timetable/access-leg-helper.d.ts +26 -0
- package/development/core/timetable/access-leg-helper.d.ts.map +1 -0
- package/development/core/timetable/timetable-helper.d.ts +9 -0
- package/development/core/timetable/timetable-helper.d.ts.map +1 -0
- package/development/core/timetable/timetable-properties.d.ts +308 -0
- package/development/core/timetable/timetable-properties.d.ts.map +1 -0
- package/development/core/timetable.d.ts +4 -0
- package/development/core/timetable.d.ts.map +1 -0
- package/development/core/timetable.js +164 -0
- package/development/differenceInMinutes-D47vcSvy.js +21 -0
- package/development/format-BOXfsJCN.js +1373 -0
- package/development/isValid-YTpbhEHG.js +52 -0
- package/development/journey-summary/journey-summary.d.ts +57 -0
- package/development/journey-summary/journey-summary.d.ts.map +1 -0
- package/development/journey-summary.d.ts +2 -0
- package/development/journey-summary.d.ts.map +1 -0
- package/development/journey-summary.js +209 -0
- package/development/pearl-chain/pearl-chain.d.ts +41 -0
- package/development/pearl-chain/pearl-chain.d.ts.map +1 -0
- package/development/pearl-chain/pearl-chain.sample-data.d.ts +121 -0
- package/development/pearl-chain/pearl-chain.sample-data.d.ts.map +1 -0
- package/development/pearl-chain-time/pearl-chain-time.d.ts +44 -0
- package/development/pearl-chain-time/pearl-chain-time.d.ts.map +1 -0
- package/development/pearl-chain-time.d.ts +2 -0
- package/development/pearl-chain-time.d.ts.map +1 -0
- package/development/pearl-chain-time.js +208 -0
- package/development/pearl-chain-vertical/pearl-chain-vertical.d.ts +17 -0
- package/development/pearl-chain-vertical/pearl-chain-vertical.d.ts.map +1 -0
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.d.ts +35 -0
- package/development/pearl-chain-vertical-item/pearl-chain-vertical-item.d.ts.map +1 -0
- package/development/pearl-chain-vertical-item.d.ts +2 -0
- package/development/pearl-chain-vertical-item.d.ts.map +1 -0
- package/development/pearl-chain-vertical-item.js +368 -0
- package/development/pearl-chain-vertical.d.ts +2 -0
- package/development/pearl-chain-vertical.d.ts.map +1 -0
- package/development/pearl-chain-vertical.js +58 -0
- package/development/pearl-chain.d.ts +2 -0
- package/development/pearl-chain.d.ts.map +1 -0
- package/development/pearl-chain.js +597 -0
- package/development/timetable-duration/timetable-duration.d.ts +23 -0
- package/development/timetable-duration/timetable-duration.d.ts.map +1 -0
- package/development/timetable-duration/timetable-duration.sample-data.d.ts +6 -0
- package/development/timetable-duration/timetable-duration.sample-data.d.ts.map +1 -0
- package/development/timetable-duration.d.ts +2 -0
- package/development/timetable-duration.d.ts.map +1 -0
- package/development/timetable-duration.js +106 -0
- package/development/timetable-row/timetable-row.d.ts +79 -0
- package/development/timetable-row/timetable-row.d.ts.map +1 -0
- package/development/timetable-row/timetable-row.sample-data.d.ts +24 -0
- package/development/timetable-row/timetable-row.sample-data.d.ts.map +1 -0
- package/development/timetable-row.d.ts +2 -0
- package/development/timetable-row.d.ts.map +1 -0
- package/development/timetable-row.js +687 -0
- package/differenceInMinutes-CDpgJIgL.js +19 -0
- package/format-qHhIvnY8.js +1164 -0
- package/index.d.ts +19 -0
- package/index.js +17 -0
- package/isValid-Df_caLp4.js +40 -0
- package/journey-summary/journey-summary.d.ts +57 -0
- package/journey-summary/journey-summary.d.ts.map +1 -0
- package/journey-summary.d.ts +2 -0
- package/journey-summary.d.ts.map +1 -0
- package/journey-summary.js +130 -0
- package/package.json +79 -2
- package/pearl-chain/pearl-chain.d.ts +41 -0
- package/pearl-chain/pearl-chain.d.ts.map +1 -0
- package/pearl-chain/pearl-chain.sample-data.d.ts +121 -0
- package/pearl-chain/pearl-chain.sample-data.d.ts.map +1 -0
- package/pearl-chain-time/pearl-chain-time.d.ts +44 -0
- package/pearl-chain-time/pearl-chain-time.d.ts.map +1 -0
- package/pearl-chain-time.d.ts +2 -0
- package/pearl-chain-time.d.ts.map +1 -0
- package/pearl-chain-time.js +90 -0
- package/pearl-chain-vertical/pearl-chain-vertical.d.ts +17 -0
- package/pearl-chain-vertical/pearl-chain-vertical.d.ts.map +1 -0
- package/pearl-chain-vertical-item/pearl-chain-vertical-item.d.ts +35 -0
- package/pearl-chain-vertical-item/pearl-chain-vertical-item.d.ts.map +1 -0
- package/pearl-chain-vertical-item.d.ts +2 -0
- package/pearl-chain-vertical-item.d.ts.map +1 -0
- package/pearl-chain-vertical-item.js +48 -0
- package/pearl-chain-vertical.d.ts +2 -0
- package/pearl-chain-vertical.d.ts.map +1 -0
- package/pearl-chain-vertical.js +24 -0
- package/pearl-chain.d.ts +2 -0
- package/pearl-chain.d.ts.map +1 -0
- package/pearl-chain.js +147 -0
- package/timetable-duration/timetable-duration.d.ts +23 -0
- package/timetable-duration/timetable-duration.d.ts.map +1 -0
- package/timetable-duration/timetable-duration.sample-data.d.ts +6 -0
- package/timetable-duration/timetable-duration.sample-data.d.ts.map +1 -0
- package/timetable-duration.d.ts +2 -0
- package/timetable-duration.d.ts.map +1 -0
- package/timetable-duration.js +37 -0
- package/timetable-row/timetable-row.d.ts +79 -0
- package/timetable-row/timetable-row.d.ts.map +1 -0
- package/timetable-row/timetable-row.sample-data.d.ts +24 -0
- package/timetable-row/timetable-row.sample-data.d.ts.map +1 -0
- package/timetable-row.d.ts +2 -0
- package/timetable-row.d.ts.map +1 -0
- package/timetable-row.js +386 -0
package/index.d.ts
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { SbbJourneySummaryElement } from "./journey-summary.js";
|
|
2
|
+
import { SbbPearlChainElement } from "./pearl-chain.js";
|
|
3
|
+
import { SbbPearlChainTimeElement } from "./pearl-chain-time.js";
|
|
4
|
+
import { SbbPearlChainVerticalElement } from "./pearl-chain-vertical.js";
|
|
5
|
+
import { SbbPearlChainVerticalItemElement } from "./pearl-chain-vertical-item.js";
|
|
6
|
+
import { SbbTimetableDurationElement } from "./timetable-duration.js";
|
|
7
|
+
import { SbbTimetableRowElement } from "./timetable-row.js";
|
|
8
|
+
|
|
9
|
+
declare global {
|
|
10
|
+
var SbbJourneySummaryElement: SbbJourneySummaryElement;
|
|
11
|
+
var SbbPearlChainElement: SbbPearlChainElement;
|
|
12
|
+
var SbbPearlChainTimeElement: SbbPearlChainTimeElement;
|
|
13
|
+
var SbbPearlChainVerticalElement: SbbPearlChainVerticalElement;
|
|
14
|
+
var SbbPearlChainVerticalItemElement: SbbPearlChainVerticalItemElement;
|
|
15
|
+
var SbbTimetableDurationElement: SbbTimetableDurationElement;
|
|
16
|
+
var SbbTimetableRowElement: SbbTimetableRowElement;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export {}
|
package/index.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { SbbJourneySummaryElement } from "./journey-summary.js";
|
|
2
|
+
import { SbbPearlChainElement } from "./pearl-chain.js";
|
|
3
|
+
import { SbbPearlChainTimeElement } from "./pearl-chain-time.js";
|
|
4
|
+
import { SbbPearlChainVerticalElement } from "./pearl-chain-vertical.js";
|
|
5
|
+
import { SbbPearlChainVerticalItemElement } from "./pearl-chain-vertical-item.js";
|
|
6
|
+
import { SbbTimetableDurationElement } from "./timetable-duration.js";
|
|
7
|
+
import { SbbTimetableRowElement } from "./timetable-row.js";
|
|
8
|
+
|
|
9
|
+
globalThis.SbbJourneySummaryElement = SbbJourneySummaryElement;
|
|
10
|
+
globalThis.SbbPearlChainElement = SbbPearlChainElement;
|
|
11
|
+
globalThis.SbbPearlChainTimeElement = SbbPearlChainTimeElement;
|
|
12
|
+
globalThis.SbbPearlChainVerticalElement = SbbPearlChainVerticalElement;
|
|
13
|
+
globalThis.SbbPearlChainVerticalItemElement = SbbPearlChainVerticalItemElement;
|
|
14
|
+
globalThis.SbbTimetableDurationElement = SbbTimetableDurationElement;
|
|
15
|
+
globalThis.SbbTimetableRowElement = SbbTimetableRowElement;
|
|
16
|
+
|
|
17
|
+
export {}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { t as s, c as f } from "./constants-ClrwyPF-.js";
|
|
2
|
+
function D(e, t) {
|
|
3
|
+
return e instanceof Date ? new e.constructor(t) : new Date(t);
|
|
4
|
+
}
|
|
5
|
+
function r(e) {
|
|
6
|
+
const t = s(e);
|
|
7
|
+
return t.setHours(0, 0, 0, 0), t;
|
|
8
|
+
}
|
|
9
|
+
function a(e) {
|
|
10
|
+
const t = s(e), n = new Date(
|
|
11
|
+
Date.UTC(
|
|
12
|
+
t.getFullYear(),
|
|
13
|
+
t.getMonth(),
|
|
14
|
+
t.getDate(),
|
|
15
|
+
t.getHours(),
|
|
16
|
+
t.getMinutes(),
|
|
17
|
+
t.getSeconds(),
|
|
18
|
+
t.getMilliseconds()
|
|
19
|
+
)
|
|
20
|
+
);
|
|
21
|
+
return n.setUTCFullYear(t.getFullYear()), +e - +n;
|
|
22
|
+
}
|
|
23
|
+
function g(e, t) {
|
|
24
|
+
const n = r(e), o = r(t), c = +n - a(n), i = +o - a(o);
|
|
25
|
+
return Math.round((c - i) / f);
|
|
26
|
+
}
|
|
27
|
+
function u(e) {
|
|
28
|
+
return e instanceof Date || typeof e == "object" && Object.prototype.toString.call(e) === "[object Date]";
|
|
29
|
+
}
|
|
30
|
+
function m(e) {
|
|
31
|
+
if (!u(e) && typeof e != "number")
|
|
32
|
+
return !1;
|
|
33
|
+
const t = s(e);
|
|
34
|
+
return !isNaN(Number(t));
|
|
35
|
+
}
|
|
36
|
+
export {
|
|
37
|
+
D as c,
|
|
38
|
+
g as d,
|
|
39
|
+
m as i
|
|
40
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { SbbDateLike } from '@sbb-esta/lyne-elements/core/interfaces/types';
|
|
2
|
+
import { SbbTitleLevel } from '@sbb-esta/lyne-elements/title.js';
|
|
3
|
+
import { CSSResultGroup, TemplateResult, LitElement } from 'lit';
|
|
4
|
+
import { Leg } from '../core/timetable.js';
|
|
5
|
+
|
|
6
|
+
export interface InterfaceSbbJourneySummaryAttributes {
|
|
7
|
+
legs: Leg[];
|
|
8
|
+
vias?: string[];
|
|
9
|
+
origin: string;
|
|
10
|
+
destination: string;
|
|
11
|
+
arrivalWalk?: number;
|
|
12
|
+
departure: string;
|
|
13
|
+
arrival: string;
|
|
14
|
+
departureWalk?: number;
|
|
15
|
+
duration?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* It displays journey's information.
|
|
19
|
+
*
|
|
20
|
+
* @slot content - Use this slot to add `sbb-button`s or other interactive elements.
|
|
21
|
+
*/
|
|
22
|
+
export declare class SbbJourneySummaryElement extends LitElement {
|
|
23
|
+
static styles: CSSResultGroup;
|
|
24
|
+
/** The trip prop */
|
|
25
|
+
trip: InterfaceSbbJourneySummaryAttributes;
|
|
26
|
+
/** The tripBack prop */
|
|
27
|
+
tripBack?: InterfaceSbbJourneySummaryAttributes;
|
|
28
|
+
/**
|
|
29
|
+
* The RoundTrip prop. This prop controls if one or two arrows are displayed in the header.
|
|
30
|
+
*/
|
|
31
|
+
roundTrip?: boolean;
|
|
32
|
+
/** Heading level of the journey header element (e.g. h1-h6). */
|
|
33
|
+
headerLevel: SbbTitleLevel;
|
|
34
|
+
/**
|
|
35
|
+
* Per default, the current location has a pulsating animation. You can
|
|
36
|
+
* disable the animation with this property.
|
|
37
|
+
*/
|
|
38
|
+
disableAnimation?: boolean;
|
|
39
|
+
/** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */
|
|
40
|
+
set now(value: SbbDateLike | undefined);
|
|
41
|
+
get now(): Date;
|
|
42
|
+
private _now;
|
|
43
|
+
private _hasContentSlot;
|
|
44
|
+
private _language;
|
|
45
|
+
connectedCallback(): void;
|
|
46
|
+
/** renders the date of the journey or if it is the current or next day */
|
|
47
|
+
private _renderJourneyStart;
|
|
48
|
+
private _renderJourneyVias;
|
|
49
|
+
private _renderJourneyInformation;
|
|
50
|
+
protected render(): TemplateResult;
|
|
51
|
+
}
|
|
52
|
+
declare global {
|
|
53
|
+
interface HTMLElementTagNameMap {
|
|
54
|
+
'sbb-journey-summary': SbbJourneySummaryElement;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=journey-summary.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey-summary.d.ts","sourceRoot":"","sources":["../../../src/elements-experimental/journey-summary/journey-summary.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AACjF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAEtE,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAQ,UAAU,EAAW,MAAM,KAAK,CAAC;AAIhD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,sBAAsB,CAAC;AAIhD,OAAO,oCAAoC,CAAC;AAC5C,OAAO,+CAA+C,CAAC;AACvD,OAAO,2CAA2C,CAAC;AACnD,OAAO,wBAAwB,CAAC;AAEhC,MAAM,WAAW,oCAAoC;IACnD,IAAI,EAAE,GAAG,EAAE,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,WAAW,EAAE,MAAM,CAAC;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;;GAIG;AACH,qBACa,wBAAyB,SAAQ,UAAU;IACtD,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD,qBAAqB;IACc,IAAI,EAAG,oCAAoC,CAAC;IAE/E,yBAAyB;IAElB,QAAQ,CAAC,EAAE,oCAAoC,CAAC;IAEvD;;OAEG;IAC0D,SAAS,CAAC,EAAE,OAAO,CAAC;IAEjF,gEAAgE;IAChB,WAAW,EAAE,aAAa,CAAO;IAEjF;;;OAGG;IACiE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE/F,2HAA2H;IAC3H,IACW,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAE5C;IACD,IAAW,GAAG,IAAI,IAAI,CAErB;IACD,OAAO,CAAC,IAAI,CAAqB;IAEjC,OAAO,CAAC,eAAe,CAAkB;IACzC,OAAO,CAAC,SAAS,CAAmC;IAEpC,iBAAiB,IAAI,IAAI;IAKzC,2EAA2E;IAC3E,OAAO,CAAC,mBAAmB;IAwB3B,OAAO,CAAC,kBAAkB;IAmB1B,OAAO,CAAC,yBAAyB;cAsBd,MAAM,IAAI,cAAc;CA4B5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,qBAAqB,EAAE,wBAAwB,CAAC;KACjD;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"journey-summary.d.ts","sourceRoot":"","sources":["../../src/elements-experimental/journey-summary.ts"],"names":[],"mappings":"AAAA,cAAc,sCAAsC,CAAC"}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { SbbLanguageController as y } from "@sbb-esta/lyne-elements/core/controllers.js";
|
|
2
|
+
import { defaultDateAdapter as d } from "@sbb-esta/lyne-elements/core/datetime.js";
|
|
3
|
+
import { i18nTripDuration as v } from "@sbb-esta/lyne-elements/core/i18n.js";
|
|
4
|
+
import { css as h, LitElement as f, html as s, nothing as o } from "lit";
|
|
5
|
+
import { property as b, customElement as _ } from "lit/decorators.js";
|
|
6
|
+
import { durationToTime as g, removeTimezoneFromISOTimeString as $ } from "./core/datetime.js";
|
|
7
|
+
import "@sbb-esta/lyne-elements/divider.js";
|
|
8
|
+
import "@sbb-esta/lyne-elements/screen-reader-only.js";
|
|
9
|
+
import "@sbb-esta/lyne-elements/journey-header.js";
|
|
10
|
+
import "./pearl-chain-time.js";
|
|
11
|
+
import { i as j } from "./isValid-Df_caLp4.js";
|
|
12
|
+
import { f as u } from "./format-qHhIvnY8.js";
|
|
13
|
+
const x = h`*,: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 w = Object.defineProperty, k = Object.getOwnPropertyDescriptor, l = (e, t, a, r) => {
|
|
15
|
+
for (var i = r > 1 ? void 0 : r ? k(t, a) : t, m = e.length - 1, p; m >= 0; m--)
|
|
16
|
+
(p = e[m]) && (i = (r ? p(t, a, i) : p(i)) || i);
|
|
17
|
+
return r && i && w(t, a, i), i;
|
|
18
|
+
};
|
|
19
|
+
let n = class extends f {
|
|
20
|
+
constructor() {
|
|
21
|
+
super(...arguments), this.headerLevel = "3", this.a = null, this.b = !1, this.c = new y(this);
|
|
22
|
+
}
|
|
23
|
+
set now(e) {
|
|
24
|
+
this.a = d.getValidDateOrNull(d.deserialize(e));
|
|
25
|
+
}
|
|
26
|
+
get now() {
|
|
27
|
+
return this.a ?? /* @__PURE__ */ new Date();
|
|
28
|
+
}
|
|
29
|
+
connectedCallback() {
|
|
30
|
+
var e;
|
|
31
|
+
super.connectedCallback(), this.b = !!((e = this.querySelector) != null && e.call(this, '[slot="content"]'));
|
|
32
|
+
}
|
|
33
|
+
/** renders the date of the journey or if it is the current or next day */
|
|
34
|
+
e(e, t) {
|
|
35
|
+
const a = d, r = t ? g(t, this.c.current) : null;
|
|
36
|
+
if (j(e))
|
|
37
|
+
return s`
|
|
38
|
+
<time datetime=${u(e, "d") + " " + u(e, "M")}>
|
|
39
|
+
${a.format(e).replace(",", ".")}</time
|
|
40
|
+
>${t && t > 0 ? s`,<time>
|
|
41
|
+
<sbb-screen-reader-only>
|
|
42
|
+
${v[this.c.current]} ${r.long}
|
|
43
|
+
</sbb-screen-reader-only>
|
|
44
|
+
<span aria-hidden="true">${r.short}</span>
|
|
45
|
+
</time>` : o}
|
|
46
|
+
`;
|
|
47
|
+
}
|
|
48
|
+
f(e) {
|
|
49
|
+
const t = e.slice(0, 5);
|
|
50
|
+
return s`
|
|
51
|
+
<div class="sbb-journey-summary__via-block">
|
|
52
|
+
<span class="sbb-journey-summary__via-text">Via</span>
|
|
53
|
+
<ul class="sbb-journey-summary__vias" role=${e.length <= 1 ? "presentation" : o}>
|
|
54
|
+
${t.map(
|
|
55
|
+
(a, r) => s`<li class="sbb-journey-summary__via">
|
|
56
|
+
${a}${r !== t.length - 1 && r < 4 ? s`<span>,</span>` : o}
|
|
57
|
+
</li>`
|
|
58
|
+
)}
|
|
59
|
+
</ul>
|
|
60
|
+
</div>
|
|
61
|
+
`;
|
|
62
|
+
}
|
|
63
|
+
d(e) {
|
|
64
|
+
const { vias: t, duration: a, departureWalk: r, departure: i, arrivalWalk: m, arrival: p, legs: c } = e || {};
|
|
65
|
+
return s`
|
|
66
|
+
<div>
|
|
67
|
+
${t && t.length > 0 ? this.f(t) : o}
|
|
68
|
+
<div class="sbb-journey-summary__date">
|
|
69
|
+
${this.e($(i), a)}
|
|
70
|
+
</div>
|
|
71
|
+
<sbb-pearl-chain-time
|
|
72
|
+
.arrivalTime=${p}
|
|
73
|
+
.departureTime=${i}
|
|
74
|
+
.departureWalk=${r}
|
|
75
|
+
.arrivalWalk=${m}
|
|
76
|
+
.legs=${c}
|
|
77
|
+
.disableAnimation=${this.disableAnimation}
|
|
78
|
+
.now=${this.now}
|
|
79
|
+
></sbb-pearl-chain-time>
|
|
80
|
+
</div>
|
|
81
|
+
`;
|
|
82
|
+
}
|
|
83
|
+
render() {
|
|
84
|
+
const { origin: e, destination: t } = this.trip || {};
|
|
85
|
+
return s`
|
|
86
|
+
<div class="sbb-journey-summary">
|
|
87
|
+
${e ? s`<sbb-journey-header
|
|
88
|
+
size="l"
|
|
89
|
+
.level=${this.headerLevel || o}
|
|
90
|
+
.origin=${e}
|
|
91
|
+
.destination=${t}
|
|
92
|
+
.roundTrip=${this.roundTrip ?? o}
|
|
93
|
+
></sbb-journey-header>` : o}
|
|
94
|
+
${this.d(this.trip)}
|
|
95
|
+
${this.tripBack ? s`<div>
|
|
96
|
+
<sbb-divider class="sbb-journey-summary__divider"></sbb-divider>
|
|
97
|
+
${this.d(this.tripBack)}
|
|
98
|
+
</div>` : o}
|
|
99
|
+
${this.b ? s` <div class="sbb-journey-summary__slot">
|
|
100
|
+
<slot name="content"></slot>
|
|
101
|
+
</div>` : o}
|
|
102
|
+
</div>
|
|
103
|
+
`;
|
|
104
|
+
}
|
|
105
|
+
};
|
|
106
|
+
n.styles = x;
|
|
107
|
+
l([
|
|
108
|
+
b({ type: Object })
|
|
109
|
+
], n.prototype, "trip", 2);
|
|
110
|
+
l([
|
|
111
|
+
b({ attribute: "trip-back", type: Object })
|
|
112
|
+
], n.prototype, "tripBack", 2);
|
|
113
|
+
l([
|
|
114
|
+
b({ attribute: "round-trip", type: Boolean })
|
|
115
|
+
], n.prototype, "roundTrip", 2);
|
|
116
|
+
l([
|
|
117
|
+
b({ attribute: "header-level" })
|
|
118
|
+
], n.prototype, "headerLevel", 2);
|
|
119
|
+
l([
|
|
120
|
+
b({ attribute: "disable-animation", type: Boolean })
|
|
121
|
+
], n.prototype, "disableAnimation", 2);
|
|
122
|
+
l([
|
|
123
|
+
b()
|
|
124
|
+
], n.prototype, "now", 1);
|
|
125
|
+
n = l([
|
|
126
|
+
_("sbb-journey-summary")
|
|
127
|
+
], n);
|
|
128
|
+
export {
|
|
129
|
+
n as SbbJourneySummaryElement
|
|
130
|
+
};
|
package/package.json
CHANGED
|
@@ -1,8 +1,85 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sbb-esta/lyne-elements-experimental",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.52.1",
|
|
4
4
|
"description": "Lyne Design System",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"design system",
|
|
7
|
+
"web components",
|
|
8
|
+
"lit",
|
|
9
|
+
"storybook"
|
|
10
|
+
],
|
|
11
|
+
"type": "module",
|
|
12
|
+
"customElements": "custom-elements.json",
|
|
13
|
+
"peerDependencies": {
|
|
14
|
+
"@sbb-esta/lyne-elements": "0.52.1"
|
|
15
|
+
},
|
|
16
|
+
"dependencies": {
|
|
17
|
+
"lit": "^3.0.0"
|
|
18
|
+
},
|
|
5
19
|
"publishConfig": {
|
|
6
20
|
"access": "public"
|
|
21
|
+
},
|
|
22
|
+
"author": "Lyne Team",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"repository": {
|
|
25
|
+
"type": "git",
|
|
26
|
+
"url": "https://github.com/sbb-design-systems/lyne-components.git"
|
|
27
|
+
},
|
|
28
|
+
"bugs": {
|
|
29
|
+
"url": "https://github.com/sbb-design-systems/lyne-components/issues"
|
|
30
|
+
},
|
|
31
|
+
"exports": {
|
|
32
|
+
".": {
|
|
33
|
+
"types": "./index.d.ts",
|
|
34
|
+
"default": "./index.js"
|
|
35
|
+
},
|
|
36
|
+
"./package.json": {
|
|
37
|
+
"default": "./package.json"
|
|
38
|
+
},
|
|
39
|
+
"./core/datetime.js": {
|
|
40
|
+
"types": "./development/core/datetime.d.ts",
|
|
41
|
+
"development": "./development/core/datetime.js",
|
|
42
|
+
"default": "./core/datetime.js"
|
|
43
|
+
},
|
|
44
|
+
"./core/timetable.js": {
|
|
45
|
+
"types": "./development/core/timetable.d.ts",
|
|
46
|
+
"development": "./development/core/timetable.js",
|
|
47
|
+
"default": "./core/timetable.js"
|
|
48
|
+
},
|
|
49
|
+
"./journey-summary.js": {
|
|
50
|
+
"types": "./development/journey-summary.d.ts",
|
|
51
|
+
"development": "./development/journey-summary.js",
|
|
52
|
+
"default": "./journey-summary.js"
|
|
53
|
+
},
|
|
54
|
+
"./pearl-chain.js": {
|
|
55
|
+
"types": "./development/pearl-chain.d.ts",
|
|
56
|
+
"development": "./development/pearl-chain.js",
|
|
57
|
+
"default": "./pearl-chain.js"
|
|
58
|
+
},
|
|
59
|
+
"./pearl-chain-time.js": {
|
|
60
|
+
"types": "./development/pearl-chain-time.d.ts",
|
|
61
|
+
"development": "./development/pearl-chain-time.js",
|
|
62
|
+
"default": "./pearl-chain-time.js"
|
|
63
|
+
},
|
|
64
|
+
"./pearl-chain-vertical.js": {
|
|
65
|
+
"types": "./development/pearl-chain-vertical.d.ts",
|
|
66
|
+
"development": "./development/pearl-chain-vertical.js",
|
|
67
|
+
"default": "./pearl-chain-vertical.js"
|
|
68
|
+
},
|
|
69
|
+
"./pearl-chain-vertical-item.js": {
|
|
70
|
+
"types": "./development/pearl-chain-vertical-item.d.ts",
|
|
71
|
+
"development": "./development/pearl-chain-vertical-item.js",
|
|
72
|
+
"default": "./pearl-chain-vertical-item.js"
|
|
73
|
+
},
|
|
74
|
+
"./timetable-duration.js": {
|
|
75
|
+
"types": "./development/timetable-duration.d.ts",
|
|
76
|
+
"development": "./development/timetable-duration.js",
|
|
77
|
+
"default": "./timetable-duration.js"
|
|
78
|
+
},
|
|
79
|
+
"./timetable-row.js": {
|
|
80
|
+
"types": "./development/timetable-row.d.ts",
|
|
81
|
+
"development": "./development/timetable-row.js",
|
|
82
|
+
"default": "./timetable-row.js"
|
|
83
|
+
}
|
|
7
84
|
}
|
|
8
|
-
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { SbbDateLike } from '@sbb-esta/lyne-elements/core/interfaces/types';
|
|
2
|
+
import { CSSResultGroup, TemplateResult, LitElement } from 'lit';
|
|
3
|
+
import { Leg, PtRideLeg } from '../core/timetable.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* It visually displays journey information.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SbbPearlChainElement extends LitElement {
|
|
9
|
+
static styles: CSSResultGroup;
|
|
10
|
+
/**
|
|
11
|
+
* Define the legs of the pearl-chain.
|
|
12
|
+
* Format:
|
|
13
|
+
* `{"legs": [{"duration": 25}, ...]}`
|
|
14
|
+
* `duration` in minutes. Duration of the leg is relative
|
|
15
|
+
* to the total travel time. Example: departure 16:30, change at 16:40,
|
|
16
|
+
* arrival at 17:00. So the change should have a duration of 33.33%.
|
|
17
|
+
*/
|
|
18
|
+
legs?: (Leg | PtRideLeg)[];
|
|
19
|
+
/**
|
|
20
|
+
* Per default, the current location has a pulsating animation. You can
|
|
21
|
+
* disable the animation with this property.
|
|
22
|
+
*/
|
|
23
|
+
disableAnimation?: boolean;
|
|
24
|
+
/** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */
|
|
25
|
+
set now(value: SbbDateLike | undefined);
|
|
26
|
+
get now(): Date | null;
|
|
27
|
+
private _now;
|
|
28
|
+
private _getAllDuration;
|
|
29
|
+
private _isAllCancelled;
|
|
30
|
+
private _getRelativeDuration;
|
|
31
|
+
private _getProgress;
|
|
32
|
+
private _getStatus;
|
|
33
|
+
private _renderPosition;
|
|
34
|
+
protected render(): TemplateResult;
|
|
35
|
+
}
|
|
36
|
+
declare global {
|
|
37
|
+
interface HTMLElementTagNameMap {
|
|
38
|
+
'sbb-pearl-chain': SbbPearlChainElement;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=pearl-chain.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pearl-chain.d.ts","sourceRoot":"","sources":["../../../src/elements-experimental/pearl-chain/pearl-chain.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEjF,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAQ,UAAU,EAAW,MAAM,KAAK,CAAC;AAKhD,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAO3D;;GAEG;AACH,qBACa,oBAAqB,SAAQ,UAAU;IAClD,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD;;;;;;;OAOG;IAC+B,IAAI,CAAC,EAAE,CAAC,GAAG,GAAG,SAAS,CAAC,EAAE,CAAC;IAE7D;;;OAGG;IACiE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE/F,2HAA2H;IAC3H,IACW,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAE5C;IACD,IAAW,GAAG,IAAI,IAAI,GAAG,IAAI,CAE5B;IACD,OAAO,CAAC,IAAI,CAAqB;IAEjC,OAAO,CAAC,eAAe;IAiBvB,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,oBAAoB;IAmB5B,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,UAAU;IASlB,OAAO,CAAC,eAAe;cAmBJ,MAAM,IAAI,cAAc;CAgI5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,iBAAiB,EAAE,oBAAoB,CAAC;KACzC;CACF"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
export declare const futureLeg: any;
|
|
2
|
+
export declare const extendedLeg: {
|
|
3
|
+
__typename: string;
|
|
4
|
+
arrival: {
|
|
5
|
+
time: string;
|
|
6
|
+
};
|
|
7
|
+
departure: {
|
|
8
|
+
time: string;
|
|
9
|
+
};
|
|
10
|
+
serviceJourney: {
|
|
11
|
+
notices: {
|
|
12
|
+
name: string;
|
|
13
|
+
text: {
|
|
14
|
+
template: string;
|
|
15
|
+
};
|
|
16
|
+
}[];
|
|
17
|
+
serviceAlteration: {
|
|
18
|
+
cancelled: boolean;
|
|
19
|
+
delayText: string;
|
|
20
|
+
reachable: boolean;
|
|
21
|
+
unplannedStopPointsText: string;
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
export declare const longFutureLeg: {
|
|
26
|
+
__typename: string;
|
|
27
|
+
arrival: {
|
|
28
|
+
time: string;
|
|
29
|
+
};
|
|
30
|
+
departure: {
|
|
31
|
+
time: string;
|
|
32
|
+
};
|
|
33
|
+
serviceJourney: {
|
|
34
|
+
serviceAlteration: {
|
|
35
|
+
cancelled: boolean;
|
|
36
|
+
delayText: string;
|
|
37
|
+
reachable: boolean;
|
|
38
|
+
unplannedStopPointsText: string;
|
|
39
|
+
};
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
export declare const cancelledLeg: any;
|
|
43
|
+
export declare const progressLeg: any;
|
|
44
|
+
export declare const pastLeg: any;
|
|
45
|
+
export declare const delayedLeg: {
|
|
46
|
+
__typename: string;
|
|
47
|
+
arrival: {
|
|
48
|
+
time: string;
|
|
49
|
+
};
|
|
50
|
+
departure: {
|
|
51
|
+
time: string;
|
|
52
|
+
};
|
|
53
|
+
serviceJourney: {
|
|
54
|
+
serviceAlteration: {
|
|
55
|
+
delay: boolean;
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
};
|
|
59
|
+
export declare const notReachableLeg: {
|
|
60
|
+
__typename: string;
|
|
61
|
+
arrival: {
|
|
62
|
+
time: string;
|
|
63
|
+
};
|
|
64
|
+
departure: {
|
|
65
|
+
time: string;
|
|
66
|
+
};
|
|
67
|
+
serviceJourney: {
|
|
68
|
+
serviceAlteration: {
|
|
69
|
+
reachable: boolean;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
export declare const unplannedStopLeg: {
|
|
74
|
+
__typename: string;
|
|
75
|
+
arrival: {
|
|
76
|
+
time: string;
|
|
77
|
+
};
|
|
78
|
+
departure: {
|
|
79
|
+
time: string;
|
|
80
|
+
};
|
|
81
|
+
serviceJourney: {
|
|
82
|
+
serviceAlteration: {
|
|
83
|
+
unplannedStopPointsText: string;
|
|
84
|
+
};
|
|
85
|
+
};
|
|
86
|
+
};
|
|
87
|
+
export declare const redirectedOnDepartureLeg: {
|
|
88
|
+
__typename: string;
|
|
89
|
+
arrival: {
|
|
90
|
+
time: string;
|
|
91
|
+
};
|
|
92
|
+
departure: {
|
|
93
|
+
time: string;
|
|
94
|
+
};
|
|
95
|
+
serviceJourney: {
|
|
96
|
+
stopPoints: {
|
|
97
|
+
stopStatus: string;
|
|
98
|
+
}[];
|
|
99
|
+
serviceAlteration: {
|
|
100
|
+
redirectedText: string;
|
|
101
|
+
};
|
|
102
|
+
};
|
|
103
|
+
};
|
|
104
|
+
export declare const redirectedOnArrivalLeg: {
|
|
105
|
+
__typename: string;
|
|
106
|
+
arrival: {
|
|
107
|
+
time: string;
|
|
108
|
+
};
|
|
109
|
+
departure: {
|
|
110
|
+
time: string;
|
|
111
|
+
};
|
|
112
|
+
serviceJourney: {
|
|
113
|
+
stopPoints: {
|
|
114
|
+
stopStatus: string;
|
|
115
|
+
}[];
|
|
116
|
+
serviceAlteration: {
|
|
117
|
+
redirectedText: string;
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
};
|
|
121
|
+
//# sourceMappingURL=pearl-chain.sample-data.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pearl-chain.sample-data.d.ts","sourceRoot":"","sources":["../../../src/elements-experimental/pearl-chain/pearl-chain.sample-data.ts"],"names":[],"mappings":"AAyBA,eAAO,MAAM,SAAS,EAAE,GAKvB,CAAC;AAEF,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;CAQvB,CAAC;AAEF,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;CAKzB,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,GAK1B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,GAKzB,CAAC;AAEF,eAAO,MAAM,OAAO,EAAE,GAKrB,CAAC;AAEF,eAAO,MAAM,UAAU;;;;;;;;;;;;;CAKtB,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;;;;;;;;;CAK3B,CAAC;AAEF,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;CAK5B,CAAC;AAEF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;CAQpC,CAAC;AAEF,eAAO,MAAM,sBAAsB;;;;;;;;;;;;;;;;CAKlC,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { SbbDateLike } from '@sbb-esta/lyne-elements/core/interfaces/types';
|
|
2
|
+
import { CSSResultGroup, TemplateResult, LitElement } from 'lit';
|
|
3
|
+
import { Leg, PtRideLeg } from '../core/timetable.js';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Combined with `sbb-pearl-chain`, it displays walk time information.
|
|
7
|
+
*/
|
|
8
|
+
export declare class SbbPearlChainTimeElement extends LitElement {
|
|
9
|
+
static styles: CSSResultGroup;
|
|
10
|
+
/**
|
|
11
|
+
* define the legs of the pearl-chain.
|
|
12
|
+
* Format:
|
|
13
|
+
* `{"legs": [{"duration": 25}, ...]}`
|
|
14
|
+
* `duration` in minutes. Duration of the leg is relative
|
|
15
|
+
* to the total travel time. Example: departure 16:30, change at 16:40,
|
|
16
|
+
* arrival at 17:00. So the change should have a duration of 33.33%.
|
|
17
|
+
*/
|
|
18
|
+
legs: (Leg | PtRideLeg)[];
|
|
19
|
+
/** Prop to render the departure time - will be formatted as "H:mm" */
|
|
20
|
+
departureTime?: string;
|
|
21
|
+
/** Prop to render the arrival time - will be formatted as "H:mm" */
|
|
22
|
+
arrivalTime?: string;
|
|
23
|
+
/** Optional prop to render the walk time (in minutes) before departure */
|
|
24
|
+
departureWalk?: number;
|
|
25
|
+
/** Optional prop to render the walk time (in minutes) after arrival */
|
|
26
|
+
arrivalWalk?: number;
|
|
27
|
+
/**
|
|
28
|
+
* Per default, the current location has a pulsating animation. You can
|
|
29
|
+
* disable the animation with this property.
|
|
30
|
+
*/
|
|
31
|
+
disableAnimation?: boolean;
|
|
32
|
+
/** A configured date which acts as the current date instead of the real current date. Recommended for testing purposes. */
|
|
33
|
+
set now(value: SbbDateLike | undefined);
|
|
34
|
+
get now(): Date;
|
|
35
|
+
private _now;
|
|
36
|
+
private _language;
|
|
37
|
+
protected render(): TemplateResult;
|
|
38
|
+
}
|
|
39
|
+
declare global {
|
|
40
|
+
interface HTMLElementTagNameMap {
|
|
41
|
+
'sbb-pearl-chain-time': SbbPearlChainTimeElement;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=pearl-chain-time.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pearl-chain-time.d.ts","sourceRoot":"","sources":["../../../src/elements-experimental/pearl-chain-time/pearl-chain-time.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,+CAA+C,CAAC;AAEjF,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1D,OAAO,EAAQ,UAAU,EAAW,MAAM,KAAK,CAAC;AAIhD,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAK3D,OAAO,mBAAmB,CAAC;AAE3B;;GAEG;AACH,qBACa,wBAAyB,SAAQ,UAAU;IACtD,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD;;;;;;;OAOG;IAC+B,IAAI,EAAG,CAAC,GAAG,GAAG,SAAS,CAAC,EAAE,CAAC;IAE7D,sEAAsE;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;IAEzE,oEAAoE;IACpB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErE,0EAA0E;IACV,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvF,uEAAuE;IACT,WAAW,CAAC,EAAE,MAAM,CAAC;IAEnF;;;OAGG;IACiE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAE/F,2HAA2H;IAC3H,IACW,GAAG,CAAC,KAAK,EAAE,WAAW,GAAG,SAAS,EAE5C;IACD,IAAW,GAAG,IAAI,IAAI,CAErB;IACD,OAAO,CAAC,IAAI,CAAqB;IAEjC,OAAO,CAAC,SAAS,CAAmC;cAEjC,MAAM,IAAI,cAAc;CAmD5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,sBAAsB,EAAE,wBAAwB,CAAC;KAClD;CACF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pearl-chain-time.d.ts","sourceRoot":"","sources":["../../src/elements-experimental/pearl-chain-time.ts"],"names":[],"mappings":"AAAA,cAAc,wCAAwC,CAAC"}
|