@sbb-esta/lyne-elements 0.52.1 → 0.52.2

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 (71) hide show
  1. package/accordion.js +54 -54
  2. package/action-group.js +3 -3
  3. package/alert/alert-group.js +22 -22
  4. package/alert/alert.js +22 -22
  5. package/autocomplete.js +126 -126
  6. package/breadcrumb/breadcrumb-group.js +60 -60
  7. package/breadcrumb/breadcrumb.js +17 -17
  8. package/calendar.js +423 -423
  9. package/card/card-badge.js +17 -17
  10. package/card/card.js +2 -2
  11. package/card/common.js +30 -30
  12. package/checkbox/checkbox-group.js +17 -17
  13. package/checkbox/checkbox.js +34 -34
  14. package/clock.js +83 -83
  15. package/container/sticky-bar.js +16 -16
  16. package/core/a11y.js +91 -91
  17. package/core/base-elements.js +86 -86
  18. package/core/controllers.js +40 -40
  19. package/core/datetime.js +32 -32
  20. package/core/dom.js +26 -26
  21. package/core/eventing.js +33 -33
  22. package/core/mixins.js +122 -122
  23. package/core/testing.js +29 -29
  24. package/datepicker/common.js +55 -55
  25. package/datepicker/datepicker-toggle.js +94 -94
  26. package/datepicker/datepicker.js +144 -144
  27. package/dialog/dialog-title.js +20 -20
  28. package/dialog/dialog.js +66 -66
  29. package/expansion-panel/expansion-panel-header.js +20 -20
  30. package/expansion-panel/expansion-panel.js +60 -60
  31. package/file-selector.js +91 -91
  32. package/form-field/form-field-clear.js +12 -12
  33. package/form-field/form-field.js +111 -111
  34. package/header/header.js +53 -53
  35. package/icon.js +107 -107
  36. package/image.js +87 -87
  37. package/journey-header.js +29 -29
  38. package/map-container.js +23 -23
  39. package/menu/menu.js +91 -91
  40. package/navigation/common.js +16 -16
  41. package/navigation/navigation-marker.js +34 -34
  42. package/navigation/navigation-section.js +83 -83
  43. package/navigation/navigation.js +87 -87
  44. package/notification.js +52 -52
  45. package/option/optgroup.js +45 -45
  46. package/option/option.js +108 -108
  47. package/overlay.js +5 -5
  48. package/package.json +1 -1
  49. package/popover/popover.js +110 -110
  50. package/radio-button/radio-button-group.js +93 -93
  51. package/radio-button/radio-button.js +84 -84
  52. package/select.js +178 -178
  53. package/selection-panel.js +44 -44
  54. package/slider.js +58 -58
  55. package/status.js +6 -6
  56. package/stepper/step-label.js +19 -19
  57. package/stepper/step.js +31 -31
  58. package/stepper/stepper.js +46 -46
  59. package/tabs/tab-group.js +67 -67
  60. package/tag/tag-group.js +8 -8
  61. package/tag/tag.js +27 -27
  62. package/teaser-paid.js +12 -12
  63. package/time-input.js +73 -73
  64. package/timetable-occupancy-icon.js +26 -26
  65. package/timetable-occupancy.js +9 -9
  66. package/toast.js +38 -38
  67. package/toggle/toggle-option.js +33 -33
  68. package/toggle/toggle.js +46 -46
  69. package/train/train-formation.js +36 -36
  70. package/train/train-wagon.js +30 -30
  71. package/train/train.js +13 -13
package/calendar.js CHANGED
@@ -1,148 +1,148 @@
1
- import { css as M, LitElement as z, isServer as Y, html as l, nothing as h } from "lit";
2
- import { property as f, state as p, customElement as D } from "lit/decorators.js";
3
- import { classMap as g } from "lit/directives/class-map.js";
4
- import { sbbInputModalityDetector as A, isArrowKeyOrPageKeysPressed as V } from "./core/a11y.js";
5
- import { SbbConnectedAbortController as O, SbbLanguageController as R } from "./core/controllers.js";
6
- import { defaultDateAdapter as I, YEARS_PER_PAGE as o, DAYS_PER_ROW as y, MONTHS_PER_ROW as _, YEARS_PER_ROW as v } from "./core/datetime.js";
7
- import { isBreakpoint as $ } from "./core/dom.js";
8
- import { EventEmitter as S } from "./core/eventing.js";
9
- import { i18nPreviousMonth as F, i18nNextMonth as W, i18nYearMonthSelection as N, i18nPreviousYear as E, i18nNextYear as P, i18nCalendarDateSelection as x, i18nPreviousYearRange as C, i18nNextYearRange as q } from "./core/i18n.js";
1
+ import { css as $, LitElement as Y, isServer as M, html as o, nothing as h } from "lit";
2
+ import { property as u, state as v, customElement as V } from "lit/decorators.js";
3
+ import { classMap as p } from "lit/directives/class-map.js";
4
+ import { sbbInputModalityDetector as k, isArrowKeyOrPageKeysPressed as F } from "./core/a11y.js";
5
+ import { SbbConnectedAbortController as z, SbbLanguageController as R } from "./core/controllers.js";
6
+ import { defaultDateAdapter as N, YEARS_PER_PAGE as l, DAYS_PER_ROW as y, MONTHS_PER_ROW as g, YEARS_PER_ROW as m } from "./core/datetime.js";
7
+ import { isBreakpoint as A } from "./core/dom.js";
8
+ import { EventEmitter as T } from "./core/eventing.js";
9
+ import { i18nPreviousMonth as I, i18nNextMonth as O, i18nYearMonthSelection as S, i18nPreviousYear as C, i18nNextYear as W, i18nCalendarDateSelection as x, i18nPreviousYearRange as E, i18nNextYearRange as L } from "./core/i18n.js";
10
10
  import "./button/secondary-button.js";
11
11
  import "./icon.js";
12
12
  import "./screen-reader-only.js";
13
- const L = M`*,:before,:after{box-sizing:border-box}:host{--sbb-calendar-cell-size: 2.5rem;--sbb-calendar-hover-shift: .0625rem;--sbb-calendar-wide-cell-size: 4.375rem;--sbb-calendar-cell-disabled-color: var(--sbb-color-granite);--sbb-calendar-header-color: var(--sbb-color-granite);--sbb-calendar-cell-background-color: transparent;--sbb-calendar-cell-padding: .125rem;--sbb-calendar-cell-color: var(--sbb-color-charcoal);--sbb-calendar-cell-selected-color: var(--sbb-color-white);--sbb-calendar-cell-selected-background-color: var(--sbb-color-charcoal);--sbb-calendar-cell-disabled-height: .09375rem;--sbb-calendar-cell-disabled-width: 1.59375rem;--sbb-calendar-cell-transition-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-2x) );--sbb-calendar-cell-transition-easing-function: var(--sbb-animation-easing);--sbb-calendar-tables-gap: var(--sbb-spacing-fixed-10x);--sbb-calendar-table-animation-shift: .00625rem;--sbb-calendar-table-animation-duration: .1ms;--sbb-calendar-table-column-spaces: 12;--sbb-calendar-control-view-change-height: 2.75rem;--sbb-calendar-control-view-change-color: var(--sbb-color-charcoal);--sbb-calendar-control-view-change-background: var(--sbb-color-white);display:block;width:max-content}@media (min-width: 22.5rem){:host{--sbb-calendar-cell-size: 2.75rem;--sbb-calendar-wide-cell-size: 4.8125rem;--sbb-calendar-control-view-change-height: 3rem}}.sbb-calendar__wrapper{width:100%;display:block;transition-duration:var(--sbb-calendar-cell-transition-duration)}.sbb-calendar__controls{width:100%;display:inline-flex;align-items:center;gap:var(--sbb-spacing-fixed-2x);margin-block-end:var(--sbb-spacing-fixed-4x)}.sbb-calendar__controls-month{width:100%;display:flex;gap:var(--sbb-calendar-tables-gap)}#sbb-calendar__controls-previous,#sbb-calendar__controls-next{-webkit-tap-highlight-color:transparent}.sbb-calendar__controls-change-date{-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;outline:none;border:none;border-radius:0;padding:0;background:none;-webkit-tap-highlight-color:transparent;color:inherit;--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);display:flex;align-items:center;margin:auto;height:var(--sbb-calendar-control-view-change-height);text-transform:capitalize;cursor:pointer;padding-inline:var(--sbb-spacing-fixed-5x) var(--sbb-spacing-fixed-2x);border-radius:var(--sbb-border-radius-infinity);background-color:var(--sbb-calendar-control-view-change-background);color:var(--sbb-calendar-control-view-change-color);transition-duration:var(--sbb-calendar-cell-transition-duration);transition-timing-function:var(--sbb-calendar-cell-transition-easing-function);transition-property:background-color,padding-block-end}.sbb-calendar__controls-change-date:disabled{--sbb-calendar-control-view-change-background: var(--sbb-color-milk);--sbb-calendar-control-view-change-color: var(--sbb-calendar-cell-disabled-color);cursor:unset}.sbb-calendar__controls-change-date:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch]){outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width);outline-offset:var(--sbb-spacing-fixed-1x)}@media (any-hover: hover){.sbb-calendar__controls-change-date:not(:active,:disabled):hover{padding-block-end:var(--sbb-calendar-hover-shift)}}.sbb-calendar__controls-change-date:not(:disabled):active{--sbb-calendar-control-view-change-background: var(--sbb-color-milk)}.sbb-calendar__table-month-view,.sbb-calendar__table-year-view{--sbb-calendar-table-column-spaces: 6}.sbb-calendar__table-container{display:flex;gap:var(--sbb-calendar-tables-gap);--sbb-calendar-min-width: calc(7 * var(--sbb-calendar-cell-size));--sbb-calendar-overflow: calc(100% - var(--sbb-calendar-min-width));--sbb-calendar-start-offset: min( 0px, -1 * (var(--sbb-calendar-overflow) / var(--sbb-calendar-table-column-spaces)) );--sbb-calendar-margin: var(--sbb-calendar-start-offset);margin-inline:var(--sbb-calendar-margin)}:host([data-wide]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc( 2 * 7 * var(--sbb-calendar-cell-size) + var(--sbb-calendar-tables-gap) );--sbb-calendar-margin: calc(.5 * var(--sbb-calendar-start-offset))}.sbb-calendar__table{width:100%;border-collapse:collapse;height:max-content;animation-name:show;animation-duration:var(--sbb-calendar-table-animation-duration)}.sbb-calendar__table.sbb-calendar__table-hide{--sbb-calendar-cell-transition-duration: 0ms;animation-name:hide;animation-duration:var(--sbb-calendar-table-animation-duration)}:host(:not([data-wide])) .sbb-calendar__table{min-width:100%}.sbb-calendar__table-header{--sbb-text-font-size: var(--sbb-font-size-text-xs);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);color:var(--sbb-calendar-header-color);width:var(--sbb-calendar-cell-size);padding:0;padding-block-end:var(--sbb-spacing-fixed-4x);text-align:center}.sbb-calendar__table-data{position:relative;padding:0;text-align:center}.sbb-calendar__cell{-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;margin:0;outline:none;border:none;border-radius:0;padding:0;background:none;-webkit-tap-highlight-color:transparent;color:inherit;--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);height:var(--sbb-calendar-cell-size);color:var(--sbb-calendar-cell-color);cursor:pointer;position:relative;z-index:0}.sbb-calendar__cell:before{content:"";position:absolute;inset:var(--sbb-calendar-cell-padding);background-color:var(--sbb-calendar-cell-background-color);border-radius:50%;z-index:-1;transition-duration:var(--sbb-calendar-cell-transition-duration);transition-timing-function:var(--sbb-calendar-cell-transition-easing-function);transition-property:background-color}@media (any-hover: hover){.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover{--sbb-calendar-cell-background-color: var(--sbb-color-milk);padding-block-end:var(--sbb-calendar-hover-shift)}}@media (any-hover: hover) and (forced-colors: active){.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}}.sbb-calendar__cell:disabled{--sbb-calendar-cell-color: var(--sbb-calendar-cell-disabled-color);cursor:unset}.sbb-calendar__cell:focus-visible:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active{--sbb-calendar-cell-background-color: var(--sbb-color-cloud)}@media (forced-colors: active){.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}}.sbb-calendar__day{border-radius:50%;width:var(--sbb-calendar-cell-size)}.sbb-calendar__day:before{border-radius:50%}.sbb-calendar__pill{width:var(--sbb-calendar-wide-cell-size);border-radius:var(--sbb-border-radius-infinity)}.sbb-calendar__pill:before{border-radius:var(--sbb-border-radius-infinity)}.sbb-calendar__crossed-out:after{content:"";height:var(--sbb-calendar-cell-disabled-height);width:var(--sbb-calendar-cell-disabled-width);position:absolute;background-color:var(--sbb-calendar-cell-disabled-color);top:50%;left:50%;transform:translate(-50%,-50%) rotate(-45deg)}.sbb-calendar__cell-current{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);font-weight:700}.sbb-calendar__selected{--sbb-calendar-cell-color: var(--sbb-calendar-cell-selected-color);--sbb-calendar-cell-background-color: var(--sbb-calendar-cell-selected-background-color)}@media (forced-colors: active){.sbb-calendar__selected{--sbb-calendar-cell-background-color: ButtonText !important}}@keyframes show{0%{opacity:0;transform:translateY(var(--sbb-calendar-table-animation-shift))}to{opacity:1;transform:translateY(0)}}@keyframes hide{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(var(--sbb-calendar-table-animation-shift))}}`;
14
- var B = Object.defineProperty, j = Object.getOwnPropertyDescriptor, d = (t, e, a, i) => {
15
- for (var s = i > 1 ? void 0 : i ? j(e, a) : e, r = t.length - 1, n; r >= 0; r--)
16
- (n = t[r]) && (s = (i ? n(e, a, s) : n(s)) || s);
17
- return i && s && B(e, a, s), s;
13
+ const P = $`*,:before,:after{box-sizing:border-box}:host{--sbb-calendar-cell-size: 2.5rem;--sbb-calendar-hover-shift: .0625rem;--sbb-calendar-wide-cell-size: 4.375rem;--sbb-calendar-cell-disabled-color: var(--sbb-color-granite);--sbb-calendar-header-color: var(--sbb-color-granite);--sbb-calendar-cell-background-color: transparent;--sbb-calendar-cell-padding: .125rem;--sbb-calendar-cell-color: var(--sbb-color-charcoal);--sbb-calendar-cell-selected-color: var(--sbb-color-white);--sbb-calendar-cell-selected-background-color: var(--sbb-color-charcoal);--sbb-calendar-cell-disabled-height: .09375rem;--sbb-calendar-cell-disabled-width: 1.59375rem;--sbb-calendar-cell-transition-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-2x) );--sbb-calendar-cell-transition-easing-function: var(--sbb-animation-easing);--sbb-calendar-tables-gap: var(--sbb-spacing-fixed-10x);--sbb-calendar-table-animation-shift: .00625rem;--sbb-calendar-table-animation-duration: .1ms;--sbb-calendar-table-column-spaces: 12;--sbb-calendar-control-view-change-height: 2.75rem;--sbb-calendar-control-view-change-color: var(--sbb-color-charcoal);--sbb-calendar-control-view-change-background: var(--sbb-color-white);display:block;width:max-content}@media (min-width: 22.5rem){:host{--sbb-calendar-cell-size: 2.75rem;--sbb-calendar-wide-cell-size: 4.8125rem;--sbb-calendar-control-view-change-height: 3rem}}.sbb-calendar__wrapper{width:100%;display:block;transition-duration:var(--sbb-calendar-cell-transition-duration)}.sbb-calendar__controls{width:100%;display:inline-flex;align-items:center;gap:var(--sbb-spacing-fixed-2x);margin-block-end:var(--sbb-spacing-fixed-4x)}.sbb-calendar__controls-month{width:100%;display:flex;gap:var(--sbb-calendar-tables-gap)}#sbb-calendar__controls-previous,#sbb-calendar__controls-next{-webkit-tap-highlight-color:transparent}.sbb-calendar__controls-change-date{-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;outline:none;border:none;border-radius:0;padding:0;background:none;-webkit-tap-highlight-color:transparent;color:inherit;--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);display:flex;align-items:center;margin:auto;height:var(--sbb-calendar-control-view-change-height);text-transform:capitalize;cursor:pointer;padding-inline:var(--sbb-spacing-fixed-5x) var(--sbb-spacing-fixed-2x);border-radius:var(--sbb-border-radius-infinity);background-color:var(--sbb-calendar-control-view-change-background);color:var(--sbb-calendar-control-view-change-color);transition-duration:var(--sbb-calendar-cell-transition-duration);transition-timing-function:var(--sbb-calendar-cell-transition-easing-function);transition-property:background-color,padding-block-end}.sbb-calendar__controls-change-date:disabled{--sbb-calendar-control-view-change-background: var(--sbb-color-milk);--sbb-calendar-control-view-change-color: var(--sbb-calendar-cell-disabled-color);cursor:unset}.sbb-calendar__controls-change-date:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch]){outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width);outline-offset:var(--sbb-spacing-fixed-1x)}@media (any-hover: hover){.sbb-calendar__controls-change-date:not(:active,:disabled):hover{padding-block-end:var(--sbb-calendar-hover-shift)}}.sbb-calendar__controls-change-date:not(:disabled):active{--sbb-calendar-control-view-change-background: var(--sbb-color-milk)}.sbb-calendar__table-month-view,.sbb-calendar__table-year-view{--sbb-calendar-table-column-spaces: 6}.sbb-calendar__table-container{display:flex;gap:var(--sbb-calendar-tables-gap);--sbb-calendar-min-width: calc(7 * var(--sbb-calendar-cell-size));--sbb-calendar-overflow: calc(100% - var(--sbb-calendar-min-width));--sbb-calendar-start-offset: min( 0px, -1 * (var(--sbb-calendar-overflow) / var(--sbb-calendar-table-column-spaces)) );--sbb-calendar-margin: var(--sbb-calendar-start-offset);margin-inline:var(--sbb-calendar-margin)}:host([data-wide]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc( 2 * 7 * var(--sbb-calendar-cell-size) + var(--sbb-calendar-tables-gap) );--sbb-calendar-margin: calc(.5 * var(--sbb-calendar-start-offset))}.sbb-calendar__table{width:100%;border-collapse:collapse;height:max-content;animation-name:show;animation-duration:var(--sbb-calendar-table-animation-duration)}.sbb-calendar__table.sbb-calendar__table-hide{--sbb-calendar-cell-transition-duration: 0ms;animation-name:hide;animation-duration:var(--sbb-calendar-table-animation-duration)}:host(:not([data-wide])) .sbb-calendar__table{min-width:100%}.sbb-calendar__table-header{--sbb-text-font-size: var(--sbb-font-size-text-xs);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);color:var(--sbb-calendar-header-color);width:var(--sbb-calendar-cell-size);padding:0;padding-block-end:var(--sbb-spacing-fixed-4x);text-align:center}.sbb-calendar__table-data{position:relative;padding:0;text-align:center}.sbb-calendar__cell{-webkit-appearance:none;-moz-appearance:none;box-sizing:border-box;margin:0;outline:none;border:none;border-radius:0;padding:0;background:none;-webkit-tap-highlight-color:transparent;color:inherit;--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);height:var(--sbb-calendar-cell-size);color:var(--sbb-calendar-cell-color);cursor:pointer;position:relative;z-index:0}.sbb-calendar__cell:before{content:"";position:absolute;inset:var(--sbb-calendar-cell-padding);background-color:var(--sbb-calendar-cell-background-color);border-radius:50%;z-index:-1;transition-duration:var(--sbb-calendar-cell-transition-duration);transition-timing-function:var(--sbb-calendar-cell-transition-easing-function);transition-property:background-color}@media (any-hover: hover){.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover{--sbb-calendar-cell-background-color: var(--sbb-color-milk);padding-block-end:var(--sbb-calendar-hover-shift)}}@media (any-hover: hover) and (forced-colors: active){.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}}.sbb-calendar__cell:disabled{--sbb-calendar-cell-color: var(--sbb-calendar-cell-disabled-color);cursor:unset}.sbb-calendar__cell:focus-visible:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active{--sbb-calendar-cell-background-color: var(--sbb-color-cloud)}@media (forced-colors: active){.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}}.sbb-calendar__day{border-radius:50%;width:var(--sbb-calendar-cell-size)}.sbb-calendar__day:before{border-radius:50%}.sbb-calendar__pill{width:var(--sbb-calendar-wide-cell-size);border-radius:var(--sbb-border-radius-infinity)}.sbb-calendar__pill:before{border-radius:var(--sbb-border-radius-infinity)}.sbb-calendar__crossed-out:after{content:"";height:var(--sbb-calendar-cell-disabled-height);width:var(--sbb-calendar-cell-disabled-width);position:absolute;background-color:var(--sbb-calendar-cell-disabled-color);top:50%;left:50%;transform:translate(-50%,-50%) rotate(-45deg)}.sbb-calendar__cell-current{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);font-weight:700}.sbb-calendar__selected{--sbb-calendar-cell-color: var(--sbb-calendar-cell-selected-color);--sbb-calendar-cell-background-color: var(--sbb-calendar-cell-selected-background-color)}@media (forced-colors: active){.sbb-calendar__selected{--sbb-calendar-cell-background-color: ButtonText !important}}@keyframes show{0%{opacity:0;transform:translateY(var(--sbb-calendar-table-animation-shift))}to{opacity:1;transform:translateY(0)}}@keyframes hide{0%{opacity:1;transform:translateY(0)}to{opacity:0;transform:translateY(var(--sbb-calendar-table-animation-shift))}}`;
14
+ var B = Object.defineProperty, K = Object.getOwnPropertyDescriptor, b = (e, t, a, r) => {
15
+ for (var s = r > 1 ? void 0 : r ? K(t, a) : t, i = e.length - 1, n; i >= 0; i--)
16
+ (n = e[i]) && (s = (r ? n(t, a, s) : n(s)) || s);
17
+ return r && s && B(t, a, s), s;
18
18
  };
19
- let c = class extends z {
19
+ let c = class extends Y {
20
20
  constructor() {
21
- super(), this.wide = !1, this.B = null, this.a = I, this.W = new S(
21
+ super(), this.wide = !1, this._now = null, this._dateAdapter = N, this._dateSelected = new T(
22
22
  this,
23
23
  c.events.dateSelected
24
- ), this.b = this.now, this.q = "day", this.o = "day", this.F = [], this.r = this.a.getMonthNames("long"), this.l = !1, this.G = !1, this.Y = new O(this), this.h = new R(this).withHandler(() => {
25
- this.r = this.a.getMonthNames("long"), this.H();
26
- }), this.H(), this.Z();
24
+ ), this._activeDate = this.now, this._calendarView = "day", this._nextCalendarView = "day", this._weeks = [], this._monthNames = this._dateAdapter.getMonthNames("long"), this._resetFocus = !1, this._initialized = !1, this._abort = new z(this), this._language = new R(this).withHandler(() => {
25
+ this._monthNames = this._dateAdapter.getMonthNames("long"), this._createMonthRows();
26
+ }), this._createMonthRows(), this._setWeekdays();
27
27
  }
28
- set min(t) {
29
- this.c = this.a.getValidDateOrNull(this.a.deserialize(t));
28
+ set min(e) {
29
+ this._min = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e));
30
30
  }
31
31
  get min() {
32
- return this.c ?? null;
32
+ return this._min ?? null;
33
33
  }
34
- set max(t) {
35
- this.d = this.a.getValidDateOrNull(this.a.deserialize(t));
34
+ set max(e) {
35
+ this._max = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e));
36
36
  }
37
37
  get max() {
38
- return this.d ?? null;
38
+ return this._max ?? null;
39
39
  }
40
- set now(t) {
41
- this.B = this.a.getValidDateOrNull(this.a.deserialize(t));
40
+ set now(e) {
41
+ this._now = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e));
42
42
  }
43
43
  get now() {
44
- return this.B ?? this.a.today();
44
+ return this._now ?? this._dateAdapter.today();
45
45
  }
46
- set selected(t) {
47
- this.j = this.a.getValidDateOrNull(this.a.deserialize(t)), this.j && (!this.C(this.a.toIso8601(this.j)) || this.D(this.j)) ? this.e = this.a.toIso8601(this.j) : this.e = void 0;
46
+ set selected(e) {
47
+ this._selectedDate = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(e)), this._selectedDate && (!this._isDayInRange(this._dateAdapter.toIso8601(this._selectedDate)) || this._dateFilter(this._selectedDate)) ? this._selected = this._dateAdapter.toIso8601(this._selectedDate) : this._selected = void 0;
48
48
  }
49
49
  get selected() {
50
- return this.j ?? null;
50
+ return this._selectedDate ?? null;
51
51
  }
52
- set g(t) {
53
- this.toggleAttribute("data-wide", t);
52
+ set _wide(e) {
53
+ this.toggleAttribute("data-wide", e);
54
54
  }
55
- get g() {
55
+ get _wide() {
56
56
  return this.hasAttribute("data-wide");
57
57
  }
58
58
  /** A list of buttons corresponding to days, months or years depending on the view. */
59
- get X() {
59
+ get _cells() {
60
60
  return Array.from(
61
61
  this.shadowRoot.querySelectorAll(".sbb-calendar__cell") ?? []
62
62
  );
63
63
  }
64
- get D() {
64
+ get _dateFilter() {
65
65
  return this.dateFilter ?? (() => !0);
66
66
  }
67
67
  /** Resets the active month according to the new state of the calendar. */
68
68
  resetPosition() {
69
- this.q !== "day" && this.w(), this.b = this.selected ?? this.now, this.m();
69
+ this._calendarView !== "day" && this._resetToDayView(), this._activeDate = this.selected ?? this.now, this._init();
70
70
  }
71
71
  connectedCallback() {
72
- var t;
72
+ var e;
73
73
  super.connectedCallback(), this.resetPosition(), this.focus = () => {
74
- this.l = !0, this.I();
75
- }, (t = globalThis.window) == null || t.addEventListener("resize", () => this.m(), {
74
+ this._resetFocus = !0, this._focusCell();
75
+ }, (e = globalThis.window) == null || e.addEventListener("resize", () => this._init(), {
76
76
  passive: !0,
77
- signal: this.Y.signal
77
+ signal: this._abort.signal
78
78
  });
79
79
  }
80
- willUpdate(t) {
81
- super.willUpdate(t), this.G && t.has("wide") && this.resetPosition();
80
+ willUpdate(e) {
81
+ super.willUpdate(e), this._initialized && e.has("wide") && this.resetPosition();
82
82
  }
83
- updated(t) {
84
- super.updated(t), this.J(), A.mostRecentModality === "keyboard" && this.I();
83
+ updated(e) {
84
+ super.updated(e), this._setTabIndex(), k.mostRecentModality === "keyboard" && this._focusCell();
85
85
  }
86
86
  /** Initializes the component. */
87
- m(t) {
88
- if (!Y) {
89
- if (t && this.K(t), this.g = $("medium") && this.wide, this.F = this.L(this.b), this.k = this.M(), this.v = [[]], this.p = [[]], this.g) {
90
- const e = this.a.addCalendarMonths(this.b, 1);
91
- this.v = this.L(e), this.p = this.M(o);
87
+ _init(e) {
88
+ if (!M) {
89
+ if (e && this._assignActiveDate(e), this._wide = A("medium") && this.wide, this._weeks = this._createWeekRows(this._activeDate), this._years = this._createYearRows(), this._nextMonthWeeks = [[]], this._nextMonthYears = [[]], this._wide) {
90
+ const t = this._dateAdapter.addCalendarMonths(this._activeDate, 1);
91
+ this._nextMonthWeeks = this._createWeekRows(t), this._nextMonthYears = this._createYearRows(l);
92
92
  }
93
- this.G = !0;
93
+ this._initialized = !0;
94
94
  }
95
95
  }
96
96
  /** Focuses on a day cell prioritizing the selected day, the current day, and lastly, the first selectable day. */
97
- I() {
98
- var t;
99
- this.l && ((t = this.N()) == null || t.focus(), this.l = !1);
97
+ _focusCell() {
98
+ var e;
99
+ this._resetFocus && ((e = this._getFirstFocusable()) == null || e.focus(), this._resetFocus = !1);
100
100
  }
101
101
  /** Creates the array of weekdays. */
102
- Z() {
103
- const t = this.a.getDayOfWeekNames("narrow"), a = this.a.getDayOfWeekNames("long").map((s, r) => ({
102
+ _setWeekdays() {
103
+ const e = this._dateAdapter.getDayOfWeekNames("narrow"), a = this._dateAdapter.getDayOfWeekNames("long").map((s, i) => ({
104
104
  long: s,
105
- narrow: t[r]
106
- })), i = this.a.getFirstDayOfWeek();
107
- this.E = a.slice(i).concat(a.slice(0, i));
105
+ narrow: e[i]
106
+ })), r = this._dateAdapter.getFirstDayOfWeek();
107
+ this._weekdays = a.slice(r).concat(a.slice(0, r));
108
108
  }
109
109
  /** Creates the rows for each week. */
110
- L(t) {
111
- const e = this.a.getNumDaysInMonth(t), a = this.a.getDateNames(), i = [[]], s = this.a.getFirstWeekOffset(t);
112
- for (let r = 0, n = s; r < e; r++, n++) {
113
- n === y && (i.push([]), n = 0);
114
- const b = this.a.createDate(
115
- this.a.getYear(t),
116
- this.a.getMonth(t),
117
- r + 1
110
+ _createWeekRows(e) {
111
+ const t = this._dateAdapter.getNumDaysInMonth(e), a = this._dateAdapter.getDateNames(), r = [[]], s = this._dateAdapter.getFirstWeekOffset(e);
112
+ for (let i = 0, n = s; i < t; i++, n++) {
113
+ n === y && (r.push([]), n = 0);
114
+ const d = this._dateAdapter.createDate(
115
+ this._dateAdapter.getYear(e),
116
+ this._dateAdapter.getMonth(e),
117
+ i + 1
118
118
  );
119
- i[i.length - 1].push({
120
- value: this.a.toIso8601(b),
121
- dayValue: a[r],
122
- monthValue: String(this.a.getMonth(b)),
123
- yearValue: String(this.a.getYear(b))
119
+ r[r.length - 1].push({
120
+ value: this._dateAdapter.toIso8601(d),
121
+ dayValue: a[i],
122
+ monthValue: String(this._dateAdapter.getMonth(d)),
123
+ yearValue: String(this._dateAdapter.getYear(d))
124
124
  });
125
125
  }
126
- return i;
126
+ return r;
127
127
  }
128
128
  /** Creates the rows for the month selection view. */
129
- H() {
130
- const t = this.a.getMonthNames("short"), e = new Array(12).fill(null).map(
131
- (s, r) => ({
132
- value: t[r],
133
- longValue: this.r[r],
134
- monthValue: r + 1
129
+ _createMonthRows() {
130
+ const e = this._dateAdapter.getMonthNames("short"), t = new Array(12).fill(null).map(
131
+ (s, i) => ({
132
+ value: e[i],
133
+ longValue: this._monthNames[i],
134
+ monthValue: i + 1
135
135
  })
136
- ), a = 12 / _, i = [];
136
+ ), a = 12 / g, r = [];
137
137
  for (let s = 0; s < a; s++)
138
- i.push(e.slice(_ * s, _ * (s + 1)));
139
- this.u = i;
138
+ r.push(t.slice(g * s, g * (s + 1)));
139
+ this._months = r;
140
140
  }
141
141
  /** Creates the rows for the year selection view. */
142
- M(t = 0) {
143
- const e = this._(), a = new Array(o).fill(0).map((r, n) => e + t + n), i = o / v, s = [];
144
- for (let r = 0; r < i; r++)
145
- s.push(a.slice(v * r, v * (r + 1)));
142
+ _createYearRows(e = 0) {
143
+ const t = this._getStartValueYearView(), a = new Array(l).fill(0).map((i, n) => t + e + n), r = l / m, s = [];
144
+ for (let i = 0; i < r; i++)
145
+ s.push(a.slice(m * i, m * (i + 1)));
146
146
  return s;
147
147
  }
148
148
  /**
@@ -155,150 +155,150 @@ let c = class extends z {
155
155
  * it returns the corresponding year minus `YEARS_PER_PAGE`, so that the `maxDate` is the last rendered year.
156
156
  * If both are not null, `maxDate` has priority over `minDate`.
157
157
  */
158
- _() {
159
- let t = 0;
160
- this.max ? t = this.a.getYear(this.max) - o + 1 : this.min && (t = this.a.getYear(this.min));
161
- const e = this.a.getYear(this.b);
162
- return e - ((e - t) % o + o) % o;
158
+ _getStartValueYearView() {
159
+ let e = 0;
160
+ this.max ? e = this._dateAdapter.getYear(this.max) - l + 1 : this.min && (e = this._dateAdapter.getYear(this.min));
161
+ const t = this._dateAdapter.getYear(this._activeDate);
162
+ return t - ((t - e) % l + l) % l;
163
163
  }
164
164
  /** Checks if date is within the min-max range. */
165
- C(t) {
166
- if (!this.c && !this.d)
165
+ _isDayInRange(e) {
166
+ if (!this._min && !this._max)
167
167
  return !0;
168
- const e = this.a.isValid(this.c) && this.a.compareDate(this.c, this.a.deserialize(t)) > 0, a = this.a.isValid(this.d) && this.a.compareDate(this.d, this.a.deserialize(t)) < 0;
169
- return !(e || a);
168
+ const t = this._dateAdapter.isValid(this._min) && this._dateAdapter.compareDate(this._min, this._dateAdapter.deserialize(e)) > 0, a = this._dateAdapter.isValid(this._max) && this._dateAdapter.compareDate(this._max, this._dateAdapter.deserialize(e)) < 0;
169
+ return !(t || a);
170
170
  }
171
- $(t) {
172
- if (!this.c && !this.d)
171
+ _isMonthInRange(e) {
172
+ if (!this._min && !this._max)
173
173
  return !0;
174
- const e = this.a.isValid(this.c) && this.a.getYear(this.c) >= this.f && this.a.getMonth(this.c) > t, a = this.a.isValid(this.d) && this.a.getYear(this.d) <= this.f && this.a.getMonth(this.d) < t;
175
- return !(e || a);
174
+ const t = this._dateAdapter.isValid(this._min) && this._dateAdapter.getYear(this._min) >= this._chosenYear && this._dateAdapter.getMonth(this._min) > e, a = this._dateAdapter.isValid(this._max) && this._dateAdapter.getYear(this._max) <= this._chosenYear && this._dateAdapter.getMonth(this._max) < e;
175
+ return !(t || a);
176
176
  }
177
- aa(t) {
178
- if (!this.c && !this.d)
177
+ _isYearInRange(e) {
178
+ if (!this._min && !this._max)
179
179
  return !0;
180
- const e = this.a.isValid(this.c) && this.a.getYear(this.c) > t, a = this.a.isValid(this.d) && this.a.getYear(this.d) < t;
181
- return !(e || a);
180
+ const t = this._dateAdapter.isValid(this._min) && this._dateAdapter.getYear(this._min) > e, a = this._dateAdapter.isValid(this._max) && this._dateAdapter.getYear(this._max) < e;
181
+ return !(t || a);
182
182
  }
183
183
  // Implementation adapted from https://github.com/angular/components/blob/main/src/material/datepicker/year-view.ts#L366
184
- ba(t) {
184
+ _isMonthFilteredOut(e) {
185
185
  if (!this.dateFilter)
186
186
  return !0;
187
- const e = this.a.createDate(this.f, t, 1);
188
- for (let a = e; this.a.getMonth(a) == t; a = this.a.addCalendarDays(a, 1))
187
+ const t = this._dateAdapter.createDate(this._chosenYear, e, 1);
188
+ for (let a = t; this._dateAdapter.getMonth(a) == e; a = this._dateAdapter.addCalendarDays(a, 1))
189
189
  if (this.dateFilter(a))
190
190
  return !0;
191
191
  return !1;
192
192
  }
193
193
  // Implementation adapted from https://github.com/angular/components/blob/main/src/material/datepicker/multi-year-view.ts#L351
194
- ca(t) {
194
+ _isYearFilteredOut(e) {
195
195
  if (!this.dateFilter)
196
196
  return !0;
197
- const e = this.a.createDate(t, 1, 1);
198
- for (let a = e; this.a.getYear(a) == t; a = this.a.addCalendarDays(a, 1))
197
+ const t = this._dateAdapter.createDate(e, 1, 1);
198
+ for (let a = t; this._dateAdapter.getYear(a) == e; a = this._dateAdapter.addCalendarDays(a, 1))
199
199
  if (this.dateFilter(a))
200
200
  return !0;
201
201
  return !1;
202
202
  }
203
203
  /** Emits the selected date and sets it internally. */
204
- da(t) {
205
- this.s = void 0, this.f = void 0, this.e !== t && (this.e = t, this.W.emit(this.a.deserialize(t)));
204
+ _selectDate(e) {
205
+ this._chosenMonth = void 0, this._chosenYear = void 0, this._selected !== e && (this._selected = e, this._dateSelected.emit(this._dateAdapter.deserialize(e)));
206
206
  }
207
- K(t) {
208
- if (this.c && this.a.compareDate(this.c, t) > 0) {
209
- this.b = this.c;
207
+ _assignActiveDate(e) {
208
+ if (this._min && this._dateAdapter.compareDate(this._min, e) > 0) {
209
+ this._activeDate = this._min;
210
210
  return;
211
211
  }
212
- if (this.d && this.a.compareDate(this.d, t) < 0) {
213
- this.b = this.d;
212
+ if (this._max && this._dateAdapter.compareDate(this._max, e) < 0) {
213
+ this._activeDate = this._max;
214
214
  return;
215
215
  }
216
- this.b = t;
216
+ this._activeDate = e;
217
217
  }
218
218
  /** Goes to the month identified by the shift. */
219
- O(t) {
220
- this.m(this.a.addCalendarMonths(this.b, t));
219
+ _goToDifferentMonth(e) {
220
+ this._init(this._dateAdapter.addCalendarMonths(this._activeDate, e));
221
221
  }
222
- P(t) {
223
- this.f += t, this.b = this.a.createDate(
224
- this.f,
225
- this.a.getMonth(this.b),
226
- this.a.getDate(this.b)
227
- ), this.m();
222
+ _goToDifferentYear(e) {
223
+ this._chosenYear += e, this._activeDate = this._dateAdapter.createDate(
224
+ this._chosenYear,
225
+ this._dateAdapter.getMonth(this._activeDate),
226
+ this._dateAdapter.getDate(this._activeDate)
227
+ ), this._init();
228
228
  }
229
- Q(t) {
230
- this.m(this.a.addCalendarYears(this.b, t));
229
+ _goToDifferentYearRange(e) {
230
+ this._init(this._dateAdapter.addCalendarYears(this._activeDate, e));
231
231
  }
232
- x(t) {
233
- return this.c ? this.a.compareDate(t, this.c) < 0 : !1;
232
+ _prevDisabled(e) {
233
+ return this._min ? this._dateAdapter.compareDate(e, this._min) < 0 : !1;
234
234
  }
235
- y(t) {
236
- return this.d ? this.a.compareDate(t, this.d) > 0 : !1;
235
+ _nextDisabled(e) {
236
+ return this._max ? this._dateAdapter.compareDate(e, this._max) > 0 : !1;
237
237
  }
238
238
  /** Checks if the "previous month" button should be disabled. */
239
- ea() {
240
- const t = this.a.addCalendarDays(
241
- this.b,
242
- this.a.getDate(this.b) * -1
239
+ _previousMonthDisabled() {
240
+ const e = this._dateAdapter.addCalendarDays(
241
+ this._activeDate,
242
+ this._dateAdapter.getDate(this._activeDate) * -1
243
243
  );
244
- return this.x(t);
244
+ return this._prevDisabled(e);
245
245
  }
246
246
  /** Checks if the "next month" button should be disabled. */
247
- fa() {
248
- let t = this.a.addCalendarMonths(this.b, this.g ? 2 : 1);
249
- return t = this.a.createDate(
250
- this.a.getYear(t),
251
- this.a.getMonth(t),
247
+ _nextMonthDisabled() {
248
+ let e = this._dateAdapter.addCalendarMonths(this._activeDate, this._wide ? 2 : 1);
249
+ return e = this._dateAdapter.createDate(
250
+ this._dateAdapter.getYear(e),
251
+ this._dateAdapter.getMonth(e),
252
252
  1
253
- ), this.y(t);
253
+ ), this._nextDisabled(e);
254
254
  }
255
- ga() {
256
- const t = this.a.createDate(
257
- this.a.getYear(this.b) - 1,
255
+ _previousYearDisabled() {
256
+ const e = this._dateAdapter.createDate(
257
+ this._dateAdapter.getYear(this._activeDate) - 1,
258
258
  12,
259
259
  31
260
260
  );
261
- return this.x(t);
261
+ return this._prevDisabled(e);
262
262
  }
263
- ha() {
264
- const t = this.a.createDate(
265
- this.a.getYear(this.b) + 1,
263
+ _nextYearDisabled() {
264
+ const e = this._dateAdapter.createDate(
265
+ this._dateAdapter.getYear(this._activeDate) + 1,
266
266
  1,
267
267
  1
268
268
  );
269
- return this.y(t);
269
+ return this._nextDisabled(e);
270
270
  }
271
- ia() {
272
- const t = this.a.createDate(this.k[0][0] - 1, 12, 31);
273
- return this.x(t);
271
+ _previousYearRangeDisabled() {
272
+ const e = this._dateAdapter.createDate(this._years[0][0] - 1, 12, 31);
273
+ return this._prevDisabled(e);
274
274
  }
275
- ja() {
276
- const t = $("medium") && this.wide ? this.p : this.k, e = t[t.length - 1], a = e[e.length - 1], i = this.a.createDate(a + 1, 1, 1);
277
- return this.y(i);
275
+ _nextYearRangeDisabled() {
276
+ const e = A("medium") && this.wide ? this._nextMonthYears : this._years, t = e[e.length - 1], a = t[t.length - 1], r = this._dateAdapter.createDate(a + 1, 1, 1);
277
+ return this._nextDisabled(r);
278
278
  }
279
- ka(t) {
280
- (t == null ? void 0 : t.localName) !== "button" && this.J();
279
+ _handleTableBlur(e) {
280
+ (e == null ? void 0 : e.localName) !== "button" && this._setTabIndex();
281
281
  }
282
- J() {
282
+ _setTabIndex() {
283
283
  Array.from(
284
284
  this.shadowRoot.querySelectorAll('.sbb-calendar__cell[tabindex="0"]') ?? []
285
- ).forEach((e) => e.tabIndex = -1);
286
- const t = this.N();
287
- t && (t.tabIndex = 0);
288
- }
289
- N() {
290
- const t = this.e ? this.a.deserialize(this.e) : this.now;
291
- let e = this.shadowRoot.querySelector(".sbb-calendar__selected") ?? this.shadowRoot.querySelector(
292
- `[data-day="${this.a.getDate(t)} ${this.a.getMonth(
293
- t
294
- )} ${this.a.getYear(t)}"]`
295
- ) ?? this.shadowRoot.querySelector(`[data-month="${this.a.getMonth(t)}"]`) ?? this.shadowRoot.querySelector(`[data-year="${this.a.getYear(t)}"]`);
296
- return (!e || e != null && e.disabled) && (e = this.shadowRoot.querySelector(".sbb-calendar__cell:not([disabled])")), e || null;
297
- }
298
- z(t, e) {
299
- V(t) && t.preventDefault();
300
- const a = this.X, i = a.findIndex((n) => n === t.target), s = this.la(t, i, a, e), r = this.shadowRoot.activeElement;
301
- s !== r && (s.tabIndex = 0, s == null || s.focus(), r.tabIndex = -1);
285
+ ).forEach((t) => t.tabIndex = -1);
286
+ const e = this._getFirstFocusable();
287
+ e && (e.tabIndex = 0);
288
+ }
289
+ _getFirstFocusable() {
290
+ const e = this._selected ? this._dateAdapter.deserialize(this._selected) : this.now;
291
+ let t = this.shadowRoot.querySelector(".sbb-calendar__selected") ?? this.shadowRoot.querySelector(
292
+ `[data-day="${this._dateAdapter.getDate(e)} ${this._dateAdapter.getMonth(
293
+ e
294
+ )} ${this._dateAdapter.getYear(e)}"]`
295
+ ) ?? this.shadowRoot.querySelector(`[data-month="${this._dateAdapter.getMonth(e)}"]`) ?? this.shadowRoot.querySelector(`[data-year="${this._dateAdapter.getYear(e)}"]`);
296
+ return (!t || t != null && t.disabled) && (t = this.shadowRoot.querySelector(".sbb-calendar__cell:not([disabled])")), t || null;
297
+ }
298
+ _handleKeyboardEvent(e, t) {
299
+ F(e) && e.preventDefault();
300
+ const a = this._cells, r = a.findIndex((n) => n === e.target), s = this._navigateByKeyboard(e, r, a, t), i = this.shadowRoot.activeElement;
301
+ s !== i && (s.tabIndex = 0, s == null || s.focus(), i.tabIndex = -1);
302
302
  }
303
303
  /**
304
304
  * Gets the index of the element to move to, based on a list of elements (which can be potentially disabled),
@@ -306,41 +306,41 @@ let c = class extends z {
306
306
  * In the day view, the `day?: Day` parameter is mandatory for calculation,
307
307
  * while in month and year view it's not due to the fixed amount of rendered cells.
308
308
  */
309
- la(t, e, a, i) {
309
+ _navigateByKeyboard(e, t, a, r) {
310
310
  const {
311
311
  elementIndexForWideMode: s,
312
- offsetForWideMode: r,
312
+ offsetForWideMode: i,
313
313
  lastElementIndexForWideMode: n,
314
- verticalOffset: b
315
- } = this.ma(
314
+ verticalOffset: d
315
+ } = this._calculateParametersForKeyboardNavigation(
316
316
  a,
317
- e,
318
- i
317
+ t,
318
+ r
319
319
  );
320
- switch (t.key) {
320
+ switch (e.key) {
321
321
  case "ArrowUp":
322
- return this.i(a, e, -b);
322
+ return this._findNext(a, t, -d);
323
323
  case "ArrowDown":
324
- return this.i(a, e, b);
324
+ return this._findNext(a, t, d);
325
325
  case "ArrowLeft":
326
- return this.i(a, e, -1);
326
+ return this._findNext(a, t, -1);
327
327
  case "ArrowRight":
328
- return this.i(a, e, 1);
328
+ return this._findNext(a, t, 1);
329
329
  case "Home":
330
- return this.na(a, r);
330
+ return this._findFirst(a, i);
331
331
  case "PageUp":
332
- return this.oa(
332
+ return this._findFirstOnColumn(
333
333
  a,
334
334
  s,
335
- r,
336
- b
335
+ i,
336
+ d
337
337
  );
338
338
  case "PageDown":
339
- return this.pa(a, e, n, b);
339
+ return this._findLastOnColumn(a, t, n, d);
340
340
  case "End":
341
- return this.qa(a, n - 1);
341
+ return this._findLast(a, n - 1);
342
342
  default:
343
- return a[e];
343
+ return a[t];
344
344
  }
345
345
  }
346
346
  /**
@@ -351,36 +351,36 @@ let c = class extends z {
351
351
  * @param index The starting element's index in the cell array.
352
352
  * @param day (optional) Only in the day view, the day represented by the starting cell.
353
353
  */
354
- ma(t, e, a) {
355
- switch (this.q) {
354
+ _calculateParametersForKeyboardNavigation(e, t, a) {
355
+ switch (this._calendarView) {
356
356
  case "day": {
357
- const i = +a.dayValue - 1;
357
+ const r = +a.dayValue - 1;
358
358
  return {
359
359
  verticalOffset: y,
360
- elementIndexForWideMode: i,
361
- offsetForWideMode: e - i,
362
- lastElementIndexForWideMode: e === i ? this.a.getNumDaysInMonth(
363
- this.a.addCalendarMonths(
364
- this.a.deserialize(a.value),
360
+ elementIndexForWideMode: r,
361
+ offsetForWideMode: t - r,
362
+ lastElementIndexForWideMode: t === r ? this._dateAdapter.getNumDaysInMonth(
363
+ this._dateAdapter.addCalendarMonths(
364
+ this._dateAdapter.deserialize(a.value),
365
365
  -1
366
366
  )
367
- ) : t.length
367
+ ) : e.length
368
368
  };
369
369
  }
370
370
  case "month":
371
371
  return {
372
- verticalOffset: _,
373
- elementIndexForWideMode: e,
372
+ verticalOffset: g,
373
+ elementIndexForWideMode: t,
374
374
  offsetForWideMode: 0,
375
375
  lastElementIndexForWideMode: 12
376
376
  };
377
377
  case "year": {
378
- const i = Math.trunc(e / o) * o, s = i === 0 ? e : e - o;
378
+ const r = Math.trunc(t / l) * l, s = r === 0 ? t : t - l;
379
379
  return {
380
- verticalOffset: v,
380
+ verticalOffset: m,
381
381
  elementIndexForWideMode: s,
382
- offsetForWideMode: e - s,
383
- lastElementIndexForWideMode: i === 0 ? o : o * 2
382
+ offsetForWideMode: t - s,
383
+ lastElementIndexForWideMode: r === 0 ? l : l * 2
384
384
  };
385
385
  }
386
386
  }
@@ -389,168 +389,168 @@ let c = class extends z {
389
389
  * Gets the next element of the provided array starting from `index` by adding `delta`.
390
390
  * If the found element is disabled, it continues adding `delta` until it finds an enabled one in the array bounds.
391
391
  */
392
- i(t, e, a) {
392
+ _findNext(e, t, a) {
393
393
  var s;
394
- let i = e + a;
395
- for (; i < t.length && ((s = t[i]) != null && s.disabled); )
396
- i += a;
397
- return t[i] ?? t[e];
394
+ let r = t + a;
395
+ for (; r < e.length && ((s = e[r]) != null && s.disabled); )
396
+ r += a;
397
+ return e[r] ?? e[t];
398
398
  }
399
399
  /** Find the first enabled element in the provided array. */
400
- na(t, e) {
401
- return t[e].disabled ? this.i(t, e, 1) : t[e];
400
+ _findFirst(e, t) {
401
+ return e[t].disabled ? this._findNext(e, t, 1) : e[t];
402
402
  }
403
403
  /** Find the last enabled element in the provided array. */
404
- qa(t, e) {
405
- return t[e].disabled ? this.i(t, e, -1) : t[e];
404
+ _findLast(e, t) {
405
+ return e[t].disabled ? this._findNext(e, t, -1) : e[t];
406
406
  }
407
407
  /** Find the first enabled element in the same column of the provided array. */
408
- oa(t, e, a, i) {
409
- const s = e % i + a;
410
- return t[s].disabled ? this.i(t, s, i) : t[s];
408
+ _findFirstOnColumn(e, t, a, r) {
409
+ const s = t % r + a;
410
+ return e[s].disabled ? this._findNext(e, s, r) : e[s];
411
411
  }
412
412
  /** Find the last enabled element in the same column of the provided array. */
413
- pa(t, e, a, i) {
414
- const s = e + Math.trunc((a - e - 1) / i) * i;
415
- return t[s].disabled ? this.i(t, s, -i) : t[s];
413
+ _findLastOnColumn(e, t, a, r) {
414
+ const s = t + Math.trunc((a - t - 1) / r) * r;
415
+ return e[s].disabled ? this._findNext(e, s, -r) : e[s];
416
416
  }
417
- w() {
418
- this.l = !0, this.b = this.selected ?? this.now, this.f = void 0, this.s = void 0, this.o = "day", this.t();
417
+ _resetToDayView() {
418
+ this._resetFocus = !0, this._activeDate = this.selected ?? this.now, this._chosenYear = void 0, this._chosenMonth = void 0, this._nextCalendarView = "day", this._removeTable();
419
419
  }
420
420
  /** Render the view for the day selection. */
421
- ra() {
422
- const t = this.g ? this.a.addCalendarMonths(this.b, 1) : void 0;
423
- return l`
421
+ _renderDayView() {
422
+ const e = this._wide ? this._dateAdapter.addCalendarMonths(this._activeDate, 1) : void 0;
423
+ return o`
424
424
  <div class="sbb-calendar__controls">
425
- ${this.n(
425
+ ${this._getArrow(
426
426
  "left",
427
- () => this.O(-1),
428
- F[this.h.current],
429
- this.ea()
427
+ () => this._goToDifferentMonth(-1),
428
+ I[this._language.current],
429
+ this._previousMonthDisabled()
430
430
  )}
431
431
  <div class="sbb-calendar__controls-month">
432
- ${this.R(this.b)}
433
- ${this.g ? this.R(t) : h}
432
+ ${this._createLabelForDayView(this._activeDate)}
433
+ ${this._wide ? this._createLabelForDayView(e) : h}
434
434
  <sbb-screen-reader-only role="status">
435
- ${this.sa(this.b, t)}
435
+ ${this._createAriaLabelForDayView(this._activeDate, e)}
436
436
  </sbb-screen-reader-only>
437
437
  </div>
438
- ${this.n(
438
+ ${this._getArrow(
439
439
  "right",
440
- () => this.O(1),
441
- W[this.h.current],
442
- this.fa()
440
+ () => this._goToDifferentMonth(1),
441
+ O[this._language.current],
442
+ this._nextMonthDisabled()
443
443
  )}
444
444
  </div>
445
445
  <div class="sbb-calendar__table-container sbb-calendar__table-day-view">
446
- ${this.S(this.F)}
447
- ${this.g ? this.S(this.v) : h}
446
+ ${this._createDayTable(this._weeks)}
447
+ ${this._wide ? this._createDayTable(this._nextMonthWeeks) : h}
448
448
  </div>
449
449
  `;
450
450
  }
451
451
  /** Creates the label with the month for the daily view. */
452
- R(t) {
453
- const e = `${this.r[this.a.getMonth(t) - 1]} ${this.a.getYear(t)}`;
454
- return l`
452
+ _createLabelForDayView(e) {
453
+ const t = `${this._monthNames[this._dateAdapter.getMonth(e) - 1]} ${this._dateAdapter.getYear(e)}`;
454
+ return o`
455
455
  <button
456
456
  type="button"
457
457
  id="sbb-calendar__date-selection"
458
458
  class="sbb-calendar__controls-change-date"
459
- aria-label="${N[this.h.current]} ${e}"
459
+ aria-label="${S[this._language.current]} ${t}"
460
460
  @click=${() => {
461
- this.l = !0, this.o = "year", this.t();
461
+ this._resetFocus = !0, this._nextCalendarView = "year", this._removeTable();
462
462
  }}
463
463
  >
464
- ${e}
464
+ ${t}
465
465
  <sbb-icon name="chevron-small-down-small"></sbb-icon>
466
466
  </button>
467
467
  `;
468
468
  }
469
469
  /** Creates the aria-label for the daily view. */
470
- sa(...t) {
471
- let e = "";
472
- for (const a of t)
473
- a && (e += `${this.r[this.a.getMonth(a) - 1]} ${this.a.getYear(a)} `);
474
- return e;
470
+ _createAriaLabelForDayView(...e) {
471
+ let t = "";
472
+ for (const a of e)
473
+ a && (t += `${this._monthNames[this._dateAdapter.getMonth(a) - 1]} ${this._dateAdapter.getYear(a)} `);
474
+ return t;
475
475
  }
476
476
  /** Creates the calendar table for the daily view. */
477
- S(t) {
478
- return l`
477
+ _createDayTable(e) {
478
+ return o`
479
479
  <table
480
480
  class="sbb-calendar__table"
481
- @focusout=${(e) => this.ka(e.relatedTarget)}
482
- @animationend=${(e) => this.A(e)}
481
+ @focusout=${(t) => this._handleTableBlur(t.relatedTarget)}
482
+ @animationend=${(t) => this._tableAnimationEnd(t)}
483
483
  >
484
484
  <thead class="sbb-calendar__table-header">
485
485
  <tr class="sbb-calendar__table-header-row">
486
- ${this.ta()}
486
+ ${this._createDayTableHeader()}
487
487
  </tr>
488
488
  </thead>
489
489
  <tbody class="sbb-calendar__table-body">
490
- ${this.ua(t)}
490
+ ${this._createDayTableBody(e)}
491
491
  </tbody>
492
492
  </table>
493
493
  `;
494
494
  }
495
495
  /** Creates the table header with the month header cells. */
496
- ta() {
497
- return this.E.map(
498
- (t) => l`
496
+ _createDayTableHeader() {
497
+ return this._weekdays.map(
498
+ (e) => o`
499
499
  <th class="sbb-calendar__table-header">
500
- <sbb-screen-reader-only>${t.long}</sbb-screen-reader-only>
501
- <span aria-hidden="true">${t.narrow}</span>
500
+ <sbb-screen-reader-only>${e.long}</sbb-screen-reader-only>
501
+ <span aria-hidden="true">${e.narrow}</span>
502
502
  </th>
503
503
  `
504
504
  );
505
505
  }
506
506
  /** Creates the table body with the day cells. For the first row, it also considers the possible day's offset. */
507
- ua(t) {
508
- const e = this.a.toIso8601(this.now);
509
- return t.map((a, i) => {
507
+ _createDayTableBody(e) {
508
+ const t = this._dateAdapter.toIso8601(this.now);
509
+ return e.map((a, r) => {
510
510
  const s = y - a.length;
511
- return i === 0 && s ? l`
511
+ return r === 0 && s ? o`
512
512
  <tr>
513
513
  ${[...Array(s).keys()].map(
514
- () => l`<td
514
+ () => o`<td
515
515
  class="sbb-calendar__table-data"
516
516
  data-day=${`0 ${a[0].monthValue} ${a[0].yearValue}`}
517
517
  ></td>`
518
518
  )}
519
- ${this.T(a, e)}
519
+ ${this._createDayCells(a, t)}
520
520
  </tr>
521
- ` : l`<tr>
522
- ${this.T(a, e)}
521
+ ` : o`<tr>
522
+ ${this._createDayCells(a, t)}
523
523
  </tr>`;
524
524
  });
525
525
  }
526
526
  /** Creates the cells for the daily view. */
527
- T(t, e) {
528
- return t.map((a) => {
529
- const i = !this.C(a.value), s = !this.D(this.a.deserialize(a.value)), r = !!this.e && a.value === this.e, n = `${a.dayValue} ${a.monthValue} ${a.yearValue}`, b = a.value === e;
530
- return l`
527
+ _createDayCells(e, t) {
528
+ return e.map((a) => {
529
+ const r = !this._isDayInRange(a.value), s = !this._dateFilter(this._dateAdapter.deserialize(a.value)), i = !!this._selected && a.value === this._selected, n = `${a.dayValue} ${a.monthValue} ${a.yearValue}`, d = a.value === t;
530
+ return o`
531
531
  <td
532
- class=${g({
532
+ class=${p({
533
533
  "sbb-calendar__table-data": !0,
534
- "sbb-calendar__table-data-selected": r
534
+ "sbb-calendar__table-data-selected": i
535
535
  })}
536
536
  >
537
537
  <button
538
- class=${g({
538
+ class=${p({
539
539
  "sbb-calendar__cell": !0,
540
540
  "sbb-calendar__day": !0,
541
- "sbb-calendar__cell-current": b,
542
- "sbb-calendar__selected": r,
543
- "sbb-calendar__crossed-out": !i && s
541
+ "sbb-calendar__cell-current": d,
542
+ "sbb-calendar__selected": i,
543
+ "sbb-calendar__crossed-out": !r && s
544
544
  })}
545
- @click=${() => this.da(a.value)}
546
- ?disabled=${i || s}
547
- aria-label=${this.a.getAccessibilityFormatDate(a.value)}
548
- aria-pressed=${r}
549
- aria-disabled=${i || s}
550
- aria-current=${b ? "date" : h}
545
+ @click=${() => this._selectDate(a.value)}
546
+ ?disabled=${r || s}
547
+ aria-label=${this._dateAdapter.getAccessibilityFormatDate(a.value)}
548
+ aria-pressed=${i}
549
+ aria-disabled=${r || s}
550
+ aria-current=${d ? "date" : h}
551
551
  data-day=${n || h}
552
552
  tabindex="-1"
553
- @keydown=${(u) => this.z(u, a)}
553
+ @keydown=${(_) => this._handleKeyboardEvent(_, a)}
554
554
  sbb-popover-close
555
555
  >
556
556
  ${a.dayValue}
@@ -560,83 +560,83 @@ let c = class extends z {
560
560
  });
561
561
  }
562
562
  /** Render the view for the month selection. */
563
- va() {
564
- return l`
563
+ _renderMonthView() {
564
+ return o`
565
565
  <div class="sbb-calendar__controls">
566
- ${this.n(
566
+ ${this._getArrow(
567
567
  "left",
568
- () => this.P(-1),
569
- E[this.h.current],
570
- this.ga()
568
+ () => this._goToDifferentYear(-1),
569
+ C[this._language.current],
570
+ this._previousYearDisabled()
571
571
  )}
572
- <div class="sbb-calendar__controls-month">${this.wa()}</div>
573
- ${this.n(
572
+ <div class="sbb-calendar__controls-month">${this._createLabelForMonthView()}</div>
573
+ ${this._getArrow(
574
574
  "right",
575
- () => this.P(1),
576
- P[this.h.current],
577
- this.ha()
575
+ () => this._goToDifferentYear(1),
576
+ W[this._language.current],
577
+ this._nextYearDisabled()
578
578
  )}
579
579
  </div>
580
580
  <div class="sbb-calendar__table-container sbb-calendar__table-month-view">
581
- ${this.U(this.u, this.f)}
582
- ${this.g ? this.U(this.u, this.f + 1, !0) : h}
581
+ ${this._createMonthTable(this._months, this._chosenYear)}
582
+ ${this._wide ? this._createMonthTable(this._months, this._chosenYear + 1, !0) : h}
583
583
  </div>
584
584
  `;
585
585
  }
586
586
  /** Creates the label with the year for the monthly view. */
587
- wa() {
588
- return l` <button
587
+ _createLabelForMonthView() {
588
+ return o` <button
589
589
  type="button"
590
590
  id="sbb-calendar__month-selection"
591
591
  class="sbb-calendar__controls-change-date"
592
- aria-label=${`${x[this.h.current]} ${this.f}`}
593
- @click=${() => this.w()}
592
+ aria-label=${`${x[this._language.current]} ${this._chosenYear}`}
593
+ @click=${() => this._resetToDayView()}
594
594
  >
595
- ${this.f} ${this.g ? ` - ${this.f + 1}` : h}
595
+ ${this._chosenYear} ${this._wide ? ` - ${this._chosenYear + 1}` : h}
596
596
  <sbb-icon name="chevron-small-up-small"></sbb-icon>
597
597
  </button>
598
- <sbb-screen-reader-only role="status"> ${this.f} </sbb-screen-reader-only>`;
598
+ <sbb-screen-reader-only role="status"> ${this._chosenYear} </sbb-screen-reader-only>`;
599
599
  }
600
600
  /** Creates the table for the month selection view. */
601
- U(t, e, a = !1) {
602
- return l`
601
+ _createMonthTable(e, t, a = !1) {
602
+ return o`
603
603
  <table
604
604
  class="sbb-calendar__table"
605
- @animationend=${(i) => this.A(i)}
605
+ @animationend=${(r) => this._tableAnimationEnd(r)}
606
606
  >
607
- ${this.g ? l`<thead class="sbb-calendar__table-header" aria-hidden="true">
607
+ ${this._wide ? o`<thead class="sbb-calendar__table-header" aria-hidden="true">
608
608
  <tr class="sbb-calendar__table-header-row">
609
- <th class="sbb-calendar__table-header" colspan=${_}>${e}</th>
609
+ <th class="sbb-calendar__table-header" colspan=${g}>${t}</th>
610
610
  </tr>
611
611
  </thead>` : h}
612
612
  <tbody class="sbb-calendar__table-body">
613
- ${t.map(
614
- (i) => l`
613
+ ${e.map(
614
+ (r) => o`
615
615
  <tr>
616
- ${i.map((s) => {
617
- const r = !this.$(s.monthValue), n = !this.ba(s.monthValue), b = this.e ? this.a.getMonth(this.a.deserialize(this.e)) : void 0, u = this.e ? this.a.getYear(this.a.deserialize(this.e)) : void 0, m = !!this.e && e === u && s.monthValue === b, w = e === this.a.getYear(this.now) && this.a.getMonth(this.now) === s.monthValue;
618
- return l` <td
619
- class=${g({
616
+ ${r.map((s) => {
617
+ const i = !this._isMonthInRange(s.monthValue), n = !this._isMonthFilteredOut(s.monthValue), d = this._selected ? this._dateAdapter.getMonth(this._dateAdapter.deserialize(this._selected)) : void 0, _ = this._selected ? this._dateAdapter.getYear(this._dateAdapter.deserialize(this._selected)) : void 0, f = !!this._selected && t === _ && s.monthValue === d, w = t === this._dateAdapter.getYear(this.now) && this._dateAdapter.getMonth(this.now) === s.monthValue;
618
+ return o` <td
619
+ class=${p({
620
620
  "sbb-calendar__table-data": !0,
621
621
  "sbb-calendar__table-month": !0
622
622
  })}
623
623
  >
624
624
  <button
625
- class=${g({
625
+ class=${p({
626
626
  "sbb-calendar__cell": !0,
627
627
  "sbb-calendar__pill": !0,
628
628
  "sbb-calendar__cell-current": w,
629
- "sbb-calendar__crossed-out": !r && n,
630
- "sbb-calendar__selected": m
629
+ "sbb-calendar__crossed-out": !i && n,
630
+ "sbb-calendar__selected": f
631
631
  })}
632
- @click=${() => this.xa(s.monthValue, e, a)}
633
- ?disabled=${r || n}
634
- aria-label=${`${s.longValue} ${this.f}`}
635
- aria-pressed=${m}
636
- aria-disabled=${String(r || n)}
632
+ @click=${() => this._onMonthSelection(s.monthValue, t, a)}
633
+ ?disabled=${i || n}
634
+ aria-label=${`${s.longValue} ${this._chosenYear}`}
635
+ aria-pressed=${f}
636
+ aria-disabled=${String(i || n)}
637
637
  tabindex="-1"
638
638
  data-month=${s.monthValue || h}
639
- @keydown=${(k) => this.z(k)}
639
+ @keydown=${(D) => this._handleKeyboardEvent(D)}
640
640
  >
641
641
  ${s.value}
642
642
  </button>
@@ -650,96 +650,96 @@ let c = class extends z {
650
650
  `;
651
651
  }
652
652
  /** Select the month and change the view to day selection. */
653
- xa(t, e, a) {
654
- this.s = a ? t + 1 : t, this.o = "day", this.m(
655
- this.a.createDate(
656
- e,
657
- this.s,
658
- this.a.getDate(this.b)
653
+ _onMonthSelection(e, t, a) {
654
+ this._chosenMonth = a ? e + 1 : e, this._nextCalendarView = "day", this._init(
655
+ this._dateAdapter.createDate(
656
+ t,
657
+ this._chosenMonth,
658
+ this._dateAdapter.getDate(this._activeDate)
659
659
  )
660
- ), this.t();
660
+ ), this._removeTable();
661
661
  }
662
662
  /** Render the view for the year selection. */
663
- ya() {
664
- return l`
663
+ _renderYearView() {
664
+ return o`
665
665
  <div class="sbb-calendar__controls">
666
- ${this.n(
666
+ ${this._getArrow(
667
667
  "left",
668
- () => this.Q(-o),
669
- C(o)[this.h.current],
670
- this.ia()
668
+ () => this._goToDifferentYearRange(-l),
669
+ E(l)[this._language.current],
670
+ this._previousYearRangeDisabled()
671
671
  )}
672
- <div class="sbb-calendar__controls-month">${this.za()}</div>
673
- ${this.n(
672
+ <div class="sbb-calendar__controls-month">${this._createLabelForYearView()}</div>
673
+ ${this._getArrow(
674
674
  "right",
675
- () => this.Q(o),
676
- q(o)[this.h.current],
677
- this.ja()
675
+ () => this._goToDifferentYearRange(l),
676
+ L(l)[this._language.current],
677
+ this._nextYearRangeDisabled()
678
678
  )}
679
679
  </div>
680
680
  <div class="sbb-calendar__table-container sbb-calendar__table-year-view">
681
- ${this.V(this.k)}
682
- ${this.g ? this.V(this.p, !0) : h}
681
+ ${this._createYearTable(this._years)}
682
+ ${this._wide ? this._createYearTable(this._nextMonthYears, !0) : h}
683
683
  </div>
684
684
  `;
685
685
  }
686
686
  /** Creates the button arrow for all the views. */
687
- n(t, e, a, i) {
688
- return l`<sbb-secondary-button
687
+ _getArrow(e, t, a, r) {
688
+ return o`<sbb-secondary-button
689
689
  size="m"
690
- icon-name="chevron-small-${t}-small"
690
+ icon-name="chevron-small-${e}-small"
691
691
  aria-label=${a}
692
- @click=${e}
693
- ?disabled=${i}
694
- id="sbb-calendar__controls-${t === "left" ? "previous" : "next"}"
692
+ @click=${t}
693
+ ?disabled=${r}
694
+ id="sbb-calendar__controls-${e === "left" ? "previous" : "next"}"
695
695
  ></sbb-secondary-button>`;
696
696
  }
697
697
  /** Creates the label with the year range for the yearly view. */
698
- za() {
699
- const t = this.k.flat()[0], e = ($("medium") && this.wide ? this.p : this.k).flat(), a = e[e.length - 1], i = `${t} - ${a}`;
700
- return l`
698
+ _createLabelForYearView() {
699
+ const e = this._years.flat()[0], t = (A("medium") && this.wide ? this._nextMonthYears : this._years).flat(), a = t[t.length - 1], r = `${e} - ${a}`;
700
+ return o`
701
701
  <button
702
702
  type="button"
703
703
  id="sbb-calendar__year-selection"
704
704
  class="sbb-calendar__controls-change-date"
705
- aria-label="${x[this.h.current]} ${i}"
706
- @click=${() => this.w()}
705
+ aria-label="${x[this._language.current]} ${r}"
706
+ @click=${() => this._resetToDayView()}
707
707
  >
708
- ${i}
708
+ ${r}
709
709
  <sbb-icon name="chevron-small-up-small"></sbb-icon>
710
710
  </button>
711
- <sbb-screen-reader-only role="status"> ${i} </sbb-screen-reader-only>
711
+ <sbb-screen-reader-only role="status"> ${r} </sbb-screen-reader-only>
712
712
  `;
713
713
  }
714
714
  /** Creates the table for the year selection view. */
715
- V(t, e = !1) {
715
+ _createYearTable(e, t = !1) {
716
716
  const a = this.now;
717
- return l` <table
717
+ return o` <table
718
718
  class="sbb-calendar__table"
719
- @animationend=${(i) => this.A(i)}
719
+ @animationend=${(r) => this._tableAnimationEnd(r)}
720
720
  >
721
721
  <tbody class="sbb-calendar__table-body">
722
- ${t.map(
723
- (i) => l` <tr>
724
- ${i.map((s) => {
725
- const r = !this.aa(s), n = !this.ca(s), b = this.e ? this.a.getYear(this.a.deserialize(this.e)) : void 0, u = !!this.e && s === b, m = this.a.getYear(a) === s;
726
- return l` <td class="sbb-calendar__table-data sbb-calendar__table-year">
722
+ ${e.map(
723
+ (r) => o` <tr>
724
+ ${r.map((s) => {
725
+ const i = !this._isYearInRange(s), n = !this._isYearFilteredOut(s), d = this._selected ? this._dateAdapter.getYear(this._dateAdapter.deserialize(this._selected)) : void 0, _ = !!this._selected && s === d, f = this._dateAdapter.getYear(a) === s;
726
+ return o` <td class="sbb-calendar__table-data sbb-calendar__table-year">
727
727
  <button
728
- class=${g({
728
+ class=${p({
729
729
  "sbb-calendar__cell": !0,
730
730
  "sbb-calendar__pill": !0,
731
- "sbb-calendar__cell-current": m,
732
- "sbb-calendar__crossed-out": !r && n,
733
- "sbb-calendar__selected": u
731
+ "sbb-calendar__cell-current": f,
732
+ "sbb-calendar__crossed-out": !i && n,
733
+ "sbb-calendar__selected": _
734
734
  })}
735
- @click=${() => this.Aa(s, e)}
736
- ?disabled=${r || n}
735
+ @click=${() => this._onYearSelection(s, t)}
736
+ ?disabled=${i || n}
737
737
  aria-label=${s}
738
- aria-pressed=${u}
739
- aria-disabled=${String(r || n)}
738
+ aria-pressed=${_}
739
+ aria-disabled=${String(i || n)}
740
740
  tabindex="-1"
741
741
  data-year=${s || h}
742
- @keydown=${(w) => this.z(w)}
742
+ @keydown=${(w) => this._handleKeyboardEvent(w)}
743
743
  >
744
744
  ${s}
745
745
  </button>
@@ -751,75 +751,75 @@ let c = class extends z {
751
751
  </table>`;
752
752
  }
753
753
  /** Select the year and change the view to month selection. */
754
- Aa(t, e) {
755
- this.f = e ? t - 1 : t, this.o = "month", this.K(
756
- this.a.createDate(
757
- this.f,
758
- this.a.getMonth(this.b),
759
- this.a.getDate(this.b)
754
+ _onYearSelection(e, t) {
755
+ this._chosenYear = t ? e - 1 : e, this._nextCalendarView = "month", this._assignActiveDate(
756
+ this._dateAdapter.createDate(
757
+ this._chosenYear,
758
+ this._dateAdapter.getMonth(this._activeDate),
759
+ this._dateAdapter.getDate(this._activeDate)
760
760
  )
761
- ), this.t();
761
+ ), this._removeTable();
762
762
  }
763
- get Ba() {
764
- switch (this.q) {
763
+ get _getView() {
764
+ switch (this._calendarView) {
765
765
  case "year":
766
- return this.ya();
766
+ return this._renderYearView();
767
767
  case "month":
768
- return this.va();
768
+ return this._renderMonthView();
769
769
  case "day":
770
770
  default:
771
- return this.ra();
771
+ return this._renderDayView();
772
772
  }
773
773
  }
774
- A(t) {
775
- const e = t.target;
776
- t.animationName === "hide" ? (e.classList.remove("sbb-calendar__table-hide"), this.l = !0, this.q = this.o) : t.animationName === "show" && this.removeAttribute("data-transition");
774
+ _tableAnimationEnd(e) {
775
+ const t = e.target;
776
+ e.animationName === "hide" ? (t.classList.remove("sbb-calendar__table-hide"), this._resetFocus = !0, this._calendarView = this._nextCalendarView) : e.animationName === "show" && this.removeAttribute("data-transition");
777
777
  }
778
- t() {
778
+ _removeTable() {
779
779
  this.toggleAttribute("data-transition", !0), this.shadowRoot.querySelectorAll("table").forEach(
780
- (t) => t.classList.toggle("sbb-calendar__table-hide")
780
+ (e) => e.classList.toggle("sbb-calendar__table-hide")
781
781
  );
782
782
  }
783
783
  render() {
784
- return l`<div class="sbb-calendar__wrapper">${this.Ba}</div>`;
784
+ return o`<div class="sbb-calendar__wrapper">${this._getView}</div>`;
785
785
  }
786
786
  };
787
- c.styles = L;
787
+ c.styles = P;
788
788
  c.events = {
789
789
  dateSelected: "dateSelected"
790
790
  };
791
- d([
792
- f({ type: Boolean })
791
+ b([
792
+ u({ type: Boolean })
793
793
  ], c.prototype, "wide", 2);
794
- d([
795
- f()
794
+ b([
795
+ u()
796
796
  ], c.prototype, "min", 1);
797
- d([
798
- f()
797
+ b([
798
+ u()
799
799
  ], c.prototype, "max", 1);
800
- d([
801
- f()
800
+ b([
801
+ u()
802
802
  ], c.prototype, "now", 1);
803
- d([
804
- f()
803
+ b([
804
+ u()
805
805
  ], c.prototype, "selected", 1);
806
- d([
807
- f({ attribute: "date-filter" })
806
+ b([
807
+ u({ attribute: "date-filter" })
808
808
  ], c.prototype, "dateFilter", 2);
809
- d([
810
- p()
811
- ], c.prototype, "b", 2);
812
- d([
813
- p()
814
- ], c.prototype, "e", 2);
815
- d([
816
- p()
817
- ], c.prototype, "g", 1);
818
- d([
819
- p()
820
- ], c.prototype, "q", 2);
821
- c = d([
822
- D("sbb-calendar")
809
+ b([
810
+ v()
811
+ ], c.prototype, "_activeDate", 2);
812
+ b([
813
+ v()
814
+ ], c.prototype, "_selected", 2);
815
+ b([
816
+ v()
817
+ ], c.prototype, "_wide", 1);
818
+ b([
819
+ v()
820
+ ], c.prototype, "_calendarView", 2);
821
+ c = b([
822
+ V("sbb-calendar")
823
823
  ], c);
824
824
  export {
825
825
  c as SbbCalendarElement