@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
|
@@ -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 d, customElement as m } from "lit/decorators.js";
|
|
3
|
+
import { isArrowKeyPressed as f, getNextElementIndex as g } from "../core/a11y.js";
|
|
4
|
+
import { SbbConnectedAbortController as v, SbbSlotStateController as w } from "../core/controllers.js";
|
|
5
|
+
import { hostAttributes as x } 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 y } from "../core/mixins.js";
|
|
8
|
+
const z = 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 E = Object.defineProperty, C = Object.getOwnPropertyDescriptor, n = (t, o, e, i) => {
|
|
10
|
+
for (var a = i > 1 ? void 0 : i ? C(o, e) : o, s = t.length - 1, l; s >= 0; s--)
|
|
11
|
+
(l = t[s]) && (a = (i ? l(o, e, a) : l(a)) || a);
|
|
12
|
+
return i && a && E(o, e, a), a;
|
|
13
13
|
};
|
|
14
|
-
let
|
|
14
|
+
let r = class extends y(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.a = !1, this.b = !1, this.h = new v(this), this.j = new b(
|
|
17
17
|
this,
|
|
18
|
-
|
|
19
|
-
), this.
|
|
18
|
+
r.events.didChange
|
|
19
|
+
), this.k = new b(
|
|
20
20
|
this,
|
|
21
|
-
|
|
22
|
-
), this.
|
|
21
|
+
r.events.change
|
|
22
|
+
), this.l = new b(
|
|
23
23
|
this,
|
|
24
|
-
|
|
25
|
-
), new
|
|
24
|
+
r.events.input
|
|
25
|
+
), new w(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((o) => {
|
|
33
|
+
var e;
|
|
34
|
+
return ((e = o.closest) == null ? void 0 : e.call(o, "sbb-radio-button-group")) === this;
|
|
35
35
|
});
|
|
36
36
|
}
|
|
37
|
-
get
|
|
37
|
+
get f() {
|
|
38
38
|
if (!this.disabled)
|
|
39
39
|
return this.radioButtons.filter((t) => !t.disabled);
|
|
40
40
|
}
|
|
41
|
-
|
|
42
|
-
for (const
|
|
43
|
-
|
|
44
|
-
this.
|
|
41
|
+
i(t) {
|
|
42
|
+
for (const o of this.radioButtons)
|
|
43
|
+
o.checked = o.value === t, o.tabIndex = this.c(o);
|
|
44
|
+
this.d();
|
|
45
45
|
}
|
|
46
46
|
connectedCallback() {
|
|
47
|
-
var
|
|
47
|
+
var o;
|
|
48
48
|
super.connectedCallback();
|
|
49
|
-
const t = this.
|
|
49
|
+
const t = this.h.signal;
|
|
50
50
|
this.addEventListener(
|
|
51
51
|
"stateChange",
|
|
52
|
-
(
|
|
52
|
+
(e) => this.m(e),
|
|
53
53
|
{
|
|
54
54
|
signal: t,
|
|
55
55
|
passive: !0
|
|
56
56
|
}
|
|
57
|
-
), this.addEventListener("keydown", (
|
|
57
|
+
), this.addEventListener("keydown", (e) => this.n(e), { signal: t }), this.a = !!((o = this.querySelector) != null && o.call(this, "sbb-selection-panel")), this.toggleAttribute("data-has-selection-panel", this.a), this.e(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 o;
|
|
61
|
+
if (super.willUpdate(t), t.has("value") && this.i(this.value), t.has("disabled")) {
|
|
62
|
+
for (const e of this.radioButtons)
|
|
63
|
+
e.tabIndex = this.c(e), (o = e.requestUpdate) == null || o.call(e, "disabled");
|
|
64
|
+
this.d();
|
|
65
65
|
}
|
|
66
|
-
t.has("required") && this.radioButtons.forEach((
|
|
66
|
+
t.has("required") && this.radioButtons.forEach((e) => {
|
|
67
67
|
var i;
|
|
68
|
-
return (i =
|
|
69
|
-
}), t.has("size") && this.radioButtons.forEach((
|
|
68
|
+
return (i = e.requestUpdate) == null ? void 0 : i.call(e, "required");
|
|
69
|
+
}), t.has("size") && this.radioButtons.forEach((e) => {
|
|
70
70
|
var i;
|
|
71
|
-
return (i =
|
|
71
|
+
return (i = e.requestUpdate) == null ? void 0 : i.call(e, "size");
|
|
72
72
|
});
|
|
73
73
|
}
|
|
74
74
|
firstUpdated(t) {
|
|
75
|
-
super.firstUpdated(t), this.
|
|
75
|
+
super.firstUpdated(t), this.b = !0, this.e(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
|
+
m(t) {
|
|
81
|
+
var e;
|
|
82
|
+
if (t.stopPropagation(), t.detail.type !== "checked" || !this.b)
|
|
83
83
|
return;
|
|
84
|
-
const
|
|
85
|
-
t.detail.checked ? (this.value =
|
|
84
|
+
const o = t.target;
|
|
85
|
+
t.detail.checked ? (this.value = o.value, this.g(o, this.value)) : this.allowEmptySelection && (this.value = (e = this.radioButtons.find((i) => i.checked)) == null ? void 0 : e.value, this.value || this.g(o));
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
this.
|
|
87
|
+
g(t, o) {
|
|
88
|
+
this.k.emit({ value: o, radioButton: t }), this.l.emit({ value: o, radioButton: t }), this.j.emit({ value: o, radioButton: t });
|
|
89
89
|
}
|
|
90
|
-
|
|
91
|
-
var
|
|
92
|
-
if (!this.
|
|
90
|
+
e(t) {
|
|
91
|
+
var e;
|
|
92
|
+
if (!this.b)
|
|
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 o = this.radioButtons;
|
|
95
|
+
this.value = t ?? ((e = o.find((i) => i.checked)) == null ? void 0 : e.value) ?? this.value;
|
|
96
|
+
for (const i of o)
|
|
97
|
+
i.checked = i.value === this.value, i.tabIndex = this.c(i);
|
|
98
|
+
this.d();
|
|
99
99
|
}
|
|
100
|
-
|
|
101
|
-
const t = this.radioButtons.find((
|
|
102
|
-
!t && (
|
|
100
|
+
d() {
|
|
101
|
+
const t = this.radioButtons.find((e) => e.checked && !e.disabled), o = this.f;
|
|
102
|
+
!t && (o != null && o.length) && (o[0].tabIndex = 0);
|
|
103
103
|
}
|
|
104
|
-
|
|
104
|
+
c(t) {
|
|
105
105
|
var i;
|
|
106
|
-
const
|
|
107
|
-
return
|
|
106
|
+
const o = t.checked && !t.disabled && !this.disabled, e = ((i = t.parentElement) == null ? void 0 : i.nodeName) === "SBB-SELECTION-PANEL" && t.parentElement.hasContent;
|
|
107
|
+
return o || this.a && e ? 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
|
+
n(t) {
|
|
110
|
+
var s, l;
|
|
111
|
+
const o = this.f;
|
|
112
|
+
if (!o || !o.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" || !f(t))
|
|
114
114
|
return;
|
|
115
|
-
const
|
|
116
|
-
(!this.
|
|
115
|
+
const e = o.findIndex((h) => h === t.target), i = g(t, e, o.length), a = (Array.from((l = this.querySelectorAll) == null ? void 0 : l.call(this, "sbb-selection-panel")) || []).every((h) => !h.hasContent);
|
|
116
|
+
(!this.a || this.a && a) && o[i].select(), o[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.e()}></slot>
|
|
122
122
|
</div>
|
|
123
123
|
<div class="sbb-radio-group__error">
|
|
124
124
|
<slot name="error"></slot>
|
|
@@ -126,36 +126,36 @@ let a = class extends x(c) {
|
|
|
126
126
|
`;
|
|
127
127
|
}
|
|
128
128
|
};
|
|
129
|
-
|
|
130
|
-
|
|
129
|
+
r.styles = z;
|
|
130
|
+
r.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
|
+
n([
|
|
136
|
+
d({ attribute: "allow-empty-selection", type: Boolean })
|
|
137
|
+
], r.prototype, "allowEmptySelection", 2);
|
|
138
|
+
n([
|
|
139
|
+
d({ type: Boolean })
|
|
140
|
+
], r.prototype, "required", 2);
|
|
141
|
+
n([
|
|
142
|
+
d()
|
|
143
|
+
], r.prototype, "value", 2);
|
|
144
|
+
n([
|
|
145
|
+
d()
|
|
146
|
+
], r.prototype, "size", 2);
|
|
147
|
+
n([
|
|
148
|
+
d({ attribute: "horizontal-from", reflect: !0 })
|
|
149
|
+
], r.prototype, "horizontalFrom", 2);
|
|
150
|
+
n([
|
|
151
|
+
d({ reflect: !0 })
|
|
152
|
+
], r.prototype, "orientation", 2);
|
|
153
|
+
r = n([
|
|
154
154
|
m("sbb-radio-button-group"),
|
|
155
|
-
|
|
155
|
+
x({
|
|
156
156
|
role: "radiogroup"
|
|
157
157
|
})
|
|
158
|
-
],
|
|
158
|
+
], r);
|
|
159
159
|
export {
|
|
160
|
-
|
|
160
|
+
r 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 a, nothing as n } 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 y } from "../core/controllers.js";
|
|
4
|
+
import { hostAttributes as x } from "../core/decorators.js";
|
|
5
|
+
import { setOrRemoveAttribute as k } from "../core/dom.js";
|
|
6
|
+
import { EventEmitter as u, HandlerRepository as w, formElementHandlerAspect as _ } from "../core/eventing.js";
|
|
7
|
+
import { i18nExpanded as S, i18nCollapsed as z } from "../core/i18n.js";
|
|
8
|
+
import { SbbUpdateSchedulerMixin as C } from "../core/mixins.js";
|
|
9
|
+
const E = 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 B = Object.defineProperty, q = Object.getOwnPropertyDescriptor, s = (t, o, l, b) => {
|
|
11
|
+
for (var i = b > 1 ? void 0 : b ? q(o, l) : o, d = t.length - 1, c; d >= 0; d--)
|
|
12
|
+
(c = t[d]) && (i = (b ? c(o, l, i) : c(i)) || i);
|
|
13
|
+
return b && i && B(o, l, i), i;
|
|
14
14
|
};
|
|
15
|
-
let
|
|
15
|
+
let e = class extends C(f) {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(), this.
|
|
17
|
+
super(), this.d = !1, this.e = !1, this.f = !1, this.g = null, this.h = !1, this.i = "m", this.c = !1, this.a = null, this.n = new m(this), this.j = new g(this), this.k = new u(
|
|
18
18
|
this,
|
|
19
|
-
|
|
19
|
+
e.events.stateChange,
|
|
20
20
|
{ bubbles: !0 }
|
|
21
|
-
), this.
|
|
21
|
+
), this.o = new u(
|
|
22
22
|
this,
|
|
23
|
-
|
|
23
|
+
e.events.radioButtonLoaded,
|
|
24
24
|
{ bubbles: !0 }
|
|
25
|
-
), this.
|
|
25
|
+
), this.l = new w(this, _), new y(this);
|
|
26
26
|
}
|
|
27
|
-
set allowEmptySelection(
|
|
28
|
-
this.
|
|
27
|
+
set allowEmptySelection(t) {
|
|
28
|
+
this.d = !!t;
|
|
29
29
|
}
|
|
30
30
|
get allowEmptySelection() {
|
|
31
|
-
var
|
|
32
|
-
return this.
|
|
31
|
+
var t;
|
|
32
|
+
return this.d || (((t = this.group) == null ? void 0 : t.allowEmptySelection) ?? !1);
|
|
33
33
|
}
|
|
34
|
-
set disabled(
|
|
35
|
-
this.
|
|
34
|
+
set disabled(t) {
|
|
35
|
+
this.e = !!t;
|
|
36
36
|
}
|
|
37
37
|
get disabled() {
|
|
38
|
-
var
|
|
39
|
-
return this.
|
|
38
|
+
var t;
|
|
39
|
+
return this.e || (((t = this.group) == null ? void 0 : t.disabled) ?? !1);
|
|
40
40
|
}
|
|
41
|
-
set required(
|
|
42
|
-
this.
|
|
41
|
+
set required(t) {
|
|
42
|
+
this.f = !!t;
|
|
43
43
|
}
|
|
44
44
|
get required() {
|
|
45
|
-
var
|
|
46
|
-
return this.
|
|
45
|
+
var t;
|
|
46
|
+
return this.f || (((t = this.group) == null ? void 0 : t.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.g;
|
|
53
53
|
}
|
|
54
|
-
set checked(
|
|
55
|
-
this.
|
|
54
|
+
set checked(t) {
|
|
55
|
+
this.h = !!t;
|
|
56
56
|
}
|
|
57
57
|
get checked() {
|
|
58
|
-
return this.
|
|
58
|
+
return this.h;
|
|
59
59
|
}
|
|
60
|
-
set size(
|
|
61
|
-
this.
|
|
60
|
+
set size(t) {
|
|
61
|
+
this.i = t;
|
|
62
62
|
}
|
|
63
63
|
get size() {
|
|
64
|
-
var
|
|
65
|
-
return ((
|
|
64
|
+
var t;
|
|
65
|
+
return ((t = this.group) == null ? void 0 : t.size) ?? this.i;
|
|
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.c;
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
|
|
74
|
+
p(t) {
|
|
75
|
+
t.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.g = this.closest("sbb-radio-button-group"), this.a = this.closest("sbb-selection-panel"), this.c = !!this.a && !this.closest('sbb-selection-panel [slot="content"]'), this.toggleAttribute("data-is-selection-panel-input", this.c);
|
|
82
|
+
const t = this.n.signal;
|
|
83
|
+
this.addEventListener("click", (o) => this.p(o), { signal: t }), this.addEventListener("keydown", (o) => this.q(o), { signal: t }), this.l.connect(), this.o.emit(), ["disabled", "required", "size"].forEach((o) => this.requestUpdate(o));
|
|
84
84
|
}
|
|
85
|
-
willUpdate(
|
|
86
|
-
super.willUpdate(
|
|
85
|
+
willUpdate(t) {
|
|
86
|
+
super.willUpdate(t), t.has("checked") && (this.setAttribute("aria-checked", `${this.checked}`), this.checked !== t.get("checked") && (this.k.emit({ type: "checked", checked: this.checked }), this.isSelectionPanelInput && this.m())), t.has("disabled") && (k(this, "aria-disabled", this.disabled ? "true" : null), this.disabled !== t.get("disabled") && this.k.emit({ type: "disabled", disabled: this.disabled })), t.has("required") && this.setAttribute("aria-required", `${this.required}`);
|
|
87
87
|
}
|
|
88
|
-
firstUpdated(
|
|
89
|
-
super.firstUpdated(
|
|
90
|
-
this.isSelectionPanelInput && this.
|
|
88
|
+
firstUpdated(t) {
|
|
89
|
+
super.firstUpdated(t), this.startUpdate(), setTimeout(() => {
|
|
90
|
+
this.isSelectionPanelInput && this.m(), this.completeUpdate();
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
disconnectedCallback() {
|
|
94
|
-
super.disconnectedCallback(), this.
|
|
94
|
+
super.disconnectedCallback(), this.l.disconnect();
|
|
95
95
|
}
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
q(t) {
|
|
97
|
+
t.code === "Space" && this.select();
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
var
|
|
101
|
-
if (!((
|
|
102
|
-
this.
|
|
99
|
+
m() {
|
|
100
|
+
var t;
|
|
101
|
+
if (!((t = this.a) != null && t.hasContent)) {
|
|
102
|
+
this.b = "";
|
|
103
103
|
return;
|
|
104
104
|
}
|
|
105
|
-
this.
|
|
105
|
+
this.b = this.checked ? ", " + S[this.j.current] : ", " + z[this.j.current];
|
|
106
106
|
}
|
|
107
107
|
render() {
|
|
108
|
-
return
|
|
108
|
+
return a`
|
|
109
109
|
<label class="sbb-radio-button">
|
|
110
110
|
<input
|
|
111
111
|
type="radio"
|
|
@@ -114,54 +114,54 @@ let t = class extends z(f) {
|
|
|
114
114
|
?disabled=${this.disabled}
|
|
115
115
|
?required=${this.required}
|
|
116
116
|
?checked=${this.checked}
|
|
117
|
-
value=${this.value ||
|
|
117
|
+
value=${this.value || n}
|
|
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.a ? a`<slot name="suffix"></slot>` : n}
|
|
123
123
|
</span>
|
|
124
|
-
${this.
|
|
125
|
-
${this.isSelectionPanelInput && this.
|
|
124
|
+
${this.a ? a`<slot name="subtext"></slot>` : n}
|
|
125
|
+
${this.isSelectionPanelInput && this.b ? a`<span class="sbb-screen-reader-only"> ${this.b} </span>` : n}
|
|
126
126
|
</label>
|
|
127
127
|
`;
|
|
128
128
|
}
|
|
129
129
|
};
|
|
130
|
-
|
|
131
|
-
|
|
130
|
+
e.styles = E;
|
|
131
|
+
e.events = {
|
|
132
132
|
stateChange: "stateChange",
|
|
133
133
|
radioButtonLoaded: "radioButtonLoaded"
|
|
134
134
|
};
|
|
135
|
-
|
|
135
|
+
s([
|
|
136
136
|
r({ attribute: "allow-empty-selection", type: Boolean })
|
|
137
|
-
],
|
|
138
|
-
|
|
137
|
+
], e.prototype, "allowEmptySelection", 1);
|
|
138
|
+
s([
|
|
139
139
|
r()
|
|
140
|
-
],
|
|
141
|
-
|
|
140
|
+
], e.prototype, "value", 2);
|
|
141
|
+
s([
|
|
142
142
|
r({ reflect: !0, type: Boolean })
|
|
143
|
-
],
|
|
144
|
-
|
|
143
|
+
], e.prototype, "disabled", 1);
|
|
144
|
+
s([
|
|
145
145
|
r({ reflect: !0, type: Boolean })
|
|
146
|
-
],
|
|
147
|
-
|
|
146
|
+
], e.prototype, "required", 1);
|
|
147
|
+
s([
|
|
148
148
|
r({ reflect: !0, type: Boolean })
|
|
149
|
-
],
|
|
150
|
-
|
|
149
|
+
], e.prototype, "checked", 1);
|
|
150
|
+
s([
|
|
151
151
|
r({ reflect: !0 })
|
|
152
|
-
],
|
|
153
|
-
|
|
152
|
+
], e.prototype, "size", 1);
|
|
153
|
+
s([
|
|
154
154
|
h()
|
|
155
|
-
],
|
|
156
|
-
|
|
155
|
+
], e.prototype, "c", 2);
|
|
156
|
+
s([
|
|
157
157
|
h()
|
|
158
|
-
],
|
|
159
|
-
|
|
158
|
+
], e.prototype, "b", 2);
|
|
159
|
+
e = s([
|
|
160
160
|
v("sbb-radio-button"),
|
|
161
|
-
|
|
161
|
+
x({
|
|
162
162
|
role: "radio"
|
|
163
163
|
})
|
|
164
|
-
],
|
|
164
|
+
], e);
|
|
165
165
|
export {
|
|
166
|
-
|
|
166
|
+
e as SbbRadioButtonElement
|
|
167
167
|
};
|