@sbb-esta/lyne-elements 0.52.0 → 0.52.1
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/accordion.js +54 -54
- package/action-group.js +3 -3
- package/alert/alert-group.js +22 -22
- package/alert/alert.js +22 -22
- package/autocomplete.js +126 -126
- package/breadcrumb/breadcrumb-group/breadcrumb-group.d.ts.map +1 -1
- package/breadcrumb/breadcrumb-group.js +70 -69
- package/breadcrumb/breadcrumb.js +17 -17
- package/calendar.js +423 -423
- package/card/card-badge.js +17 -17
- package/card/card.js +2 -2
- package/card/common.js +30 -30
- package/checkbox/checkbox-group.js +17 -17
- package/checkbox/checkbox.js +34 -34
- package/clock.js +83 -83
- package/container/sticky-bar.js +16 -16
- package/core/a11y.js +91 -91
- package/core/base-elements.js +87 -88
- package/core/controllers.js +40 -40
- package/core/datetime.js +34 -36
- package/core/dom.js +26 -26
- package/core/eventing.js +33 -33
- package/core/mixins.js +122 -122
- package/core/overlay/overlay.d.ts.map +1 -1
- package/core/overlay.js +55 -50
- package/core/testing/event-spy.d.ts +1 -1
- package/core/testing/wait-for-image-ready.d.ts +4 -0
- package/core/testing/wait-for-image-ready.d.ts.map +1 -0
- package/core/testing.d.ts +1 -0
- package/core/testing.d.ts.map +1 -1
- package/core/testing.js +42 -31
- package/custom-elements.json +70 -4
- package/datepicker/common.js +55 -55
- package/datepicker/datepicker-toggle.js +94 -94
- package/datepicker/datepicker.js +144 -144
- package/development/accordion.js +2 -3
- package/development/action-group.js +2 -3
- package/development/alert/alert-group.js +2 -3
- package/development/alert/alert.js +2 -3
- package/development/autocomplete.js +2 -3
- package/development/breadcrumb/breadcrumb-group/breadcrumb-group.d.ts.map +1 -1
- package/development/breadcrumb/breadcrumb-group.js +5 -5
- package/development/breadcrumb/breadcrumb.js +2 -3
- package/development/button/button-link.js +2 -3
- package/development/button/button-static.js +2 -3
- package/development/button/button.js +2 -3
- package/development/button/common.js +2 -3
- package/development/button/mini-button.js +2 -3
- package/development/button/secondary-button-link.js +2 -3
- package/development/button/secondary-button-static.js +2 -3
- package/development/button/secondary-button.js +2 -3
- package/development/button/tertiary-button-link.js +2 -3
- package/development/button/tertiary-button-static.js +2 -3
- package/development/button/tertiary-button.js +2 -3
- package/development/button/transparent-button-link.js +2 -3
- package/development/button/transparent-button-static.js +2 -3
- package/development/button/transparent-button.js +2 -3
- package/development/calendar.js +2 -3
- package/development/card/card-badge.js +2 -3
- package/development/card/card-button.js +2 -3
- package/development/card/card-link.js +2 -3
- package/development/card/card.js +2 -3
- package/development/card/common.js +2 -3
- package/development/checkbox/checkbox-group.js +2 -3
- package/development/checkbox/checkbox.js +2 -3
- package/development/chip.js +2 -3
- package/development/clock.js +2 -3
- package/development/container/container.js +2 -3
- package/development/container/sticky-bar.js +2 -3
- package/development/core/base-elements.js +4 -7
- package/development/core/mixins.js +7 -13
- package/development/core/overlay/overlay.d.ts.map +1 -1
- package/development/core/overlay.js +9 -3
- package/development/core/testing/event-spy.d.ts +1 -1
- package/development/core/testing/wait-for-image-ready.d.ts +4 -0
- package/development/core/testing/wait-for-image-ready.d.ts.map +1 -0
- package/development/core/testing.d.ts +1 -0
- package/development/core/testing.d.ts.map +1 -1
- package/development/core/testing.js +17 -1
- package/development/datepicker/common.js +2 -3
- package/development/datepicker/datepicker-next-day.js +2 -3
- package/development/datepicker/datepicker-previous-day.js +2 -3
- package/development/datepicker/datepicker-toggle.js +2 -3
- package/development/datepicker/datepicker.js +2 -3
- package/development/dialog/dialog-actions.js +2 -3
- package/development/dialog/dialog-content.js +2 -3
- package/development/dialog/dialog-title.js +2 -3
- package/development/dialog/dialog.js +2 -3
- package/development/divider.js +2 -3
- package/development/expansion-panel/expansion-panel-content.js +2 -3
- package/development/expansion-panel/expansion-panel-header.js +2 -3
- package/development/expansion-panel/expansion-panel.js +2 -3
- package/development/file-selector.js +2 -3
- package/development/footer.js +2 -3
- package/development/form-error.js +2 -3
- package/development/form-field/form-field-clear.js +2 -3
- package/development/form-field/form-field.js +2 -3
- package/development/header/common.js +2 -3
- package/development/header/header-button.js +2 -3
- package/development/header/header-link.js +2 -3
- package/development/header/header.js +2 -3
- package/development/icon.js +4 -7
- package/development/image/image.d.ts +12 -3
- package/development/image/image.d.ts.map +1 -1
- package/development/image.js +41 -24
- package/development/journey-header.js +2 -3
- package/development/lead-container.js +2 -3
- package/development/link/block-link-button.js +2 -3
- package/development/link/block-link-static.js +2 -3
- package/development/link/block-link.js +2 -3
- package/development/link/common.js +3 -5
- package/development/link/link-button.js +2 -3
- package/development/link/link-static.js +2 -3
- package/development/link/link.js +2 -3
- package/development/link-list.js +2 -3
- package/development/loading-indicator.js +2 -3
- package/development/logo.js +2 -3
- package/development/map-container.js +2 -3
- package/development/menu/common.js +2 -3
- package/development/menu/menu-button.js +2 -3
- package/development/menu/menu-link.js +2 -3
- package/development/menu/menu.js +2 -3
- package/development/message.js +2 -3
- package/development/navigation/common.js +2 -3
- package/development/navigation/navigation-button.js +2 -3
- package/development/navigation/navigation-link.js +2 -3
- package/development/navigation/navigation-list.js +2 -3
- package/development/navigation/navigation-marker.js +2 -3
- package/development/navigation/navigation-section.js +2 -3
- package/development/navigation/navigation.js +2 -3
- package/development/notification.js +2 -3
- package/development/option/optgroup.js +2 -3
- package/development/option/option.js +2 -3
- package/development/overlay.js +3 -5
- package/development/popover/popover-trigger.js +2 -3
- package/development/popover/popover.js +2 -3
- package/development/radio-button/radio-button-group.js +2 -3
- package/development/radio-button/radio-button.js +2 -3
- package/development/screen-reader-only.js +2 -3
- package/development/select.js +2 -3
- package/development/selection-panel.js +2 -3
- package/development/signet.js +2 -3
- package/development/skiplink-list.js +2 -3
- package/development/slider.js +2 -3
- package/development/status.js +2 -3
- package/development/stepper/step-label.js +2 -3
- package/development/stepper/step.js +2 -3
- package/development/stepper/stepper/stepper.d.ts +1 -1
- package/development/stepper/stepper/stepper.d.ts.map +1 -1
- package/development/stepper/stepper.js +5 -6
- package/development/tabs/tab-group.js +2 -3
- package/development/tabs/tab-title.js +2 -3
- package/development/tag/tag-group.js +2 -3
- package/development/tag/tag.js +2 -3
- package/development/teaser-hero.js +2 -3
- package/development/teaser-paid.js +2 -3
- package/development/teaser.js +2 -3
- package/development/time-input.js +2 -3
- package/development/timetable-occupancy-icon.js +2 -3
- package/development/timetable-occupancy.js +2 -3
- package/development/title.js +3 -5
- package/development/toast.js +2 -3
- package/development/toggle/toggle-option.js +3 -5
- package/development/toggle/toggle.js +2 -3
- package/development/toggle-check.js +10 -3
- package/development/train/train-blocked-passage.js +2 -3
- package/development/train/train-formation.js +2 -3
- package/development/train/train-wagon.js +2 -3
- package/development/train/train.js +2 -3
- package/development/visual-checkbox.js +2 -3
- package/dialog/dialog-title.js +20 -20
- package/dialog/dialog.js +66 -66
- package/expansion-panel/expansion-panel-header.js +20 -20
- package/expansion-panel/expansion-panel.js +60 -60
- package/file-selector.js +91 -91
- package/form-field/form-field-clear.js +12 -12
- package/form-field/form-field.js +111 -111
- package/header/header.js +53 -53
- package/icon.js +107 -107
- package/image/image.d.ts +12 -3
- package/image/image.d.ts.map +1 -1
- package/image.js +118 -105
- package/journey-header.js +29 -29
- package/map-container.js +23 -23
- package/menu/menu.js +91 -91
- package/navigation/common.js +16 -16
- package/navigation/navigation-marker.js +34 -34
- package/navigation/navigation-section.js +83 -83
- package/navigation/navigation.js +87 -87
- package/notification.js +52 -52
- package/option/optgroup.js +45 -45
- package/option/option.js +108 -108
- package/overlay.js +5 -5
- package/package.json +1 -1
- package/popover/popover.js +110 -110
- package/radio-button/radio-button-group.js +93 -93
- package/radio-button/radio-button.js +84 -84
- package/select.js +178 -178
- package/selection-panel.js +44 -44
- package/slider.js +58 -58
- package/status.js +6 -6
- package/stepper/step-label.js +19 -19
- package/stepper/step.js +31 -31
- package/stepper/stepper/stepper.d.ts +1 -1
- package/stepper/stepper/stepper.d.ts.map +1 -1
- package/stepper/stepper.js +48 -48
- package/tabs/tab-group.js +67 -67
- package/tag/tag-group.js +8 -8
- package/tag/tag.js +27 -27
- package/teaser-paid.js +12 -12
- package/time-input.js +73 -73
- package/timetable-occupancy-icon.js +26 -26
- package/timetable-occupancy.js +9 -9
- package/toast.js +38 -38
- package/toggle/toggle-option.js +33 -33
- package/toggle/toggle.js +46 -46
- package/toggle-check.js +14 -14
- package/train/train-formation.js +36 -37
- package/train/train-wagon.js +30 -30
- package/train/train.js +13 -13
package/core/controllers.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
import { isServer as
|
|
1
|
+
import { isServer as l } from "lit";
|
|
2
2
|
import { readConfig as u } from "./config.js";
|
|
3
|
-
import { AgnosticMutationObserver as
|
|
4
|
-
class
|
|
3
|
+
import { AgnosticMutationObserver as m } from "./observers.js";
|
|
4
|
+
class A {
|
|
5
5
|
constructor(t) {
|
|
6
|
-
this.
|
|
6
|
+
this.b = t, this.a = new AbortController(), this.b.addController(this);
|
|
7
7
|
}
|
|
8
8
|
get signal() {
|
|
9
9
|
var t;
|
|
10
|
-
return (t = this.
|
|
10
|
+
return (t = this.a) == null ? void 0 : t.signal;
|
|
11
11
|
}
|
|
12
12
|
hostConnected() {
|
|
13
|
-
this.
|
|
13
|
+
this.a || (this.a = new AbortController());
|
|
14
14
|
}
|
|
15
15
|
hostDisconnected() {
|
|
16
16
|
var t;
|
|
17
|
-
(t = this.
|
|
17
|
+
(t = this.a) == null || t.abort(), this.a = void 0;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
const e = class e {
|
|
21
21
|
constructor(t) {
|
|
22
|
-
this.
|
|
22
|
+
this.g = t, this.f = [], this.g.addController(this);
|
|
23
23
|
}
|
|
24
24
|
/** Get the current language. */
|
|
25
25
|
static get current() {
|
|
26
|
-
const s = ((u().language ?? (
|
|
27
|
-
return e.
|
|
26
|
+
const s = ((u().language ?? (l ? e.b : document.documentElement.getAttribute("lang"))) || e.b).split("-")[0];
|
|
27
|
+
return e.h.includes(s) ? s : e.b;
|
|
28
28
|
}
|
|
29
29
|
/** Get the current language. */
|
|
30
30
|
get current() {
|
|
@@ -32,57 +32,57 @@ const e = class e {
|
|
|
32
32
|
}
|
|
33
33
|
/** Add a language change handler. */
|
|
34
34
|
withHandler(t) {
|
|
35
|
-
return this.
|
|
35
|
+
return this.f.unshift(t), this;
|
|
36
36
|
}
|
|
37
37
|
hostConnected() {
|
|
38
|
-
e.
|
|
38
|
+
e.a.size || e.d.observe(
|
|
39
39
|
document.documentElement,
|
|
40
|
-
e.
|
|
41
|
-
), e.
|
|
40
|
+
e.i
|
|
41
|
+
), e.a.add(this), this.c !== this.current && this.e(this.c !== void 0);
|
|
42
42
|
}
|
|
43
43
|
hostDisconnected() {
|
|
44
|
-
this.
|
|
44
|
+
this.c = this.current, e.a.delete(this), e.a.size || e.d.disconnect();
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
this.
|
|
46
|
+
e(t = !0) {
|
|
47
|
+
this.f.forEach((s) => s()), t && this.g.requestUpdate();
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
e.
|
|
51
|
-
t[0].oldValue !== document.documentElement.getAttribute("lang") && e.
|
|
52
|
-
}), e.
|
|
50
|
+
e.b = "en", e.h = ["en", "de", "fr", "it"], e.a = /* @__PURE__ */ new Set(), e.d = new m((t) => {
|
|
51
|
+
t[0].oldValue !== document.documentElement.getAttribute("lang") && e.a.forEach((s) => s.e());
|
|
52
|
+
}), e.i = {
|
|
53
53
|
attributeFilter: ["lang"],
|
|
54
54
|
attributeOldValue: !0
|
|
55
55
|
};
|
|
56
|
-
let
|
|
57
|
-
class
|
|
56
|
+
let c = e;
|
|
57
|
+
class v {
|
|
58
58
|
constructor(t, s = null) {
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
61
|
-
}, this.
|
|
59
|
+
this.a = t, this.d = s, this.slots = /* @__PURE__ */ new Set(), this.b = (i) => {
|
|
60
|
+
this.c(i.target);
|
|
61
|
+
}, this.a.addController(this);
|
|
62
62
|
}
|
|
63
63
|
hostConnected() {
|
|
64
64
|
var t;
|
|
65
|
-
this.
|
|
65
|
+
this.c(...this.a.querySelectorAll("slot")), (t = this.a.shadowRoot) == null || t.addEventListener("slotchange", this.b);
|
|
66
66
|
}
|
|
67
67
|
hostDisconnected() {
|
|
68
68
|
var t;
|
|
69
|
-
(t = this.
|
|
69
|
+
(t = this.a.shadowRoot) == null || t.removeEventListener("slotchange", this.b);
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
var
|
|
73
|
-
for (const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
return "tagName" in
|
|
78
|
-
}) ? this.slots.add(
|
|
71
|
+
c(...t) {
|
|
72
|
+
var o;
|
|
73
|
+
for (const n of t) {
|
|
74
|
+
const a = n.name || "unnamed";
|
|
75
|
+
n.assignedNodes().some((r) => {
|
|
76
|
+
var h;
|
|
77
|
+
return "tagName" in r || ((h = r.textContent) == null ? void 0 : h.trim());
|
|
78
|
+
}) ? this.slots.add(a) : this.slots.delete(a);
|
|
79
79
|
}
|
|
80
|
-
const s = this.
|
|
81
|
-
|
|
80
|
+
const s = this.a.getAttribute("data-slot-names"), i = [...this.slots].sort().join(" ");
|
|
81
|
+
i ? this.a.getAttribute("data-slot-names") !== i && this.a.setAttribute("data-slot-names", i) : this.a.removeAttribute("data-slot-names"), i !== s && ((o = this.d) == null || o.call(this));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
A as SbbConnectedAbortController,
|
|
86
|
+
c as SbbLanguageController,
|
|
87
|
+
v as SbbSlotStateController
|
|
88
88
|
};
|
package/core/datetime.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { SbbLanguageController as i } from "./controllers.js";
|
|
2
|
-
const o = 7,
|
|
2
|
+
const o = 7, m = 4, d = 4, f = 24, u = /(^0?[1-9]?|[12]?[0-9]?|3?[01]?)[.,\\/\-\s](0?[1-9]?|1?[0-2]?)?[.,\\/\-\s](\d{1,4}$)?/;
|
|
3
3
|
class l {
|
|
4
4
|
/**
|
|
5
5
|
* Attempts to deserialize a value to a valid date object. This is different from parsing in that
|
|
@@ -16,7 +16,7 @@ class l {
|
|
|
16
16
|
* @param date The date to convert to ISO String.
|
|
17
17
|
*/
|
|
18
18
|
toIso8601(t) {
|
|
19
|
-
const e = (r,
|
|
19
|
+
const e = (r, n = 2) => `${r}`.padStart(n, "0");
|
|
20
20
|
return `${e(this.getYear(t), 4)}-${e(this.getMonth(t))}-${e(this.getDate(t))}`;
|
|
21
21
|
}
|
|
22
22
|
/**
|
|
@@ -54,8 +54,8 @@ class l {
|
|
|
54
54
|
*/
|
|
55
55
|
sameDate(t, e) {
|
|
56
56
|
if (t && e) {
|
|
57
|
-
const r = this.isValid(t),
|
|
58
|
-
return r &&
|
|
57
|
+
const r = this.isValid(t), n = this.isValid(e);
|
|
58
|
+
return r && n ? !this.compareDate(t, e) : r == n;
|
|
59
59
|
}
|
|
60
60
|
return t == e;
|
|
61
61
|
}
|
|
@@ -74,7 +74,7 @@ class l {
|
|
|
74
74
|
const D = /^\d{4}-\d{2}-\d{2}(?:T\d{2}:\d{2}:\d{2}(?:\.\d+)?(?:Z|(?:(?:\+|-)\d{2}:\d{2}))?)?$/;
|
|
75
75
|
class c extends l {
|
|
76
76
|
constructor(t = 15) {
|
|
77
|
-
super(), this.
|
|
77
|
+
super(), this.b = t;
|
|
78
78
|
}
|
|
79
79
|
/** Gets the year of the input date. */
|
|
80
80
|
getYear(t) {
|
|
@@ -108,12 +108,12 @@ class c extends l {
|
|
|
108
108
|
*/
|
|
109
109
|
getMonthNames(t) {
|
|
110
110
|
const e = new Intl.DateTimeFormat(i.current, { month: t });
|
|
111
|
-
return this.
|
|
111
|
+
return this.a(12, (r) => e.format(new Date(2017, r, 1)));
|
|
112
112
|
}
|
|
113
113
|
/** Creates a string array with length = 31, filled with the days in a month, starting from 1. */
|
|
114
114
|
getDateNames() {
|
|
115
115
|
const t = new Intl.DateTimeFormat(i.current, { day: "numeric" });
|
|
116
|
-
return this.
|
|
116
|
+
return this.a(31, (e) => t.format(new Date(2017, 0, e + 1)));
|
|
117
117
|
}
|
|
118
118
|
/**
|
|
119
119
|
* Creates a string array with length = 7, filled with the name of the days in a week starting from Sunday, in the document language.
|
|
@@ -122,7 +122,7 @@ class c extends l {
|
|
|
122
122
|
*/
|
|
123
123
|
getDayOfWeekNames(t) {
|
|
124
124
|
const e = new Intl.DateTimeFormat(i.current, { weekday: t });
|
|
125
|
-
return this.
|
|
125
|
+
return this.a(7, (r) => e.format(new Date(2017, 0, r + 1)));
|
|
126
126
|
}
|
|
127
127
|
/* Defines which is the first day of the week (0: sunday; 1: monday; etc.). */
|
|
128
128
|
getFirstDayOfWeek() {
|
|
@@ -130,7 +130,7 @@ class c extends l {
|
|
|
130
130
|
}
|
|
131
131
|
/** Calculates the number of days in a month given the year and the month. */
|
|
132
132
|
getNumDaysInMonth(t) {
|
|
133
|
-
return this.getDate(this.
|
|
133
|
+
return this.getDate(this.c(this.getYear(t), this.getMonth(t), 0));
|
|
134
134
|
}
|
|
135
135
|
/** Creates today's date. */
|
|
136
136
|
today() {
|
|
@@ -142,10 +142,10 @@ class c extends l {
|
|
|
142
142
|
throw Error(`Invalid month index "${e}". Month index has to be between 1 and 12.`);
|
|
143
143
|
if (r < 1)
|
|
144
144
|
throw Error(`Invalid date "${r}". Date has to be greater than 0.`);
|
|
145
|
-
const
|
|
146
|
-
if (
|
|
145
|
+
const n = this.c(t, e - 1, r);
|
|
146
|
+
if (n.getMonth() + 1 !== e)
|
|
147
147
|
throw Error(`Invalid date "${r}" for month with index "${e}".`);
|
|
148
|
-
return
|
|
148
|
+
return n;
|
|
149
149
|
}
|
|
150
150
|
/** Checks whether the given `obj` is a Date. */
|
|
151
151
|
isDateInstance(t) {
|
|
@@ -173,8 +173,8 @@ class c extends l {
|
|
|
173
173
|
* E.g., with `date` = new Date(2022, 0, 31) and `months` = 1, it returns new Date(2022, 1, 28).
|
|
174
174
|
*/
|
|
175
175
|
addCalendarMonths(t, e) {
|
|
176
|
-
const r = t.getMonth() + e,
|
|
177
|
-
return new Date(this.clone(t).setMonth(r, Math.min(
|
|
176
|
+
const r = t.getMonth() + e, n = new Date(t.getFullYear(), r, 1, 0, 0, 0, 0), a = this.getNumDaysInMonth(n);
|
|
177
|
+
return new Date(this.clone(t).setMonth(r, Math.min(a, t.getDate())));
|
|
178
178
|
}
|
|
179
179
|
/** Creates a new date by adding the number of provided `days` to the provided `date`. */
|
|
180
180
|
addCalendarDays(t, e) {
|
|
@@ -188,10 +188,8 @@ class c extends l {
|
|
|
188
188
|
if (Number.isNaN(+t)) {
|
|
189
189
|
if (D.test(t))
|
|
190
190
|
return this.getValidDateOrNull(new Date(t));
|
|
191
|
-
} else
|
|
192
|
-
|
|
193
|
-
else
|
|
194
|
-
return null;
|
|
191
|
+
} else return this.getValidDateOrNull(new Date(+t * 1e3));
|
|
192
|
+
else return null;
|
|
195
193
|
else if (typeof t == "number")
|
|
196
194
|
return this.getValidDateOrNull(new Date(t * 1e3));
|
|
197
195
|
return super.deserialize(t);
|
|
@@ -200,15 +198,15 @@ class c extends l {
|
|
|
200
198
|
parse(t, e) {
|
|
201
199
|
if (!t)
|
|
202
200
|
return;
|
|
203
|
-
const r = t.replace(/\D/g, " ").trim(),
|
|
204
|
-
if (!
|
|
201
|
+
const r = t.replace(/\D/g, " ").trim(), n = r == null ? void 0 : r.match(u);
|
|
202
|
+
if (!n || n.index !== 0 || n.length <= 2 || n.some((s) => s === void 0) || !this.isValid(this.createDate(+n[3], +n[2], +n[1])))
|
|
205
203
|
return;
|
|
206
|
-
let
|
|
207
|
-
if (typeof
|
|
208
|
-
const s = e.getFullYear() - 2e3 + this.
|
|
209
|
-
|
|
204
|
+
let a = +n[3];
|
|
205
|
+
if (typeof a == "number" && a < 100 && a >= 0) {
|
|
206
|
+
const s = e.getFullYear() - 2e3 + this.b;
|
|
207
|
+
a = a <= s ? 2e3 + a : 1900 + a;
|
|
210
208
|
}
|
|
211
|
-
return new Date(
|
|
209
|
+
return new Date(a, +n[2] - 1, +n[1]);
|
|
212
210
|
}
|
|
213
211
|
format(t) {
|
|
214
212
|
if (!t)
|
|
@@ -218,10 +216,10 @@ class c extends l {
|
|
|
218
216
|
month: "2-digit",
|
|
219
217
|
year: "numeric"
|
|
220
218
|
});
|
|
221
|
-
let
|
|
219
|
+
let a = new Intl.DateTimeFormat(e, {
|
|
222
220
|
weekday: "short"
|
|
223
221
|
}).format(t);
|
|
224
|
-
return
|
|
222
|
+
return a = a.charAt(0).toUpperCase() + a.charAt(1), `${a}, ${r.format(t)}`;
|
|
225
223
|
}
|
|
226
224
|
invalid() {
|
|
227
225
|
return /* @__PURE__ */ new Date(NaN);
|
|
@@ -231,16 +229,16 @@ class c extends l {
|
|
|
231
229
|
* @param length The length of the array to be created.
|
|
232
230
|
* @param valueFunction The function of array's index used to fill the array.
|
|
233
231
|
*/
|
|
234
|
-
|
|
232
|
+
a(t, e) {
|
|
235
233
|
const r = Array(t);
|
|
236
|
-
for (let
|
|
237
|
-
r[
|
|
234
|
+
for (let n = 0; n < t; n++)
|
|
235
|
+
r[n] = e(n);
|
|
238
236
|
return r;
|
|
239
237
|
}
|
|
240
238
|
/** Creates a date but allows the month and date to overflow. */
|
|
241
|
-
|
|
242
|
-
const
|
|
243
|
-
return t >= 0 && t < 100 &&
|
|
239
|
+
c(t, e, r) {
|
|
240
|
+
const n = new Date(t, e, r);
|
|
241
|
+
return t >= 0 && t < 100 && n.setFullYear(this.getYear(n) - 1900), n;
|
|
244
242
|
}
|
|
245
243
|
}
|
|
246
244
|
const w = new c();
|
|
@@ -248,9 +246,9 @@ export {
|
|
|
248
246
|
o as DAYS_PER_ROW,
|
|
249
247
|
l as DateAdapter,
|
|
250
248
|
u as FORMAT_DATE,
|
|
251
|
-
|
|
249
|
+
m as MONTHS_PER_ROW,
|
|
252
250
|
c as NativeDateAdapter,
|
|
253
|
-
|
|
254
|
-
|
|
251
|
+
f as YEARS_PER_PAGE,
|
|
252
|
+
d as YEARS_PER_ROW,
|
|
255
253
|
w as defaultDateAdapter
|
|
256
254
|
};
|
package/core/dom.js
CHANGED
|
@@ -7,14 +7,14 @@ function S(t, n, o) {
|
|
|
7
7
|
i.getPropertyValue(
|
|
8
8
|
`--sbb-breakpoint-${n}-${o != null && o.includeMaxBreakpoint ? "max" : "min"}`
|
|
9
9
|
)
|
|
10
|
-
) - (o != null && o.includeMaxBreakpoint ? 0 : 0.0625)}rem` : "", f = r && `(min-width: ${r})`,
|
|
11
|
-
return window.matchMedia(`${f}${
|
|
10
|
+
) - (o != null && o.includeMaxBreakpoint ? 0 : 0.0625)}rem` : "", f = r && `(min-width: ${r})`, y = s && `(max-width: ${s})`, g = r && s && " and ";
|
|
11
|
+
return window.matchMedia(`${f}${g}${y}`).matches;
|
|
12
12
|
}
|
|
13
13
|
function h(t) {
|
|
14
14
|
return e ? null : typeof t == "string" ? document.getElementById(t) : t instanceof window.Element ? t : null;
|
|
15
15
|
}
|
|
16
|
-
const
|
|
17
|
-
function
|
|
16
|
+
const x = () => !e && document.documentElement.getAttribute("dir") || "ltr";
|
|
17
|
+
function k(t, n) {
|
|
18
18
|
if (e)
|
|
19
19
|
return null;
|
|
20
20
|
for (n = n.parentElement ?? n.getRootNode().host; n && n !== document && n !== window; ) {
|
|
@@ -25,8 +25,8 @@ function x(t, n) {
|
|
|
25
25
|
}
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
28
|
+
const p = "a,button,sbb-teaser-hero,sbb-teaser";
|
|
29
|
+
function $(t, n) {
|
|
30
30
|
var o;
|
|
31
31
|
if (!n) {
|
|
32
32
|
const i = (o = t.closest) == null ? void 0 : o.call(t, "sbb-form-field");
|
|
@@ -34,7 +34,7 @@ function I(t, n) {
|
|
|
34
34
|
}
|
|
35
35
|
return h(n);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function I(t, n, o) {
|
|
38
38
|
o ? t.setAttribute(n, o) : t.removeAttribute(n);
|
|
39
39
|
}
|
|
40
40
|
let a;
|
|
@@ -43,31 +43,31 @@ try {
|
|
|
43
43
|
} catch {
|
|
44
44
|
a = !1;
|
|
45
45
|
}
|
|
46
|
-
const m = !e && /(edge)/i.test(navigator.userAgent), c = !e && /(msie|trident)/i.test(navigator.userAgent), w = !e && !!(window.chrome || a) && typeof CSS < "u" && !m && !c, v = !e && /AppleWebKit/i.test(navigator.userAgent) && !w && !m && !c, M = !e && /iPad|iPhone|iPod/.test(navigator.userAgent) && !("MSStream" in window),
|
|
46
|
+
const m = !e && /(edge)/i.test(navigator.userAgent), c = !e && /(msie|trident)/i.test(navigator.userAgent), w = !e && !!(window.chrome || a) && typeof CSS < "u" && !m && !c, v = !e && /AppleWebKit/i.test(navigator.userAgent) && !w && !m && !c, M = !e && /iPad|iPhone|iPod/.test(navigator.userAgent) && !("MSStream" in window), W = !e && /(firefox|minefield)/i.test(navigator.userAgent), B = !e && /android/i.test(navigator.userAgent) && !c, C = !e && /safari/i.test(navigator.userAgent) && v;
|
|
47
47
|
var l, b;
|
|
48
|
-
const
|
|
48
|
+
const N = !e && ((b = (l = navigator.userAgentData) == null ? void 0 : l.brands) == null ? void 0 : b.some((t) => t.brand == "Chromium")), P = () => !!globalThis.next;
|
|
49
49
|
function u() {
|
|
50
50
|
return document.body.hasAttribute("data-sbb-scroll-disabled");
|
|
51
51
|
}
|
|
52
|
-
class
|
|
52
|
+
class R {
|
|
53
53
|
disableScroll() {
|
|
54
54
|
if (u())
|
|
55
55
|
return;
|
|
56
|
-
this.
|
|
56
|
+
this.a = document.body.style.position, this.b = document.body.style.overflow, this.c = document.body.style.marginInlineEnd;
|
|
57
57
|
const n = window.innerWidth - document.documentElement.clientWidth;
|
|
58
58
|
document.body.style.overflow = "hidden", document.body.style.position = "relative", document.body.style.marginInlineEnd = `${n}px`, document.body.style.setProperty("--sbb-scrollbar-width", `${n}px`), document.body.toggleAttribute("data-sbb-scroll-disabled", !0);
|
|
59
59
|
}
|
|
60
60
|
enableScroll() {
|
|
61
|
-
u() && (document.body.style.position = this.
|
|
61
|
+
u() && (document.body.style.position = this.a || "", document.body.style.overflow = this.b || "", document.body.style.marginInlineEnd = this.c || "", document.body.style.setProperty("--sbb-scrollbar-width", "0"), document.body.removeAttribute("data-sbb-scroll-disabled"));
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
const d = /* @__PURE__ */ new Map();
|
|
65
|
-
function
|
|
65
|
+
function T(t) {
|
|
66
66
|
if (d.has(t.constructor))
|
|
67
67
|
return d.get(t.constructor);
|
|
68
68
|
const n = (
|
|
69
69
|
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
70
|
-
customElements.
|
|
70
|
+
customElements.a
|
|
71
71
|
);
|
|
72
72
|
for (const [o, i] of n)
|
|
73
73
|
if (i.ctor === t.constructor)
|
|
@@ -75,25 +75,25 @@ function R(t) {
|
|
|
75
75
|
throw new Error(`Given element ${t.constructor.name} has not been registered yet.`);
|
|
76
76
|
}
|
|
77
77
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
p as ACTION_ELEMENTS,
|
|
79
|
+
R as SbbScrollHandler,
|
|
80
80
|
E as breakpoints,
|
|
81
|
-
|
|
81
|
+
$ as findInput,
|
|
82
82
|
h as findReferencedElement,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
x as getDocumentWritingMode,
|
|
84
|
+
T as getLocalName,
|
|
85
|
+
k as hostContext,
|
|
86
|
+
B as isAndroid,
|
|
87
87
|
w as isBlink,
|
|
88
88
|
S as isBreakpoint,
|
|
89
|
-
|
|
89
|
+
N as isChromium,
|
|
90
90
|
m as isEdge,
|
|
91
|
-
|
|
91
|
+
W as isFirefox,
|
|
92
92
|
M as isIOS,
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
P as isNextjs,
|
|
94
|
+
C as isSafari,
|
|
95
95
|
c as isTrident,
|
|
96
96
|
v as isWebkit,
|
|
97
97
|
u as pageScrollDisabled,
|
|
98
|
-
|
|
98
|
+
I as setOrRemoveAttribute
|
|
99
99
|
};
|
package/core/eventing.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
function a(t, e,
|
|
2
|
-
const
|
|
3
|
-
let s =
|
|
4
|
-
return s === -1 && (s = void 0),
|
|
1
|
+
function a(t, e, n = null) {
|
|
2
|
+
const o = t.composedPath();
|
|
3
|
+
let s = o.findIndex((r) => r === n);
|
|
4
|
+
return s === -1 && (s = void 0), o.slice(0, s).find((r) => r instanceof window.HTMLElement && r.hasAttribute(e));
|
|
5
5
|
}
|
|
6
6
|
const c = {
|
|
7
7
|
bubbles: !0,
|
|
8
8
|
cancelable: !0,
|
|
9
9
|
composed: !0
|
|
10
10
|
};
|
|
11
|
-
class
|
|
12
|
-
constructor(e,
|
|
13
|
-
this.
|
|
11
|
+
class u {
|
|
12
|
+
constructor(e, n, o = c) {
|
|
13
|
+
this.a = e, this.b = n, this.c = o;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Dispatches an event.
|
|
@@ -19,61 +19,61 @@ class l {
|
|
|
19
19
|
* if preventDefault() was called. Always returns true in SSR.
|
|
20
20
|
*/
|
|
21
21
|
emit(e) {
|
|
22
|
-
var
|
|
23
|
-
return ((
|
|
24
|
-
|
|
25
|
-
new CustomEvent(this.
|
|
22
|
+
var n, o;
|
|
23
|
+
return ((o = (n = this.a).dispatchEvent) == null ? void 0 : o.call(
|
|
24
|
+
n,
|
|
25
|
+
new CustomEvent(this.b, { ...this.c, detail: e })
|
|
26
26
|
)) ?? !0;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function d(t) {
|
|
30
30
|
return t.composedPath ? t.composedPath()[0] : t.target;
|
|
31
31
|
}
|
|
32
32
|
function i(t) {
|
|
33
33
|
t.key === " " && t.preventDefault();
|
|
34
34
|
}
|
|
35
|
-
const
|
|
35
|
+
const l = ({ host: t, signal: e }) => {
|
|
36
36
|
t.addEventListener("keydown", i, { signal: e });
|
|
37
37
|
};
|
|
38
38
|
function h(t, e) {
|
|
39
|
-
const
|
|
40
|
-
e.dispatchEvent(
|
|
39
|
+
const n = Object.getPrototypeOf(t).constructor, o = new n(t.type, t);
|
|
40
|
+
e.dispatchEvent(o);
|
|
41
41
|
}
|
|
42
|
-
class
|
|
43
|
-
constructor(e, ...
|
|
44
|
-
this.
|
|
42
|
+
class f {
|
|
43
|
+
constructor(e, ...n) {
|
|
44
|
+
this.c = e, this.b = n;
|
|
45
45
|
}
|
|
46
46
|
connect() {
|
|
47
|
-
var
|
|
48
|
-
(
|
|
49
|
-
const e = { host: this.
|
|
50
|
-
for (const
|
|
51
|
-
|
|
47
|
+
var n;
|
|
48
|
+
(n = this.a) == null || n.abort(), this.a = new AbortController();
|
|
49
|
+
const e = { host: this.c, signal: this.a.signal };
|
|
50
|
+
for (const o of this.b)
|
|
51
|
+
o(e);
|
|
52
52
|
}
|
|
53
53
|
disconnect() {
|
|
54
54
|
var e;
|
|
55
|
-
(e = this.
|
|
55
|
+
(e = this.a) == null || e.abort();
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
async function
|
|
58
|
+
async function p(t) {
|
|
59
59
|
return await new Promise((e) => setTimeout(e)), t.defaultPrevented;
|
|
60
60
|
}
|
|
61
61
|
const m = (t, e) => {
|
|
62
|
-
let
|
|
62
|
+
let n = !1;
|
|
63
63
|
return (...s) => {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
n || (t(...s), n = !0, setTimeout(() => {
|
|
65
|
+
n = !1;
|
|
66
66
|
}, e));
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
export {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
u as EventEmitter,
|
|
71
|
+
f as HandlerRepository,
|
|
72
72
|
a as composedPathHasAttribute,
|
|
73
|
-
|
|
73
|
+
l as formElementHandlerAspect,
|
|
74
74
|
h as forwardEventToHost,
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
d as getEventTarget,
|
|
76
|
+
p as isEventPrevented,
|
|
77
77
|
i as preventScrollOnSpacebarPress,
|
|
78
78
|
m as throttle
|
|
79
79
|
};
|