@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/navigation/navigation.js
CHANGED
|
@@ -1,75 +1,75 @@
|
|
|
1
|
-
import { css as
|
|
2
|
-
import { property as
|
|
3
|
-
import { ref as
|
|
4
|
-
import { SbbFocusHandler as
|
|
5
|
-
import { SbbOpenCloseBaseElement as
|
|
6
|
-
import { SbbConnectedAbortController as
|
|
7
|
-
import { hostAttributes as
|
|
8
|
-
import { SbbScrollHandler as
|
|
9
|
-
import { i18nCloseNavigation as
|
|
10
|
-
import { SbbUpdateSchedulerMixin as
|
|
11
|
-
import { AgnosticMutationObserver as
|
|
12
|
-
import { isEventOnElement as l, removeAriaOverlayTriggerAttributes as
|
|
1
|
+
import { css as p, html as v } from "lit";
|
|
2
|
+
import { property as m, state as u, customElement as _ } from "lit/decorators.js";
|
|
3
|
+
import { ref as c } from "lit/directives/ref.js";
|
|
4
|
+
import { SbbFocusHandler as f, setModalityOnNextFocus as g } from "../core/a11y.js";
|
|
5
|
+
import { SbbOpenCloseBaseElement as w } from "../core/base-elements.js";
|
|
6
|
+
import { SbbConnectedAbortController as k, SbbLanguageController as y } from "../core/controllers.js";
|
|
7
|
+
import { hostAttributes as E } from "../core/decorators.js";
|
|
8
|
+
import { SbbScrollHandler as x, findReferencedElement as C } from "../core/dom.js";
|
|
9
|
+
import { i18nCloseNavigation as O } from "../core/i18n.js";
|
|
10
|
+
import { SbbUpdateSchedulerMixin as S } from "../core/mixins.js";
|
|
11
|
+
import { AgnosticMutationObserver as A, AgnosticResizeObserver as N } from "../core/observers.js";
|
|
12
|
+
import { isEventOnElement as l, removeAriaOverlayTriggerAttributes as z, setAriaOverlayTriggerAttributes as T, applyInertMechanism as d, removeInertMechanism as h } from "../core/overlay.js";
|
|
13
13
|
import "../button/transparent-button.js";
|
|
14
|
-
const
|
|
15
|
-
var
|
|
16
|
-
for (var
|
|
17
|
-
(b = t[r]) && (
|
|
18
|
-
return
|
|
14
|
+
const L = p`*,:before,:after{box-sizing:border-box}:host{--sbb-navigation-grid-column: 1 / 5;--sbb-navigation-animation-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-3x) );--sbb-navigation-animation-easing: ease-in;--sbb-navigation-padding-inline: var(--sbb-layout-base-offset-responsive);--sbb-navigation-padding-block-start: var(--sbb-spacing-responsive-l);--sbb-navigation-padding-block-end: var(--sbb-spacing-responsive-xl);--sbb-navigation-backdrop-visibility: hidden;--sbb-navigation-backdrop-pointer-events: none;--sbb-navigation-backdrop-color: transparent;--sbb-navigation-list-margin-block-start: var(--sbb-spacing-responsive-xxl);--sbb-navigation-inline-start: 0;--sbb-navigation-expanded-width: 100%;--sbb-navigation-inset: 0 auto auto 0;--sbb-navigation-transform: translateX(-100%);--sbb-navigation-content-transform: translateX(0);--sbb-navigation-width: 100%;--sbb-navigation-height: 100vh;display:block;position:fixed;inset:var(--sbb-navigation-inset);z-index:var(--sbb-navigation-z-index, var(--sbb-overlay-default-z-index));overflow:hidden;--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark)}@supports (height: 100dvh){:host{--sbb-navigation-height: 100dvh}}@media (min-width: 52.5rem){:host{--sbb-navigation-grid-column: 1 / 9}}@media (min-width: 64rem){:host{--sbb-navigation-grid-column: 1 / 5;--sbb-navigation-animation-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-6x) );--sbb-navigation-padding-block-start: var(--sbb-spacing-responsive-xl);--sbb-navigation-padding-inline: var(--sbb-layout-base-offset-responsive) 0;--sbb-navigation-list-margin-block-start: var(--sbb-spacing-fixed-1x);--sbb-navigation-inline-start: calc(var(--sbb-layout-base-offset-responsive) * -1);--sbb-navigation-width: calc(100% + var(--sbb-layout-base-offset-responsive))}}@media (min-width: 90rem){:host{--sbb-navigation-grid-column: 1 / 6;--sbb-navigation-padding-block-start: var(--sbb-spacing-responsive-xxl)}}:host([data-state=opened]){--sbb-navigation-animation-easing: ease-out}:host(:is([data-state=opened],[data-state=opening])){--sbb-navigation-backdrop-visibility: visible;--sbb-navigation-backdrop-pointer-events: all;--sbb-navigation-backdrop-color: var(--sbb-color-black-alpha-70)}:host(:not([data-state=closed])){--sbb-navigation-inset: 0;--sbb-navigation-transform: translateX(0)}:host([data-has-navigation-section]){--sbb-navigation-content-transform: translateX(-100%)}@media (min-width: 64rem){:host([data-has-navigation-section]){--sbb-navigation-expanded-width: 100vw;--sbb-navigation-content-transform: translateX(0%)}@supports (height: 100dvw){:host([data-has-navigation-section]){--sbb-navigation-expanded-width: 100dvw}}}:host([data-resize-disable-animation]){--sbb-disable-animation-time: .1ms;--sbb-disable-animation-zero-time: 0s}.sbb-navigation__container{display:grid;gap:var(--sbb-grid-base-gutter-responsive);grid-template-columns:repeat(var(--sbb-grid-base-columns),1fr);padding-inline:0;pointer-events:none;transform:var(--sbb-navigation-transform)}@media (min-width: 64rem){.sbb-navigation__container{padding-inline:var(--sbb-layout-base-offset-responsive)}.sbb-navigation__container:before{transition-duration:var(--sbb-navigation-animation-duration);transition-timing-function:var(--sbb-navigation-animation-easing);transition-property:background-color,visibility;content:"";visibility:var(--sbb-navigation-backdrop-visibility);pointer-events:var(--sbb-navigation-backdrop-pointer-events);position:fixed;inset:var(--sbb-navigation-inset);background-color:var(--sbb-navigation-backdrop-color)}}.sbb-navigation{transition-duration:var(--sbb-navigation-animation-duration);transition-timing-function:var(--sbb-navigation-animation-easing);transition-property:width;display:none;width:var(--sbb-navigation-width);grid-column:var(--sbb-navigation-grid-column);padding:0;margin:0;position:relative;inset-inline-start:var(--sbb-navigation-inline-start);inset-block-start:0;border:none;pointer-events:none;height:var(--sbb-navigation-height);color:var(--sbb-color-white);background-color:var(--sbb-color-midnight)}.sbb-navigation:before{transition-duration:var(--sbb-navigation-animation-duration);transition-timing-function:var(--sbb-navigation-animation-easing);transition-property:width;content:"";position:absolute;width:var(--sbb-navigation-expanded-width);height:var(--sbb-navigation-height);background:var(--sbb-color-midnight)}:host([data-state]:not([data-state=closed])) .sbb-navigation{display:block;pointer-events:all;animation-name:open;animation-duration:var(--sbb-navigation-animation-duration);animation-timing-function:var(--sbb-navigation-animation-easing)}:host([data-state][data-state=closing]) .sbb-navigation{pointer-events:none;animation-name:close}@media (forced-colors: active){.sbb-navigation{outline:var(--sbb-border-width-1x) solid CanvasText}}.sbb-navigation__wrapper{outline:none}.sbb-navigation__header{transition-duration:var(--sbb-navigation-animation-duration);transition-timing-function:var(--sbb-navigation-animation-easing);transition-property:width;display:flex;justify-content:flex-end;position:absolute;width:var(--sbb-navigation-expanded-width);pointer-events:none;padding:var(--sbb-spacing-responsive-xs);z-index:calc(var(--sbb-navigation-z-index, var(--sbb-overlay-default-z-index)) + 1)}.sbb-navigation__close{pointer-events:all}.sbb-navigation__content{transition-duration:var(--sbb-navigation-animation-duration);transition-timing-function:var(--sbb-navigation-animation-easing);transition-property:transform;--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: var(--sbb-color-white-alpha-30);--sbb-scrollbar-color-hover: var(--sbb-color-white-alpha-60);--sbb-scrollbar-track-color: transparent;--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x);display:flex;flex-direction:column;gap:var(--sbb-spacing-responsive-xxl);position:relative;height:var(--sbb-navigation-height);padding-inline:var(--sbb-navigation-padding-inline);padding-block:var(--sbb-navigation-padding-block-start) var(--sbb-navigation-padding-block-end);overflow-y:auto;transform:var(--sbb-navigation-content-transform)}.sbb-navigation__content::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-navigation__content::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-navigation__content::-webkit-scrollbar-thumb{background-color:var(--sbb-scrollbar-color, currentcolor);border:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width))) solid transparent;border-radius:var(--sbb-border-radius-4x);background-clip:padding-box}.sbb-navigation__content::-webkit-scrollbar-thumb:hover{background-color:var(--sbb-scrollbar-color-hover, currentcolor);border-width:calc(.5 * (var(--sbb-scrollbar-width) - var(--sbb-scrollbar-thumb-width-hover)))}.sbb-navigation__content::-webkit-scrollbar-button,.sbb-navigation__content::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-navigation__content{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}::slotted(:first-child){margin-block-start:var(--sbb-navigation-list-margin-block-start)}@keyframes open{0%{transform:translate(-100%)}to{transform:translate(0)}}@keyframes close{0%{transform:translate(0)}to{transform:translate(-100%)}}`;
|
|
15
|
+
var B = Object.defineProperty, H = Object.getOwnPropertyDescriptor, s = (t, i, n, a) => {
|
|
16
|
+
for (var e = a > 1 ? void 0 : a ? H(i, n) : i, r = t.length - 1, b; r >= 0; r--)
|
|
17
|
+
(b = t[r]) && (e = (a ? b(i, n, e) : b(e)) || e);
|
|
18
|
+
return a && e && B(i, n, e), e;
|
|
19
19
|
};
|
|
20
|
-
const
|
|
20
|
+
const I = {
|
|
21
21
|
subtree: !0,
|
|
22
22
|
attributeFilter: ["data-state"]
|
|
23
23
|
};
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
let o = class extends
|
|
24
|
+
let P = 0;
|
|
25
|
+
const R = 150;
|
|
26
|
+
let o = class extends S(w) {
|
|
27
27
|
constructor() {
|
|
28
|
-
super(...arguments), this.
|
|
29
|
-
(t) => this.
|
|
30
|
-
), this.
|
|
31
|
-
var i,
|
|
32
|
-
this.
|
|
33
|
-
(
|
|
28
|
+
super(...arguments), this._trigger = null, this._activeNavigationSection = null, this._triggerElement = null, this._abort = new k(this), this._language = new y(this), this._focusHandler = new f(), this._scrollHandler = new x(), this._isPointerDownEventOnNavigation = !1, this._resizeObserverTimeout = null, this._navigationObserver = new A(
|
|
29
|
+
(t) => this._onNavigationSectionChange(t)
|
|
30
|
+
), this._navigationResizeObserver = new N(() => this._onNavigationResize()), this._trapFocusFilter = (t) => t.nodeName !== "SBB-NAVIGATION-SECTION" || t.getAttribute("data-state") === "opened", this._pointerDownListener = (t) => {
|
|
31
|
+
var i, n;
|
|
32
|
+
this._isPointerDownEventOnNavigation = l(this._navigation, t) || l(
|
|
33
|
+
(n = (i = this.querySelector(
|
|
34
34
|
'sbb-navigation-section[data-state="opened"]'
|
|
35
|
-
)) == null ? void 0 : i.shadowRoot) == null ? void 0 :
|
|
35
|
+
)) == null ? void 0 : i.shadowRoot) == null ? void 0 : n.querySelector("nav.sbb-navigation-section"),
|
|
36
36
|
t
|
|
37
37
|
);
|
|
38
|
-
}, this.
|
|
39
|
-
!this.
|
|
38
|
+
}, this._closeOnBackdropClick = (t) => {
|
|
39
|
+
!this._isPointerDownEventOnNavigation && !l(this._navigation, t) && this.close();
|
|
40
40
|
};
|
|
41
41
|
}
|
|
42
42
|
set trigger(t) {
|
|
43
|
-
const i = this.
|
|
44
|
-
this.
|
|
43
|
+
const i = this._trigger;
|
|
44
|
+
this._trigger = t, this._removeTriggerClickListener(this._trigger, i);
|
|
45
45
|
}
|
|
46
46
|
get trigger() {
|
|
47
|
-
return this.
|
|
47
|
+
return this._trigger;
|
|
48
48
|
}
|
|
49
49
|
get activeNavigationSection() {
|
|
50
|
-
return this.
|
|
50
|
+
return this._activeNavigationSection;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* Opens the navigation.
|
|
54
54
|
*/
|
|
55
55
|
open() {
|
|
56
56
|
var t;
|
|
57
|
-
this.state !== "closed" || !this.
|
|
57
|
+
this.state !== "closed" || !this._navigation || this.willOpen.emit() && (this.state = "opening", this._checkActiveActions(), this._checkActiveSection(), this.startUpdate(), this._scrollHandler.disableScroll(), (t = this._triggerElement) == null || t.setAttribute("aria-expanded", "true"));
|
|
58
58
|
}
|
|
59
|
-
|
|
59
|
+
_checkActiveSection() {
|
|
60
60
|
var i;
|
|
61
61
|
const t = this.querySelector(
|
|
62
62
|
"sbb-navigation-button.sbb-active"
|
|
63
63
|
);
|
|
64
64
|
(i = t == null ? void 0 : t.connectedSection) == null || i.open();
|
|
65
65
|
}
|
|
66
|
-
|
|
66
|
+
_checkActiveActions() {
|
|
67
67
|
const t = Array.from(
|
|
68
68
|
this.querySelectorAll(":is(sbb-navigation-button, sbb-navigation-link).sbb-active")
|
|
69
69
|
);
|
|
70
70
|
t == null || t.forEach((i) => {
|
|
71
|
-
var
|
|
72
|
-
return (
|
|
71
|
+
var n;
|
|
72
|
+
return (n = i.marker) == null ? void 0 : n.select(i);
|
|
73
73
|
});
|
|
74
74
|
}
|
|
75
75
|
/**
|
|
@@ -77,87 +77,87 @@ let o = class extends C(k) {
|
|
|
77
77
|
*/
|
|
78
78
|
close() {
|
|
79
79
|
var t;
|
|
80
|
-
this.state === "opened" && this.willClose.emit() && (this.state = "closing", this.startUpdate(), (t = this.
|
|
80
|
+
this.state === "opened" && this.willClose.emit() && (this.state = "closing", this.startUpdate(), (t = this._triggerElement) == null || t.setAttribute("aria-expanded", "false"));
|
|
81
81
|
}
|
|
82
82
|
// Removes trigger click listener on trigger change.
|
|
83
|
-
|
|
84
|
-
var
|
|
85
|
-
t !== i && ((
|
|
83
|
+
_removeTriggerClickListener(t, i) {
|
|
84
|
+
var n, a;
|
|
85
|
+
t !== i && ((n = this._navigationController) == null || n.abort(), (a = this._windowEventsController) == null || a.abort(), this._configure(this.trigger));
|
|
86
86
|
}
|
|
87
87
|
// Check if the trigger is valid and attach click event listeners.
|
|
88
|
-
|
|
88
|
+
_configure(t) {
|
|
89
89
|
var i;
|
|
90
|
-
|
|
91
|
-
signal: this.
|
|
90
|
+
z(this._triggerElement), t && (this._triggerElement = C(t), this._triggerElement && (T(this._triggerElement, "menu", this.id, this.state), (i = this._navigationController) == null || i.abort(), this._navigationController = new AbortController(), this._triggerElement.addEventListener("click", () => this.open(), {
|
|
91
|
+
signal: this._navigationController.signal
|
|
92
92
|
})));
|
|
93
93
|
}
|
|
94
94
|
// In rare cases it can be that the animationEnd event is triggered twice.
|
|
95
95
|
// To avoid entering a corrupt state, exit when state is not expected.
|
|
96
|
-
|
|
97
|
-
var i,
|
|
98
|
-
t.animationName === "open" && this.state === "opening" ? (this.state = "opened", this.didOpen.emit(), this.
|
|
96
|
+
_onAnimationEnd(t) {
|
|
97
|
+
var i, n;
|
|
98
|
+
t.animationName === "open" && this.state === "opening" ? (this.state = "opened", this.didOpen.emit(), this._navigationResizeObserver.observe(this), d(this), this._focusHandler.trap(this, { filter: this._trapFocusFilter }), this._attachWindowEvents(), this._setNavigationFocus()) : t.animationName === "close" && this.state === "closing" && (this.state = "closed", this._navigationContentElement.scrollTo(0, 0), g(this._triggerElement), h(), (i = this._triggerElement) == null || i.focus(), this.didClose.emit(), this._navigationResizeObserver.unobserve(this), this._resetMarkers(), (n = this._windowEventsController) == null || n.abort(), this._focusHandler.disconnect(), this._scrollHandler.enableScroll()), this.completeUpdate();
|
|
99
99
|
}
|
|
100
|
-
|
|
100
|
+
_resetMarkers() {
|
|
101
101
|
const t = Array.from(
|
|
102
102
|
this.querySelectorAll(
|
|
103
103
|
":is(sbb-navigation-button, sbb-navigation-link)[data-action-active]:not(.sbb-active)"
|
|
104
104
|
)
|
|
105
105
|
);
|
|
106
106
|
t == null || t.forEach((i) => {
|
|
107
|
-
var
|
|
108
|
-
return (
|
|
107
|
+
var n;
|
|
108
|
+
return (n = i.marker) == null ? void 0 : n.reset();
|
|
109
109
|
});
|
|
110
110
|
}
|
|
111
|
-
|
|
112
|
-
this.
|
|
113
|
-
signal: this.
|
|
111
|
+
_attachWindowEvents() {
|
|
112
|
+
this._windowEventsController = new AbortController(), window.addEventListener("keydown", (t) => this._onKeydownEvent(t), {
|
|
113
|
+
signal: this._windowEventsController.signal
|
|
114
114
|
});
|
|
115
115
|
}
|
|
116
|
-
|
|
117
|
-
t.composedPath().filter((
|
|
116
|
+
_handleNavigationClose(t) {
|
|
117
|
+
t.composedPath().filter((n) => n instanceof window.HTMLElement).some((n) => this._isCloseElement(n)) && this.close();
|
|
118
118
|
}
|
|
119
|
-
|
|
119
|
+
_isCloseElement(t) {
|
|
120
120
|
return t.nodeName === "A" || t.hasAttribute("sbb-navigation-close") && !t.hasAttribute("disabled");
|
|
121
121
|
}
|
|
122
122
|
// Closes the navigation on "Esc" key pressed.
|
|
123
|
-
|
|
123
|
+
_onKeydownEvent(t) {
|
|
124
124
|
this.state === "opened" && t.key === "Escape" && this.close();
|
|
125
125
|
}
|
|
126
126
|
// Set focus on the first focusable element.
|
|
127
|
-
|
|
127
|
+
_setNavigationFocus() {
|
|
128
128
|
const t = this.shadowRoot.querySelector(
|
|
129
129
|
"#sbb-navigation-close-button"
|
|
130
130
|
);
|
|
131
|
-
|
|
131
|
+
g(t), t.focus();
|
|
132
132
|
}
|
|
133
133
|
// Observe changes on navigation section data-state.
|
|
134
|
-
|
|
134
|
+
_onNavigationSectionChange(t) {
|
|
135
135
|
for (const i of t)
|
|
136
|
-
i.target.nodeName === "SBB-NAVIGATION-SECTION" && (this.
|
|
136
|
+
i.target.nodeName === "SBB-NAVIGATION-SECTION" && (this._activeNavigationSection = this.querySelector(
|
|
137
137
|
'sbb-navigation-section[data-state="opening"], sbb-navigation-section[data-state="opened"]'
|
|
138
|
-
), this.toggleAttribute("data-has-navigation-section", !!this.
|
|
138
|
+
), this.toggleAttribute("data-has-navigation-section", !!this._activeNavigationSection));
|
|
139
139
|
}
|
|
140
|
-
|
|
141
|
-
this.state === "opened" && (this.
|
|
140
|
+
_onNavigationResize() {
|
|
141
|
+
this.state === "opened" && (this._resizeObserverTimeout && clearTimeout(this._resizeObserverTimeout), this.toggleAttribute("data-resize-disable-animation", !0), this._resizeObserverTimeout = setTimeout(
|
|
142
142
|
() => this.removeAttribute("data-resize-disable-animation"),
|
|
143
|
-
|
|
143
|
+
R
|
|
144
144
|
));
|
|
145
145
|
}
|
|
146
146
|
connectedCallback() {
|
|
147
|
-
super.connectedCallback(), this.id || (this.id = `sbb-navigation-${
|
|
148
|
-
const t = this.
|
|
149
|
-
this.addEventListener("click", (i) => this.
|
|
147
|
+
super.connectedCallback(), this.id || (this.id = `sbb-navigation-${P++}`);
|
|
148
|
+
const t = this._abort.signal;
|
|
149
|
+
this.addEventListener("click", (i) => this._handleNavigationClose(i), { signal: t }), this._configure(this.trigger), this._navigationObserver.observe(this, I), this.addEventListener("pointerup", (i) => this._closeOnBackdropClick(i), { signal: t }), this.addEventListener("pointerdown", (i) => this._pointerDownListener(i), { signal: t }), this.state === "opened" && d(this);
|
|
150
150
|
}
|
|
151
151
|
disconnectedCallback() {
|
|
152
152
|
var t, i;
|
|
153
|
-
super.disconnectedCallback(), (t = this.
|
|
153
|
+
super.disconnectedCallback(), (t = this._navigationController) == null || t.abort(), (i = this._windowEventsController) == null || i.abort(), this._focusHandler.disconnect(), this._navigationObserver.disconnect(), this._navigationResizeObserver.disconnect(), h();
|
|
154
154
|
}
|
|
155
155
|
render() {
|
|
156
|
-
const t =
|
|
156
|
+
const t = v`
|
|
157
157
|
<sbb-transparent-button
|
|
158
158
|
id="sbb-navigation-close-button"
|
|
159
159
|
class="sbb-navigation__close"
|
|
160
|
-
aria-label=${this.accessibilityCloseLabel ||
|
|
160
|
+
aria-label=${this.accessibilityCloseLabel || O[this._language.current]}
|
|
161
161
|
aria-controls="sbb-navigation-overlay"
|
|
162
162
|
negative
|
|
163
163
|
size="m"
|
|
@@ -166,19 +166,19 @@ let o = class extends C(k) {
|
|
|
166
166
|
sbb-navigation-close
|
|
167
167
|
></sbb-transparent-button>
|
|
168
168
|
`;
|
|
169
|
-
return
|
|
169
|
+
return v`
|
|
170
170
|
<div class="sbb-navigation__container">
|
|
171
171
|
<div
|
|
172
172
|
id="sbb-navigation-overlay"
|
|
173
|
-
@animationend=${(i) => this.
|
|
173
|
+
@animationend=${(i) => this._onAnimationEnd(i)}
|
|
174
174
|
class="sbb-navigation"
|
|
175
|
-
${
|
|
175
|
+
${c((i) => this._navigation = i)}
|
|
176
176
|
>
|
|
177
177
|
<div class="sbb-navigation__header">${t}</div>
|
|
178
178
|
<div class="sbb-navigation__wrapper">
|
|
179
179
|
<div
|
|
180
180
|
class="sbb-navigation__content"
|
|
181
|
-
${
|
|
181
|
+
${c((i) => this._navigationContentElement = i)}
|
|
182
182
|
>
|
|
183
183
|
<slot></slot>
|
|
184
184
|
</div>
|
|
@@ -189,19 +189,19 @@ let o = class extends C(k) {
|
|
|
189
189
|
`;
|
|
190
190
|
}
|
|
191
191
|
};
|
|
192
|
-
o.styles =
|
|
193
|
-
|
|
194
|
-
|
|
192
|
+
o.styles = L;
|
|
193
|
+
s([
|
|
194
|
+
m()
|
|
195
195
|
], o.prototype, "trigger", 1);
|
|
196
|
-
|
|
197
|
-
|
|
196
|
+
s([
|
|
197
|
+
m({ attribute: "accessibility-close-label" })
|
|
198
198
|
], o.prototype, "accessibilityCloseLabel", 2);
|
|
199
|
-
|
|
199
|
+
s([
|
|
200
200
|
u()
|
|
201
|
-
], o.prototype, "
|
|
202
|
-
o =
|
|
203
|
-
|
|
204
|
-
|
|
201
|
+
], o.prototype, "_activeNavigationSection", 2);
|
|
202
|
+
o = s([
|
|
203
|
+
_("sbb-navigation"),
|
|
204
|
+
E({
|
|
205
205
|
role: "navigation"
|
|
206
206
|
})
|
|
207
207
|
], o);
|
package/notification.js
CHANGED
|
@@ -1,39 +1,39 @@
|
|
|
1
1
|
import { css as f, LitElement as p, html as d, nothing as m } from "lit";
|
|
2
|
-
import { property as
|
|
2
|
+
import { property as a, customElement as h } from "lit/decorators.js";
|
|
3
3
|
import { SbbLanguageController as v, SbbSlotStateController as g } from "./core/controllers.js";
|
|
4
4
|
import { EventEmitter as r } from "./core/eventing.js";
|
|
5
|
-
import { i18nCloseNotification as
|
|
6
|
-
import { AgnosticResizeObserver as
|
|
5
|
+
import { i18nCloseNotification as _ } from "./core/i18n.js";
|
|
6
|
+
import { AgnosticResizeObserver as u } from "./core/observers.js";
|
|
7
7
|
import "./button/secondary-button.js";
|
|
8
8
|
import "./divider.js";
|
|
9
9
|
import "./icon.js";
|
|
10
10
|
import "./title.js";
|
|
11
|
-
const
|
|
12
|
-
var
|
|
13
|
-
for (var n =
|
|
14
|
-
(l = t[c]) && (n = (
|
|
15
|
-
return
|
|
11
|
+
const y = f`*,:before,:after{box-sizing:border-box}:host{--sbb-notification-margin: 0;--sbb-notification-padding-block: var(--sbb-spacing-responsive-xxs);--sbb-notification-padding-inline: var(--sbb-spacing-responsive-xs);--sbb-notification-color: var(--sbb-color-charcoal);--sbb-notification-icon-color: var(--sbb-notification-type-color);--sbb-notification-icon-margin-block-start: 0;--sbb-notification-border-width: var(--sbb-border-width-1x);--sbb-notification-border: var(--sbb-notification-border-width) solid var(--sbb-notification-type-color);--sbb-notification-base-radius: var(--sbb-border-radius-4x);--sbb-notification-border-radius: calc(var(--sbb-notification-base-radius) / 2) var(--sbb-notification-base-radius) var(--sbb-notification-base-radius) calc(var(--sbb-notification-base-radius) / 2);--sbb-notification-animation-duration: var( --sbb-disable-animation-zero-time, var(--sbb-animation-duration-4x) );--sbb-notification-timing-function: ease-in;--sbb-notification-content-padding-inline: var(--sbb-spacing-responsive-xxxs) var(--sbb-spacing-responsive-xs);--sbb-focus-outline-color: var(--sbb-focus-outline-color-default);display:block}:host([data-state=opening]:not([animation=open],[animation=all])){--sbb-disable-animation-time: .1ms;--sbb-disable-animation-zero-time: 0s}:host([data-state=closing]:not([animation=close],[animation=all])){--sbb-disable-animation-time: .1ms;--sbb-disable-animation-zero-time: 0s}:host([data-resize-disable-animation]){--sbb-disable-animation-time: .1ms;--sbb-disable-animation-zero-time: 0s}:host([type=info]){--sbb-notification-type-color: var(--sbb-color-smoke);--sbb-notification-type-color-sass: #f9f9f9;--sbb-notification-icon-color: var(--sbb-notification-color)}:host([type=success]){--sbb-notification-type-color: var(--sbb-color-green);--sbb-notification-type-color-sass: #f2f9f5}:host([type=warn]){--sbb-notification-type-color: var(--sbb-color-peach);--sbb-notification-type-color-sass: #fffcf2;--sbb-notification-icon-color: var(--sbb-notification-color)}:host([type=error]){--sbb-notification-type-color: var(--sbb-color-red);--sbb-notification-type-color-sass: #fef2f2}:host([size=s]){--sbb-notification-padding-block: var(--sbb-spacing-responsive-xxxs);--sbb-notification-padding-inline: var(--sbb-spacing-responsive-xxs) var(--sbb-spacing-responsive-xxxs);--sbb-notification-content-padding-inline: var(--sbb-spacing-responsive-xxxs) var(--sbb-spacing-responsive-xxs)}@media (min-width: 37.5rem){:host{--sbb-notification-icon-margin-block-start: calc( ((1em * var(--sbb-typo-line-height-body-text)) - var(--sbb-size-icon-ui-small)) / 2 )}:host(:where([data-slot-names~=title],[title-content])){--sbb-notification-icon-margin-block-start: calc( ( (var(--sbb-font-size-title-5) * var(--sbb-typo-line-height-body-text)) - var( --sbb-size-icon-ui-small ) ) / 2 )}:host([size=s]){--sbb-notification-padding-inline: var(--sbb-spacing-responsive-xxs);--sbb-notification-icon-margin-block-start: 0}}.sbb-notification__wrapper{position:relative;inset-inline-start:calc(var(--sbb-notification-base-radius) - var(--sbb-notification-border-width));width:calc(100% - (var(--sbb-notification-base-radius) - var(--sbb-notification-border-width)));border:var(--sbb-notification-border);border-radius:var(--sbb-notification-border-radius);opacity:0;max-height:0;margin:0}.sbb-notification__wrapper:before{content:"";position:absolute;inset:calc(var(--sbb-notification-border-width) * -1) var(--sbb-notification-base-radius) calc(var(--sbb-notification-border-width) * -1) calc(var(--sbb-notification-base-radius) * -1);background-color:var(--sbb-notification-type-color);border:var(--sbb-notification-border);border-radius:var(--sbb-notification-base-radius)}:host(:is([data-state=opened],[data-state=closing])) .sbb-notification__wrapper{opacity:1;max-height:calc(var(--sbb-notification-height) + var(--sbb-notification-border-width) * 2);margin:var(--sbb-notification-margin, 0)}:host([data-state=opening]) .sbb-notification__wrapper{animation-name:open;animation-fill-mode:forwards;animation-duration:var(--sbb-notification-animation-duration);animation-timing-function:var(--sbb-notification-timing-function)}:host([data-state=closing]) .sbb-notification__wrapper{animation-name:close,close-height;animation-fill-mode:forwards;animation-duration:var(--sbb-notification-animation-duration);animation-timing-function:var(--sbb-notification-timing-function);animation-delay:0s,var(--sbb-disable-animation-zero-time, var(--sbb-animation-duration-2x))}.sbb-notification{--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:grid;grid-template-columns:1fr auto;align-items:center;padding-block:var(--sbb-notification-padding-block);padding-inline:var(--sbb-notification-padding-inline);color:var(--sbb-notification-color);border-radius:var(--sbb-notification-border-radius);overflow:hidden;background-color:var(--sbb-notification-type-color-sass)}@supports (background-color: color-mix(in srgb,transparent 5%,white)){.sbb-notification{background-color:color-mix(in srgb,var(--sbb-notification-type-color) 5%,white)}}@media (min-width: 37.5rem){.sbb-notification{grid-template-columns:auto 1fr auto;align-items:flex-start}}:host([size=s]) .sbb-notification{--sbb-text-font-size: var(--sbb-font-size-text-xs);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size)}.sbb-notification__icon{color:var(--sbb-notification-icon-color);margin-block-start:var(--sbb-notification-icon-margin-block-start)}.sbb-notification__title{margin:0}:host(:not([data-slot-names~=title],[title-content])) .sbb-notification__title{display:none}.sbb-notification__content{order:3;grid-area:2/1/3/3;margin-block-start:var(--sbb-spacing-fixed-2x)}@media (min-width: 37.5rem){.sbb-notification__content{order:initial;grid-area:initial;margin-block-start:0;padding-inline:var(--sbb-notification-content-padding-inline)}}.sbb-notification__close-wrapper{display:flex;align-items:center;gap:var(--sbb-spacing-responsive-xxs);height:100%}.sbb-notification__divider{--sbb-divider-color: var(--sbb-notification-type-color);display:none;position:relative;inset-inline-start:var(--sbb-border-width-1x);opacity:.2}@media (min-width: 37.5rem){.sbb-notification__divider{display:block;height:calc(100% - var(--sbb-spacing-fixed-1x) * 2)}}@keyframes open{0%{opacity:0;max-height:0;margin:0}to{opacity:1;max-height:calc(var(--sbb-notification-height) + var(--sbb-notification-border-width) * 2);margin:var(--sbb-notification-margin, 0)}}@keyframes close{0%{opacity:1;margin:var(--sbb-notification-margin, 0)}to{opacity:0;margin:0}}@keyframes close-height{0%{max-height:calc(var(--sbb-notification-height) + var(--sbb-notification-border-width) * 2)}to{max-height:0}}`;
|
|
12
|
+
var x = Object.defineProperty, w = Object.getOwnPropertyDescriptor, e = (t, o, b, s) => {
|
|
13
|
+
for (var n = s > 1 ? void 0 : s ? w(o, b) : o, c = t.length - 1, l; c >= 0; c--)
|
|
14
|
+
(l = t[c]) && (n = (s ? l(o, b, n) : l(n)) || n);
|
|
15
|
+
return s && n && x(o, b, n), n;
|
|
16
16
|
};
|
|
17
17
|
const z = /* @__PURE__ */ new Map([
|
|
18
18
|
["info", "circle-information-small"],
|
|
19
19
|
["success", "circle-tick-small"],
|
|
20
20
|
["warn", "circle-exclamation-point-small"],
|
|
21
21
|
["error", "circle-cross-small"]
|
|
22
|
-
]),
|
|
22
|
+
]), O = 150;
|
|
23
23
|
let i = class extends p {
|
|
24
24
|
constructor() {
|
|
25
|
-
super(), this.type = "info", this.titleLevel = "3", this.readonly = !1, this.size = "m", this.animation = "all", this.
|
|
26
|
-
() => this.
|
|
27
|
-
), this.
|
|
25
|
+
super(), this.type = "info", this.titleLevel = "3", this.readonly = !1, this.size = "m", this.animation = "all", this._resizeObserverTimeout = null, this._language = new v(this), this._notificationResizeObserver = new u(
|
|
26
|
+
() => this._onNotificationResize()
|
|
27
|
+
), this._willOpen = new r(
|
|
28
28
|
this,
|
|
29
29
|
i.events.willOpen
|
|
30
|
-
), this.
|
|
30
|
+
), this._didOpen = new r(
|
|
31
31
|
this,
|
|
32
32
|
i.events.didOpen
|
|
33
|
-
), this.
|
|
33
|
+
), this._willClose = new r(
|
|
34
34
|
this,
|
|
35
35
|
i.events.willClose
|
|
36
|
-
), this.
|
|
36
|
+
), this._didClose = new r(
|
|
37
37
|
this,
|
|
38
38
|
i.events.didClose
|
|
39
39
|
), new g(this);
|
|
@@ -41,57 +41,57 @@ let i = class extends p {
|
|
|
41
41
|
/**
|
|
42
42
|
* The state of the notification.
|
|
43
43
|
*/
|
|
44
|
-
set
|
|
44
|
+
set _state(t) {
|
|
45
45
|
this.setAttribute("data-state", t);
|
|
46
46
|
}
|
|
47
|
-
get
|
|
47
|
+
get _state() {
|
|
48
48
|
return this.getAttribute("data-state");
|
|
49
49
|
}
|
|
50
|
-
|
|
51
|
-
this.
|
|
50
|
+
_open() {
|
|
51
|
+
this._state === "closed" && (this._state = "opening", this._willOpen.emit());
|
|
52
52
|
}
|
|
53
53
|
close() {
|
|
54
|
-
this.
|
|
54
|
+
this._state === "opened" && (this._state = "closing", this._willClose.emit());
|
|
55
55
|
}
|
|
56
56
|
connectedCallback() {
|
|
57
|
-
this.
|
|
57
|
+
this._state || (this._state = "closed"), super.connectedCallback();
|
|
58
58
|
}
|
|
59
59
|
async firstUpdated(t) {
|
|
60
60
|
var o;
|
|
61
|
-
super.firstUpdated(t), this.
|
|
61
|
+
super.firstUpdated(t), this._notificationElement = (o = this.shadowRoot) == null ? void 0 : o.querySelector(
|
|
62
62
|
".sbb-notification__wrapper"
|
|
63
|
-
), await this.updateComplete, this.
|
|
63
|
+
), await this.updateComplete, this._setNotificationHeight(), this._open();
|
|
64
64
|
}
|
|
65
65
|
disconnectedCallback() {
|
|
66
|
-
super.disconnectedCallback(), this.
|
|
66
|
+
super.disconnectedCallback(), this._notificationResizeObserver.disconnect();
|
|
67
67
|
}
|
|
68
|
-
|
|
68
|
+
_setNotificationHeight() {
|
|
69
69
|
var o;
|
|
70
|
-
if (!((o = this.
|
|
70
|
+
if (!((o = this._notificationElement) != null && o.scrollHeight))
|
|
71
71
|
return;
|
|
72
|
-
const t = `${this.
|
|
72
|
+
const t = `${this._notificationElement.scrollHeight}px`;
|
|
73
73
|
this.style.setProperty("--sbb-notification-height", t);
|
|
74
74
|
}
|
|
75
|
-
|
|
76
|
-
this.
|
|
75
|
+
_onNotificationResize() {
|
|
76
|
+
this._state === "opened" && (this._resizeObserverTimeout && clearTimeout(this._resizeObserverTimeout), this.toggleAttribute("data-resize-disable-animation", !0), this._setNotificationHeight(), this._resizeObserverTimeout = setTimeout(
|
|
77
77
|
() => this.removeAttribute("data-resize-disable-animation"),
|
|
78
|
-
|
|
78
|
+
O
|
|
79
79
|
));
|
|
80
80
|
}
|
|
81
|
-
|
|
82
|
-
this.
|
|
81
|
+
_onNotificationAnimationEnd(t) {
|
|
82
|
+
this._state === "opening" && t.animationName === "open" && this._handleOpening(), this._state === "closing" && t.animationName === "close-height" && this._handleClosing();
|
|
83
83
|
}
|
|
84
|
-
|
|
85
|
-
this.
|
|
84
|
+
_handleOpening() {
|
|
85
|
+
this._state = "opened", this._didOpen.emit(), this._notificationResizeObserver.observe(this._notificationElement);
|
|
86
86
|
}
|
|
87
|
-
|
|
88
|
-
this.
|
|
87
|
+
_handleClosing() {
|
|
88
|
+
this._state = "closed", this._didClose.emit(), this._notificationResizeObserver.unobserve(this._notificationElement), setTimeout(() => this.remove());
|
|
89
89
|
}
|
|
90
90
|
render() {
|
|
91
91
|
return d`
|
|
92
92
|
<div
|
|
93
93
|
class="sbb-notification__wrapper"
|
|
94
|
-
@animationend=${(t) => this.
|
|
94
|
+
@animationend=${(t) => this._onNotificationAnimationEnd(t)}
|
|
95
95
|
>
|
|
96
96
|
<div class="sbb-notification">
|
|
97
97
|
<sbb-icon
|
|
@@ -116,7 +116,7 @@ let i = class extends p {
|
|
|
116
116
|
size=${this.size}
|
|
117
117
|
icon-name="cross-small"
|
|
118
118
|
@click=${() => this.close()}
|
|
119
|
-
aria-label=${
|
|
119
|
+
aria-label=${_[this._language.current]}
|
|
120
120
|
class="sbb-notification__close"
|
|
121
121
|
></sbb-secondary-button>
|
|
122
122
|
</span>`}
|
|
@@ -125,32 +125,32 @@ let i = class extends p {
|
|
|
125
125
|
`;
|
|
126
126
|
}
|
|
127
127
|
};
|
|
128
|
-
i.styles =
|
|
128
|
+
i.styles = y;
|
|
129
129
|
i.events = {
|
|
130
130
|
willOpen: "willOpen",
|
|
131
131
|
didOpen: "didOpen",
|
|
132
132
|
willClose: "willClose",
|
|
133
133
|
didClose: "didClose"
|
|
134
134
|
};
|
|
135
|
-
|
|
136
|
-
|
|
135
|
+
e([
|
|
136
|
+
a({ reflect: !0 })
|
|
137
137
|
], i.prototype, "type", 2);
|
|
138
|
-
|
|
139
|
-
|
|
138
|
+
e([
|
|
139
|
+
a({ attribute: "title-content", reflect: !0 })
|
|
140
140
|
], i.prototype, "titleContent", 2);
|
|
141
|
-
|
|
142
|
-
|
|
141
|
+
e([
|
|
142
|
+
a({ attribute: "title-level" })
|
|
143
143
|
], i.prototype, "titleLevel", 2);
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
e([
|
|
145
|
+
a({ reflect: !0, type: Boolean })
|
|
146
146
|
], i.prototype, "readonly", 2);
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
e([
|
|
148
|
+
a({ reflect: !0 })
|
|
149
149
|
], i.prototype, "size", 2);
|
|
150
|
-
|
|
151
|
-
|
|
150
|
+
e([
|
|
151
|
+
a({ reflect: !0 })
|
|
152
152
|
], i.prototype, "animation", 2);
|
|
153
|
-
i =
|
|
153
|
+
i = e([
|
|
154
154
|
h("sbb-notification")
|
|
155
155
|
], i);
|
|
156
156
|
export {
|