@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/a11y.js
CHANGED
|
@@ -1,82 +1,82 @@
|
|
|
1
|
-
import { getDocumentWritingMode as
|
|
2
|
-
import { isServer as
|
|
3
|
-
import { getEventTarget as
|
|
4
|
-
function
|
|
5
|
-
return
|
|
1
|
+
import { getDocumentWritingMode as w } from "./dom.js";
|
|
2
|
+
import { isServer as A } from "lit";
|
|
3
|
+
import { getEventTarget as u } from "./eventing.js";
|
|
4
|
+
function l() {
|
|
5
|
+
return w() === "rtl" ? { prevKey: "ArrowRight", nextKey: "ArrowLeft" } : { prevKey: "ArrowLeft", nextKey: "ArrowRight" };
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function E(t) {
|
|
8
8
|
return ["ArrowRight", "ArrowLeft", "ArrowUp", "ArrowDown"].includes(t.key);
|
|
9
9
|
}
|
|
10
|
-
function V(t) {
|
|
11
|
-
return t.key === "ArrowUp" || t.key === d().prevKey;
|
|
12
|
-
}
|
|
13
10
|
function W(t) {
|
|
14
|
-
return t.key === "
|
|
11
|
+
return t.key === "ArrowUp" || t.key === l().prevKey;
|
|
15
12
|
}
|
|
16
13
|
function Y(t) {
|
|
17
|
-
return
|
|
14
|
+
return t.key === "ArrowDown" || t.key === l().nextKey;
|
|
15
|
+
}
|
|
16
|
+
function _(t) {
|
|
17
|
+
return E(t) || ["PageUp", "PageDown", "Home", "End"].includes(t.key);
|
|
18
18
|
}
|
|
19
|
-
function f(t, e,
|
|
20
|
-
return (t +
|
|
19
|
+
function f(t, e, n) {
|
|
20
|
+
return (t + n + e) % e;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function k(t) {
|
|
23
23
|
return t - 1;
|
|
24
24
|
}
|
|
25
25
|
const y = 0;
|
|
26
|
-
function B(t, e,
|
|
27
|
-
const { prevKey:
|
|
28
|
-
return t.key ===
|
|
26
|
+
function B(t, e, n) {
|
|
27
|
+
const { prevKey: i, nextKey: r } = l();
|
|
28
|
+
return t.key === i || t.key === "ArrowUp" ? e < y ? k(n) : f(e, n, -1) : t.key === r || t.key === "ArrowDown" ? e >= n ? y : f(e, n, 1) : e;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function v(t) {
|
|
31
31
|
return t.buttons === 0 || t.detail === 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function R(t) {
|
|
34
34
|
const e = t.touches && t.touches[0] || t.changedTouches && t.changedTouches[0];
|
|
35
35
|
return !!e && e.identifier === -1 && (e.radiusX == null || e.radiusX === 1) && (e.radiusY == null || e.radiusY === 1);
|
|
36
36
|
}
|
|
37
|
-
const
|
|
38
|
-
ignoreKeys: [
|
|
39
|
-
},
|
|
37
|
+
const L = 16, C = 17, K = 18, x = 91, F = 224, M = {
|
|
38
|
+
ignoreKeys: [K, C, F, x, L]
|
|
39
|
+
}, S = 650, d = {
|
|
40
40
|
passive: !0,
|
|
41
41
|
capture: !0
|
|
42
42
|
};
|
|
43
|
-
class
|
|
43
|
+
class D {
|
|
44
44
|
constructor() {
|
|
45
|
-
this.
|
|
46
|
-
...
|
|
47
|
-
}, this.
|
|
48
|
-
var
|
|
49
|
-
(
|
|
50
|
-
}, this.
|
|
51
|
-
Date.now() - this.
|
|
52
|
-
}, this.
|
|
53
|
-
if (
|
|
54
|
-
this.
|
|
45
|
+
this.a = "mouse", this.b = null, this.d = {
|
|
46
|
+
...M
|
|
47
|
+
}, this.c = 0, this.e = (e) => {
|
|
48
|
+
var n, i;
|
|
49
|
+
(i = (n = this.d) == null ? void 0 : n.ignoreKeys) != null && i.some((r) => r === e.keyCode) || (this.a = "keyboard", this.b = u(e));
|
|
50
|
+
}, this.f = (e) => {
|
|
51
|
+
Date.now() - this.c < S || (this.a = v(e) ? "keyboard" : "mouse", this.b = u(e));
|
|
52
|
+
}, this.g = (e) => {
|
|
53
|
+
if (R(e)) {
|
|
54
|
+
this.a = "keyboard", this.b = u(e);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
this.
|
|
58
|
-
},
|
|
57
|
+
this.c = Date.now(), this.a = "touch", this.b = u(e);
|
|
58
|
+
}, A || (document.addEventListener("keydown", this.e, d), document.addEventListener("mousedown", this.f, d), document.addEventListener("touchstart", this.g, d));
|
|
59
59
|
}
|
|
60
60
|
/** The most recently detected input modality. */
|
|
61
61
|
get mostRecentModality() {
|
|
62
|
-
return this.
|
|
62
|
+
return this.a;
|
|
63
63
|
}
|
|
64
64
|
reset() {
|
|
65
|
-
this.
|
|
65
|
+
this.a = "mouse", this.b = null, this.c = 0;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* The most recently detected input modality event target. Is null if no input modality has been
|
|
69
69
|
* detected or if the associated event target is null for some unknown reason.
|
|
70
70
|
*/
|
|
71
71
|
get mostRecentTarget() {
|
|
72
|
-
return this.
|
|
72
|
+
return this.b;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const b = new D();
|
|
76
76
|
function X(t) {
|
|
77
77
|
if (!t)
|
|
78
78
|
return;
|
|
79
|
-
const e =
|
|
79
|
+
const e = b.mostRecentModality;
|
|
80
80
|
t && e !== null && t.addEventListener(
|
|
81
81
|
"focus",
|
|
82
82
|
() => {
|
|
@@ -93,26 +93,26 @@ function X(t) {
|
|
|
93
93
|
}
|
|
94
94
|
class j {
|
|
95
95
|
constructor(e) {
|
|
96
|
-
this.
|
|
97
|
-
this.
|
|
96
|
+
this.a = e, this.b = () => {
|
|
97
|
+
this.a.toggleAttribute(
|
|
98
98
|
"data-has-visible-focus-within",
|
|
99
|
-
|
|
99
|
+
b.mostRecentModality === "keyboard"
|
|
100
100
|
);
|
|
101
|
-
}, this.
|
|
102
|
-
this.
|
|
103
|
-
}, this.
|
|
101
|
+
}, this.c = () => {
|
|
102
|
+
this.a.removeAttribute("data-has-visible-focus-within");
|
|
103
|
+
}, this.a.addController(this);
|
|
104
104
|
}
|
|
105
105
|
hostConnected() {
|
|
106
|
-
this.
|
|
106
|
+
this.a.addEventListener("focusin", this.b), this.a.addEventListener("focusout", this.c);
|
|
107
107
|
}
|
|
108
108
|
hostDisconnected() {
|
|
109
|
-
this.
|
|
109
|
+
this.a.removeEventListener("focusin", this.b), this.a.removeEventListener("focusout", this.c);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function I(t) {
|
|
113
113
|
return !!(t.offsetWidth || t.offsetHeight || typeof t.getClientRects == "function" && t.getClientRects().length);
|
|
114
114
|
}
|
|
115
|
-
class
|
|
115
|
+
class N {
|
|
116
116
|
/**
|
|
117
117
|
* Gets whether an element is visible for the purposes of interactivity.
|
|
118
118
|
*
|
|
@@ -122,15 +122,15 @@ class D {
|
|
|
122
122
|
* @returns Whether the element is visible.
|
|
123
123
|
*/
|
|
124
124
|
isVisible(e) {
|
|
125
|
-
return
|
|
125
|
+
return I(e) && getComputedStyle(e).visibility === "visible";
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
class
|
|
128
|
+
class P {
|
|
129
129
|
isVisible() {
|
|
130
130
|
return !0;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
const
|
|
133
|
+
const O = typeof getComputedStyle > "u" || getComputedStyle(document.documentElement).visibility === "" ? new P() : new N(), T = [
|
|
134
134
|
"button",
|
|
135
135
|
"[href]",
|
|
136
136
|
"input",
|
|
@@ -141,38 +141,38 @@ const H = typeof getComputedStyle > "u" || getComputedStyle(document.documentEle
|
|
|
141
141
|
"[tabindex]"
|
|
142
142
|
].map((t) => `${t}:not([disabled],[tabindex="-1"])`).join(",");
|
|
143
143
|
function g(t, e) {
|
|
144
|
-
const
|
|
145
|
-
function
|
|
146
|
-
var
|
|
147
|
-
for (const
|
|
148
|
-
if (!(c && !c(
|
|
149
|
-
if (
|
|
150
|
-
|
|
151
|
-
Array.from(
|
|
144
|
+
const n = /* @__PURE__ */ new Set();
|
|
145
|
+
function i(r, c) {
|
|
146
|
+
var o;
|
|
147
|
+
for (const s of r)
|
|
148
|
+
if (!(c && !c(s))) {
|
|
149
|
+
if (s.nodeName === "SLOT") {
|
|
150
|
+
i(
|
|
151
|
+
Array.from(s.assignedElements()),
|
|
152
152
|
c
|
|
153
153
|
);
|
|
154
154
|
continue;
|
|
155
155
|
}
|
|
156
|
-
if (
|
|
156
|
+
if (s.matches(T) && ((e == null ? void 0 : e.includeInvisibleElements) ?? O.isVisible(s)) && n.add(s), e != null && e.findFirstFocusable && n.size > 0)
|
|
157
157
|
break;
|
|
158
|
-
if (
|
|
159
|
-
const
|
|
160
|
-
|
|
158
|
+
if (s.children.length || (o = s.shadowRoot) != null && o.children.length) {
|
|
159
|
+
const a = Array.from(s.children).length ? Array.from(s.children) : Array.from(s.shadowRoot.children);
|
|
160
|
+
i(a, c);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
return
|
|
164
|
+
return i(t, e == null ? void 0 : e.filter), [...n];
|
|
165
165
|
}
|
|
166
166
|
function G(t, e) {
|
|
167
|
-
const
|
|
167
|
+
const n = g(t, {
|
|
168
168
|
filter: e,
|
|
169
169
|
findFirstFocusable: !0
|
|
170
170
|
});
|
|
171
|
-
return
|
|
171
|
+
return n.length ? n[0] : null;
|
|
172
172
|
}
|
|
173
173
|
class Q {
|
|
174
174
|
constructor() {
|
|
175
|
-
this.
|
|
175
|
+
this.a = new AbortController();
|
|
176
176
|
}
|
|
177
177
|
/**
|
|
178
178
|
* @param element in which the focus should be trapped.
|
|
@@ -180,47 +180,47 @@ class Q {
|
|
|
180
180
|
* @param options.filter filter function which is applied during searching for focusable element. If an element is filtered, also child elements are filtered.
|
|
181
181
|
* @param options.postFilter filter function which is applied after collecting focusable elements.
|
|
182
182
|
*/
|
|
183
|
-
trap(e,
|
|
183
|
+
trap(e, n) {
|
|
184
184
|
e.addEventListener(
|
|
185
185
|
"keydown",
|
|
186
|
-
(
|
|
187
|
-
if (
|
|
186
|
+
(i) => {
|
|
187
|
+
if (i.key !== "Tab")
|
|
188
188
|
return;
|
|
189
189
|
const r = Array.from(
|
|
190
190
|
e.shadowRoot.children || []
|
|
191
|
-
),
|
|
192
|
-
filter:
|
|
191
|
+
), o = g(r, {
|
|
192
|
+
filter: n == null ? void 0 : n.filter
|
|
193
193
|
}).filter(
|
|
194
|
-
(
|
|
194
|
+
(n == null ? void 0 : n.postFilter) ?? (() => !0)
|
|
195
195
|
);
|
|
196
|
-
if (!
|
|
196
|
+
if (!o.length)
|
|
197
197
|
return;
|
|
198
|
-
const
|
|
199
|
-
(
|
|
198
|
+
const s = o[0], a = o[o.length - 1], [h, m] = i.shiftKey ? [s, a] : [a, s];
|
|
199
|
+
(s.getRootNode().activeElement === h || a.getRootNode().activeElement === h) && (m.focus(), i.preventDefault());
|
|
200
200
|
},
|
|
201
|
-
{ signal: this.
|
|
201
|
+
{ signal: this.a.signal }
|
|
202
202
|
);
|
|
203
203
|
}
|
|
204
204
|
disconnect() {
|
|
205
|
-
this.
|
|
205
|
+
this.a.abort(), this.a = new AbortController();
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
export {
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
T as IS_FOCUSABLE_QUERY,
|
|
210
|
+
N as InteractivityChecker,
|
|
211
211
|
Q as SbbFocusHandler,
|
|
212
212
|
j as SbbFocusVisibleWithinController,
|
|
213
213
|
G as getFirstFocusableElement,
|
|
214
214
|
g as getFocusableElements,
|
|
215
215
|
B as getNextElementIndex,
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
216
|
+
I as hasGeometry,
|
|
217
|
+
O as interactivityChecker,
|
|
218
|
+
_ as isArrowKeyOrPageKeysPressed,
|
|
219
|
+
E as isArrowKeyPressed,
|
|
220
|
+
v as isFakeMousedownFromScreenReader,
|
|
221
|
+
R as isFakeTouchstartFromScreenReader,
|
|
222
|
+
Y as isNextArrowKeyPressed,
|
|
223
|
+
W as isPreviousArrowKeyPressed,
|
|
224
|
+
b as sbbInputModalityDetector,
|
|
225
225
|
X as setModalityOnNextFocus
|
|
226
226
|
};
|
package/core/base-elements.js
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { LitElement as w, html as
|
|
2
|
-
import { hostAttributes as
|
|
3
|
-
import { getDocumentWritingMode as O, getLocalName as
|
|
4
|
-
import { property as
|
|
5
|
-
import { isEventPrevented as
|
|
6
|
-
import { SbbLanguageController as
|
|
7
|
-
import { i18nTargetOpensInNewWindow as
|
|
1
|
+
import { LitElement as w, html as f, isServer as g, nothing as l } from "lit";
|
|
2
|
+
import { hostAttributes as y } from "./decorators.js";
|
|
3
|
+
import { getDocumentWritingMode as O, getLocalName as $ } from "./dom.js";
|
|
4
|
+
import { property as o } from "lit/decorators.js";
|
|
5
|
+
import { isEventPrevented as E, EventEmitter as b } from "./eventing.js";
|
|
6
|
+
import { SbbLanguageController as C } from "./controllers.js";
|
|
7
|
+
import { i18nTargetOpensInNewWindow as D } from "./i18n.js";
|
|
8
8
|
import "../screen-reader-only.js";
|
|
9
|
-
var
|
|
10
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
9
|
+
var P = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, L = (e, t, r, i) => {
|
|
10
|
+
for (var s = i > 1 ? void 0 : i ? _(t, r) : t, a = e.length - 1, n; a >= 0; a--)
|
|
11
11
|
(n = e[a]) && (s = (i ? n(t, r, s) : n(s)) || s);
|
|
12
|
-
return i && s &&
|
|
12
|
+
return i && s && P(t, r, s), s;
|
|
13
13
|
};
|
|
14
14
|
let m = class extends w {
|
|
15
15
|
get maybeDisabled() {
|
|
@@ -33,41 +33,40 @@ let m = class extends w {
|
|
|
33
33
|
}
|
|
34
34
|
/** Default render method for button-like components. */
|
|
35
35
|
render() {
|
|
36
|
-
return
|
|
37
|
-
<span class="sbb-action-base ${this.localName ??
|
|
36
|
+
return f`
|
|
37
|
+
<span class="sbb-action-base ${this.localName ?? $(this)}">
|
|
38
38
|
${this.renderTemplate()}
|
|
39
39
|
</span>
|
|
40
40
|
`;
|
|
41
41
|
}
|
|
42
42
|
};
|
|
43
|
-
m =
|
|
44
|
-
|
|
43
|
+
m = L([
|
|
44
|
+
y({
|
|
45
45
|
dir: O(),
|
|
46
46
|
"data-action": ""
|
|
47
47
|
})
|
|
48
48
|
], m);
|
|
49
|
-
var
|
|
50
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
49
|
+
var A = Object.defineProperty, x = Object.getOwnPropertyDescriptor, c = (e, t, r, i) => {
|
|
50
|
+
for (var s = i > 1 ? void 0 : i ? x(t, r) : t, a = e.length - 1, n; a >= 0; a--)
|
|
51
51
|
(n = e[a]) && (s = (i ? n(t, r, s) : n(s)) || s);
|
|
52
|
-
return i && s &&
|
|
52
|
+
return i && s && A(t, r, s), s;
|
|
53
53
|
};
|
|
54
|
-
let
|
|
54
|
+
let d = class extends m {
|
|
55
55
|
constructor() {
|
|
56
|
-
if (super(), this.type = "button", this.
|
|
57
|
-
if (this.type === "button" || await
|
|
56
|
+
if (super(), this.type = "button", this.c = async (e) => {
|
|
57
|
+
if (this.type === "button" || await E(e))
|
|
58
58
|
return;
|
|
59
59
|
const t = this.form ? this.ownerDocument.querySelector(`form#${this.form}`) : this.closest("form");
|
|
60
60
|
if (t)
|
|
61
61
|
this.type === "submit" ? t.requestSubmit() : this.type === "reset" && t.reset();
|
|
62
|
-
else
|
|
63
|
-
|
|
64
|
-
}, this._preventScrollOnSpaceKeydown = (e) => {
|
|
62
|
+
else return;
|
|
63
|
+
}, this.d = (e) => {
|
|
65
64
|
e.key === " " && (e.preventDefault(), e.target.toggleAttribute("data-active", !0));
|
|
66
|
-
}, this.
|
|
65
|
+
}, this.a = (e) => {
|
|
67
66
|
e.target.removeAttribute("data-active");
|
|
68
|
-
}, this.
|
|
69
|
-
e.key === " " && (this.
|
|
70
|
-
}, this.
|
|
67
|
+
}, this.e = (e) => {
|
|
68
|
+
e.key === " " && (this.a(e), this.b(e));
|
|
69
|
+
}, this.b = (e) => {
|
|
71
70
|
const { altKey: t, ctrlKey: r, metaKey: i, shiftKey: s } = e;
|
|
72
71
|
e.target.dispatchEvent(
|
|
73
72
|
new PointerEvent("click", {
|
|
@@ -85,11 +84,11 @@ let h = class extends m {
|
|
|
85
84
|
}, !g) {
|
|
86
85
|
this.setupBaseEventHandlers();
|
|
87
86
|
const e = { passive: !0 };
|
|
88
|
-
this.addEventListener("click", this.
|
|
87
|
+
this.addEventListener("click", this.c), this.addEventListener("keydown", this.d), this.addEventListener("keyup", this.e, e), this.addEventListener("blur", this.a, e), this.addEventListener(
|
|
89
88
|
"keypress",
|
|
90
89
|
(t) => {
|
|
91
90
|
(t.key === "Enter" || t.key === `
|
|
92
|
-
`) && this.
|
|
91
|
+
`) && this.b(t);
|
|
93
92
|
},
|
|
94
93
|
e
|
|
95
94
|
);
|
|
@@ -111,33 +110,33 @@ let h = class extends m {
|
|
|
111
110
|
(!["name", "value"].includes(e) || t !== r) && super.attributeChangedCallback(e, t, r);
|
|
112
111
|
}
|
|
113
112
|
};
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
],
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
],
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
],
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
],
|
|
126
|
-
|
|
127
|
-
|
|
113
|
+
c([
|
|
114
|
+
o()
|
|
115
|
+
], d.prototype, "type", 2);
|
|
116
|
+
c([
|
|
117
|
+
o()
|
|
118
|
+
], d.prototype, "name", 1);
|
|
119
|
+
c([
|
|
120
|
+
o()
|
|
121
|
+
], d.prototype, "value", 1);
|
|
122
|
+
c([
|
|
123
|
+
o()
|
|
124
|
+
], d.prototype, "form", 2);
|
|
125
|
+
d = c([
|
|
126
|
+
y({
|
|
128
127
|
role: "button",
|
|
129
128
|
tabindex: "0",
|
|
130
129
|
"data-button": ""
|
|
131
130
|
})
|
|
132
|
-
],
|
|
133
|
-
var
|
|
134
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
131
|
+
], d);
|
|
132
|
+
var S = Object.defineProperty, j = Object.getOwnPropertyDescriptor, u = (e, t, r, i) => {
|
|
133
|
+
for (var s = i > 1 ? void 0 : i ? j(t, r) : t, a = e.length - 1, n; a >= 0; a--)
|
|
135
134
|
(n = e[a]) && (s = (i ? n(t, r, s) : n(s)) || s);
|
|
136
|
-
return i && s &&
|
|
135
|
+
return i && s && S(t, r, s), s;
|
|
137
136
|
};
|
|
138
|
-
let
|
|
137
|
+
let p = class extends m {
|
|
139
138
|
constructor() {
|
|
140
|
-
super(), this.language = new
|
|
139
|
+
super(), this.language = new C(this), this.a = () => this.rel ? this.rel : this.target === "_blank" ? "external noopener nofollow" : l, g || this.setupBaseEventHandlers();
|
|
141
140
|
}
|
|
142
141
|
/** @internal */
|
|
143
142
|
focus(e) {
|
|
@@ -156,56 +155,56 @@ let c = class extends m {
|
|
|
156
155
|
}
|
|
157
156
|
/** Default render method for link-like components. Can be overridden if the LinkRenderVariables are not needed. */
|
|
158
157
|
render() {
|
|
159
|
-
return
|
|
158
|
+
return f`
|
|
160
159
|
<a
|
|
161
|
-
class="sbb-action-base ${this.localName ??
|
|
162
|
-
href=${this.href ||
|
|
160
|
+
class="sbb-action-base ${this.localName ?? $(this)}"
|
|
161
|
+
href=${this.href || l}
|
|
163
162
|
?download=${this.download}
|
|
164
|
-
target=${this.target ||
|
|
165
|
-
rel=${this.
|
|
166
|
-
aria-label=${this.accessibilityLabel ||
|
|
167
|
-
tabindex=${this.maybeDisabled ? "-1" :
|
|
168
|
-
aria-disabled=${this.maybeDisabled ? "true" :
|
|
163
|
+
target=${this.target || l}
|
|
164
|
+
rel=${this.a()}
|
|
165
|
+
aria-label=${this.accessibilityLabel || l}
|
|
166
|
+
tabindex=${this.maybeDisabled ? "-1" : l}
|
|
167
|
+
aria-disabled=${this.maybeDisabled ? "true" : l}
|
|
169
168
|
>
|
|
170
169
|
${this.renderTemplate()}
|
|
171
|
-
${this.href && this.target === "_blank" ?
|
|
172
|
-
>. ${
|
|
173
|
-
>` :
|
|
170
|
+
${this.href && this.target === "_blank" ? f`<sbb-screen-reader-only
|
|
171
|
+
>. ${D[this.language.current]}</sbb-screen-reader-only
|
|
172
|
+
>` : l}
|
|
174
173
|
</a>
|
|
175
174
|
`;
|
|
176
175
|
}
|
|
177
176
|
};
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
],
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
],
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
],
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
],
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
],
|
|
193
|
-
|
|
194
|
-
|
|
177
|
+
u([
|
|
178
|
+
o()
|
|
179
|
+
], p.prototype, "href", 2);
|
|
180
|
+
u([
|
|
181
|
+
o()
|
|
182
|
+
], p.prototype, "target", 2);
|
|
183
|
+
u([
|
|
184
|
+
o()
|
|
185
|
+
], p.prototype, "rel", 2);
|
|
186
|
+
u([
|
|
187
|
+
o({ type: Boolean })
|
|
188
|
+
], p.prototype, "download", 2);
|
|
189
|
+
u([
|
|
190
|
+
o({ attribute: "accessibility-label" })
|
|
191
|
+
], p.prototype, "accessibilityLabel", 2);
|
|
192
|
+
p = u([
|
|
193
|
+
y({
|
|
195
194
|
"data-link": ""
|
|
196
195
|
})
|
|
197
|
-
],
|
|
198
|
-
const
|
|
196
|
+
], p);
|
|
197
|
+
const h = class h extends w {
|
|
199
198
|
constructor() {
|
|
200
199
|
super(...arguments), this.willOpen = new b(
|
|
201
200
|
this,
|
|
202
|
-
|
|
203
|
-
), this.didOpen = new b(this,
|
|
201
|
+
h.events.willOpen
|
|
202
|
+
), this.didOpen = new b(this, h.events.didOpen), this.willClose = new b(
|
|
204
203
|
this,
|
|
205
|
-
|
|
204
|
+
h.events.willClose
|
|
206
205
|
), this.didClose = new b(
|
|
207
206
|
this,
|
|
208
|
-
|
|
207
|
+
h.events.didClose
|
|
209
208
|
);
|
|
210
209
|
}
|
|
211
210
|
/** The state of the component. */
|
|
@@ -219,16 +218,16 @@ const p = class p extends w {
|
|
|
219
218
|
super.connectedCallback(), this.state || (this.state = "closed");
|
|
220
219
|
}
|
|
221
220
|
};
|
|
222
|
-
|
|
221
|
+
h.events = {
|
|
223
222
|
willOpen: "willOpen",
|
|
224
223
|
didOpen: "didOpen",
|
|
225
224
|
willClose: "willClose",
|
|
226
225
|
didClose: "didClose"
|
|
227
226
|
};
|
|
228
|
-
let
|
|
227
|
+
let v = h;
|
|
229
228
|
export {
|
|
230
229
|
m as SbbActionBaseElement,
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
230
|
+
d as SbbButtonBaseElement,
|
|
231
|
+
p as SbbLinkBaseElement,
|
|
232
|
+
v as SbbOpenCloseBaseElement
|
|
234
233
|
};
|