@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/datepicker/datepicker.js
CHANGED
|
@@ -1,261 +1,261 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
3
|
-
import { readConfig as
|
|
4
|
-
import { SbbConnectedAbortController as
|
|
5
|
-
import { defaultDateAdapter as
|
|
6
|
-
import { findReferencedElement as
|
|
1
|
+
import { css as c, LitElement as b, html as f } from "lit";
|
|
2
|
+
import { property as u, state as E, customElement as g } from "lit/decorators.js";
|
|
3
|
+
import { readConfig as v } from "../core/config.js";
|
|
4
|
+
import { SbbConnectedAbortController as C, SbbLanguageController as w } from "../core/controllers.js";
|
|
5
|
+
import { defaultDateAdapter as m } from "../core/datetime.js";
|
|
6
|
+
import { findReferencedElement as D, findInput as h } from "../core/dom.js";
|
|
7
7
|
import { EventEmitter as d } from "../core/eventing.js";
|
|
8
|
-
import { i18nDatePickerPlaceholder as
|
|
9
|
-
import { AgnosticMutationObserver as
|
|
10
|
-
const
|
|
11
|
-
var
|
|
12
|
-
for (var i = a > 1 ? void 0 : a ?
|
|
13
|
-
(
|
|
14
|
-
return a && i &&
|
|
8
|
+
import { i18nDatePickerPlaceholder as p, i18nDateChangedTo as A } from "../core/i18n.js";
|
|
9
|
+
import { AgnosticMutationObserver as y } from "../core/observers.js";
|
|
10
|
+
const V = c`:host{border:0;clip:rect(0 0 0 0);height:1px;margin:-1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}`;
|
|
11
|
+
var x = Object.defineProperty, P = Object.getOwnPropertyDescriptor, l = (t, e, n, a) => {
|
|
12
|
+
for (var i = a > 1 ? void 0 : a ? P(e, n) : e, s = t.length - 1, o; s >= 0; s--)
|
|
13
|
+
(o = t[s]) && (i = (a ? o(e, n, i) : o(i)) || i);
|
|
14
|
+
return a && i && x(e, n, i), i;
|
|
15
15
|
};
|
|
16
16
|
const U = /(^0?[1-9]?|[12]?[0-9]?|3?[01]?)[.,\\/\-\s](0?[1-9]?|1?[0-2]?)?[.,\\/\-\s](\d{1,4}$)?/;
|
|
17
|
-
function
|
|
18
|
-
var
|
|
17
|
+
function N(t, e) {
|
|
18
|
+
var n;
|
|
19
19
|
if (!e) {
|
|
20
|
-
const a = (
|
|
20
|
+
const a = (n = t.closest) == null ? void 0 : n.call(t, "sbb-form-field");
|
|
21
21
|
return a == null ? void 0 : a.querySelector("sbb-datepicker");
|
|
22
22
|
}
|
|
23
|
-
return
|
|
23
|
+
return D(e);
|
|
24
24
|
}
|
|
25
|
-
function
|
|
25
|
+
function _(t, e, n, a) {
|
|
26
26
|
let i = a.addCalendarDays(t, e);
|
|
27
|
-
if (
|
|
28
|
-
for (; !
|
|
27
|
+
if (n)
|
|
28
|
+
for (; !n(i); )
|
|
29
29
|
i = a.addCalendarDays(i, e);
|
|
30
30
|
return i;
|
|
31
31
|
}
|
|
32
|
-
function $(t, e,
|
|
33
|
-
const i =
|
|
34
|
-
return !
|
|
32
|
+
function $(t, e, n, a) {
|
|
33
|
+
const i = _(t, -1, e, n), s = n.deserialize(a);
|
|
34
|
+
return !s || n.isValid(s) && n.compareDate(i, s) >= 0 ? i : t;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
37
|
-
const i =
|
|
38
|
-
return !
|
|
36
|
+
function H(t, e, n, a) {
|
|
37
|
+
const i = _(t, 1, e, n), s = n.deserialize(a);
|
|
38
|
+
return !s || n.isValid(s) && n.compareDate(i, s) <= 0 ? i : t;
|
|
39
39
|
}
|
|
40
|
-
function
|
|
41
|
-
const i =
|
|
42
|
-
return i.isValid(
|
|
40
|
+
function k(t, e, n, a) {
|
|
41
|
+
const i = m, s = i.deserialize(n), o = i.deserialize(a);
|
|
42
|
+
return i.isValid(s) && i.compareDate(t, s) < 0 || i.isValid(o) && i.compareDate(t, o) > 0 ? !1 : e ? e(t) : !0;
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const j = () => new CustomEvent("datepickerControlRegistered", {
|
|
45
45
|
bubbles: !1,
|
|
46
46
|
composed: !0
|
|
47
47
|
});
|
|
48
|
-
let
|
|
48
|
+
let r = class extends b {
|
|
49
49
|
constructor() {
|
|
50
50
|
var t;
|
|
51
|
-
super(...arguments), this.wide = !1, this.dateFilter = () => !0, this.
|
|
51
|
+
super(...arguments), this.wide = !1, this.dateFilter = () => !0, this._now = null, this._didChange = new d(this, r.events.didChange, {
|
|
52
52
|
bubbles: !0,
|
|
53
53
|
cancelable: !0
|
|
54
|
-
}), this.
|
|
54
|
+
}), this._change = new d(this, r.events.change, {
|
|
55
55
|
bubbles: !0
|
|
56
|
-
}), this.
|
|
56
|
+
}), this._inputUpdated = new d(
|
|
57
57
|
this,
|
|
58
|
-
|
|
58
|
+
r.events.inputUpdated,
|
|
59
59
|
{ bubbles: !0, cancelable: !0 }
|
|
60
|
-
), this.
|
|
60
|
+
), this._datePickerUpdated = new d(
|
|
61
61
|
this,
|
|
62
|
-
|
|
62
|
+
r.events.datePickerUpdated,
|
|
63
63
|
{
|
|
64
64
|
bubbles: !0,
|
|
65
65
|
cancelable: !0
|
|
66
66
|
}
|
|
67
|
-
), this.
|
|
67
|
+
), this._validationChange = new d(
|
|
68
68
|
this,
|
|
69
|
-
|
|
70
|
-
), this.
|
|
71
|
-
if (this.
|
|
72
|
-
this.
|
|
69
|
+
r.events.validationChange
|
|
70
|
+
), this._inputElementState = null, this._inputObserver = new y(this._onInputPropertiesChange.bind(this)), this._dateAdapter = ((t = v().datetime) == null ? void 0 : t.dateAdapter) ?? m, this._abort = new C(this), this._language = new w(this).withHandler(() => {
|
|
71
|
+
if (this._inputElement) {
|
|
72
|
+
this._inputElement.placeholder = p[this._language.current];
|
|
73
73
|
const e = this.getValueAsDate();
|
|
74
|
-
e && (this.
|
|
74
|
+
e && (this._inputElement.value = this._format(e));
|
|
75
75
|
}
|
|
76
76
|
});
|
|
77
77
|
}
|
|
78
78
|
set now(t) {
|
|
79
|
-
this.
|
|
79
|
+
this._now = this._dateAdapter.getValidDateOrNull(this._dateAdapter.deserialize(t));
|
|
80
80
|
}
|
|
81
81
|
get now() {
|
|
82
|
-
return this.
|
|
82
|
+
return this._now ?? this._dateAdapter.today();
|
|
83
83
|
}
|
|
84
|
-
get
|
|
85
|
-
return this.
|
|
84
|
+
get _inputElement() {
|
|
85
|
+
return this._inputElementState;
|
|
86
86
|
}
|
|
87
|
-
set
|
|
88
|
-
const e = this.
|
|
89
|
-
this.
|
|
87
|
+
set _inputElement(t) {
|
|
88
|
+
const e = this._inputElementState;
|
|
89
|
+
this._inputElementState = t, this._registerInputElement(this._inputElementState, e);
|
|
90
90
|
}
|
|
91
|
-
|
|
92
|
-
t !== e && (this.
|
|
91
|
+
_findInput(t, e) {
|
|
92
|
+
t !== e && (this._inputElement = h(this, this.input));
|
|
93
93
|
}
|
|
94
|
-
|
|
95
|
-
var
|
|
94
|
+
_registerInputElement(t, e) {
|
|
95
|
+
var n, a;
|
|
96
96
|
if (t !== e) {
|
|
97
|
-
if ((
|
|
97
|
+
if ((n = this._datePickerController) == null || n.abort(), this._datePickerController = new AbortController(), !this._inputElement)
|
|
98
98
|
return;
|
|
99
|
-
(a = this.
|
|
99
|
+
(a = this._inputObserver) == null || a.disconnect(), this._inputObserver.observe(this._inputElement, {
|
|
100
100
|
attributeFilter: ["disabled", "readonly", "min", "max", "value"]
|
|
101
|
-
}), this.
|
|
101
|
+
}), this._inputElement.type = "text", this._inputElement.placeholder || (this._inputElement.placeholder = p[this._language.current]), this._inputElement.addEventListener(
|
|
102
102
|
"change",
|
|
103
103
|
(i) => {
|
|
104
|
-
i instanceof CustomEvent || this.
|
|
104
|
+
i instanceof CustomEvent || this._valueChanged(i);
|
|
105
105
|
},
|
|
106
106
|
{
|
|
107
|
-
signal: this.
|
|
107
|
+
signal: this._datePickerController.signal
|
|
108
108
|
}
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
}
|
|
112
112
|
/** Gets the input value with the correct date format. */
|
|
113
113
|
getValueAsDate() {
|
|
114
|
-
if (this.
|
|
115
|
-
return this.
|
|
114
|
+
if (this._inputElement && this._inputElement.value)
|
|
115
|
+
return this._parse(this._inputElement.value);
|
|
116
116
|
}
|
|
117
117
|
/** Set the input value to the correctly formatted value. */
|
|
118
118
|
setValueAsDate(t) {
|
|
119
119
|
const e = t instanceof Date ? t : new Date(t);
|
|
120
|
-
this.
|
|
120
|
+
this._inputElement && (this._formatAndUpdateValue(this._inputElement.value, e), this._inputElement.dispatchEvent(new Event("blur", { composed: !0 })));
|
|
121
121
|
}
|
|
122
122
|
/**
|
|
123
123
|
* @internal
|
|
124
124
|
* Whether a custom now is configured.
|
|
125
125
|
*/
|
|
126
126
|
hasCustomNow() {
|
|
127
|
-
return !!this.
|
|
127
|
+
return !!this._now;
|
|
128
128
|
}
|
|
129
|
-
|
|
130
|
-
var e,
|
|
131
|
-
this.
|
|
132
|
-
disabled: (e = this.
|
|
133
|
-
readonly: (
|
|
134
|
-
min: (a = this.
|
|
135
|
-
max: (i = this.
|
|
136
|
-
}), this.
|
|
129
|
+
_onInputPropertiesChange(t) {
|
|
130
|
+
var e, n, a, i;
|
|
131
|
+
this._inputUpdated.emit({
|
|
132
|
+
disabled: (e = this._inputElement) == null ? void 0 : e.disabled,
|
|
133
|
+
readonly: (n = this._inputElement) == null ? void 0 : n.readOnly,
|
|
134
|
+
min: (a = this._inputElement) == null ? void 0 : a.min,
|
|
135
|
+
max: (i = this._inputElement) == null ? void 0 : i.max
|
|
136
|
+
}), this._inputElement && t && Array.from(t).some((s) => s.attributeName === "value") && (this._inputElement.value = this._getValidValue(this._inputElement.getAttribute("value")));
|
|
137
137
|
}
|
|
138
138
|
connectedCallback() {
|
|
139
139
|
super.connectedCallback();
|
|
140
|
-
const t = this.
|
|
141
|
-
this.addEventListener("datepickerControlRegistered", () => this.
|
|
140
|
+
const t = this._abort.signal;
|
|
141
|
+
this.addEventListener("datepickerControlRegistered", () => this._onInputPropertiesChange(), {
|
|
142
142
|
signal: t
|
|
143
|
-
}), this.
|
|
144
|
-
disabled: this.
|
|
145
|
-
readonly: this.
|
|
146
|
-
min: this.
|
|
147
|
-
max: this.
|
|
143
|
+
}), this._inputElement = h(this, this.input), this._inputElement && (this._inputElement.value = this._getValidValue(this._inputElement.value), this._inputUpdated.emit({
|
|
144
|
+
disabled: this._inputElement.disabled,
|
|
145
|
+
readonly: this._inputElement.readOnly,
|
|
146
|
+
min: this._inputElement.min,
|
|
147
|
+
max: this._inputElement.max
|
|
148
148
|
}));
|
|
149
149
|
}
|
|
150
150
|
willUpdate(t) {
|
|
151
|
-
super.willUpdate(t), t.has("input") && this.
|
|
151
|
+
super.willUpdate(t), t.has("input") && this._findInput(this.input, t.get("input")), (t.has("wide") || t.has("dateFilter") || t.has("now")) && this._datePickerUpdated.emit();
|
|
152
152
|
}
|
|
153
153
|
disconnectedCallback() {
|
|
154
154
|
var t, e;
|
|
155
|
-
super.disconnectedCallback(), (t = this.
|
|
155
|
+
super.disconnectedCallback(), (t = this._inputObserver) == null || t.disconnect(), (e = this._datePickerController) == null || e.abort();
|
|
156
156
|
}
|
|
157
157
|
firstUpdated(t) {
|
|
158
|
-
super.firstUpdated(t), this.
|
|
158
|
+
super.firstUpdated(t), this._setAriaLiveMessage(this.getValueAsDate());
|
|
159
159
|
}
|
|
160
|
-
|
|
161
|
-
const e = this.
|
|
162
|
-
return this.
|
|
160
|
+
_parseAndFormatValue(t) {
|
|
161
|
+
const e = this._parse(t);
|
|
162
|
+
return this._dateAdapter.isValid(e) ? this._format(e) : t;
|
|
163
163
|
}
|
|
164
|
-
|
|
164
|
+
_createAndComposeDate(t) {
|
|
165
165
|
const e = new Date(t);
|
|
166
|
-
return this.
|
|
166
|
+
return this._format(e);
|
|
167
167
|
}
|
|
168
|
-
|
|
168
|
+
_valueChanged(t) {
|
|
169
169
|
const e = t.target.value;
|
|
170
|
-
this.
|
|
170
|
+
this._formatAndUpdateValue(e, this._parse(e));
|
|
171
171
|
}
|
|
172
172
|
/** Applies the correct format to values and triggers event dispatch. */
|
|
173
|
-
|
|
174
|
-
var
|
|
175
|
-
if (this.
|
|
176
|
-
this.
|
|
177
|
-
const i = !t || !!e &&
|
|
173
|
+
_formatAndUpdateValue(t, e) {
|
|
174
|
+
var n, a;
|
|
175
|
+
if (this._inputElement) {
|
|
176
|
+
this._inputElement.value = this._dateAdapter.isValid(e) ? this._format(e) : t;
|
|
177
|
+
const i = !t || !!e && k(
|
|
178
178
|
e,
|
|
179
179
|
this.dateFilter,
|
|
180
|
-
(
|
|
181
|
-
(a = this.
|
|
182
|
-
),
|
|
183
|
-
this.
|
|
180
|
+
(n = this._inputElement) == null ? void 0 : n.min,
|
|
181
|
+
(a = this._inputElement) == null ? void 0 : a.max
|
|
182
|
+
), s = !this._inputElement.hasAttribute("data-sbb-invalid");
|
|
183
|
+
this._inputElement.toggleAttribute("data-sbb-invalid", !i), s !== i && this._validationChange.emit({ valid: i }), this._emitChange(e);
|
|
184
184
|
}
|
|
185
185
|
}
|
|
186
186
|
/** Emits the change event. */
|
|
187
|
-
|
|
188
|
-
this.
|
|
187
|
+
_emitChange(t) {
|
|
188
|
+
this._setAriaLiveMessage(t), this._change.emit(), this._didChange.emit(), this._inputElement && (this._inputElement.dispatchEvent(new InputEvent("input", { bubbles: !0, composed: !0 })), this._inputElement.dispatchEvent(
|
|
189
189
|
new CustomEvent("change", { bubbles: !0, composed: !0 })
|
|
190
190
|
));
|
|
191
191
|
}
|
|
192
|
-
|
|
192
|
+
_getValidValue(t) {
|
|
193
193
|
if (!t)
|
|
194
194
|
return "";
|
|
195
195
|
const e = t.match(U);
|
|
196
|
-
return (e == null ? void 0 : e.index) === 0 ? this.
|
|
196
|
+
return (e == null ? void 0 : e.index) === 0 ? this._parseAndFormatValue(t) : Number.isInteger(+t) ? this._createAndComposeDate(+t) : this._dateAdapter.isValid(new Date(t)) ? this._createAndComposeDate(t) : t;
|
|
197
197
|
}
|
|
198
|
-
|
|
199
|
-
return this.dateParser ? this.dateParser(t) : this.
|
|
198
|
+
_parse(t) {
|
|
199
|
+
return this.dateParser ? this.dateParser(t) : this._dateAdapter.parse(t, this.now);
|
|
200
200
|
}
|
|
201
|
-
|
|
202
|
-
return this.format ? this.format(t) : this.
|
|
201
|
+
_format(t) {
|
|
202
|
+
return this.format ? this.format(t) : this._dateAdapter.format(t);
|
|
203
203
|
}
|
|
204
|
-
|
|
205
|
-
var i,
|
|
206
|
-
const e = new Intl.DateTimeFormat(`${this.
|
|
204
|
+
_setAriaLiveMessage(t) {
|
|
205
|
+
var i, s;
|
|
206
|
+
const e = new Intl.DateTimeFormat(`${this._language.current}-CH`, {
|
|
207
207
|
weekday: "long"
|
|
208
|
-
}),
|
|
208
|
+
}), n = new Intl.DateTimeFormat("de-CH", {
|
|
209
209
|
day: "2-digit",
|
|
210
210
|
month: "2-digit",
|
|
211
211
|
year: "numeric"
|
|
212
|
-
}), a = (
|
|
213
|
-
a && (a.innerText = t ? `${
|
|
212
|
+
}), a = (s = (i = this.shadowRoot) == null ? void 0 : i.querySelector) == null ? void 0 : s.call(i, "#status-container");
|
|
213
|
+
a && (a.innerText = t ? `${A[this._language.current]} ${e.format(
|
|
214
214
|
t
|
|
215
|
-
)}, ${
|
|
215
|
+
)}, ${n.format(t)}` : "");
|
|
216
216
|
}
|
|
217
217
|
render() {
|
|
218
|
-
return
|
|
218
|
+
return f`<p id="status-container" role="status"></p>`;
|
|
219
219
|
}
|
|
220
220
|
};
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
r.styles = V;
|
|
222
|
+
r.events = {
|
|
223
223
|
didChange: "didChange",
|
|
224
224
|
change: "change",
|
|
225
225
|
inputUpdated: "inputUpdated",
|
|
226
226
|
datePickerUpdated: "datePickerUpdated",
|
|
227
227
|
validationChange: "validationChange"
|
|
228
228
|
};
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
],
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
],
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
],
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
],
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
],
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
],
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
],
|
|
250
|
-
|
|
229
|
+
l([
|
|
230
|
+
u({ type: Boolean })
|
|
231
|
+
], r.prototype, "wide", 2);
|
|
232
|
+
l([
|
|
233
|
+
u({ attribute: "date-filter" })
|
|
234
|
+
], r.prototype, "dateFilter", 2);
|
|
235
|
+
l([
|
|
236
|
+
u({ attribute: "date-parser" })
|
|
237
|
+
], r.prototype, "dateParser", 2);
|
|
238
|
+
l([
|
|
239
|
+
u()
|
|
240
|
+
], r.prototype, "format", 2);
|
|
241
|
+
l([
|
|
242
|
+
u()
|
|
243
|
+
], r.prototype, "input", 2);
|
|
244
|
+
l([
|
|
245
|
+
u()
|
|
246
|
+
], r.prototype, "now", 1);
|
|
247
|
+
l([
|
|
248
|
+
E()
|
|
249
|
+
], r.prototype, "_inputElement", 1);
|
|
250
|
+
r = l([
|
|
251
251
|
g("sbb-datepicker")
|
|
252
|
-
],
|
|
252
|
+
], r);
|
|
253
253
|
export {
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
254
|
+
r as SbbDatepickerElement,
|
|
255
|
+
j as datepickerControlRegisteredEventFactory,
|
|
256
|
+
H as findNextAvailableDate,
|
|
257
257
|
$ as findPreviousAvailableDate,
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
258
|
+
_ as getAvailableDate,
|
|
259
|
+
N as getDatePicker,
|
|
260
|
+
k as isDateAvailable
|
|
261
261
|
};
|
package/dialog/dialog-title.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { css as v, nothing as g } from "lit";
|
|
2
|
-
import { property as
|
|
3
|
-
import { html as c, unsafeStatic as
|
|
4
|
-
import { SbbFocusVisibleWithinController as
|
|
2
|
+
import { property as b, customElement as u } from "lit/decorators.js";
|
|
3
|
+
import { html as c, unsafeStatic as r } from "lit/static-html.js";
|
|
4
|
+
import { SbbFocusVisibleWithinController as p } from "../core/a11y.js";
|
|
5
5
|
import { SbbLanguageController as f } from "../core/controllers.js";
|
|
6
6
|
import { EventEmitter as m } from "../core/eventing.js";
|
|
7
7
|
import { i18nCloseDialog as w, i18nGoBack as _ } from "../core/i18n.js";
|
|
@@ -16,44 +16,44 @@ var y = Object.defineProperty, B = Object.getOwnPropertyDescriptor, o = (e, s, i
|
|
|
16
16
|
};
|
|
17
17
|
let a = class extends h {
|
|
18
18
|
constructor() {
|
|
19
|
-
super(), this.backButton = !1, this.
|
|
19
|
+
super(), this.backButton = !1, this._hideOnScroll = !1, this._backClick = new m(
|
|
20
20
|
this,
|
|
21
21
|
a.events.backClick
|
|
22
|
-
), this.
|
|
22
|
+
), this._language = new f(this), this.level = "2", this.visualLevel = "3";
|
|
23
23
|
}
|
|
24
24
|
set hideOnScroll(e) {
|
|
25
|
-
this.
|
|
25
|
+
this._hideOnScroll = e === "" ? !0 : e;
|
|
26
26
|
}
|
|
27
27
|
get hideOnScroll() {
|
|
28
|
-
return this.
|
|
28
|
+
return this._hideOnScroll;
|
|
29
29
|
}
|
|
30
30
|
connectedCallback() {
|
|
31
|
-
super.connectedCallback(), new
|
|
31
|
+
super.connectedCallback(), new p(this);
|
|
32
32
|
}
|
|
33
33
|
willUpdate(e) {
|
|
34
34
|
super.willUpdate(e), (e.has("backButton") || e.has("accessibilityBackLabel")) && (this.backButton = !this.backButton && this.accessibilityBackLabel ? !0 : this.backButton);
|
|
35
35
|
}
|
|
36
36
|
render() {
|
|
37
37
|
const e = this.negative ? "sbb-transparent-button" : "sbb-secondary-button", s = c`
|
|
38
|
-
<${
|
|
38
|
+
<${r(e)}
|
|
39
39
|
class="sbb-dialog__close"
|
|
40
|
-
aria-label=${this.accessibilityCloseLabel || w[this.
|
|
40
|
+
aria-label=${this.accessibilityCloseLabel || w[this._language.current]}
|
|
41
41
|
?negative=${this.negative}
|
|
42
42
|
size="m"
|
|
43
43
|
type="button"
|
|
44
44
|
icon-name="cross-small"
|
|
45
45
|
sbb-dialog-close
|
|
46
|
-
></${
|
|
46
|
+
></${r(e)}>
|
|
47
47
|
`, i = c`
|
|
48
|
-
<${
|
|
48
|
+
<${r(e)}
|
|
49
49
|
class="sbb-dialog__back"
|
|
50
|
-
aria-label=${this.accessibilityBackLabel || _[this.
|
|
50
|
+
aria-label=${this.accessibilityBackLabel || _[this._language.current]}
|
|
51
51
|
?negative=${this.negative}
|
|
52
52
|
size="m"
|
|
53
53
|
type="button"
|
|
54
54
|
icon-name="chevron-small-left-small"
|
|
55
|
-
@click=${() => this.
|
|
56
|
-
></${
|
|
55
|
+
@click=${() => this._backClick.emit()}
|
|
56
|
+
></${r(e)}>
|
|
57
57
|
`;
|
|
58
58
|
return c`
|
|
59
59
|
<div class="sbb-dialog__header">
|
|
@@ -67,19 +67,19 @@ a.events = {
|
|
|
67
67
|
backClick: "requestBackAction"
|
|
68
68
|
};
|
|
69
69
|
o([
|
|
70
|
-
|
|
70
|
+
b({ attribute: "back-button", type: Boolean })
|
|
71
71
|
], a.prototype, "backButton", 2);
|
|
72
72
|
o([
|
|
73
|
-
|
|
73
|
+
b({ attribute: "accessibility-close-label" })
|
|
74
74
|
], a.prototype, "accessibilityCloseLabel", 2);
|
|
75
75
|
o([
|
|
76
|
-
|
|
76
|
+
b({ attribute: "accessibility-back-label" })
|
|
77
77
|
], a.prototype, "accessibilityBackLabel", 2);
|
|
78
78
|
o([
|
|
79
|
-
|
|
79
|
+
b({ attribute: "hide-on-scroll" })
|
|
80
80
|
], a.prototype, "hideOnScroll", 1);
|
|
81
81
|
a = o([
|
|
82
|
-
|
|
82
|
+
u("sbb-dialog-title")
|
|
83
83
|
], a);
|
|
84
84
|
export {
|
|
85
85
|
a as SbbDialogTitleElement
|