@sbb-esta/lyne-elements 3.8.0 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +1 -1
- package/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +1 -1
- package/calendar/calendar.component.d.ts.map +1 -1
- package/calendar/calendar.component.js +211 -225
- package/carousel/carousel/carousel.component.d.ts.map +1 -1
- package/carousel/carousel/carousel.component.js +5 -5
- package/core/base-elements/open-close-base-element.d.ts +2 -0
- package/core/base-elements/open-close-base-element.d.ts.map +1 -1
- package/core/base-elements/open-close-base-element.js +4 -0
- package/core/controllers/escapable-overlay-controller.js +3 -3
- package/core/controllers/inert-controller.d.ts +8 -1
- package/core/controllers/inert-controller.d.ts.map +1 -1
- package/core/controllers/inert-controller.js +25 -13
- package/core/overlay/position.d.ts +20 -0
- package/core/overlay/position.d.ts.map +1 -1
- package/core/overlay/position.js +34 -23
- package/core/overlay.js +11 -10
- package/core/styles/core.scss +7 -0
- package/core.css +6 -0
- package/custom-elements.json +1152 -661
- package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +7 -1
- package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +2 -1
- package/development/calendar/calendar.component.d.ts.map +1 -1
- package/development/calendar/calendar.component.js +20 -36
- package/development/carousel/carousel/carousel.component.d.ts.map +1 -1
- package/development/carousel/carousel/carousel.component.js +2 -2
- package/development/core/base-elements/open-close-base-element.d.ts +2 -0
- package/development/core/base-elements/open-close-base-element.d.ts.map +1 -1
- package/development/core/base-elements/open-close-base-element.js +5 -1
- package/development/core/controllers/escapable-overlay-controller.js +2 -2
- package/development/core/controllers/inert-controller.d.ts +8 -1
- package/development/core/controllers/inert-controller.d.ts.map +1 -1
- package/development/core/controllers/inert-controller.js +49 -30
- package/development/core/overlay/position.d.ts +20 -0
- package/development/core/overlay/position.d.ts.map +1 -1
- package/development/core/overlay/position.js +41 -1
- package/development/core/overlay.js +2 -1
- package/development/menu/common/menu-action-common.d.ts.map +1 -1
- package/development/menu/common/menu-action-common.js +20 -3
- package/development/menu/menu/menu.component.d.ts +21 -10
- package/development/menu/menu/menu.component.d.ts.map +1 -1
- package/development/menu/menu/menu.component.js +203 -61
- package/development/option/option/option.component.js +4 -2
- package/development/paginator/common/paginator-common.d.ts.map +1 -1
- package/development/paginator/common/paginator-common.js +14 -3
- package/development/tabs/tab/tab.component.d.ts +10 -4
- package/development/tabs/tab/tab.component.d.ts.map +1 -1
- package/development/tabs/tab/tab.component.js +15 -16
- package/development/tabs/tab-group/tab-group.component.d.ts +15 -14
- package/development/tabs/tab-group/tab-group.component.d.ts.map +1 -1
- package/development/tabs/tab-group/tab-group.component.js +46 -175
- package/development/tabs/tab-label/tab-label.component.d.ts +21 -2
- package/development/tabs/tab-label/tab-label.component.d.ts.map +1 -1
- package/development/tabs/tab-label/tab-label.component.js +91 -6
- package/development/tooltip/tooltip.component.d.ts +6 -6
- package/development/tooltip/tooltip.component.d.ts.map +1 -1
- package/development/tooltip/tooltip.component.js +14 -7
- package/menu/common/menu-action-common.d.ts.map +1 -1
- package/menu/common/menu-action-common.js +15 -12
- package/menu/menu/menu.component.d.ts +21 -10
- package/menu/menu/menu.component.d.ts.map +1 -1
- package/menu/menu/menu.component.js +144 -80
- package/off-brand-theme.css +6 -0
- package/option/option/option.component.js +1 -1
- package/package.json +1 -1
- package/paginator/common/paginator-common.d.ts.map +1 -1
- package/paginator/common/paginator-common.js +30 -25
- package/safety-theme.css +6 -0
- package/standard-theme.css +6 -0
- package/tabs/tab/tab.component.d.ts +10 -4
- package/tabs/tab/tab.component.d.ts.map +1 -1
- package/tabs/tab/tab.component.js +22 -24
- package/tabs/tab-group/tab-group.component.d.ts +15 -14
- package/tabs/tab-group/tab-group.component.d.ts.map +1 -1
- package/tabs/tab-group/tab-group.component.js +68 -122
- package/tabs/tab-label/tab-label.component.d.ts +21 -2
- package/tabs/tab-label/tab-label.component.d.ts.map +1 -1
- package/tabs/tab-label/tab-label.component.js +88 -46
- package/tooltip/tooltip.component.d.ts +6 -6
- package/tooltip/tooltip.component.d.ts.map +1 -1
- package/tooltip/tooltip.component.js +59 -54
|
@@ -1,100 +1,101 @@
|
|
|
1
|
-
var
|
|
1
|
+
var Ce = (o) => {
|
|
2
2
|
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var k = (o, n,
|
|
4
|
+
var Ie = (o, n, d) => n.has(o) || Ce("Cannot " + d);
|
|
5
|
+
var k = (o, n, d) => (Ie(o, n, "read from private field"), d ? d.call(o) : n.get(o)), x = (o, n, d) => n.has(o) ? Ce("Cannot add the same private member more than once") : n instanceof WeakSet ? n.add(o) : n.set(o, d), f = (o, n, d, b) => (Ie(o, n, "write to private field"), b ? b.call(o, d) : n.set(o, d), d);
|
|
6
6
|
import { __esDecorate as y, __runInitializers as u } from "tslib";
|
|
7
|
-
import { css as
|
|
8
|
-
import { customElement as
|
|
7
|
+
import { css as Le, LitElement as Be, isServer as Re, nothing as m, html as h } from "lit";
|
|
8
|
+
import { customElement as He, property as Y, state as G } from "lit/decorators.js";
|
|
9
9
|
import { classMap as Q } from "lit/directives/class-map.js";
|
|
10
|
-
import { sbbInputModalityDetector as qe, isArrowKeyOrPageKeysPressed as
|
|
11
|
-
import { readConfig as
|
|
12
|
-
import { SbbLanguageController as
|
|
13
|
-
import { defaultDateAdapter as
|
|
14
|
-
import { forceType as
|
|
15
|
-
import { i18nPreviousMonth as
|
|
16
|
-
import { SbbHydrationMixin as
|
|
10
|
+
import { sbbInputModalityDetector as qe, isArrowKeyOrPageKeysPressed as Ke } from "../core/a11y.js";
|
|
11
|
+
import { readConfig as Ue } from "../core/config.js";
|
|
12
|
+
import { SbbLanguageController as je, SbbMediaMatcherController as Ge, SbbMediaQueryBreakpointMediumAndAbove as Se } from "../core/controllers.js";
|
|
13
|
+
import { defaultDateAdapter as Qe, YEARS_PER_PAGE as V, DAYS_PER_ROW as D, MONTHS_PER_ROW as J, YEARS_PER_ROW as X, MONTHS_PER_PAGE as Je } from "../core/datetime.js";
|
|
14
|
+
import { forceType as Z, plainDate as Te, handleDistinctChange as Xe } from "../core/decorators.js";
|
|
15
|
+
import { i18nPreviousMonth as Ze, i18nNextMonth as et, i18nYearMonthSelection as tt, i18nCalendarWeekNumber as K, i18nPreviousYear as at, i18nNextYear as st, i18nCalendarDateSelection as Ee, i18nPreviousYearRange as it, i18nNextYearRange as rt } from "../core/i18n.js";
|
|
16
|
+
import { SbbHydrationMixin as nt } from "../core/mixins.js";
|
|
17
17
|
import "../button/secondary-button.js";
|
|
18
18
|
import "../icon.js";
|
|
19
19
|
import "../screen-reader-only.js";
|
|
20
|
-
const
|
|
21
|
-
function
|
|
22
|
-
return typeof o == "function" ? o(n) : o && typeof o == "object" &&
|
|
20
|
+
const lt = 6048e5, Pe = Symbol.for("constructDateFrom");
|
|
21
|
+
function F(o, n) {
|
|
22
|
+
return typeof o == "function" ? o(n) : o && typeof o == "object" && Pe in o ? o[Pe](n) : o instanceof Date ? new o.constructor(n) : new Date(n);
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return
|
|
24
|
+
function U(o, n) {
|
|
25
|
+
return F(n || o, o);
|
|
26
26
|
}
|
|
27
|
-
function
|
|
28
|
-
const b =
|
|
29
|
-
return isNaN(n) ?
|
|
27
|
+
function ot(o, n, d) {
|
|
28
|
+
const b = U(o, d?.in);
|
|
29
|
+
return isNaN(n) ? F(o, NaN) : (n && b.setDate(b.getDate() + n), b);
|
|
30
30
|
}
|
|
31
|
-
let
|
|
32
|
-
function
|
|
33
|
-
return
|
|
31
|
+
let dt = {};
|
|
32
|
+
function te() {
|
|
33
|
+
return dt;
|
|
34
34
|
}
|
|
35
|
-
function
|
|
36
|
-
const
|
|
35
|
+
function z(o, n) {
|
|
36
|
+
const d = te(), b = n?.weekStartsOn ?? n?.locale?.options?.weekStartsOn ?? d.weekStartsOn ?? d.locale?.options?.weekStartsOn ?? 0, g = U(o, n?.in), v = g.getDay(), $ = (v < b ? 7 : 0) + v - b;
|
|
37
37
|
return g.setDate(g.getDate() - $), g.setHours(0, 0, 0, 0), g;
|
|
38
38
|
}
|
|
39
|
-
function
|
|
40
|
-
const
|
|
39
|
+
function ct(o, ...n) {
|
|
40
|
+
const d = F.bind(
|
|
41
41
|
null,
|
|
42
42
|
o || n.find((b) => typeof b == "object")
|
|
43
43
|
);
|
|
44
|
-
return n.map(
|
|
44
|
+
return n.map(d);
|
|
45
45
|
}
|
|
46
|
-
function
|
|
47
|
-
return
|
|
46
|
+
function ht(o, n, d) {
|
|
47
|
+
return ot(o, n * 7, d);
|
|
48
|
+
}
|
|
49
|
+
function bt(o, n) {
|
|
50
|
+
const d = U(o, n?.in), b = d.getMonth();
|
|
51
|
+
return d.setFullYear(d.getFullYear(), b + 1, 0), d.setHours(23, 59, 59, 999), d;
|
|
48
52
|
}
|
|
49
53
|
function _t(o, n) {
|
|
50
|
-
const
|
|
51
|
-
return
|
|
54
|
+
const [d, b] = ct(o, n.start, n.end);
|
|
55
|
+
return { start: d, end: b };
|
|
52
56
|
}
|
|
53
57
|
function ut(o, n) {
|
|
54
|
-
const
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
function ft(o, n) {
|
|
58
|
-
const { start: c, end: b } = ut(n?.in, o);
|
|
59
|
-
let g = +c > +b;
|
|
60
|
-
const v = F(g ? b : c, n), $ = F(g ? c : b, n);
|
|
58
|
+
const { start: d, end: b } = _t(n?.in, o);
|
|
59
|
+
let g = +d > +b;
|
|
60
|
+
const v = z(g ? b : d, n), $ = z(g ? d : b, n);
|
|
61
61
|
v.setHours(15), $.setHours(15);
|
|
62
|
-
const
|
|
62
|
+
const O = +$.getTime();
|
|
63
63
|
let A = v, M = n?.step ?? 1;
|
|
64
64
|
if (!M) return [];
|
|
65
65
|
M < 0 && (M = -M, g = !g);
|
|
66
|
-
const
|
|
67
|
-
for (; +A <=
|
|
68
|
-
A.setHours(0),
|
|
69
|
-
return g ?
|
|
66
|
+
const W = [];
|
|
67
|
+
for (; +A <= O; )
|
|
68
|
+
A.setHours(0), W.push(F(d, A)), A = ht(A, M), A.setHours(15);
|
|
69
|
+
return g ? W.reverse() : W;
|
|
70
70
|
}
|
|
71
|
-
function
|
|
72
|
-
const
|
|
73
|
-
return
|
|
71
|
+
function ft(o, n) {
|
|
72
|
+
const d = U(o, n?.in);
|
|
73
|
+
return d.setDate(1), d.setHours(0, 0, 0, 0), d;
|
|
74
74
|
}
|
|
75
|
-
function
|
|
76
|
-
const
|
|
75
|
+
function pt(o, n) {
|
|
76
|
+
const d = U(o, n?.in), b = d.getFullYear(), g = te(), v = n?.firstWeekContainsDate ?? n?.locale?.options?.firstWeekContainsDate ?? g.firstWeekContainsDate ?? g.locale?.options?.firstWeekContainsDate ?? 1, $ = F(n?.in || o, 0);
|
|
77
77
|
$.setFullYear(b + 1, 0, v), $.setHours(0, 0, 0, 0);
|
|
78
|
-
const
|
|
78
|
+
const O = z($, n), A = F(n?.in || o, 0);
|
|
79
79
|
A.setFullYear(b, 0, v), A.setHours(0, 0, 0, 0);
|
|
80
|
-
const M =
|
|
81
|
-
return +
|
|
80
|
+
const M = z(A, n);
|
|
81
|
+
return +d >= +O ? b + 1 : +d >= +M ? b : b - 1;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
84
|
-
const
|
|
85
|
-
return v.setFullYear(g, 0, b), v.setHours(0, 0, 0, 0),
|
|
83
|
+
function gt(o, n) {
|
|
84
|
+
const d = te(), b = n?.firstWeekContainsDate ?? n?.locale?.options?.firstWeekContainsDate ?? d.firstWeekContainsDate ?? d.locale?.options?.firstWeekContainsDate ?? 1, g = pt(o, n), v = F(n?.in || o, 0);
|
|
85
|
+
return v.setFullYear(g, 0, b), v.setHours(0, 0, 0, 0), z(v, n);
|
|
86
86
|
}
|
|
87
|
-
function
|
|
88
|
-
const
|
|
89
|
-
return Math.round(b /
|
|
87
|
+
function ee(o, n) {
|
|
88
|
+
const d = U(o, n?.in), b = +z(d, n) - +gt(d, n);
|
|
89
|
+
return Math.round(b / lt) + 1;
|
|
90
90
|
}
|
|
91
|
-
const wt = Be`*,:before,:after{box-sizing:border-box}:host{display:block;width:max-content;--sbb-calendar-cell-size: 2.5rem;--sbb-calendar-hover-shift: .0625rem;--sbb-calendar-wide-cell-size: 4.375rem;--sbb-calendar-header-color: var(--sbb-color-granite);--sbb-calendar-header-color: light-dark(var(--sbb-color-granite), var(--sbb-color-smoke));--sbb-calendar-cell-background-color: transparent;--sbb-calendar-cell-padding: .125rem;--sbb-calendar-cell-color: var(--sbb-color-2);--sbb-calendar-cell-selected-color: var(--sbb-color-1-inverted);--sbb-calendar-cell-selected-background-color: var(--sbb-background-color-2-inverted);--sbb-calendar-cell-disabled-height: .09375rem;--sbb-calendar-cell-disabled-width: 1.59375rem;--sbb-calendar-cell-disabled-color: var(--sbb-color-granite);--sbb-calendar-cell-disabled-color: light-dark(var(--sbb-color-granite), var(--sbb-color-smoke));--sbb-calendar-cell-transition-duration: var( --sbb-disable-animation-duration, 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-3);--sbb-calendar-control-view-change-background: var(--sbb-background-color-1)}@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-background: light-dark( var(--sbb-color-milk), var(--sbb-color-anthracite) );--sbb-calendar-control-view-change-color: var(--sbb-color-granite);--sbb-calendar-control-view-change-color: light-dark( var(--sbb-color-granite), var(--sbb-color-aluminium) );cursor:unset}.sbb-calendar__controls-change-date:focus-visible{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, 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-background-color-3)}.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);margin-inline:var(--sbb-calendar-margin);--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)}: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))}:host([orientation=horizontal][week-numbers]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc(8 * var(--sbb-calendar-cell-size))}:host([orientation=horizontal][week-numbers][data-wide]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc( 2 * 8 * var(--sbb-calendar-cell-size) + var(--sbb-calendar-tables-gap) )}:host([orientation=vertical]) .sbb-calendar__table-container{min-width:var(--sbb-calendar-min-width);--sbb-calendar-start-offset: 0}:host([orientation=vertical][data-wide]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc( 13 * var(--sbb-calendar-cell-size) + var(--sbb-calendar-tables-gap) )}.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-calendar__table-body{text-align:center}.sbb-calendar__table-header-cell{--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);width:var(--sbb-calendar-cell-size);color:var(--sbb-calendar-header-color);padding:0}:host(:not([multiple])) .sbb-calendar__table-header-cell{height:var(--sbb-calendar-cell-size)}.sbb-calendar__table-data{position:relative;padding:0;text-align:center}.sbb-calendar__header-cell,.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__header-cell:before,.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__header-cell:not(.sbb-calendar__selected,:active,:disabled):hover,.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover{--sbb-calendar-cell-background-color: var(--sbb-background-color-3);padding-block-end:var(--sbb-calendar-hover-shift)}}@media (any-hover: hover) and (forced-colors: active){.sbb-calendar__header-cell:not(.sbb-calendar__selected,:active,:disabled):hover:before,.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, solid) var(--sbb-focus-outline-width);--sbb-focus-outline-style: initial}}.sbb-calendar__header-cell:disabled,.sbb-calendar__cell:disabled{--sbb-calendar-cell-color: var(--sbb-calendar-cell-disabled-color);cursor:unset}.sbb-calendar__header-cell:focus-visible:before,.sbb-calendar__cell:focus-visible:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, solid) var(--sbb-focus-outline-width)}.sbb-calendar__header-cell:not(.sbb-calendar__selected,:disabled):active,.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active{--sbb-calendar-cell-background-color: var(--sbb-background-color-4)}@media (forced-colors: active){.sbb-calendar__header-cell:not(.sbb-calendar__selected,:disabled):active:before,.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, solid) var(--sbb-focus-outline-width);--sbb-focus-outline-style: initial}}.sbb-calendar__header-cell{--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)}.sbb-calendar__weekday,.sbb-calendar__day{border-radius:50%;width:var(--sbb-calendar-cell-size)}.sbb-calendar__weekday:before,.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))}}`;
|
|
92
|
-
let
|
|
93
|
-
var C, I, R, S, T, E, P, L, B, H,
|
|
94
|
-
let o = [
|
|
91
|
+
const mt = Le`*,:before,:after{box-sizing:border-box}:host{display:block;width:max-content;--sbb-calendar-cell-size: 2.5rem;--sbb-calendar-hover-shift: .0625rem;--sbb-calendar-wide-cell-size: 4.375rem;--sbb-calendar-header-color: var(--sbb-color-granite);--sbb-calendar-header-color: light-dark(var(--sbb-color-granite), var(--sbb-color-smoke));--sbb-calendar-cell-background-color: transparent;--sbb-calendar-cell-padding: .125rem;--sbb-calendar-cell-color: var(--sbb-color-2);--sbb-calendar-cell-selected-color: var(--sbb-color-1-inverted);--sbb-calendar-cell-selected-background-color: var(--sbb-background-color-2-inverted);--sbb-calendar-cell-disabled-height: .09375rem;--sbb-calendar-cell-disabled-width: 1.59375rem;--sbb-calendar-cell-disabled-color: var(--sbb-color-granite);--sbb-calendar-cell-disabled-color: light-dark(var(--sbb-color-granite), var(--sbb-color-smoke));--sbb-calendar-cell-transition-duration: var( --sbb-disable-animation-duration, 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-3);--sbb-calendar-control-view-change-background: var(--sbb-background-color-1)}@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-background: light-dark( var(--sbb-color-milk), var(--sbb-color-anthracite) );--sbb-calendar-control-view-change-color: var(--sbb-color-granite);--sbb-calendar-control-view-change-color: light-dark( var(--sbb-color-granite), var(--sbb-color-aluminium) );cursor:unset}.sbb-calendar__controls-change-date:focus-visible{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, 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-background-color-3)}.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);margin-inline:var(--sbb-calendar-margin);--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)}: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))}:host([orientation=horizontal][week-numbers]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc(8 * var(--sbb-calendar-cell-size))}:host([orientation=horizontal][week-numbers][data-wide]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc( 2 * 8 * var(--sbb-calendar-cell-size) + var(--sbb-calendar-tables-gap) )}:host([orientation=vertical]) .sbb-calendar__table-container{min-width:var(--sbb-calendar-min-width);--sbb-calendar-start-offset: 0}:host([orientation=vertical][data-wide]) .sbb-calendar__table-container{--sbb-calendar-min-width: calc( 13 * var(--sbb-calendar-cell-size) + var(--sbb-calendar-tables-gap) )}.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-calendar__table-body{text-align:center}.sbb-calendar__table-header-cell{--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);width:var(--sbb-calendar-cell-size);color:var(--sbb-calendar-header-color);padding:0}:host(:not([multiple])) .sbb-calendar__table-header-cell{height:var(--sbb-calendar-cell-size)}.sbb-calendar__table-data{position:relative;padding:0;text-align:center}.sbb-calendar__header-cell,.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__header-cell:before,.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__header-cell:not(.sbb-calendar__selected,:active,:disabled):hover,.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover{--sbb-calendar-cell-background-color: var(--sbb-background-color-3);padding-block-end:var(--sbb-calendar-hover-shift)}}@media (any-hover: hover) and (forced-colors: active){.sbb-calendar__header-cell:not(.sbb-calendar__selected,:active,:disabled):hover:before,.sbb-calendar__cell:not(.sbb-calendar__selected,:active,:disabled):hover:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, solid) var(--sbb-focus-outline-width);--sbb-focus-outline-style: initial}}.sbb-calendar__header-cell:disabled,.sbb-calendar__cell:disabled{--sbb-calendar-cell-color: var(--sbb-calendar-cell-disabled-color);cursor:unset}.sbb-calendar__header-cell:focus-visible:before,.sbb-calendar__cell:focus-visible:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, solid) var(--sbb-focus-outline-width)}.sbb-calendar__header-cell:not(.sbb-calendar__selected,:disabled):active,.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active{--sbb-calendar-cell-background-color: var(--sbb-background-color-4)}@media (forced-colors: active){.sbb-calendar__header-cell:not(.sbb-calendar__selected,:disabled):active:before,.sbb-calendar__cell:not(.sbb-calendar__selected,:disabled):active:before{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) var(--sbb-focus-outline-style, solid) var(--sbb-focus-outline-width);--sbb-focus-outline-style: initial}}.sbb-calendar__header-cell{--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)}.sbb-calendar__weekday,.sbb-calendar__day{border-radius:50%;width:var(--sbb-calendar-cell-size)}.sbb-calendar__weekday:before,.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))}}`;
|
|
92
|
+
let Ct = (() => {
|
|
93
|
+
var N, C, I, R, S, T, E, P, L, B, H, q, p;
|
|
94
|
+
let o = [He("sbb-calendar")], n, d = [], b, g = nt(Be), v = [], $, O = [], A = [], M, W = [], ae = [], se, ie = [], re = [], ne, le = [], oe = [], de, ce = [], he = [], be, _e, ue = [], fe = [], pe, ge = [], me = [], we, ve = [], ye = [], De, Ae = [], ke = [], xe, $e = [], Ve = [], Me, Ye, ze = [], Fe = [], Oe, We = [], Ne = [];
|
|
95
95
|
return p = class extends g {
|
|
96
96
|
constructor() {
|
|
97
97
|
super();
|
|
98
|
+
x(this, N);
|
|
98
99
|
x(this, C);
|
|
99
100
|
x(this, I);
|
|
100
101
|
x(this, R);
|
|
@@ -105,60 +106,59 @@ let It = (() => {
|
|
|
105
106
|
x(this, L);
|
|
106
107
|
x(this, B);
|
|
107
108
|
x(this, H);
|
|
108
|
-
x(this, K);
|
|
109
109
|
x(this, q);
|
|
110
|
-
f(this,
|
|
110
|
+
f(this, N, (u(this, v), u(this, O, !1))), f(this, C, (u(this, A), u(this, W, "day"))), f(this, I, (u(this, ae), u(this, ie, null))), f(this, R, (u(this, re), u(this, le, null))), f(this, S, (u(this, oe), u(this, ce, !1))), f(this, T, (u(this, he), u(this, ue, null))), f(this, E, (u(this, fe), u(this, ge, null))), f(this, P, (u(this, me), u(this, ve, "horizontal"))), f(this, L, (u(this, ye), u(this, Ae, !1))), this._dateAdapter = (u(this, ke), Ue().datetime?.dateAdapter ?? Qe), f(this, B, u(this, $e, this._dateAdapter.today())), f(this, H, (u(this, Ve), u(this, ze, "day"))), this._nextCalendarView = (u(this, Fe), "day"), this._keyboardNavigationDayViewParameters = {
|
|
111
111
|
firstDayInView: null,
|
|
112
112
|
lastDayInView: null,
|
|
113
113
|
firstMonthOffset: 0,
|
|
114
114
|
firstMonthLength: 0,
|
|
115
115
|
secondMonthOffset: 0
|
|
116
|
-
}, this._weeks = [], this._monthNames = this._dateAdapter.getMonthNames("long"), this._resetFocus = !1, f(this, q, u(this,
|
|
116
|
+
}, this._weeks = [], this._monthNames = this._dateAdapter.getMonthNames("long"), this._resetFocus = !1, f(this, q, u(this, We, !1)), this._language = (u(this, Ne), new je(this).withHandler(() => {
|
|
117
117
|
this._monthNames = this._dateAdapter.getMonthNames("long"), this._createMonthRows();
|
|
118
|
-
})), this._mediaMatcher = new
|
|
119
|
-
[
|
|
118
|
+
})), this._mediaMatcher = new Ge(this, {
|
|
119
|
+
[Se]: () => this._init()
|
|
120
120
|
}), this._createMonthRows(), this._setWeekdays();
|
|
121
121
|
}
|
|
122
122
|
/** If set to true, two months are displayed */
|
|
123
123
|
get wide() {
|
|
124
|
-
return k(this,
|
|
124
|
+
return k(this, N);
|
|
125
125
|
}
|
|
126
126
|
set wide(e) {
|
|
127
|
-
f(this,
|
|
127
|
+
f(this, N, e);
|
|
128
128
|
}
|
|
129
129
|
/** The initial view of the calendar which should be displayed on opening. */
|
|
130
130
|
get view() {
|
|
131
|
-
return k(this,
|
|
131
|
+
return k(this, C);
|
|
132
132
|
}
|
|
133
133
|
set view(e) {
|
|
134
|
-
f(this,
|
|
134
|
+
f(this, C, e);
|
|
135
135
|
}
|
|
136
136
|
/**
|
|
137
137
|
* The minimum valid date. Accepts a date object or null.
|
|
138
138
|
* Accepts an ISO8601 formatted string (e.g. 2024-12-24) as attribute.
|
|
139
139
|
*/
|
|
140
140
|
get min() {
|
|
141
|
-
return k(this,
|
|
141
|
+
return k(this, I);
|
|
142
142
|
}
|
|
143
143
|
set min(e) {
|
|
144
|
-
f(this,
|
|
144
|
+
f(this, I, e);
|
|
145
145
|
}
|
|
146
146
|
/**
|
|
147
147
|
* The maximum valid date. Accepts a date object or null.
|
|
148
148
|
* Accepts an ISO8601 formatted string (e.g. 2024-12-24) as attribute.
|
|
149
149
|
*/
|
|
150
150
|
get max() {
|
|
151
|
-
return k(this,
|
|
151
|
+
return k(this, R);
|
|
152
152
|
}
|
|
153
153
|
set max(e) {
|
|
154
|
-
f(this,
|
|
154
|
+
f(this, R, e);
|
|
155
155
|
}
|
|
156
156
|
/** Whether the calendar allows for multiple date selection. */
|
|
157
157
|
get multiple() {
|
|
158
|
-
return k(this,
|
|
158
|
+
return k(this, S);
|
|
159
159
|
}
|
|
160
160
|
set multiple(e) {
|
|
161
|
-
f(this,
|
|
161
|
+
f(this, S, e);
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* The selected date: accepts a date object, or, if `multiple`, an array of dates.
|
|
@@ -175,38 +175,38 @@ let It = (() => {
|
|
|
175
175
|
return this._selected;
|
|
176
176
|
}
|
|
177
177
|
get _selected() {
|
|
178
|
-
return k(this,
|
|
178
|
+
return k(this, T);
|
|
179
179
|
}
|
|
180
180
|
set _selected(e) {
|
|
181
|
-
f(this,
|
|
181
|
+
f(this, T, e);
|
|
182
182
|
}
|
|
183
183
|
/** A function used to filter out dates. */
|
|
184
184
|
get dateFilter() {
|
|
185
|
-
return k(this,
|
|
185
|
+
return k(this, E);
|
|
186
186
|
}
|
|
187
187
|
set dateFilter(e) {
|
|
188
|
-
f(this,
|
|
188
|
+
f(this, E, e);
|
|
189
189
|
}
|
|
190
190
|
/** The orientation of days in the calendar. */
|
|
191
191
|
get orientation() {
|
|
192
|
-
return k(this,
|
|
192
|
+
return k(this, P);
|
|
193
193
|
}
|
|
194
194
|
set orientation(e) {
|
|
195
|
-
f(this,
|
|
195
|
+
f(this, P, e);
|
|
196
196
|
}
|
|
197
197
|
/** Whether it has to display the week numbers in addition to week days. */
|
|
198
198
|
get weekNumbers() {
|
|
199
|
-
return k(this,
|
|
199
|
+
return k(this, L);
|
|
200
200
|
}
|
|
201
201
|
set weekNumbers(e) {
|
|
202
|
-
f(this,
|
|
202
|
+
f(this, L, e);
|
|
203
203
|
}
|
|
204
204
|
/** The currently active date. */
|
|
205
205
|
get _activeDate() {
|
|
206
|
-
return k(this,
|
|
206
|
+
return k(this, B);
|
|
207
207
|
}
|
|
208
208
|
set _activeDate(e) {
|
|
209
|
-
f(this,
|
|
209
|
+
f(this, B, e);
|
|
210
210
|
}
|
|
211
211
|
/** The current wide property considering property value and breakpoints. From zero to small `wide` has always to be false. */
|
|
212
212
|
set _wide(e) {
|
|
@@ -216,10 +216,10 @@ let It = (() => {
|
|
|
216
216
|
return this.hasAttribute("data-wide");
|
|
217
217
|
}
|
|
218
218
|
get _calendarView() {
|
|
219
|
-
return k(this,
|
|
219
|
+
return k(this, H);
|
|
220
220
|
}
|
|
221
221
|
set _calendarView(e) {
|
|
222
|
-
f(this,
|
|
222
|
+
f(this, H, e);
|
|
223
223
|
}
|
|
224
224
|
/** A list of buttons corresponding to days, months or years depending on the view. */
|
|
225
225
|
get _cells() {
|
|
@@ -261,12 +261,12 @@ let It = (() => {
|
|
|
261
261
|
}
|
|
262
262
|
/** Initializes the component. */
|
|
263
263
|
_init(e) {
|
|
264
|
-
if (!
|
|
264
|
+
if (!Re) {
|
|
265
265
|
if (this.hydrationRequired) {
|
|
266
266
|
this.hydrationComplete.then(() => this._init());
|
|
267
267
|
return;
|
|
268
268
|
}
|
|
269
|
-
if (e && this._assignActiveDate(e), this._wide = (this._mediaMatcher.matches(
|
|
269
|
+
if (e && this._assignActiveDate(e), this._wide = (this._mediaMatcher.matches(Se) ?? !1) && this.wide, this._weeks = this._createWeekRows(this._activeDate), this._years = this._createYearRows(), this._weekNumbers = this._createWeekNumbers(this._activeDate), this._nextMonthWeeks = [[]], this._nextMonthYears = [[]], this._wide) {
|
|
270
270
|
const t = this._dateAdapter.addCalendarMonths(this._activeDate, 1);
|
|
271
271
|
this._nextMonthWeeks = this._createWeekRows(t, !0), this._nextMonthYears = this._createYearRows(V), this._nextMonthWeekNumbers = this._createWeekNumbers(t);
|
|
272
272
|
}
|
|
@@ -297,7 +297,7 @@ let It = (() => {
|
|
|
297
297
|
* Then, this array is mapped via the `getWeek` function, which returns the ISO week number for that date.
|
|
298
298
|
*/
|
|
299
299
|
_createWeekNumbers(e) {
|
|
300
|
-
return
|
|
300
|
+
return ut({ start: ft(e), end: bt(e) }, { weekStartsOn: 1 }).map((t) => ee(t, { weekStartsOn: 1, firstWeekContainsDate: 4 }));
|
|
301
301
|
}
|
|
302
302
|
/** Creates the rows along the horizontal direction and sets the parameters used in keyboard navigation. */
|
|
303
303
|
_createWeekRows(e, t = !1) {
|
|
@@ -316,15 +316,15 @@ let It = (() => {
|
|
|
316
316
|
const i = [[]];
|
|
317
317
|
for (let l = 0, r = s; l < a; l++, r++) {
|
|
318
318
|
r === D && (i.push([]), r = 0);
|
|
319
|
-
const
|
|
319
|
+
const c = this._dateAdapter.createDate(this._dateAdapter.getYear(e), this._dateAdapter.getMonth(e), l + 1), _ = this._dateAdapter.toIso8601(c);
|
|
320
320
|
i[i.length - 1].push({
|
|
321
321
|
value: _,
|
|
322
|
-
dateValue:
|
|
322
|
+
dateValue: c,
|
|
323
323
|
dayValue: t[l],
|
|
324
|
-
monthValue: String(this._dateAdapter.getMonth(
|
|
325
|
-
yearValue: String(this._dateAdapter.getYear(
|
|
326
|
-
weekValue:
|
|
327
|
-
weekDayValue: this._dateAdapter.getDayOfWeek(
|
|
324
|
+
monthValue: String(this._dateAdapter.getMonth(c)),
|
|
325
|
+
yearValue: String(this._dateAdapter.getYear(c)),
|
|
326
|
+
weekValue: ee(_, { weekStartsOn: 1, firstWeekContainsDate: 4 }),
|
|
327
|
+
weekDayValue: this._dateAdapter.getDayOfWeek(c)
|
|
328
328
|
});
|
|
329
329
|
}
|
|
330
330
|
return i;
|
|
@@ -347,15 +347,15 @@ let It = (() => {
|
|
|
347
347
|
const i = Array.from({ length: D }, () => []);
|
|
348
348
|
for (let l = 0, r = s; l < a; l++, r++) {
|
|
349
349
|
r === D && (r = 0);
|
|
350
|
-
const
|
|
350
|
+
const c = this._dateAdapter.createDate(this._dateAdapter.getYear(e), this._dateAdapter.getMonth(e), l + 1), _ = this._dateAdapter.toIso8601(c);
|
|
351
351
|
i[r].push({
|
|
352
352
|
value: _,
|
|
353
|
-
dateValue:
|
|
353
|
+
dateValue: c,
|
|
354
354
|
dayValue: t[l],
|
|
355
|
-
monthValue: String(this._dateAdapter.getMonth(
|
|
356
|
-
yearValue: String(this._dateAdapter.getYear(
|
|
357
|
-
weekValue:
|
|
358
|
-
weekDayValue: this._dateAdapter.getDayOfWeek(
|
|
355
|
+
monthValue: String(this._dateAdapter.getMonth(c)),
|
|
356
|
+
yearValue: String(this._dateAdapter.getYear(c)),
|
|
357
|
+
weekValue: ee(_, { weekStartsOn: 1, firstWeekContainsDate: 4 }),
|
|
358
|
+
weekDayValue: this._dateAdapter.getDayOfWeek(c)
|
|
359
359
|
});
|
|
360
360
|
}
|
|
361
361
|
return i;
|
|
@@ -436,22 +436,16 @@ let It = (() => {
|
|
|
436
436
|
return !1;
|
|
437
437
|
}
|
|
438
438
|
/** Emits the selected date and sets it internally. */
|
|
439
|
-
_selectDate(e
|
|
439
|
+
_selectDate(e) {
|
|
440
440
|
if (this._chosenMonth = void 0, this._setChosenYear(), this.multiple) {
|
|
441
|
-
if (
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
else {
|
|
448
|
-
if (this._selected?.length === 1 && this._dateAdapter.compareDate(this._selected[0], t) === 0)
|
|
449
|
-
return;
|
|
450
|
-
this._selected = [t];
|
|
451
|
-
}
|
|
452
|
-
this._emitDateSelectedEvent(this._selected.map((a) => this._dateAdapter.deserialize(a)));
|
|
441
|
+
if (this._selected && this._selected.length > 0) {
|
|
442
|
+
const t = this._selected.findIndex((a) => this._dateAdapter.compareDate(a, e) === 0);
|
|
443
|
+
t !== -1 ? this._selected = this._selected.filter((a, s) => s !== t) : this._selected = [...this._selected, e];
|
|
444
|
+
} else
|
|
445
|
+
this._selected = [e];
|
|
446
|
+
this._emitDateSelectedEvent(this._selected.map((t) => this._dateAdapter.deserialize(t)));
|
|
453
447
|
} else
|
|
454
|
-
(!this._selected || this._dateAdapter.compareDate(this._selected,
|
|
448
|
+
(!this._selected || this._dateAdapter.compareDate(this._selected, e) !== 0) && (this._selected = e, this._emitDateSelectedEvent(this._dateAdapter.deserialize(e)));
|
|
455
449
|
}
|
|
456
450
|
/**
|
|
457
451
|
* Handle multiple dates selection via weekNumber / weekDay buttons:
|
|
@@ -460,17 +454,9 @@ let It = (() => {
|
|
|
460
454
|
* - if the new dates are the same of the current ones, it means that the same button has been clicked twice, so do nothing;
|
|
461
455
|
* - if not, the selected dates are the new ones.
|
|
462
456
|
*/
|
|
463
|
-
_selectMultipleDates(e
|
|
464
|
-
const
|
|
465
|
-
|
|
466
|
-
const r = this._updateSelectedWithMultipleDates(s, i, l);
|
|
467
|
-
this._selected = r.map((d) => this._dateAdapter.deserialize(d));
|
|
468
|
-
} else {
|
|
469
|
-
if (i.size === l.size && [...i].every((r) => l.has(r)))
|
|
470
|
-
return;
|
|
471
|
-
this._selected = s.map((r) => this._dateAdapter.deserialize(r));
|
|
472
|
-
}
|
|
473
|
-
this._emitDateSelectedEvent(this._selected.map((r) => this._dateAdapter.deserialize(r)));
|
|
457
|
+
_selectMultipleDates(e) {
|
|
458
|
+
const t = this._cells.filter((r) => !r.disabled).map((r) => r.value), a = e.map((r) => r.value).filter((r) => t.includes(r)), s = new Set(a), i = new Set(this._selected.map((r) => this._dateAdapter.toIso8601(r))), l = this._updateSelectedWithMultipleDates(a, s, i);
|
|
459
|
+
this._selected = l.map((r) => this._dateAdapter.deserialize(r)), this._emitDateSelectedEvent(this._selected.map((r) => this._dateAdapter.deserialize(r)));
|
|
474
460
|
}
|
|
475
461
|
/**
|
|
476
462
|
* Emits the dateselected event given the detail (as T or T[] based on the value of the multiple flag).
|
|
@@ -585,7 +571,7 @@ let It = (() => {
|
|
|
585
571
|
}
|
|
586
572
|
}
|
|
587
573
|
_handleKeyboardEvent(e, t) {
|
|
588
|
-
|
|
574
|
+
Ke(e) && e.preventDefault();
|
|
589
575
|
const a = this._cells, s = a.findIndex((r) => r === e.target);
|
|
590
576
|
let i;
|
|
591
577
|
t ? i = this._navigateByKeyboardDayView(e, s, a, t) : i = this._navigateByKeyboard(e, s, a);
|
|
@@ -605,16 +591,16 @@ let It = (() => {
|
|
|
605
591
|
return this._findDayArrows(a, t, s.dateValue, i.leftRight);
|
|
606
592
|
case "PageUp":
|
|
607
593
|
if (this.orientation === "horizontal") {
|
|
608
|
-
const
|
|
609
|
-
return this._findDayPageUpDown(a, t, s,
|
|
594
|
+
const c = (+s.dayValue % D || D) - +s.dayValue;
|
|
595
|
+
return this._findDayPageUpDown(a, t, s, c, i.upDown);
|
|
610
596
|
} else {
|
|
611
597
|
const _ = (Math.ceil((+s.dayValue + l) / D) - 1) * D - l + 1 - +s.dayValue;
|
|
612
598
|
return this._findDayPageUpDown(a, t, s, _, i.upDown);
|
|
613
599
|
}
|
|
614
600
|
case "PageDown":
|
|
615
601
|
if (this.orientation === "horizontal") {
|
|
616
|
-
const r = +s.monthValue + 1 > 12 ? 1 : +s.monthValue + 1,
|
|
617
|
-
return this._findDayPageUpDown(a, t, s,
|
|
602
|
+
const r = +s.monthValue + 1 > 12 ? 1 : +s.monthValue + 1, c = +s.monthValue + 1 > 12 ? +s.yearValue + 1 : +s.yearValue, _ = this._dateAdapter.createDate(c, r, 1), w = this._dateAdapter.getDate(this._dateAdapter.addCalendarDays(_, -1)), j = Math.trunc((w - +s.dayValue) / D) * D;
|
|
603
|
+
return this._findDayPageUpDown(a, t, s, j, -i.upDown);
|
|
618
604
|
} else {
|
|
619
605
|
const _ = Math.ceil((+s.dayValue + l) / D) * D - l - +s.dayValue;
|
|
620
606
|
return this._findDayPageUpDown(a, t, s, _, -i.upDown);
|
|
@@ -622,7 +608,7 @@ let It = (() => {
|
|
|
622
608
|
case "Home":
|
|
623
609
|
return this._findDayFirst(a, t, s, 1);
|
|
624
610
|
case "End": {
|
|
625
|
-
const r = +s.monthValue + 1 > 12 ? 1 : +s.monthValue + 1,
|
|
611
|
+
const r = +s.monthValue + 1 > 12 ? 1 : +s.monthValue + 1, c = +s.monthValue + 1 > 12 ? +s.yearValue + 1 : +s.yearValue, _ = this._dateAdapter.createDate(c, r, 1);
|
|
626
612
|
return this._findDayLast(a, t, _);
|
|
627
613
|
}
|
|
628
614
|
default:
|
|
@@ -643,7 +629,7 @@ let It = (() => {
|
|
|
643
629
|
const l = this._dateAdapter.toIso8601(this._dateAdapter.addCalendarDays(a.dateValue, s));
|
|
644
630
|
if (this._isDayOutOfView(l))
|
|
645
631
|
return e[t];
|
|
646
|
-
const r = e.find((
|
|
632
|
+
const r = e.find((c) => c.value === l);
|
|
647
633
|
return !r || r.disabled ? this._findDayPageUpDown(e, t, a, s + i, i) : r;
|
|
648
634
|
}
|
|
649
635
|
_findDayFirst(e, t, a, s) {
|
|
@@ -695,7 +681,7 @@ let It = (() => {
|
|
|
695
681
|
* @param isYearView Whether the displayed `view` is the year one.
|
|
696
682
|
*/
|
|
697
683
|
_calculateParametersForKeyboardNavigation(e, t) {
|
|
698
|
-
const a = t ? V :
|
|
684
|
+
const a = t ? V : Je, s = Math.trunc(e / a) * a, i = s === 0 ? e : e - a;
|
|
699
685
|
return {
|
|
700
686
|
verticalOffset: t ? X : J,
|
|
701
687
|
elementIndexForWideMode: i,
|
|
@@ -739,23 +725,23 @@ let It = (() => {
|
|
|
739
725
|
const e = this._wide ? this._dateAdapter.addCalendarMonths(this._activeDate, 1) : void 0;
|
|
740
726
|
return h`
|
|
741
727
|
<div class="sbb-calendar__controls">
|
|
742
|
-
${this._getArrow("left", () => this._goToDifferentMonth(-1),
|
|
728
|
+
${this._getArrow("left", () => this._goToDifferentMonth(-1), Ze[this._language.current], this._previousMonthDisabled())}
|
|
743
729
|
<div class="sbb-calendar__controls-month">
|
|
744
730
|
${this._createLabelForDayView(this._activeDate)}
|
|
745
|
-
${this._wide ? this._createLabelForDayView(e) :
|
|
731
|
+
${this._wide ? this._createLabelForDayView(e) : m}
|
|
746
732
|
<sbb-screen-reader-only role="status">
|
|
747
733
|
${this._createAriaLabelForDayView(this._activeDate, e)}
|
|
748
734
|
</sbb-screen-reader-only>
|
|
749
735
|
</div>
|
|
750
|
-
${this._getArrow("right", () => this._goToDifferentMonth(1),
|
|
736
|
+
${this._getArrow("right", () => this._goToDifferentMonth(1), et[this._language.current], this._nextMonthDisabled())}
|
|
751
737
|
</div>
|
|
752
738
|
<div class="sbb-calendar__table-container sbb-calendar__table-day-view">
|
|
753
739
|
${this.orientation === "horizontal" ? h`
|
|
754
740
|
${this._createDayTable(this._weeks, this._weekNumbers)}
|
|
755
|
-
${this._wide ? this._createDayTable(this._nextMonthWeeks, this._nextMonthWeekNumbers, !0) :
|
|
741
|
+
${this._wide ? this._createDayTable(this._nextMonthWeeks, this._nextMonthWeekNumbers, !0) : m}
|
|
756
742
|
` : h`
|
|
757
743
|
${this._createDayTableVertical(this._weeks, this._weekNumbers)}
|
|
758
|
-
${this._wide ? this._createDayTableVertical(this._nextMonthWeeks, this._nextMonthWeekNumbers, e) :
|
|
744
|
+
${this._wide ? this._createDayTableVertical(this._nextMonthWeeks, this._nextMonthWeekNumbers, e) : m}
|
|
759
745
|
`}
|
|
760
746
|
</div>
|
|
761
747
|
`;
|
|
@@ -767,7 +753,7 @@ let It = (() => {
|
|
|
767
753
|
<button
|
|
768
754
|
type="button"
|
|
769
755
|
class="sbb-calendar__date-selection sbb-calendar__controls-change-date"
|
|
770
|
-
aria-label="${
|
|
756
|
+
aria-label="${tt[this._language.current]} ${t}"
|
|
771
757
|
@click=${() => {
|
|
772
758
|
this._resetFocus = !0, this._nextCalendarView = "year", this._startTableTransition();
|
|
773
759
|
}}
|
|
@@ -795,16 +781,16 @@ let It = (() => {
|
|
|
795
781
|
>
|
|
796
782
|
<thead class="sbb-calendar__table-header">
|
|
797
783
|
<tr>
|
|
798
|
-
${this.weekNumbers ? h`<th class="sbb-calendar__table-header-cell"></th>` :
|
|
799
|
-
${this._weekdays.map((r,
|
|
784
|
+
${this.weekNumbers ? h`<th class="sbb-calendar__table-header-cell"></th>` : m}
|
|
785
|
+
${this._weekdays.map((r, c) => h`
|
|
800
786
|
<th class="sbb-calendar__table-header-cell">
|
|
801
787
|
${this.multiple ? h`
|
|
802
788
|
<button
|
|
803
789
|
class="sbb-calendar__header-cell sbb-calendar__weekday"
|
|
804
790
|
aria-label=${r.long}
|
|
805
|
-
@click=${(
|
|
806
|
-
const
|
|
807
|
-
this._selectMultipleDates(_
|
|
791
|
+
@click=${() => {
|
|
792
|
+
const _ = l.filter((w) => w.weekDayValue === (c + 1) % 7);
|
|
793
|
+
this._selectMultipleDates(_);
|
|
808
794
|
}}
|
|
809
795
|
>
|
|
810
796
|
${r.narrow}
|
|
@@ -818,31 +804,31 @@ let It = (() => {
|
|
|
818
804
|
</tr>
|
|
819
805
|
</thead>
|
|
820
806
|
<tbody class="sbb-calendar__table-body">
|
|
821
|
-
${e.map((r,
|
|
807
|
+
${e.map((r, c) => {
|
|
822
808
|
const _ = D - r.length;
|
|
823
|
-
return
|
|
809
|
+
return c === 0 && _ ? h`
|
|
824
810
|
<tr>
|
|
825
811
|
${this.weekNumbers ? h`
|
|
826
812
|
<td class="sbb-calendar__table-header-cell">
|
|
827
813
|
${this.multiple ? h`
|
|
828
814
|
<button
|
|
829
815
|
class="sbb-calendar__header-cell sbb-calendar__weekday"
|
|
830
|
-
aria-label=${`${
|
|
831
|
-
@click=${(
|
|
832
|
-
const
|
|
833
|
-
this._selectMultipleDates(
|
|
816
|
+
aria-label=${`${K[this._language.current]} ${t[0]}`}
|
|
817
|
+
@click=${() => {
|
|
818
|
+
const w = i.filter((j) => j.weekValue === t[0]);
|
|
819
|
+
this._selectMultipleDates(w);
|
|
834
820
|
}}
|
|
835
821
|
>
|
|
836
822
|
${t[0]}
|
|
837
823
|
</button>
|
|
838
824
|
` : h`
|
|
839
825
|
<sbb-screen-reader-only
|
|
840
|
-
>${`${
|
|
826
|
+
>${`${K[this._language.current]} ${t[0]}`}</sbb-screen-reader-only
|
|
841
827
|
>
|
|
842
828
|
<span aria-hidden="true">${t[0]}</span>
|
|
843
829
|
`}
|
|
844
830
|
</td>
|
|
845
|
-
` :
|
|
831
|
+
` : m}
|
|
846
832
|
${[...Array(_).keys()].map(() => h`<td class="sbb-calendar__table-data"></td>`)}
|
|
847
833
|
${this._createDayCells(r, s)}
|
|
848
834
|
</tr>
|
|
@@ -853,22 +839,22 @@ let It = (() => {
|
|
|
853
839
|
${this.multiple ? h`
|
|
854
840
|
<button
|
|
855
841
|
class="sbb-calendar__header-cell sbb-calendar__weekday"
|
|
856
|
-
aria-label=${`${
|
|
857
|
-
@click=${(
|
|
858
|
-
const
|
|
859
|
-
this._selectMultipleDates(
|
|
842
|
+
aria-label=${`${K[this._language.current]} ${t[c]}`}
|
|
843
|
+
@click=${() => {
|
|
844
|
+
const w = i.filter((j) => j.weekValue === t[c]);
|
|
845
|
+
this._selectMultipleDates(w);
|
|
860
846
|
}}
|
|
861
847
|
>
|
|
862
|
-
${t[
|
|
848
|
+
${t[c]}
|
|
863
849
|
</button>
|
|
864
850
|
` : h`
|
|
865
851
|
<sbb-screen-reader-only
|
|
866
|
-
>${`${
|
|
852
|
+
>${`${K[this._language.current]} ${t[c]}`}</sbb-screen-reader-only
|
|
867
853
|
>
|
|
868
|
-
<span aria-hidden="true">${t[
|
|
854
|
+
<span aria-hidden="true">${t[c]}</span>
|
|
869
855
|
`}
|
|
870
856
|
</td>
|
|
871
|
-
` :
|
|
857
|
+
` : m}
|
|
872
858
|
${this._createDayCells(r, s)}
|
|
873
859
|
</tr>
|
|
874
860
|
`;
|
|
@@ -889,23 +875,23 @@ let It = (() => {
|
|
|
889
875
|
${this.weekNumbers ? h`
|
|
890
876
|
<thead class="sbb-calendar__table-header">
|
|
891
877
|
<tr>
|
|
892
|
-
${a ?
|
|
878
|
+
${a ? m : h`<th class="sbb-calendar__table-data"></th>`}
|
|
893
879
|
${t.map((r) => h`
|
|
894
880
|
<th class="sbb-calendar__table-header-cell">
|
|
895
881
|
${this.multiple ? h`
|
|
896
882
|
<button
|
|
897
883
|
class="sbb-calendar__header-cell sbb-calendar__weekday"
|
|
898
|
-
aria-label=${`${
|
|
899
|
-
@click=${(
|
|
900
|
-
const
|
|
901
|
-
this._selectMultipleDates(
|
|
884
|
+
aria-label=${`${K[this._language.current]} ${r}`}
|
|
885
|
+
@click=${() => {
|
|
886
|
+
const c = l.filter((_) => _.weekValue === r);
|
|
887
|
+
this._selectMultipleDates(c);
|
|
902
888
|
}}
|
|
903
889
|
>
|
|
904
890
|
${r}
|
|
905
891
|
</button>
|
|
906
892
|
` : h`
|
|
907
893
|
<sbb-screen-reader-only
|
|
908
|
-
>${`${
|
|
894
|
+
>${`${K[this._language.current]} ${r}`}</sbb-screen-reader-only
|
|
909
895
|
>
|
|
910
896
|
<span aria-hidden="true">${r}</span>
|
|
911
897
|
`}
|
|
@@ -913,19 +899,19 @@ let It = (() => {
|
|
|
913
899
|
`)}
|
|
914
900
|
</tr>
|
|
915
901
|
</thead>
|
|
916
|
-
` :
|
|
902
|
+
` : m}
|
|
917
903
|
<tbody class="sbb-calendar__table-body">
|
|
918
|
-
${e.map((r,
|
|
919
|
-
const _ = this._weekdays[
|
|
904
|
+
${e.map((r, c) => {
|
|
905
|
+
const _ = this._weekdays[c], w = this._wide ? [...r, ...this._nextMonthWeeks[c]] : r;
|
|
920
906
|
return h`
|
|
921
907
|
<tr>
|
|
922
|
-
${a ?
|
|
908
|
+
${a ? m : h`
|
|
923
909
|
<td class="sbb-calendar__table-header-cell">
|
|
924
910
|
${this.multiple ? h`
|
|
925
911
|
<button
|
|
926
912
|
class="sbb-calendar__header-cell sbb-calendar__weekday"
|
|
927
913
|
aria-label=${_.long}
|
|
928
|
-
@click=${(
|
|
914
|
+
@click=${() => this._selectMultipleDates(w)}
|
|
929
915
|
>
|
|
930
916
|
${_.narrow}
|
|
931
917
|
</button>
|
|
@@ -935,7 +921,7 @@ let It = (() => {
|
|
|
935
921
|
`}
|
|
936
922
|
</td>
|
|
937
923
|
`}
|
|
938
|
-
${
|
|
924
|
+
${c < i ? h`<td class="sbb-calendar__table-data"></td>` : m}
|
|
939
925
|
${this._createDayCells(r, s)}
|
|
940
926
|
</tr>
|
|
941
927
|
`;
|
|
@@ -949,7 +935,7 @@ let It = (() => {
|
|
|
949
935
|
return e.map((a) => {
|
|
950
936
|
const s = !this._isDayInRange(a.value), i = !this._dateFilter(this._dateAdapter.deserialize(a.value)), l = a.value === t;
|
|
951
937
|
let r;
|
|
952
|
-
return this.multiple ? r = this._selected.find((
|
|
938
|
+
return this.multiple ? r = this._selected.find((c) => this._dateAdapter.compareDate(a.dateValue, c) === 0) !== void 0 : r = !!this._selected && this._dateAdapter.compareDate(a.dateValue, this._selected) === 0, h`
|
|
953
939
|
<td
|
|
954
940
|
class=${Q({
|
|
955
941
|
"sbb-calendar__table-data": !0,
|
|
@@ -964,16 +950,16 @@ let It = (() => {
|
|
|
964
950
|
"sbb-calendar__selected": r,
|
|
965
951
|
"sbb-calendar__crossed-out": !s && i
|
|
966
952
|
})}
|
|
967
|
-
@click=${(
|
|
953
|
+
@click=${() => this._selectDate(a.dateValue)}
|
|
968
954
|
?disabled=${s || i}
|
|
969
955
|
value=${a.value}
|
|
970
956
|
type="button"
|
|
971
957
|
aria-label=${this._dateAdapter.getAccessibilityFormatDate(a.value)}
|
|
972
958
|
aria-pressed=${r}
|
|
973
959
|
aria-disabled=${s || i}
|
|
974
|
-
aria-current=${l ? "date" :
|
|
960
|
+
aria-current=${l ? "date" : m}
|
|
975
961
|
tabindex="-1"
|
|
976
|
-
@keydown=${(
|
|
962
|
+
@keydown=${(c) => this._handleKeyboardEvent(c, a)}
|
|
977
963
|
sbb-popover-close
|
|
978
964
|
>
|
|
979
965
|
${a.dayValue}
|
|
@@ -986,13 +972,13 @@ let It = (() => {
|
|
|
986
972
|
_renderMonthView() {
|
|
987
973
|
return h`
|
|
988
974
|
<div class="sbb-calendar__controls">
|
|
989
|
-
${this._getArrow("left", () => this._goToDifferentYear(-1),
|
|
975
|
+
${this._getArrow("left", () => this._goToDifferentYear(-1), at[this._language.current], this._previousYearDisabled())}
|
|
990
976
|
<div class="sbb-calendar__controls-month">${this._createLabelForMonthView()}</div>
|
|
991
|
-
${this._getArrow("right", () => this._goToDifferentYear(1),
|
|
977
|
+
${this._getArrow("right", () => this._goToDifferentYear(1), st[this._language.current], this._nextYearDisabled())}
|
|
992
978
|
</div>
|
|
993
979
|
<div class="sbb-calendar__table-container sbb-calendar__table-month-view">
|
|
994
980
|
${this._createMonthTable(this._months, this._chosenYear)}
|
|
995
|
-
${this._wide ? this._createMonthTable(this._months, this._chosenYear + 1) :
|
|
981
|
+
${this._wide ? this._createMonthTable(this._months, this._chosenYear + 1) : m}
|
|
996
982
|
</div>
|
|
997
983
|
`;
|
|
998
984
|
}
|
|
@@ -1002,10 +988,10 @@ let It = (() => {
|
|
|
1002
988
|
type="button"
|
|
1003
989
|
id="sbb-calendar__month-selection"
|
|
1004
990
|
class="sbb-calendar__controls-change-date"
|
|
1005
|
-
aria-label=${`${
|
|
991
|
+
aria-label=${`${Ee[this._language.current]} ${this._chosenYear}`}
|
|
1006
992
|
@click=${() => this._resetCalendarView(!0)}
|
|
1007
993
|
>
|
|
1008
|
-
${this._chosenYear} ${this._wide ? ` - ${this._chosenYear + 1}` :
|
|
994
|
+
${this._chosenYear} ${this._wide ? ` - ${this._chosenYear + 1}` : m}
|
|
1009
995
|
<sbb-icon name="chevron-small-up-small"></sbb-icon>
|
|
1010
996
|
</button>
|
|
1011
997
|
<sbb-screen-reader-only role="status"> ${this._chosenYear} </sbb-screen-reader-only>`;
|
|
@@ -1021,7 +1007,7 @@ let It = (() => {
|
|
|
1021
1007
|
<tr>
|
|
1022
1008
|
<th class="sbb-calendar__table-header-cell" colspan=${J}>${t}</th>
|
|
1023
1009
|
</tr>
|
|
1024
|
-
</thead>` :
|
|
1010
|
+
</thead>` : m}
|
|
1025
1011
|
<tbody class="sbb-calendar__table-body">
|
|
1026
1012
|
${e.map((a) => h`
|
|
1027
1013
|
<tr>
|
|
@@ -1030,10 +1016,10 @@ let It = (() => {
|
|
|
1030
1016
|
if (this.multiple)
|
|
1031
1017
|
i = this._selected.find((_) => t === this._dateAdapter.getYear(_) && s.monthValue === this._dateAdapter.getMonth(_)) !== void 0;
|
|
1032
1018
|
else {
|
|
1033
|
-
const _ = this._selected ? this._dateAdapter.getMonth(this._selected) : void 0,
|
|
1034
|
-
i = !!this._selected && t ===
|
|
1019
|
+
const _ = this._selected ? this._dateAdapter.getMonth(this._selected) : void 0, w = this._selected ? this._dateAdapter.getYear(this._selected) : void 0;
|
|
1020
|
+
i = !!this._selected && t === w && s.monthValue === _;
|
|
1035
1021
|
}
|
|
1036
|
-
const l = !this._isMonthInRange(s.monthValue, t), r = !this._isMonthFilteredOut(s.monthValue, t),
|
|
1022
|
+
const l = !this._isMonthInRange(s.monthValue, t), r = !this._isMonthFilteredOut(s.monthValue, t), c = t === this._dateAdapter.getYear(this._dateAdapter.today()) && this._dateAdapter.getMonth(this._dateAdapter.today()) === s.monthValue;
|
|
1037
1023
|
return h` <td
|
|
1038
1024
|
class=${Q({
|
|
1039
1025
|
"sbb-calendar__table-data": !0,
|
|
@@ -1044,7 +1030,7 @@ let It = (() => {
|
|
|
1044
1030
|
class=${Q({
|
|
1045
1031
|
"sbb-calendar__cell": !0,
|
|
1046
1032
|
"sbb-calendar__pill": !0,
|
|
1047
|
-
"sbb-calendar__cell-current":
|
|
1033
|
+
"sbb-calendar__cell-current": c,
|
|
1048
1034
|
"sbb-calendar__crossed-out": !l && r,
|
|
1049
1035
|
"sbb-calendar__selected": i
|
|
1050
1036
|
})}
|
|
@@ -1054,7 +1040,7 @@ let It = (() => {
|
|
|
1054
1040
|
aria-pressed=${i}
|
|
1055
1041
|
aria-disabled=${String(l || r)}
|
|
1056
1042
|
tabindex="-1"
|
|
1057
|
-
data-month=${s.monthValue ||
|
|
1043
|
+
data-month=${s.monthValue || m}
|
|
1058
1044
|
@keydown=${(_) => this._handleKeyboardEvent(_)}
|
|
1059
1045
|
>
|
|
1060
1046
|
${s.value}
|
|
@@ -1075,13 +1061,13 @@ let It = (() => {
|
|
|
1075
1061
|
_renderYearView() {
|
|
1076
1062
|
return h`
|
|
1077
1063
|
<div class="sbb-calendar__controls">
|
|
1078
|
-
${this._getArrow("left", () => this._goToDifferentYearRange(-V),
|
|
1064
|
+
${this._getArrow("left", () => this._goToDifferentYearRange(-V), it(V)[this._language.current], this._previousYearRangeDisabled())}
|
|
1079
1065
|
<div class="sbb-calendar__controls-month">${this._createLabelForYearView()}</div>
|
|
1080
|
-
${this._getArrow("right", () => this._goToDifferentYearRange(V),
|
|
1066
|
+
${this._getArrow("right", () => this._goToDifferentYearRange(V), rt(V)[this._language.current], this._nextYearRangeDisabled())}
|
|
1081
1067
|
</div>
|
|
1082
1068
|
<div class="sbb-calendar__table-container sbb-calendar__table-year-view">
|
|
1083
1069
|
${this._createYearTable(this._years)}
|
|
1084
|
-
${this._wide ? this._createYearTable(this._nextMonthYears, !0) :
|
|
1070
|
+
${this._wide ? this._createYearTable(this._nextMonthYears, !0) : m}
|
|
1085
1071
|
</div>
|
|
1086
1072
|
`;
|
|
1087
1073
|
}
|
|
@@ -1104,7 +1090,7 @@ let It = (() => {
|
|
|
1104
1090
|
type="button"
|
|
1105
1091
|
id="sbb-calendar__year-selection"
|
|
1106
1092
|
class="sbb-calendar__controls-change-date"
|
|
1107
|
-
aria-label="${
|
|
1093
|
+
aria-label="${Ee[this._language.current]} ${s}"
|
|
1108
1094
|
@click=${() => this._resetCalendarView(!0)}
|
|
1109
1095
|
>
|
|
1110
1096
|
${s}
|
|
@@ -1125,29 +1111,29 @@ let It = (() => {
|
|
|
1125
1111
|
${s.map((i) => {
|
|
1126
1112
|
let l;
|
|
1127
1113
|
if (this.multiple)
|
|
1128
|
-
l = this._selected.find((
|
|
1114
|
+
l = this._selected.find((w) => i === this._dateAdapter.getYear(w)) !== void 0;
|
|
1129
1115
|
else {
|
|
1130
|
-
const
|
|
1131
|
-
l = !!this._selected && i ===
|
|
1116
|
+
const w = this._selected ? this._dateAdapter.getYear(this._selected) : void 0;
|
|
1117
|
+
l = !!this._selected && i === w;
|
|
1132
1118
|
}
|
|
1133
|
-
const r = !this._isYearInRange(i),
|
|
1119
|
+
const r = !this._isYearInRange(i), c = !this._isYearFilteredOut(i), _ = this._dateAdapter.getYear(a) === i;
|
|
1134
1120
|
return h` <td class="sbb-calendar__table-data sbb-calendar__table-year">
|
|
1135
1121
|
<button
|
|
1136
1122
|
class=${Q({
|
|
1137
1123
|
"sbb-calendar__cell": !0,
|
|
1138
1124
|
"sbb-calendar__pill": !0,
|
|
1139
1125
|
"sbb-calendar__cell-current": _,
|
|
1140
|
-
"sbb-calendar__crossed-out": !r &&
|
|
1126
|
+
"sbb-calendar__crossed-out": !r && c,
|
|
1141
1127
|
"sbb-calendar__selected": l
|
|
1142
1128
|
})}
|
|
1143
1129
|
@click=${() => this._onYearSelection(i, t)}
|
|
1144
|
-
?disabled=${r ||
|
|
1130
|
+
?disabled=${r || c}
|
|
1145
1131
|
aria-label=${i}
|
|
1146
1132
|
aria-pressed=${l}
|
|
1147
|
-
aria-disabled=${String(r ||
|
|
1133
|
+
aria-disabled=${String(r || c)}
|
|
1148
1134
|
tabindex="-1"
|
|
1149
|
-
data-year=${i ||
|
|
1150
|
-
@keydown=${(
|
|
1135
|
+
data-year=${i || m}
|
|
1136
|
+
@keydown=${(w) => this._handleKeyboardEvent(w)}
|
|
1151
1137
|
>
|
|
1152
1138
|
${i}
|
|
1153
1139
|
</button>
|
|
@@ -1162,8 +1148,8 @@ let It = (() => {
|
|
|
1162
1148
|
this._chosenYear = t ? e - 1 : e, this._nextCalendarView = "month", this._assignActiveDate(this._dateAdapter.createDate(this._chosenYear, this._dateAdapter.getMonth(this._activeDate), this._dateAdapter.getDate(this._activeDate))), this._startTableTransition();
|
|
1163
1149
|
}
|
|
1164
1150
|
_getView() {
|
|
1165
|
-
if (
|
|
1166
|
-
return h`${
|
|
1151
|
+
if (Re || this.hydrationRequired)
|
|
1152
|
+
return h`${m}`;
|
|
1167
1153
|
switch (this._calendarView) {
|
|
1168
1154
|
case "year":
|
|
1169
1155
|
return this._renderYearView();
|
|
@@ -1184,41 +1170,41 @@ let It = (() => {
|
|
|
1184
1170
|
render() {
|
|
1185
1171
|
return h`<div class="sbb-calendar__wrapper">${this._getView()}</div>`;
|
|
1186
1172
|
}
|
|
1187
|
-
}, C = new WeakMap(), I = new WeakMap(), R = new WeakMap(), S = new WeakMap(), T = new WeakMap(), E = new WeakMap(), P = new WeakMap(), L = new WeakMap(), B = new WeakMap(), H = new WeakMap(),
|
|
1173
|
+
}, N = new WeakMap(), C = new WeakMap(), I = new WeakMap(), R = new WeakMap(), S = new WeakMap(), T = new WeakMap(), E = new WeakMap(), P = new WeakMap(), L = new WeakMap(), B = new WeakMap(), H = new WeakMap(), q = new WeakMap(), b = p, (() => {
|
|
1188
1174
|
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(g[Symbol.metadata] ?? null) : void 0;
|
|
1189
|
-
$ = [
|
|
1175
|
+
$ = [Z(), Y({ type: Boolean })], M = [Y()], se = [Te(), Y()], ne = [Te(), Y()], de = [Z(), Xe((t, a) => t._onMultipleChanged(a)), Y({ type: Boolean })], be = [Y()], _e = [G()], pe = [Y({ attribute: "date-filter" })], we = [Y({ reflect: !0 })], De = [Z(), Y({ attribute: "week-numbers", type: Boolean })], xe = [G()], Me = [G()], Ye = [G()], Oe = [G()], y(p, null, $, { kind: "accessor", name: "wide", static: !1, private: !1, access: { has: (t) => "wide" in t, get: (t) => t.wide, set: (t, a) => {
|
|
1190
1176
|
t.wide = a;
|
|
1191
|
-
} }, metadata: e },
|
|
1177
|
+
} }, metadata: e }, O, A), y(p, null, M, { kind: "accessor", name: "view", static: !1, private: !1, access: { has: (t) => "view" in t, get: (t) => t.view, set: (t, a) => {
|
|
1192
1178
|
t.view = a;
|
|
1193
|
-
} }, metadata: e },
|
|
1179
|
+
} }, metadata: e }, W, ae), y(p, null, se, { kind: "accessor", name: "min", static: !1, private: !1, access: { has: (t) => "min" in t, get: (t) => t.min, set: (t, a) => {
|
|
1194
1180
|
t.min = a;
|
|
1195
|
-
} }, metadata: e },
|
|
1181
|
+
} }, metadata: e }, ie, re), y(p, null, ne, { kind: "accessor", name: "max", static: !1, private: !1, access: { has: (t) => "max" in t, get: (t) => t.max, set: (t, a) => {
|
|
1196
1182
|
t.max = a;
|
|
1197
|
-
} }, metadata: e },
|
|
1183
|
+
} }, metadata: e }, le, oe), y(p, null, de, { kind: "accessor", name: "multiple", static: !1, private: !1, access: { has: (t) => "multiple" in t, get: (t) => t.multiple, set: (t, a) => {
|
|
1198
1184
|
t.multiple = a;
|
|
1199
|
-
} }, metadata: e },
|
|
1185
|
+
} }, metadata: e }, ce, he), y(p, null, be, { kind: "setter", name: "selected", static: !1, private: !1, access: { has: (t) => "selected" in t, set: (t, a) => {
|
|
1200
1186
|
t.selected = a;
|
|
1201
|
-
} }, metadata: e }, null, v), y(p, null,
|
|
1187
|
+
} }, metadata: e }, null, v), y(p, null, _e, { kind: "accessor", name: "_selected", static: !1, private: !1, access: { has: (t) => "_selected" in t, get: (t) => t._selected, set: (t, a) => {
|
|
1202
1188
|
t._selected = a;
|
|
1203
|
-
} }, metadata: e },
|
|
1189
|
+
} }, metadata: e }, ue, fe), y(p, null, pe, { kind: "accessor", name: "dateFilter", static: !1, private: !1, access: { has: (t) => "dateFilter" in t, get: (t) => t.dateFilter, set: (t, a) => {
|
|
1204
1190
|
t.dateFilter = a;
|
|
1205
|
-
} }, metadata: e },
|
|
1191
|
+
} }, metadata: e }, ge, me), y(p, null, we, { kind: "accessor", name: "orientation", static: !1, private: !1, access: { has: (t) => "orientation" in t, get: (t) => t.orientation, set: (t, a) => {
|
|
1206
1192
|
t.orientation = a;
|
|
1207
|
-
} }, metadata: e },
|
|
1193
|
+
} }, metadata: e }, ve, ye), y(p, null, De, { kind: "accessor", name: "weekNumbers", static: !1, private: !1, access: { has: (t) => "weekNumbers" in t, get: (t) => t.weekNumbers, set: (t, a) => {
|
|
1208
1194
|
t.weekNumbers = a;
|
|
1209
|
-
} }, metadata: e },
|
|
1195
|
+
} }, metadata: e }, Ae, ke), y(p, null, xe, { kind: "accessor", name: "_activeDate", static: !1, private: !1, access: { has: (t) => "_activeDate" in t, get: (t) => t._activeDate, set: (t, a) => {
|
|
1210
1196
|
t._activeDate = a;
|
|
1211
|
-
} }, metadata: e },
|
|
1197
|
+
} }, metadata: e }, $e, Ve), y(p, null, Me, { kind: "setter", name: "_wide", static: !1, private: !1, access: { has: (t) => "_wide" in t, set: (t, a) => {
|
|
1212
1198
|
t._wide = a;
|
|
1213
|
-
} }, metadata: e }, null, v), y(p, null,
|
|
1199
|
+
} }, metadata: e }, null, v), y(p, null, Ye, { kind: "accessor", name: "_calendarView", static: !1, private: !1, access: { has: (t) => "_calendarView" in t, get: (t) => t._calendarView, set: (t, a) => {
|
|
1214
1200
|
t._calendarView = a;
|
|
1215
|
-
} }, metadata: e },
|
|
1201
|
+
} }, metadata: e }, ze, Fe), y(p, null, Oe, { kind: "accessor", name: "_initialized", static: !1, private: !1, access: { has: (t) => "_initialized" in t, get: (t) => t._initialized, set: (t, a) => {
|
|
1216
1202
|
t._initialized = a;
|
|
1217
|
-
} }, metadata: e },
|
|
1218
|
-
})(), p.styles =
|
|
1203
|
+
} }, metadata: e }, We, Ne), y(null, n = { value: b }, o, { kind: "class", name: b.name, metadata: e }, null, d), b = n.value, e && Object.defineProperty(b, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
1204
|
+
})(), p.styles = mt, p.events = {
|
|
1219
1205
|
dateselected: "dateselected"
|
|
1220
|
-
}, u(b,
|
|
1206
|
+
}, u(b, d), b;
|
|
1221
1207
|
})();
|
|
1222
1208
|
export {
|
|
1223
|
-
|
|
1209
|
+
Ct as SbbCalendarElement
|
|
1224
1210
|
};
|