@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
package/card/card-badge.js
CHANGED
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as n, LitElement as i, html as l } from "lit";
|
|
2
|
+
import { property as p, customElement as g } from "lit/decorators.js";
|
|
3
3
|
import { hostAttributes as f } from "../core/decorators.js";
|
|
4
4
|
import { getDocumentWritingMode as h } from "../core/dom.js";
|
|
5
|
-
const v =
|
|
6
|
-
var
|
|
7
|
-
for (var
|
|
8
|
-
(s = d[
|
|
9
|
-
return a &&
|
|
5
|
+
const v = n`*,:before,:after{box-sizing:border-box}:host{--sbb-card-badge-gap: var(--sbb-spacing-fixed-2x);display:block}:host([color=white]){--sbb-card-badge-color: var(--sbb-color-charcoal);--sbb-card-badge-background-color: var(--sbb-color-white);--sbb-card-badge-border-color: var(--sbb-color-aluminium)}:host([color=charcoal]){--sbb-card-badge-color: var(--sbb-color-white);--sbb-card-badge-background-color: var(--sbb-color-charcoal);--sbb-card-badge-border-color: transparent}.sbb-card-badge-wrapper{display:flex;position:relative;height:fit-content;justify-content:end}@media (forced-colors: active){.sbb-card-badge-wrapper:after{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border-block-end:var(--sbb-border-width-1x) solid CanvasText}}.sbb-card-badge{position:relative;display:flex;inset-block-start:0;inset-inline-end:0;padding-inline:var(--sbb-spacing-fixed-2x) var(--sbb-spacing-fixed-3x)}.sbb-card-badge-content{--sbb-text-font-size: var(--sbb-font-size-text-xxs);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;position:relative;display:flex;align-items:center;gap:var(--sbb-card-badge-gap);color:var(--sbb-card-badge-color)}.sbb-card-badge-background{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;background-color:var(--sbb-card-badge-background-color);border-end-start-radius:var(--sbb-border-radius-4x);margin-inline-end:calc(var(--sbb-spacing-fixed-3x) * -1);transform:skew(16deg)}:host([dir=rtl]) .sbb-card-badge-background{transform:skew(-16deg)}.sbb-card-badge-background:before{content:"";display:block;position:absolute;top:0;right:0;bottom:0;left:0;border-block-end:var(--sbb-border-width-1x) solid var(--sbb-card-badge-border-color);border-inline-start:var(--sbb-border-width-1x) solid var(--sbb-card-badge-border-color);border-end-start-radius:var(--sbb-border-radius-4x)}@media (forced-colors: active){.sbb-card-badge-background:before{border:none}}`;
|
|
6
|
+
var m = Object.defineProperty, u = Object.getOwnPropertyDescriptor, c = (d, r, o, a) => {
|
|
7
|
+
for (var e = a > 1 ? void 0 : a ? u(r, o) : r, b = d.length - 1, s; b >= 0; b--)
|
|
8
|
+
(s = d[b]) && (e = (a ? s(r, o, e) : s(e)) || e);
|
|
9
|
+
return a && e && m(r, o, e), e;
|
|
10
10
|
};
|
|
11
|
-
let
|
|
11
|
+
let t = class extends i {
|
|
12
12
|
constructor() {
|
|
13
13
|
super(...arguments), this.color = "charcoal";
|
|
14
14
|
}
|
|
15
15
|
connectedCallback() {
|
|
16
|
-
super.connectedCallback(), this.
|
|
16
|
+
super.connectedCallback(), this._parentElement = this.parentElement, this._parentElement && this._parentElement.toggleAttribute("data-has-card-badge", !0);
|
|
17
17
|
}
|
|
18
18
|
disconnectedCallback() {
|
|
19
|
-
super.disconnectedCallback(), this.
|
|
19
|
+
super.disconnectedCallback(), this._parentElement && this._parentElement.removeAttribute("data-has-card-badge"), this._parentElement = void 0;
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
22
22
|
return l`
|
|
@@ -31,18 +31,18 @@ let o = class extends n {
|
|
|
31
31
|
`;
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
|
-
|
|
34
|
+
t.styles = v;
|
|
35
35
|
c([
|
|
36
|
-
|
|
37
|
-
],
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
p({ reflect: !0 })
|
|
37
|
+
], t.prototype, "color", 2);
|
|
38
|
+
t = c([
|
|
39
|
+
g("sbb-card-badge"),
|
|
40
40
|
f({
|
|
41
41
|
slot: "badge",
|
|
42
42
|
role: "text",
|
|
43
43
|
dir: h()
|
|
44
44
|
})
|
|
45
|
-
],
|
|
45
|
+
], t);
|
|
46
46
|
export {
|
|
47
|
-
|
|
47
|
+
t as SbbCardBadgeElement
|
|
48
48
|
};
|
package/card/card.js
CHANGED
|
@@ -15,7 +15,7 @@ let r = class extends v {
|
|
|
15
15
|
*
|
|
16
16
|
* @returns True whether size is equal to m, l, xl or xxl.
|
|
17
17
|
*/
|
|
18
|
-
|
|
18
|
+
_isBadgeVisible() {
|
|
19
19
|
return ["m", "l", "xl", "xxl", "xxxl"].includes(this.size);
|
|
20
20
|
}
|
|
21
21
|
render() {
|
|
@@ -25,7 +25,7 @@ let r = class extends v {
|
|
|
25
25
|
<span class="sbb-card__wrapper">
|
|
26
26
|
<slot></slot>
|
|
27
27
|
</span>
|
|
28
|
-
${this.
|
|
28
|
+
${this._isBadgeVisible() ? c`<span class="sbb-card__badge-wrapper">
|
|
29
29
|
<slot name="badge"></slot>
|
|
30
30
|
</span>` : p}
|
|
31
31
|
</span>
|
package/card/common.js
CHANGED
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import { property as
|
|
2
|
-
import { html as
|
|
1
|
+
import { property as n } from "lit/decorators.js";
|
|
2
|
+
import { html as b } from "lit/static-html.js";
|
|
3
3
|
import { IS_FOCUSABLE_QUERY as l } from "../core/a11y.js";
|
|
4
|
-
import { hostAttributes as
|
|
5
|
-
import { AgnosticMutationObserver as
|
|
4
|
+
import { hostAttributes as d } from "../core/decorators.js";
|
|
5
|
+
import { AgnosticMutationObserver as u } from "../core/observers.js";
|
|
6
6
|
import { css as h } from "lit";
|
|
7
7
|
import "../screen-reader-only.js";
|
|
8
8
|
const f = h`*,:before,:after{box-sizing:border-box}:host{display:block;outline:none!important;position:absolute;top:0;right:0;bottom:0;left:0}:is(.sbb-card-button,.sbb-card-link){display:block;position:absolute;top:0;right:0;bottom:0;left:0;border-radius:var(--sbb-card-border-radius);cursor:pointer;outline:none}:host(:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch])) :is(.sbb-card-button,.sbb-card-link),:host(:not([data-focus-origin=mouse],[data-focus-origin=touch])) :is(.sbb-card-button,.sbb-card-link):focus-visible{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width)}`;
|
|
9
|
-
var m = Object.defineProperty,
|
|
10
|
-
for (var
|
|
11
|
-
(i =
|
|
12
|
-
return
|
|
9
|
+
var m = Object.defineProperty, _ = Object.getOwnPropertyDescriptor, c = (s, e, t, r) => {
|
|
10
|
+
for (var o = r > 1 ? void 0 : r ? _(e, t) : e, a = s.length - 1, i; a >= 0; a--)
|
|
11
|
+
(i = s[a]) && (o = (r ? i(e, t, o) : i(o)) || o);
|
|
12
|
+
return r && o && m(e, t, o), o;
|
|
13
13
|
};
|
|
14
|
-
const
|
|
15
|
-
let
|
|
14
|
+
const S = (s) => {
|
|
15
|
+
let e = class extends s {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(...arguments), this.
|
|
18
|
-
() => this.
|
|
17
|
+
super(...arguments), this._active = !1, this._card = null, this._cardMutationObserver = new u(
|
|
18
|
+
() => this._checkForSlottedActions()
|
|
19
19
|
);
|
|
20
20
|
}
|
|
21
21
|
set active(t) {
|
|
22
|
-
this.
|
|
22
|
+
this._active = t, this._onActiveChange();
|
|
23
23
|
}
|
|
24
24
|
get active() {
|
|
25
|
-
return this.
|
|
25
|
+
return this._active;
|
|
26
26
|
}
|
|
27
|
-
|
|
28
|
-
this.
|
|
27
|
+
_onActiveChange() {
|
|
28
|
+
this._card && this._card.toggleAttribute("data-has-active-action", this.active);
|
|
29
29
|
}
|
|
30
|
-
|
|
31
|
-
var
|
|
30
|
+
_checkForSlottedActions() {
|
|
31
|
+
var r, o;
|
|
32
32
|
const t = "data-card-focusable";
|
|
33
|
-
Array.from(((
|
|
33
|
+
Array.from(((o = (r = this._card) == null ? void 0 : r.querySelectorAll) == null ? void 0 : o.call(r, l)) ?? []).filter(
|
|
34
34
|
(a) => a.localName !== "sbb-card-link" && a.localName !== "sbb-card-button" && !a.hasAttribute(t)
|
|
35
35
|
).forEach((a) => a.setAttribute(t, ""));
|
|
36
36
|
}
|
|
37
37
|
connectedCallback() {
|
|
38
38
|
var t;
|
|
39
|
-
super.connectedCallback(), this.
|
|
39
|
+
super.connectedCallback(), this._card = (t = this.closest) == null ? void 0 : t.call(this, "sbb-card"), this._card && (this._card.toggleAttribute("data-has-action", !0), this._card.toggleAttribute("data-has-active-action", this.active), this._card.setAttribute("data-action-role", this.actionRole), this._checkForSlottedActions(), this._cardMutationObserver.observe(this._card, {
|
|
40
40
|
childList: !0,
|
|
41
41
|
subtree: !0
|
|
42
42
|
}));
|
|
43
43
|
}
|
|
44
44
|
disconnectedCallback() {
|
|
45
|
-
super.disconnectedCallback(), this.
|
|
46
|
-
(t) => this.
|
|
47
|
-
), this.
|
|
45
|
+
super.disconnectedCallback(), this._card && (["data-has-action", "data-has-active-action", "data-action-role"].forEach(
|
|
46
|
+
(t) => this._card.removeAttribute(t)
|
|
47
|
+
), this._card.querySelectorAll("[data-card-focusable]").forEach((t) => t.removeAttribute("data-card-focusable")), this._card = null), this._cardMutationObserver.disconnect();
|
|
48
48
|
}
|
|
49
49
|
renderTemplate() {
|
|
50
|
-
return
|
|
50
|
+
return b`
|
|
51
51
|
<sbb-screen-reader-only>
|
|
52
52
|
<slot></slot>
|
|
53
53
|
</sbb-screen-reader-only>
|
|
54
54
|
`;
|
|
55
55
|
}
|
|
56
56
|
};
|
|
57
|
-
return
|
|
58
|
-
|
|
59
|
-
],
|
|
60
|
-
|
|
57
|
+
return e.styles = f, c([
|
|
58
|
+
n({ reflect: !0, type: Boolean })
|
|
59
|
+
], e.prototype, "active", 1), e = c([
|
|
60
|
+
d({
|
|
61
61
|
slot: "action"
|
|
62
62
|
})
|
|
63
|
-
],
|
|
63
|
+
], e), e;
|
|
64
64
|
};
|
|
65
65
|
export {
|
|
66
|
-
|
|
66
|
+
S as SbbCardActionCommonElementMixin
|
|
67
67
|
};
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import { css as h, LitElement as l, html as
|
|
2
|
-
import { property as s, customElement as
|
|
1
|
+
import { css as h, LitElement as l, html as d } from "lit";
|
|
2
|
+
import { property as s, customElement as p } from "lit/decorators.js";
|
|
3
3
|
import { interactivityChecker as x, isArrowKeyPressed as u, getNextElementIndex as m } from "../core/a11y.js";
|
|
4
4
|
import { SbbConnectedAbortController as g, SbbSlotStateController as k } from "../core/controllers.js";
|
|
5
5
|
import { SbbDisabledMixin as f } from "../core/mixins.js";
|
|
6
6
|
const w = h`*,:before,:after{box-sizing:border-box}:host{--sbb-checkbox-group-orientation: row;--sbb-checkbox-group-checkbox-width: auto;--sbb-checkbox-group-width: max-content;--sbb-checkbox-group-gap: var(--sbb-spacing-fixed-3x) var(--sbb-spacing-fixed-6x);display:block}:host([orientation=vertical]){--sbb-checkbox-group-orientation: column;--sbb-checkbox-group-width: 100%;--sbb-checkbox-group-checkbox-width: 100%}:host([data-has-selection-panel]){--sbb-checkbox-group-width: 100%}:host([data-has-selection-panel][orientation=vertical]){--sbb-checkbox-group-gap: var(--sbb-spacing-fixed-2x) var(--sbb-spacing-fixed-4x)}@media (min-width: 0rem){:host([orientation=vertical][horizontal-from=zero]){--sbb-checkbox-group-orientation: row;--sbb-checkbox-group-checkbox-width: auto}:host([orientation=vertical][horizontal-from=zero]:not([data-has-selection-panel])){--sbb-checkbox-group-width: max-content}}@media (min-width: 22.5rem){:host([orientation=vertical][horizontal-from=micro]){--sbb-checkbox-group-orientation: row;--sbb-checkbox-group-checkbox-width: auto}:host([orientation=vertical][horizontal-from=micro]:not([data-has-selection-panel])){--sbb-checkbox-group-width: max-content}}@media (min-width: 37.5rem){:host([orientation=vertical][horizontal-from=small]){--sbb-checkbox-group-orientation: row;--sbb-checkbox-group-checkbox-width: auto}:host([orientation=vertical][horizontal-from=small]:not([data-has-selection-panel])){--sbb-checkbox-group-width: max-content}}@media (min-width: 52.5rem){:host([orientation=vertical][horizontal-from=medium]){--sbb-checkbox-group-orientation: row;--sbb-checkbox-group-checkbox-width: auto}:host([orientation=vertical][horizontal-from=medium]:not([data-has-selection-panel])){--sbb-checkbox-group-width: max-content}}@media (min-width: 64rem){:host([orientation=vertical][horizontal-from=large]){--sbb-checkbox-group-orientation: row;--sbb-checkbox-group-checkbox-width: auto}:host([orientation=vertical][horizontal-from=large]:not([data-has-selection-panel])){--sbb-checkbox-group-width: max-content}}@media (min-width: 80rem){:host([orientation=vertical][horizontal-from=wide]){--sbb-checkbox-group-orientation: row;--sbb-checkbox-group-checkbox-width: auto}:host([orientation=vertical][horizontal-from=wide]:not([data-has-selection-panel])){--sbb-checkbox-group-width: max-content}}@media (min-width: 90rem){:host([orientation=vertical][horizontal-from=ultra]){--sbb-checkbox-group-orientation: row;--sbb-checkbox-group-checkbox-width: auto}:host([orientation=vertical][horizontal-from=ultra]:not([data-has-selection-panel])){--sbb-checkbox-group-width: max-content}}.sbb-checkbox-group{display:flex;flex-direction:var(--sbb-checkbox-group-orientation);gap:var(--sbb-checkbox-group-gap);align-items:flex-start;width:var(--sbb-checkbox-group-width)}.sbb-checkbox-group__error{display:inline-block;margin-block-start:var(--sbb-spacing-fixed-1x)}:host(:not([data-slot-names~=error])) .sbb-checkbox-group__error{display:none}::slotted(sbb-checkbox){width:var(--sbb-checkbox-group-checkbox-width)}`;
|
|
7
|
-
var v = Object.defineProperty, z = Object.getOwnPropertyDescriptor,
|
|
8
|
-
for (var i = r > 1 ? void 0 : r ? z(o, e) : o,
|
|
9
|
-
(c = t[
|
|
7
|
+
var v = Object.defineProperty, z = Object.getOwnPropertyDescriptor, b = (t, o, e, r) => {
|
|
8
|
+
for (var i = r > 1 ? void 0 : r ? z(o, e) : o, n = t.length - 1, c; n >= 0; n--)
|
|
9
|
+
(c = t[n]) && (i = (r ? c(o, e, i) : c(i)) || i);
|
|
10
10
|
return r && i && v(o, e, i), i;
|
|
11
11
|
};
|
|
12
12
|
let a = class extends f(l) {
|
|
13
13
|
constructor() {
|
|
14
|
-
super(), this.required = !1, this.size = "m", this.orientation = "horizontal", this.
|
|
14
|
+
super(), this.required = !1, this.size = "m", this.orientation = "horizontal", this._abort = new g(this), new k(this);
|
|
15
15
|
}
|
|
16
16
|
/** List of contained checkbox elements. */
|
|
17
17
|
get checkboxes() {
|
|
@@ -23,8 +23,8 @@ let a = class extends f(l) {
|
|
|
23
23
|
connectedCallback() {
|
|
24
24
|
var o;
|
|
25
25
|
super.connectedCallback();
|
|
26
|
-
const t = this.
|
|
27
|
-
this.addEventListener("keydown", (e) => this.
|
|
26
|
+
const t = this._abort.signal;
|
|
27
|
+
this.addEventListener("keydown", (e) => this._handleKeyDown(e), { signal: t }), this.toggleAttribute("data-has-selection-panel", !!((o = this.querySelector) != null && o.call(this, "sbb-selection-panel")));
|
|
28
28
|
}
|
|
29
29
|
willUpdate(t) {
|
|
30
30
|
super.willUpdate(t), t.has("disabled") && this.checkboxes.forEach((o) => {
|
|
@@ -38,7 +38,7 @@ let a = class extends f(l) {
|
|
|
38
38
|
return (e = o.requestUpdate) == null ? void 0 : e.call(o, "size");
|
|
39
39
|
});
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
_handleKeyDown(t) {
|
|
42
42
|
var e;
|
|
43
43
|
const o = this.checkboxes.filter(
|
|
44
44
|
(r) => !r.disabled && x.isVisible(r)
|
|
@@ -46,13 +46,13 @@ let a = class extends f(l) {
|
|
|
46
46
|
if (!(!o || // don't trap nested handling
|
|
47
47
|
t.target !== this && t.target.parentElement !== this && t.target.parentElement.nodeName !== "SBB-SELECTION-PANEL") && u(t)) {
|
|
48
48
|
const r = o.findIndex(
|
|
49
|
-
(
|
|
49
|
+
(n) => n === t.target
|
|
50
50
|
), i = m(t, r, o.length);
|
|
51
51
|
(e = o[i]) == null || e.focus();
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
54
|
render() {
|
|
55
|
-
return
|
|
55
|
+
return d`
|
|
56
56
|
<div class="sbb-checkbox-group">
|
|
57
57
|
<slot></slot>
|
|
58
58
|
</div>
|
|
@@ -63,20 +63,20 @@ let a = class extends f(l) {
|
|
|
63
63
|
}
|
|
64
64
|
};
|
|
65
65
|
a.styles = w;
|
|
66
|
-
|
|
66
|
+
b([
|
|
67
67
|
s({ reflect: !0, type: Boolean })
|
|
68
68
|
], a.prototype, "required", 2);
|
|
69
|
-
|
|
69
|
+
b([
|
|
70
70
|
s()
|
|
71
71
|
], a.prototype, "size", 2);
|
|
72
|
-
|
|
72
|
+
b([
|
|
73
73
|
s({ attribute: "horizontal-from", reflect: !0 })
|
|
74
74
|
], a.prototype, "horizontalFrom", 2);
|
|
75
|
-
|
|
75
|
+
b([
|
|
76
76
|
s({ reflect: !0 })
|
|
77
77
|
], a.prototype, "orientation", 2);
|
|
78
|
-
a =
|
|
79
|
-
|
|
78
|
+
a = b([
|
|
79
|
+
p("sbb-checkbox-group")
|
|
80
80
|
], a);
|
|
81
81
|
export {
|
|
82
82
|
a as SbbCheckboxGroupElement
|
package/checkbox/checkbox.js
CHANGED
|
@@ -1,42 +1,42 @@
|
|
|
1
1
|
import { css as h, LitElement as d, html as p } from "lit";
|
|
2
|
-
import { property as c, state as u, customElement as
|
|
3
|
-
import { SbbLanguageController as
|
|
2
|
+
import { property as c, state as u, customElement as x } from "lit/decorators.js";
|
|
3
|
+
import { SbbLanguageController as f, SbbSlotStateController as m } from "../core/controllers.js";
|
|
4
4
|
import { EventEmitter as r } from "../core/eventing.js";
|
|
5
|
-
import { i18nExpanded as
|
|
6
|
-
import { SbbUpdateSchedulerMixin as
|
|
5
|
+
import { i18nExpanded as g, i18nCollapsed as k } from "../core/i18n.js";
|
|
6
|
+
import { SbbUpdateSchedulerMixin as _, SbbFormAssociatedCheckboxMixin as v, SbbHydrationMixin as y } from "../core/mixins.js";
|
|
7
7
|
import { SbbIconNameMixin as w } from "../icon.js";
|
|
8
8
|
import "../screen-reader-only.js";
|
|
9
9
|
import "../visual-checkbox.js";
|
|
10
|
-
const
|
|
11
|
-
var
|
|
12
|
-
for (var i =
|
|
13
|
-
(l = e[
|
|
14
|
-
return
|
|
10
|
+
const E = h`@charset "UTF-8";*,:before,:after{box-sizing:border-box}:host{--sbb-checkbox-dimension: var(--sbb-size-icon-ui-small);--sbb-checkbox-label-color: var(--sbb-color-charcoal);--sbb-checkbox-label-icon-color: var(--sbb-color-charcoal);--sbb-checkbox-cursor: pointer;--sbb-checkbox-suffix-color: var(--sbb-color-charcoal);--sbb-checkbox-subtext-color: var(--sbb-color-granite);--sbb-checkbox-label-gap: var(--sbb-spacing-fixed-2x);display:inline-block;outline:none!important}:host(:disabled){--sbb-checkbox-cursor: default;--sbb-checkbox-label-color: var(--sbb-color-granite)}:host([data-is-selection-panel-input]){--sbb-checkbox-label-gap: 0}:host(:not([data-is-inside-selection-panel])) :is(slot[name=subtext],slot[name=suffix]){display:none}slot[name=suffix]{color:var(--sbb-checkbox-suffix-color)}slot[name=subtext]{display:block;color:var(--sbb-checkbox-subtext-color);padding-inline-start:var(--sbb-spacing-fixed-8x)}:host(:not([data-slot-names~=subtext])) slot[name=subtext]{display:none}.sbb-checkbox-wrapper{display:flex}.sbb-checkbox-wrapper: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],[data-is-selection-panel-input])) .sbb-checkbox-wrapper{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-checkbox{--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);position:relative;display:block;width:100%;cursor:var(--sbb-checkbox-cursor);-webkit-user-select:none;user-select:none;-webkit-tap-highlight-color:transparent}:host([size=m]) .sbb-checkbox{--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)}.sbb-checkbox__inner{display:flex;align-items:start;gap:var(--sbb-spacing-fixed-2x)}:host([data-is-selection-panel-input]:focus-visible:not([data-focus-origin=mouse],[data-focus-origin=touch])) .sbb-checkbox__inner:before{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))}.sbb-checkbox__aligner,.sbb-checkbox__label--icon{display:flex;align-items:center;height:calc(1em * var(--sbb-typo-line-height-body-text))}.sbb-checkbox__label--icon{color:var(--sbb-checkbox-label-icon-color)}:host([icon-placement=end]) .sbb-checkbox__label--icon{margin-inline-start:auto}:host(:is(:not([icon-name],[data-slot-names~=icon]),[data-is-selection-panel-input])) .sbb-checkbox__label--icon{display:none}.sbb-checkbox__label{display:flex;gap:var(--sbb-checkbox-label-gap);color:var(--sbb-checkbox-label-color);line-height:max(1em * var(--sbb-typo-line-height-body-text),var(--sbb-checkbox-dimension))}:host([icon-placement=start]) .sbb-checkbox__label{flex-direction:row-reverse;justify-content:flex-end}:host([icon-placement=end]) .sbb-checkbox__label{justify-content:flex-start;flex-grow:1}:host(:not([data-is-selection-panel-input][data-has-selection-panel-label])) .sbb-checkbox__expanded-label{display:none}`;
|
|
11
|
+
var z = Object.defineProperty, C = Object.getOwnPropertyDescriptor, a = (e, s, o, n) => {
|
|
12
|
+
for (var i = n > 1 ? void 0 : n ? C(s, o) : s, b = e.length - 1, l; b >= 0; b--)
|
|
13
|
+
(l = e[b]) && (i = (n ? l(s, o, i) : l(i)) || i);
|
|
14
|
+
return n && i && z(s, o, i), i;
|
|
15
15
|
};
|
|
16
|
-
let t = class extends
|
|
17
|
-
|
|
16
|
+
let t = class extends _(
|
|
17
|
+
v(w(y(d)))
|
|
18
18
|
) {
|
|
19
19
|
constructor() {
|
|
20
|
-
super(), this.indeterminate = !1, this.iconPlacement = "end", this.
|
|
20
|
+
super(), this.indeterminate = !1, this.iconPlacement = "end", this._size = "m", this._group = null, this._language = new f(this), this._selectionPanelElement = null, this._stateChange = new r(
|
|
21
21
|
this,
|
|
22
22
|
t.events.stateChange,
|
|
23
23
|
{ bubbles: !0 }
|
|
24
|
-
), this.
|
|
24
|
+
), this._checkboxLoaded = new r(
|
|
25
25
|
this,
|
|
26
26
|
t.events.checkboxLoaded,
|
|
27
27
|
{ bubbles: !0 }
|
|
28
28
|
), new m(this);
|
|
29
29
|
}
|
|
30
30
|
set size(e) {
|
|
31
|
-
this.
|
|
31
|
+
this._size = e;
|
|
32
32
|
}
|
|
33
33
|
get size() {
|
|
34
34
|
var e;
|
|
35
|
-
return ((e = this.group) == null ? void 0 : e.size) ?? this.
|
|
35
|
+
return ((e = this.group) == null ? void 0 : e.size) ?? this._size;
|
|
36
36
|
}
|
|
37
37
|
/** Reference to the connected checkbox group. */
|
|
38
38
|
get group() {
|
|
39
|
-
return this.
|
|
39
|
+
return this._group;
|
|
40
40
|
}
|
|
41
41
|
/**
|
|
42
42
|
* Whether the input is the main input of a selection panel.
|
|
@@ -47,17 +47,17 @@ let t = class extends g(
|
|
|
47
47
|
}
|
|
48
48
|
connectedCallback() {
|
|
49
49
|
var e, s;
|
|
50
|
-
super.connectedCallback(), this.
|
|
50
|
+
super.connectedCallback(), this._group = this.closest("sbb-checkbox-group"), this._selectionPanelElement = (e = this.closest) == null ? void 0 : e.call(this, "sbb-selection-panel"), this.toggleAttribute("data-is-inside-selection-panel", !!this._selectionPanelElement), this.toggleAttribute(
|
|
51
51
|
"data-is-selection-panel-input",
|
|
52
|
-
!!this.
|
|
53
|
-
), this.
|
|
52
|
+
!!this._selectionPanelElement && !((s = this.closest) != null && s.call(this, 'sbb-selection-panel [slot="content"]'))
|
|
53
|
+
), this._checkboxLoaded.emit(), ["disabled", "required", "size"].forEach((o) => this.requestUpdate(o));
|
|
54
54
|
}
|
|
55
55
|
async willUpdate(e) {
|
|
56
|
-
super.willUpdate(e), e.has("checked") && this.isSelectionPanelInput && this.checked !== e.get("checked") && (this.
|
|
56
|
+
super.willUpdate(e), e.has("checked") && this.isSelectionPanelInput && this.checked !== e.get("checked") && (this._stateChange.emit({ type: "checked", checked: this.checked }), this._updateExpandedLabel()), e.has("disabled") && this.isSelectionPanelInput && this.disabled !== e.get("disabled") && this._stateChange.emit({ type: "disabled", disabled: this.disabled }), (e.has("checked") || e.has("indeterminate")) && (this.internals.ariaChecked = this.indeterminate ? "mixed" : `${this.checked}`);
|
|
57
57
|
}
|
|
58
58
|
firstUpdated(e) {
|
|
59
59
|
super.firstUpdated(e), this.startUpdate(), setTimeout(() => {
|
|
60
|
-
this.isSelectionPanelInput && this.
|
|
60
|
+
this.isSelectionPanelInput && this._updateExpandedLabel(), this.completeUpdate();
|
|
61
61
|
});
|
|
62
62
|
}
|
|
63
63
|
isDisabledExternally() {
|
|
@@ -71,13 +71,13 @@ let t = class extends g(
|
|
|
71
71
|
withUserInteraction() {
|
|
72
72
|
this.indeterminate && (this.indeterminate = !1);
|
|
73
73
|
}
|
|
74
|
-
async
|
|
74
|
+
async _updateExpandedLabel() {
|
|
75
75
|
var e;
|
|
76
|
-
if (await this.hydrationComplete, !((e = this.
|
|
77
|
-
this.
|
|
76
|
+
if (await this.hydrationComplete, !((e = this._selectionPanelElement) != null && e.hasContent)) {
|
|
77
|
+
this._selectionPanelExpandedLabel = "", this.removeAttribute("data-has-selection-panel-label");
|
|
78
78
|
return;
|
|
79
79
|
}
|
|
80
|
-
this.
|
|
80
|
+
this._selectionPanelExpandedLabel = this.checked ? ", " + g[this._language.current] : ", " + k[this._language.current], this.toggleAttribute("data-has-selection-panel-label", !0);
|
|
81
81
|
}
|
|
82
82
|
render() {
|
|
83
83
|
return p`
|
|
@@ -99,33 +99,33 @@ let t = class extends g(
|
|
|
99
99
|
</span>
|
|
100
100
|
<slot name="subtext"></slot>
|
|
101
101
|
<sbb-screen-reader-only class="sbb-checkbox__expanded-label">
|
|
102
|
-
${this.
|
|
102
|
+
${this._selectionPanelExpandedLabel}
|
|
103
103
|
</sbb-screen-reader-only>
|
|
104
104
|
</span>
|
|
105
105
|
</span>
|
|
106
106
|
`;
|
|
107
107
|
}
|
|
108
108
|
};
|
|
109
|
-
t.styles =
|
|
109
|
+
t.styles = E;
|
|
110
110
|
t.events = {
|
|
111
111
|
didChange: "didChange",
|
|
112
112
|
stateChange: "stateChange",
|
|
113
113
|
checkboxLoaded: "checkboxLoaded"
|
|
114
114
|
};
|
|
115
|
-
|
|
115
|
+
a([
|
|
116
116
|
c({ type: Boolean })
|
|
117
117
|
], t.prototype, "indeterminate", 2);
|
|
118
|
-
|
|
118
|
+
a([
|
|
119
119
|
c({ attribute: "icon-placement", reflect: !0 })
|
|
120
120
|
], t.prototype, "iconPlacement", 2);
|
|
121
|
-
|
|
121
|
+
a([
|
|
122
122
|
c({ reflect: !0 })
|
|
123
123
|
], t.prototype, "size", 1);
|
|
124
|
-
|
|
124
|
+
a([
|
|
125
125
|
u()
|
|
126
|
-
], t.prototype, "
|
|
127
|
-
t =
|
|
128
|
-
|
|
126
|
+
], t.prototype, "_selectionPanelExpandedLabel", 2);
|
|
127
|
+
t = a([
|
|
128
|
+
x("sbb-checkbox")
|
|
129
129
|
], t);
|
|
130
130
|
export {
|
|
131
131
|
t as SbbCheckboxElement
|