@sbb-esta/lyne-elements 2.2.0 → 2.3.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 +6 -6
- package/alert/alert-group.js +4 -4
- package/alert/alert.js +9 -9
- package/autocomplete-grid/autocomplete-grid-button.js +4 -4
- package/autocomplete-grid/autocomplete-grid-optgroup.js +4 -4
- package/autocomplete-grid/autocomplete-grid-row.js +4 -4
- package/autocomplete.js +1 -1
- package/badge.css +31 -0
- package/breadcrumb/breadcrumb-group.js +4 -4
- package/breadcrumb/breadcrumb.js +19 -19
- package/button/accent-button-link.js +9 -9
- package/button/accent-button-static.js +6 -6
- package/button/accent-button.js +6 -6
- package/button/button-link.js +7 -7
- package/button/button-static.js +7 -7
- package/button/button.js +8 -8
- package/button/common.js +1 -1
- package/button/mini-button-group.js +8 -8
- package/button/secondary-button-link.js +7 -7
- package/button/secondary-button-static.js +7 -7
- package/button/secondary-button.js +3 -3
- package/button/transparent-button-link.js +6 -6
- package/button/transparent-button-static.js +5 -5
- package/button/transparent-button.js +6 -6
- package/calendar.js +1 -1
- package/card/card-badge.js +9 -9
- package/card/card-button.js +5 -5
- package/card/card-link.js +7 -7
- package/card/card.js +1 -1
- package/checkbox/checkbox-panel.js +16 -16
- package/checkbox/checkbox.js +15 -15
- package/checkbox/common.js +3 -3
- package/clock.js +8 -8
- package/container/container.js +4 -4
- package/core/base-elements.js +10 -10
- package/core/controllers.js +4 -4
- package/core/datetime.js +6 -6
- package/core/eventing.js +4 -4
- package/core/i18n/i18n.d.ts +2 -0
- package/core/i18n/i18n.d.ts.map +1 -1
- package/core/i18n.js +43 -31
- package/core/mixins/form-associated-checkbox-mixin.d.ts.map +1 -1
- package/core/mixins/form-associated-mixin.d.ts +3 -0
- package/core/mixins/form-associated-mixin.d.ts.map +1 -1
- package/core/mixins/form-associated-radio-button-mixin.d.ts.map +1 -1
- package/core/mixins.js +342 -248
- package/core/styles/badge.scss +3 -0
- package/core/styles/mixins/badge.scss +26 -1
- package/core/styles/mixins/font-face.scss +12 -12
- package/core/styles/mixins/link.scss +32 -8
- package/core/styles/standard-theme.scss +1 -0
- package/core/testing.js +14 -14
- package/core.css +3 -3
- package/custom-elements.json +7323 -169
- package/datepicker/datepicker-toggle.js +14 -14
- package/development/alert/alert-group.js +1 -1
- package/development/alert/alert.js +1 -1
- package/development/autocomplete.js +1 -1
- package/development/breadcrumb/breadcrumb.js +5 -2
- package/development/button/common.js +18 -14
- package/development/calendar.js +1 -1
- package/development/card/card.js +1 -1
- package/development/checkbox/checkbox-panel.js +1 -1
- package/development/core/i18n/i18n.d.ts +2 -0
- package/development/core/i18n/i18n.d.ts.map +1 -1
- package/development/core/i18n.js +15 -1
- package/development/core/mixins/form-associated-checkbox-mixin.d.ts.map +1 -1
- package/development/core/mixins/form-associated-mixin.d.ts +3 -0
- package/development/core/mixins/form-associated-mixin.d.ts.map +1 -1
- package/development/core/mixins/form-associated-radio-button-mixin.d.ts.map +1 -1
- package/development/core/mixins.js +159 -22
- package/development/datepicker/datepicker-toggle.js +1 -1
- package/development/dialog/dialog-title.js +1 -1
- package/development/expansion-panel/expansion-panel-header.js +1 -1
- package/development/expansion-panel/expansion-panel.js +1 -1
- package/development/file-selector/common.js +1 -1
- package/development/footer.js +1 -1
- package/development/form-field/form-field/form-field.d.ts.map +1 -1
- package/development/form-field/form-field.js +5 -2
- package/development/image.js +1 -1
- package/development/journey-header.js +1 -1
- package/development/link/common.js +19 -7
- package/development/link-list/common.js +1 -1
- package/development/map-container.js +1 -1
- package/development/menu/common/menu-action-common.d.ts +3 -0
- package/development/menu/common/menu-action-common.d.ts.map +1 -1
- package/development/menu/common.js +35 -12
- package/development/navigation/navigation-section.js +1 -1
- package/development/notification.js +1 -1
- package/development/overlay.js +1 -1
- package/development/radio-button/radio-button-panel.js +1 -1
- package/development/select/select.d.ts +4 -1
- package/development/select/select.d.ts.map +1 -1
- package/development/select.js +22 -4
- package/development/skiplink-list.js +1 -1
- package/development/slider.js +1 -1
- package/development/tabs/tab-label.js +1 -1
- package/development/timetable-occupancy.js +1 -1
- package/development/toast.js +1 -1
- package/development/toggle/toggle/toggle.d.ts +25 -6
- package/development/toggle/toggle/toggle.d.ts.map +1 -1
- package/development/toggle/toggle-option/toggle-option.d.ts +2 -6
- package/development/toggle/toggle-option/toggle-option.d.ts.map +1 -1
- package/development/toggle/toggle-option.js +21 -39
- package/development/toggle/toggle.js +57 -39
- package/development/train/train-formation.js +1 -1
- package/development/train/train.js +1 -1
- package/development/visual-checkbox.js +1 -1
- package/dialog/dialog-content.js +3 -3
- package/dialog/dialog-title.js +8 -8
- package/divider.js +12 -12
- package/expansion-panel/expansion-panel-header.js +1 -1
- package/expansion-panel/expansion-panel.js +1 -1
- package/file-selector/common.js +9 -9
- package/file-selector/file-selector-dropzone.js +5 -5
- package/file-selector/file-selector.js +6 -6
- package/flip-card/flip-card-details.js +4 -4
- package/flip-card/flip-card-summary.js +9 -9
- package/font-characters-extension.css +3 -3
- package/footer.js +4 -4
- package/form-field/form-field/form-field.d.ts.map +1 -1
- package/form-field/form-field.js +7 -5
- package/header/header-button.js +5 -5
- package/header/header-link.js +5 -5
- package/icon.js +36 -36
- package/image.js +1 -1
- package/journey-header.js +5 -5
- package/link/block-link-button.js +4 -4
- package/link/block-link-static.js +9 -9
- package/link/block-link.js +4 -4
- package/link/common.js +28 -28
- package/link/link-button.js +7 -7
- package/link/link-static.js +7 -7
- package/link/link.js +4 -4
- package/link-list/common.js +15 -15
- package/loading-indicator-circle.js +11 -11
- package/map-container.js +5 -5
- package/menu/common/menu-action-common.d.ts +3 -0
- package/menu/common/menu-action-common.d.ts.map +1 -1
- package/menu/common.js +34 -30
- package/menu/menu-button.js +8 -8
- package/menu/menu-link.js +6 -6
- package/menu/menu.js +7 -7
- package/navigation/navigation-button.js +4 -4
- package/navigation/navigation-link.js +7 -7
- package/navigation/navigation-list.js +4 -4
- package/navigation/navigation-marker.js +3 -3
- package/navigation/navigation-section.js +1 -1
- package/notification.js +18 -18
- package/option/optgroup.js +11 -11
- package/overlay.js +14 -14
- package/package.json +6 -2
- package/paginator/common.js +6 -6
- package/popover/popover.js +13 -13
- package/radio-button/radio-button-panel.js +6 -6
- package/screen-reader-only.js +5 -5
- package/select/select.d.ts +4 -1
- package/select/select.d.ts.map +1 -1
- package/select.js +35 -28
- package/skiplink-list.js +3 -3
- package/slider.js +13 -13
- package/standard-theme.css +35 -3
- package/status.js +3 -3
- package/stepper/step-label.js +4 -4
- package/table/table-wrapper.js +4 -4
- package/tabs/tab-group.js +24 -24
- package/tabs/tab-label.js +1 -1
- package/tabs/tab.js +4 -4
- package/tag/tag-group.js +7 -7
- package/teaser-product/common.js +5 -5
- package/teaser-product/teaser-product-static.js +2 -2
- package/timetable-occupancy-icon.js +3 -3
- package/timetable-occupancy.js +6 -6
- package/toast.js +5 -5
- package/toggle/toggle/toggle.d.ts +25 -6
- package/toggle/toggle/toggle.d.ts.map +1 -1
- package/toggle/toggle-option/toggle-option.d.ts +2 -6
- package/toggle/toggle-option/toggle-option.d.ts.map +1 -1
- package/toggle/toggle-option.js +44 -52
- package/toggle/toggle.js +103 -83
- package/toggle-check.js +5 -5
- package/train/train-formation.js +1 -1
- package/train/train.js +29 -29
- package/visual-checkbox.js +1 -1
package/toggle/toggle-option.js
CHANGED
|
@@ -1,51 +1,45 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var x = (t) => {
|
|
2
|
+
throw TypeError(t);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __esDecorate as
|
|
7
|
-
import { css as
|
|
8
|
-
import { customElement as
|
|
9
|
-
import { hostAttributes as
|
|
10
|
-
import { setOrRemoveAttribute as
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
4
|
+
var w = (t, o, s) => o.has(t) || x("Cannot " + s);
|
|
5
|
+
var h = (t, o, s) => (w(t, o, "read from private field"), s ? s.call(t) : o.get(t)), g = (t, o, s) => o.has(t) ? x("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(t) : o.set(t, s), b = (t, o, s, a) => (w(t, o, "write to private field"), a ? a.call(t, s) : o.set(t, s), s);
|
|
6
|
+
import { __esDecorate as u, __runInitializers as d } from "tslib";
|
|
7
|
+
import { css as I, LitElement as E, nothing as z, html as T } from "lit";
|
|
8
|
+
import { customElement as $, property as S } from "lit/decorators.js";
|
|
9
|
+
import { hostAttributes as D, slotState as C, forceType as O } from "../core/decorators.js";
|
|
10
|
+
import { setOrRemoveAttribute as j } from "../core/dom.js";
|
|
11
|
+
import { SbbDisabledMixin as A } from "../core/mixins.js";
|
|
12
|
+
import { SbbIconNameMixin as L } from "../icon.js";
|
|
13
|
+
const M = I`*,:before,:after{box-sizing:border-box}:host{--sbb-toggle-option-cursor: pointer;--sbb-toggle-option-color: var(--sbb-color-anthracite);--sbb-toggle-option-icon-min-size: var(--sbb-size-icon-ui-small);--sbb-toggle-option-border-radius: var(--sbb-border-radius-infinity);--sbb-toggle-option-line-height: calc(1em * var(--sbb-typo-line-height-body-text));display:inline-block;min-width:var(--sbb-toggle-min-width);overflow:hidden;z-index:1}:host(:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch])){outline:none!important}:host([checked]){--sbb-toggle-option-color: var(--sbb-color-charcoal)}:host([disabled]){--sbb-toggle-option-cursor: unset;--sbb-toggle-option-color: var(--sbb-color-granite)}input[type=radio]{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.sbb-toggle-option{--sbb-text-font-size: var(--sbb-font-size-text-xs);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);font-weight:700;cursor:var(--sbb-toggle-option-cursor);display:flex;justify-content:center;align-items:center;height:var(--sbb-toggle-height);padding-inline:var(--sbb-toggle-padding-inline);border-radius:var(--sbb-toggle-option-border-radius);color:var(--sbb-toggle-option-color)}:host([data-slot-names~=unnamed]:where([data-slot-names~=icon],[icon-name])) .sbb-toggle-option{gap:var(--sbb-spacing-fixed-1x)}.sbb-toggle-option__label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host(:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch])) .sbb-toggle-option__label:before{content:"";position:absolute;pointer-events:none;inset:calc(var(--sbb-focus-outline-offset) * -2);border:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width);border-radius:var(--sbb-toggle-option-border-radius)}sbb-icon,::slotted(sbb-icon){min-width:var(--sbb-toggle-option-icon-min-size);min-height:var(--sbb-toggle-option-icon-min-size)}`;
|
|
14
|
+
let K = (() => {
|
|
15
|
+
var r, c, n;
|
|
16
|
+
let t = [$("sbb-toggle-option"), D({
|
|
16
17
|
role: "radio"
|
|
17
|
-
}),
|
|
18
|
-
return n = class extends
|
|
18
|
+
}), C()], o, s = [], a, p = A(L(E)), f, m = [], v = [], _, k = [], y = [];
|
|
19
|
+
return n = class extends p {
|
|
19
20
|
constructor() {
|
|
20
|
-
var e,
|
|
21
|
+
var e, i;
|
|
21
22
|
super();
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
var
|
|
26
|
-
return (
|
|
23
|
+
g(this, r);
|
|
24
|
+
g(this, c);
|
|
25
|
+
b(this, r, d(this, m, !1)), b(this, c, (d(this, v), d(this, k, ""))), this._toggle = d(this, y), (e = this.addEventListener) == null || e.call(this, "input", () => this._handleInput()), (i = this.addEventListener) == null || i.call(this, "click", () => {
|
|
26
|
+
var l;
|
|
27
|
+
return (l = this.shadowRoot.querySelector("label")) == null ? void 0 : l.click();
|
|
27
28
|
});
|
|
28
29
|
}
|
|
29
30
|
/** Whether the toggle-option is checked. */
|
|
30
31
|
get checked() {
|
|
31
|
-
return
|
|
32
|
+
return h(this, r);
|
|
32
33
|
}
|
|
33
34
|
set checked(e) {
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
/** Whether the toggle option is disabled. */
|
|
37
|
-
get disabled() {
|
|
38
|
-
return g(this, d);
|
|
39
|
-
}
|
|
40
|
-
set disabled(e) {
|
|
41
|
-
c(this, d, e);
|
|
35
|
+
b(this, r, e);
|
|
42
36
|
}
|
|
43
37
|
/** Value of toggle-option. */
|
|
44
|
-
set value(e) {
|
|
45
|
-
this._value = `${e}`;
|
|
46
|
-
}
|
|
47
38
|
get value() {
|
|
48
|
-
return this
|
|
39
|
+
return h(this, c);
|
|
40
|
+
}
|
|
41
|
+
set value(e) {
|
|
42
|
+
b(this, c, e);
|
|
49
43
|
}
|
|
50
44
|
connectedCallback() {
|
|
51
45
|
var e;
|
|
@@ -55,11 +49,11 @@ let J = (() => {
|
|
|
55
49
|
super.willUpdate(e), e.has("checked") && (this.setAttribute("aria-checked", `${this.checked}`), this._verifyTabindex(), this.checked && this._uncheckOtherOptions()), e.has("disabled") && this._handleDisabledChange();
|
|
56
50
|
}
|
|
57
51
|
_uncheckOtherOptions() {
|
|
58
|
-
var e,
|
|
59
|
-
(e = this._toggle) == null || e.options.filter((
|
|
52
|
+
var e, i;
|
|
53
|
+
(e = this._toggle) == null || e.options.filter((l) => l !== this).forEach((l) => l.checked = !1), (i = this._toggle) == null || i.statusChanged();
|
|
60
54
|
}
|
|
61
55
|
_handleDisabledChange() {
|
|
62
|
-
|
|
56
|
+
j(this, "aria-disabled", this.disabled ? "true" : null), this._verifyTabindex();
|
|
63
57
|
}
|
|
64
58
|
_handleInput() {
|
|
65
59
|
this.disabled || (this.checked = !0, this._uncheckOtherOptions());
|
|
@@ -68,7 +62,7 @@ let J = (() => {
|
|
|
68
62
|
this.tabIndex = this.checked && !this.disabled ? 0 : -1;
|
|
69
63
|
}
|
|
70
64
|
render() {
|
|
71
|
-
return
|
|
65
|
+
return T`
|
|
72
66
|
<input
|
|
73
67
|
type="radio"
|
|
74
68
|
id="sbb-toggle-option-id"
|
|
@@ -76,8 +70,8 @@ let J = (() => {
|
|
|
76
70
|
tabindex="-1"
|
|
77
71
|
?inert=${this.checked}
|
|
78
72
|
?disabled=${this.disabled}
|
|
79
|
-
.checked=${this.checked ||
|
|
80
|
-
.value=${this.value ||
|
|
73
|
+
.checked=${this.checked || z}
|
|
74
|
+
.value=${this.value || z}
|
|
81
75
|
@click=${(e) => e.stopPropagation()}
|
|
82
76
|
/>
|
|
83
77
|
<label class="sbb-toggle-option" for="sbb-toggle-option-id">
|
|
@@ -88,17 +82,15 @@ let J = (() => {
|
|
|
88
82
|
</label>
|
|
89
83
|
`;
|
|
90
84
|
}
|
|
91
|
-
}, r = new WeakMap(),
|
|
92
|
-
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
} }, metadata: e },
|
|
96
|
-
|
|
97
|
-
} }, metadata: e },
|
|
98
|
-
|
|
99
|
-
} }, metadata: e }, null, m), h(null, s = { value: l }, i, { kind: "class", name: l.name, metadata: e }, null, o), l = s.value, e && Object.defineProperty(l, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
100
|
-
})(), n.styles = P, b(l, o), l;
|
|
85
|
+
}, r = new WeakMap(), c = new WeakMap(), a = n, (() => {
|
|
86
|
+
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(p[Symbol.metadata] ?? null) : void 0;
|
|
87
|
+
f = [O(), S({ reflect: !0, type: Boolean })], _ = [O(), S()], u(n, null, f, { kind: "accessor", name: "checked", static: !1, private: !1, access: { has: (i) => "checked" in i, get: (i) => i.checked, set: (i, l) => {
|
|
88
|
+
i.checked = l;
|
|
89
|
+
} }, metadata: e }, m, v), u(n, null, _, { kind: "accessor", name: "value", static: !1, private: !1, access: { has: (i) => "value" in i, get: (i) => i.value, set: (i, l) => {
|
|
90
|
+
i.value = l;
|
|
91
|
+
} }, metadata: e }, k, y), u(null, o = { value: a }, t, { kind: "class", name: a.name, metadata: e }, null, s), a = o.value, e && Object.defineProperty(a, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
92
|
+
})(), n.styles = M, d(a, s), a;
|
|
101
93
|
})();
|
|
102
94
|
export {
|
|
103
|
-
|
|
95
|
+
K as SbbToggleOptionElement
|
|
104
96
|
};
|
package/toggle/toggle.js
CHANGED
|
@@ -1,143 +1,163 @@
|
|
|
1
|
-
var
|
|
1
|
+
var A = (s) => {
|
|
2
2
|
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __esDecorate as
|
|
7
|
-
import { ResizeController as
|
|
8
|
-
import { css as U, LitElement as
|
|
9
|
-
import { customElement as
|
|
10
|
-
import { interactivityChecker as
|
|
11
|
-
import { hostAttributes as M, forceType as
|
|
12
|
-
import { isLean as
|
|
13
|
-
import { EventEmitter as
|
|
14
|
-
|
|
4
|
+
var O = (s, o, r) => o.has(s) || A("Cannot " + r);
|
|
5
|
+
var v = (s, o, r) => (O(s, o, "read from private field"), r ? r.call(s) : o.get(s)), f = (s, o, r) => o.has(s) ? A("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(s) : o.set(s, r), h = (s, o, r, n) => (O(s, o, "write to private field"), n ? n.call(s, r) : o.set(s, r), r);
|
|
6
|
+
import { __esDecorate as c, __runInitializers as g } from "tslib";
|
|
7
|
+
import { ResizeController as L } from "@lit-labs/observers/resize-controller.js";
|
|
8
|
+
import { css as U, LitElement as V, isServer as P, html as W } from "lit";
|
|
9
|
+
import { customElement as K, property as _ } from "lit/decorators.js";
|
|
10
|
+
import { interactivityChecker as $, isArrowKeyPressed as j, getNextElementIndex as q } from "../core/a11y.js";
|
|
11
|
+
import { hostAttributes as M, forceType as B } from "../core/decorators.js";
|
|
12
|
+
import { isLean as G } from "../core/dom.js";
|
|
13
|
+
import { EventEmitter as H } from "../core/eventing.js";
|
|
14
|
+
import { SbbDisabledMixin as N, SbbFormAssociatedMixin as J } from "../core/mixins.js";
|
|
15
|
+
import "./toggle-option.js";
|
|
16
|
+
const Q = U`*,:before,:after{box-sizing:border-box}:host{display:block;--sbb-toggle-width: fit-content;--sbb-toggle-min-width: calc( var(--sbb-toggle-padding-inline) * 2 + var(--sbb-size-icon-ui-small) );--sbb-toggle-selected-option-border-color: var(--sbb-color-smoke);--sbb-toggle-padding-inline: var(--sbb-spacing-responsive-xxxs);--sbb-toggle-animation-duration: var( --sbb-disable-animation-duration, var(--sbb-animation-duration-6x) );--sbb-toggle-height: 1.75rem;--sbb-toggle-border-width: var(--sbb-border-width-1x);--sbb-toggle-border-style: solid;--sbb-toggle-border-radius: var(--sbb-border-radius-infinity)}@media (min-width: 52.5rem){:host{--sbb-toggle-height: 2rem}}@media (forced-colors: active){:host{--sbb-toggle-selected-option-border-color: Highlight;--sbb-toggle-border-width: var(--sbb-border-width-2x)}}:host([even]){--sbb-toggle-width: 100%}:host([even]) ::slotted(sbb-toggle-option){width:50%}:host(:disabled){--sbb-toggle-selected-option-border-color: var(--sbb-color-graphite);--sbb-toggle-border-style: dashed}@media (forced-colors: active){:host(:disabled){--sbb-toggle-border-style: solid;--sbb-toggle-selected-option-border-color: GrayText}}:host([size=m]){--sbb-toggle-padding-inline: var(--sbb-spacing-responsive-xs);--sbb-toggle-height: 2.75rem}@media (min-width: 52.5rem){:host([size=m]){--sbb-toggle-height: 3.25rem}}:host([data-disable-animation-on-resizing]){--sbb-disable-animation-duration: 0s}.sbb-toggle{--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);position:relative;display:flex;align-items:center;width:var(--sbb-toggle-width);max-width:100%;min-width:calc(var(--sbb-toggle-min-width) * 2);height:var(--sbb-toggle-height);-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;background:var(--sbb-color-cloud);border-radius:var(--sbb-toggle-border-radius)}.sbb-toggle:after{content:"";padding-inline:var(--sbb-toggle-padding-inline);display:inline-block;opacity:1;background-color:var(--sbb-color-white);border:var(--sbb-toggle-border-width) var(--sbb-toggle-border-style) var(--sbb-toggle-selected-option-border-color);border-radius:var(--sbb-toggle-border-radius);position:absolute;max-width:100%;min-width:var(--sbb-toggle-min-width);inset-block:calc(-2 * var(--sbb-toggle-border-width));inset-inline:calc(var(--sbb-toggle-option-left) - .125rem) calc(var(--sbb-toggle-option-right) - .125rem);transition-duration:var(--sbb-toggle-animation-duration);transition-timing-function:ease;transition-property:opacity,inset-inline-end,inset-inline-start}@media (forced-colors: active){.sbb-toggle{outline:var(--sbb-toggle-border-width) solid CanvasText}}`;
|
|
15
17
|
let be = (() => {
|
|
16
|
-
var
|
|
17
|
-
let s = [
|
|
18
|
+
var b, d, l;
|
|
19
|
+
let s = [K("sbb-toggle"), M({
|
|
18
20
|
role: "radiogroup"
|
|
19
|
-
})], o,
|
|
20
|
-
var
|
|
21
|
+
})], o, r = [], n, y = N(J(V)), w = [], x, k = [], z = [], C, E = [], S = [], D;
|
|
22
|
+
var u = (l = class extends y {
|
|
21
23
|
constructor() {
|
|
22
|
-
var
|
|
24
|
+
var e, t;
|
|
23
25
|
super();
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
b(this, c, (d(this, x), d(this, k, !1))), b(this, g, (d(this, E), d(this, I, !1))), b(this, h, (d(this, C), d(this, S, X() ? "s" : "m"))), this._value = (d(this, T), null), this._loaded = !1, this._toggleResizeObserver = new B(this, {
|
|
26
|
+
f(this, b);
|
|
27
|
+
f(this, d);
|
|
28
|
+
h(this, b, (g(this, w), g(this, k, !1))), h(this, d, (g(this, z), g(this, E, G() ? "s" : "m"))), this._value = (g(this, S), null), this._loaded = !1, this._toggleResizeObserver = new L(this, {
|
|
28
29
|
target: null,
|
|
29
30
|
skipInitial: !0,
|
|
30
31
|
callback: () => this.updatePillPosition(!0)
|
|
31
|
-
}), this._change = new
|
|
32
|
+
}), this._change = new H(this, u.events.change, {
|
|
32
33
|
bubbles: !0,
|
|
33
34
|
composed: !0
|
|
34
|
-
}), (
|
|
35
|
-
}
|
|
36
|
-
/** Whether the toggle is disabled. */
|
|
37
|
-
get disabled() {
|
|
38
|
-
return p(this, c);
|
|
39
|
-
}
|
|
40
|
-
set disabled(t) {
|
|
41
|
-
b(this, c, t);
|
|
35
|
+
}), (e = this.addEventListener) == null || e.call(this, "input", () => this._handleInput(), { passive: !0 }), (t = this.addEventListener) == null || t.call(this, "keydown", (i) => this._handleKeyDown(i));
|
|
42
36
|
}
|
|
43
37
|
/**
|
|
44
38
|
* If true, set the width of the component fixed; if false,
|
|
45
39
|
* the width is dynamic based on the label of the sbb-toggle-option.
|
|
46
40
|
*/
|
|
47
41
|
get even() {
|
|
48
|
-
return
|
|
42
|
+
return v(this, b);
|
|
49
43
|
}
|
|
50
|
-
set even(
|
|
51
|
-
|
|
44
|
+
set even(e) {
|
|
45
|
+
h(this, b, e);
|
|
52
46
|
}
|
|
53
47
|
/**
|
|
54
48
|
* Size variant, either m or s.
|
|
55
49
|
* @default 'm' / 's' (lean)
|
|
56
50
|
*/
|
|
57
51
|
get size() {
|
|
58
|
-
return
|
|
52
|
+
return v(this, d);
|
|
59
53
|
}
|
|
60
|
-
set size(
|
|
61
|
-
|
|
54
|
+
set size(e) {
|
|
55
|
+
h(this, d, e);
|
|
62
56
|
}
|
|
63
57
|
/**
|
|
64
58
|
* The value of the toggle. It needs to be mutable since it is updated whenever
|
|
65
59
|
* a new option is selected (see the `onToggleOptionSelect()` method).
|
|
66
60
|
*/
|
|
67
|
-
set value(
|
|
68
|
-
|
|
61
|
+
set value(e) {
|
|
62
|
+
P ? this._value = e : this._valueChanged(e);
|
|
69
63
|
}
|
|
70
64
|
get value() {
|
|
71
|
-
var
|
|
72
|
-
return
|
|
65
|
+
var e, t;
|
|
66
|
+
return P ? this._value ?? "" : ((e = this.options.find((i) => i.checked)) == null ? void 0 : e.value) ?? ((t = this.options[0]) == null ? void 0 : t.value) ?? "";
|
|
73
67
|
}
|
|
74
68
|
/** The child instances of sbb-toggle-option as an array. */
|
|
75
69
|
get options() {
|
|
76
|
-
var
|
|
77
|
-
return Array.from(((
|
|
70
|
+
var e;
|
|
71
|
+
return Array.from(((e = this.querySelectorAll) == null ? void 0 : e.call(this, "sbb-toggle-option")) ?? []);
|
|
72
|
+
}
|
|
73
|
+
connectedCallback() {
|
|
74
|
+
super.connectedCallback(), this.options.forEach((e) => this._toggleResizeObserver.observe(e)), this._updateToggle();
|
|
75
|
+
}
|
|
76
|
+
willUpdate(e) {
|
|
77
|
+
super.willUpdate(e), (e.has("disabled") || e.has("formDisabled")) && this._updateDisabled();
|
|
78
78
|
}
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
79
|
+
async firstUpdated(e) {
|
|
80
|
+
super.firstUpdated(e), await this.updateComplete, this._loaded = !0, this.statusChanged();
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Called whenever the value changes, both programmatically or by user interaction.
|
|
84
|
+
* @internal
|
|
85
|
+
*/
|
|
86
|
+
statusChanged() {
|
|
87
|
+
this.updateFormValue(), this.updatePillPosition();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Reset to the init value if present. Select the first option, otherwise.
|
|
91
|
+
*/
|
|
92
|
+
formResetCallback() {
|
|
93
|
+
this.value = this.getAttribute("value");
|
|
94
|
+
}
|
|
95
|
+
formStateRestoreCallback(e, t) {
|
|
96
|
+
this.value = e;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* @deprecated Will be made 'private' in the next major version
|
|
100
|
+
* @internal
|
|
101
|
+
*/
|
|
102
|
+
updatePillPosition(e = !1) {
|
|
103
|
+
var I, T;
|
|
82
104
|
if (!this._loaded)
|
|
83
105
|
return;
|
|
84
|
-
const
|
|
85
|
-
if (
|
|
106
|
+
const t = this.options, i = this.shadowRoot.querySelector(".sbb-toggle");
|
|
107
|
+
if (t.every((m) => !m.checked) || t.every((m) => !m.clientWidth) || !i)
|
|
86
108
|
return;
|
|
87
|
-
this.toggleAttribute("data-disable-animation-on-resizing",
|
|
88
|
-
const a =
|
|
89
|
-
(
|
|
109
|
+
this.toggleAttribute("data-disable-animation-on-resizing", e);
|
|
110
|
+
const a = t[0], p = a.checked, R = a.checked ? "0px" : `${a.clientWidth}px`, F = p ? `${i.clientWidth - a.clientWidth}px` : "0px";
|
|
111
|
+
(I = this.style) == null || I.setProperty("--sbb-toggle-option-left", R), (T = this.style) == null || T.setProperty("--sbb-toggle-option-right", F);
|
|
90
112
|
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
}
|
|
94
|
-
async firstUpdated(t) {
|
|
95
|
-
super.firstUpdated(t), await this.updateComplete, this._loaded = !0, this.updatePillPosition(!1);
|
|
113
|
+
updateFormValue() {
|
|
114
|
+
this.internals.setFormValue(this.value);
|
|
96
115
|
}
|
|
97
116
|
_updateToggle() {
|
|
98
117
|
this._valueChanged(this.value), this._updateDisabled();
|
|
99
118
|
}
|
|
100
|
-
_valueChanged(
|
|
101
|
-
const
|
|
102
|
-
i && (i.checked || (i.checked = !0), this.
|
|
119
|
+
_valueChanged(e) {
|
|
120
|
+
const t = this.options, i = t.find((a) => e === ("value" in a ? a.value : a.getAttribute("value"))) ?? t.find((a) => a.checked) ?? t[0];
|
|
121
|
+
i && (i.checked || (i.checked = !0), this.statusChanged());
|
|
103
122
|
}
|
|
104
123
|
_updateDisabled() {
|
|
105
|
-
for (const
|
|
106
|
-
|
|
124
|
+
for (const e of this.options)
|
|
125
|
+
e.disabled = this.disabled || this.formDisabled;
|
|
107
126
|
}
|
|
127
|
+
/**
|
|
128
|
+
* Called on user interaction (click or keyboard)
|
|
129
|
+
*/
|
|
108
130
|
_handleInput() {
|
|
109
|
-
this.
|
|
110
|
-
}
|
|
111
|
-
_handleKeyDown(
|
|
112
|
-
const
|
|
113
|
-
if (!(!
|
|
114
|
-
|
|
115
|
-
const i =
|
|
116
|
-
|
|
131
|
+
this.statusChanged(), this._change.emit();
|
|
132
|
+
}
|
|
133
|
+
_handleKeyDown(e) {
|
|
134
|
+
const t = this.options.filter((i) => !i.disabled && $.isVisible(i));
|
|
135
|
+
if (!(!t || // don't trap nested handling
|
|
136
|
+
e.target !== this && e.target.parentElement !== this) && j(e)) {
|
|
137
|
+
const i = t.findIndex((p) => p.checked), a = q(e, i, t.length);
|
|
138
|
+
t[a].checked || (t[a].checked = !0, t[a].focus(), t[a].dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0 }))), e.preventDefault();
|
|
117
139
|
}
|
|
118
140
|
}
|
|
119
141
|
render() {
|
|
120
|
-
return
|
|
142
|
+
return W`
|
|
121
143
|
<div class="sbb-toggle">
|
|
122
144
|
<slot @slotchange=${this._updateToggle}></slot>
|
|
123
145
|
</div>
|
|
124
146
|
`;
|
|
125
147
|
}
|
|
126
|
-
},
|
|
127
|
-
const
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
} }, metadata:
|
|
131
|
-
|
|
132
|
-
} }, metadata:
|
|
133
|
-
|
|
134
|
-
} }, metadata:
|
|
135
|
-
|
|
136
|
-
} }, metadata: t }, null, x), u(null, o = { value: n }, s, { kind: "class", name: n.name, metadata: t }, null, l), f = n = o.value, t && Object.defineProperty(n, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: t });
|
|
137
|
-
})(), r.styles = Z, r.events = {
|
|
148
|
+
}, b = new WeakMap(), d = new WeakMap(), n = l, (() => {
|
|
149
|
+
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(y[Symbol.metadata] ?? null) : void 0;
|
|
150
|
+
x = [B(), _({ reflect: !0, type: Boolean })], C = [_({ reflect: !0 })], D = [_()], c(l, null, x, { kind: "accessor", name: "even", static: !1, private: !1, access: { has: (t) => "even" in t, get: (t) => t.even, set: (t, i) => {
|
|
151
|
+
t.even = i;
|
|
152
|
+
} }, metadata: e }, k, z), c(l, null, C, { kind: "accessor", name: "size", static: !1, private: !1, access: { has: (t) => "size" in t, get: (t) => t.size, set: (t, i) => {
|
|
153
|
+
t.size = i;
|
|
154
|
+
} }, metadata: e }, E, S), c(l, null, D, { kind: "setter", name: "value", static: !1, private: !1, access: { has: (t) => "value" in t, set: (t, i) => {
|
|
155
|
+
t.value = i;
|
|
156
|
+
} }, metadata: e }, null, w), c(null, o = { value: n }, s, { kind: "class", name: n.name, metadata: e }, null, r), u = n = o.value, e && Object.defineProperty(n, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
157
|
+
})(), l.styles = Q, l.events = {
|
|
138
158
|
change: "change"
|
|
139
|
-
},
|
|
140
|
-
return
|
|
159
|
+
}, g(n, r), l);
|
|
160
|
+
return u = n;
|
|
141
161
|
})();
|
|
142
162
|
export {
|
|
143
163
|
be as SbbToggleElement
|
package/toggle-check.js
CHANGED
|
@@ -5,7 +5,7 @@ var I = (e, o, c) => o.has(e) || S("Cannot " + c);
|
|
|
5
5
|
var h = (e, o, c) => (I(e, o, "read from private field"), c ? c.call(e) : o.get(e)), d = (e, o, c) => o.has(e) ? S("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(e) : o.set(e, c), k = (e, o, c, a) => (I(e, o, "write to private field"), a ? a.call(e, c) : o.set(e, c), c);
|
|
6
6
|
import { __esDecorate as v, __runInitializers as r } from "tslib";
|
|
7
7
|
import { css as T, LitElement as C, html as E } from "lit";
|
|
8
|
-
import { customElement as D, property as
|
|
8
|
+
import { customElement as D, property as m } from "lit/decorators.js";
|
|
9
9
|
import { slotState as U, forceType as j } from "./core/decorators.js";
|
|
10
10
|
import { isLean as A } from "./core/dom.js";
|
|
11
11
|
import { SbbFormAssociatedCheckboxMixin as F } from "./core/mixins.js";
|
|
@@ -13,8 +13,8 @@ import { SbbIconNameMixin as G } from "./icon.js";
|
|
|
13
13
|
const H = T`@charset "UTF-8";*,:before,:after{box-sizing:border-box}:host{display:inline-block;outline:none!important;--sbb-toggle-check-checked-color: var(--sbb-color-red);--sbb-toggle-check-background-color: var(--sbb-color-cloud);--sbb-toggle-check-icon-color: var(--sbb-toggle-check-checked-color);--sbb-toggle-check-icon-opacity: 0;--sbb-toggle-check-circle-background-color: var(--sbb-color-white);--sbb-toggle-check-circle-border-color: var(--sbb-color-smoke);--sbb-toggle-check-circle-border-style: solid;--sbb-toggle-check-circle-diameter: 1.75rem;--sbb-toggle-check-overall-height: var(--sbb-toggle-check-circle-diameter);--sbb-toggle-check-circle-transform: translate(0, -50%);--sbb-toggle-check-height: 1.5rem;--sbb-toggle-check-width: calc(2 * var(--sbb-toggle-check-height));--sbb-toggle-check-cursor: pointer;--sbb-toggle-check-flex-direction: row-reverse;--sbb-toggle-check-gap: var(--sbb-spacing-fixed-3x);--sbb-toggle-check-animation-duration: var( --sbb-disable-animation-duration, var(--sbb-animation-duration-6x) )}@media (forced-colors: active){:host{--sbb-toggle-check-background-color: CanvasText;--sbb-toggle-check-circle-background-color: Canvas}}:host([size=m]){--sbb-toggle-check-overall-height: calc(1em * var(--sbb-typo-line-height-body-text))}:host([data-checked]){--sbb-toggle-check-background-color: var(--sbb-toggle-check-checked-color);--sbb-toggle-check-circle-border-color: var(--sbb-toggle-check-background-color);--sbb-toggle-check-icon-opacity: 1;--sbb-toggle-check-circle-transform: translate( calc(100% - 2 * (100% - .5 * var(--sbb-toggle-check-width))), -50% )}@media (forced-colors: active){:host([data-checked]){--sbb-toggle-check-icon-color: Highlight;--sbb-toggle-check-background-color: Highlight}}:host(:disabled){--sbb-toggle-check-background-color: var(--sbb-color-cloud);--sbb-toggle-check-circle-border-color: var(--sbb-color-smoke);--sbb-toggle-check-circle-border-style: dashed;--sbb-toggle-check-circle-background-color: var(--sbb-color-milk);--sbb-toggle-check-icon-color: var(--sbb-color-granite);--sbb-toggle-check-cursor: default}@media (forced-colors: active){:host(:disabled){--sbb-toggle-check-icon-color: GrayText;--sbb-toggle-check-background-color: GrayText;--sbb-toggle-check-circle-border-style: solid}}:host([data-checked]:disabled){--sbb-toggle-check-circle-background-color: var(--sbb-color-white)}:host([label-position=before]){--sbb-toggle-check-flex-direction: row}.sbb-toggle-check{position:relative;display:flex;color:var(--sbb-color-charcoal);-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent;cursor:var(--sbb-toggle-check-cursor)}.sbb-toggle-check:before{content:"";-webkit-user-select:none;user-select:none;width:0;height:0}:host(:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch])) .sbb-toggle-check{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))}.sbb-toggle-check__container{--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);display:flex;flex-direction:var(--sbb-toggle-check-flex-direction);gap:var(--sbb-toggle-check-gap);align-items:start;width:100%}:host([size=m]) .sbb-toggle-check__container{--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)}:host([size=xs]) .sbb-toggle-check__container{--sbb-text-font-size: var(--sbb-font-size-text-xs);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)}.sbb-toggle-check__label{flex-grow:1;padding-block-start:calc((var(--sbb-toggle-check-circle-diameter) - var(--sbb-typo-line-height-body-text) * 1em) / 2)}:host(:not([data-slot-names~=unnamed])) .sbb-toggle-check__label{display:none}.sbb-toggle-check__track{display:inline-block;position:relative;min-width:var(--sbb-toggle-check-width);height:var(--sbb-toggle-check-height);border-radius:var(--sbb-border-radius-infinity);background-color:var(--sbb-toggle-check-background-color);margin-block:calc((var(--sbb-toggle-check-overall-height) - var(--sbb-toggle-check-height)) / 2)}.sbb-toggle-check__circle{box-shadow:var(--sbb-shadow-elevation-level-5-shadow-2-offset-x) var(--sbb-shadow-elevation-level-5-shadow-2-offset-y) var(--sbb-shadow-elevation-level-5-shadow-2-blur) var(--sbb-shadow-elevation-level-5-shadow-2-spread) var(--sbb-shadow-elevation-level-5-hard-2-color),var(--sbb-shadow-elevation-level-5-shadow-1-offset-x) var(--sbb-shadow-elevation-level-5-shadow-1-offset-y) var(--sbb-shadow-elevation-level-5-shadow-1-blur) var(--sbb-shadow-elevation-level-5-shadow-1-spread) var(--sbb-shadow-elevation-level-5-hard-1-color);position:absolute;top:50%;transform:translateY(-50%);width:var(--sbb-toggle-check-circle-diameter);height:var(--sbb-toggle-check-circle-diameter);border:var(--sbb-border-width-1x) var(--sbb-toggle-check-circle-border-style) var(--sbb-toggle-check-circle-border-color);border-radius:50%;background-color:var(--sbb-toggle-check-circle-background-color);color:var(--sbb-toggle-check-icon-color);will-change:transform;transform:var(--sbb-toggle-check-circle-transform);transition:transform ease var(--sbb-toggle-check-animation-duration)}.sbb-toggle-check__icon{position:absolute;top:50%;left:50%;transform:translate(-50%,-50%);width:var(--sbb-size-icon-ui-small);height:var(--sbb-size-icon-ui-small);opacity:var(--sbb-toggle-check-icon-opacity);transition:opacity ease var(--sbb-toggle-check-animation-duration)}`;
|
|
14
14
|
let Q = (() => {
|
|
15
15
|
var i, b, n, l;
|
|
16
|
-
let e = [D("sbb-toggle-check"), U()], o, c = [], a,
|
|
17
|
-
return l = class extends
|
|
16
|
+
let e = [D("sbb-toggle-check"), U()], o, c = [], a, f = F(G(C)), u, p = [], _ = [], y, x = [], w = [], z, N = [], P = [];
|
|
17
|
+
return l = class extends f {
|
|
18
18
|
constructor() {
|
|
19
19
|
super(...arguments);
|
|
20
20
|
d(this, i, r(this, p, A() ? "xs" : "s"));
|
|
@@ -66,8 +66,8 @@ let Q = (() => {
|
|
|
66
66
|
`;
|
|
67
67
|
}
|
|
68
68
|
}, i = new WeakMap(), b = new WeakMap(), n = new WeakMap(), a = l, (() => {
|
|
69
|
-
const s = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
70
|
-
u = [
|
|
69
|
+
const s = typeof Symbol == "function" && Symbol.metadata ? Object.create(f[Symbol.metadata] ?? null) : void 0;
|
|
70
|
+
u = [m({ reflect: !0 })], y = [j(), m({ attribute: "icon-name" })], z = [m({ attribute: "label-position", reflect: !0 })], v(l, null, u, { kind: "accessor", name: "size", static: !1, private: !1, access: { has: (t) => "size" in t, get: (t) => t.size, set: (t, g) => {
|
|
71
71
|
t.size = g;
|
|
72
72
|
} }, metadata: s }, p, _), v(l, null, y, { kind: "accessor", name: "iconName", static: !1, private: !1, access: { has: (t) => "iconName" in t, get: (t) => t.iconName, set: (t, g) => {
|
|
73
73
|
t.iconName = g;
|
package/train/train-formation.js
CHANGED
|
@@ -4,7 +4,7 @@ var S = (t) => {
|
|
|
4
4
|
var L = (t, o, s) => o.has(t) || S("Cannot " + s);
|
|
5
5
|
var p = (t, o, s) => (L(t, o, "read from private field"), s ? s.call(t) : o.get(t)), u = (t, o, s) => o.has(t) ? S("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(t) : o.set(t, s), f = (t, o, s, e) => (L(t, o, "write to private field"), e ? e.call(t, s) : o.set(t, s), s);
|
|
6
6
|
import { __esDecorate as _, __runInitializers as m } from "tslib";
|
|
7
|
-
import { css as $, LitElement as E,
|
|
7
|
+
import { css as $, LitElement as E, nothing as A, html as v } from "lit";
|
|
8
8
|
import { customElement as P, property as I, state as N } from "lit/decorators.js";
|
|
9
9
|
import { SbbLanguageController as T } from "../core/controllers.js";
|
|
10
10
|
import { i18nSectorShort as D, i18nSector as j, i18nTrains as O } from "../core/i18n.js";
|
package/train/train.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
var G = (
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var G = (e) => {
|
|
2
|
+
throw TypeError(e);
|
|
3
3
|
};
|
|
4
|
-
var P = (
|
|
5
|
-
var m = (
|
|
4
|
+
var P = (e, a, s) => a.has(e) || G("Cannot " + s);
|
|
5
|
+
var m = (e, a, s) => (P(e, a, "read from private field"), s ? s.call(e) : a.get(e)), g = (e, a, s) => a.has(e) ? G("Cannot add the same private member more than once") : a instanceof WeakSet ? a.add(e) : a.set(e, s), n = (e, a, s, o) => (P(e, a, "write to private field"), o ? o.call(e, s) : a.set(e, s), s);
|
|
6
6
|
import { __runInitializers as l, __esDecorate as f } from "tslib";
|
|
7
7
|
import { css as q, LitElement as B, nothing as y } from "lit";
|
|
8
8
|
import { customElement as F, property as L } from "lit/decorators.js";
|
|
9
|
-
import {
|
|
9
|
+
import { unsafeStatic as W, html as u } from "lit/static-html.js";
|
|
10
10
|
import { SbbLanguageController as H } from "../core/controllers.js";
|
|
11
11
|
import { forceType as x, omitEmptyConverter as J } from "../core/decorators.js";
|
|
12
12
|
import { EventEmitter as K } from "../core/eventing.js";
|
|
@@ -16,7 +16,7 @@ import "../icon.js";
|
|
|
16
16
|
const X = q`*,:before,:after{box-sizing:border-box}:host{display:block;--sbb-train-direction-label-spacing: var(--sbb-spacing-fixed-1x)}.sbb-train{--sbb-text-font-size: var(--sbb-font-size-text-xs);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:flex;flex-direction:column;gap:var(--sbb-train-formation-vertical-gap);position:relative}.sbb-train:before{content:"";display:var(--sbb-train-formation-reserve-spacing-display, none);height:max(var(--sbb-size-icon-ui-small),1em * var(--sbb-typo-line-height-body-text))}.sbb-train__wagons{list-style:none;margin:0;padding:0;font-size:inherit;display:flex;gap:var(--sbb-train-formation-wagon-gap)}.sbb-train__direction-heading{display:flex;position:absolute;width:100%}.sbb-train__direction-sticky-wrapper{position:sticky;inset-inline-start:0;display:inline-flex;align-items:center;gap:var(--sbb-train-direction-label-spacing);max-width:100%}.sbb-train__direction-label{overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.sbb-train__direction-label-sr{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}`;
|
|
17
17
|
let bt = (() => {
|
|
18
18
|
var b, d, h, _, p, r;
|
|
19
|
-
let
|
|
19
|
+
let e = [F("sbb-train")], a, s = [], o, w = V(B), z, S = [], $ = [], k, E = [], C = [], I, T = [], D = [], A, j = [], N = [], M, O = [], U = [];
|
|
20
20
|
var v = (r = class extends w {
|
|
21
21
|
constructor() {
|
|
22
22
|
super(...arguments);
|
|
@@ -37,54 +37,54 @@ let bt = (() => {
|
|
|
37
37
|
get directionLabel() {
|
|
38
38
|
return m(this, b);
|
|
39
39
|
}
|
|
40
|
-
set directionLabel(
|
|
41
|
-
n(this, b,
|
|
40
|
+
set directionLabel(i) {
|
|
41
|
+
n(this, b, i);
|
|
42
42
|
}
|
|
43
43
|
/** Heading level of the direction label, used for screen readers. */
|
|
44
44
|
get directionLabelLevel() {
|
|
45
45
|
return m(this, d);
|
|
46
46
|
}
|
|
47
|
-
set directionLabelLevel(
|
|
48
|
-
n(this, d,
|
|
47
|
+
set directionLabelLevel(i) {
|
|
48
|
+
n(this, d, i);
|
|
49
49
|
}
|
|
50
50
|
/** Label for the destination station of the train. */
|
|
51
51
|
get station() {
|
|
52
52
|
return m(this, h);
|
|
53
53
|
}
|
|
54
|
-
set station(
|
|
55
|
-
n(this, h,
|
|
54
|
+
set station(i) {
|
|
55
|
+
n(this, h, i);
|
|
56
56
|
}
|
|
57
57
|
/** Accessibility label for additional information regarding the leaving direction of the train. */
|
|
58
58
|
get accessibilityLabel() {
|
|
59
59
|
return m(this, _);
|
|
60
60
|
}
|
|
61
|
-
set accessibilityLabel(
|
|
62
|
-
n(this, _,
|
|
61
|
+
set accessibilityLabel(i) {
|
|
62
|
+
n(this, _, i);
|
|
63
63
|
}
|
|
64
64
|
/** Controls the direction indicator to show the arrow left or right. Default is left. */
|
|
65
65
|
get direction() {
|
|
66
66
|
return m(this, p);
|
|
67
67
|
}
|
|
68
|
-
set direction(
|
|
69
|
-
n(this, p,
|
|
68
|
+
set direction(i) {
|
|
69
|
+
n(this, p, i);
|
|
70
70
|
}
|
|
71
71
|
/**
|
|
72
72
|
* Create the aria-label text out of the direction label, station and the accessibility label.
|
|
73
73
|
*/
|
|
74
74
|
_getDirectionAriaLabel() {
|
|
75
|
-
const
|
|
76
|
-
return this.directionLabel && this.station &&
|
|
75
|
+
const i = [Q[this._language.current]];
|
|
76
|
+
return this.directionLabel && this.station && i.push(`${this.directionLabel} ${this.station}`), this.accessibilityLabel && i.push(this.accessibilityLabel), `${i.join(", ")}.`;
|
|
77
77
|
}
|
|
78
|
-
willUpdate(
|
|
79
|
-
super.willUpdate(
|
|
78
|
+
willUpdate(i) {
|
|
79
|
+
super.willUpdate(i), i.has("listChildren") && this._trainSlotChange.emit();
|
|
80
80
|
}
|
|
81
81
|
render() {
|
|
82
|
-
const
|
|
82
|
+
const i = `h${this.directionLabelLevel}`;
|
|
83
83
|
return u`
|
|
84
84
|
<div class="sbb-train">
|
|
85
|
-
<${W(
|
|
85
|
+
<${W(i)} class="sbb-train__direction-label-sr">
|
|
86
86
|
${this._getDirectionAriaLabel()}
|
|
87
|
-
</${W(
|
|
87
|
+
</${W(i)}>
|
|
88
88
|
${this.directionLabel ? u`<div class="sbb-train__direction-heading" aria-hidden="true">
|
|
89
89
|
<span class="sbb-train__direction-sticky-wrapper">
|
|
90
90
|
${this.direction === "left" ? u`<sbb-icon name="chevron-small-left-small"></sbb-icon>` : y}
|
|
@@ -104,18 +104,18 @@ let bt = (() => {
|
|
|
104
104
|
`;
|
|
105
105
|
}
|
|
106
106
|
}, b = new WeakMap(), d = new WeakMap(), h = new WeakMap(), _ = new WeakMap(), p = new WeakMap(), o = r, (() => {
|
|
107
|
-
const
|
|
107
|
+
const i = typeof Symbol == "function" && Symbol.metadata ? Object.create(w[Symbol.metadata] ?? null) : void 0;
|
|
108
108
|
z = [x(), L({ attribute: "direction-label", reflect: !0, converter: J })], k = [L({ attribute: "direction-label-level" })], I = [x(), L()], A = [x(), L({ attribute: "accessibility-label" })], M = [L({ reflect: !0 })], f(r, null, z, { kind: "accessor", name: "directionLabel", static: !1, private: !1, access: { has: (t) => "directionLabel" in t, get: (t) => t.directionLabel, set: (t, c) => {
|
|
109
109
|
t.directionLabel = c;
|
|
110
|
-
} }, metadata:
|
|
110
|
+
} }, metadata: i }, S, $), f(r, null, k, { kind: "accessor", name: "directionLabelLevel", static: !1, private: !1, access: { has: (t) => "directionLabelLevel" in t, get: (t) => t.directionLabelLevel, set: (t, c) => {
|
|
111
111
|
t.directionLabelLevel = c;
|
|
112
|
-
} }, metadata:
|
|
112
|
+
} }, metadata: i }, E, C), f(r, null, I, { kind: "accessor", name: "station", static: !1, private: !1, access: { has: (t) => "station" in t, get: (t) => t.station, set: (t, c) => {
|
|
113
113
|
t.station = c;
|
|
114
|
-
} }, metadata:
|
|
114
|
+
} }, metadata: i }, T, D), f(r, null, A, { kind: "accessor", name: "accessibilityLabel", static: !1, private: !1, access: { has: (t) => "accessibilityLabel" in t, get: (t) => t.accessibilityLabel, set: (t, c) => {
|
|
115
115
|
t.accessibilityLabel = c;
|
|
116
|
-
} }, metadata:
|
|
116
|
+
} }, metadata: i }, j, N), f(r, null, M, { kind: "accessor", name: "direction", static: !1, private: !1, access: { has: (t) => "direction" in t, get: (t) => t.direction, set: (t, c) => {
|
|
117
117
|
t.direction = c;
|
|
118
|
-
} }, metadata:
|
|
118
|
+
} }, metadata: i }, O, U), f(null, a = { value: o }, e, { kind: "class", name: o.name, metadata: i }, null, s), v = o = a.value, i && Object.defineProperty(o, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: i });
|
|
119
119
|
})(), r.styles = X, r.events = {
|
|
120
120
|
trainSlotChange: "trainSlotChange"
|
|
121
121
|
}, l(o, s), r);
|
package/visual-checkbox.js
CHANGED
|
@@ -4,7 +4,7 @@ var C = (e) => {
|
|
|
4
4
|
var I = (e, o, i) => o.has(e) || C("Cannot " + i);
|
|
5
5
|
var h = (e, o, i) => (I(e, o, "read from private field"), i ? i.call(e) : o.get(e)), u = (e, o, i) => o.has(e) ? C("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(e) : o.set(e, i), v = (e, o, i, t) => (I(e, o, "write to private field"), t ? t.call(e, i) : o.set(e, i), i);
|
|
6
6
|
import { __esDecorate as k, __runInitializers as r } from "tslib";
|
|
7
|
-
import { css as j, LitElement as D,
|
|
7
|
+
import { css as j, LitElement as D, nothing as E, html as L } from "lit";
|
|
8
8
|
import { customElement as M, property as m } from "lit/decorators.js";
|
|
9
9
|
import { forceType as T } from "./core/decorators.js";
|
|
10
10
|
import { isLean as $ } from "./core/dom.js";
|