@sbb-esta/lyne-elements 0.52.1 → 0.52.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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.js +60 -60
- 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 +86 -86
- package/core/controllers.js +40 -40
- package/core/datetime.js +32 -32
- package/core/dom.js +26 -26
- package/core/eventing.js +33 -33
- package/core/mixins.js +122 -122
- package/core/testing.js +29 -29
- package/datepicker/common.js +55 -55
- package/datepicker/datepicker-toggle.js +94 -94
- package/datepicker/datepicker.js +144 -144
- 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.js +87 -87
- 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.js +46 -46
- 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/train/train-formation.js +36 -36
- 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 d } from "lit";
|
|
2
2
|
import { readConfig as u } from "./config.js";
|
|
3
|
-
import { AgnosticMutationObserver as
|
|
4
|
-
class
|
|
3
|
+
import { AgnosticMutationObserver as _ } from "./observers.js";
|
|
4
|
+
class b {
|
|
5
5
|
constructor(t) {
|
|
6
|
-
this.
|
|
6
|
+
this._host = t, this._abortController = new AbortController(), this._host.addController(this);
|
|
7
7
|
}
|
|
8
8
|
get signal() {
|
|
9
9
|
var t;
|
|
10
|
-
return (t = this.
|
|
10
|
+
return (t = this._abortController) == null ? void 0 : t.signal;
|
|
11
11
|
}
|
|
12
12
|
hostConnected() {
|
|
13
|
-
this.
|
|
13
|
+
this._abortController || (this._abortController = new AbortController());
|
|
14
14
|
}
|
|
15
15
|
hostDisconnected() {
|
|
16
16
|
var t;
|
|
17
|
-
(t = this.
|
|
17
|
+
(t = this._abortController) == null || t.abort(), this._abortController = void 0;
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
20
|
const e = class e {
|
|
21
21
|
constructor(t) {
|
|
22
|
-
this.
|
|
22
|
+
this._host = t, this._handlers = [], this._host.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 ?? (d ? e._defaultLanguage : document.documentElement.getAttribute("lang"))) || e._defaultLanguage).split("-")[0];
|
|
27
|
+
return e._supportedLocales.includes(s) ? s : e._defaultLanguage;
|
|
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._handlers.unshift(t), this;
|
|
36
36
|
}
|
|
37
37
|
hostConnected() {
|
|
38
|
-
e.
|
|
38
|
+
e._listeners.size || e._observer.observe(
|
|
39
39
|
document.documentElement,
|
|
40
|
-
e.
|
|
41
|
-
), e.
|
|
40
|
+
e._observerConfig
|
|
41
|
+
), e._listeners.add(this), this._previousLanguage !== this.current && this._callHandlers(this._previousLanguage !== void 0);
|
|
42
42
|
}
|
|
43
43
|
hostDisconnected() {
|
|
44
|
-
this.
|
|
44
|
+
this._previousLanguage = this.current, e._listeners.delete(this), e._listeners.size || e._observer.disconnect();
|
|
45
45
|
}
|
|
46
|
-
|
|
47
|
-
this.
|
|
46
|
+
_callHandlers(t = !0) {
|
|
47
|
+
this._handlers.forEach((s) => s()), t && this._host.requestUpdate();
|
|
48
48
|
}
|
|
49
49
|
};
|
|
50
|
-
e.
|
|
51
|
-
t[0].oldValue !== document.documentElement.getAttribute("lang") && e.
|
|
52
|
-
}), e.
|
|
50
|
+
e._defaultLanguage = "en", e._supportedLocales = ["en", "de", "fr", "it"], e._listeners = /* @__PURE__ */ new Set(), e._observer = new _((t) => {
|
|
51
|
+
t[0].oldValue !== document.documentElement.getAttribute("lang") && e._listeners.forEach((s) => s._callHandlers());
|
|
52
|
+
}), e._observerConfig = {
|
|
53
53
|
attributeFilter: ["lang"],
|
|
54
54
|
attributeOldValue: !0
|
|
55
55
|
};
|
|
56
|
-
let
|
|
57
|
-
class
|
|
56
|
+
let h = e;
|
|
57
|
+
class C {
|
|
58
58
|
constructor(t, s = null) {
|
|
59
|
-
this.
|
|
60
|
-
this.
|
|
61
|
-
}, this.
|
|
59
|
+
this._host = t, this._onChangeCallback = s, this.slots = /* @__PURE__ */ new Set(), this._slotchangeHandler = (o) => {
|
|
60
|
+
this._syncSlots(o.target);
|
|
61
|
+
}, this._host.addController(this);
|
|
62
62
|
}
|
|
63
63
|
hostConnected() {
|
|
64
64
|
var t;
|
|
65
|
-
this.
|
|
65
|
+
this._syncSlots(...this._host.querySelectorAll("slot")), (t = this._host.shadowRoot) == null || t.addEventListener("slotchange", this._slotchangeHandler);
|
|
66
66
|
}
|
|
67
67
|
hostDisconnected() {
|
|
68
68
|
var t;
|
|
69
|
-
(t = this.
|
|
69
|
+
(t = this._host.shadowRoot) == null || t.removeEventListener("slotchange", this._slotchangeHandler);
|
|
70
70
|
}
|
|
71
|
-
|
|
72
|
-
var
|
|
73
|
-
for (const
|
|
74
|
-
const
|
|
75
|
-
|
|
76
|
-
var
|
|
77
|
-
return "tagName" in
|
|
78
|
-
}) ? this.slots.add(
|
|
71
|
+
_syncSlots(...t) {
|
|
72
|
+
var n;
|
|
73
|
+
for (const r of t) {
|
|
74
|
+
const i = r.name || "unnamed";
|
|
75
|
+
r.assignedNodes().some((l) => {
|
|
76
|
+
var a;
|
|
77
|
+
return "tagName" in l || ((a = l.textContent) == null ? void 0 : a.trim());
|
|
78
|
+
}) ? this.slots.add(i) : this.slots.delete(i);
|
|
79
79
|
}
|
|
80
|
-
const s = this.
|
|
81
|
-
|
|
80
|
+
const s = this._host.getAttribute("data-slot-names"), o = [...this.slots].sort().join(" ");
|
|
81
|
+
o ? this._host.getAttribute("data-slot-names") !== o && this._host.setAttribute("data-slot-names", o) : this._host.removeAttribute("data-slot-names"), o !== s && ((n = this._onChangeCallback) == null || n.call(this));
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
84
|
export {
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
85
|
+
b as SbbConnectedAbortController,
|
|
86
|
+
h as SbbLanguageController,
|
|
87
|
+
C 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, f = 4, m = 4, d = 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, a = 2) => `${r}`.padStart(a, "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), a = this.isValid(e);
|
|
58
|
+
return r && a ? !this.compareDate(t, e) : r == a;
|
|
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._cutoffYearOffset = 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._range(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._range(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._range(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._createDateWithOverflow(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 a = this._createDateWithOverflow(t, e - 1, r);
|
|
146
|
+
if (a.getMonth() + 1 !== e)
|
|
147
147
|
throw Error(`Invalid date "${r}" for month with index "${e}".`);
|
|
148
|
-
return
|
|
148
|
+
return a;
|
|
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, a = new Date(t.getFullYear(), r, 1, 0, 0, 0, 0), n = this.getNumDaysInMonth(a);
|
|
177
|
+
return new Date(this.clone(t).setMonth(r, Math.min(n, 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) {
|
|
@@ -198,15 +198,15 @@ class c extends l {
|
|
|
198
198
|
parse(t, e) {
|
|
199
199
|
if (!t)
|
|
200
200
|
return;
|
|
201
|
-
const r = t.replace(/\D/g, " ").trim(),
|
|
202
|
-
if (!
|
|
201
|
+
const r = t.replace(/\D/g, " ").trim(), a = r == null ? void 0 : r.match(u);
|
|
202
|
+
if (!a || a.index !== 0 || a.length <= 2 || a.some((s) => s === void 0) || !this.isValid(this.createDate(+a[3], +a[2], +a[1])))
|
|
203
203
|
return;
|
|
204
|
-
let
|
|
205
|
-
if (typeof
|
|
206
|
-
const s = e.getFullYear() - 2e3 + this.
|
|
207
|
-
|
|
204
|
+
let n = +a[3];
|
|
205
|
+
if (typeof n == "number" && n < 100 && n >= 0) {
|
|
206
|
+
const s = e.getFullYear() - 2e3 + this._cutoffYearOffset;
|
|
207
|
+
n = n <= s ? 2e3 + n : 1900 + n;
|
|
208
208
|
}
|
|
209
|
-
return new Date(
|
|
209
|
+
return new Date(n, +a[2] - 1, +a[1]);
|
|
210
210
|
}
|
|
211
211
|
format(t) {
|
|
212
212
|
if (!t)
|
|
@@ -216,10 +216,10 @@ class c extends l {
|
|
|
216
216
|
month: "2-digit",
|
|
217
217
|
year: "numeric"
|
|
218
218
|
});
|
|
219
|
-
let
|
|
219
|
+
let n = new Intl.DateTimeFormat(e, {
|
|
220
220
|
weekday: "short"
|
|
221
221
|
}).format(t);
|
|
222
|
-
return
|
|
222
|
+
return n = n.charAt(0).toUpperCase() + n.charAt(1), `${n}, ${r.format(t)}`;
|
|
223
223
|
}
|
|
224
224
|
invalid() {
|
|
225
225
|
return /* @__PURE__ */ new Date(NaN);
|
|
@@ -229,16 +229,16 @@ class c extends l {
|
|
|
229
229
|
* @param length The length of the array to be created.
|
|
230
230
|
* @param valueFunction The function of array's index used to fill the array.
|
|
231
231
|
*/
|
|
232
|
-
|
|
232
|
+
_range(t, e) {
|
|
233
233
|
const r = Array(t);
|
|
234
|
-
for (let
|
|
235
|
-
r[
|
|
234
|
+
for (let a = 0; a < t; a++)
|
|
235
|
+
r[a] = e(a);
|
|
236
236
|
return r;
|
|
237
237
|
}
|
|
238
238
|
/** Creates a date but allows the month and date to overflow. */
|
|
239
|
-
|
|
240
|
-
const
|
|
241
|
-
return t >= 0 && t < 100 &&
|
|
239
|
+
_createDateWithOverflow(t, e, r) {
|
|
240
|
+
const a = new Date(t, e, r);
|
|
241
|
+
return t >= 0 && t < 100 && a.setFullYear(this.getYear(a) - 1900), a;
|
|
242
242
|
}
|
|
243
243
|
}
|
|
244
244
|
const w = new c();
|
|
@@ -246,9 +246,9 @@ export {
|
|
|
246
246
|
o as DAYS_PER_ROW,
|
|
247
247
|
l as DateAdapter,
|
|
248
248
|
u as FORMAT_DATE,
|
|
249
|
-
|
|
249
|
+
f as MONTHS_PER_ROW,
|
|
250
250
|
c as NativeDateAdapter,
|
|
251
|
-
|
|
252
|
-
|
|
251
|
+
d as YEARS_PER_PAGE,
|
|
252
|
+
m as YEARS_PER_ROW,
|
|
253
253
|
w as defaultDateAdapter
|
|
254
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})`, g = s && `(max-width: ${s})`, y = r && s && " and ";
|
|
11
|
+
return window.matchMedia(`${f}${y}${g}`).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 p = () => !e && document.documentElement.getAttribute("dir") || "ltr";
|
|
17
|
+
function x(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 k(t, n) {
|
|
|
25
25
|
}
|
|
26
26
|
return null;
|
|
27
27
|
}
|
|
28
|
-
const
|
|
29
|
-
function
|
|
28
|
+
const k = "a,button,sbb-teaser-hero,sbb-teaser";
|
|
29
|
+
function I(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 $(t, n) {
|
|
|
34
34
|
}
|
|
35
35
|
return h(n);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function $(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), _ = !e && /(firefox|minefield)/i.test(navigator.userAgent), W = !e && /android/i.test(navigator.userAgent) && !c, B = !e && /safari/i.test(navigator.userAgent) && v;
|
|
47
47
|
var l, b;
|
|
48
|
-
const
|
|
48
|
+
const C = !e && ((b = (l = navigator.userAgentData) == null ? void 0 : l.brands) == null ? void 0 : b.some((t) => t.brand == "Chromium")), N = () => !!globalThis.next;
|
|
49
49
|
function u() {
|
|
50
50
|
return document.body.hasAttribute("data-sbb-scroll-disabled");
|
|
51
51
|
}
|
|
52
|
-
class
|
|
52
|
+
class P {
|
|
53
53
|
disableScroll() {
|
|
54
54
|
if (u())
|
|
55
55
|
return;
|
|
56
|
-
this.
|
|
56
|
+
this._position = document.body.style.position, this._overflow = document.body.style.overflow, this._marginInlineEnd = 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._position || "", document.body.style.overflow = this._overflow || "", document.body.style.marginInlineEnd = this._marginInlineEnd || "", 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 R(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.__definitions
|
|
71
71
|
);
|
|
72
72
|
for (const [o, i] of n)
|
|
73
73
|
if (i.ctor === t.constructor)
|
|
@@ -75,25 +75,25 @@ function T(t) {
|
|
|
75
75
|
throw new Error(`Given element ${t.constructor.name} has not been registered yet.`);
|
|
76
76
|
}
|
|
77
77
|
export {
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
k as ACTION_ELEMENTS,
|
|
79
|
+
P as SbbScrollHandler,
|
|
80
80
|
E as breakpoints,
|
|
81
|
-
|
|
81
|
+
I as findInput,
|
|
82
82
|
h as findReferencedElement,
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
83
|
+
p as getDocumentWritingMode,
|
|
84
|
+
R as getLocalName,
|
|
85
|
+
x as hostContext,
|
|
86
|
+
W as isAndroid,
|
|
87
87
|
w as isBlink,
|
|
88
88
|
S as isBreakpoint,
|
|
89
|
-
|
|
89
|
+
C as isChromium,
|
|
90
90
|
m as isEdge,
|
|
91
|
-
|
|
91
|
+
_ as isFirefox,
|
|
92
92
|
M as isIOS,
|
|
93
|
-
|
|
94
|
-
|
|
93
|
+
N as isNextjs,
|
|
94
|
+
B as isSafari,
|
|
95
95
|
c as isTrident,
|
|
96
96
|
v as isWebkit,
|
|
97
97
|
u as pageScrollDisabled,
|
|
98
|
-
|
|
98
|
+
$ 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, o = null) {
|
|
2
|
+
const n = t.composedPath();
|
|
3
|
+
let s = n.findIndex((r) => r === o);
|
|
4
|
+
return s === -1 && (s = void 0), n.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 l {
|
|
12
|
+
constructor(e, o, n = c) {
|
|
13
|
+
this._element = e, this._eventName = o, this._options = n;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Dispatches an event.
|
|
@@ -19,61 +19,61 @@ class u {
|
|
|
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 o, n;
|
|
23
|
+
return ((n = (o = this._element).dispatchEvent) == null ? void 0 : n.call(
|
|
24
|
+
o,
|
|
25
|
+
new CustomEvent(this._eventName, { ...this._options, detail: e })
|
|
26
26
|
)) ?? !0;
|
|
27
27
|
}
|
|
28
28
|
}
|
|
29
|
-
function
|
|
29
|
+
function u(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 d = ({ 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 o = Object.getPrototypeOf(t).constructor, n = new o(t.type, t);
|
|
40
|
+
e.dispatchEvent(n);
|
|
41
41
|
}
|
|
42
|
-
class
|
|
43
|
-
constructor(e, ...
|
|
44
|
-
this.
|
|
42
|
+
class p {
|
|
43
|
+
constructor(e, ...o) {
|
|
44
|
+
this._host = e, this._aspects = o;
|
|
45
45
|
}
|
|
46
46
|
connect() {
|
|
47
|
-
var
|
|
48
|
-
(
|
|
49
|
-
const e = { host: this.
|
|
50
|
-
for (const
|
|
51
|
-
|
|
47
|
+
var o;
|
|
48
|
+
(o = this._controller) == null || o.abort(), this._controller = new AbortController();
|
|
49
|
+
const e = { host: this._host, signal: this._controller.signal };
|
|
50
|
+
for (const n of this._aspects)
|
|
51
|
+
n(e);
|
|
52
52
|
}
|
|
53
53
|
disconnect() {
|
|
54
54
|
var e;
|
|
55
|
-
(e = this.
|
|
55
|
+
(e = this._controller) == null || e.abort();
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
|
-
async function
|
|
58
|
+
async function f(t) {
|
|
59
59
|
return await new Promise((e) => setTimeout(e)), t.defaultPrevented;
|
|
60
60
|
}
|
|
61
61
|
const m = (t, e) => {
|
|
62
|
-
let
|
|
62
|
+
let o = !1;
|
|
63
63
|
return (...s) => {
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
o || (t(...s), o = !0, setTimeout(() => {
|
|
65
|
+
o = !1;
|
|
66
66
|
}, e));
|
|
67
67
|
};
|
|
68
68
|
};
|
|
69
69
|
export {
|
|
70
|
-
|
|
71
|
-
|
|
70
|
+
l as EventEmitter,
|
|
71
|
+
p as HandlerRepository,
|
|
72
72
|
a as composedPathHasAttribute,
|
|
73
|
-
|
|
73
|
+
d as formElementHandlerAspect,
|
|
74
74
|
h as forwardEventToHost,
|
|
75
|
-
|
|
76
|
-
|
|
75
|
+
u as getEventTarget,
|
|
76
|
+
f as isEventPrevented,
|
|
77
77
|
i as preventScrollOnSpacebarPress,
|
|
78
78
|
m as throttle
|
|
79
79
|
};
|