@sbb-esta/lyne-elements-dev 4.7.0-dev.1773737285 → 4.7.0-dev.1773743095
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/calendar/calendar/calendar.component.js +1 -1
- package/calendar/calendar-day/calendar-day.component.js +1 -1
- package/calendar/calendar-day.js +1 -1
- package/calendar/calendar-month/calendar-month.component.js +84 -0
- package/calendar/calendar-month.js +4 -0
- package/calendar/calendar-weekday/calendar-weekday.component.js +54 -0
- package/calendar/calendar-weekday.js +4 -0
- package/calendar/calendar-weeknumber/calendar-weeknumber.component.js +56 -0
- package/calendar/calendar-weeknumber.js +4 -0
- package/calendar/calendar-year/calendar-year.component.js +80 -0
- package/calendar/calendar-year.js +4 -0
- package/calendar/calendar.js +1 -1
- package/calendar/common/calendar-cell-base-element.js +23 -0
- package/calendar/common.js +6 -0
- package/calendar-day.component-Iewo-vBR.js +109 -0
- package/{calendar.component-BgZDy-rX.js → calendar.component-Cz-OGQu6.js} +140 -224
- package/calendar.js +8 -4
- package/calendar.pure.js +7 -3
- package/carousel/carousel/carousel.component.js +1 -1
- package/carousel/carousel.js +1 -1
- package/carousel.js +1 -1
- package/carousel.pure.js +1 -1
- package/core/styles/core.scss +8 -0
- package/core.css +40 -0
- package/custom-elements.json +4304 -406
- package/development/calendar/calendar/calendar.component.d.ts +7 -9
- package/development/calendar/calendar/calendar.component.d.ts.map +1 -1
- package/development/calendar/calendar/calendar.component.js +1 -1
- package/development/calendar/calendar-day/calendar-day.component.d.ts +7 -21
- package/development/calendar/calendar-day/calendar-day.component.d.ts.map +1 -1
- package/development/calendar/calendar-day/calendar-day.component.js +1 -1
- package/development/calendar/calendar-day.js +1 -1
- package/development/calendar/calendar-month/calendar-month.component.d.ts +33 -0
- package/development/calendar/calendar-month/calendar-month.component.d.ts.map +1 -0
- package/development/calendar/calendar-month/calendar-month.component.js +112 -0
- package/development/calendar/calendar-month.d.ts +2 -0
- package/development/calendar/calendar-month.d.ts.map +1 -0
- package/development/calendar/calendar-month.js +10 -0
- package/development/calendar/calendar-weekday/calendar-weekday.component.d.ts +23 -0
- package/development/calendar/calendar-weekday/calendar-weekday.component.d.ts.map +1 -0
- package/development/calendar/calendar-weekday/calendar-weekday.component.js +67 -0
- package/development/calendar/calendar-weekday.d.ts +2 -0
- package/development/calendar/calendar-weekday.d.ts.map +1 -0
- package/development/calendar/calendar-weekday.js +10 -0
- package/development/calendar/calendar-weeknumber/calendar-weeknumber.component.d.ts +23 -0
- package/development/calendar/calendar-weeknumber/calendar-weeknumber.component.d.ts.map +1 -0
- package/development/calendar/calendar-weeknumber/calendar-weeknumber.component.js +70 -0
- package/development/calendar/calendar-weeknumber.d.ts +2 -0
- package/development/calendar/calendar-weeknumber.d.ts.map +1 -0
- package/development/calendar/calendar-weeknumber.js +10 -0
- package/development/calendar/calendar-year/calendar-year.component.d.ts +28 -0
- package/development/calendar/calendar-year/calendar-year.component.d.ts.map +1 -0
- package/development/calendar/calendar-year/calendar-year.component.js +103 -0
- package/development/calendar/calendar-year.d.ts +2 -0
- package/development/calendar/calendar-year.d.ts.map +1 -0
- package/development/calendar/calendar-year.js +10 -0
- package/development/calendar/calendar.js +1 -1
- package/development/calendar/common/calendar-cell-base-element.d.ts +24 -0
- package/development/calendar/common/calendar-cell-base-element.d.ts.map +1 -0
- package/development/calendar/common/calendar-cell-base-element.js +35 -0
- package/development/calendar/common.d.ts +3 -0
- package/development/calendar/common.d.ts.map +1 -0
- package/development/calendar/common.js +120 -0
- package/development/calendar-day.component-Brz0Wyai.js +178 -0
- package/development/calendar.component-0Pl7qEXL.js +2222 -0
- package/development/calendar.d.ts.map +1 -1
- package/development/calendar.js +12 -4
- package/development/calendar.pure.d.ts +4 -0
- package/development/calendar.pure.d.ts.map +1 -1
- package/development/calendar.pure.js +7 -3
- package/development/carousel/carousel/carousel.component.js +1 -1
- package/development/carousel/carousel.js +1 -1
- package/development/{carousel.component-b4C-hxkj.js → carousel.component-Cs0gWroH.js} +2 -2
- package/development/carousel.js +1 -1
- package/development/carousel.pure.js +1 -1
- package/development/mini-calendar/mini-calendar/mini-calendar.component.js +1 -1
- package/development/mini-calendar/mini-calendar-day/mini-calendar-day.component.js +1 -1
- package/development/mini-calendar/mini-calendar-day.js +1 -1
- package/development/mini-calendar/mini-calendar-month/mini-calendar-month.component.js +1 -1
- package/development/mini-calendar/mini-calendar-month.js +1 -1
- package/development/mini-calendar/mini-calendar.js +1 -1
- package/development/{mini-calendar-day.component-DLP7Pa6R.js → mini-calendar-day.component-DdjlUG0k.js} +2 -2
- package/development/{mini-calendar-month.component-C1jsGlJ2.js → mini-calendar-month.component-BjxmoYz6.js} +2 -2
- package/development/{mini-calendar.component-BzqjMchx.js → mini-calendar.component-B38J84Gg.js} +2 -2
- package/development/mini-calendar.js +3 -3
- package/development/mini-calendar.pure.js +3 -3
- package/development/popover/popover.component.d.ts.map +1 -1
- package/development/popover/popover.component.js +1 -1
- package/development/{popover.component-BpYi6btR.js → popover.component-BujfGgbD.js} +5 -4
- package/development/popover.js +1 -1
- package/development/popover.pure.js +1 -1
- package/index.d.ts +5 -1
- package/index.js +5 -1
- package/mini-calendar/mini-calendar/mini-calendar.component.js +1 -1
- package/mini-calendar/mini-calendar-day/mini-calendar-day.component.js +1 -1
- package/mini-calendar/mini-calendar-day.js +1 -1
- package/mini-calendar/mini-calendar-month/mini-calendar-month.component.js +1 -1
- package/mini-calendar/mini-calendar-month.js +1 -1
- package/mini-calendar/mini-calendar.js +1 -1
- package/{mini-calendar.component-DpPMb47Y.js → mini-calendar.component-_YJbFi4P.js} +4 -4
- package/mini-calendar.js +3 -3
- package/mini-calendar.pure.js +3 -3
- package/off-brand-theme.css +40 -0
- package/package.json +27 -2
- package/popover/popover.component.js +1 -1
- package/{popover.component-D_nJwaqJ.js → popover.component-CktV5oiV.js} +3 -2
- package/popover.js +1 -1
- package/popover.pure.js +1 -1
- package/safety-theme.css +40 -0
- package/standard-theme.css +40 -0
- package/calendar-day.component-DqAXvoP3.js +0 -113
- package/development/calendar-day.component-De9Xn3-q.js +0 -283
- package/development/calendar.component-PHpgLc0z.js +0 -2458
- package/{carousel.component-Bd0iGUbf.js → carousel.component-BA0V2JHI.js} +1 -1
- package/{mini-calendar-day.component-cAawa9Gr.js → mini-calendar-day.component-D5HlCTH0.js} +1 -1
- package/{mini-calendar-month.component-DiYSVb-Y.js → mini-calendar-month.component-CGAOxDtz.js} +1 -1
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { n as e, t } from "../../calendar.component-
|
|
1
|
+
import { n as e, t } from "../../calendar.component-Cz-OGQu6.js";
|
|
2
2
|
export { t as SbbCalendarElement, e as SbbMonthChangeEvent };
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "../../calendar-day.component-
|
|
1
|
+
import { t as e } from "../../calendar-day.component-Iewo-vBR.js";
|
|
2
2
|
export { e as SbbCalendarDayElement };
|
package/calendar/calendar-day.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { t as e } from "../calendar-day.component-
|
|
1
|
+
import { t as e } from "../calendar-day.component-Iewo-vBR.js";
|
|
2
2
|
e.define(), console.warn("The entrypoint '@sbb-esta/elements/calendar/calendar-day.js' has been deprecated.\nUse either '@sbb-esta/elements/calendar.js' or '@sbb-esta/elements/calendar.pure.js' instead.");
|
|
3
3
|
//#endregion
|
|
4
4
|
export { e as SbbCalendarDayElement };
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { __esDecorate as e, __runInitializers as t } from "tslib";
|
|
2
|
+
import { html as n } from "lit";
|
|
3
|
+
import { state as r } from "lit/decorators.js";
|
|
4
|
+
import { boxSizingStyles as i } from "../../core/styles.js";
|
|
5
|
+
import { SbbCalendarCellBaseElement as a, calendarCellBaseStyle as o } from "../common.js";
|
|
6
|
+
//#region src/elements/calendar/calendar-month/calendar-month.component.ts
|
|
7
|
+
var s = (() => {
|
|
8
|
+
let s = a, c = [], l;
|
|
9
|
+
return class a extends s {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this._monthShortNames = (t(this, c), this.dateAdapter.getMonthNames("short")), this._monthLongNames = this.dateAdapter.getMonthNames("long"), this._monthValue = null, this._yearValue = null, this._value = null;
|
|
12
|
+
}
|
|
13
|
+
static {
|
|
14
|
+
let t = typeof Symbol == "function" && Symbol.metadata ? Object.create(s[Symbol.metadata] ?? null) : void 0;
|
|
15
|
+
l = [r()], e(this, null, l, {
|
|
16
|
+
kind: "setter",
|
|
17
|
+
name: "value",
|
|
18
|
+
static: !1,
|
|
19
|
+
private: !1,
|
|
20
|
+
access: {
|
|
21
|
+
has: (e) => "value" in e,
|
|
22
|
+
set: (e, t) => {
|
|
23
|
+
e.value = t;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
metadata: t
|
|
27
|
+
}, null, c), t && Object.defineProperty(this, Symbol.metadata, {
|
|
28
|
+
enumerable: !0,
|
|
29
|
+
configurable: !0,
|
|
30
|
+
writable: !0,
|
|
31
|
+
value: t
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
static {
|
|
35
|
+
this.elementName = "sbb-calendar-month";
|
|
36
|
+
}
|
|
37
|
+
static {
|
|
38
|
+
this.styles = [i, o];
|
|
39
|
+
}
|
|
40
|
+
static {
|
|
41
|
+
this._monthFormatRegex = /^\d{4}-(0[1-9]|1[0-2])$/;
|
|
42
|
+
}
|
|
43
|
+
set value(e) {
|
|
44
|
+
if (!e || !a._monthFormatRegex.test(e)) return;
|
|
45
|
+
this._value = e;
|
|
46
|
+
let t = e.split("-");
|
|
47
|
+
this._yearValue = Number(t[0]), this._monthValue = Number(t[1]);
|
|
48
|
+
let n = this._yearValue === this.dateAdapter.getYear(this.dateAdapter.today()) && this._monthValue === this.dateAdapter.getMonth(this.dateAdapter.today());
|
|
49
|
+
this.toggleState("current", n), this.internals.ariaLabel = `${this._monthLongNames[this._monthValue - 1]} ${this._yearValue}`;
|
|
50
|
+
let r = this.getParent();
|
|
51
|
+
r && (this.setDisabledFilteredState(r), this.setSelectedState(r));
|
|
52
|
+
}
|
|
53
|
+
get value() {
|
|
54
|
+
return this._value;
|
|
55
|
+
}
|
|
56
|
+
connectedCallback() {
|
|
57
|
+
super.connectedCallback(), this.tabIndex = -1;
|
|
58
|
+
}
|
|
59
|
+
setSelectedState(e) {
|
|
60
|
+
let t = e.multiple ? e.selected?.some((e) => this._yearValue === this.dateAdapter.getYear(e) && this._monthValue === this.dateAdapter.getMonth(e)) ?? !1 : !!e.selected && this.dateAdapter.getYear(e.selected) === this._yearValue && this.dateAdapter.getMonth(e.selected) === this._monthValue;
|
|
61
|
+
this.toggleState("selected", t), this.internals.ariaPressed = String(t);
|
|
62
|
+
}
|
|
63
|
+
setDisabledFilteredState(e) {
|
|
64
|
+
let t = !this._isActiveMonth(e), n = !this._isMonthInRange(e.min, e.max);
|
|
65
|
+
this.disabled = t || n, this.internals.ariaDisabled = String(this.disabled), this.toggleState("crossed-out", t && !n);
|
|
66
|
+
}
|
|
67
|
+
_isActiveMonth(e) {
|
|
68
|
+
if (!e.dateFilter || !this._yearValue || !this._monthValue) return !0;
|
|
69
|
+
let t = this.dateAdapter.createDate(this._yearValue, this._monthValue, 1);
|
|
70
|
+
for (let n = t; this.dateAdapter.getMonth(n) == this._monthValue; n = this.dateAdapter.addCalendarDays(n, 1)) if (e.dateFilter(n)) return !0;
|
|
71
|
+
return !1;
|
|
72
|
+
}
|
|
73
|
+
_isMonthInRange(e, t) {
|
|
74
|
+
if (!e && !t || !this._yearValue || !this._monthValue) return !0;
|
|
75
|
+
let n = this.dateAdapter.isValid(e) && (this._yearValue < this.dateAdapter.getYear(e) || this._yearValue === this.dateAdapter.getYear(e) && this._monthValue < this.dateAdapter.getMonth(e)), r = this.dateAdapter.isValid(t) && (this._yearValue > this.dateAdapter.getYear(t) || this._yearValue === this.dateAdapter.getYear(t) && this._monthValue > this.dateAdapter.getMonth(t));
|
|
76
|
+
return !(n || r);
|
|
77
|
+
}
|
|
78
|
+
renderTemplate() {
|
|
79
|
+
return n`${this._monthShortNames[this._monthValue - 1]}`;
|
|
80
|
+
}
|
|
81
|
+
};
|
|
82
|
+
})();
|
|
83
|
+
//#endregion
|
|
84
|
+
export { s as SbbCalendarMonthElement };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SbbCalendarMonthElement as e } from "./calendar-month/calendar-month.component.js";
|
|
2
|
+
e.define(), console.warn("The entrypoint '@sbb-esta/elements/calendar/calendar-month.js' has been deprecated.\nUse either '@sbb-esta/elements/calendar.js' or '@sbb-esta/elements/calendar.pure.js' instead.");
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as SbbCalendarMonthElement };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { __esDecorate as e, __runInitializers as t } from "tslib";
|
|
2
|
+
import { html as n } from "lit";
|
|
3
|
+
import { state as r } from "lit/decorators.js";
|
|
4
|
+
import { boxSizingStyles as i } from "../../core/styles.js";
|
|
5
|
+
import { SbbCalendarCellBaseElement as a, calendarCellBaseStyle as o } from "../common.js";
|
|
6
|
+
//#region src/elements/calendar/calendar-weekday/calendar-weekday.component.ts
|
|
7
|
+
var s = (() => {
|
|
8
|
+
let s = a, c = [], l;
|
|
9
|
+
return class extends s {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this._value = (t(this, c), null);
|
|
12
|
+
}
|
|
13
|
+
static {
|
|
14
|
+
let t = typeof Symbol == "function" && Symbol.metadata ? Object.create(s[Symbol.metadata] ?? null) : void 0;
|
|
15
|
+
l = [r()], e(this, null, l, {
|
|
16
|
+
kind: "setter",
|
|
17
|
+
name: "value",
|
|
18
|
+
static: !1,
|
|
19
|
+
private: !1,
|
|
20
|
+
access: {
|
|
21
|
+
has: (e) => "value" in e,
|
|
22
|
+
set: (e, t) => {
|
|
23
|
+
e.value = t;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
metadata: t
|
|
27
|
+
}, null, c), t && Object.defineProperty(this, Symbol.metadata, {
|
|
28
|
+
enumerable: !0,
|
|
29
|
+
configurable: !0,
|
|
30
|
+
writable: !0,
|
|
31
|
+
value: t
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
static {
|
|
35
|
+
this.elementName = "sbb-calendar-weekday";
|
|
36
|
+
}
|
|
37
|
+
static {
|
|
38
|
+
this.styles = [i, o];
|
|
39
|
+
}
|
|
40
|
+
set value(e) {
|
|
41
|
+
e && (this._value = e, this.internals.ariaLabel = e.long);
|
|
42
|
+
}
|
|
43
|
+
get value() {
|
|
44
|
+
return this._value;
|
|
45
|
+
}
|
|
46
|
+
setSelectedState() {}
|
|
47
|
+
setDisabledFilteredState() {}
|
|
48
|
+
renderTemplate() {
|
|
49
|
+
return n`${this.value?.narrow}`;
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
})();
|
|
53
|
+
//#endregion
|
|
54
|
+
export { s as SbbCalendarWeekdayElement };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SbbCalendarWeekdayElement as e } from "./calendar-weekday/calendar-weekday.component.js";
|
|
2
|
+
e.define(), console.warn("The entrypoint '@sbb-esta/elements/calendar/calendar-weekday.js' has been deprecated.\nUse either '@sbb-esta/elements/calendar.js' or '@sbb-esta/elements/calendar.pure.js' instead.");
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as SbbCalendarWeekdayElement };
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { __esDecorate as e, __runInitializers as t } from "tslib";
|
|
2
|
+
import { html as n } from "lit";
|
|
3
|
+
import { state as r } from "lit/decorators.js";
|
|
4
|
+
import { boxSizingStyles as i } from "../../core/styles.js";
|
|
5
|
+
import { SbbCalendarCellBaseElement as a, calendarCellBaseStyle as o } from "../common.js";
|
|
6
|
+
import { SbbLanguageController as s } from "../../core/controllers/language-controller.js";
|
|
7
|
+
import { i18nCalendarWeekNumber as c } from "../../core/i18n/i18n.js";
|
|
8
|
+
//#region src/elements/calendar/calendar-weeknumber/calendar-weeknumber.component.ts
|
|
9
|
+
var l = (() => {
|
|
10
|
+
let l = a, u = [], d;
|
|
11
|
+
return class extends l {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments), this._language = (t(this, u), new s(this)), this._value = null;
|
|
14
|
+
}
|
|
15
|
+
static {
|
|
16
|
+
let t = typeof Symbol == "function" && Symbol.metadata ? Object.create(l[Symbol.metadata] ?? null) : void 0;
|
|
17
|
+
d = [r()], e(this, null, d, {
|
|
18
|
+
kind: "setter",
|
|
19
|
+
name: "value",
|
|
20
|
+
static: !1,
|
|
21
|
+
private: !1,
|
|
22
|
+
access: {
|
|
23
|
+
has: (e) => "value" in e,
|
|
24
|
+
set: (e, t) => {
|
|
25
|
+
e.value = t;
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
metadata: t
|
|
29
|
+
}, null, u), t && Object.defineProperty(this, Symbol.metadata, {
|
|
30
|
+
enumerable: !0,
|
|
31
|
+
configurable: !0,
|
|
32
|
+
writable: !0,
|
|
33
|
+
value: t
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
static {
|
|
37
|
+
this.elementName = "sbb-calendar-weeknumber";
|
|
38
|
+
}
|
|
39
|
+
static {
|
|
40
|
+
this.styles = [i, o];
|
|
41
|
+
}
|
|
42
|
+
set value(e) {
|
|
43
|
+
e && (this._value = String(e), this.internals.ariaLabel = `${c[this._language.current]} ${e}`);
|
|
44
|
+
}
|
|
45
|
+
get value() {
|
|
46
|
+
return this._value;
|
|
47
|
+
}
|
|
48
|
+
setSelectedState() {}
|
|
49
|
+
setDisabledFilteredState() {}
|
|
50
|
+
renderTemplate() {
|
|
51
|
+
return n`${this.value}`;
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
})();
|
|
55
|
+
//#endregion
|
|
56
|
+
export { l as SbbCalendarWeeknumberElement };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SbbCalendarWeeknumberElement as e } from "./calendar-weeknumber/calendar-weeknumber.component.js";
|
|
2
|
+
e.define(), console.warn("The entrypoint '@sbb-esta/elements/calendar/calendar-weeknumber.js' has been deprecated.\nUse either '@sbb-esta/elements/calendar.js' or '@sbb-esta/elements/calendar.pure.js' instead.");
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as SbbCalendarWeeknumberElement };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { __esDecorate as e, __runInitializers as t } from "tslib";
|
|
2
|
+
import { html as n } from "lit";
|
|
3
|
+
import { state as r } from "lit/decorators.js";
|
|
4
|
+
import { boxSizingStyles as i } from "../../core/styles.js";
|
|
5
|
+
import { SbbCalendarCellBaseElement as a, calendarCellBaseStyle as o } from "../common.js";
|
|
6
|
+
//#region src/elements/calendar/calendar-year/calendar-year.component.ts
|
|
7
|
+
var s = (() => {
|
|
8
|
+
let s = a, c = [], l;
|
|
9
|
+
return class extends s {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this._value = (t(this, c), null);
|
|
12
|
+
}
|
|
13
|
+
static {
|
|
14
|
+
let t = typeof Symbol == "function" && Symbol.metadata ? Object.create(s[Symbol.metadata] ?? null) : void 0;
|
|
15
|
+
l = [r()], e(this, null, l, {
|
|
16
|
+
kind: "setter",
|
|
17
|
+
name: "value",
|
|
18
|
+
static: !1,
|
|
19
|
+
private: !1,
|
|
20
|
+
access: {
|
|
21
|
+
has: (e) => "value" in e,
|
|
22
|
+
set: (e, t) => {
|
|
23
|
+
e.value = t;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
metadata: t
|
|
27
|
+
}, null, c), t && Object.defineProperty(this, Symbol.metadata, {
|
|
28
|
+
enumerable: !0,
|
|
29
|
+
configurable: !0,
|
|
30
|
+
writable: !0,
|
|
31
|
+
value: t
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
static {
|
|
35
|
+
this.elementName = "sbb-calendar-year";
|
|
36
|
+
}
|
|
37
|
+
static {
|
|
38
|
+
this.styles = [i, o];
|
|
39
|
+
}
|
|
40
|
+
set value(e) {
|
|
41
|
+
let t = Number(e);
|
|
42
|
+
if (isNaN(t)) return;
|
|
43
|
+
this._value = e;
|
|
44
|
+
let n = this.dateAdapter.getYear(this.dateAdapter.today()) === t;
|
|
45
|
+
this.toggleState("current", n), this.internals.ariaLabel = String(t);
|
|
46
|
+
let r = this.getParent();
|
|
47
|
+
r && (this.setDisabledFilteredState(r), this.setSelectedState(r));
|
|
48
|
+
}
|
|
49
|
+
get value() {
|
|
50
|
+
return this._value;
|
|
51
|
+
}
|
|
52
|
+
connectedCallback() {
|
|
53
|
+
super.connectedCallback(), this.tabIndex = -1;
|
|
54
|
+
}
|
|
55
|
+
setSelectedState(e) {
|
|
56
|
+
let t = e.multiple ? e.selected?.some((e) => Number(this.value) === this.dateAdapter.getYear(e)) ?? !1 : !!e.selected && this.dateAdapter.getYear(e.selected) === Number(this.value);
|
|
57
|
+
this.toggleState("selected", t), this.internals.ariaPressed = String(t);
|
|
58
|
+
}
|
|
59
|
+
setDisabledFilteredState(e) {
|
|
60
|
+
let t = !this._isActiveYear(e), n = !this._isYearInRange(e.min, e.max);
|
|
61
|
+
this.disabled = t || n, this.internals.ariaDisabled = String(this.disabled), this.toggleState("crossed-out", t && !n);
|
|
62
|
+
}
|
|
63
|
+
_isActiveYear(e) {
|
|
64
|
+
if (!e.dateFilter || !this.value) return !0;
|
|
65
|
+
let t = this.dateAdapter.createDate(Number(this.value), 1, 1);
|
|
66
|
+
for (let n = t; this.dateAdapter.getYear(n) == Number(this.value); n = this.dateAdapter.addCalendarDays(n, 1)) if (e.dateFilter(n)) return !0;
|
|
67
|
+
return !1;
|
|
68
|
+
}
|
|
69
|
+
_isYearInRange(e, t) {
|
|
70
|
+
if (!e && !t || !this.value) return !0;
|
|
71
|
+
let n = this.dateAdapter.isValid(e) && this.dateAdapter.getYear(e) > Number(this.value), r = this.dateAdapter.isValid(t) && this.dateAdapter.getYear(t) < Number(this.value);
|
|
72
|
+
return !(n || r);
|
|
73
|
+
}
|
|
74
|
+
renderTemplate() {
|
|
75
|
+
return n`${this.value}`;
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
})();
|
|
79
|
+
//#endregion
|
|
80
|
+
export { s as SbbCalendarYearElement };
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { SbbCalendarYearElement as e } from "./calendar-year/calendar-year.component.js";
|
|
2
|
+
e.define(), console.warn("The entrypoint '@sbb-esta/elements/calendar/calendar-year.js' has been deprecated.\nUse either '@sbb-esta/elements/calendar.js' or '@sbb-esta/elements/calendar.pure.js' instead.");
|
|
3
|
+
//#endregion
|
|
4
|
+
export { e as SbbCalendarYearElement };
|
package/calendar/calendar.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as e, t } from "../calendar.component-
|
|
1
|
+
import { n as e, t } from "../calendar.component-Cz-OGQu6.js";
|
|
2
2
|
t.define(), console.warn("The entrypoint '@sbb-esta/elements/calendar/calendar.js' has been deprecated.\nUse either '@sbb-esta/elements/calendar.js' or '@sbb-esta/elements/calendar.pure.js' instead.");
|
|
3
3
|
//#endregion
|
|
4
4
|
export { t as SbbCalendarElement, e as SbbMonthChangeEvent };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { readConfig as e } from "../../core/config/config.js";
|
|
2
|
+
import { defaultDateAdapter as t } from "../../core/datetime/native-date-adapter.js";
|
|
3
|
+
import { SbbButtonLikeBaseElement as n } from "../../core/base-elements/button-base-element.js";
|
|
4
|
+
import { SbbPropertyWatcherController as r } from "../../core/controllers/property-watcher-controller.js";
|
|
5
|
+
import { SbbDisabledMixin as i } from "../../core/mixins/disabled-mixin.js";
|
|
6
|
+
//#region src/elements/calendar/common/calendar-cell-base-element.ts
|
|
7
|
+
var a = class extends i(n) {
|
|
8
|
+
constructor() {
|
|
9
|
+
super(), this.dateAdapter = e().datetime?.dateAdapter ?? t, this.addController(new r(this, () => this.getParent(), {
|
|
10
|
+
dateFilter: (e) => this.setDisabledFilteredState(e),
|
|
11
|
+
min: (e) => this.setDisabledFilteredState(e),
|
|
12
|
+
max: (e) => this.setDisabledFilteredState(e),
|
|
13
|
+
selected: (e) => this.setSelectedState(e)
|
|
14
|
+
}));
|
|
15
|
+
}
|
|
16
|
+
getParent() {
|
|
17
|
+
return this.getRootNode?.()?.host?.closest("sbb-calendar");
|
|
18
|
+
}
|
|
19
|
+
formResetCallback() {}
|
|
20
|
+
formStateRestoreCallback(e, t) {}
|
|
21
|
+
};
|
|
22
|
+
//#endregion
|
|
23
|
+
export { a as SbbCalendarCellBaseElement };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { SbbCalendarCellBaseElement as e } from "./common/calendar-cell-base-element.js";
|
|
2
|
+
import { css as t } from "lit";
|
|
3
|
+
//#region src/elements/calendar/common/calendar-cell-base-element.scss?lit&inline
|
|
4
|
+
var n = t`:host{--sbb-calendar-cell-transition-duration:var(--sbb-disable-animation-duration,var(--sbb-animation-duration-2x));--sbb-calendar-cell-border-radius:calc(var(--sbb-border-radius-4x) + var(--sbb-calendar-cell-border-width));display:block}@media (forced-colors:active){:host{--sbb-calendar-cell-border:transparent}}:host(:is(:state(current),[state--current])){--sbb-calendar-cell-font-weight:bold}:host(:is(:state(selected),[state--selected])){--sbb-calendar-cell-border:var(--sbb-calendar-cell-border-width) solid var(--sbb-border-color-2)}:host(:disabled){--sbb-calendar-cell-color:var(--sbb-calendar-cell-disabled-color);--sbb-calendar-cell-cursor:unset}:host(:focus-visible){outline:0}:host(:not(:disabled):active){--sbb-calendar-cell-background-color:var(--sbb-calendar-cell-background-color-active)}.sbb-action-base{font-size:var(--sbb-calendar-cell-font-size);font-weight:var(--sbb-calendar-cell-font-weight);letter-spacing:var(--sbb-typo-letter-spacing-text);cursor:var(--sbb-calendar-cell-cursor);color:var(--sbb-calendar-cell-color);border-radius:var(--sbb-calendar-cell-border-radius);justify-content:center;align-items:center;display:inline-flex;position:relative}:host(:focus-visible) .sbb-action-base{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-offset:.0625rem}.sbb-action-base:before{content:"";background-color:var(--sbb-calendar-cell-background-color);inset:var(--sbb-calendar-cell-inset);border:var(--sbb-calendar-cell-border);border-radius:var(--sbb-calendar-cell-border-radius);transition-duration:var(--sbb-calendar-cell-transition-duration);transition-timing-function:var(--sbb-calendar-cell-transition-easing-function);z-index:-1;transition-property:background-color;position:absolute}@media (forced-colors:active){:host(:not(:disabled):active) .sbb-action-base: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}}@media (any-hover:hover){:host(:not(:active,:disabled):hover) .sbb-action-base{--sbb-calendar-cell-background-color:var(--sbb-calendar-cell-background-color-hover)}}@media (any-hover:hover) and (forced-colors:active){:host(:not(:active,:disabled):hover) .sbb-action-base: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-offset:.0625rem;--sbb-focus-outline-style:initial}}.sbb-calendar-year,.sbb-calendar-month{height:var(--sbb-calendar-cell-year-month-height);width:var(--sbb-calendar-cell-year-month-width);padding-block-end:var(--sbb-calendar-cell-padding)}:host(:is(:state(crossed-out),[state--crossed-out])) .sbb-calendar-year:after,:host(:is(:state(crossed-out),[state--crossed-out])) .sbb-calendar-month:after{content:"";height:var(--sbb-calendar-cell-disabled-height);width:var(--sbb-calendar-cell-disabled-width);background-color:var(--sbb-calendar-cell-disabled-color);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)rotate(-45deg)}.sbb-calendar-weekday,.sbb-calendar-weeknumber{--sbb-calendar-cell-font-size:var(--sbb-text-font-size-xs);--sbb-calendar-cell-font-weight:normal;height:var(--sbb-calendar-day-width);width:var(--sbb-calendar-day-width);color:var(--sbb-calendar-header-color)}`;
|
|
5
|
+
//#endregion
|
|
6
|
+
export { e as SbbCalendarCellBaseElement, n as calendarCellBaseStyle };
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { __esDecorate as e, __runInitializers as t } from "tslib";
|
|
2
|
+
import { css as n, html as r } from "lit";
|
|
3
|
+
import { property as i, state as a } from "lit/decorators.js";
|
|
4
|
+
import { boxSizingStyles as o } from "./core/styles.js";
|
|
5
|
+
import { SbbCalendarCellBaseElement as s, calendarCellBaseStyle as c } from "./calendar/common.js";
|
|
6
|
+
//#region src/elements/calendar/calendar-day/calendar-day.scss?lit&inline
|
|
7
|
+
var l = n`:host{--sbb-calendar-day-value-height:var(--sbb-spacing-fixed-6x)}.sbb-calendar-day{justify-content:var(--sbb-calendar-cell-justify-content);height:var(--sbb-calendar-day-height);width:var(--sbb-calendar-day-width);padding:var(--sbb-calendar-cell-padding);flex-direction:column}.sbb-calendar-day__value{height:var(--sbb-calendar-day-value-height)}:host(:is(:state(crossed-out),[state--crossed-out])) .sbb-calendar-day__value:after{content:"";height:var(--sbb-calendar-cell-disabled-height);width:var(--sbb-calendar-cell-disabled-width);background-color:var(--sbb-calendar-cell-disabled-color);transform:var(--sbb-calendar-day-crossed-out-translate);position:absolute;inset-block-start:var(--sbb-calendar-day-crossed-out-top);inset-inline-start:50%}.sbb-calendar-day__extra{display:var(--sbb-calendar-day-extra-display);height:var(--sbb-calendar-day-extra-height);padding:var(--sbb-calendar-cell-padding)}::slotted(*){height:var(--sbb-calendar-day-extra-height)}`, u = (() => {
|
|
8
|
+
let n = s, u = [], d, f;
|
|
9
|
+
return class extends n {
|
|
10
|
+
constructor() {
|
|
11
|
+
super(...arguments), this._value = (t(this, u), null);
|
|
12
|
+
}
|
|
13
|
+
static {
|
|
14
|
+
let t = typeof Symbol == "function" && Symbol.metadata ? Object.create(n[Symbol.metadata] ?? null) : void 0;
|
|
15
|
+
d = [i()], f = [a()], e(this, null, d, {
|
|
16
|
+
kind: "setter",
|
|
17
|
+
name: "slot",
|
|
18
|
+
static: !1,
|
|
19
|
+
private: !1,
|
|
20
|
+
access: {
|
|
21
|
+
has: (e) => "slot" in e,
|
|
22
|
+
set: (e, t) => {
|
|
23
|
+
e.slot = t;
|
|
24
|
+
}
|
|
25
|
+
},
|
|
26
|
+
metadata: t
|
|
27
|
+
}, null, u), e(this, null, f, {
|
|
28
|
+
kind: "setter",
|
|
29
|
+
name: "value",
|
|
30
|
+
static: !1,
|
|
31
|
+
private: !1,
|
|
32
|
+
access: {
|
|
33
|
+
has: (e) => "value" in e,
|
|
34
|
+
set: (e, t) => {
|
|
35
|
+
e.value = t;
|
|
36
|
+
}
|
|
37
|
+
},
|
|
38
|
+
metadata: t
|
|
39
|
+
}, null, u), t && Object.defineProperty(this, Symbol.metadata, {
|
|
40
|
+
enumerable: !0,
|
|
41
|
+
configurable: !0,
|
|
42
|
+
writable: !0,
|
|
43
|
+
value: t
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
static {
|
|
47
|
+
this.elementName = "sbb-calendar-day";
|
|
48
|
+
}
|
|
49
|
+
static {
|
|
50
|
+
this.styles = [
|
|
51
|
+
o,
|
|
52
|
+
c,
|
|
53
|
+
l
|
|
54
|
+
];
|
|
55
|
+
}
|
|
56
|
+
set slot(e) {
|
|
57
|
+
super.slot = e, this.value = this.dateAdapter.deserialize(e);
|
|
58
|
+
}
|
|
59
|
+
get slot() {
|
|
60
|
+
return super.slot;
|
|
61
|
+
}
|
|
62
|
+
set value(e) {
|
|
63
|
+
let t = this.dateAdapter.getValidDateOrNull(this.dateAdapter.deserialize(e));
|
|
64
|
+
if (t) {
|
|
65
|
+
this._value = t;
|
|
66
|
+
let e = this.dateAdapter.sameDate(t, this.dateAdapter.today());
|
|
67
|
+
this.toggleState("current", e), this.internals.ariaCurrent = e ? "date" : null, this.internals.ariaLabel = this.dateAdapter.getAccessibilityFormatDate(t);
|
|
68
|
+
let n = this.getParent();
|
|
69
|
+
n && (this.setDisabledFilteredState(n), this.setSelectedState(n));
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
get value() {
|
|
73
|
+
return this._value;
|
|
74
|
+
}
|
|
75
|
+
connectedCallback() {
|
|
76
|
+
super.connectedCallback(), this.tabIndex = -1;
|
|
77
|
+
}
|
|
78
|
+
getParent() {
|
|
79
|
+
return this.closest?.("sbb-calendar") ?? this.getRootNode?.()?.host?.closest("sbb-calendar");
|
|
80
|
+
}
|
|
81
|
+
setSelectedState(e) {
|
|
82
|
+
let t = e.multiple ? e.selected.some((e) => this.dateAdapter.sameDate(this.value, e)) : !!e.selected && this.dateAdapter.compareDate(this.value, e.selected) === 0;
|
|
83
|
+
this.toggleState("selected", t), this.internals.ariaPressed = String(t);
|
|
84
|
+
}
|
|
85
|
+
setDisabledFilteredState(e) {
|
|
86
|
+
let t = !this._isActiveDate(e.dateFilter), n = !this._isDayInRange(e.min, e.max);
|
|
87
|
+
this.disabled = t || n, this.internals.ariaDisabled = String(this.disabled), this.toggleState("crossed-out", t && !n);
|
|
88
|
+
}
|
|
89
|
+
_isActiveDate(e) {
|
|
90
|
+
return e?.(this.value) ?? !0;
|
|
91
|
+
}
|
|
92
|
+
_isDayInRange(e, t) {
|
|
93
|
+
return !e && !t ? !0 : this.dateAdapter.sameDate(this.value, this.dateAdapter.clampDate(this.value, e, t));
|
|
94
|
+
}
|
|
95
|
+
_handleSlotchange(e) {
|
|
96
|
+
this.internals.ariaDescribedByElements = e.target.assignedElements();
|
|
97
|
+
}
|
|
98
|
+
renderTemplate() {
|
|
99
|
+
return r` <span class="sbb-calendar-day__value" aria-hidden="true">
|
|
100
|
+
${this.dateAdapter.getDate(this.value)}
|
|
101
|
+
</span>
|
|
102
|
+
<span class="sbb-calendar-day__extra">
|
|
103
|
+
<slot @slotchange=${(e) => this._handleSlotchange(e)}></slot>
|
|
104
|
+
</span>`;
|
|
105
|
+
}
|
|
106
|
+
};
|
|
107
|
+
})();
|
|
108
|
+
//#endregion
|
|
109
|
+
export { u as t };
|