@sbb-esta/lyne-elements 0.52.1 → 0.53.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 +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/checkbox.d.ts +3 -46
- package/checkbox/checkbox/checkbox.d.ts.map +1 -1
- package/checkbox/checkbox-group/checkbox-group.d.ts +4 -2
- package/checkbox/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/checkbox/checkbox-group.js +26 -23
- package/checkbox/checkbox-panel/checkbox-panel.d.ts +41 -0
- package/checkbox/checkbox-panel/checkbox-panel.d.ts.map +1 -0
- package/checkbox/checkbox-panel.d.ts +2 -0
- package/checkbox/checkbox-panel.d.ts.map +1 -0
- package/checkbox/checkbox-panel.js +67 -0
- package/checkbox/checkbox.js +27 -104
- package/checkbox/common/checkbox-common.d.ts +13 -0
- package/checkbox/common/checkbox-common.d.ts.map +1 -0
- package/checkbox/common.d.ts +2 -0
- package/checkbox/common.d.ts.map +1 -0
- package/checkbox/common.js +52 -0
- package/checkbox.d.ts +2 -0
- package/checkbox.d.ts.map +1 -1
- package/checkbox.js +2 -0
- 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/panel-mixin.d.ts +13 -0
- package/core/mixins/panel-mixin.d.ts.map +1 -0
- package/core/mixins.d.ts +1 -0
- package/core/mixins.d.ts.map +1 -1
- package/core/mixins.js +170 -139
- package/core/styles/node_modules_@sbb-esta_lyne-design-tokens_dist_scss_sbb-variables_css--mixin.scss +1 -1
- package/core/testing.js +29 -29
- package/core.css +1 -1
- package/custom-elements.json +8862 -6904
- package/datepicker/common.js +55 -55
- package/datepicker/datepicker-toggle.js +94 -94
- package/datepicker/datepicker.js +144 -144
- package/development/checkbox/checkbox/checkbox.d.ts +3 -46
- package/development/checkbox/checkbox/checkbox.d.ts.map +1 -1
- package/development/checkbox/checkbox-group/checkbox-group.d.ts +4 -2
- package/development/checkbox/checkbox-group/checkbox-group.d.ts.map +1 -1
- package/development/checkbox/checkbox-group.js +43 -13
- package/development/checkbox/checkbox-panel/checkbox-panel.d.ts +41 -0
- package/development/checkbox/checkbox-panel/checkbox-panel.d.ts.map +1 -0
- package/development/checkbox/checkbox-panel.d.ts +2 -0
- package/development/checkbox/checkbox-panel.d.ts.map +1 -0
- package/development/checkbox/checkbox-panel.js +86 -0
- package/development/checkbox/checkbox.js +19 -239
- package/development/checkbox/common/checkbox-common.d.ts +13 -0
- package/development/checkbox/common/checkbox-common.d.ts.map +1 -0
- package/development/checkbox/common.d.ts +2 -0
- package/development/checkbox/common.d.ts.map +1 -0
- package/development/checkbox/common.js +156 -0
- package/development/checkbox.d.ts +2 -0
- package/development/checkbox.d.ts.map +1 -1
- package/development/checkbox.js +3 -1
- package/development/core/mixins/panel-mixin.d.ts +13 -0
- package/development/core/mixins/panel-mixin.d.ts.map +1 -0
- package/development/core/mixins.d.ts +1 -0
- package/development/core/mixins.d.ts.map +1 -1
- package/development/core/mixins.js +187 -31
- package/development/image.js +1 -1
- package/development/radio-button/common/radio-button-common.d.ts +22 -0
- package/development/radio-button/common/radio-button-common.d.ts.map +1 -0
- package/development/radio-button/common.d.ts +2 -0
- package/development/radio-button/common.d.ts.map +1 -0
- package/development/radio-button/common.js +294 -0
- package/development/radio-button/radio-button/radio-button.d.ts +2 -81
- package/development/radio-button/radio-button/radio-button.d.ts.map +1 -1
- package/development/radio-button/radio-button-group/radio-button-group.d.ts +6 -4
- package/development/radio-button/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/development/radio-button/radio-button-group.js +55 -23
- package/development/radio-button/radio-button-panel/index.d.ts +2 -0
- package/development/radio-button/radio-button-panel/index.d.ts.map +1 -0
- package/development/radio-button/radio-button-panel/radio-button-panel.d.ts +29 -0
- package/development/radio-button/radio-button-panel/radio-button-panel.d.ts.map +1 -0
- package/development/radio-button/radio-button-panel.d.ts +2 -0
- package/development/radio-button/radio-button-panel.d.ts.map +1 -0
- package/development/radio-button/radio-button-panel.js +69 -0
- package/development/radio-button/radio-button.js +10 -324
- package/development/radio-button.d.ts +2 -0
- package/development/radio-button.d.ts.map +1 -1
- package/development/radio-button.js +3 -1
- package/{selection-panel/selection-panel.d.ts → development/selection-expansion-panel/selection-expansion-panel.d.ts} +9 -7
- package/development/selection-expansion-panel/selection-expansion-panel.d.ts.map +1 -0
- package/development/selection-expansion-panel.d.ts +2 -0
- package/development/selection-expansion-panel.d.ts.map +1 -0
- package/development/selection-expansion-panel.js +340 -0
- package/development/tabs/tab/index.d.ts +2 -0
- package/development/tabs/tab/index.d.ts.map +1 -0
- package/development/tabs/tab/tab.d.ts +24 -0
- package/development/tabs/tab/tab.d.ts.map +1 -0
- package/development/tabs/tab-group/tab-group.d.ts +20 -15
- package/development/tabs/tab-group/tab-group.d.ts.map +1 -1
- package/development/tabs/tab-group.js +24 -14
- package/development/tabs/{tab-title/tab-title.d.ts → tab-label/tab-label.d.ts} +4 -4
- package/development/tabs/{tab-title/tab-title.d.ts.map → tab-label/tab-label.d.ts.map} +1 -1
- package/development/tabs/tab-label.d.ts +2 -0
- package/development/tabs/tab-label.d.ts.map +1 -0
- package/development/tabs/{tab-title.js → tab-label.js} +86 -86
- package/development/tabs/tab.d.ts +2 -0
- package/development/tabs/tab.d.ts.map +1 -0
- package/development/tabs/tab.js +71 -0
- package/development/tabs.d.ts +2 -1
- package/development/tabs.d.ts.map +1 -1
- package/development/tabs.js +3 -2
- package/development/train/train-formation/train-formation.d.ts.map +1 -1
- package/development/train/train-formation.js +12 -12
- 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/index.d.ts +10 -8
- package/index.js +10 -8
- 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 +34 -19
- package/popover/popover.js +110 -110
- package/radio-button/common/radio-button-common.d.ts +22 -0
- package/radio-button/common/radio-button-common.d.ts.map +1 -0
- package/radio-button/common.d.ts +2 -0
- package/radio-button/common.d.ts.map +1 -0
- package/radio-button/common.js +105 -0
- package/radio-button/radio-button/radio-button.d.ts +2 -81
- package/radio-button/radio-button/radio-button.d.ts.map +1 -1
- package/radio-button/radio-button-group/radio-button-group.d.ts +6 -4
- package/radio-button/radio-button-group/radio-button-group.d.ts.map +1 -1
- package/radio-button/radio-button-group.js +86 -80
- package/radio-button/radio-button-panel/index.d.ts +2 -0
- package/radio-button/radio-button-panel/index.d.ts.map +1 -0
- package/radio-button/radio-button-panel/radio-button-panel.d.ts +29 -0
- package/radio-button/radio-button-panel/radio-button-panel.d.ts.map +1 -0
- package/radio-button/radio-button-panel.d.ts +2 -0
- package/radio-button/radio-button-panel.d.ts.map +1 -0
- package/radio-button/radio-button-panel.js +59 -0
- package/radio-button/radio-button.js +20 -143
- package/radio-button.d.ts +2 -0
- package/radio-button.d.ts.map +1 -1
- package/radio-button.js +2 -0
- package/select.js +178 -178
- package/{development/selection-panel/selection-panel.d.ts → selection-expansion-panel/selection-expansion-panel.d.ts} +9 -7
- package/selection-expansion-panel/selection-expansion-panel.d.ts.map +1 -0
- package/selection-expansion-panel.d.ts +2 -0
- package/selection-expansion-panel.d.ts.map +1 -0
- package/selection-expansion-panel.js +146 -0
- package/slider.js +58 -58
- package/standard-theme.css +1 -1
- 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/index.d.ts +2 -0
- package/tabs/tab/index.d.ts.map +1 -0
- package/tabs/tab/tab.d.ts +24 -0
- package/tabs/tab/tab.d.ts.map +1 -0
- package/tabs/tab-group/tab-group.d.ts +20 -15
- package/tabs/tab-group/tab-group.d.ts.map +1 -1
- package/tabs/tab-group.js +85 -75
- package/tabs/{tab-title/tab-title.d.ts → tab-label/tab-label.d.ts} +4 -4
- package/tabs/{tab-title/tab-title.d.ts.map → tab-label/tab-label.d.ts.map} +1 -1
- package/tabs/tab-label.d.ts +2 -0
- package/tabs/tab-label.d.ts.map +1 -0
- package/tabs/tab-label.js +51 -0
- package/tabs/tab.d.ts +2 -0
- package/tabs/tab.d.ts.map +1 -0
- package/tabs/tab.js +41 -0
- package/tabs.d.ts +2 -1
- package/tabs.d.ts.map +1 -1
- package/tabs.js +2 -1
- package/tag/tag-group.js +8 -8
- package/tag/tag.js +27 -27
- 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/train-formation.d.ts.map +1 -1
- package/train/train-formation.js +51 -51
- package/train/train-wagon.js +30 -30
- package/train/train.js +13 -13
- package/development/selection-panel/selection-panel.d.ts.map +0 -1
- package/development/selection-panel.d.ts +0 -2
- package/development/selection-panel.d.ts.map +0 -1
- package/development/selection-panel.js +0 -376
- package/development/tabs/tab-title.d.ts +0 -2
- package/development/tabs/tab-title.d.ts.map +0 -1
- package/development/teaser-hero/teaser-hero.d.ts +0 -26
- package/development/teaser-hero/teaser-hero.d.ts.map +0 -1
- package/development/teaser-hero.d.ts +0 -2
- package/development/teaser-hero.d.ts.map +0 -1
- package/development/teaser-hero.js +0 -181
- package/development/teaser-paid/teaser-paid.d.ts +0 -20
- package/development/teaser-paid/teaser-paid.d.ts.map +0 -1
- package/development/teaser-paid.d.ts +0 -2
- package/development/teaser-paid.d.ts.map +0 -1
- package/development/teaser-paid.js +0 -91
- package/selection-panel/selection-panel.d.ts.map +0 -1
- package/selection-panel.d.ts +0 -2
- package/selection-panel.d.ts.map +0 -1
- package/selection-panel.js +0 -138
- package/tabs/tab-title.d.ts +0 -2
- package/tabs/tab-title.d.ts.map +0 -1
- package/tabs/tab-title.js +0 -51
- package/teaser-hero/teaser-hero.d.ts +0 -26
- package/teaser-hero/teaser-hero.d.ts.map +0 -1
- package/teaser-hero.d.ts +0 -2
- package/teaser-hero.d.ts.map +0 -1
- package/teaser-hero.js +0 -51
- package/teaser-paid/teaser-paid.d.ts +0 -20
- package/teaser-paid/teaser-paid.d.ts.map +0 -1
- package/teaser-paid.d.ts +0 -2
- package/teaser-paid.d.ts.map +0 -1
- package/teaser-paid.js +0 -28
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
|
};
|
|
@@ -1,17 +1,12 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { SbbCheckboxGroupElement } from '../checkbox-group.js';
|
|
1
|
+
import { LitElement, CSSResultGroup, TemplateResult } from 'lit';
|
|
2
|
+
import { SbbIconPlacement } from '../../core/interfaces.js';
|
|
4
3
|
|
|
5
|
-
|
|
6
|
-
export type SbbCheckboxSize = 's' | 'm';
|
|
7
|
-
declare const SbbCheckboxElement_base: import('../../core/mixins.js').AbstractConstructor<import('../../core/mixins.js').SbbUpdateSchedulerMixinType> & import('../../core/mixins.js').Constructor<import('../../core/mixins.js').SbbFormAssociatedCheckboxMixinType> & import('../../core/mixins.js').AbstractConstructor<import('../../icon.js').SbbIconNameMixinType> & import('../../core/mixins.js').AbstractConstructor<import('../../core/mixins.js').SbbHydrationMixinType> & typeof LitElement;
|
|
4
|
+
declare const SbbCheckboxElement_base: import('../../core/mixins.js').Constructor<import('../common.js').SbbCheckboxCommonElementMixinType> & import('../../core/mixins.js').AbstractConstructor<import('../../icon.js').SbbIconNameMixinType> & typeof LitElement;
|
|
8
5
|
/**
|
|
9
6
|
* It displays a checkbox enhanced with the SBB Design.
|
|
10
7
|
*
|
|
11
8
|
* @slot - Use the unnamed slot to add content to the `sbb-checkbox`.
|
|
12
9
|
* @slot icon - Slot used to render the checkbox icon (disabled inside a selection panel).
|
|
13
|
-
* @slot subtext - Slot used to render a subtext under the label (only visible within a selection panel).
|
|
14
|
-
* @slot suffix - Slot used to render additional content after the label (only visible within a selection panel).
|
|
15
10
|
* @event {CustomEvent<void>} didChange - Deprecated. used for React. Will probably be removed once React 19 is available.
|
|
16
11
|
* @event {Event} change - Event fired on change.
|
|
17
12
|
* @event {InputEvent} input - Event fired on input.
|
|
@@ -20,48 +15,10 @@ export declare class SbbCheckboxElement extends SbbCheckboxElement_base {
|
|
|
20
15
|
static styles: CSSResultGroup;
|
|
21
16
|
static readonly events: {
|
|
22
17
|
readonly didChange: "didChange";
|
|
23
|
-
readonly stateChange: "stateChange";
|
|
24
|
-
readonly checkboxLoaded: "checkboxLoaded";
|
|
25
18
|
};
|
|
26
|
-
/** Whether the checkbox is indeterminate. */
|
|
27
|
-
indeterminate: boolean;
|
|
28
19
|
/** The label position relative to the labelIcon. Defaults to end */
|
|
29
20
|
iconPlacement: SbbIconPlacement;
|
|
30
|
-
/** Label size variant, either m or s. */
|
|
31
|
-
set size(value: SbbCheckboxSize);
|
|
32
|
-
get size(): SbbCheckboxSize;
|
|
33
|
-
private _size;
|
|
34
|
-
/** Reference to the connected checkbox group. */
|
|
35
|
-
get group(): SbbCheckboxGroupElement | null;
|
|
36
|
-
private _group;
|
|
37
|
-
/**
|
|
38
|
-
* Whether the input is the main input of a selection panel.
|
|
39
|
-
* @internal
|
|
40
|
-
*/
|
|
41
|
-
get isSelectionPanelInput(): boolean;
|
|
42
|
-
/** The label describing whether the selection panel is expanded (for screen readers only). */
|
|
43
|
-
private _selectionPanelExpandedLabel;
|
|
44
|
-
private _language;
|
|
45
|
-
private _selectionPanelElement;
|
|
46
|
-
/**
|
|
47
|
-
* @internal
|
|
48
|
-
* Internal event that emits whenever the state of the checkbox
|
|
49
|
-
* in relation to the parent selection panel changes.
|
|
50
|
-
*/
|
|
51
|
-
private _stateChange;
|
|
52
|
-
/**
|
|
53
|
-
* @internal
|
|
54
|
-
* Internal event that emits when the checkbox is loaded.
|
|
55
|
-
*/
|
|
56
|
-
private _checkboxLoaded;
|
|
57
21
|
constructor();
|
|
58
|
-
connectedCallback(): void;
|
|
59
|
-
protected willUpdate(changedProperties: PropertyValues<this>): Promise<void>;
|
|
60
|
-
protected firstUpdated(changedProperties: PropertyValues<this>): void;
|
|
61
|
-
protected isDisabledExternally(): boolean;
|
|
62
|
-
protected isRequiredExternally(): boolean;
|
|
63
|
-
protected withUserInteraction(): void;
|
|
64
|
-
private _updateExpandedLabel;
|
|
65
22
|
protected render(): TemplateResult;
|
|
66
23
|
}
|
|
67
24
|
declare global {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/elements/checkbox/checkbox/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"checkbox.d.ts","sourceRoot":"","sources":["../../../../../src/elements/checkbox/checkbox/checkbox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,KAAK,cAAc,EAAE,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAIjF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAIjE,OAAO,0BAA0B,CAAC;;AAIlC;;;;;;;;GAQG;AACH,qBACa,kBAAmB,SAAQ,uBAEvC;IACC,OAAuB,MAAM,EAAE,cAAc,CAAwC;IAErF,gBAAuB,MAAM;;MAElB;IAEX,oEAAoE;IAE7D,aAAa,EAAE,gBAAgB,CAAS;;cAO5B,MAAM,IAAI,cAAc;CAuB5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,cAAc,EAAE,kBAAkB,CAAC;KACpC;CACF"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { CSSResultGroup, PropertyValues, TemplateResult, LitElement } from 'lit';
|
|
2
2
|
import { SbbHorizontalFrom, SbbOrientation } from '../../core/interfaces.js';
|
|
3
|
-
import {
|
|
3
|
+
import { SbbCheckboxPanelElement } from '../checkbox-panel.js';
|
|
4
|
+
import { SbbCheckboxElement } from '../checkbox.js';
|
|
5
|
+
import { SbbCheckboxSize } from '../common.js';
|
|
4
6
|
|
|
5
7
|
declare const SbbCheckboxGroupElement_base: import('../../core/mixins.js').AbstractConstructor<import('../../core/mixins.js').SbbDisabledMixinType> & typeof LitElement;
|
|
6
8
|
/**
|
|
@@ -20,7 +22,7 @@ export declare class SbbCheckboxGroupElement extends SbbCheckboxGroupElement_bas
|
|
|
20
22
|
/** Indicates the orientation of the checkboxes inside the `<sbb-checkbox-group>`. */
|
|
21
23
|
orientation: SbbOrientation;
|
|
22
24
|
/** List of contained checkbox elements. */
|
|
23
|
-
get checkboxes(): SbbCheckboxElement[];
|
|
25
|
+
get checkboxes(): (SbbCheckboxElement | SbbCheckboxPanelElement)[];
|
|
24
26
|
private _abort;
|
|
25
27
|
constructor();
|
|
26
28
|
connectedCallback(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../../../../src/elements/checkbox/checkbox-group/checkbox-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,
|
|
1
|
+
{"version":3,"file":"checkbox-group.d.ts","sourceRoot":"","sources":["../../../../../src/elements/checkbox/checkbox-group/checkbox-group.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,KAAK,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAKvC,OAAO,KAAK,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,0BAA0B,CAAC;AAElF,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,sBAAsB,CAAC;AACpE,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACzD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;;AAIpD;;;;;GAKG;AACH,qBACa,uBAAwB,SAAQ,4BAA4B;IACvE,OAAuB,MAAM,EAAE,cAAc,CAAS;IAEtD,8CAA8C;IACK,QAAQ,UAAS;IAEpE,mCAAmC;IAChB,IAAI,EAAE,eAAe,CAAO;IAE/C,yDAAyD;IAElD,cAAc,CAAC,EAAE,iBAAiB,CAAC;IAE1C,qFAAqF;IAE9E,WAAW,EAAE,cAAc,CAAgB;IAElD,2CAA2C;IAC3C,IAAW,UAAU,IAAI,CAAC,kBAAkB,GAAG,uBAAuB,CAAC,EAAE,CAMxE;IAED,OAAO,CAAC,MAAM,CAAsE;;IAOpE,iBAAiB,IAAI,IAAI;cAUtB,UAAU,CAAC,iBAAiB,EAAE,cAAc,CAAC,IAAI,CAAC,GAAG,IAAI;IAc5E,OAAO,CAAC,cAAc;cA0BH,MAAM,IAAI,cAAc;CAU5C;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,qBAAqB;QAE7B,oBAAoB,EAAE,uBAAuB,CAAC;KAC/C;CACF"}
|