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