@sbb-esta/lyne-elements-experimental 3.0.1 → 3.2.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.
Files changed (64) hide show
  1. package/custom-elements.json +908 -567
  2. package/development/seat-reservation/common/mapper/icon-mapper.d.ts.map +1 -1
  3. package/development/seat-reservation/common/mapper/icon-mapper.js +1 -3
  4. package/development/seat-reservation/common/mapper/mapper.d.ts +4 -3
  5. package/development/seat-reservation/common/mapper/mapper.d.ts.map +1 -1
  6. package/development/seat-reservation/common/mapper/mapper.js +6 -4
  7. package/development/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts.map +1 -1
  8. package/development/seat-reservation/common/mapper/seat-reservation-sample-data.js +4989 -4
  9. package/development/seat-reservation/common/svgs.d.ts +0 -1
  10. package/development/seat-reservation/common/svgs.d.ts.map +1 -1
  11. package/development/seat-reservation/common/svgs.js +1 -3
  12. package/development/seat-reservation/common/translations/i18n.js +194 -194
  13. package/development/seat-reservation/common/types.d.ts +10 -0
  14. package/development/seat-reservation/common/types.d.ts.map +1 -1
  15. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +38 -12
  16. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -1
  17. package/development/seat-reservation/seat-reservation/seat-reservation-base-element.js +252 -122
  18. package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts +28 -13
  19. package/development/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
  20. package/development/seat-reservation/seat-reservation/seat-reservation.component.js +481 -262
  21. package/development/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +17 -10
  22. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.d.ts.map +1 -1
  23. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +1 -6
  24. package/development/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +36 -18
  25. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +3 -1
  26. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -1
  27. package/development/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +26 -4
  28. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts.map +1 -1
  29. package/development/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +86 -54
  30. package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts +1 -16
  31. package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -1
  32. package/development/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +10 -164
  33. package/package.json +3 -3
  34. package/seat-reservation/common/mapper/icon-mapper.d.ts.map +1 -1
  35. package/seat-reservation/common/mapper/icon-mapper.js +0 -2
  36. package/seat-reservation/common/mapper/mapper.d.ts +4 -3
  37. package/seat-reservation/common/mapper/mapper.d.ts.map +1 -1
  38. package/seat-reservation/common/mapper/mapper.js +16 -14
  39. package/seat-reservation/common/mapper/seat-reservation-sample-data.d.ts.map +1 -1
  40. package/seat-reservation/common/mapper/seat-reservation-sample-data.js +4988 -3
  41. package/seat-reservation/common/svgs.d.ts +0 -1
  42. package/seat-reservation/common/svgs.d.ts.map +1 -1
  43. package/seat-reservation/common/svgs.js +4 -11
  44. package/seat-reservation/common/translations/i18n.js +197 -197
  45. package/seat-reservation/common/types.d.ts +10 -0
  46. package/seat-reservation/common/types.d.ts.map +1 -1
  47. package/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts +38 -12
  48. package/seat-reservation/seat-reservation/seat-reservation-base-element.d.ts.map +1 -1
  49. package/seat-reservation/seat-reservation/seat-reservation-base-element.js +208 -134
  50. package/seat-reservation/seat-reservation/seat-reservation.component.d.ts +28 -13
  51. package/seat-reservation/seat-reservation/seat-reservation.component.d.ts.map +1 -1
  52. package/seat-reservation/seat-reservation/seat-reservation.component.js +290 -298
  53. package/seat-reservation/seat-reservation-area/seat-reservation-area.component.js +22 -22
  54. package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.d.ts.map +1 -1
  55. package/seat-reservation/seat-reservation-graphic/seat-reservation-assets.js +0 -5
  56. package/seat-reservation/seat-reservation-graphic/seat-reservation-graphic.component.js +37 -37
  57. package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts +3 -1
  58. package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.d.ts.map +1 -1
  59. package/seat-reservation/seat-reservation-navigation-coach/seat-reservation-navigation-coach.component.js +69 -58
  60. package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.d.ts.map +1 -1
  61. package/seat-reservation/seat-reservation-place-control/seat-reservation-place-control.component.js +28 -27
  62. package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts +1 -16
  63. package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.d.ts.map +1 -1
  64. package/seat-reservation/seat-reservation-scoped/seat-reservation-scoped.component.js +14 -101
@@ -1,36 +1,26 @@
1
- var U = (r) => {
2
- throw TypeError(r);
3
- };
4
- var q = (r, o, l) => o.has(r) || U("Cannot " + l);
5
- var R = (r, o, l) => (q(r, o, "read from private field"), l ? l.call(r) : o.get(r)), x = (r, o, l) => o.has(r) ? U("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(r) : o.set(r, l), b = (r, o, l, u) => (q(r, o, "write to private field"), u ? u.call(r, l) : o.set(r, l), l);
6
- import { __runInitializers as p, __esDecorate as S } from "tslib";
7
- import { SbbLanguageController as K } from "@sbb-esta/lyne-elements/core/controllers.js";
8
- import { forceType as P } from "@sbb-esta/lyne-elements/core/decorators.js";
9
- import { css as X, html as d, nothing as A } from "lit";
10
- import { customElement as J, property as y } from "lit/decorators.js";
11
- import { classMap as Y } from "lit/directives/class-map.js";
12
- import { styleMap as Q } from "lit/directives/style-map.js";
13
- import { getI18nSeatReservation as _ } from "../common.js";
14
- import { SeatReservationBaseElement as Z } from "./seat-reservation-base-element.js";
1
+ import { __esDecorate as $, __runInitializers as x } from "tslib";
2
+ import { SbbLanguageController as A } from "@sbb-esta/lyne-elements/core/controllers.js";
3
+ import { css as S, isServer as y, html as b, nothing as v } from "lit";
4
+ import { customElement as R } from "lit/decorators.js";
5
+ import { classMap as k } from "lit/directives/class-map.js";
6
+ import { styleMap as g } from "lit/directives/style-map.js";
7
+ import { getI18nSeatReservation as n } from "../common.js";
8
+ import { SeatReservationBaseElement as E } from "./seat-reservation-base-element.js";
9
+ import "@sbb-esta/lyne-elements/button.js";
15
10
  import "@sbb-esta/lyne-elements/screen-reader-only.js";
16
11
  import "../seat-reservation-area.js";
17
12
  import "../seat-reservation-graphic.js";
18
13
  import "../seat-reservation-place-control.js";
19
14
  import "../seat-reservation-navigation-coach.js";
20
15
  import "../seat-reservation-scoped.js";
21
- const ee = X`*,:before,:after{box-sizing:border-box}:host{--sbb-seat-reservation-grid-size: 16px;--sbb-seat-reservation-vertical-offset: 0;display:block}:host ::part(coach-floor){fill:var(--sbb-color-white)}@media (forced-colors: active){:host ::part(coach-floor){fill:transparent}}.sbb-sr__wrapper--vertical{width:fit-content;position:relative;inset-inline-start:var(--sbb-seat-reservation-vertical-offset);rotate:90deg;transform-origin:top left}.sbb-sr__wrapper--vertical .sbb-sr__parent{overflow-y:hidden}.sbb-sr__wrapper--vertical .sbb-sr__list-coaches{width:100vw}.sbb-sr-navigation--vertical{inset-inline-start:var(--sbb-seat-reservation-vertical-offset);margin-inline-start:1.25rem;position:absolute}.sbb-sr-navigation--vertical .sbb-sr-navigation__list-coaches{flex-direction:column}.sbb-sr-navigation__list-coaches{list-style:none;margin:0;padding:0;font-size:inherit;display:flex;justify-content:center;flex-wrap:nowrap;gap:var(--sbb-spacing-fixed-1x);min-height:3.75rem}.sbb-sr__parent{overflow-x:scroll;padding:3rem 0}.sbb-sr__list-coaches{display:flex;gap:.25rem;padding:0;margin:0;list-style:none}.sbb-sr__item-coach{padding:0;margin:0;position:relative}.sbb-sr-coach-wrapper__table{outline:0}`;
22
- let me = (() => {
23
- var g, m, f, $, C, c;
24
- let r = [J("sbb-seat-reservation")], o, l = [], u, N = Z, T, z = [], O = [], E, k = [], D = [], G, I = [], V = [], B, L = [], F = [], M, H = [], W = [];
25
- return c = class extends N {
16
+ import "@sbb-esta/lyne-elements/popover/popover.js";
17
+ const P = S`*,:before,:after{box-sizing:border-box}:host{--sbb-seat-reservation-grid-size: 16px;--sbb-seat-reservation-coach-height: 0;display:block;height:inherit}:host ::part(coach-floor){fill:var(--sbb-color-white)}@media (forced-colors: active){:host ::part(coach-floor){fill:transparent}}:host(:dir(rtl)) :not(.sbb-sr-place-ctrl--type-bicycle,.sbb-sr-place-ctrl--orientation-90,.sbb-sr-place-ctrl--orientation-270,.sbb-sr-place-ctrl--state-selected) ::part(coach-floor){rotate:180deg}[popover]:where(sbb-popover){margin:0;padding:0;border:none;width:auto;height:auto;background-color:transparent;color:inherit;pointer-events:none}.sbb-sr__container{display:flex;height:inherit}.sbb-sr__grid{display:grid;grid-template-columns:20% 1fr 20%;grid-template-rows:auto auto}.sbb-sr__grid .sbb-sr-navigation-first-grid,.sbb-sr__grid .sbb-sr-navigation-last-grid{grid-row-start:1;position:relative}.sbb-sr__grid .sbb-sr-navigation-first-grid{grid-column:1/2}.sbb-sr__grid .sbb-sr-navigation-last-grid{grid-column:3/4}.sbb-sr__grid .sbb-sr__component{display:flex;grid-column:1/4;grid-row:1/3}.sbb-sr__grid .sbb-sr-grid-inner{display:grid;grid-template-columns:20% 60% 20%;grid-template-rows:auto 1fr;grid-gap:0}.sbb-sr__grid .sbb-sr-grid-inner .nav-grid{grid-column:2/3;grid-row:1/2;display:inherit}.sbb-sr__grid .sbb-sr-grid-inner .coaches-grid{grid-column:1/4;grid-row:2/3;display:inherit}.sbb-sr__grid .sbb-sr-grid-inner .coaches-grid .sbb-sr__wrapper{overflow:hidden}.sbb-sr__navigation-control-button{position:absolute;z-index:10}.sbb-sr__navigation-control-button#first-tab-element{inset-inline-end:var(--sbb-spacing-fixed-2x)}.sbb-sr__navigation-control-button#last-tab-element{inset-inline-start:var(--sbb-spacing-fixed-2x)}.sbb-sr-navigation-wrapper{overflow:hidden;padding-block:0 var(--sbb-spacing-fixed-8x)}.sbb-sr-navigation{--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: var(--sbb-color-black-alpha-30);--sbb-scrollbar-color-hover: var(--sbb-color-black-alpha-60);--sbb-scrollbar-track-color: transparent;--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-sr-navigation::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr-navigation::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr-navigation::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-sr-navigation::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-sr-navigation::-webkit-scrollbar-button,.sbb-sr-navigation::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-sr-navigation{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-sr-navigation{--sbb-scrollbar-color: var(--sbb-color-white-alpha-0);display:flex;overflow:scroll hidden;position:relative}.sbb-sr-navigation__list-coaches{list-style:none;margin:0;padding:0;font-size:inherit;display:flex;flex-wrap:nowrap;gap:var(--sbb-spacing-fixed-1x);padding:.125rem}.sbb-sr__parent{--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: var(--sbb-color-black-alpha-30);--sbb-scrollbar-color-hover: var(--sbb-color-black-alpha-60);--sbb-scrollbar-track-color: transparent;--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-sr__parent::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr__parent::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr__parent::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-sr__parent::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-sr__parent::-webkit-scrollbar-button,.sbb-sr__parent::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-sr__parent{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-sr__parent{overflow-x:scroll;padding-block:var(--sbb-spacing-fixed-2x) var(--sbb-spacing-fixed-4x)}.sbb-sr__list-coaches{list-style:none;margin:0;padding:0;font-size:inherit;display:flex;gap:.25rem}.sbb-sr__item-coach{position:relative}.sbb-sr-popover{margin:0}.sbb-sr-coach-wrapper__table{outline:0}.sbb-sr.sbb-sr__grid--vertical{grid-template-columns:calc((var(--sbb-seat-reservation-coach-height) + 28) * var(--sbb-seat-reservation-one-px-rem)) 1fr;grid-template-rows:20% 60% 20%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-first-grid{grid-column:2/3;grid-row-start:1}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-first-grid #first-tab-element{position:absolute;inset-block-end:var(--sbb-spacing-fixed-4x);inset-inline-start:var(--sbb-spacing-fixed-8x);inset-inline-end:initial;rotate:90deg}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-last-grid{grid-column:2/3;grid-row:3/4}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-last-grid #last-tab-element{inset-block-start:var(--sbb-spacing-fixed-4x);inset-inline-start:var(--sbb-spacing-fixed-8x);rotate:90deg}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-navigation-wrapper{padding-block-end:initial;padding-inline-start:var(--sbb-spacing-fixed-8x)}.sbb-sr.sbb-sr__grid--vertical .sbb-sr__component{grid-column:1/3;grid-row:1/4}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner{grid-template-columns:calc((var(--sbb-seat-reservation-coach-height) + 28) * var(--sbb-seat-reservation-one-px-rem)) 1fr;grid-template-rows:20% 60% 20%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .nav-grid{grid-column:2/3;grid-row:2/3;height:100%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .nav-grid .sbb-sr-navigation{display:block;overflow:hidden scroll;height:100%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .nav-grid .sbb-sr-navigation .sbb-sr-navigation__list-coaches{flex-direction:column;padding:.125rem}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid{grid-column:1/2;grid-row:1/4;overflow:hidden;position:relative}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent{--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: var(--sbb-color-black-alpha-30);--sbb-scrollbar-color-hover: var(--sbb-color-black-alpha-60);--sbb-scrollbar-track-color: transparent;--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-button,.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent{overflow:hidden scroll;padding:0 var(--sbb-spacing-fixed-4x) 0 0;height:100%}.sbb-sr.sbb-sr__grid--vertical .sbb-sr-grid-inner .coaches-grid .sbb-sr__parent .sbb-sr__list-coaches{rotate:90deg;transform-origin:calc((var(--sbb-seat-reservation-coach-height) / 2 - 3) * var(--sbb-seat-reservation-one-px-rem)) calc((var(--sbb-seat-reservation-coach-height) / 2 - 3) * var(--sbb-seat-reservation-one-px-rem))}`;
18
+ let q = (() => {
19
+ var h;
20
+ let C = [R("sbb-seat-reservation")], u, m = [], d, f = E;
21
+ return h = class extends f {
26
22
  constructor() {
27
- super(...arguments);
28
- x(this, g);
29
- x(this, m);
30
- x(this, f);
31
- x(this, $);
32
- x(this, C);
33
- b(this, g, p(this, z, null)), b(this, m, (p(this, O), p(this, k, !0))), b(this, f, (p(this, D), p(this, I, !1))), b(this, $, (p(this, V), p(this, L, null))), b(this, C, (p(this, F), p(this, H, !1))), this._language = (p(this, W), new K(this)), this._notAreaElements = [
23
+ super(...arguments), this._language = new A(this), this._notAreaElements = [
34
24
  "DRIVER_AREA_FULL",
35
25
  "COACH_PASSAGE",
36
26
  "COACH_WALL_NO_PASSAGE",
@@ -40,301 +30,309 @@ let me = (() => {
40
30
  "COMPARTMENT_PASSAGE_LOW"
41
31
  ], this._notFixedRotatableAreaIcons = ["ENTRY_EXIT"];
42
32
  }
43
- /** The seat reservation object which contains all coaches and places */
44
- get seatReservation() {
45
- return R(this, g);
46
- }
47
- set seatReservation(e) {
48
- b(this, g, e);
49
- }
50
- /** The seat reservation navigation can be toggled by this property */
51
- get hasNavigation() {
52
- return R(this, m);
53
- }
54
- set hasNavigation(e) {
55
- b(this, m, e);
56
- }
57
- /** Controls the visual representation of seat reservation in a horizonal or vertical alignment */
58
- get alignVertical() {
59
- return R(this, f);
60
- }
61
- set alignVertical(e) {
62
- b(this, f, e);
33
+ willUpdate(r) {
34
+ super.willUpdate(r), r.has("hasNavigation") && (this.hasNavigation ? this.shadowRoot?.querySelectorAll("table").forEach((s) => s.removeAttribute("tabindex")) : this.shadowRoot?.querySelectorAll("table").forEach((s) => s.setAttribute("tabindex", "0")));
63
35
  }
64
- /** Maximal number of possible clickable seats */
65
- get maxReservations() {
66
- return R(this, $);
67
- }
68
- set maxReservations(e) {
69
- b(this, $, e);
70
- }
71
- /** Any click functionality is prevented */
72
- get preventPlaceClick() {
73
- return R(this, C);
74
- }
75
- set preventPlaceClick(e) {
76
- b(this, C, e);
77
- }
78
- willUpdate(e) {
79
- super.willUpdate(e), e.has("hasNavigation") && (this.hasNavigation ? this.shadowRoot?.querySelectorAll("table").forEach((t) => t.removeAttribute("tabindex")) : this.shadowRoot?.querySelectorAll("table").forEach((t) => t.setAttribute("tabindex", "0")));
80
- }
81
- firstUpdated(e) {
82
- super.firstUpdated(e), this._componentSetup();
36
+ firstUpdated(r) {
37
+ super.firstUpdated(r), this.updateComplete.then(() => {
38
+ this.initNavigationSelectionByScrollEvent();
39
+ });
83
40
  }
84
41
  render() {
85
- return this._initVehicleSeatReservationConstruction(), this._coachesHtmlTemplate || null;
42
+ return y || this._determineBaseFontSize(), this._initVehicleSeatReservationConstruction(), this._coachesHtmlTemplate || null;
86
43
  }
87
- _componentSetup() {
88
- this.initNavigationSelectionByScrollEvent();
44
+ _determineBaseFontSize() {
45
+ const s = 1 / parseInt(window.getComputedStyle(document.body).fontSize, 10);
46
+ this.style?.setProperty("--sbb-seat-reservation-one-px-rem", `${s + "rem"}`);
89
47
  }
90
48
  _initVehicleSeatReservationConstruction() {
91
- const e = JSON.parse(JSON.stringify(this.seatReservation?.coachItems)), t = this.alignVertical ? "sbb-sr__wrapper--vertical" : "";
92
- this._coachesHtmlTemplate = d`
93
- <div>
94
- <sbb-screen-reader-only>
95
- <input
96
- id="first-tab-element"
97
- role="contentinfo"
98
- type="text"
99
- aria-label="${_("SEAT_RESERVATION_BEGIN", this._language.current)}"
100
- readonly
101
- />
102
- </sbb-screen-reader-only>
103
-
104
- <div @keydown=${(i) => this.handleKeyboardEvent(i)}>
105
- ${this._renderNavigation()}
106
- <div class="sbb-sr__wrapper ${t}">
107
- <div id="sbb-sr__parent-area" class="sbb-sr__parent" tabindex="-1">
108
- <ul class="sbb-sr__list-coaches" role="presentation">
109
- ${this._renderCoaches(e)}
110
- </ul>
49
+ const r = JSON.parse(JSON.stringify(this.seatReservation?.coachItems)), s = this.alignVertical ? "sbb-sr__grid--vertical" : "";
50
+ this._coachesHtmlTemplate = b`
51
+ <div class="sbb-sr__container">
52
+ <div class="sbb-sr sbb-sr__grid ${s}">
53
+ <div class="sbb-sr-navigation-first-grid">
54
+ ${this._renderNavigationControlButton("DIRECTION_LEFT")}
55
+ </div>
56
+ <div
57
+ class="sbb-sr__component"
58
+ @keydown=${(e) => this.handleKeyboardEvent(e)}
59
+ >
60
+ <div class="sbb-sr-grid-inner">
61
+ <div class="nav-grid">${this._renderNavigation()}</div>
62
+ <div class="coaches-grid">
63
+ <div class="sbb-sr__wrapper">
64
+ <div id="sbb-sr__parent-area" class="sbb-sr__parent" tabindex="-1">
65
+ <ul class="sbb-sr__list-coaches" role="presentation">
66
+ ${this._renderCoaches(r)}
67
+ </ul>
68
+ </div>
69
+ </div>
70
+ </div>
111
71
  </div>
112
72
  </div>
73
+ <div class="sbb-sr-navigation-last-grid">
74
+ ${this._renderNavigationControlButton("DIRECTION_RIGHT")}
75
+ </div>
113
76
  </div>
114
-
115
- <sbb-screen-reader-only>
116
- <input
117
- id="last-tab-element"
118
- role="contentinfo"
119
- type="text"
120
- aria-label="${_("SEAT_RESERVATION_END", this._language.current)}"
121
- readonly
122
- />
123
- </sbb-screen-reader-only>
124
77
  </div>
125
78
  `;
126
79
  }
80
+ _renderNavigationControlButton(r) {
81
+ if (!this.hasNavigation)
82
+ return null;
83
+ const s = r == "DIRECTION_RIGHT" ? "last-tab-element" : "first-tab-element", e = r == "DIRECTION_RIGHT" ? "arrow-right-small" : "arrow-left-small", t = r == "DIRECTION_RIGHT" ? n("SEAT_RESERVATION_END", this._language.current) : n("SEAT_RESERVATION_BEGIN", this._language.current);
84
+ let i = !0;
85
+ return (r == "DIRECTION_LEFT" && this.selectedCoachIndex > 0 || r == "DIRECTION_RIGHT" && this.selectedCoachIndex < this.seatReservation.coachItems.length - 1) && (i = !1), b`<sbb-secondary-button
86
+ @click="${() => this.navigateByDirectionBtn(r)}"
87
+ id="${s}"
88
+ class="sbb-sr__navigation-control-button"
89
+ size="s"
90
+ icon-name="${e}"
91
+ type="button"
92
+ aria-label="${t}"
93
+ role="contentinfo"
94
+ .disabledInteractive="${i || v}"
95
+ ></sbb-secondary-button>`;
96
+ }
127
97
  _renderNavigation() {
128
- return this.hasNavigation ? d`
129
- <nav class="${Y({ "sbb-sr-navigation--vertical": this.alignVertical })}">
98
+ return this.hasNavigation ? b`<div class="sbb-sr-navigation-wrapper">
99
+ <nav id="sbb-sr-navigation" class="sbb-sr-navigation">
130
100
  <ul
101
+ id="sbb-sr__navigation-list-coaches"
131
102
  class="sbb-sr-navigation__list-coaches"
132
- aria-label="${_("SEAT_RESERVATION_NAVIGATION", this._language.current)}"
103
+ aria-label="${n("SEAT_RESERVATION_NAVIGATION", this._language.current)}"
133
104
  >
134
- ${this.seatReservation?.coachItems.map((e, t) => d`<li>
105
+ ${this.seatReservation?.coachItems.map((r, s) => {
106
+ const e = this.getAvailableFreePlacesNumFromCoach(s);
107
+ return b`<li>
135
108
  <sbb-seat-reservation-navigation-coach
136
- @selectcoach=${(i) => this._onSelectNavCoach(i)}
109
+ @selectcoach=${(t) => this._onSelectNavCoach(t)}
137
110
  @focuscoach=${() => this._onFocusNavCoach()}
138
- index="${t}"
139
- coach-id="${e.id}"
140
- .selected=${this.selectedCoachIndex === t}
141
- .focused=${this.focusedCoachIndex === t}
142
- .propertyIds="${e.propertyIds}"
143
- .travelClass="${e.travelClass}"
144
- ?driver-area="${!e.places?.length}"
145
- ?first="${t === 0}"
146
- ?last="${t === this.seatReservation?.coachItems.length - 1}"
111
+ class="${k({
112
+ "sbb-sr__navigation-coach--hover-scroll": this.hoveredScrollCoachIndex === s
113
+ })}"
114
+ index="${s}"
115
+ coach-id="${r.id}"
116
+ .freePlacesByType="${e}"
117
+ .selected=${this.selectedCoachIndex === s}
118
+ .focused=${this.focusedCoachIndex === s}
119
+ .propertyIds="${r.propertyIds}"
120
+ .travelClass="${r.travelClass}"
121
+ ?driver-area="${!r.places?.length}"
122
+ ?first="${s === 0}"
123
+ ?last="${s === this.seatReservation?.coachItems.length - 1}"
147
124
  ?vertical="${this.alignVertical}"
148
125
  >
149
126
  </sbb-seat-reservation-navigation-coach>
150
- </li>`)}
127
+ </li>`;
128
+ })}
151
129
  </ul>
152
130
  </nav>
153
- ` : null;
131
+ </div>` : null;
154
132
  }
155
133
  /**
156
134
  *
157
135
  * @param coaches
158
136
  * @returns
159
137
  */
160
- _renderCoaches(e) {
161
- return e ? e.map((t, i) => d`
162
- <li class="sbb-sr__item-coach">${this._renderCoachElement(t, i)}</li>
138
+ _renderCoaches(r) {
139
+ return r ? r.map((s, e) => b`
140
+ <li class="sbb-sr__item-coach">${this._renderCoachElement(s, e)}</li>
163
141
  `) : null;
164
142
  }
165
- _renderCoachElement(e, t) {
166
- const i = this.getCalculatedDimension(e.dimension), s = this._getDescriptionTableCoach(e);
167
- return d` <sbb-seat-reservation-scoped
168
- scoped-classes="coach-wrapper"
169
- height="${i.h}px"
170
- width="${i.w}px"
143
+ _renderCoachElement(r, s) {
144
+ const e = this.getCalculatedDimension(r.dimension), t = this._getDescriptionTableCoach(r, s);
145
+ return b`<sbb-seat-reservation-scoped
146
+ style=${g({
147
+ "--sbb-seat-reservation-scoped-width": e.w,
148
+ "--sbb-seat-reservation-scoped-height": e.h
149
+ })}
171
150
  >
172
- ${this._getRenderedCoachBorders(e, t)}
173
- ${this._getRenderedGraphicalElements(e.graphicElements || [], e.dimension)}
174
- ${this._getRenderedServiceElements(e.serviceElements)}
151
+ ${this._getRenderedCoachBorders(r, s)}
152
+ ${this._getRenderedGraphicalElements(r.graphicElements || [], r.dimension, s)}
153
+ ${this._getRenderedServiceElements(s, r.serviceElements)}
154
+
175
155
  <table
176
- @focus=${() => this.onFocusTableCoachAndPreselectPlace(t)}
177
- id="sbb-sr-coach-${t}"
156
+ @focus=${() => this.onFocusTableCoachAndPreselectPlace(s)}
157
+ id="sbb-sr-coach-${s}"
178
158
  class="sbb-sr-coach-wrapper__table"
179
- aria-describedby="sbb-sr-coach-caption-${t}"
159
+ aria-describedby="sbb-sr-coach-caption-${s}"
180
160
  >
181
- <caption id="sbb-sr-coach-caption-${t}" tabindex="-1">
182
- <sbb-screen-reader-only>${s}</sbb-screen-reader-only>
161
+ <caption id="sbb-sr-coach-caption-${s}" tabindex="-1">
162
+ <sbb-screen-reader-only>${t}</sbb-screen-reader-only>
183
163
  </caption>
184
- ${this._getRenderedRowPlaces(e, t)}
164
+ ${this._getRenderedRowPlaces(r, s)}
185
165
  </table>
186
166
  </sbb-seat-reservation-scoped>`;
187
167
  }
188
- _getRenderedCoachBorders(e, t) {
189
- const i = e.graphicElements, s = 1, a = i?.find((v) => v.icon === "DRIVER_AREA_FULL"), n = a ? e.dimension.w - a.dimension.w - s : e.dimension.w - s * 2, h = t === 0 && a ? a?.dimension.w * this.baseGridSize : this.baseGridSize;
190
- return d`
191
- <sbb-seat-reservation-scoped
192
- scoped-classes="coach-border"
193
- inset-block-start="${this.coachBorderPadding * -1}px"
194
- inset-inline-start="${h}px"
195
- >
196
- <sbb-seat-reservation-graphic
197
- name="COACH_BORDER_MIDDLE"
198
- width=${n * this.baseGridSize}
199
- height=${(e.dimension.h + this.coachBorderOffset * 2) * this.baseGridSize}
200
- ?stretch=${!0}
201
- role="presentation"
202
- ></sbb-seat-reservation-graphic>
203
- </sbb-seat-reservation-scoped>
168
+ /**
169
+ * @returns Returns the border graphic (COACH_BORDER_MIDDLE) of a coach with calculated border gap and coach width,
170
+ * depending on whether the coach is with a driver area or without.
171
+ */
172
+ _getRenderedCoachBorders(r, s) {
173
+ const i = r.graphicElements?.find((c) => c.icon === "DRIVER_AREA_FULL"), a = i ? r.dimension.w - i.dimension.w - 1 : r.dimension.w - 2, o = (r.dimension.h + this.coachBorderOffset * 2) * this.baseGridSize, l = s === 0 && i ? i?.dimension.w * this.baseGridSize : this.baseGridSize;
174
+ return b`
175
+ <sbb-seat-reservation-graphic
176
+ style=${g({
177
+ "--sbb-seat-reservation-graphic-width": a * this.baseGridSize,
178
+ "--sbb-seat-reservation-graphic-height": o,
179
+ "--sbb-seat-reservation-graphic-top": this.coachBorderPadding * -1,
180
+ "--sbb-seat-reservation-graphic-left": l,
181
+ "--sbb-seat-reservation-graphic-position": "absolute"
182
+ })}
183
+ name="COACH_BORDER_MIDDLE"
184
+ ?stretch=${!0}
185
+ role="presentation"
186
+ ></sbb-seat-reservation-graphic>
204
187
  `;
205
188
  }
206
- _getRenderedRowPlaces(e, t) {
207
- if (!e.places)
189
+ _getRenderedRowPlaces(r, s) {
190
+ if (!r.places)
208
191
  return null;
209
- const i = {};
210
- for (const s of e.places)
211
- i[s.position.y] ? i[s.position.y].push(s) : i[s.position.y] = [s];
212
- return Object.values(i).map((s, a) => d`
213
- <tr id="row-${t}-${s[0].position.y}" data-row-index=${a}>
214
- ${this._getRenderedColumnPlaces(s, t)}
192
+ const e = {};
193
+ for (const t of r.places)
194
+ e[t.position.y] ? e[t.position.y].push(t) : e[t.position.y] = [t];
195
+ return Object.values(e).map((t, i) => b`
196
+ <tr id="row-${s}-${t[0].position.y}" data-row-index=${i}>
197
+ ${this._getRenderedColumnPlaces(t, s)}
215
198
  </tr>
216
- `).flatMap((s) => s);
199
+ `).flatMap((t) => t);
217
200
  }
218
- _getRenderedColumnPlaces(e, t) {
219
- return e.sort((i, s) => Number(i.position.x) - Number(s.position.x)), e?.map((i, s) => {
220
- const a = this.getCalculatedDimension(i.dimension), n = this.getCalculatedPosition(i.position), h = this.alignVertical ? -90 : 0;
221
- return d`
222
- <sbb-seat-reservation-scoped
223
- scoped-classes="graphical-element"
224
- inset-block-start="${n.y}px"
225
- inset-inline-start="${n.x}px"
226
- width="${a.w}px"
227
- height="${a.h}px"
228
- z-index="${i.position.z}"
229
- cell-id="cell-${t}-${i.position.y}-${s}"
230
- >
201
+ _getRenderedColumnPlaces(r, s) {
202
+ return r.sort((e, t) => Number(e.position.x) - Number(t.position.x)), r?.map((e, t) => {
203
+ const i = this.getCalculatedDimension(e.dimension), a = this.getCalculatedPosition(e.position), o = this.alignVertical ? -90 : 0;
204
+ return b`
205
+ <td id="cell-${s}-${e.position.y}-${t}" class="graphical-element">
231
206
  <sbb-seat-reservation-place-control
232
- @selectplace=${(v) => this._onSelectPlace(v)}
207
+ style=${g({
208
+ "--sbb-seat-reservation-place-control-width": i.w,
209
+ "--sbb-seat-reservation-place-control-height": i.h,
210
+ "--sbb-seat-reservation-place-control-top": a.y,
211
+ "--sbb-seat-reservation-place-control-left": a.x
212
+ })}
213
+ @selectplace=${(l) => this._onSelectPlace(l)}
233
214
  exportparts="sbb-sr-place-part"
234
- id="seat-reservation__place-button-${t}-${i.number}"
215
+ id="seat-reservation__place-button-${s}-${e.number}"
235
216
  class="seat-reservation-place-control"
236
- data-cell-id="${t}-${i.position.y}-${s}"
237
- text=${i.number}
238
- type=${i.type}
239
- state=${i.state}
240
- width=${i.dimension.w * this.baseGridSize}
241
- height=${i.dimension.h * this.baseGridSize}
242
- rotation=${i.rotation ?? A}
243
- text-rotation=${h}
244
- coach-index=${t}
245
- .propertyIds=${i.propertyIds}
217
+ data-cell-id="${s}-${e.position.y}-${t}"
218
+ text=${e.number}
219
+ type=${e.type}
220
+ state=${e.state}
221
+ width=${e.dimension.w * this.baseGridSize}
222
+ height=${e.dimension.h * this.baseGridSize}
223
+ rotation=${e.rotation ?? v}
224
+ text-rotation=${o}
225
+ coach-index=${s}
226
+ .propertyIds=${e.propertyIds}
246
227
  .preventClick=${this.preventPlaceClick}
247
228
  ></sbb-seat-reservation-place-control>
248
- </sbb-seat-reservation-scoped>
229
+ </td>
249
230
  `;
250
231
  });
251
232
  }
252
- _getRenderedGraphicalElements(e, t) {
253
- return e ? e?.map((i) => {
254
- const s = i.icon ?? "", a = i.rotation || 0, n = this._notFixedRotatableAreaIcons.indexOf(i.icon) === -1, h = this.alignVertical && n ? a - 90 : a;
255
- return this._notAreaElements.findIndex((v) => v === s) > -1 ? this._getRenderElementWithoutArea(i, a, t) : this._getRenderElementWithArea(i, h, t);
233
+ _getRenderedGraphicalElements(r, s, e) {
234
+ return r ? r?.map((t) => {
235
+ const i = t.icon ?? "", a = t.rotation || 0, o = this._notFixedRotatableAreaIcons.indexOf(t.icon) === -1, l = this.alignVertical && o ? a - 90 : a;
236
+ return this._notAreaElements.findIndex((c) => c === i) > -1 ? this._getRenderElementWithoutArea(t, a, s) : this._getRenderElementWithArea(t, l, s, e);
256
237
  }) : null;
257
238
  }
258
- _getRenderElementWithArea(e, t, i) {
259
- const s = e.icon?.indexOf("TABLE") === -1, a = e.icon && s ? e.icon : null, n = a !== "ENTRY_EXIT", h = e.icon ? _(e.icon, this._language.current) : A, v = this.getCalculatedDimension(e.dimension, i, !0, n), j = this.getCalculatedPosition(e.position, e.dimension, i, !0);
260
- let w = "free";
261
- return e.position.y === this.coachBorderOffset * -1 ? w = "upper-border" : e.position.y + e.dimension.h === i.h + this.coachBorderOffset && (w = "lower-border"), d`
262
- <sbb-seat-reservation-scoped
263
- scoped-classes="graphical-element"
264
- inset-block-start="${j.y}px"
265
- inset-inline-start="${j.x}px"
266
- width="${v.w}px"
267
- height="${v.h}px"
268
- z-index="${e.position.z}"
239
+ /**
240
+ * creates a rendered element with an area component
241
+ * @param graphicalElement
242
+ * @param rotation
243
+ * @param coachDimension
244
+ * @param coachIndex used to generate a unique id for the popover trigger
245
+ * @private
246
+ */
247
+ _getRenderElementWithArea(r, s, e, t) {
248
+ const i = r.icon?.indexOf("TABLE") === -1, a = r.icon && i ? r.icon : null, o = a !== "ENTRY_EXIT", l = r.icon ? n(r.icon, this._language.current) : v, c = this.getCalculatedDimension(r.dimension, e, !0, o), p = this.getCalculatedPosition(r.position, r.dimension, e, !0), w = `popover-trigger-${t}-${p.x}-${p.y}`;
249
+ let _ = "free";
250
+ return r.position.y === this.coachBorderOffset * -1 ? _ = "upper-border" : r.position.y + r.dimension.h === e.h + this.coachBorderOffset && (_ = "lower-border"), b`
251
+ <sbb-seat-reservation-area
252
+ id="${w}"
253
+ style=${g({
254
+ "--sbb-seat-reservation-area-width": c.w,
255
+ "--sbb-seat-reservation-area-height": c.h,
256
+ "--sbb-seat-reservation-area-top": p.y,
257
+ "--sbb-seat-reservation-area-left": p.x
258
+ })}
259
+ mounting=${_}
260
+ background="dark"
261
+ aria-hidden="true"
269
262
  >
270
- <sbb-seat-reservation-area
271
- style=${Q({
272
- "--sbb-reservation-area-width": e.dimension.w * this.baseGridSize,
273
- "--sbb-reservation-area-height": e.dimension.h * this.baseGridSize
263
+ ${a ? b`
264
+ <sbb-seat-reservation-graphic
265
+ style=${g({
266
+ "--sbb-seat-reservation--cursor-pointer": "pointer"
274
267
  })}
275
- mounting=${w}
276
- background="dark"
277
- aria-hidden="true"
278
- title=${h}
279
- >
280
- ${a ? d`
281
- <sbb-seat-reservation-graphic
282
- name=${a}
283
- rotation=${t}
284
- width=${this.baseGridSize}
285
- height=${this.baseGridSize}
286
- role="img"
287
- aria-hidden="true"
288
- ></sbb-seat-reservation-graphic>
289
- ` : A}
290
- </sbb-seat-reservation-area>
291
- </sbb-seat-reservation-scoped>
268
+ name=${a}
269
+ width=${this.baseGridSize}
270
+ height=${this.baseGridSize}
271
+ rotation=${s}
272
+ role="img"
273
+ aria-hidden="true"
274
+ ></sbb-seat-reservation-graphic>
275
+ ` : v}
276
+ </sbb-seat-reservation-area>
277
+ ${this._popover(w, l)}
292
278
  `;
293
279
  }
294
- _getRenderElementWithoutArea(e, t, i) {
295
- const s = this.getCalculatedDimension(e.dimension, i), a = this.getCalculatedPosition(e.position, e.dimension, i), n = e.icon && e.icon.indexOf("DRIVER_AREA") === -1 ? e.icon : e.icon?.concat("_", this.seatReservation.vehicleType);
296
- return d`
297
- <sbb-seat-reservation-scoped
298
- scoped-classes="graphical-element"
299
- inset-block-start="${a.y}px"
300
- inset-inline-start="${a.x}px"
301
- width="${s.w}px"
302
- height="${s.h}px"
303
- z-index="${e.position.z}"
304
- >
280
+ /**
281
+ * Creates a popover for extra service information
282
+ * @param triggerId
283
+ * @param popoverContent
284
+ * @private
285
+ */
286
+ _popover(r, s) {
287
+ return b`
288
+ <sbb-popover trigger="${r}">
289
+ <p class="sbb-text-s sbb-sr-popover">${s}</p>
290
+ </sbb-popover>
291
+ `;
292
+ }
293
+ /**
294
+ * trigger to close all opened popovers (normally only one is opened at a time)
295
+ * @private
296
+ */
297
+ _closePopover() {
298
+ this.shadowRoot?.querySelectorAll('sbb-popover[data-state="opened"]').forEach((r) => r.setAttribute("data-state", "closed"));
299
+ }
300
+ _getRenderElementWithoutArea(r, s, e) {
301
+ const t = this.getCalculatedDimension(r.dimension, e), i = this.getCalculatedPosition(r.position, r.dimension, e), a = r.icon && r.icon.indexOf("DRIVER_AREA") === -1 ? r.icon : r.icon?.concat("_", this.seatReservation.vehicleType);
302
+ return b` <sbb-seat-reservation-graphic
303
+ style=${g({
304
+ "--sbb-seat-reservation-graphic-width": t.w,
305
+ "--sbb-seat-reservation-graphic-height": t.h,
306
+ "--sbb-seat-reservation-graphic-top": i.y,
307
+ "--sbb-seat-reservation-graphic-left": i.x,
308
+ "--sbb-seat-reservation-graphic-position": "absolute"
309
+ })}
310
+ name=${a ?? v}
311
+ rotation=${s}
312
+ aria-hidden="true"
313
+ ?stretch=${!0}
314
+ ></sbb-seat-reservation-graphic>`;
315
+ }
316
+ _getRenderedServiceElements(r, s) {
317
+ return s ? s?.map((e) => {
318
+ const t = e.icon ? n(e.icon, this._language.current) : null, i = this.getCalculatedDimension(e.dimension), a = this.getCalculatedPosition(e.position), o = e.rotation || 0, l = this.alignVertical ? o - 90 : o, c = `popover-trigger-${r}-${a.x}-${a.y}`;
319
+ return b`
305
320
  <sbb-seat-reservation-graphic
306
- name=${n ?? A}
307
- width=${e.dimension.w * this.baseGridSize}
308
- height=${e.dimension.h * this.baseGridSize}
309
- rotation=${t}
321
+ id="${c}"
322
+ style=${g({
323
+ "--sbb-seat-reservation-graphic-width": i.w,
324
+ "--sbb-seat-reservation-graphic-height": i.h,
325
+ "--sbb-seat-reservation-graphic-top": a.y,
326
+ "--sbb-seat-reservation-graphic-left": a.x,
327
+ "--sbb-seat-reservation-graphic-position": "absolute",
328
+ "--sbb-seat-reservation--cursor-pointer": "pointer"
329
+ })}
330
+ name=${e.icon ?? v}
331
+ .rotation=${l}
332
+ role="img"
310
333
  aria-hidden="true"
311
- ?stretch=${!0}
312
334
  ></sbb-seat-reservation-graphic>
313
- </sbb-seat-reservation-scoped>
314
- `;
315
- }
316
- _getRenderedServiceElements(e) {
317
- return e ? e?.map((t) => {
318
- const i = t.icon ? _(t.icon, this._language.current) : null, s = this.getCalculatedDimension(t.dimension), a = this.getCalculatedPosition(t.position), n = t.rotation || 0, h = this.alignVertical ? n - 90 : n;
319
- return d`
320
- <sbb-seat-reservation-scoped
321
- scoped-classes="graphical-element"
322
- inset-block-start="${a.y}px"
323
- inset-inline-start="${a.x}px"
324
- width="${s.w}px"
325
- height="${s.h}px"
326
- z-index="${t.position.z}"
327
- >
328
- <sbb-seat-reservation-graphic
329
- name=${t.icon ?? A}
330
- width=${t.dimension.w * this.baseGridSize}
331
- height=${t.dimension.h * this.baseGridSize}
332
- .rotation=${h}
333
- role="img"
334
- aria-hidden="true"
335
- title=${i ?? A}
336
- ></sbb-seat-reservation-graphic>
337
- </sbb-seat-reservation-scoped>
335
+ ${this._popover(c, t)}
338
336
  `;
339
337
  }) : null;
340
338
  }
@@ -343,53 +341,47 @@ let me = (() => {
343
341
  * Each selection emits an array of all selected places
344
342
  * @param selectPlaceEvent
345
343
  */
346
- _onSelectPlace(e) {
347
- const t = e.detail;
348
- this.preventCoachScrollByPlaceClick = !0, this.isCoachGridFocusable = !1, this.preventPlaceClick || (this.updateSelectedSeatReservationPlaces(t), this.updateCurrentSelectedPlaceInCoach(t));
344
+ _onSelectPlace(r) {
345
+ const s = r.detail;
346
+ this.preventCoachScrollByPlaceClick = !0, this.isCoachGridFocusable = !1, this.preventPlaceClick || (this.updateSelectedSeatReservationPlaces(s), this.updateCurrentSelectedPlaceInCoach(s));
349
347
  }
350
- _onSelectNavCoach(e) {
351
- const t = e.detail;
352
- this.isKeyboardNavigation = !1, t !== null && t !== this.currSelectedCoachIndex ? (this.unfocusPlaceElement(), this.scrollToSelectedNavCoach(t)) : t === this.currSelectedCoachIndex && (this.updateCurrentSelectedCoach(), this.preselectPlaceInCoach());
348
+ _onSelectNavCoach(r) {
349
+ const s = r.detail;
350
+ this.isKeyboardNavigation = !1, s !== null && s !== this.currSelectedCoachIndex ? (this.unfocusPlaceElement(), this.scrollToSelectedNavCoach(s)) : s === this.currSelectedCoachIndex && (this.updateCurrentSelectedCoach(), this.preselectPlaceInCoach()), this._closePopover();
353
351
  }
354
352
  _onFocusNavCoach() {
355
353
  this.preventCoachScrollByPlaceClick ? this.focusPlaceElement(this.currSelectedPlace) : this.preselectPlaceInCoach(), this.isAutoScrolling = !1;
356
354
  }
357
- _getDescriptionTableCoach(e) {
358
- if (!e.places?.length)
359
- return _("COACH_BLOCKED_TABLE_CAPTION", this._language.current, [
360
- e.id
355
+ _getDescriptionTableCoach(r, s) {
356
+ if (!r.places?.length)
357
+ return n("COACH_BLOCKED_TABLE_CAPTION", this._language.current, [
358
+ r.id
361
359
  ]);
362
- let t = "";
363
- const i = this._getTitleDescriptionListString(e.graphicElements), s = this._getTitleDescriptionListString(e.serviceElements);
364
- return t = _("COACH_TABLE_CAPTION", this._language.current, [
365
- e.id
366
- ]), (i || s) && (t += ". " + _("COACH_AVAILABLE_SERVICES", this._language.current) + ": ", t += s + ", " + i + "."), t;
360
+ let e;
361
+ const t = this._getTitleDescriptionListString(r.graphicElements), i = this._getTitleDescriptionListString(r.serviceElements);
362
+ if (e = n("COACH_TABLE_CAPTION", this._language.current, [
363
+ r.id
364
+ ]), !this.hasNavigation) {
365
+ const a = this.getAvailableFreePlacesNumFromCoach(s), o = n("COACH_AVAILABLE_NUMBER_OF_PLACES", this._language.current, [a.seats, a.bicycles]);
366
+ e = e.concat(". ").concat(o).concat(". ");
367
+ }
368
+ return (t || i) && (e += ". " + n("COACH_AVAILABLE_SERVICES", this._language.current) + ": ", e += i + ", " + t + "."), e;
367
369
  }
368
- _getTitleDescriptionListString(e) {
369
- const t = [];
370
- return e?.map((i) => {
371
- const s = i.icon;
372
- if (!s)
370
+ _getTitleDescriptionListString(r) {
371
+ const s = [];
372
+ return r?.map((e) => {
373
+ const t = e.icon;
374
+ if (!t)
373
375
  return null;
374
- const a = t.indexOf(s) > -1, n = _(i.icon, this._language.current), h = this._notFixedRotatableAreaIcons.indexOf(s) === -1 && this._notAreaElements.indexOf(s) === -1;
375
- return a || t.push(i.icon), n && !a && h ? n : null;
376
- }).filter((i) => !!i).join(", ");
376
+ const i = s.indexOf(t) > -1, a = n(e.icon, this._language.current), o = this._notFixedRotatableAreaIcons.indexOf(t) === -1 && this._notAreaElements.indexOf(t) === -1;
377
+ return i || s.push(e.icon), a && !i && o ? a : null;
378
+ }).filter((e) => !!e).join(", ");
377
379
  }
378
- }, g = new WeakMap(), m = new WeakMap(), f = new WeakMap(), $ = new WeakMap(), C = new WeakMap(), u = c, (() => {
379
- const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(N[Symbol.metadata] ?? null) : void 0;
380
- T = [y({ attribute: "seat-reservation", type: Object })], E = [P(), y({ attribute: "has-navigation", type: Boolean })], G = [P(), y({ attribute: "align-vertical", type: Boolean })], B = [P(), y({ attribute: "max-reservations", type: Number })], M = [P(), y({ attribute: "prevent-place-click", type: Boolean })], S(c, null, T, { kind: "accessor", name: "seatReservation", static: !1, private: !1, access: { has: (t) => "seatReservation" in t, get: (t) => t.seatReservation, set: (t, i) => {
381
- t.seatReservation = i;
382
- } }, metadata: e }, z, O), S(c, null, E, { kind: "accessor", name: "hasNavigation", static: !1, private: !1, access: { has: (t) => "hasNavigation" in t, get: (t) => t.hasNavigation, set: (t, i) => {
383
- t.hasNavigation = i;
384
- } }, metadata: e }, k, D), S(c, null, G, { kind: "accessor", name: "alignVertical", static: !1, private: !1, access: { has: (t) => "alignVertical" in t, get: (t) => t.alignVertical, set: (t, i) => {
385
- t.alignVertical = i;
386
- } }, metadata: e }, I, V), S(c, null, B, { kind: "accessor", name: "maxReservations", static: !1, private: !1, access: { has: (t) => "maxReservations" in t, get: (t) => t.maxReservations, set: (t, i) => {
387
- t.maxReservations = i;
388
- } }, metadata: e }, L, F), S(c, null, M, { kind: "accessor", name: "preventPlaceClick", static: !1, private: !1, access: { has: (t) => "preventPlaceClick" in t, get: (t) => t.preventPlaceClick, set: (t, i) => {
389
- t.preventPlaceClick = i;
390
- } }, metadata: e }, H, W), S(null, o = { value: u }, r, { kind: "class", name: u.name, metadata: e }, null, l), u = o.value, e && Object.defineProperty(u, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
391
- })(), c.styles = ee, p(u, l), u;
380
+ }, d = h, (() => {
381
+ const r = typeof Symbol == "function" && Symbol.metadata ? Object.create(f[Symbol.metadata] ?? null) : void 0;
382
+ $(null, u = { value: d }, C, { kind: "class", name: d.name, metadata: r }, null, m), d = u.value, r && Object.defineProperty(d, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: r });
383
+ })(), h.styles = P, x(d, m), d;
392
384
  })();
393
385
  export {
394
- me as SbbSeatReservationElement
386
+ q as SbbSeatReservationElement
395
387
  };