@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
|
@@ -1,124 +1,124 @@
|
|
|
1
1
|
import { css as u, LitElement as c, html as p } from "lit";
|
|
2
|
-
import { property as
|
|
3
|
-
import { isArrowKeyPressed as
|
|
4
|
-
import { SbbConnectedAbortController as
|
|
5
|
-
import { hostAttributes as
|
|
2
|
+
import { property as l, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import { isArrowKeyPressed as g, getNextElementIndex as f } from "../core/a11y.js";
|
|
4
|
+
import { SbbConnectedAbortController as _, SbbSlotStateController as v } from "../core/controllers.js";
|
|
5
|
+
import { hostAttributes as w } from "../core/decorators.js";
|
|
6
6
|
import { EventEmitter as b } from "../core/eventing.js";
|
|
7
|
-
import { SbbDisabledMixin as
|
|
8
|
-
const
|
|
9
|
-
var
|
|
10
|
-
for (var
|
|
11
|
-
(
|
|
12
|
-
return i &&
|
|
7
|
+
import { SbbDisabledMixin as x } from "../core/mixins.js";
|
|
8
|
+
const y = u`*,:before,:after{box-sizing:border-box}:host{--sbb-radio-button-group-orientation: row;--sbb-radio-button-group-width: max-content;--sbb-radio-button-group-gap: var(--sbb-spacing-fixed-3x) var(--sbb-spacing-fixed-6x);display:block}:host([orientation=vertical]){--sbb-radio-button-group-orientation: column;--sbb-radio-button-group-width: 100%}:host([data-has-selection-panel]){--sbb-radio-button-group-width: 100%}:host([data-has-selection-panel][orientation=vertical]){--sbb-radio-button-group-gap: var(--sbb-spacing-fixed-2x) var(--sbb-spacing-fixed-4x)}@media (min-width: 0rem){:host([orientation=vertical][horizontal-from=zero]){--sbb-radio-button-group-orientation: row}:host([orientation=vertical][horizontal-from=zero]:not([data-has-selection-panel])){--sbb-radio-button-group-width: max-content}}@media (min-width: 22.5rem){:host([orientation=vertical][horizontal-from=micro]){--sbb-radio-button-group-orientation: row}:host([orientation=vertical][horizontal-from=micro]:not([data-has-selection-panel])){--sbb-radio-button-group-width: max-content}}@media (min-width: 37.5rem){:host([orientation=vertical][horizontal-from=small]){--sbb-radio-button-group-orientation: row}:host([orientation=vertical][horizontal-from=small]:not([data-has-selection-panel])){--sbb-radio-button-group-width: max-content}}@media (min-width: 52.5rem){:host([orientation=vertical][horizontal-from=medium]){--sbb-radio-button-group-orientation: row}:host([orientation=vertical][horizontal-from=medium]:not([data-has-selection-panel])){--sbb-radio-button-group-width: max-content}}@media (min-width: 64rem){:host([orientation=vertical][horizontal-from=large]){--sbb-radio-button-group-orientation: row}:host([orientation=vertical][horizontal-from=large]:not([data-has-selection-panel])){--sbb-radio-button-group-width: max-content}}@media (min-width: 80rem){:host([orientation=vertical][horizontal-from=wide]){--sbb-radio-button-group-orientation: row}:host([orientation=vertical][horizontal-from=wide]:not([data-has-selection-panel])){--sbb-radio-button-group-width: max-content}}@media (min-width: 90rem){:host([orientation=vertical][horizontal-from=ultra]){--sbb-radio-button-group-orientation: row}:host([orientation=vertical][horizontal-from=ultra]:not([data-has-selection-panel])){--sbb-radio-button-group-width: max-content}}.sbb-radio-group{display:flex;flex-direction:var(--sbb-radio-button-group-orientation);gap:var(--sbb-radio-button-group-gap);align-items:flex-start;width:var(--sbb-radio-button-group-width)}.sbb-radio-group__error{display:inline-block;margin-block-start:var(--sbb-spacing-fixed-1x)}:host(:not([data-slot-names~=error])) .sbb-radio-group__error{display:none}`;
|
|
9
|
+
var C = Object.defineProperty, S = Object.getOwnPropertyDescriptor, r = (t, e, o, i) => {
|
|
10
|
+
for (var n = i > 1 ? void 0 : i ? S(e, o) : e, s = t.length - 1, d; s >= 0; s--)
|
|
11
|
+
(d = t[s]) && (n = (i ? d(e, o, n) : d(n)) || n);
|
|
12
|
+
return i && n && C(e, o, n), n;
|
|
13
13
|
};
|
|
14
|
-
let
|
|
14
|
+
let a = class extends x(c) {
|
|
15
15
|
constructor() {
|
|
16
|
-
super(), this.allowEmptySelection = !1, this.required = !1, this.size = "m", this.orientation = "horizontal", this.
|
|
16
|
+
super(), this.allowEmptySelection = !1, this.required = !1, this.size = "m", this.orientation = "horizontal", this._hasSelectionPanel = !1, this._didLoad = !1, this._abort = new _(this), this._didChange = new b(
|
|
17
17
|
this,
|
|
18
|
-
|
|
19
|
-
), this.
|
|
18
|
+
a.events.didChange
|
|
19
|
+
), this._change = new b(
|
|
20
20
|
this,
|
|
21
|
-
|
|
22
|
-
), this.
|
|
21
|
+
a.events.change
|
|
22
|
+
), this._input = new b(
|
|
23
23
|
this,
|
|
24
|
-
|
|
25
|
-
), new
|
|
24
|
+
a.events.input
|
|
25
|
+
), new v(this);
|
|
26
26
|
}
|
|
27
27
|
/**
|
|
28
28
|
* List of contained radio buttons.
|
|
29
29
|
*/
|
|
30
30
|
get radioButtons() {
|
|
31
31
|
var t;
|
|
32
|
-
return Array.from(((t = this.querySelectorAll) == null ? void 0 : t.call(this, "sbb-radio-button")) ?? []).filter((
|
|
33
|
-
var
|
|
34
|
-
return ((
|
|
32
|
+
return Array.from(((t = this.querySelectorAll) == null ? void 0 : t.call(this, "sbb-radio-button")) ?? []).filter((e) => {
|
|
33
|
+
var o;
|
|
34
|
+
return ((o = e.closest) == null ? void 0 : o.call(e, "sbb-radio-button-group")) === this;
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
get
|
|
37
|
+
get _enabledRadios() {
|
|
38
38
|
if (!this.disabled)
|
|
39
39
|
return this.radioButtons.filter((t) => !t.disabled);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
for (const
|
|
43
|
-
|
|
44
|
-
this.
|
|
41
|
+
_valueChanged(t) {
|
|
42
|
+
for (const e of this.radioButtons)
|
|
43
|
+
e.checked = e.value === t, e.tabIndex = this._getRadioTabIndex(e);
|
|
44
|
+
this._setFocusableRadio();
|
|
45
45
|
}
|
|
46
46
|
connectedCallback() {
|
|
47
|
-
var
|
|
47
|
+
var e;
|
|
48
48
|
super.connectedCallback();
|
|
49
|
-
const t = this.
|
|
49
|
+
const t = this._abort.signal;
|
|
50
50
|
this.addEventListener(
|
|
51
51
|
"stateChange",
|
|
52
|
-
(
|
|
52
|
+
(o) => this._onRadioButtonSelect(o),
|
|
53
53
|
{
|
|
54
54
|
signal: t,
|
|
55
55
|
passive: !0
|
|
56
56
|
}
|
|
57
|
-
), this.addEventListener("keydown", (
|
|
57
|
+
), this.addEventListener("keydown", (o) => this._handleKeyDown(o), { signal: t }), this._hasSelectionPanel = !!((e = this.querySelector) != null && e.call(this, "sbb-selection-panel")), this.toggleAttribute("data-has-selection-panel", this._hasSelectionPanel), this._updateRadios(this.value);
|
|
58
58
|
}
|
|
59
59
|
willUpdate(t) {
|
|
60
|
-
var
|
|
61
|
-
if (super.willUpdate(t), t.has("value") && this.
|
|
62
|
-
for (const
|
|
63
|
-
|
|
64
|
-
this.
|
|
60
|
+
var e;
|
|
61
|
+
if (super.willUpdate(t), t.has("value") && this._valueChanged(this.value), t.has("disabled")) {
|
|
62
|
+
for (const o of this.radioButtons)
|
|
63
|
+
o.tabIndex = this._getRadioTabIndex(o), (e = o.requestUpdate) == null || e.call(o, "disabled");
|
|
64
|
+
this._setFocusableRadio();
|
|
65
65
|
}
|
|
66
|
-
t.has("required") && this.radioButtons.forEach((
|
|
66
|
+
t.has("required") && this.radioButtons.forEach((o) => {
|
|
67
67
|
var i;
|
|
68
|
-
return (i =
|
|
69
|
-
}), t.has("size") && this.radioButtons.forEach((
|
|
68
|
+
return (i = o.requestUpdate) == null ? void 0 : i.call(o, "required");
|
|
69
|
+
}), t.has("size") && this.radioButtons.forEach((o) => {
|
|
70
70
|
var i;
|
|
71
|
-
return (i =
|
|
71
|
+
return (i = o.requestUpdate) == null ? void 0 : i.call(o, "size");
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
firstUpdated(t) {
|
|
75
|
-
super.firstUpdated(t), this.
|
|
75
|
+
super.firstUpdated(t), this._didLoad = !0, this._updateRadios(this.value);
|
|
76
76
|
}
|
|
77
77
|
disconnectedCallback() {
|
|
78
78
|
super.disconnectedCallback();
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
var
|
|
82
|
-
if (t.stopPropagation(), t.detail.type !== "checked" || !this.
|
|
80
|
+
_onRadioButtonSelect(t) {
|
|
81
|
+
var o;
|
|
82
|
+
if (t.stopPropagation(), t.detail.type !== "checked" || !this._didLoad)
|
|
83
83
|
return;
|
|
84
|
-
const
|
|
85
|
-
t.detail.checked ? (this.value =
|
|
84
|
+
const e = t.target;
|
|
85
|
+
t.detail.checked ? (this.value = e.value, this._emitChange(e, this.value)) : this.allowEmptySelection && (this.value = (o = this.radioButtons.find((i) => i.checked)) == null ? void 0 : o.value, this.value || this._emitChange(e));
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
this.
|
|
87
|
+
_emitChange(t, e) {
|
|
88
|
+
this._change.emit({ value: e, radioButton: t }), this._input.emit({ value: e, radioButton: t }), this._didChange.emit({ value: e, radioButton: t });
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
var
|
|
92
|
-
if (!this.
|
|
90
|
+
_updateRadios(t) {
|
|
91
|
+
var o;
|
|
92
|
+
if (!this._didLoad)
|
|
93
93
|
return;
|
|
94
|
-
const
|
|
95
|
-
this.value = t ?? ((
|
|
96
|
-
for (const i of
|
|
97
|
-
i.checked = i.value === this.value, i.tabIndex = this.
|
|
98
|
-
this.
|
|
94
|
+
const e = this.radioButtons;
|
|
95
|
+
this.value = t ?? ((o = e.find((i) => i.checked)) == null ? void 0 : o.value) ?? this.value;
|
|
96
|
+
for (const i of e)
|
|
97
|
+
i.checked = i.value === this.value, i.tabIndex = this._getRadioTabIndex(i);
|
|
98
|
+
this._setFocusableRadio();
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
const t = this.radioButtons.find((
|
|
102
|
-
!t && (
|
|
100
|
+
_setFocusableRadio() {
|
|
101
|
+
const t = this.radioButtons.find((o) => o.checked && !o.disabled), e = this._enabledRadios;
|
|
102
|
+
!t && (e != null && e.length) && (e[0].tabIndex = 0);
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
_getRadioTabIndex(t) {
|
|
105
105
|
var i;
|
|
106
|
-
const
|
|
107
|
-
return
|
|
106
|
+
const e = t.checked && !t.disabled && !this.disabled, o = ((i = t.parentElement) == null ? void 0 : i.nodeName) === "SBB-SELECTION-PANEL" && t.parentElement.hasContent;
|
|
107
|
+
return e || this._hasSelectionPanel && o ? 0 : -1;
|
|
108
108
|
}
|
|
109
|
-
|
|
110
|
-
var s,
|
|
111
|
-
const
|
|
112
|
-
if (!
|
|
113
|
-
t.target !== this && t.target.parentElement !== this && ((s = t.target.parentElement) == null ? void 0 : s.nodeName) !== "SBB-SELECTION-PANEL" || !
|
|
109
|
+
_handleKeyDown(t) {
|
|
110
|
+
var s, d;
|
|
111
|
+
const e = this._enabledRadios;
|
|
112
|
+
if (!e || !e.length || // don't trap nested handling
|
|
113
|
+
t.target !== this && t.target.parentElement !== this && ((s = t.target.parentElement) == null ? void 0 : s.nodeName) !== "SBB-SELECTION-PANEL" || !g(t))
|
|
114
114
|
return;
|
|
115
|
-
const
|
|
116
|
-
(!this.
|
|
115
|
+
const o = e.findIndex((h) => h === t.target), i = f(t, o, e.length), n = (Array.from((d = this.querySelectorAll) == null ? void 0 : d.call(this, "sbb-selection-panel")) || []).every((h) => !h.hasContent);
|
|
116
|
+
(!this._hasSelectionPanel || this._hasSelectionPanel && n) && e[i].select(), e[i].focus(), t.preventDefault();
|
|
117
117
|
}
|
|
118
118
|
render() {
|
|
119
119
|
return p`
|
|
120
120
|
<div class="sbb-radio-group">
|
|
121
|
-
<slot @slotchange=${() => this.
|
|
121
|
+
<slot @slotchange=${() => this._updateRadios()}></slot>
|
|
122
122
|
</div>
|
|
123
123
|
<div class="sbb-radio-group__error">
|
|
124
124
|
<slot name="error"></slot>
|
|
@@ -126,36 +126,36 @@ let r = class extends y(c) {
|
|
|
126
126
|
`;
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
a.styles = y;
|
|
130
|
+
a.events = {
|
|
131
131
|
didChange: "didChange",
|
|
132
132
|
change: "change",
|
|
133
133
|
input: "input"
|
|
134
134
|
};
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
],
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
],
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
],
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
],
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
],
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
],
|
|
153
|
-
|
|
135
|
+
r([
|
|
136
|
+
l({ attribute: "allow-empty-selection", type: Boolean })
|
|
137
|
+
], a.prototype, "allowEmptySelection", 2);
|
|
138
|
+
r([
|
|
139
|
+
l({ type: Boolean })
|
|
140
|
+
], a.prototype, "required", 2);
|
|
141
|
+
r([
|
|
142
|
+
l()
|
|
143
|
+
], a.prototype, "value", 2);
|
|
144
|
+
r([
|
|
145
|
+
l()
|
|
146
|
+
], a.prototype, "size", 2);
|
|
147
|
+
r([
|
|
148
|
+
l({ attribute: "horizontal-from", reflect: !0 })
|
|
149
|
+
], a.prototype, "horizontalFrom", 2);
|
|
150
|
+
r([
|
|
151
|
+
l({ reflect: !0 })
|
|
152
|
+
], a.prototype, "orientation", 2);
|
|
153
|
+
a = r([
|
|
154
154
|
m("sbb-radio-button-group"),
|
|
155
|
-
|
|
155
|
+
w({
|
|
156
156
|
role: "radiogroup"
|
|
157
157
|
})
|
|
158
|
-
],
|
|
158
|
+
], a);
|
|
159
159
|
export {
|
|
160
|
-
|
|
160
|
+
a as SbbRadioButtonGroupElement
|
|
161
161
|
};
|
|
@@ -1,111 +1,111 @@
|
|
|
1
|
-
import { css as p, LitElement as f, html as
|
|
1
|
+
import { css as p, LitElement as f, html as n, nothing as b } from "lit";
|
|
2
2
|
import { property as r, state as h, customElement as v } from "lit/decorators.js";
|
|
3
|
-
import { SbbConnectedAbortController as m, SbbLanguageController as g, SbbSlotStateController as
|
|
4
|
-
import { hostAttributes as
|
|
5
|
-
import { setOrRemoveAttribute as
|
|
6
|
-
import { EventEmitter as u, HandlerRepository as
|
|
7
|
-
import { i18nExpanded as
|
|
8
|
-
import { SbbUpdateSchedulerMixin as
|
|
9
|
-
const
|
|
10
|
-
var
|
|
11
|
-
for (var
|
|
12
|
-
(c =
|
|
13
|
-
return
|
|
3
|
+
import { SbbConnectedAbortController as m, SbbLanguageController as g, SbbSlotStateController as _ } from "../core/controllers.js";
|
|
4
|
+
import { hostAttributes as y } from "../core/decorators.js";
|
|
5
|
+
import { setOrRemoveAttribute as x } from "../core/dom.js";
|
|
6
|
+
import { EventEmitter as u, HandlerRepository as k, formElementHandlerAspect as w } from "../core/eventing.js";
|
|
7
|
+
import { i18nExpanded as E, i18nCollapsed as S } from "../core/i18n.js";
|
|
8
|
+
import { SbbUpdateSchedulerMixin as z } from "../core/mixins.js";
|
|
9
|
+
const C = p`*,:before,:after{box-sizing:border-box}:host{--sbb-radio-button-label-color: var(--sbb-color-charcoal);--sbb-radio-button-background-color: var(--sbb-color-white);--sbb-radio-button-inner-circle-color: var(--sbb-color-white);--sbb-radio-button-border-width: var(--sbb-border-width-1x);--sbb-radio-button-border-style: solid;--sbb-radio-button-border-color: var(--sbb-color-smoke);--sbb-radio-button-dimension: var(--sbb-size-icon-ui-small);--sbb-radio-button-inner-circle-dimension: .625rem;--sbb-radio-button-suffix-color: var(--sbb-color-charcoal);--sbb-radio-button-subtext-color: var(--sbb-color-granite);--sbb-radio-button-cursor: pointer;--sbb-radio-button-background-fake-border-width: calc(var(--sbb-radio-button-dimension) / 2);--sbb-radio-button-icon-align: calc( (1em * var(--sbb-typo-line-height-body-text) - var(--sbb-radio-button-dimension)) / 2 );display:block;outline:none!important}@media (forced-colors: active){:host{--sbb-radio-button-background-color: Canvas !important;--sbb-radio-button-border-width: var(--sbb-border-width-2x);--sbb-radio-button-border-color: ButtonBorder}}:host(:focus-visible[data-is-selection-panel-input]){outline:none!important}:host(:focus-visible[data-is-selection-panel-input]) .sbb-radio-button:after{content:"";position:absolute;display:block;inset-block:calc(var(--sbb-spacing-responsive-xs) * -1 + var(--sbb-focus-outline-width) - var(--sbb-focus-outline-offset) * 2);inset-inline:calc(var(--sbb-spacing-responsive-xxs) * -1 + var(--sbb-focus-outline-width) - var(--sbb-focus-outline-offset) * 2);border:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width);border-radius:calc(var(--sbb-border-radius-4x) + var(--sbb-focus-outline-offset))}:host([checked]){--sbb-radio-button-inner-circle-color: var(--sbb-color-red);--sbb-radio-button-background-fake-border-width: calc( (var(--sbb-radio-button-dimension) - var(--sbb-radio-button-inner-circle-dimension)) / 2 )}@media (forced-colors: active){:host([checked]){--sbb-radio-button-inner-circle-color: Highlight;--sbb-radio-button-border-color: Highlight}}:host([disabled]){--sbb-radio-button-label-color: var(--sbb-color-granite);--sbb-radio-button-background-color: var(--sbb-color-milk);--sbb-radio-button-border-style: dashed;--sbb-radio-button-inner-circle-color: var(--sbb-color-charcoal);--sbb-radio-button-cursor: default}@media (forced-colors: active){:host([disabled]){--sbb-radio-button-inner-circle-color: GrayText;--sbb-radio-button-border-color: GrayText;--sbb-radio-button-border-style: solid}}.sbb-radio-button{--sbb-text-font-size: var(--sbb-font-size-text-m);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);display:block;cursor:var(--sbb-radio-button-cursor);-webkit-user-select:none;user-select:none;position:relative;color:var(--sbb-radio-button-label-color);-webkit-tap-highlight-color:transparent}:host([size=s]) .sbb-radio-button{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size)}:host(:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch],[data-is-selection-panel-input])) .sbb-radio-button{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width);border-radius:calc(var(--sbb-border-radius-4x) - var(--sbb-focus-outline-offset))}slot[name=suffix]{color:var(--sbb-radio-button-suffix-color)}slot[name=subtext]{display:block;color:var(--sbb-radio-button-subtext-color);padding-inline-start:var(--sbb-spacing-fixed-8x)}:host(:not([data-slot-names~=subtext])) slot[name=subtext]{display:none}.sbb-radio-button__label-slot{display:flex;align-items:flex-start;overflow:hidden}.sbb-radio-button__label-slot:before,.sbb-radio-button__label-slot:after{content:"";flex-shrink:0;width:var(--sbb-radio-button-dimension);height:var(--sbb-radio-button-dimension);border-radius:50%;margin-block-start:var(--sbb-radio-button-icon-align);transition-duration:var(--sbb-disable-animation-zero-time, var(--sbb-animation-duration-4x));transition-timing-function:ease;transition-property:background-color,border}@media (forced-colors: active){.sbb-radio-button__label-slot:before,.sbb-radio-button__label-slot:after{transition:none}}.sbb-radio-button__label-slot:before{background:var(--sbb-radio-button-inner-circle-color);border:var(--sbb-radio-button-background-fake-border-width) solid var(--sbb-radio-button-background-color);margin-inline-end:var(--sbb-spacing-fixed-2x)}.sbb-radio-button__label-slot:after{position:absolute;border:var(--sbb-radio-button-border-width) var(--sbb-radio-button-border-style) var(--sbb-radio-button-border-color)}.sbb-screen-reader-only{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}`;
|
|
10
|
+
var P = Object.defineProperty, L = Object.getOwnPropertyDescriptor, i = (e, o, l, a) => {
|
|
11
|
+
for (var s = a > 1 ? void 0 : a ? L(o, l) : o, d = e.length - 1, c; d >= 0; d--)
|
|
12
|
+
(c = e[d]) && (s = (a ? c(o, l, s) : c(s)) || s);
|
|
13
|
+
return a && s && P(o, l, s), s;
|
|
14
14
|
};
|
|
15
|
-
let
|
|
15
|
+
let t = class extends z(f) {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(), this.
|
|
17
|
+
super(), this._allowEmptySelection = !1, this._disabled = !1, this._required = !1, this._group = null, this._checked = !1, this._size = "m", this._isSelectionPanelInput = !1, this._selectionPanelElement = null, this._abort = new m(this), this._language = new g(this), this._stateChange = new u(
|
|
18
18
|
this,
|
|
19
|
-
|
|
19
|
+
t.events.stateChange,
|
|
20
20
|
{ bubbles: !0 }
|
|
21
|
-
), this.
|
|
21
|
+
), this._radioButtonLoaded = new u(
|
|
22
22
|
this,
|
|
23
|
-
|
|
23
|
+
t.events.radioButtonLoaded,
|
|
24
24
|
{ bubbles: !0 }
|
|
25
|
-
), this.
|
|
25
|
+
), this._handlerRepository = new k(this, w), new _(this);
|
|
26
26
|
}
|
|
27
|
-
set allowEmptySelection(
|
|
28
|
-
this.
|
|
27
|
+
set allowEmptySelection(e) {
|
|
28
|
+
this._allowEmptySelection = !!e;
|
|
29
29
|
}
|
|
30
30
|
get allowEmptySelection() {
|
|
31
|
-
var
|
|
32
|
-
return this.
|
|
31
|
+
var e;
|
|
32
|
+
return this._allowEmptySelection || (((e = this.group) == null ? void 0 : e.allowEmptySelection) ?? !1);
|
|
33
33
|
}
|
|
34
|
-
set disabled(
|
|
35
|
-
this.
|
|
34
|
+
set disabled(e) {
|
|
35
|
+
this._disabled = !!e;
|
|
36
36
|
}
|
|
37
37
|
get disabled() {
|
|
38
|
-
var
|
|
39
|
-
return this.
|
|
38
|
+
var e;
|
|
39
|
+
return this._disabled || (((e = this.group) == null ? void 0 : e.disabled) ?? !1);
|
|
40
40
|
}
|
|
41
|
-
set required(
|
|
42
|
-
this.
|
|
41
|
+
set required(e) {
|
|
42
|
+
this._required = !!e;
|
|
43
43
|
}
|
|
44
44
|
get required() {
|
|
45
|
-
var
|
|
46
|
-
return this.
|
|
45
|
+
var e;
|
|
46
|
+
return this._required || (((e = this.group) == null ? void 0 : e.required) ?? !1);
|
|
47
47
|
}
|
|
48
48
|
/**
|
|
49
49
|
* Reference to the connected radio button group.
|
|
50
50
|
*/
|
|
51
51
|
get group() {
|
|
52
|
-
return this.
|
|
52
|
+
return this._group;
|
|
53
53
|
}
|
|
54
|
-
set checked(
|
|
55
|
-
this.
|
|
54
|
+
set checked(e) {
|
|
55
|
+
this._checked = !!e;
|
|
56
56
|
}
|
|
57
57
|
get checked() {
|
|
58
|
-
return this.
|
|
58
|
+
return this._checked;
|
|
59
59
|
}
|
|
60
|
-
set size(
|
|
61
|
-
this.
|
|
60
|
+
set size(e) {
|
|
61
|
+
this._size = e;
|
|
62
62
|
}
|
|
63
63
|
get size() {
|
|
64
|
-
var
|
|
65
|
-
return ((
|
|
64
|
+
var e;
|
|
65
|
+
return ((e = this.group) == null ? void 0 : e.size) ?? this._size;
|
|
66
66
|
}
|
|
67
67
|
/**
|
|
68
68
|
* Whether the input is the main input of a selection panel.
|
|
69
69
|
* @internal
|
|
70
70
|
*/
|
|
71
71
|
get isSelectionPanelInput() {
|
|
72
|
-
return this.
|
|
72
|
+
return this._isSelectionPanelInput;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
_handleClick(e) {
|
|
75
|
+
e.preventDefault(), this.select();
|
|
76
76
|
}
|
|
77
77
|
select() {
|
|
78
78
|
this.disabled || (this.allowEmptySelection ? this.checked = !this.checked : this.checked || (this.checked = !0));
|
|
79
79
|
}
|
|
80
80
|
connectedCallback() {
|
|
81
|
-
super.connectedCallback(), this.
|
|
82
|
-
const
|
|
83
|
-
this.addEventListener("click", (o) => this.
|
|
81
|
+
super.connectedCallback(), this._group = this.closest("sbb-radio-button-group"), this._selectionPanelElement = this.closest("sbb-selection-panel"), this._isSelectionPanelInput = !!this._selectionPanelElement && !this.closest('sbb-selection-panel [slot="content"]'), this.toggleAttribute("data-is-selection-panel-input", this._isSelectionPanelInput);
|
|
82
|
+
const e = this._abort.signal;
|
|
83
|
+
this.addEventListener("click", (o) => this._handleClick(o), { signal: e }), this.addEventListener("keydown", (o) => this._handleKeyDown(o), { signal: e }), this._handlerRepository.connect(), this._radioButtonLoaded.emit(), ["disabled", "required", "size"].forEach((o) => this.requestUpdate(o));
|
|
84
84
|
}
|
|
85
|
-
willUpdate(
|
|
86
|
-
super.willUpdate(
|
|
85
|
+
willUpdate(e) {
|
|
86
|
+
super.willUpdate(e), e.has("checked") && (this.setAttribute("aria-checked", `${this.checked}`), this.checked !== e.get("checked") && (this._stateChange.emit({ type: "checked", checked: this.checked }), this.isSelectionPanelInput && this._updateExpandedLabel())), e.has("disabled") && (x(this, "aria-disabled", this.disabled ? "true" : null), this.disabled !== e.get("disabled") && this._stateChange.emit({ type: "disabled", disabled: this.disabled })), e.has("required") && this.setAttribute("aria-required", `${this.required}`);
|
|
87
87
|
}
|
|
88
|
-
firstUpdated(
|
|
89
|
-
super.firstUpdated(
|
|
90
|
-
this.isSelectionPanelInput && this.
|
|
88
|
+
firstUpdated(e) {
|
|
89
|
+
super.firstUpdated(e), this.startUpdate(), setTimeout(() => {
|
|
90
|
+
this.isSelectionPanelInput && this._updateExpandedLabel(), this.completeUpdate();
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
disconnectedCallback() {
|
|
94
|
-
super.disconnectedCallback(), this.
|
|
94
|
+
super.disconnectedCallback(), this._handlerRepository.disconnect();
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
_handleKeyDown(e) {
|
|
97
|
+
e.code === "Space" && this.select();
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
var
|
|
101
|
-
if (!((
|
|
102
|
-
this.
|
|
99
|
+
_updateExpandedLabel() {
|
|
100
|
+
var e;
|
|
101
|
+
if (!((e = this._selectionPanelElement) != null && e.hasContent)) {
|
|
102
|
+
this._selectionPanelExpandedLabel = "";
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
|
-
this.
|
|
105
|
+
this._selectionPanelExpandedLabel = this.checked ? ", " + E[this._language.current] : ", " + S[this._language.current];
|
|
106
106
|
}
|
|
107
107
|
render() {
|
|
108
|
-
return
|
|
108
|
+
return n`
|
|
109
109
|
<label class="sbb-radio-button">
|
|
110
110
|
<input
|
|
111
111
|
type="radio"
|
|
@@ -114,54 +114,54 @@ let e = class extends C(f) {
|
|
|
114
114
|
?disabled=${this.disabled}
|
|
115
115
|
?required=${this.required}
|
|
116
116
|
?checked=${this.checked}
|
|
117
|
-
value=${this.value ||
|
|
117
|
+
value=${this.value || b}
|
|
118
118
|
class="sbb-screen-reader-only"
|
|
119
119
|
/>
|
|
120
120
|
<span class="sbb-radio-button__label-slot">
|
|
121
121
|
<slot></slot>
|
|
122
|
-
${this.
|
|
122
|
+
${this._selectionPanelElement ? n`<slot name="suffix"></slot>` : b}
|
|
123
123
|
</span>
|
|
124
|
-
${this.
|
|
125
|
-
${this.isSelectionPanelInput && this.
|
|
124
|
+
${this._selectionPanelElement ? n`<slot name="subtext"></slot>` : b}
|
|
125
|
+
${this.isSelectionPanelInput && this._selectionPanelExpandedLabel ? n`<span class="sbb-screen-reader-only"> ${this._selectionPanelExpandedLabel} </span>` : b}
|
|
126
126
|
</label>
|
|
127
127
|
`;
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
t.styles = C;
|
|
131
|
+
t.events = {
|
|
132
132
|
stateChange: "stateChange",
|
|
133
133
|
radioButtonLoaded: "radioButtonLoaded"
|
|
134
134
|
};
|
|
135
|
-
|
|
135
|
+
i([
|
|
136
136
|
r({ attribute: "allow-empty-selection", type: Boolean })
|
|
137
|
-
],
|
|
138
|
-
|
|
137
|
+
], t.prototype, "allowEmptySelection", 1);
|
|
138
|
+
i([
|
|
139
139
|
r()
|
|
140
|
-
],
|
|
141
|
-
|
|
140
|
+
], t.prototype, "value", 2);
|
|
141
|
+
i([
|
|
142
142
|
r({ reflect: !0, type: Boolean })
|
|
143
|
-
],
|
|
144
|
-
|
|
143
|
+
], t.prototype, "disabled", 1);
|
|
144
|
+
i([
|
|
145
145
|
r({ reflect: !0, type: Boolean })
|
|
146
|
-
],
|
|
147
|
-
|
|
146
|
+
], t.prototype, "required", 1);
|
|
147
|
+
i([
|
|
148
148
|
r({ reflect: !0, type: Boolean })
|
|
149
|
-
],
|
|
150
|
-
|
|
149
|
+
], t.prototype, "checked", 1);
|
|
150
|
+
i([
|
|
151
151
|
r({ reflect: !0 })
|
|
152
|
-
],
|
|
153
|
-
|
|
152
|
+
], t.prototype, "size", 1);
|
|
153
|
+
i([
|
|
154
154
|
h()
|
|
155
|
-
],
|
|
156
|
-
|
|
155
|
+
], t.prototype, "_isSelectionPanelInput", 2);
|
|
156
|
+
i([
|
|
157
157
|
h()
|
|
158
|
-
],
|
|
159
|
-
|
|
158
|
+
], t.prototype, "_selectionPanelExpandedLabel", 2);
|
|
159
|
+
t = i([
|
|
160
160
|
v("sbb-radio-button"),
|
|
161
|
-
|
|
161
|
+
y({
|
|
162
162
|
role: "radio"
|
|
163
163
|
})
|
|
164
|
-
],
|
|
164
|
+
], t);
|
|
165
165
|
export {
|
|
166
|
-
|
|
166
|
+
t as SbbRadioButtonElement
|
|
167
167
|
};
|