@sbb-esta/lyne-elements 3.8.0 → 3.10.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/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +1 -1
- package/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +1 -1
- package/calendar/calendar.component.d.ts.map +1 -1
- package/calendar/calendar.component.js +211 -225
- package/carousel/carousel/carousel.component.d.ts.map +1 -1
- package/carousel/carousel/carousel.component.js +5 -5
- package/core/base-elements/open-close-base-element.d.ts +2 -0
- package/core/base-elements/open-close-base-element.d.ts.map +1 -1
- package/core/base-elements/open-close-base-element.js +4 -0
- package/core/controllers/escapable-overlay-controller.js +3 -3
- package/core/controllers/inert-controller.d.ts +8 -1
- package/core/controllers/inert-controller.d.ts.map +1 -1
- package/core/controllers/inert-controller.js +25 -13
- package/core/overlay/position.d.ts +20 -0
- package/core/overlay/position.d.ts.map +1 -1
- package/core/overlay/position.js +34 -23
- package/core/overlay.js +11 -10
- package/core/styles/core.scss +7 -0
- package/core.css +6 -0
- package/custom-elements.json +1152 -661
- package/development/autocomplete-grid/autocomplete-grid-option/autocomplete-grid-option.component.js +7 -1
- package/development/autocomplete-grid/autocomplete-grid-row/autocomplete-grid-row.component.js +2 -1
- package/development/calendar/calendar.component.d.ts.map +1 -1
- package/development/calendar/calendar.component.js +20 -36
- package/development/carousel/carousel/carousel.component.d.ts.map +1 -1
- package/development/carousel/carousel/carousel.component.js +2 -2
- package/development/core/base-elements/open-close-base-element.d.ts +2 -0
- package/development/core/base-elements/open-close-base-element.d.ts.map +1 -1
- package/development/core/base-elements/open-close-base-element.js +5 -1
- package/development/core/controllers/escapable-overlay-controller.js +2 -2
- package/development/core/controllers/inert-controller.d.ts +8 -1
- package/development/core/controllers/inert-controller.d.ts.map +1 -1
- package/development/core/controllers/inert-controller.js +49 -30
- package/development/core/overlay/position.d.ts +20 -0
- package/development/core/overlay/position.d.ts.map +1 -1
- package/development/core/overlay/position.js +41 -1
- package/development/core/overlay.js +2 -1
- package/development/menu/common/menu-action-common.d.ts.map +1 -1
- package/development/menu/common/menu-action-common.js +20 -3
- package/development/menu/menu/menu.component.d.ts +21 -10
- package/development/menu/menu/menu.component.d.ts.map +1 -1
- package/development/menu/menu/menu.component.js +203 -61
- package/development/option/option/option.component.js +4 -2
- package/development/paginator/common/paginator-common.d.ts.map +1 -1
- package/development/paginator/common/paginator-common.js +14 -3
- package/development/tabs/tab/tab.component.d.ts +10 -4
- package/development/tabs/tab/tab.component.d.ts.map +1 -1
- package/development/tabs/tab/tab.component.js +15 -16
- package/development/tabs/tab-group/tab-group.component.d.ts +15 -14
- package/development/tabs/tab-group/tab-group.component.d.ts.map +1 -1
- package/development/tabs/tab-group/tab-group.component.js +46 -175
- package/development/tabs/tab-label/tab-label.component.d.ts +21 -2
- package/development/tabs/tab-label/tab-label.component.d.ts.map +1 -1
- package/development/tabs/tab-label/tab-label.component.js +91 -6
- package/development/tooltip/tooltip.component.d.ts +6 -6
- package/development/tooltip/tooltip.component.d.ts.map +1 -1
- package/development/tooltip/tooltip.component.js +14 -7
- package/menu/common/menu-action-common.d.ts.map +1 -1
- package/menu/common/menu-action-common.js +15 -12
- package/menu/menu/menu.component.d.ts +21 -10
- package/menu/menu/menu.component.d.ts.map +1 -1
- package/menu/menu/menu.component.js +144 -80
- package/off-brand-theme.css +6 -0
- package/option/option/option.component.js +1 -1
- package/package.json +1 -1
- package/paginator/common/paginator-common.d.ts.map +1 -1
- package/paginator/common/paginator-common.js +30 -25
- package/safety-theme.css +6 -0
- package/standard-theme.css +6 -0
- package/tabs/tab/tab.component.d.ts +10 -4
- package/tabs/tab/tab.component.d.ts.map +1 -1
- package/tabs/tab/tab.component.js +22 -24
- package/tabs/tab-group/tab-group.component.d.ts +15 -14
- package/tabs/tab-group/tab-group.component.d.ts.map +1 -1
- package/tabs/tab-group/tab-group.component.js +68 -122
- package/tabs/tab-label/tab-label.component.d.ts +21 -2
- package/tabs/tab-label/tab-label.component.d.ts.map +1 -1
- package/tabs/tab-label/tab-label.component.js +88 -46
- package/tooltip/tooltip.component.d.ts +6 -6
- package/tooltip/tooltip.component.d.ts.map +1 -1
- package/tooltip/tooltip.component.js +59 -54
|
@@ -1,21 +1,24 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var x = (s) => {
|
|
2
|
+
throw TypeError(s);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
6
|
-
import { __esDecorate as
|
|
7
|
-
import { css as
|
|
8
|
-
import { customElement as B, property as
|
|
9
|
-
import { ref as
|
|
4
|
+
var C = (s, i, r) => i.has(s) || x("Cannot " + r);
|
|
5
|
+
var m = (s, i, r) => (C(s, i, "read from private field"), r ? r.call(s) : i.get(s)), g = (s, i, r) => i.has(s) ? x("Cannot add the same private member more than once") : i instanceof WeakSet ? i.add(s) : i.set(s, r), h = (s, i, r, o) => (C(s, i, "write to private field"), o ? o.call(s, r) : i.set(s, r), r);
|
|
6
|
+
import { __esDecorate as _, __runInitializers as u } from "tslib";
|
|
7
|
+
import { css as L, isServer as O, html as M } from "lit";
|
|
8
|
+
import { customElement as B, property as S } from "lit/decorators.js";
|
|
9
|
+
import { ref as T } from "lit/directives/ref.js";
|
|
10
10
|
import { SbbFocusTrapController as I, isArrowKeyOrPageKeysPressed as P, interactivityChecker as D, getNextElementIndex as U } from "../../core/a11y.js";
|
|
11
11
|
import { SbbOpenCloseBaseElement as z } from "../../core/base-elements.js";
|
|
12
|
-
import { SbbEscapableOverlayController as
|
|
13
|
-
import { idReference as
|
|
14
|
-
import { SbbScrollHandler as
|
|
15
|
-
import { forwardEvent as
|
|
16
|
-
import {
|
|
17
|
-
import {
|
|
18
|
-
|
|
12
|
+
import { SbbEscapableOverlayController as R, SbbInertController as K, SbbMediaQueryBreakpointSmallAndBelow as $, SbbMediaMatcherController as H, SbbDarkModeController as q, SbbLanguageController as F } from "../../core/controllers.js";
|
|
13
|
+
import { idReference as Z, forceType as j } from "../../core/decorators.js";
|
|
14
|
+
import { SbbScrollHandler as V, isZeroAnimationDuration as W } from "../../core/dom.js";
|
|
15
|
+
import { forwardEvent as G } from "../../core/eventing.js";
|
|
16
|
+
import { i18nGoBack as Q } from "../../core/i18n/i18n.js";
|
|
17
|
+
import { SbbNamedSlotListMixin as J } from "../../core/mixins.js";
|
|
18
|
+
import { isEventOnElement as A, removeAriaOverlayTriggerAttributes as X, setAriaOverlayTriggerAttributes as Y, getElementPosition as ee, getElementPositionHorizontal as te } from "../../core/overlay.js";
|
|
19
|
+
import "../../divider.js";
|
|
20
|
+
import "../menu-button.js";
|
|
21
|
+
const se = L`*,:before,:after{box-sizing:border-box}:host{display:contents;--sbb-menu-position-x: 0;--sbb-menu-position-y: 0;--sbb-menu-animation-duration: var( --sbb-disable-animation-duration, var(--sbb-animation-duration-6x) );--sbb-menu-animation-easing: ease;--sbb-menu-transform-y: 100%;--sbb-menu-transform-x: 0%;--sbb-menu-max-width: 100%;--sbb-menu-min-width: 100%;--sbb-menu-inset: 0 auto auto 0;--sbb-menu-container-height: 100dvh;--sbb-menu-max-height: calc(85vh - var(--sbb-spacing-fixed-8x));--sbb-menu-min-height: 3.03125rem;--sbb-menu-border-radius: var(--sbb-border-radius-4x);--sbb-menu-visibility: hidden;--sbb-menu-backdrop-color: transparent;--sbb-menu-color: var(--sbb-color-2-inverted);--sbb-menu-background-color: var(--sbb-background-color-1-inverted);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark);--sbb-scrollbar-thumb-width: .125rem;--sbb-scrollbar-thumb-width-hover: .25rem;--sbb-scrollbar-width-firefox: thin;--sbb-scrollbar-color: color-mix(in srgb, var(--sbb-color-white) 30%, transparent);--sbb-scrollbar-color-hover: color-mix(in srgb, var(--sbb-color-white) 60%, transparent);--sbb-scrollbar-track-color: transparent}@media (min-width: 52.5rem){:host{--sbb-menu-transform-y: var(--sbb-spacing-fixed-2x);--sbb-menu-max-width: 20rem;--sbb-menu-min-width: 11.25rem;--sbb-menu-back-button-display: none}}:host(:is([data-state=opened],[data-state=opening])){--sbb-menu-visibility: visible;--sbb-menu-backdrop-color: color-mix(in srgb, var(--sbb-color-black) 20%, transparent)}@media (min-width: 52.5rem){:host(:is([data-state=opened],[data-state=opening])){--sbb-menu-backdrop-color: transparent}}:host(:not(:is(:state(nested),[state--nested]))){--sbb-menu-back-button-display: none}:host(:not([data-state=closed])){--sbb-menu-inset: 0}:host(:is(:state(dark),[state--dark])){--sbb-focus-outline-color: var(--sbb-focus-outline-color-default);--sbb-scrollbar-color: color-mix(in srgb, var(--sbb-color-black) 30%, transparent);--sbb-scrollbar-color-hover: color-mix(in srgb, var(--sbb-color-black) 60%, transparent)}@media (max-width: 52.4375rem){:host(:is(:state(skip-animation),[state--skip-animation])){--sbb-menu-animation-duration: 0ms}:host(:is(:state(nested-child),[state--nested-child])){--sbb-menu-transform-x: -100%}:host(:is(:state(nested),[state--nested])[data-state]:not([data-state=closed])){--sbb-menu-open-animation-name: open-sideways}:host([data-state][data-state=closing]:is(:state(nested),[state--nested]):not(:is(:state(close-all),[state--close-all]))){--sbb-menu-close-animation-name: close-sideways}}::slotted(:not(sbb-menu-button,sbb-menu-link,sbb-divider)){display:block;padding-inline:var(--sbb-spacing-fixed-5x)}sbb-divider,::slotted(sbb-divider){--sbb-divider-color: var(--sbb-background-color-4-inverted);margin-block:var(--sbb-spacing-fixed-2x)}sbb-divider,#sbb-menu__back-button{display:var(--sbb-menu-back-button-display, block)}.sbb-menu__container{position:fixed;pointer-events:none;inset:var(--sbb-menu-inset);height:var(--sbb-menu-container-height);z-index:var(--sbb-menu-z-index, var(--sbb-overlay-default-z-index))}.sbb-menu__container:before{content:"";visibility:var(--sbb-menu-visibility);pointer-events:all;position:fixed;inset:var(--sbb-menu-inset);height:var(--sbb-menu-container-height);background-color:var(--sbb-menu-backdrop-color);transition-duration:var(--sbb-menu-animation-duration);transition-timing-function:var(--sbb-menu-animation-easing);transition-property:background-color,visibility}:host(:is(:state(nested),[state--nested])) .sbb-menu__container:before{display:none}.sbb-menu{display:none;opacity:0;pointer-events:none;max-width:var(--sbb-menu-max-width);min-width:var(--sbb-menu-min-width);text-align:start;position:absolute;inset-inline-start:0;inset-block-start:unset;inset-block-end:0;inset-inline-end:unset;color:var(--sbb-menu-color);border:none;border-radius:var(--sbb-menu-border-radius) var(--sbb-menu-border-radius) 0 0;background-color:var(--sbb-menu-background-color);padding:0;overflow:hidden;translate:var(--sbb-menu-transform-x) 0;transition:translate var(--sbb-menu-animation-duration)}:host([data-state]:not([data-state=closed])) .sbb-menu{display:block;opacity:1;pointer-events:all;animation-name:var(--sbb-menu-open-animation-name, open);animation-duration:var(--sbb-menu-animation-duration);animation-timing-function:var(--sbb-menu-animation-easing)}:host([data-state][data-state=closing]) .sbb-menu{pointer-events:none;animation-name:var(--sbb-menu-close-animation-name, close)}@media (forced-colors: active){.sbb-menu{outline:var(--sbb-border-width-1x) solid CanvasText}}@media (min-width: 52.5rem){.sbb-menu{top:0;bottom:unset;left:0;right:unset;max-height:fit-content;border-radius:var(--sbb-menu-border-radius)}:host(:not([data-state=closed])) .sbb-menu{top:var(--sbb-menu-position-y);left:var(--sbb-menu-position-x);max-height:var(--sbb-menu-max-height);min-height:var(--sbb-menu-min-height)}}.sbb-menu__content{--sbb-scrollbar-width: var(--sbb-spacing-fixed-3x)}.sbb-menu__content::-webkit-scrollbar{width:var(--sbb-scrollbar-width);height:var(--sbb-scrollbar-width);background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-menu__content::-webkit-scrollbar-corner{background-color:var(--sbb-scrollbar-track-color, transparent)}.sbb-menu__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-menu__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-menu__content::-webkit-scrollbar-button,.sbb-menu__content::-webkit-scrollbar-corner{display:none}@supports not selector(::-webkit-scrollbar){.sbb-menu__content{scrollbar-width:var(--sbb-scrollbar-width-firefox);scrollbar-color:var(--sbb-scrollbar-color, currentcolor) var(--sbb-scrollbar-track-color, transparent)}}.sbb-menu__content{max-height:var(--sbb-menu-max-height);padding-block:var(--sbb-spacing-fixed-1x);overflow:auto;outline:none}.sbb-menu__content:after{content:"";display:block;height:var(--sbb-spacing-fixed-8x)}@media (min-width: 52.5rem){.sbb-menu__content{max-height:fit-content}:host(:not([data-state=closed])) .sbb-menu__content{max-height:var(--sbb-menu-max-height);min-height:var(--sbb-menu-min-height)}.sbb-menu__content:after{display:none}}.sbb-menu-list{list-style:none;margin:0;padding:0;font-size:inherit}::slotted(:is([data-sbb-link],[data-sbb-button])){color-scheme:only light}@keyframes open{0%{opacity:0;translate:0 var(--sbb-menu-transform-y)}to{opacity:1;translate:0 0}}@keyframes close{0%{opacity:1;translate:0 0}to{opacity:0;translate:0 var(--sbb-menu-transform-y)}}@keyframes open-sideways{0%{translate:100% 0}to{translate:0 0}}@keyframes close-sideways{0%{translate:0 0}to{translate:100% 0}}`, N = 8, ie = -4, ne = [
|
|
19
22
|
"A",
|
|
20
23
|
"BUTTON",
|
|
21
24
|
"SBB-BUTTON",
|
|
@@ -23,25 +26,29 @@ const J = T`*,:before,:after{box-sizing:border-box}:host{display:contents;--sbb-
|
|
|
23
26
|
"SBB-LINK",
|
|
24
27
|
"SBB-BLOCK-LINK",
|
|
25
28
|
"SBB-LINK-BUTTON",
|
|
26
|
-
"SBB-BLOCK-LINK-BUTTON"
|
|
29
|
+
"SBB-BLOCK-LINK-BUTTON",
|
|
30
|
+
"SBB-MENU-BUTTON",
|
|
31
|
+
"SBB-MENU-LINK"
|
|
27
32
|
];
|
|
28
|
-
let
|
|
29
|
-
var l, b,
|
|
30
|
-
let
|
|
31
|
-
return
|
|
33
|
+
let re = 0, Ee = (() => {
|
|
34
|
+
var l, b, a;
|
|
35
|
+
let s = [B("sbb-menu")], i, r = [], o, p = J(z), v, f = [], w = [], y, k = [], E = [];
|
|
36
|
+
return a = class extends p {
|
|
32
37
|
constructor() {
|
|
33
38
|
super();
|
|
34
39
|
g(this, l);
|
|
35
40
|
g(this, b);
|
|
36
|
-
this.listChildLocalNames = ["sbb-menu-button", "sbb-menu-link"], h(this, l,
|
|
37
|
-
[
|
|
41
|
+
this.listChildLocalNames = ["sbb-menu-button", "sbb-menu-link"], h(this, l, u(this, f, null)), h(this, b, (u(this, w), u(this, k, ""))), this._menu = u(this, E), this._triggerElement = null, this._isPointerDownEventOnMenu = !1, this._escapableOverlayController = new R(this), this._focusTrapController = new I(this), this._scrollHandler = new V(), this._inertController = new K(this), this._mobileBreakpoint = $, this._mediaMatcher = new H(this, {
|
|
42
|
+
[this._mobileBreakpoint]: (e) => {
|
|
38
43
|
e && (this.state === "opening" || this.state === "opened") ? this._scrollHandler.disableScroll() : this._scrollHandler.enableScroll();
|
|
39
44
|
}
|
|
40
|
-
}), this._darkModeController = new
|
|
41
|
-
|
|
45
|
+
}), this._darkModeController = new q(this, () => this._syncNegative()), this._language = new F(this), this._nestedMenu = null, this._pointerDownListener = (e) => {
|
|
46
|
+
const t = e.target.closest("sbb-menu");
|
|
47
|
+
this._isPointerDownEventOnMenu = A(this._menu, e) || this._nestedMenus().some((n) => t === n);
|
|
42
48
|
}, this._closeOnBackdropClick = (e) => {
|
|
43
|
-
|
|
44
|
-
|
|
49
|
+
const t = e.target;
|
|
50
|
+
!this._isPointerDownEventOnMenu && !A(this._menu, e) && !this._nestedMenus().some((n) => n === t) && this.closeAll();
|
|
51
|
+
}, this.addEventListener?.("keydown", (e) => this._handleKeyDown(e));
|
|
45
52
|
}
|
|
46
53
|
/**
|
|
47
54
|
* The element that will trigger the menu overlay.
|
|
@@ -49,7 +56,7 @@ let te = 0, pe = (() => {
|
|
|
49
56
|
* For attribute usage, provide an id reference.
|
|
50
57
|
*/
|
|
51
58
|
get trigger() {
|
|
52
|
-
return
|
|
59
|
+
return m(this, l);
|
|
53
60
|
}
|
|
54
61
|
set trigger(e) {
|
|
55
62
|
h(this, l, e);
|
|
@@ -59,54 +66,75 @@ let te = 0, pe = (() => {
|
|
|
59
66
|
* Used only if the menu automatically renders the actions inside as a list.
|
|
60
67
|
*/
|
|
61
68
|
get listAccessibilityLabel() {
|
|
62
|
-
return
|
|
69
|
+
return m(this, b);
|
|
63
70
|
}
|
|
64
71
|
set listAccessibilityLabel(e) {
|
|
65
72
|
h(this, b, e);
|
|
66
73
|
}
|
|
74
|
+
firstUpdated(e) {
|
|
75
|
+
super.firstUpdated(e), this._configureTrigger();
|
|
76
|
+
}
|
|
77
|
+
escapeStrategy() {
|
|
78
|
+
this.closeAll();
|
|
79
|
+
}
|
|
67
80
|
/**
|
|
68
81
|
* Opens the menu on trigger click.
|
|
69
82
|
*/
|
|
70
83
|
open() {
|
|
71
|
-
this.state === "closing" ||
|
|
84
|
+
if (!(this.state === "closing" || this.state === "opened" || !this._menu || !this.dispatchBeforeOpenEvent())) {
|
|
85
|
+
if (this._isNested()) {
|
|
86
|
+
const e = this._parentMenu();
|
|
87
|
+
e.toggleState("nested-child", !0), e._nestedMenu !== this && e._nestedMenu?.close(), e._nestedMenu = this;
|
|
88
|
+
}
|
|
89
|
+
this.showPopover?.(), this.state = "opening", this._setMenuPosition(), this._triggerElement?.setAttribute("aria-expanded", "true"), this._isMobile() && this._scrollHandler.disableScroll(), this._isZeroAnimationDuration() && this._handleOpening();
|
|
90
|
+
}
|
|
72
91
|
}
|
|
73
|
-
/**
|
|
74
|
-
* Closes the menu.
|
|
75
|
-
*/
|
|
92
|
+
/** Closes the menu and all its nested menus. */
|
|
76
93
|
close() {
|
|
77
|
-
this.
|
|
94
|
+
this._close();
|
|
95
|
+
}
|
|
96
|
+
/** Closes the menu and all related menus nested and parent menus). */
|
|
97
|
+
closeAll() {
|
|
98
|
+
this._mainMenu()._close(!0);
|
|
99
|
+
}
|
|
100
|
+
/** @param [closeAll='false'] - If true, it ensures animations are correct by toggling some states when closing all related menus at once. */
|
|
101
|
+
_close(e = !1) {
|
|
102
|
+
if (!(this.state === "opening" && !this._isNested() || !this.dispatchBeforeCloseEvent())) {
|
|
103
|
+
if (this._nestedMenu?._close(e), this._isNested()) {
|
|
104
|
+
const t = this._parentMenu();
|
|
105
|
+
this.toggleState("close-all", e), t.toggleState("skip-animation", e), t.toggleState("nested-child", !1), t._nestedMenu = null;
|
|
106
|
+
}
|
|
107
|
+
this.state = "closing", this._triggerElement?.setAttribute("aria-expanded", "false"), this._isZeroAnimationDuration() && this._handleClosing();
|
|
108
|
+
}
|
|
78
109
|
}
|
|
79
110
|
_isZeroAnimationDuration() {
|
|
80
|
-
return
|
|
111
|
+
return W(this, "--sbb-menu-animation-duration");
|
|
81
112
|
}
|
|
82
113
|
_handleOpening() {
|
|
83
|
-
this.state = "opened", this._inertController.activate(), this._escapableOverlayController.connect(), this._focusTrapController.focusInitialElement(), this._focusTrapController.enabled = !0, this._attachWindowEvents(), this.dispatchOpenEvent();
|
|
114
|
+
this.state = "opened", this._isNested() ? this._updateNestedInert() : this._inertController.activate(), this._escapableOverlayController.connect(), this._focusTrapController.focusInitialElement(), this._focusTrapController.enabled = !0, this._attachWindowEvents(), this.dispatchOpenEvent();
|
|
84
115
|
}
|
|
85
116
|
_handleClosing() {
|
|
86
|
-
this.state = "closed", this.hidePopover?.(), this._menu?.firstElementChild?.scrollTo(0, 0), this._inertController.deactivate(), this._triggerElement?.focus({
|
|
117
|
+
this.state = "closed", this.toggleState("skip-animation", !1), this.toggleState("close-all", !1), this.hidePopover?.(), this._menu?.firstElementChild?.scrollTo(0, 0), this._isNested() ? this._updateNestedInert() : this._inertController.deactivate(), this._triggerElement?.focus({
|
|
87
118
|
// When inside the sbb-header, we prevent the scroll to avoid the snapping to the top of the page
|
|
88
|
-
preventScroll:
|
|
119
|
+
preventScroll: ["sbb-header-button", "sbb-header-link"].includes(this._triggerElement.localName)
|
|
89
120
|
}), this._escapableOverlayController.disconnect(), this.dispatchCloseEvent(), this._windowEventsController?.abort(), this._focusTrapController.enabled = !1, this._scrollHandler.enableScroll();
|
|
90
121
|
}
|
|
91
|
-
/**
|
|
92
|
-
* Handles click and checks if its target is a sbb-menu-button/sbb-menu-link.
|
|
93
|
-
*/
|
|
94
|
-
_onClick(e) {
|
|
95
|
-
const t = e.target;
|
|
96
|
-
(t?.localName === "sbb-menu-button" || t?.localName === "sbb-menu-link") && this.close();
|
|
97
|
-
}
|
|
98
122
|
_handleKeyDown(e) {
|
|
99
123
|
if (!P(e))
|
|
100
124
|
return;
|
|
101
125
|
e.preventDefault();
|
|
102
|
-
const t = Array.from(this.querySelectorAll("sbb-menu-button, sbb-menu-link")).filter((d) => (!d.disabled || d.disabledInteractive) && D.isVisible(d)),
|
|
126
|
+
const t = Array.from(this.querySelectorAll("sbb-menu-button, sbb-menu-link")).concat(this.shadowRoot.querySelector("sbb-menu-button")).filter((d) => (!d.disabled || d.disabledInteractive) && D.isVisible(d)), n = t.findIndex((d) => d === e.target);
|
|
103
127
|
let c;
|
|
104
128
|
switch (e.key) {
|
|
105
129
|
case "ArrowUp":
|
|
106
130
|
case "ArrowDown":
|
|
131
|
+
c = U(e, n, t.length);
|
|
132
|
+
break;
|
|
107
133
|
case "ArrowLeft":
|
|
134
|
+
this._isNested() && this.close();
|
|
135
|
+
break;
|
|
108
136
|
case "ArrowRight":
|
|
109
|
-
|
|
137
|
+
e.target.hasAttribute("data-sbb-menu-trigger") && e.target.click();
|
|
110
138
|
break;
|
|
111
139
|
case "PageUp":
|
|
112
140
|
case "Home":
|
|
@@ -116,11 +144,8 @@ let te = 0, pe = (() => {
|
|
|
116
144
|
case "PageDown":
|
|
117
145
|
c = t.length - 1;
|
|
118
146
|
break;
|
|
119
|
-
// this should never happen since all the case allowed by `isArrowKeyOrPageKeysPressed` should be covered
|
|
120
|
-
default:
|
|
121
|
-
c = 0;
|
|
122
147
|
}
|
|
123
|
-
t[c].focus();
|
|
148
|
+
c !== void 0 && t[c].focus();
|
|
124
149
|
}
|
|
125
150
|
// Removes trigger click listener on trigger change.
|
|
126
151
|
createRenderRoot() {
|
|
@@ -132,25 +157,22 @@ let te = 0, pe = (() => {
|
|
|
132
157
|
}), e;
|
|
133
158
|
}
|
|
134
159
|
connectedCallback() {
|
|
135
|
-
this.popover = "manual", super.connectedCallback(), this.id ||= `sbb-menu-${
|
|
160
|
+
this.popover = "manual", super.connectedCallback(), this.id ||= `sbb-menu-${re++}`, this.hasUpdated && this._configureTrigger();
|
|
136
161
|
}
|
|
137
162
|
disconnectedCallback() {
|
|
138
163
|
super.disconnectedCallback(), this._triggerElement = null, this._triggerAbortController?.abort(), this._windowEventsController?.abort(), this._scrollHandler.enableScroll();
|
|
139
164
|
}
|
|
140
|
-
requestUpdate(e, t,
|
|
141
|
-
super.requestUpdate(e, t,
|
|
142
|
-
}
|
|
143
|
-
firstUpdated(e) {
|
|
144
|
-
super.firstUpdated(e), this._configureTrigger();
|
|
165
|
+
requestUpdate(e, t, n) {
|
|
166
|
+
super.requestUpdate(e, t, n), !O && (!e || e === "trigger") && this.hasUpdated && this._configureTrigger();
|
|
145
167
|
}
|
|
146
168
|
_checkListCase(e) {
|
|
147
169
|
this.children?.length && Array.from(this.children ?? []).every((t) => t.localName === "sbb-menu-button" || t.localName === "sbb-menu-link") || (e.stopImmediatePropagation(), this.listChildren.length && (this.listChildren.forEach((t) => t.removeAttribute("slot")), this.listChildren = []));
|
|
148
170
|
}
|
|
149
171
|
// Check if the trigger is valid and attach click event listeners.
|
|
150
172
|
_configureTrigger() {
|
|
151
|
-
this.trigger !== this._triggerElement && (this._triggerAbortController?.abort(),
|
|
173
|
+
this.trigger !== this._triggerElement && (this._triggerAbortController?.abort(), X(this._triggerElement), this._triggerElement = this.trigger, this._triggerElement && (Y(this._triggerElement, "menu", this.id, this.state), this._triggerAbortController = new AbortController(), this._triggerElement.addEventListener("click", () => this.open(), {
|
|
152
174
|
signal: this._triggerAbortController.signal
|
|
153
|
-
})));
|
|
175
|
+
}), this.toggleState("nested", ["sbb-menu-button", "sbb-menu-link"].includes(this._triggerElement.localName)), this._triggerElement.toggleAttribute("data-sbb-menu-trigger", !0)));
|
|
154
176
|
}
|
|
155
177
|
_attachWindowEvents() {
|
|
156
178
|
this._windowEventsController = new AbortController(), document.addEventListener("scroll", () => this._setMenuPosition(), {
|
|
@@ -162,30 +184,60 @@ let te = 0, pe = (() => {
|
|
|
162
184
|
}), window.addEventListener("resize", () => this._setMenuPosition(), {
|
|
163
185
|
passive: !0,
|
|
164
186
|
signal: this._windowEventsController.signal
|
|
165
|
-
}), window.addEventListener("pointerdown", this._pointerDownListener, {
|
|
187
|
+
}), this._isNested() || (window.addEventListener("pointerdown", this._pointerDownListener, {
|
|
166
188
|
signal: this._windowEventsController.signal
|
|
167
189
|
}), window.addEventListener("pointerup", this._closeOnBackdropClick, {
|
|
168
190
|
signal: this._windowEventsController.signal
|
|
169
|
-
});
|
|
191
|
+
}));
|
|
170
192
|
}
|
|
171
193
|
// Close menu at any click on an interactive element inside the <sbb-menu> that bubbles to the container.
|
|
172
|
-
|
|
194
|
+
_interactiveElementClick(e) {
|
|
173
195
|
const t = e.target;
|
|
174
|
-
|
|
196
|
+
ne.includes(t.nodeName) && !t.hasAttribute("disabled") && !t.hasAttribute("data-sbb-menu-trigger") && t.id !== "sbb-menu__back-button" && this.closeAll();
|
|
197
|
+
}
|
|
198
|
+
/** Converts the linked list into an array of SbbMenuElement. */
|
|
199
|
+
_nestedMenus() {
|
|
200
|
+
const e = [];
|
|
201
|
+
let t = this._nestedMenu;
|
|
202
|
+
for (; t; )
|
|
203
|
+
e.push(t), t = t._nestedMenu;
|
|
204
|
+
return e;
|
|
205
|
+
}
|
|
206
|
+
_parentMenu() {
|
|
207
|
+
return this._triggerElement?.closest("sbb-menu") ?? null;
|
|
208
|
+
}
|
|
209
|
+
/** The outermost menu. */
|
|
210
|
+
_mainMenu() {
|
|
211
|
+
return this._isNested() ? this._parentMenu()?._mainMenu() ?? this : this;
|
|
212
|
+
}
|
|
213
|
+
_isNested() {
|
|
214
|
+
return !!this._parentMenu();
|
|
215
|
+
}
|
|
216
|
+
_updateNestedInert() {
|
|
217
|
+
this._inertController.restoreAllExempted(), this._mainMenu()._nestedMenus().forEach((e) => this._inertController.exempt(e));
|
|
218
|
+
}
|
|
219
|
+
// Check if nested menu should be closed.
|
|
220
|
+
_handleMouseOver(e) {
|
|
221
|
+
const t = e.target, n = this._isMobile();
|
|
222
|
+
!n && this._nestedMenu && !t.classList.contains("sbb-menu__content") && t.getAttribute("aria-expanded") !== "true" && this._nestedMenu.close(), t.hasAttribute("data-sbb-menu-trigger") && !n && t.click();
|
|
175
223
|
}
|
|
176
224
|
// Set menu position (x, y) to '0' once the menu is closed and the transition ended to prevent the
|
|
177
225
|
// viewport from overflowing. And set the focus to the first focusable element once the menu is open.
|
|
178
226
|
// In rare cases it can be that the animationEnd event is triggered twice.
|
|
179
227
|
// To avoid entering a corrupt state, exit when state is not expected.
|
|
180
228
|
_onMenuAnimationEnd(e) {
|
|
181
|
-
e.animationName === "open" && this.state === "opening" ? this._handleOpening() : e.animationName === "close" && this.state === "closing" && this._handleClosing();
|
|
229
|
+
(e.animationName === "open" || e.animationName === "open-sideways") && this.state === "opening" ? this._handleOpening() : (e.animationName === "close" || e.animationName === "close-sideways") && this.state === "closing" && this._handleClosing();
|
|
182
230
|
}
|
|
183
231
|
// Set menu position and max height if the breakpoint is medium-ultra.
|
|
184
232
|
_setMenuPosition() {
|
|
185
|
-
if (
|
|
233
|
+
if (this._isMobile() || !this._menu || !this._triggerElement || this.state === "closing")
|
|
186
234
|
return;
|
|
187
|
-
const e =
|
|
188
|
-
|
|
235
|
+
const e = this._isNested() ? te(this.shadowRoot.querySelector(".sbb-menu__content"), this._triggerElement, this.shadowRoot.querySelector(".sbb-menu__container"), {
|
|
236
|
+
horizontalOffset: N,
|
|
237
|
+
verticalOffset: ie,
|
|
238
|
+
contentSelector: ".sbb-menu__content"
|
|
239
|
+
}) : ee(this.shadowRoot.querySelector(".sbb-menu__content"), this._triggerElement, this.shadowRoot.querySelector(".sbb-menu__container"), {
|
|
240
|
+
verticalOffset: N
|
|
189
241
|
});
|
|
190
242
|
this.style.setProperty("--sbb-menu-position-x", `${e.left}px`), this.style.setProperty("--sbb-menu-position-y", `${e.top}px`), this.style.setProperty("--sbb-menu-max-height", e.maxHeight);
|
|
191
243
|
}
|
|
@@ -194,34 +246,46 @@ let te = 0, pe = (() => {
|
|
|
194
246
|
customElements.upgrade(e), e.negative = !this._darkModeController.matches();
|
|
195
247
|
});
|
|
196
248
|
}
|
|
249
|
+
_isMobile() {
|
|
250
|
+
return this._mediaMatcher.matches(this._mobileBreakpoint) ?? !0;
|
|
251
|
+
}
|
|
197
252
|
render() {
|
|
198
|
-
return
|
|
253
|
+
return M`
|
|
199
254
|
<div class="sbb-menu__container">
|
|
200
255
|
<div
|
|
201
256
|
@animationend=${this._onMenuAnimationEnd}
|
|
257
|
+
@mouseover=${(e) => this._handleMouseOver(e)}
|
|
202
258
|
class="sbb-menu"
|
|
203
|
-
${
|
|
259
|
+
${T((e) => this._menu = e)}
|
|
204
260
|
>
|
|
205
261
|
<div
|
|
206
|
-
@click=${(e) => this.
|
|
207
|
-
@scroll=${(e) =>
|
|
262
|
+
@click=${(e) => this._interactiveElementClick(e)}
|
|
263
|
+
@scroll=${(e) => G(e, document)}
|
|
208
264
|
class="sbb-menu__content"
|
|
209
265
|
>
|
|
210
|
-
${this.listChildren.length ? this.renderList({ class: "sbb-menu-list", ariaLabel: this.listAccessibilityLabel }) :
|
|
266
|
+
${this.listChildren.length ? this.renderList({ class: "sbb-menu-list", ariaLabel: this.listAccessibilityLabel }) : M`<slot></slot>`}
|
|
267
|
+
<sbb-divider></sbb-divider>
|
|
268
|
+
<sbb-menu-button
|
|
269
|
+
id="sbb-menu__back-button"
|
|
270
|
+
@click=${() => this.close()}
|
|
271
|
+
icon-name="chevron-small-left-small"
|
|
272
|
+
>
|
|
273
|
+
${Q[this._language.current]}
|
|
274
|
+
</sbb-menu-button>
|
|
211
275
|
</div>
|
|
212
276
|
</div>
|
|
213
277
|
</div>
|
|
214
278
|
`;
|
|
215
279
|
}
|
|
216
|
-
}, l = new WeakMap(), b = new WeakMap(),
|
|
217
|
-
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(
|
|
218
|
-
|
|
219
|
-
t.trigger =
|
|
220
|
-
} }, metadata: e },
|
|
221
|
-
t.listAccessibilityLabel =
|
|
222
|
-
} }, metadata: e },
|
|
223
|
-
})(),
|
|
280
|
+
}, l = new WeakMap(), b = new WeakMap(), o = a, (() => {
|
|
281
|
+
const e = typeof Symbol == "function" && Symbol.metadata ? Object.create(p[Symbol.metadata] ?? null) : void 0;
|
|
282
|
+
v = [Z(), S()], y = [j(), S({ attribute: "list-accessibility-label" })], _(a, null, v, { kind: "accessor", name: "trigger", static: !1, private: !1, access: { has: (t) => "trigger" in t, get: (t) => t.trigger, set: (t, n) => {
|
|
283
|
+
t.trigger = n;
|
|
284
|
+
} }, metadata: e }, f, w), _(a, null, y, { kind: "accessor", name: "listAccessibilityLabel", static: !1, private: !1, access: { has: (t) => "listAccessibilityLabel" in t, get: (t) => t.listAccessibilityLabel, set: (t, n) => {
|
|
285
|
+
t.listAccessibilityLabel = n;
|
|
286
|
+
} }, metadata: e }, k, E), _(null, i = { value: o }, s, { kind: "class", name: o.name, metadata: e }, null, r), o = i.value, e && Object.defineProperty(o, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: e });
|
|
287
|
+
})(), a.styles = se, a.role = "menu", u(o, r), o;
|
|
224
288
|
})();
|
|
225
289
|
export {
|
|
226
|
-
|
|
290
|
+
Ee as SbbMenuElement
|
|
227
291
|
};
|
package/off-brand-theme.css
CHANGED
|
@@ -2015,6 +2015,12 @@ sbb-status:has(sbb-title) {
|
|
|
2015
2015
|
pointer-events: none;
|
|
2016
2016
|
}
|
|
2017
2017
|
|
|
2018
|
+
.sbb-options-nowrap {
|
|
2019
|
+
--sbb-option-text-overflow: ellipsis;
|
|
2020
|
+
--sbb-option-overflow: hidden;
|
|
2021
|
+
--sbb-option-white-space: nowrap;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2018
2024
|
sub {
|
|
2019
2025
|
bottom: -0.36em;
|
|
2020
2026
|
}
|
|
@@ -3,7 +3,7 @@ import { css as d, nothing as e, html as s } from "lit";
|
|
|
3
3
|
import { customElement as p } from "lit/decorators.js";
|
|
4
4
|
import { SbbOptionBaseElement as u } from "./option-base-element.js";
|
|
5
5
|
import "../../visual-checkbox.js";
|
|
6
|
-
const h = d`*,:before,:after{box-sizing:border-box}:host{--sbb-option-color: var(--sbb-color-3);--sbb-option-background-color: inherit;--sbb-option-background-color-hover: var(--sbb-background-color-3);--sbb-option-background-color-active: var(--sbb-background-color-4);--sbb-option-disabled-border-color: var(--sbb-color-graphite);--sbb-option-disabled-border-color: light-dark(var(--sbb-color-graphite), var(--sbb-color-smoke));--sbb-option-disabled-background-color: var(--sbb-background-color-3);--sbb-option-padding-inline: var(--sbb-spacing-responsive-xxxs);--sbb-option-min-height: var(--sbb-size-element-s);--sbb-option-column-gap: var(--sbb-spacing-responsive-xxxs);--sbb-option-justify-content: start;--sbb-option-cursor: pointer;--sbb-option-border-radius: var(--sbb-border-radius-4x);--sbb-option-icon-color: var(--sbb-color-metal);--sbb-option-icon-color: light-dark(var(--sbb-color-metal), var(--sbb-color-smoke));--sbb-option-focus-outline-color: transparent;--sbb-option-focus-outline-inset: var(--sbb-spacing-fixed-1x);display:block}:host([data-negative]){--sbb-option-color: var(--sbb-color-3-negative);--sbb-option-icon-color: var(--sbb-color-5);--sbb-option-background-color-hover: var(--sbb-background-color-3-negative);--sbb-option-background-color-active: var(--sbb-background-color-4-negative);--sbb-option-disabled-border-color: var(--sbb-border-color-5);--sbb-option-disabled-background-color: var(--sbb-background-color-3-negative);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark)}@media (any-hover: hover){:host(:hover:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-hover)}}:host(:active:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-active)}:host(:not([data-disable-highlight])) .sbb-option__label slot{display:none}:host(:is([data-group-disabled],[disabled])){--sbb-option-cursor: default}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled])){--sbb-option-color: GrayText}}:host([data-variant=select]){--sbb-option-column-gap: var(--sbb-spacing-fixed-2x);--sbb-option-justify-content: space-between}:host([data-variant=select][data-multiple]){--sbb-option-justify-content: start}:host([data-active]){--sbb-option-focus-outline-color: var(--sbb-focus-outline-color)}:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{font-weight:700}@media (forced-colors: active){:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{color:Highlight}}.sbb-option__container{background-color:var(--sbb-option-background-color)}.sbb-option{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);position:relative;display:flex;min-height:var(--sbb-option-min-height);align-items:center;column-gap:var(--sbb-option-column-gap);padding-inline:var(--sbb-option-padding-inline);justify-content:var(--sbb-option-justify-content);color:var(--sbb-option-color);cursor:var(--sbb-option-cursor);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--sbb-option-color)}.sbb-option:after{content:"";display:block;position:absolute;inset:var(--sbb-option-focus-outline-inset);pointer-events:none;border:var(--sbb-focus-outline-width) solid var(--sbb-option-focus-outline-color);border-radius:var(--sbb-option-border-radius)}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option{position:relative;z-index:0}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{content:"";display:block;position:absolute;inset:.375rem;border:var(--sbb-border-width-1x) dashed var(--sbb-option-disabled-border-color);border-radius:var(--sbb-border-radius-2x);background-color:var(--sbb-option-disabled-background-color);z-index:-1}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{border-color:GrayText}}.sbb-option__icon{display:flex;min-width:var(--sbb-size-icon-ui-small);min-height:var(--sbb-size-icon-ui-small);color:var(--sbb-option-icon-color)}:host(:not([data-slot-names~=icon],[icon-name])) .sbb-option__icon{display:var(--sbb-option-icon-container-display, none)}.sbb-option__label{white-space:initial}`;
|
|
6
|
+
const h = d`*,:before,:after{box-sizing:border-box}:host{--sbb-option-color: var(--sbb-color-3);--sbb-option-background-color: inherit;--sbb-option-background-color-hover: var(--sbb-background-color-3);--sbb-option-background-color-active: var(--sbb-background-color-4);--sbb-option-disabled-border-color: var(--sbb-color-graphite);--sbb-option-disabled-border-color: light-dark(var(--sbb-color-graphite), var(--sbb-color-smoke));--sbb-option-disabled-background-color: var(--sbb-background-color-3);--sbb-option-padding-inline: var(--sbb-spacing-responsive-xxxs);--sbb-option-min-height: var(--sbb-size-element-s);--sbb-option-column-gap: var(--sbb-spacing-responsive-xxxs);--sbb-option-justify-content: start;--sbb-option-cursor: pointer;--sbb-option-border-radius: var(--sbb-border-radius-4x);--sbb-option-icon-color: var(--sbb-color-metal);--sbb-option-icon-color: light-dark(var(--sbb-color-metal), var(--sbb-color-smoke));--sbb-option-focus-outline-color: transparent;--sbb-option-focus-outline-inset: var(--sbb-spacing-fixed-1x);display:block}:host([data-negative]){--sbb-option-color: var(--sbb-color-3-negative);--sbb-option-icon-color: var(--sbb-color-5);--sbb-option-background-color-hover: var(--sbb-background-color-3-negative);--sbb-option-background-color-active: var(--sbb-background-color-4-negative);--sbb-option-disabled-border-color: var(--sbb-border-color-5);--sbb-option-disabled-background-color: var(--sbb-background-color-3-negative);--sbb-focus-outline-color: var(--sbb-focus-outline-color-dark)}@media (any-hover: hover){:host(:hover:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-hover)}}:host(:active:not([disabled],[data-group-disabled])){--sbb-option-background-color: var(--sbb-option-background-color-active)}:host(:not([data-disable-highlight])) .sbb-option__label slot{display:none}:host(:is([data-group-disabled],[disabled])){--sbb-option-cursor: default}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled])){--sbb-option-color: GrayText}}:host([data-variant=select]){--sbb-option-column-gap: var(--sbb-spacing-fixed-2x);--sbb-option-justify-content: space-between}:host([data-variant=select][data-multiple]){--sbb-option-justify-content: start}:host([data-active]){--sbb-option-focus-outline-color: var(--sbb-focus-outline-color)}:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{font-weight:700}@media (forced-colors: active){:host(:not(:is([disabled],[data-group-disabled]))) .sbb-option__label--highlight{color:Highlight}}.sbb-option__container{background-color:var(--sbb-option-background-color)}.sbb-option{--sbb-text-font-size: var(--sbb-font-size-text-s);font-family:var(--sbb-typo-font-family);font-weight:400;line-height:var(--sbb-typo-line-height-body-text);letter-spacing:var(--sbb-typo-letter-spacing-body-text);font-size:var(--sbb-text-font-size);position:relative;display:flex;min-height:var(--sbb-option-min-height);align-items:center;column-gap:var(--sbb-option-column-gap);padding-inline:var(--sbb-option-padding-inline);justify-content:var(--sbb-option-justify-content);color:var(--sbb-option-color);cursor:var(--sbb-option-cursor);-webkit-tap-highlight-color:transparent;-webkit-text-fill-color:var(--sbb-option-color)}.sbb-option:after{content:"";display:block;position:absolute;inset:var(--sbb-option-focus-outline-inset);pointer-events:none;border:var(--sbb-focus-outline-width) solid var(--sbb-option-focus-outline-color);border-radius:var(--sbb-option-border-radius)}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option{position:relative;z-index:0}:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{content:"";display:block;position:absolute;inset:.375rem;border:var(--sbb-border-width-1x) dashed var(--sbb-option-disabled-border-color);border-radius:var(--sbb-border-radius-2x);background-color:var(--sbb-option-disabled-background-color);z-index:-1}@media (forced-colors: active){:host(:is([data-group-disabled],[disabled]):not([data-multiple])) .sbb-option:before{border-color:GrayText}}.sbb-option__icon{display:flex;min-width:var(--sbb-size-icon-ui-small);min-height:var(--sbb-size-icon-ui-small);color:var(--sbb-option-icon-color)}:host(:not([data-slot-names~=icon],[icon-name])) .sbb-option__icon{display:var(--sbb-option-icon-container-display, none)}.sbb-option__label{text-overflow:var(--sbb-option-text-overflow);overflow:var(--sbb-option-overflow);white-space:var(--sbb-option-white-space, initial)}`;
|
|
7
7
|
let k = (() => {
|
|
8
8
|
var o;
|
|
9
9
|
let n = [p("sbb-option")], a, b = [], i, r = u;
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"paginator-common.d.ts","sourceRoot":"","sources":["../../../../src/elements/paginator/common/paginator-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAuB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;
|
|
1
|
+
{"version":3,"file":"paginator-common.d.ts","sourceRoot":"","sources":["../../../../src/elements/paginator/common/paginator-common.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,UAAU,EAAuB,KAAK,cAAc,EAAE,MAAM,KAAK,CAAC;AAItF,OAAO,EAAE,qBAAqB,EAAE,MAAM,2BAA2B,CAAC;AASlE,OAAO,KAAK,EAAE,4BAA4B,EAAE,MAAM,0BAA0B,CAAC;AAC7E,OAAO,EACL,KAAK,mBAAmB,EAIzB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,6BAA6B,CAAC;AACrC,OAAO,mCAAmC,CAAC;AAC3C,OAAO,kBAAkB,CAAC;;AAE1B,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,kCAAmC,SAAQ,uCAExE;IACC,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,QAAQ,EAAE,MAAM,CAAC;IACjC,SAAgB,SAAS,EAAE,MAAM,CAAC;IAClC,SAAgB,aAAa,EAAE,OAAO,GAAG,KAAK,CAAC;IAC/C,SAAgB,IAAI,EAAE,GAAG,GAAG,GAAG,CAAC;IAChC,SAAgB,sBAAsB,EAAE,MAAM,CAAC;IAC/C,SAAgB,8BAA8B,EAAE,MAAM,CAAC;IACvD,SAAgB,0BAA0B,EAAE,MAAM,CAAC;IAC5C,QAAQ,IAAI,IAAI;IAChB,YAAY,IAAI,IAAI;IACpB,SAAS,IAAI,IAAI;IACjB,QAAQ,IAAI,IAAI;IAChB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAC/B,eAAe,IAAI,OAAO;IAC1B,WAAW,IAAI,OAAO;IACtB,aAAa,IAAI,MAAM;IAC9B,SAAS,CAAC,QAAQ,EAAE,qBAAqB,CAAC;IAC1C,SAAS,CAAC,aAAa,CAAC,iBAAiB,EAAE,MAAM,GAAG,IAAI;IACxD,SAAS,CAAC,qBAAqB,IAAI,cAAc;IACjD,SAAS,CAAC,QAAQ,CAAC,eAAe,IAAI,cAAc;CACrD;AAGD,eAAO,MAAM,8BAA8B,GAAI,CAAC,SAAS,mBAAmB,CAAC,UAAU,CAAC,EACtF,YAAY,CAAC,KACZ,mBAAmB,CAAC,kCAAkC,CAAC,GAAG,CA4O5D,CAAC;AAEF,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,mBAAmB;QAC3B,IAAI,EAAE,WAAW,CAAC,4BAA4B,CAAC,CAAC;KACjD;CACF"}
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
var
|
|
1
|
+
var E = (i) => {
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var x = (i, r, l) => (
|
|
4
|
+
var T = (i, r, l) => r.has(i) || E("Cannot " + l);
|
|
5
|
+
var x = (i, r, l) => (T(i, r, "read from private field"), l ? l.call(i) : r.get(i)), _ = (i, r, l) => r.has(i) ? E("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(i) : r.set(i, l), n = (i, r, l, o) => (T(i, r, "write to private field"), o ? o.call(i, l) : r.set(i, l), l);
|
|
6
6
|
import { __runInitializers as g, __esDecorate as c } from "tslib";
|
|
7
|
-
import { html as
|
|
7
|
+
import { html as U } from "lit";
|
|
8
8
|
import { property as h } from "lit/decorators.js";
|
|
9
|
+
import { sbbInputModalityDetector as A } from "../../core/a11y/input-modality-detector.js";
|
|
9
10
|
import { SbbLanguageController as F } from "../../core/controllers.js";
|
|
10
11
|
import { forceType as m } from "../../core/decorators.js";
|
|
11
12
|
import { isLean as G } from "../../core/dom.js";
|
|
@@ -14,18 +15,18 @@ import { SbbNegativeMixin as V, SbbDisabledMixin as W, SbbElementInternalsMixin
|
|
|
14
15
|
import "../../button/mini-button.js";
|
|
15
16
|
import "../../button/mini-button-group.js";
|
|
16
17
|
import "../../divider.js";
|
|
17
|
-
const
|
|
18
|
-
var
|
|
19
|
-
let l = V(W(X(i))),
|
|
18
|
+
const oe = (i) => (() => {
|
|
19
|
+
var b, p, u, d, P, a;
|
|
20
|
+
let l = V(W(X(i))), o = [], y, z, v, f, I = [], L = [], S, N = [], M = [], k, $ = [], R = [], w, O = [], B = [], D, j = [], q = [];
|
|
20
21
|
return a = class extends l {
|
|
21
22
|
constructor() {
|
|
22
23
|
super(...arguments);
|
|
23
|
-
_(this,
|
|
24
|
+
_(this, b);
|
|
24
25
|
_(this, p);
|
|
25
26
|
_(this, u);
|
|
26
27
|
_(this, d);
|
|
27
28
|
_(this, P);
|
|
28
|
-
this._length = (g(this,
|
|
29
|
+
this._length = (g(this, o), 0), this._pageSize = 10, this._pageIndex = 0, n(this, b, g(this, I, "start")), n(this, p, (g(this, L), g(this, N, G() ? "s" : "m"))), n(this, u, (g(this, M), g(this, $, ""))), n(this, d, (g(this, R), g(this, O, ""))), n(this, P, (g(this, B), g(this, j, ""))), this.language = (g(this, q), new F(this)), this._previousPageSize = this._pageSize;
|
|
29
30
|
}
|
|
30
31
|
/** Total number of items. */
|
|
31
32
|
set length(t) {
|
|
@@ -51,10 +52,10 @@ const ce = (i) => (() => {
|
|
|
51
52
|
}
|
|
52
53
|
/** Position of the prev/next buttons. */
|
|
53
54
|
get pagerPosition() {
|
|
54
|
-
return x(this,
|
|
55
|
+
return x(this, b);
|
|
55
56
|
}
|
|
56
57
|
set pagerPosition(t) {
|
|
57
|
-
n(this,
|
|
58
|
+
n(this, b, t);
|
|
58
59
|
}
|
|
59
60
|
/**
|
|
60
61
|
* Size variant, either m or s.
|
|
@@ -159,14 +160,16 @@ const ce = (i) => (() => {
|
|
|
159
160
|
}));
|
|
160
161
|
}
|
|
161
162
|
renderPrevNextButtons() {
|
|
162
|
-
return
|
|
163
|
+
return U`
|
|
163
164
|
<sbb-mini-button-group ?negative=${this.negative} size=${this.size === "s" ? "s" : "l"}>
|
|
164
165
|
<sbb-mini-button
|
|
165
166
|
id="sbb-paginator-prev-page"
|
|
166
167
|
aria-label=${this.accessibilityPreviousPageLabel ? this.accessibilityPreviousPageLabel : K[this.language.current]}
|
|
167
168
|
icon-name="chevron-small-left-small"
|
|
168
169
|
?disabled=${this.disabled || !this.hasPreviousPage()}
|
|
169
|
-
@click=${() =>
|
|
170
|
+
@click=${() => {
|
|
171
|
+
this.previousPage(), !this.hasPreviousPage() && A.mostRecentModality === "keyboard" && this.shadowRoot?.getElementById("sbb-paginator-next-page").focus();
|
|
172
|
+
}}
|
|
170
173
|
></sbb-mini-button>
|
|
171
174
|
<sbb-divider orientation="vertical"></sbb-divider>
|
|
172
175
|
<sbb-mini-button
|
|
@@ -174,40 +177,42 @@ const ce = (i) => (() => {
|
|
|
174
177
|
aria-label=${this.accessibilityNextPageLabel ? this.accessibilityNextPageLabel : Q[this.language.current]}
|
|
175
178
|
icon-name="chevron-small-right-small"
|
|
176
179
|
?disabled=${this.disabled || !this.hasNextPage()}
|
|
177
|
-
@click=${() =>
|
|
180
|
+
@click=${() => {
|
|
181
|
+
this.nextPage(), !this.hasNextPage() && A.mostRecentModality === "keyboard" && this.shadowRoot?.getElementById("sbb-paginator-prev-page").focus();
|
|
182
|
+
}}
|
|
178
183
|
></sbb-mini-button>
|
|
179
184
|
</sbb-mini-button-group>
|
|
180
185
|
`;
|
|
181
186
|
}
|
|
182
187
|
render() {
|
|
183
|
-
return
|
|
188
|
+
return U`
|
|
184
189
|
${this.renderPaginator()}
|
|
185
190
|
<sbb-screen-reader-only id="status" role="status"></sbb-screen-reader-only>
|
|
186
191
|
`;
|
|
187
192
|
}
|
|
188
|
-
},
|
|
193
|
+
}, b = new WeakMap(), p = new WeakMap(), u = new WeakMap(), d = new WeakMap(), P = new WeakMap(), (() => {
|
|
189
194
|
const t = typeof Symbol == "function" && Symbol.metadata ? Object.create(l[Symbol.metadata] ?? null) : void 0;
|
|
190
195
|
y = [h({ type: Number })], z = [h({ attribute: "page-size", type: Number })], v = [h({ attribute: "page-index", type: Number })], f = [h({ attribute: "pager-position", reflect: !0 })], S = [h({ reflect: !0 })], k = [m(), h({ attribute: "accessibility-page-label" })], w = [m(), h({ attribute: "accessibility-previous-page-label" })], D = [m(), h({ attribute: "accessibility-next-page-label" })], c(a, null, y, { kind: "setter", name: "length", static: !1, private: !1, access: { has: (e) => "length" in e, set: (e, s) => {
|
|
191
196
|
e.length = s;
|
|
192
|
-
} }, metadata: t }, null,
|
|
197
|
+
} }, metadata: t }, null, o), c(a, null, z, { kind: "setter", name: "pageSize", static: !1, private: !1, access: { has: (e) => "pageSize" in e, set: (e, s) => {
|
|
193
198
|
e.pageSize = s;
|
|
194
|
-
} }, metadata: t }, null,
|
|
199
|
+
} }, metadata: t }, null, o), c(a, null, v, { kind: "setter", name: "pageIndex", static: !1, private: !1, access: { has: (e) => "pageIndex" in e, set: (e, s) => {
|
|
195
200
|
e.pageIndex = s;
|
|
196
|
-
} }, metadata: t }, null,
|
|
201
|
+
} }, metadata: t }, null, o), c(a, null, f, { kind: "accessor", name: "pagerPosition", static: !1, private: !1, access: { has: (e) => "pagerPosition" in e, get: (e) => e.pagerPosition, set: (e, s) => {
|
|
197
202
|
e.pagerPosition = s;
|
|
198
|
-
} }, metadata: t },
|
|
203
|
+
} }, metadata: t }, I, L), c(a, null, S, { kind: "accessor", name: "size", static: !1, private: !1, access: { has: (e) => "size" in e, get: (e) => e.size, set: (e, s) => {
|
|
199
204
|
e.size = s;
|
|
200
|
-
} }, metadata: t }, N,
|
|
205
|
+
} }, metadata: t }, N, M), c(a, null, k, { kind: "accessor", name: "accessibilityPageLabel", static: !1, private: !1, access: { has: (e) => "accessibilityPageLabel" in e, get: (e) => e.accessibilityPageLabel, set: (e, s) => {
|
|
201
206
|
e.accessibilityPageLabel = s;
|
|
202
|
-
} }, metadata: t },
|
|
207
|
+
} }, metadata: t }, $, R), c(a, null, w, { kind: "accessor", name: "accessibilityPreviousPageLabel", static: !1, private: !1, access: { has: (e) => "accessibilityPreviousPageLabel" in e, get: (e) => e.accessibilityPreviousPageLabel, set: (e, s) => {
|
|
203
208
|
e.accessibilityPreviousPageLabel = s;
|
|
204
|
-
} }, metadata: t },
|
|
209
|
+
} }, metadata: t }, O, B), c(a, null, D, { kind: "accessor", name: "accessibilityNextPageLabel", static: !1, private: !1, access: { has: (e) => "accessibilityNextPageLabel" in e, get: (e) => e.accessibilityNextPageLabel, set: (e, s) => {
|
|
205
210
|
e.accessibilityNextPageLabel = s;
|
|
206
|
-
} }, metadata: t },
|
|
211
|
+
} }, metadata: t }, j, q), t && Object.defineProperty(a, Symbol.metadata, { enumerable: !0, configurable: !0, writable: !0, value: t });
|
|
207
212
|
})(), a.role = "group", a.events = {
|
|
208
213
|
page: "page"
|
|
209
214
|
}, a;
|
|
210
215
|
})();
|
|
211
216
|
export {
|
|
212
|
-
|
|
217
|
+
oe as SbbPaginatorCommonElementMixin
|
|
213
218
|
};
|
package/safety-theme.css
CHANGED
|
@@ -2015,6 +2015,12 @@ sbb-status:has(sbb-title) {
|
|
|
2015
2015
|
pointer-events: none;
|
|
2016
2016
|
}
|
|
2017
2017
|
|
|
2018
|
+
.sbb-options-nowrap {
|
|
2019
|
+
--sbb-option-text-overflow: ellipsis;
|
|
2020
|
+
--sbb-option-overflow: hidden;
|
|
2021
|
+
--sbb-option-white-space: nowrap;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2018
2024
|
sub {
|
|
2019
2025
|
bottom: -0.36em;
|
|
2020
2026
|
}
|
package/standard-theme.css
CHANGED
|
@@ -2015,6 +2015,12 @@ sbb-status:has(sbb-title) {
|
|
|
2015
2015
|
pointer-events: none;
|
|
2016
2016
|
}
|
|
2017
2017
|
|
|
2018
|
+
.sbb-options-nowrap {
|
|
2019
|
+
--sbb-option-text-overflow: ellipsis;
|
|
2020
|
+
--sbb-option-overflow: hidden;
|
|
2021
|
+
--sbb-option-white-space: nowrap;
|
|
2022
|
+
}
|
|
2023
|
+
|
|
2018
2024
|
sub {
|
|
2019
2025
|
bottom: -0.36em;
|
|
2020
2026
|
}
|