@sbb-esta/lyne-elements 0.52.1 → 0.53.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/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/checkbox.d.ts +3 -46
- package/checkbox/checkbox/checkbox.d.ts.map +1 -1
- package/checkbox/checkbox-group/checkbox-group.d.ts +4 -2
- package/checkbox/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/checkbox/checkbox-group.js +26 -23
- package/checkbox/checkbox-panel/checkbox-panel.d.ts +41 -0
- package/checkbox/checkbox-panel/checkbox-panel.d.ts.map +1 -0
- package/checkbox/checkbox-panel.d.ts +2 -0
- package/checkbox/checkbox-panel.d.ts.map +1 -0
- package/checkbox/checkbox-panel.js +67 -0
- package/checkbox/checkbox.js +27 -104
- package/checkbox/common/checkbox-common.d.ts +13 -0
- package/checkbox/common/checkbox-common.d.ts.map +1 -0
- package/checkbox/common.d.ts +2 -0
- package/checkbox/common.d.ts.map +1 -0
- package/checkbox/common.js +52 -0
- package/checkbox.d.ts +2 -0
- package/checkbox.d.ts.map +1 -1
- package/checkbox.js +2 -0
- 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/panel-mixin.d.ts +13 -0
- package/core/mixins/panel-mixin.d.ts.map +1 -0
- package/core/mixins.d.ts +1 -0
- package/core/mixins.d.ts.map +1 -1
- package/core/mixins.js +170 -139
- package/core/styles/node_modules_@sbb-esta_lyne-design-tokens_dist_scss_sbb-variables_css--mixin.scss +1 -1
- package/core/testing.js +29 -29
- package/core.css +1 -1
- package/custom-elements.json +8862 -6904
- package/datepicker/common.js +55 -55
- package/datepicker/datepicker-toggle.js +94 -94
- package/datepicker/datepicker.js +144 -144
- package/development/checkbox/checkbox/checkbox.d.ts +3 -46
- package/development/checkbox/checkbox/checkbox.d.ts.map +1 -1
- package/development/checkbox/checkbox-group/checkbox-group.d.ts +4 -2
- package/development/checkbox/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/development/checkbox/checkbox-group.js +43 -13
- package/development/checkbox/checkbox-panel/checkbox-panel.d.ts +41 -0
- package/development/checkbox/checkbox-panel/checkbox-panel.d.ts.map +1 -0
- package/development/checkbox/checkbox-panel.d.ts +2 -0
- package/development/checkbox/checkbox-panel.d.ts.map +1 -0
- package/development/checkbox/checkbox-panel.js +86 -0
- package/development/checkbox/checkbox.js +19 -239
- package/development/checkbox/common/checkbox-common.d.ts +13 -0
- package/development/checkbox/common/checkbox-common.d.ts.map +1 -0
- package/development/checkbox/common.d.ts +2 -0
- package/development/checkbox/common.d.ts.map +1 -0
- package/development/checkbox/common.js +156 -0
- package/development/checkbox.d.ts +2 -0
- package/development/checkbox.d.ts.map +1 -1
- package/development/checkbox.js +3 -1
- package/development/core/mixins/panel-mixin.d.ts +13 -0
- package/development/core/mixins/panel-mixin.d.ts.map +1 -0
- package/development/core/mixins.d.ts +1 -0
- package/development/core/mixins.d.ts.map +1 -1
- package/development/core/mixins.js +187 -31
- package/development/image.js +1 -1
- package/development/radio-button/common/radio-button-common.d.ts +22 -0
- package/development/radio-button/common/radio-button-common.d.ts.map +1 -0
- package/development/radio-button/common.d.ts +2 -0
- package/development/radio-button/common.d.ts.map +1 -0
- package/development/radio-button/common.js +294 -0
- package/development/radio-button/radio-button/radio-button.d.ts +2 -81
- package/development/radio-button/radio-button/radio-button.d.ts.map +1 -1
- package/development/radio-button/radio-button-group/radio-button-group.d.ts +6 -4
- package/development/radio-button/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/development/radio-button/radio-button-group.js +55 -23
- package/development/radio-button/radio-button-panel/index.d.ts +2 -0
- package/development/radio-button/radio-button-panel/index.d.ts.map +1 -0
- package/development/radio-button/radio-button-panel/radio-button-panel.d.ts +29 -0
- package/development/radio-button/radio-button-panel/radio-button-panel.d.ts.map +1 -0
- package/development/radio-button/radio-button-panel.d.ts +2 -0
- package/development/radio-button/radio-button-panel.d.ts.map +1 -0
- package/development/radio-button/radio-button-panel.js +69 -0
- package/development/radio-button/radio-button.js +10 -324
- package/development/radio-button.d.ts +2 -0
- package/development/radio-button.d.ts.map +1 -1
- package/development/radio-button.js +3 -1
- package/{selection-panel/selection-panel.d.ts → development/selection-expansion-panel/selection-expansion-panel.d.ts} +9 -7
- package/development/selection-expansion-panel/selection-expansion-panel.d.ts.map +1 -0
- package/development/selection-expansion-panel.d.ts +2 -0
- package/development/selection-expansion-panel.d.ts.map +1 -0
- package/development/selection-expansion-panel.js +340 -0
- package/development/tabs/tab/index.d.ts +2 -0
- package/development/tabs/tab/index.d.ts.map +1 -0
- package/development/tabs/tab/tab.d.ts +24 -0
- package/development/tabs/tab/tab.d.ts.map +1 -0
- package/development/tabs/tab-group/tab-group.d.ts +20 -15
- package/development/tabs/tab-group/tab-group.d.ts.map +1 -1
- package/development/tabs/tab-group.js +24 -14
- package/development/tabs/{tab-title/tab-title.d.ts → tab-label/tab-label.d.ts} +4 -4
- package/development/tabs/{tab-title/tab-title.d.ts.map → tab-label/tab-label.d.ts.map} +1 -1
- package/development/tabs/tab-label.d.ts +2 -0
- package/development/tabs/tab-label.d.ts.map +1 -0
- package/development/tabs/{tab-title.js → tab-label.js} +86 -86
- package/development/tabs/tab.d.ts +2 -0
- package/development/tabs/tab.d.ts.map +1 -0
- package/development/tabs/tab.js +71 -0
- package/development/tabs.d.ts +2 -1
- package/development/tabs.d.ts.map +1 -1
- package/development/tabs.js +3 -2
- package/development/train/train-formation/train-formation.d.ts.map +1 -1
- package/development/train/train-formation.js +12 -12
- 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/index.d.ts +10 -8
- package/index.js +10 -8
- 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 +34 -19
- package/popover/popover.js +110 -110
- package/radio-button/common/radio-button-common.d.ts +22 -0
- package/radio-button/common/radio-button-common.d.ts.map +1 -0
- package/radio-button/common.d.ts +2 -0
- package/radio-button/common.d.ts.map +1 -0
- package/radio-button/common.js +105 -0
- package/radio-button/radio-button/radio-button.d.ts +2 -81
- package/radio-button/radio-button/radio-button.d.ts.map +1 -1
- package/radio-button/radio-button-group/radio-button-group.d.ts +6 -4
- package/radio-button/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/radio-button/radio-button-group.js +86 -80
- package/radio-button/radio-button-panel/index.d.ts +2 -0
- package/radio-button/radio-button-panel/index.d.ts.map +1 -0
- package/radio-button/radio-button-panel/radio-button-panel.d.ts +29 -0
- package/radio-button/radio-button-panel/radio-button-panel.d.ts.map +1 -0
- package/radio-button/radio-button-panel.d.ts +2 -0
- package/radio-button/radio-button-panel.d.ts.map +1 -0
- package/radio-button/radio-button-panel.js +59 -0
- package/radio-button/radio-button.js +20 -143
- package/radio-button.d.ts +2 -0
- package/radio-button.d.ts.map +1 -1
- package/radio-button.js +2 -0
- package/select.js +178 -178
- package/{development/selection-panel/selection-panel.d.ts → selection-expansion-panel/selection-expansion-panel.d.ts} +9 -7
- package/selection-expansion-panel/selection-expansion-panel.d.ts.map +1 -0
- package/selection-expansion-panel.d.ts +2 -0
- package/selection-expansion-panel.d.ts.map +1 -0
- package/selection-expansion-panel.js +146 -0
- package/slider.js +58 -58
- package/standard-theme.css +1 -1
- 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/index.d.ts +2 -0
- package/tabs/tab/index.d.ts.map +1 -0
- package/tabs/tab/tab.d.ts +24 -0
- package/tabs/tab/tab.d.ts.map +1 -0
- package/tabs/tab-group/tab-group.d.ts +20 -15
- package/tabs/tab-group/tab-group.d.ts.map +1 -1
- package/tabs/tab-group.js +85 -75
- package/tabs/{tab-title/tab-title.d.ts → tab-label/tab-label.d.ts} +4 -4
- package/tabs/{tab-title/tab-title.d.ts.map → tab-label/tab-label.d.ts.map} +1 -1
- package/tabs/tab-label.d.ts +2 -0
- package/tabs/tab-label.d.ts.map +1 -0
- package/tabs/tab-label.js +51 -0
- package/tabs/tab.d.ts +2 -0
- package/tabs/tab.d.ts.map +1 -0
- package/tabs/tab.js +41 -0
- package/tabs.d.ts +2 -1
- package/tabs.d.ts.map +1 -1
- package/tabs.js +2 -1
- package/tag/tag-group.js +8 -8
- package/tag/tag.js +27 -27
- 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/train-formation.d.ts.map +1 -1
- package/train/train-formation.js +51 -51
- package/train/train-wagon.js +30 -30
- package/train/train.js +13 -13
- package/development/selection-panel/selection-panel.d.ts.map +0 -1
- package/development/selection-panel.d.ts +0 -2
- package/development/selection-panel.d.ts.map +0 -1
- package/development/selection-panel.js +0 -376
- package/development/tabs/tab-title.d.ts +0 -2
- package/development/tabs/tab-title.d.ts.map +0 -1
- package/development/teaser-hero/teaser-hero.d.ts +0 -26
- package/development/teaser-hero/teaser-hero.d.ts.map +0 -1
- package/development/teaser-hero.d.ts +0 -2
- package/development/teaser-hero.d.ts.map +0 -1
- package/development/teaser-hero.js +0 -181
- package/development/teaser-paid/teaser-paid.d.ts +0 -20
- package/development/teaser-paid/teaser-paid.d.ts.map +0 -1
- package/development/teaser-paid.d.ts +0 -2
- package/development/teaser-paid.d.ts.map +0 -1
- package/development/teaser-paid.js +0 -91
- package/selection-panel/selection-panel.d.ts.map +0 -1
- package/selection-panel.d.ts +0 -2
- package/selection-panel.d.ts.map +0 -1
- package/selection-panel.js +0 -138
- package/tabs/tab-title.d.ts +0 -2
- package/tabs/tab-title.d.ts.map +0 -1
- package/tabs/tab-title.js +0 -51
- package/teaser-hero/teaser-hero.d.ts +0 -26
- package/teaser-hero/teaser-hero.d.ts.map +0 -1
- package/teaser-hero.d.ts +0 -2
- package/teaser-hero.d.ts.map +0 -1
- package/teaser-hero.js +0 -51
- package/teaser-paid/teaser-paid.d.ts +0 -20
- package/teaser-paid/teaser-paid.d.ts.map +0 -1
- package/teaser-paid.d.ts +0 -2
- package/teaser-paid.d.ts.map +0 -1
- package/teaser-paid.js +0 -28
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 _ } from "./dom.js";
|
|
2
|
+
import { isServer as w } from "lit";
|
|
3
|
+
import { getEventTarget as a } from "./eventing.js";
|
|
4
|
+
function d() {
|
|
5
|
+
return _() === "rtl" ? { prevKey: "ArrowRight", nextKey: "ArrowLeft" } : { prevKey: "ArrowLeft", nextKey: "ArrowRight" };
|
|
6
6
|
}
|
|
7
|
-
function
|
|
7
|
+
function R(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
|
+
}
|
|
10
13
|
function W(t) {
|
|
11
|
-
return t.key === "
|
|
14
|
+
return t.key === "ArrowDown" || t.key === d().nextKey;
|
|
12
15
|
}
|
|
13
16
|
function Y(t) {
|
|
14
|
-
return t
|
|
15
|
-
}
|
|
16
|
-
function _(t) {
|
|
17
|
-
return E(t) || ["PageUp", "PageDown", "Home", "End"].includes(t.key);
|
|
17
|
+
return R(t) || ["PageUp", "PageDown", "Home", "End"].includes(t.key);
|
|
18
18
|
}
|
|
19
|
-
function f(t, e,
|
|
20
|
-
return (t +
|
|
19
|
+
function f(t, e, o) {
|
|
20
|
+
return (t + o + e) % e;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
22
|
+
function A(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, o) {
|
|
27
|
+
const { prevKey: s, nextKey: r } = d();
|
|
28
|
+
return t.key === s || t.key === "ArrowUp" ? e < y ? A(o) : f(e, o, -1) : t.key === r || t.key === "ArrowDown" ? e >= o ? y : f(e, o, 1) : e;
|
|
29
29
|
}
|
|
30
|
-
function
|
|
30
|
+
function E(t) {
|
|
31
31
|
return t.buttons === 0 || t.detail === 0;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
33
|
+
function M(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 k = 16, v = 17, T = 18, K = 91, L = 224, C = {
|
|
38
|
+
ignoreKeys: [T, v, L, K, k]
|
|
39
|
+
}, x = 650, l = {
|
|
40
40
|
passive: !0,
|
|
41
41
|
capture: !0
|
|
42
42
|
};
|
|
43
|
-
class
|
|
43
|
+
class F {
|
|
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._mostRecentModality = "mouse", this._mostRecentTarget = null, this._options = {
|
|
46
|
+
...C
|
|
47
|
+
}, this._lastTouchMs = 0, this._onKeydown = (e) => {
|
|
48
|
+
var o, s;
|
|
49
|
+
(s = (o = this._options) == null ? void 0 : o.ignoreKeys) != null && s.some((r) => r === e.keyCode) || (this._mostRecentModality = "keyboard", this._mostRecentTarget = a(e));
|
|
50
|
+
}, this._onMousedown = (e) => {
|
|
51
|
+
Date.now() - this._lastTouchMs < x || (this._mostRecentModality = E(e) ? "keyboard" : "mouse", this._mostRecentTarget = a(e));
|
|
52
|
+
}, this._onTouchstart = (e) => {
|
|
53
|
+
if (M(e)) {
|
|
54
|
+
this._mostRecentModality = "keyboard", this._mostRecentTarget = a(e);
|
|
55
55
|
return;
|
|
56
56
|
}
|
|
57
|
-
this.
|
|
58
|
-
},
|
|
57
|
+
this._lastTouchMs = Date.now(), this._mostRecentModality = "touch", this._mostRecentTarget = a(e);
|
|
58
|
+
}, w || (document.addEventListener("keydown", this._onKeydown, l), document.addEventListener("mousedown", this._onMousedown, l), document.addEventListener("touchstart", this._onTouchstart, l));
|
|
59
59
|
}
|
|
60
60
|
/** The most recently detected input modality. */
|
|
61
61
|
get mostRecentModality() {
|
|
62
|
-
return this.
|
|
62
|
+
return this._mostRecentModality;
|
|
63
63
|
}
|
|
64
64
|
reset() {
|
|
65
|
-
this.
|
|
65
|
+
this._mostRecentModality = "mouse", this._mostRecentTarget = null, this._lastTouchMs = 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._mostRecentTarget;
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
|
-
const
|
|
75
|
+
const m = new F();
|
|
76
76
|
function X(t) {
|
|
77
77
|
if (!t)
|
|
78
78
|
return;
|
|
79
|
-
const e =
|
|
79
|
+
const e = m.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._host = e, this._focusinHandler = () => {
|
|
97
|
+
this._host.toggleAttribute(
|
|
98
98
|
"data-has-visible-focus-within",
|
|
99
|
-
|
|
99
|
+
m.mostRecentModality === "keyboard"
|
|
100
100
|
);
|
|
101
|
-
}, this.
|
|
102
|
-
this.
|
|
103
|
-
}, this.
|
|
101
|
+
}, this._focusoutHandler = () => {
|
|
102
|
+
this._host.removeAttribute("data-has-visible-focus-within");
|
|
103
|
+
}, this._host.addController(this);
|
|
104
104
|
}
|
|
105
105
|
hostConnected() {
|
|
106
|
-
this.
|
|
106
|
+
this._host.addEventListener("focusin", this._focusinHandler), this._host.addEventListener("focusout", this._focusoutHandler);
|
|
107
107
|
}
|
|
108
108
|
hostDisconnected() {
|
|
109
|
-
this.
|
|
109
|
+
this._host.removeEventListener("focusin", this._focusinHandler), this._host.removeEventListener("focusout", this._focusoutHandler);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function S(t) {
|
|
113
113
|
return !!(t.offsetWidth || t.offsetHeight || typeof t.getClientRects == "function" && t.getClientRects().length);
|
|
114
114
|
}
|
|
115
|
-
class
|
|
115
|
+
class D {
|
|
116
116
|
/**
|
|
117
117
|
* Gets whether an element is visible for the purposes of interactivity.
|
|
118
118
|
*
|
|
@@ -122,15 +122,15 @@ class N {
|
|
|
122
122
|
* @returns Whether the element is visible.
|
|
123
123
|
*/
|
|
124
124
|
isVisible(e) {
|
|
125
|
-
return
|
|
125
|
+
return S(e) && getComputedStyle(e).visibility === "visible";
|
|
126
126
|
}
|
|
127
127
|
}
|
|
128
|
-
class
|
|
128
|
+
class I {
|
|
129
129
|
isVisible() {
|
|
130
130
|
return !0;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
const
|
|
133
|
+
const H = typeof getComputedStyle > "u" || getComputedStyle(document.documentElement).visibility === "" ? new I() : new D(), N = [
|
|
134
134
|
"button",
|
|
135
135
|
"[href]",
|
|
136
136
|
"input",
|
|
@@ -141,38 +141,38 @@ const O = 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 o = /* @__PURE__ */ new Set();
|
|
145
|
+
function s(r, c) {
|
|
146
|
+
var i;
|
|
147
|
+
for (const n of r)
|
|
148
|
+
if (!(c && !c(n))) {
|
|
149
|
+
if (n.nodeName === "SLOT") {
|
|
150
|
+
s(
|
|
151
|
+
Array.from(n.assignedElements()),
|
|
152
152
|
c
|
|
153
153
|
);
|
|
154
154
|
continue;
|
|
155
155
|
}
|
|
156
|
-
if (
|
|
156
|
+
if (n.matches(N) && ((e == null ? void 0 : e.includeInvisibleElements) ?? H.isVisible(n)) && o.add(n), e != null && e.findFirstFocusable && o.size > 0)
|
|
157
157
|
break;
|
|
158
|
-
if (
|
|
159
|
-
const
|
|
160
|
-
|
|
158
|
+
if (n.children.length || (i = n.shadowRoot) != null && i.children.length) {
|
|
159
|
+
const u = Array.from(n.children).length ? Array.from(n.children) : Array.from(n.shadowRoot.children);
|
|
160
|
+
s(u, c);
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
}
|
|
164
|
-
return
|
|
164
|
+
return s(t, e == null ? void 0 : e.filter), [...o];
|
|
165
165
|
}
|
|
166
166
|
function G(t, e) {
|
|
167
|
-
const
|
|
167
|
+
const o = g(t, {
|
|
168
168
|
filter: e,
|
|
169
169
|
findFirstFocusable: !0
|
|
170
170
|
});
|
|
171
|
-
return
|
|
171
|
+
return o.length ? o[0] : null;
|
|
172
172
|
}
|
|
173
173
|
class Q {
|
|
174
174
|
constructor() {
|
|
175
|
-
this.
|
|
175
|
+
this._controller = 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, o) {
|
|
184
184
|
e.addEventListener(
|
|
185
185
|
"keydown",
|
|
186
|
-
(
|
|
187
|
-
if (
|
|
186
|
+
(s) => {
|
|
187
|
+
if (s.key !== "Tab")
|
|
188
188
|
return;
|
|
189
189
|
const r = Array.from(
|
|
190
190
|
e.shadowRoot.children || []
|
|
191
|
-
),
|
|
192
|
-
filter:
|
|
191
|
+
), i = g(r, {
|
|
192
|
+
filter: o == null ? void 0 : o.filter
|
|
193
193
|
}).filter(
|
|
194
|
-
(
|
|
194
|
+
(o == null ? void 0 : o.postFilter) ?? (() => !0)
|
|
195
195
|
);
|
|
196
|
-
if (!
|
|
196
|
+
if (!i.length)
|
|
197
197
|
return;
|
|
198
|
-
const
|
|
199
|
-
(
|
|
198
|
+
const n = i[0], u = i[i.length - 1], [h, b] = s.shiftKey ? [n, u] : [u, n];
|
|
199
|
+
(n.getRootNode().activeElement === h || u.getRootNode().activeElement === h) && (b.focus(), s.preventDefault());
|
|
200
200
|
},
|
|
201
|
-
{ signal: this.
|
|
201
|
+
{ signal: this._controller.signal }
|
|
202
202
|
);
|
|
203
203
|
}
|
|
204
204
|
disconnect() {
|
|
205
|
-
this.
|
|
205
|
+
this._controller.abort(), this._controller = new AbortController();
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
export {
|
|
209
|
-
|
|
210
|
-
|
|
209
|
+
N as IS_FOCUSABLE_QUERY,
|
|
210
|
+
D 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
|
+
S as hasGeometry,
|
|
217
|
+
H as interactivityChecker,
|
|
218
|
+
Y as isArrowKeyOrPageKeysPressed,
|
|
219
|
+
R as isArrowKeyPressed,
|
|
220
|
+
E as isFakeMousedownFromScreenReader,
|
|
221
|
+
M as isFakeTouchstartFromScreenReader,
|
|
222
|
+
W as isNextArrowKeyPressed,
|
|
223
|
+
V as isPreviousArrowKeyPressed,
|
|
224
|
+
m 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 v, isServer as g, nothing as o } from "lit";
|
|
2
|
+
import { hostAttributes as f } from "./decorators.js";
|
|
3
|
+
import { getDocumentWritingMode as O, getLocalName as _ } from "./dom.js";
|
|
4
|
+
import { property as l } from "lit/decorators.js";
|
|
5
|
+
import { isEventPrevented as C, EventEmitter as b } from "./eventing.js";
|
|
6
|
+
import { SbbLanguageController as E } from "./controllers.js";
|
|
7
|
+
import { i18nTargetOpensInNewWindow as $ } from "./i18n.js";
|
|
8
8
|
import "../screen-reader-only.js";
|
|
9
|
-
var
|
|
10
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
9
|
+
var D = Object.defineProperty, k = Object.getOwnPropertyDescriptor, A = (e, t, r, i) => {
|
|
10
|
+
for (var s = i > 1 ? void 0 : i ? k(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 && D(t, r, s), s;
|
|
13
13
|
};
|
|
14
14
|
let m = class extends w {
|
|
15
15
|
get maybeDisabled() {
|
|
@@ -33,40 +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 v`
|
|
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 = A([
|
|
44
|
+
f({
|
|
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 P = Object.defineProperty, S = Object.getOwnPropertyDescriptor, u = (e, t, r, i) => {
|
|
50
|
+
for (var s = i > 1 ? void 0 : i ? S(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 && P(t, r, s), s;
|
|
53
53
|
};
|
|
54
|
-
let
|
|
54
|
+
let h = 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._handleButtonClick = async (e) => {
|
|
57
|
+
if (this.type === "button" || await C(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
62
|
else return;
|
|
63
|
-
}, this.
|
|
63
|
+
}, this._preventScrollOnSpaceKeydown = (e) => {
|
|
64
64
|
e.key === " " && (e.preventDefault(), e.target.toggleAttribute("data-active", !0));
|
|
65
|
-
}, this.
|
|
65
|
+
}, this._removeActiveMarker = (e) => {
|
|
66
66
|
e.target.removeAttribute("data-active");
|
|
67
|
-
}, this.
|
|
68
|
-
e.key === " " && (this.
|
|
69
|
-
}, this.
|
|
67
|
+
}, this._dispatchClickEventOnSpaceKeyup = (e) => {
|
|
68
|
+
e.key === " " && (this._removeActiveMarker(e), this._dispatchClickEvent(e));
|
|
69
|
+
}, this._dispatchClickEvent = (e) => {
|
|
70
70
|
const { altKey: t, ctrlKey: r, metaKey: i, shiftKey: s } = e;
|
|
71
71
|
e.target.dispatchEvent(
|
|
72
72
|
new PointerEvent("click", {
|
|
@@ -84,11 +84,11 @@ let d = class extends m {
|
|
|
84
84
|
}, !g) {
|
|
85
85
|
this.setupBaseEventHandlers();
|
|
86
86
|
const e = { passive: !0 };
|
|
87
|
-
this.addEventListener("click", this.
|
|
87
|
+
this.addEventListener("click", this._handleButtonClick), this.addEventListener("keydown", this._preventScrollOnSpaceKeydown), this.addEventListener("keyup", this._dispatchClickEventOnSpaceKeyup, e), this.addEventListener("blur", this._removeActiveMarker, e), this.addEventListener(
|
|
88
88
|
"keypress",
|
|
89
89
|
(t) => {
|
|
90
90
|
(t.key === "Enter" || t.key === `
|
|
91
|
-
`) && this.
|
|
91
|
+
`) && this._dispatchClickEvent(t);
|
|
92
92
|
},
|
|
93
93
|
e
|
|
94
94
|
);
|
|
@@ -110,33 +110,33 @@ let d = class extends m {
|
|
|
110
110
|
(!["name", "value"].includes(e) || t !== r) && super.attributeChangedCallback(e, t, r);
|
|
111
111
|
}
|
|
112
112
|
};
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
],
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
],
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
],
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
],
|
|
125
|
-
|
|
126
|
-
|
|
113
|
+
u([
|
|
114
|
+
l()
|
|
115
|
+
], h.prototype, "type", 2);
|
|
116
|
+
u([
|
|
117
|
+
l()
|
|
118
|
+
], h.prototype, "name", 1);
|
|
119
|
+
u([
|
|
120
|
+
l()
|
|
121
|
+
], h.prototype, "value", 1);
|
|
122
|
+
u([
|
|
123
|
+
l()
|
|
124
|
+
], h.prototype, "form", 2);
|
|
125
|
+
h = u([
|
|
126
|
+
f({
|
|
127
127
|
role: "button",
|
|
128
128
|
tabindex: "0",
|
|
129
129
|
"data-button": ""
|
|
130
130
|
})
|
|
131
|
-
],
|
|
132
|
-
var
|
|
133
|
-
for (var s = i > 1 ? void 0 : i ?
|
|
131
|
+
], h);
|
|
132
|
+
var L = Object.defineProperty, x = Object.getOwnPropertyDescriptor, d = (e, t, r, i) => {
|
|
133
|
+
for (var s = i > 1 ? void 0 : i ? x(t, r) : t, a = e.length - 1, n; a >= 0; a--)
|
|
134
134
|
(n = e[a]) && (s = (i ? n(t, r, s) : n(s)) || s);
|
|
135
|
-
return i && s &&
|
|
135
|
+
return i && s && L(t, r, s), s;
|
|
136
136
|
};
|
|
137
|
-
let
|
|
137
|
+
let c = class extends m {
|
|
138
138
|
constructor() {
|
|
139
|
-
super(), this.language = new
|
|
139
|
+
super(), this.language = new E(this), this._evaluateRelAttribute = () => this.rel ? this.rel : this.target === "_blank" ? "external noopener nofollow" : o, g || this.setupBaseEventHandlers();
|
|
140
140
|
}
|
|
141
141
|
/** @internal */
|
|
142
142
|
focus(e) {
|
|
@@ -155,56 +155,56 @@ let p = class extends m {
|
|
|
155
155
|
}
|
|
156
156
|
/** Default render method for link-like components. Can be overridden if the LinkRenderVariables are not needed. */
|
|
157
157
|
render() {
|
|
158
|
-
return
|
|
158
|
+
return v`
|
|
159
159
|
<a
|
|
160
|
-
class="sbb-action-base ${this.localName ??
|
|
161
|
-
href=${this.href ||
|
|
160
|
+
class="sbb-action-base ${this.localName ?? _(this)}"
|
|
161
|
+
href=${this.href || o}
|
|
162
162
|
?download=${this.download}
|
|
163
|
-
target=${this.target ||
|
|
164
|
-
rel=${this.
|
|
165
|
-
aria-label=${this.accessibilityLabel ||
|
|
166
|
-
tabindex=${this.maybeDisabled ? "-1" :
|
|
167
|
-
aria-disabled=${this.maybeDisabled ? "true" :
|
|
163
|
+
target=${this.target || o}
|
|
164
|
+
rel=${this._evaluateRelAttribute()}
|
|
165
|
+
aria-label=${this.accessibilityLabel || o}
|
|
166
|
+
tabindex=${this.maybeDisabled ? "-1" : o}
|
|
167
|
+
aria-disabled=${this.maybeDisabled ? "true" : o}
|
|
168
168
|
>
|
|
169
169
|
${this.renderTemplate()}
|
|
170
|
-
${this.href && this.target === "_blank" ?
|
|
171
|
-
>. ${
|
|
172
|
-
>` :
|
|
170
|
+
${this.href && this.target === "_blank" ? v`<sbb-screen-reader-only
|
|
171
|
+
>. ${$[this.language.current]}</sbb-screen-reader-only
|
|
172
|
+
>` : o}
|
|
173
173
|
</a>
|
|
174
174
|
`;
|
|
175
175
|
}
|
|
176
176
|
};
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
],
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
],
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
],
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
],
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
],
|
|
192
|
-
|
|
193
|
-
|
|
177
|
+
d([
|
|
178
|
+
l()
|
|
179
|
+
], c.prototype, "href", 2);
|
|
180
|
+
d([
|
|
181
|
+
l()
|
|
182
|
+
], c.prototype, "target", 2);
|
|
183
|
+
d([
|
|
184
|
+
l()
|
|
185
|
+
], c.prototype, "rel", 2);
|
|
186
|
+
d([
|
|
187
|
+
l({ type: Boolean })
|
|
188
|
+
], c.prototype, "download", 2);
|
|
189
|
+
d([
|
|
190
|
+
l({ attribute: "accessibility-label" })
|
|
191
|
+
], c.prototype, "accessibilityLabel", 2);
|
|
192
|
+
c = d([
|
|
193
|
+
f({
|
|
194
194
|
"data-link": ""
|
|
195
195
|
})
|
|
196
|
-
],
|
|
197
|
-
const
|
|
196
|
+
], c);
|
|
197
|
+
const p = class p extends w {
|
|
198
198
|
constructor() {
|
|
199
199
|
super(...arguments), this.willOpen = new b(
|
|
200
200
|
this,
|
|
201
|
-
|
|
202
|
-
), this.didOpen = new b(this,
|
|
201
|
+
p.events.willOpen
|
|
202
|
+
), this.didOpen = new b(this, p.events.didOpen), this.willClose = new b(
|
|
203
203
|
this,
|
|
204
|
-
|
|
204
|
+
p.events.willClose
|
|
205
205
|
), this.didClose = new b(
|
|
206
206
|
this,
|
|
207
|
-
|
|
207
|
+
p.events.didClose
|
|
208
208
|
);
|
|
209
209
|
}
|
|
210
210
|
/** The state of the component. */
|
|
@@ -218,16 +218,16 @@ const h = class h extends w {
|
|
|
218
218
|
super.connectedCallback(), this.state || (this.state = "closed");
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
|
-
|
|
221
|
+
p.events = {
|
|
222
222
|
willOpen: "willOpen",
|
|
223
223
|
didOpen: "didOpen",
|
|
224
224
|
willClose: "willClose",
|
|
225
225
|
didClose: "didClose"
|
|
226
226
|
};
|
|
227
|
-
let
|
|
227
|
+
let y = p;
|
|
228
228
|
export {
|
|
229
229
|
m as SbbActionBaseElement,
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
230
|
+
h as SbbButtonBaseElement,
|
|
231
|
+
c as SbbLinkBaseElement,
|
|
232
|
+
y as SbbOpenCloseBaseElement
|
|
233
233
|
};
|