@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/option/optgroup.js
CHANGED
|
@@ -1,103 +1,103 @@
|
|
|
1
|
-
import { css as n, LitElement as d, html as
|
|
2
|
-
import { property as
|
|
1
|
+
import { css as n, LitElement as d, html as g } from "lit";
|
|
2
|
+
import { property as c, state as v, customElement as u } from "lit/decorators.js";
|
|
3
3
|
import { hostAttributes as h } from "../core/decorators.js";
|
|
4
4
|
import { setOrRemoveAttribute as f, isSafari as x } from "../core/dom.js";
|
|
5
|
-
import { SbbDisabledMixin as
|
|
6
|
-
import { AgnosticMutationObserver as
|
|
5
|
+
import { SbbDisabledMixin as _, SbbHydrationMixin as m } from "../core/mixins.js";
|
|
6
|
+
import { AgnosticMutationObserver as y } from "../core/observers.js";
|
|
7
7
|
import "../divider.js";
|
|
8
|
-
const
|
|
9
|
-
var
|
|
10
|
-
for (var
|
|
11
|
-
(
|
|
12
|
-
return
|
|
8
|
+
const O = n`*,:before,:after{box-sizing:border-box}:host{--sbb-optgroup-divider-display: block;--sbb-optgroup-divider-spacing: 0;--sbb-optgroup-label-padding-start: var(--sbb-spacing-fixed-4x);--sbb-optgroup-label-padding-inline: var(--sbb-spacing-fixed-4x);--sbb-optgroup-label-font-size: var(--sbb-typo-scale-0-75x);--sbb-optgroup-label-color: var(--sbb-color-metal);display:block}:host(:first-child){--sbb-optgroup-divider-display: none;--sbb-optgroup-label-padding-start: var(--sbb-spacing-fixed-2x)}:host([data-variant=select]){--sbb-optgroup-divider-spacing: var(--sbb-spacing-fixed-4x);--sbb-optgroup-label-padding-inline: var(--sbb-spacing-responsive-xxxs);--sbb-optgroup-label-padding-start: 0;--sbb-optgroup-label-font-size: inherit}:host([data-variant=select]:first-child){--sbb-optgroup-label-padding-start: var(--sbb-spacing-fixed-4x)}:host([data-negative]){--sbb-optgroup-label-color: var(--sbb-color-smoke)}.sbb-optgroup{margin-block:var(--sbb-spacing-fixed-4x);margin-inline:var(--sbb-spacing-fixed-4x)}.sbb-optgroup__label{--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);display:flex;column-gap:var(--sbb-spacing-responsive-xxxs);color:var(--sbb-optgroup-label-color);-webkit-text-fill-color:var(--sbb-optgroup-label-color);padding-inline:var(--sbb-optgroup-label-padding-inline);padding-block:var(--sbb-optgroup-label-padding-start) var(--sbb-spacing-fixed-2x)}:host([data-variant=select][data-multiple]) .sbb-optgroup__label{--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);padding-inline-start:calc(var(--sbb-spacing-responsive-xxxs) + var(--sbb-spacing-fixed-8x))}.sbb-optgroup__divider{display:var(--sbb-optgroup-divider-display);padding-block:var(--sbb-optgroup-divider-spacing)}.sbb-optgroup__icon-space{display:var(--sbb-option-icon-container-display, none);min-width:var(--sbb-size-icon-ui-small)}`;
|
|
9
|
+
var A = Object.defineProperty, z = Object.getOwnPropertyDescriptor, p = (t, e, i, o) => {
|
|
10
|
+
for (var s = o > 1 ? void 0 : o ? z(e, i) : e, r = t.length - 1, b; r >= 0; r--)
|
|
11
|
+
(b = t[r]) && (s = (o ? b(e, i, s) : b(s)) || s);
|
|
12
|
+
return o && s && A(e, i, s), s;
|
|
13
13
|
};
|
|
14
14
|
const l = x;
|
|
15
|
-
let
|
|
15
|
+
let a = class extends _(m(d)) {
|
|
16
16
|
constructor() {
|
|
17
|
-
super(...arguments), this.
|
|
17
|
+
super(...arguments), this._negative = !1, this._negativeObserver = new y(() => this._onNegativeChange());
|
|
18
18
|
}
|
|
19
|
-
get
|
|
19
|
+
get _options() {
|
|
20
20
|
var t;
|
|
21
21
|
return Array.from(((t = this.querySelectorAll) == null ? void 0 : t.call(this, "sbb-option")) ?? []);
|
|
22
22
|
}
|
|
23
23
|
connectedCallback() {
|
|
24
24
|
var t, e;
|
|
25
|
-
super.connectedCallback(), (t = this.
|
|
25
|
+
super.connectedCallback(), (t = this._negativeObserver) == null || t.disconnect(), this._negative = !!((e = this.closest) != null && e.call(
|
|
26
26
|
this,
|
|
27
27
|
":is(sbb-autocomplete, sbb-select, sbb-form-field)[negative]"
|
|
28
|
-
)), this.toggleAttribute("data-negative", this.
|
|
28
|
+
)), this.toggleAttribute("data-negative", this._negative), this._negativeObserver.observe(this, {
|
|
29
29
|
attributes: !0,
|
|
30
30
|
attributeFilter: ["data-negative"]
|
|
31
|
-
}), this.
|
|
31
|
+
}), this._setVariantByContext(), this._proxyGroupLabelToOptions(), this.toggleAttribute("data-multiple", !!this.closest("sbb-select[multiple]"));
|
|
32
32
|
}
|
|
33
33
|
willUpdate(t) {
|
|
34
|
-
super.willUpdate(t), t.has("disabled") && (l || this.setAttribute("aria-disabled", this.disabled.toString()), this.
|
|
34
|
+
super.willUpdate(t), t.has("disabled") && (l || this.setAttribute("aria-disabled", this.disabled.toString()), this._proxyDisabledToOptions()), t.has("label") && this._proxyGroupLabelToOptions();
|
|
35
35
|
}
|
|
36
36
|
disconnectedCallback() {
|
|
37
37
|
var t;
|
|
38
|
-
super.disconnectedCallback(), (t = this.
|
|
38
|
+
super.disconnectedCallback(), (t = this._negativeObserver) == null || t.disconnect();
|
|
39
39
|
}
|
|
40
|
-
|
|
40
|
+
_setVariantByContext() {
|
|
41
41
|
var t, e;
|
|
42
42
|
(t = this.closest) != null && t.call(this, "sbb-autocomplete") ? this.setAttribute("data-variant", "autocomplete") : (e = this.closest) != null && e.call(this, "sbb-select") && this.setAttribute("data-variant", "select");
|
|
43
43
|
}
|
|
44
|
-
|
|
45
|
-
this.
|
|
44
|
+
_handleSlotchange() {
|
|
45
|
+
this._proxyDisabledToOptions(), this._proxyGroupLabelToOptions(), this._highlightOptions();
|
|
46
46
|
}
|
|
47
|
-
|
|
47
|
+
_proxyGroupLabelToOptions() {
|
|
48
48
|
var t, e;
|
|
49
49
|
if (l)
|
|
50
50
|
if (this.label) {
|
|
51
51
|
this.removeAttribute("aria-label");
|
|
52
|
-
for (const
|
|
53
|
-
|
|
52
|
+
for (const i of this._options)
|
|
53
|
+
i.setAttribute("data-group-label", this.label), (t = i.requestUpdate) == null || t.call(i);
|
|
54
54
|
} else
|
|
55
|
-
for (const
|
|
56
|
-
|
|
55
|
+
for (const i of this._options)
|
|
56
|
+
i.removeAttribute("data-group-label"), (e = i.requestUpdate) == null || e.call(i);
|
|
57
57
|
else {
|
|
58
58
|
f(this, "aria-label", this.label);
|
|
59
59
|
return;
|
|
60
60
|
}
|
|
61
61
|
}
|
|
62
|
-
|
|
63
|
-
for (const t of this.
|
|
62
|
+
_proxyDisabledToOptions() {
|
|
63
|
+
for (const t of this._options)
|
|
64
64
|
t.toggleAttribute("data-group-disabled", this.disabled);
|
|
65
65
|
}
|
|
66
|
-
|
|
67
|
-
var
|
|
66
|
+
_highlightOptions() {
|
|
67
|
+
var i;
|
|
68
68
|
const t = this.closest("sbb-autocomplete");
|
|
69
69
|
if (!t)
|
|
70
70
|
return;
|
|
71
|
-
const e = (
|
|
72
|
-
e && this.
|
|
71
|
+
const e = (i = t.triggerElement) == null ? void 0 : i.value;
|
|
72
|
+
e && this._options.forEach((o) => o.highlight(e));
|
|
73
73
|
}
|
|
74
|
-
|
|
75
|
-
this.
|
|
74
|
+
_onNegativeChange() {
|
|
75
|
+
this._negative = this.hasAttribute("data-negative");
|
|
76
76
|
}
|
|
77
77
|
render() {
|
|
78
|
-
return
|
|
78
|
+
return g`
|
|
79
79
|
<div class="sbb-optgroup__divider">
|
|
80
|
-
<sbb-divider ?negative=${this.
|
|
80
|
+
<sbb-divider ?negative=${this._negative}></sbb-divider>
|
|
81
81
|
</div>
|
|
82
82
|
<div class="sbb-optgroup__label" aria-hidden="true">
|
|
83
83
|
<div class="sbb-optgroup__icon-space"></div>
|
|
84
84
|
<span>${this.label}</span>
|
|
85
85
|
</div>
|
|
86
|
-
<slot @slotchange=${this.
|
|
86
|
+
<slot @slotchange=${this._handleSlotchange}></slot>
|
|
87
87
|
`;
|
|
88
88
|
}
|
|
89
89
|
};
|
|
90
|
-
|
|
90
|
+
a.styles = O;
|
|
91
91
|
p([
|
|
92
|
-
|
|
93
|
-
],
|
|
92
|
+
c()
|
|
93
|
+
], a.prototype, "label", 2);
|
|
94
94
|
p([
|
|
95
|
-
|
|
96
|
-
],
|
|
97
|
-
|
|
98
|
-
|
|
95
|
+
v()
|
|
96
|
+
], a.prototype, "_negative", 2);
|
|
97
|
+
a = p([
|
|
98
|
+
u("sbb-optgroup"),
|
|
99
99
|
h({ role: l ? null : "group" })
|
|
100
|
-
],
|
|
100
|
+
], a);
|
|
101
101
|
export {
|
|
102
|
-
|
|
102
|
+
a as SbbOptGroupElement
|
|
103
103
|
};
|
package/option/option.js
CHANGED
|
@@ -1,36 +1,36 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as h, state as
|
|
3
|
-
import { SbbConnectedAbortController as
|
|
4
|
-
import { hostAttributes as
|
|
5
|
-
import { setOrRemoveAttribute as p, isAndroid as y, isSafari as
|
|
6
|
-
import { EventEmitter as
|
|
7
|
-
import { SbbDisabledMixin as
|
|
8
|
-
import { AgnosticMutationObserver as
|
|
1
|
+
import { css as u, LitElement as v, html as l, nothing as b } from "lit";
|
|
2
|
+
import { property as h, state as n, customElement as _ } from "lit/decorators.js";
|
|
3
|
+
import { SbbConnectedAbortController as f, SbbSlotStateController as m } from "../core/controllers.js";
|
|
4
|
+
import { hostAttributes as x } from "../core/decorators.js";
|
|
5
|
+
import { setOrRemoveAttribute as p, isAndroid as y, isSafari as k } from "../core/dom.js";
|
|
6
|
+
import { EventEmitter as g } from "../core/eventing.js";
|
|
7
|
+
import { SbbDisabledMixin as A } from "../core/mixins.js";
|
|
8
|
+
import { AgnosticMutationObserver as S } from "../core/observers.js";
|
|
9
9
|
import { SbbIconNameMixin as C } from "../icon.js";
|
|
10
10
|
import "../screen-reader-only.js";
|
|
11
11
|
import "../visual-checkbox.js";
|
|
12
|
-
const
|
|
13
|
-
var
|
|
14
|
-
for (var a = s > 1 ? void 0 : s ?
|
|
15
|
-
(
|
|
16
|
-
return s && a &&
|
|
12
|
+
const w = u`*,:before,:after{box-sizing:border-box}:host{--sbb-option-color: var(--sbb-color-charcoal);--sbb-option-background-color: inherit;--sbb-option-background-color-hover: var(--sbb-color-milk);--sbb-option-background-color-active: var(--sbb-color-cloud);--sbb-option-disabled-border-color: var(--sbb-color-graphite);--sbb-option-disabled-background-color: var(--sbb-color-milk);--sbb-option-padding-inline: var(--sbb-spacing-responsive-xxxs);--sbb-option-padding-block: calc(var(--sbb-spacing-fixed-2x) + var(--sbb-border-width-2x));--sbb-option-column-gap: var(--sbb-spacing-responsive-xxxs);--sbb-option-justify-content: start;--sbb-option-cursor: pointer;--sbb-option-border-radius: var(--sbb-border-radius-4x);--sbb-option-icon-color: var(--sbb-color-metal);display:block}:host([data-negative]){--sbb-option-color: var(--sbb-color-milk);--sbb-option-icon-color: var(--sbb-color-smoke);--sbb-option-background-color-hover: var(--sbb-color-charcoal);--sbb-option-background-color-active: var(--sbb-color-iron);--sbb-option-disabled-border-color: var(--sbb-color-smoke);--sbb-option-disabled-background-color: var(--sbb-color-charcoal);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark)}:host([active]){--sbb-focus-outline-offset: calc(-1 * var(--sbb-spacing-fixed-1x))}@media (any-hover: hover){:host(:hover:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-hover)}}:host(:active:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-active)}:host(:not([data-disable-highlight])) .sbb-option__label slot{display:none}:host(:is([data-group-disabled],[disabled])){--sbb-option-cursor: default}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled])){--sbb-option-color: GrayText}}:host([data-variant=select]){--sbb-option-column-gap: var(--sbb-spacing-fixed-2x);--sbb-option-justify-content: space-between}:host([data-variant=select][data-multiple]){--sbb-option-justify-content: start}:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{font-weight:700}@media (forced-colors: active){:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{color:Highlight}}.sbb-option__container{background-color:var(--sbb-option-background-color)}.sbb-option{--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;align-items:center;column-gap:var(--sbb-option-column-gap);padding-inline:var(--sbb-option-padding-inline);padding-block:var(--sbb-option-padding-block);justify-content:var(--sbb-option-justify-content);color:var(--sbb-option-color);background-color:var(--sbb-option-background-color);cursor:var(--sbb-option-cursor);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--sbb-option-color)}:host([active]) .sbb-option{outline-offset:var(--sbb-focus-outline-offset);outline:var(--sbb-focus-outline-color) solid var(--sbb-focus-outline-width);border-radius:var(--sbb-option-border-radius)}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option{position:relative;z-index:0}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{content:"";display:block;position:absolute;top:.375rem;right:.375rem;bottom:.375rem;left:.375rem;border:var(--sbb-border-width-1x) dashed var(--sbb-option-disabled-border-color);border-radius:var(--sbb-border-radius-2x);background-color:var(--sbb-option-disabled-background-color);z-index:-1}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{border-color:GrayText}}.sbb-option__icon{display:flex;min-width:var(--sbb-size-icon-ui-small);min-height:var(--sbb-size-icon-ui-small);color:var(--sbb-option-icon-color)}:host(:not([data-slot-names~=icon],[icon-name])) .sbb-option__icon{display:var(--sbb-option-icon-container-display, none)}.sbb-option__label{white-space:initial}`;
|
|
13
|
+
var $ = Object.defineProperty, O = Object.getOwnPropertyDescriptor, r = (t, i, e, s) => {
|
|
14
|
+
for (var a = s > 1 ? void 0 : s ? O(i, e) : i, d = t.length - 1, c; d >= 0; d--)
|
|
15
|
+
(c = t[d]) && (a = (s ? c(i, e, a) : c(a)) || a);
|
|
16
|
+
return s && a && $(i, e, a), a;
|
|
17
17
|
};
|
|
18
|
-
const
|
|
19
|
-
let
|
|
20
|
-
const
|
|
18
|
+
const H = k;
|
|
19
|
+
let D = 0;
|
|
20
|
+
const G = {
|
|
21
21
|
attributeFilter: ["data-group-disabled", "data-negative"]
|
|
22
22
|
};
|
|
23
|
-
let
|
|
23
|
+
let o = class extends A(C(v)) {
|
|
24
24
|
constructor() {
|
|
25
|
-
super(), this.
|
|
25
|
+
super(), this._selectionChange = new g(
|
|
26
26
|
this,
|
|
27
|
-
|
|
28
|
-
), this.
|
|
27
|
+
o.events.selectionChange
|
|
28
|
+
), this._optionSelected = new g(
|
|
29
29
|
this,
|
|
30
|
-
|
|
31
|
-
), this.
|
|
32
|
-
(t) => this.
|
|
33
|
-
), new
|
|
30
|
+
o.events.optionSelected
|
|
31
|
+
), this._negative = !1, this._disabledFromGroup = !1, this._highlightString = null, this._disableLabelHighlight = !1, this._abort = new f(this), this._optionAttributeObserver = new S(
|
|
32
|
+
(t) => this._onOptionAttributesChange(t)
|
|
33
|
+
), new m(this);
|
|
34
34
|
}
|
|
35
35
|
set value(t) {
|
|
36
36
|
this.setAttribute("value", `${t}`);
|
|
@@ -39,29 +39,29 @@ let i = class extends w(C(v)) {
|
|
|
39
39
|
return this.getAttribute("value") ?? "";
|
|
40
40
|
}
|
|
41
41
|
set selected(t) {
|
|
42
|
-
this.toggleAttribute("selected", t), this.
|
|
42
|
+
this.toggleAttribute("selected", t), this._updateAriaSelected();
|
|
43
43
|
}
|
|
44
44
|
get selected() {
|
|
45
45
|
return this.hasAttribute("selected");
|
|
46
46
|
}
|
|
47
|
-
set
|
|
47
|
+
set _variant(t) {
|
|
48
48
|
this.setAttribute("data-variant", t);
|
|
49
49
|
}
|
|
50
|
-
get
|
|
50
|
+
get _variant() {
|
|
51
51
|
return this.getAttribute("data-variant");
|
|
52
52
|
}
|
|
53
|
-
get
|
|
54
|
-
return this.
|
|
53
|
+
get _isAutocomplete() {
|
|
54
|
+
return this._variant === "autocomplete";
|
|
55
55
|
}
|
|
56
|
-
get
|
|
57
|
-
return this.
|
|
56
|
+
get _isSelect() {
|
|
57
|
+
return this._variant === "select";
|
|
58
58
|
}
|
|
59
|
-
get
|
|
59
|
+
get _isMultiple() {
|
|
60
60
|
var t;
|
|
61
61
|
return !!((t = this.closest) != null && t.call(this, "sbb-select[multiple]"));
|
|
62
62
|
}
|
|
63
|
-
attributeChangedCallback(t,
|
|
64
|
-
(t !== "value" ||
|
|
63
|
+
attributeChangedCallback(t, i, e) {
|
|
64
|
+
(t !== "value" || i !== e) && super.attributeChangedCallback(t, i, e);
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Highlight the label of the option
|
|
@@ -69,162 +69,162 @@ let i = class extends w(C(v)) {
|
|
|
69
69
|
* @internal
|
|
70
70
|
*/
|
|
71
71
|
highlight(t) {
|
|
72
|
-
this.
|
|
72
|
+
this._highlightString = t;
|
|
73
73
|
}
|
|
74
74
|
/**
|
|
75
75
|
* @internal
|
|
76
76
|
*/
|
|
77
77
|
setSelectedViaUserInteraction(t) {
|
|
78
|
-
this.selected = t, this.
|
|
78
|
+
this.selected = t, this._selectionChange.emit(), this.selected && this._optionSelected.emit();
|
|
79
79
|
}
|
|
80
|
-
|
|
81
|
-
this.
|
|
80
|
+
_updateDisableHighlight(t) {
|
|
81
|
+
this._disableLabelHighlight = t, this.toggleAttribute("data-disable-highlight", t);
|
|
82
82
|
}
|
|
83
|
-
|
|
84
|
-
if (this.disabled || this.
|
|
83
|
+
_selectByClick(t) {
|
|
84
|
+
if (this.disabled || this._disabledFromGroup) {
|
|
85
85
|
t.stopPropagation();
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
|
-
this.
|
|
88
|
+
this._isMultiple ? (t.stopPropagation(), this.setSelectedViaUserInteraction(!this.selected)) : this.setSelectedViaUserInteraction(!0);
|
|
89
89
|
}
|
|
90
90
|
connectedCallback() {
|
|
91
|
-
var
|
|
92
|
-
super.connectedCallback(), this.id || (this.id = `sbb-option-${
|
|
93
|
-
const t = this.
|
|
94
|
-
|
|
91
|
+
var e, s;
|
|
92
|
+
super.connectedCallback(), this.id || (this.id = `sbb-option-${D++}`);
|
|
93
|
+
const t = this._abort.signal, i = (e = this.closest) == null ? void 0 : e.call(this, "sbb-optgroup");
|
|
94
|
+
i && (this._disabledFromGroup = i.disabled, this._updateAriaDisabled()), this._optionAttributeObserver.observe(this, G), this._negative = !!((s = this.closest) != null && s.call(
|
|
95
95
|
this,
|
|
96
96
|
// :is() selector not possible due to test environment
|
|
97
97
|
"sbb-autocomplete[negative],sbb-select[negative],sbb-form-field[negative]"
|
|
98
|
-
)), this.toggleAttribute("data-negative", this.
|
|
98
|
+
)), this.toggleAttribute("data-negative", this._negative), this._setVariantByContext(), this._handleHighlightState(), this.toggleAttribute("data-multiple", this._isMultiple), this.addEventListener("click", (a) => this._selectByClick(a), {
|
|
99
99
|
signal: t,
|
|
100
100
|
passive: !0
|
|
101
101
|
});
|
|
102
102
|
}
|
|
103
103
|
willUpdate(t) {
|
|
104
|
-
super.willUpdate(t), t.has("disabled") && (p(this, "tabindex", y && !this.disabled && 0), this.
|
|
104
|
+
super.willUpdate(t), t.has("disabled") && (p(this, "tabindex", y && !this.disabled && 0), this._updateAriaDisabled());
|
|
105
105
|
}
|
|
106
106
|
firstUpdated(t) {
|
|
107
|
-
super.firstUpdated(t), this.
|
|
107
|
+
super.firstUpdated(t), this._updateAriaSelected();
|
|
108
108
|
}
|
|
109
|
-
|
|
109
|
+
_updateAriaDisabled() {
|
|
110
110
|
p(
|
|
111
111
|
this,
|
|
112
112
|
"aria-disabled",
|
|
113
|
-
this.disabled || this.
|
|
113
|
+
this.disabled || this._disabledFromGroup ? "true" : null
|
|
114
114
|
);
|
|
115
115
|
}
|
|
116
|
-
|
|
116
|
+
_updateAriaSelected() {
|
|
117
117
|
this.setAttribute("aria-selected", `${this.selected}`);
|
|
118
118
|
}
|
|
119
119
|
disconnectedCallback() {
|
|
120
|
-
super.disconnectedCallback(), this.
|
|
120
|
+
super.disconnectedCallback(), this._optionAttributeObserver.disconnect();
|
|
121
121
|
}
|
|
122
|
-
|
|
123
|
-
var t,
|
|
124
|
-
(t = this.closest) != null && t.call(this, "sbb-autocomplete") ? this.
|
|
122
|
+
_setVariantByContext() {
|
|
123
|
+
var t, i;
|
|
124
|
+
(t = this.closest) != null && t.call(this, "sbb-autocomplete") ? this._variant = "autocomplete" : (i = this.closest) != null && i.call(this, "sbb-select") && (this._variant = "select");
|
|
125
125
|
}
|
|
126
126
|
/** Observe changes on data attributes and set the appropriate values. */
|
|
127
|
-
|
|
128
|
-
for (const
|
|
129
|
-
|
|
127
|
+
_onOptionAttributesChange(t) {
|
|
128
|
+
for (const i of t)
|
|
129
|
+
i.attributeName === "data-group-disabled" ? (this._disabledFromGroup = this.hasAttribute("data-group-disabled"), this._updateAriaDisabled()) : i.attributeName === "data-negative" && (this._negative = this.hasAttribute("data-negative"));
|
|
130
130
|
}
|
|
131
|
-
|
|
132
|
-
if (!this.
|
|
133
|
-
this.
|
|
131
|
+
_handleHighlightState() {
|
|
132
|
+
if (!this._isAutocomplete) {
|
|
133
|
+
this._updateDisableHighlight(!0);
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
const t = Array.from(this.childNodes ?? []).filter(
|
|
137
|
-
(
|
|
138
|
-
),
|
|
139
|
-
if (
|
|
140
|
-
this.
|
|
137
|
+
(e) => !(e instanceof Element) || e.slot !== "icon"
|
|
138
|
+
), i = t.filter((e) => e.nodeType === Node.TEXT_NODE);
|
|
139
|
+
if (i.length === 0 || t.filter((e) => !(e instanceof Element) || e.localName !== "template").length !== i.length) {
|
|
140
|
+
this._updateDisableHighlight(!0);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
|
-
this.
|
|
143
|
+
this._label = i.map((e) => e.wholeText).filter((e) => e.trim()).join();
|
|
144
144
|
}
|
|
145
|
-
|
|
146
|
-
if (!this.
|
|
147
|
-
return
|
|
148
|
-
const t = this.
|
|
145
|
+
_getHighlightedLabel() {
|
|
146
|
+
if (!this._highlightString || !this._highlightString.trim())
|
|
147
|
+
return l`${this._label}`;
|
|
148
|
+
const t = this._label.toLowerCase().indexOf(this._highlightString.toLowerCase());
|
|
149
149
|
if (t === -1)
|
|
150
|
-
return
|
|
151
|
-
const
|
|
150
|
+
return l`${this._label}`;
|
|
151
|
+
const i = this._label.substring(0, t), e = this._label.substring(
|
|
152
152
|
t,
|
|
153
|
-
t + this.
|
|
154
|
-
), s = this.
|
|
155
|
-
return
|
|
156
|
-
<span class="sbb-option__label--highlight">${
|
|
153
|
+
t + this._highlightString.length
|
|
154
|
+
), s = this._label.substring(t + this._highlightString.length);
|
|
155
|
+
return l`
|
|
156
|
+
<span class="sbb-option__label--highlight">${i}</span><span>${e}</span
|
|
157
157
|
><span class="sbb-option__label--highlight">${s}</span>
|
|
158
158
|
`;
|
|
159
159
|
}
|
|
160
160
|
render() {
|
|
161
|
-
const t = this.
|
|
162
|
-
return
|
|
161
|
+
const t = this._isMultiple;
|
|
162
|
+
return l`
|
|
163
163
|
<div class="sbb-option__container">
|
|
164
164
|
<div class="sbb-option">
|
|
165
165
|
<!-- Icon -->
|
|
166
|
-
${t ?
|
|
166
|
+
${t ? b : l` <span class="sbb-option__icon"> ${this.renderIconSlot()} </span>`}
|
|
167
167
|
|
|
168
168
|
<!-- Checkbox -->
|
|
169
|
-
${t ?
|
|
169
|
+
${t ? l` <sbb-visual-checkbox
|
|
170
170
|
?checked=${this.selected}
|
|
171
|
-
?disabled=${this.disabled || this.
|
|
172
|
-
?negative=${this.
|
|
173
|
-
></sbb-visual-checkbox>` :
|
|
171
|
+
?disabled=${this.disabled || this._disabledFromGroup}
|
|
172
|
+
?negative=${this._negative}
|
|
173
|
+
></sbb-visual-checkbox>` : b}
|
|
174
174
|
|
|
175
175
|
<!-- Label -->
|
|
176
176
|
<span class="sbb-option__label">
|
|
177
|
-
<slot @slotchange=${this.
|
|
177
|
+
<slot @slotchange=${this._handleHighlightState}></slot>
|
|
178
178
|
|
|
179
179
|
<!-- Search highlight -->
|
|
180
|
-
${this.
|
|
181
|
-
${
|
|
180
|
+
${this._isAutocomplete && this._label && !this._disableLabelHighlight ? this._getHighlightedLabel() : b}
|
|
181
|
+
${H && this.getAttribute("data-group-label") ? l` <sbb-screen-reader-only>
|
|
182
182
|
(${this.getAttribute("data-group-label")})</sbb-screen-reader-only
|
|
183
|
-
>` :
|
|
183
|
+
>` : b}
|
|
184
184
|
</span>
|
|
185
185
|
|
|
186
186
|
<!-- Selected tick -->
|
|
187
|
-
${this.
|
|
187
|
+
${this._isSelect && !t && this.selected ? l`<sbb-icon name="tick-small"></sbb-icon>` : b}
|
|
188
188
|
</div>
|
|
189
189
|
</div>
|
|
190
190
|
`;
|
|
191
191
|
}
|
|
192
192
|
};
|
|
193
|
-
|
|
194
|
-
|
|
193
|
+
o.styles = w;
|
|
194
|
+
o.events = {
|
|
195
195
|
selectionChange: "optionSelectionChange",
|
|
196
196
|
optionSelected: "optionSelected"
|
|
197
197
|
};
|
|
198
198
|
r([
|
|
199
199
|
h()
|
|
200
|
-
],
|
|
200
|
+
], o.prototype, "value", 1);
|
|
201
201
|
r([
|
|
202
202
|
h({ reflect: !0, type: Boolean })
|
|
203
|
-
],
|
|
203
|
+
], o.prototype, "active", 2);
|
|
204
204
|
r([
|
|
205
205
|
h({ type: Boolean })
|
|
206
|
-
],
|
|
206
|
+
], o.prototype, "selected", 1);
|
|
207
207
|
r([
|
|
208
|
-
|
|
209
|
-
],
|
|
208
|
+
n()
|
|
209
|
+
], o.prototype, "_negative", 2);
|
|
210
210
|
r([
|
|
211
|
-
|
|
212
|
-
],
|
|
211
|
+
n()
|
|
212
|
+
], o.prototype, "_disabledFromGroup", 2);
|
|
213
213
|
r([
|
|
214
|
-
|
|
215
|
-
],
|
|
214
|
+
n()
|
|
215
|
+
], o.prototype, "_label", 2);
|
|
216
216
|
r([
|
|
217
|
-
|
|
218
|
-
],
|
|
217
|
+
n()
|
|
218
|
+
], o.prototype, "_highlightString", 2);
|
|
219
219
|
r([
|
|
220
|
-
|
|
221
|
-
],
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
220
|
+
n()
|
|
221
|
+
], o.prototype, "_disableLabelHighlight", 2);
|
|
222
|
+
o = r([
|
|
223
|
+
_("sbb-option"),
|
|
224
|
+
x({
|
|
225
225
|
role: "option"
|
|
226
226
|
})
|
|
227
|
-
],
|
|
227
|
+
], o);
|
|
228
228
|
export {
|
|
229
|
-
|
|
229
|
+
o as SbbOptionElement
|
|
230
230
|
};
|
package/overlay.js
CHANGED
|
@@ -98,15 +98,15 @@ var z = Object.defineProperty, M = Object.getOwnPropertyDescriptor, c = (t, e, o
|
|
|
98
98
|
};
|
|
99
99
|
let s = class extends H {
|
|
100
100
|
constructor() {
|
|
101
|
-
super(...arguments), this.expanded = !1, this.backButton = !1, this.closeAttribute = "sbb-overlay-close", this.
|
|
101
|
+
super(...arguments), this.expanded = !1, this.backButton = !1, this.closeAttribute = "sbb-overlay-close", this._backClick = new p(
|
|
102
102
|
this,
|
|
103
103
|
s.events.backClick
|
|
104
|
-
), this.
|
|
104
|
+
), this._overlayContentElement = null;
|
|
105
105
|
}
|
|
106
106
|
/** Opens the component. */
|
|
107
107
|
open() {
|
|
108
108
|
var t;
|
|
109
|
-
this.state === "closed" && (this.lastFocusedElement = document.activeElement, this.
|
|
109
|
+
this.state === "closed" && (this.lastFocusedElement = document.activeElement, this._overlayContentElement = (t = this.shadowRoot) == null ? void 0 : t.querySelector(
|
|
110
110
|
".sbb-overlay__content"
|
|
111
111
|
), this.willOpen.emit() && (this.state = "opening", l.push(this), this.scrollHandler.disableScroll()));
|
|
112
112
|
}
|
|
@@ -115,7 +115,7 @@ let s = class extends H {
|
|
|
115
115
|
// To avoid entering a corrupt state, exit when state is not expected.
|
|
116
116
|
onOverlayAnimationEnd(t) {
|
|
117
117
|
var e, o, a;
|
|
118
|
-
t.animationName === "open" && this.state === "opening" ? (this.state = "opened", this.didOpen.emit(), y(this), this.attachOpenOverlayEvents(), this.setOverlayFocus(), setTimeout(() => this.setAriaLiveRefContent(this.accessibilityLabel)), this.focusHandler.trap(this)) : t.animationName === "close" && this.state === "closing" && ((e = this.
|
|
118
|
+
t.animationName === "open" && this.state === "opening" ? (this.state = "opened", this.didOpen.emit(), y(this), this.attachOpenOverlayEvents(), this.setOverlayFocus(), setTimeout(() => this.setAriaLiveRefContent(this.accessibilityLabel)), this.focusHandler.trap(this)) : t.animationName === "close" && this.state === "closing" && ((e = this._overlayContentElement) == null || e.scrollTo(0, 0), this.state = "closed", m(), h(this.lastFocusedElement), (o = this.lastFocusedElement) == null || o.focus(), (a = this.openOverlayController) == null || a.abort(), this.focusHandler.disconnect(), this.removeInstanceFromGlobalCollection(), !l.length && this.scrollHandler.enableScroll(), this.didClose.emit({
|
|
119
119
|
returnValue: this.returnValue,
|
|
120
120
|
closeTarget: this.overlayCloseElement
|
|
121
121
|
}));
|
|
@@ -148,7 +148,7 @@ let s = class extends H {
|
|
|
148
148
|
size="m"
|
|
149
149
|
type="button"
|
|
150
150
|
icon-name="chevron-small-left-small"
|
|
151
|
-
@click=${() => this.
|
|
151
|
+
@click=${() => this._backClick.emit()}
|
|
152
152
|
></${v(t)}>
|
|
153
153
|
`;
|
|
154
154
|
return d`
|