@sbb-esta/lyne-elements 3.8.0 → 3.9.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/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 +612 -138
- 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/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/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
|
@@ -21,6 +21,8 @@ export declare abstract class SbbOpenCloseBaseElement extends SbbOpenCloseBaseEl
|
|
|
21
21
|
/** Closes the component. */
|
|
22
22
|
abstract close(): void;
|
|
23
23
|
connectedCallback(): void;
|
|
24
|
+
/** The method which is called on escape key press. Defaults to calling close() */
|
|
25
|
+
escapeStrategy(): void;
|
|
24
26
|
protected dispatchBeforeOpenEvent(): boolean;
|
|
25
27
|
protected dispatchOpenEvent(): boolean;
|
|
26
28
|
protected dispatchBeforeCloseEvent(): boolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"open-close-base-element.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/base-elements/open-close-base-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;;AAG7D;;GAEG;AACH,8BAAsB,uBAAwB,SAAQ,4BAAoC;IACxF,gBAAuB,MAAM;;;;;MAKlB;IAEX,kCAAkC;IAClC,SAAS,KAAK,KAAK,CAAC,KAAK,EAAE,oBAAoB,EAE9C;IACD,SAAS,KAAK,KAAK,IAAI,oBAAoB,CAE1C;IAED,mCAAmC;IACnC,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED,2BAA2B;aACX,IAAI,IAAI,IAAI;IAC5B,4BAA4B;aACZ,KAAK,IAAI,IAAI;IAEb,iBAAiB,IAAI,IAAI;IAKzC,SAAS,CAAC,uBAAuB,IAAI,OAAO;IAK5C,SAAS,CAAC,iBAAiB,IAAI,OAAO;IAKtC,SAAS,CAAC,wBAAwB,IAAI,OAAO;IAK7C,SAAS,CAAC,kBAAkB,IAAI,OAAO;CAIxC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,2BAA2B;QACnC,UAAU,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,KAAK,CAAC;QACnB,IAAI,EAAE,KAAK,CAAC;QACZ,KAAK,EAAE,KAAK,CAAC;KACd;CACF"}
|
|
1
|
+
{"version":3,"file":"open-close-base-element.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/base-elements/open-close-base-element.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,KAAK,CAAC;AAEjC,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;;AAG7D;;GAEG;AACH,8BAAsB,uBAAwB,SAAQ,4BAAoC;IACxF,gBAAuB,MAAM;;;;;MAKlB;IAEX,kCAAkC;IAClC,SAAS,KAAK,KAAK,CAAC,KAAK,EAAE,oBAAoB,EAE9C;IACD,SAAS,KAAK,KAAK,IAAI,oBAAoB,CAE1C;IAED,mCAAmC;IACnC,IAAW,MAAM,IAAI,OAAO,CAE3B;IAED,2BAA2B;aACX,IAAI,IAAI,IAAI;IAC5B,4BAA4B;aACZ,KAAK,IAAI,IAAI;IAEb,iBAAiB,IAAI,IAAI;IAKzC,kFAAkF;IAC3E,cAAc,IAAI,IAAI;IAI7B,SAAS,CAAC,uBAAuB,IAAI,OAAO;IAK5C,SAAS,CAAC,iBAAiB,IAAI,OAAO;IAKtC,SAAS,CAAC,wBAAwB,IAAI,OAAO;IAK7C,SAAS,CAAC,kBAAkB,IAAI,OAAO;CAIxC;AAED,OAAO,CAAC,MAAM,CAAC;IACb,UAAU,2BAA2B;QACnC,UAAU,EAAE,KAAK,CAAC;QAClB,WAAW,EAAE,KAAK,CAAC;QACnB,IAAI,EAAE,KAAK,CAAC;QACZ,KAAK,EAAE,KAAK,CAAC;KACd;CACF"}
|
|
@@ -15,6 +15,10 @@ const e = class e extends r(s) {
|
|
|
15
15
|
connectedCallback() {
|
|
16
16
|
super.connectedCallback(), this.state ||= "closed";
|
|
17
17
|
}
|
|
18
|
+
/** The method which is called on escape key press. Defaults to calling close() */
|
|
19
|
+
escapeStrategy() {
|
|
20
|
+
this.close();
|
|
21
|
+
}
|
|
18
22
|
dispatchBeforeOpenEvent() {
|
|
19
23
|
return this.dispatchEvent(new Event("beforeopen", { cancelable: !0 }));
|
|
20
24
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { isServer as i } from "lit";
|
|
2
2
|
const o = new Array();
|
|
3
3
|
i || window.addEventListener("keydown", (t) => {
|
|
4
|
-
t.key === "Escape" && !t.defaultPrevented && (t.preventDefault(), o.at(-1)?.
|
|
4
|
+
t.key === "Escape" && !t.defaultPrevented && (t.preventDefault(), o.at(-1)?.escapeStrategy());
|
|
5
5
|
});
|
|
6
|
-
class
|
|
6
|
+
class c {
|
|
7
7
|
constructor(e, s = o) {
|
|
8
8
|
this._host = e, this._overlayStack = s, this._host.addController?.(this);
|
|
9
9
|
}
|
|
@@ -23,5 +23,5 @@ class n {
|
|
|
23
23
|
}
|
|
24
24
|
}
|
|
25
25
|
export {
|
|
26
|
-
|
|
26
|
+
c as SbbEscapableOverlayController
|
|
27
27
|
};
|
|
@@ -4,7 +4,8 @@ export declare class SbbInertController implements ReactiveController {
|
|
|
4
4
|
private _host;
|
|
5
5
|
private _inertElements;
|
|
6
6
|
private _inertOverlays;
|
|
7
|
-
|
|
7
|
+
private _exemptedElements;
|
|
8
|
+
constructor(_host: ReactiveControllerHost & SbbOpenCloseBaseElement, _inertElements?: Set<HTMLElement>, _inertOverlays?: Set<HTMLElement>, _exemptedElements?: Set<HTMLElement>);
|
|
8
9
|
hostConnected(): void;
|
|
9
10
|
hostDisconnected(): void;
|
|
10
11
|
/** Applies inert state to every other element on the page except the overlay. */
|
|
@@ -13,8 +14,14 @@ export declare class SbbInertController implements ReactiveController {
|
|
|
13
14
|
deactivate(): void;
|
|
14
15
|
/** Whether the assigned host is currently inert */
|
|
15
16
|
isInert(): boolean;
|
|
17
|
+
/** Temporarily removes all inert attributes from a given element. */
|
|
18
|
+
exempt(element: HTMLElement): void;
|
|
19
|
+
/** Inerts an element currently exempted from inert. */
|
|
20
|
+
restoreAllExempted(): void;
|
|
16
21
|
private _currentOverlay;
|
|
22
|
+
private _removeAllInertAttributes;
|
|
17
23
|
private _removeInertAttributes;
|
|
24
|
+
private _addAllInertAttributes;
|
|
18
25
|
private _addInertAttributes;
|
|
19
26
|
}
|
|
20
27
|
//# sourceMappingURL=inert-controller.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"inert-controller.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/controllers/inert-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAEtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"inert-controller.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/controllers/inert-controller.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,MAAM,KAAK,CAAC;AAEtE,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,qBAAqB,CAAC;AAOnE,qBAAa,kBAAmB,YAAW,kBAAkB;IAEzD,OAAO,CAAC,KAAK;IACb,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,cAAc;IACtB,OAAO,CAAC,iBAAiB;gBAHjB,KAAK,EAAE,sBAAsB,GAAG,uBAAuB,EACvD,cAAc,mBAAgB,EAC9B,cAAc,mBAAgB,EAC9B,iBAAiB,mBAAmB;IAKvC,aAAa,IAAI,IAAI;IAMrB,gBAAgB,IAAI,IAAI;IAM/B,iFAAiF;IAC1E,QAAQ,IAAI,IAAI;IAUvB,2BAA2B;IACpB,UAAU,IAAI,IAAI;IAyBzB,mDAAmD;IAC5C,OAAO,IAAI,OAAO;IAIzB,qEAAqE;IAC9D,MAAM,CAAC,OAAO,EAAE,WAAW,GAAG,IAAI;IAQzC,uDAAuD;IAChD,kBAAkB,IAAI,IAAI;IAKjC,OAAO,CAAC,eAAe;IAIvB,OAAO,CAAC,yBAAyB;IAOjC,OAAO,CAAC,sBAAsB;IAgB9B,OAAO,CAAC,sBAAsB;IAqB9B,OAAO,CAAC,mBAAmB;CAa5B"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
const r = ["script", "head", "template", "style"],
|
|
2
|
-
class
|
|
3
|
-
constructor(t, e = s, i = a) {
|
|
4
|
-
this._host = t, this._inertElements = e, this._inertOverlays = i, this._host.addController?.(this);
|
|
1
|
+
const r = ["script", "head", "template", "style"], n = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), h = /* @__PURE__ */ new Set();
|
|
2
|
+
class l {
|
|
3
|
+
constructor(t, e = n, s = h, i = a) {
|
|
4
|
+
this._host = t, this._inertElements = e, this._inertOverlays = s, this._exemptedElements = i, this._host.addController?.(this);
|
|
5
5
|
}
|
|
6
6
|
hostConnected() {
|
|
7
7
|
this._host.isOpen && this.activate();
|
|
@@ -11,7 +11,7 @@ class h {
|
|
|
11
11
|
}
|
|
12
12
|
/** Applies inert state to every other element on the page except the overlay. */
|
|
13
13
|
activate() {
|
|
14
|
-
this._inertOverlays.size && this.
|
|
14
|
+
this._inertOverlays.size && this._removeAllInertAttributes(), this._inertOverlays.add(this._host), this._addAllInertAttributes();
|
|
15
15
|
}
|
|
16
16
|
/** Removes inert state. */
|
|
17
17
|
deactivate() {
|
|
@@ -19,28 +19,40 @@ class h {
|
|
|
19
19
|
this._inertOverlays.has(this._host) && this._inertOverlays.delete(this._host);
|
|
20
20
|
return;
|
|
21
21
|
}
|
|
22
|
-
this.
|
|
22
|
+
this._removeAllInertAttributes(), this._inertOverlays.delete(this._host), this._inertOverlays.size && this._addAllInertAttributes();
|
|
23
23
|
}
|
|
24
24
|
/** Whether the assigned host is currently inert */
|
|
25
25
|
isInert() {
|
|
26
26
|
return this._inertOverlays.has(this._host);
|
|
27
27
|
}
|
|
28
|
+
/** Temporarily removes all inert attributes from a given element. */
|
|
29
|
+
exempt(t) {
|
|
30
|
+
this._inertElements.has(t) && !this._exemptedElements.has(t) && (this._removeInertAttributes(t), this._inertElements.delete(t), this._exemptedElements.add(t));
|
|
31
|
+
}
|
|
32
|
+
/** Inerts an element currently exempted from inert. */
|
|
33
|
+
restoreAllExempted() {
|
|
34
|
+
this._exemptedElements.forEach((t) => this._addInertAttributes(t)), this._exemptedElements.clear();
|
|
35
|
+
}
|
|
28
36
|
_currentOverlay() {
|
|
29
37
|
return [...this._inertOverlays].pop() ?? null;
|
|
30
38
|
}
|
|
31
|
-
|
|
32
|
-
this._inertElements.forEach((t) =>
|
|
33
|
-
t && (t.hasAttribute("data-sbb-inert") && (t.inert = !1, t.removeAttribute("data-sbb-inert")), t.hasAttribute("data-sbb-aria-hidden") && (t.removeAttribute("aria-hidden"), t.removeAttribute("data-sbb-aria-hidden")));
|
|
34
|
-
}), this._inertElements.clear();
|
|
39
|
+
_removeAllInertAttributes() {
|
|
40
|
+
this._inertElements.forEach((t) => this._removeInertAttributes(t)), this._inertElements.clear();
|
|
35
41
|
}
|
|
36
|
-
|
|
42
|
+
_removeInertAttributes(t) {
|
|
43
|
+
t && (t.hasAttribute("data-sbb-inert") && (t.inert = !1, t.removeAttribute("data-sbb-inert")), t.hasAttribute("data-sbb-aria-hidden") && (t.removeAttribute("aria-hidden"), t.removeAttribute("data-sbb-aria-hidden")));
|
|
44
|
+
}
|
|
45
|
+
_addAllInertAttributes() {
|
|
37
46
|
let t = this._currentOverlay();
|
|
38
47
|
for (; t !== document.documentElement && t !== null; )
|
|
39
48
|
Array.from((t?.parentElement ?? t?.getRootNode())?.childNodes ?? []).filter((e) => e !== t && e instanceof window.HTMLElement && !r.includes(e.localName) && !e.classList.contains("sbb-live-announcer-element")).forEach((e) => {
|
|
40
|
-
this.
|
|
49
|
+
this._addInertAttributes(e);
|
|
41
50
|
}), t = t?.parentElement ?? t?.getRootNode()?.host ?? null;
|
|
42
51
|
}
|
|
52
|
+
_addInertAttributes(t) {
|
|
53
|
+
this._inertElements.add(t), t.inert || (t.inert = !0, t.toggleAttribute("data-sbb-inert", !0)), t.hasAttribute("aria-hidden") || (t.setAttribute("aria-hidden", "true"), t.toggleAttribute("data-sbb-aria-hidden", !0));
|
|
54
|
+
}
|
|
43
55
|
}
|
|
44
56
|
export {
|
|
45
|
-
|
|
57
|
+
l as SbbInertController
|
|
46
58
|
};
|
|
@@ -38,4 +38,24 @@ export declare function getElementPosition(element: HTMLElement, trigger: HTMLEl
|
|
|
38
38
|
centered?: boolean;
|
|
39
39
|
responsiveHeight?: boolean;
|
|
40
40
|
}): SbbElementPositionInfos;
|
|
41
|
+
/**
|
|
42
|
+
* Determines the position of an element relative to a trigger element by evaluating
|
|
43
|
+
* the optimal position based on the available space.
|
|
44
|
+
*
|
|
45
|
+
* @param element The element of which to calculate the position.
|
|
46
|
+
* @param trigger The element relative to which to calculate the position.
|
|
47
|
+
* @param container The element which has the position:fixed applied.
|
|
48
|
+
* @param properties Properties to take into account in calculations (optional).
|
|
49
|
+
* @param properties.verticalOffset The distance to be added between the element and the trigger (optional).
|
|
50
|
+
* @param properties.horizontalOffset The horizontal offset to be applied to the element (optional).
|
|
51
|
+
* @param properties.responsiveHeight Whether the element calculates its height based on its content (optional).
|
|
52
|
+
* @returns Returns an object containing the left position, the top position, the maximum height
|
|
53
|
+
* of the element and the current alignment object.
|
|
54
|
+
*/
|
|
55
|
+
export declare function getElementPositionHorizontal(element: HTMLElement, trigger: HTMLElement, container: HTMLElement, properties?: {
|
|
56
|
+
verticalOffset?: number;
|
|
57
|
+
horizontalOffset?: number;
|
|
58
|
+
responsiveHeight?: boolean;
|
|
59
|
+
contentSelector?: string;
|
|
60
|
+
}): SbbElementPositionInfos;
|
|
41
61
|
//# sourceMappingURL=position.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/overlay/position.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,WAAW,EACX,cAAc,GAAG,cAAc,GAAG,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,CACjG,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,YAAY,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAoCrE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,KAAK,EAAE,UAAU,GAAG,YAAY,GAC/B,OAAO,CAYT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,WAAW,EACtB,UAAU,CAAC,EAAE;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GACA,uBAAuB,CAqGzB"}
|
|
1
|
+
{"version":3,"file":"position.d.ts","sourceRoot":"","sources":["../../../../src/elements/core/overlay/position.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GAAG,IAAI,CACjC,WAAW,EACX,cAAc,GAAG,cAAc,GAAG,cAAc,GAAG,aAAa,GAAG,aAAa,GAAG,aAAa,CACjG,CAAC;AAEF,MAAM,WAAW,YAAY;IAC3B,UAAU,EAAE,OAAO,GAAG,QAAQ,GAAG,KAAK,CAAC;IACvC,QAAQ,EAAE,OAAO,GAAG,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,uBAAuB;IACtC,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,YAAY,CAAC;CACzB;AAED;;GAEG;AACH,wBAAgB,mBAAmB,CAAC,EAAE,EAAE,WAAW,GAAG,gBAAgB,CAoCrE;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,WAAW,GAAG,IAAI,EAC3B,KAAK,EAAE,UAAU,GAAG,YAAY,GAC/B,OAAO,CAYT;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,WAAW,EACtB,UAAU,CAAC,EAAE;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,GACA,uBAAuB,CAqGzB;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,4BAA4B,CAC1C,OAAO,EAAE,WAAW,EACpB,OAAO,EAAE,WAAW,EACpB,SAAS,EAAE,WAAW,EACtB,UAAU,CAAC,EAAE;IACX,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B,GACA,uBAAuB,CAgEzB"}
|
package/core/overlay/position.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
function
|
|
2
|
-
const o = window.getComputedStyle(t),
|
|
3
|
-
if (
|
|
1
|
+
function R(t) {
|
|
2
|
+
const o = window.getComputedStyle(t), c = o.display, h = parseInt(o.maxHeight, 10).toString();
|
|
3
|
+
if (c !== "none" && h !== "0")
|
|
4
4
|
return {
|
|
5
5
|
scrollHeight: t.scrollHeight,
|
|
6
6
|
clientHeight: t.clientHeight,
|
|
@@ -10,31 +10,42 @@ function b(t) {
|
|
|
10
10
|
offsetWidth: t.offsetWidth
|
|
11
11
|
};
|
|
12
12
|
t.style.position = "absolute", t.style.visibility = "hidden", t.style.display = "block";
|
|
13
|
-
const
|
|
14
|
-
return t.style.display = "", t.style.position = "", t.style.visibility = "", { scrollHeight:
|
|
13
|
+
const v = t.scrollHeight, n = t.clientHeight, g = t.offsetHeight, r = t.scrollWidth, e = t.clientWidth, i = t.offsetWidth;
|
|
14
|
+
return t.style.display = "", t.style.position = "", t.style.visibility = "", { scrollHeight: v, clientHeight: n, offsetHeight: g, scrollWidth: r, clientWidth: e, offsetWidth: i };
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function x(t, o) {
|
|
17
17
|
if (!t || !o)
|
|
18
18
|
return !1;
|
|
19
|
-
const
|
|
20
|
-
return
|
|
19
|
+
const c = t.getBoundingClientRect();
|
|
20
|
+
return c.top <= o.clientY && o.clientY <= c.top + c.height && c.left <= o.clientX && o.clientX <= c.left + c.width;
|
|
21
21
|
}
|
|
22
|
-
function
|
|
23
|
-
const
|
|
24
|
-
let
|
|
25
|
-
const
|
|
26
|
-
let
|
|
27
|
-
h?.centered &&
|
|
28
|
-
const
|
|
29
|
-
return
|
|
30
|
-
top:
|
|
31
|
-
left:
|
|
32
|
-
maxHeight:
|
|
33
|
-
alignment:
|
|
22
|
+
function y(t, o, c, h) {
|
|
23
|
+
const n = h?.verticalOffset || 0, g = h?.horizontalOffset || 0, r = h?.responsiveHeight || !1, e = o.getBoundingClientRect(), i = R(t), f = e.left, H = e.top, W = document.documentElement.clientWidth - (f + e.width), d = H - n, u = document.documentElement.clientHeight - (H + e.height + n);
|
|
24
|
+
let s = f, m = H + e.height + n, l = i.offsetWidth - e.width;
|
|
25
|
+
const a = { horizontal: "start", vertical: "below" };
|
|
26
|
+
let O = `${u - n}px`;
|
|
27
|
+
h?.centered && f - 16 + e.width / 2 > i.offsetWidth / 2 && W - 16 > l / 2 && (s -= l /= 2, a.horizontal = "center"), W < l && f > l && (s = s - l, a.horizontal = "end"), g && a.horizontal !== "center" && e.width / 2 < g && (s += g * (a.horizontal === "start" ? -1 : 1)), (f < l && W < l || document.documentElement.clientWidth < i.offsetWidth) && (s = document.documentElement.clientWidth / 2 - i.offsetWidth / 2), (u - n < i.scrollHeight && d - n > (r ? i.clientHeight : i.scrollHeight) || d > u && u - n < i.clientHeight && !r) && (m = d < i.scrollHeight ? m - e.height - d - n : H - i.clientHeight - n, O = `${d - n}px`, a.vertical = "above");
|
|
28
|
+
const p = c.getBoundingClientRect();
|
|
29
|
+
return p.left < 0 && (s -= p.left), p.top < 0 && (m -= p.top), {
|
|
30
|
+
top: m,
|
|
31
|
+
left: s,
|
|
32
|
+
maxHeight: O,
|
|
33
|
+
alignment: a
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function b(t, o, c, h) {
|
|
37
|
+
const n = h?.verticalOffset || 0, g = h?.horizontalOffset || 0, r = o.getBoundingClientRect(), e = R(t), i = o.parentElement.shadowRoot.querySelector(h?.contentSelector ?? `.${t.className}`).getBoundingClientRect(), f = c.getBoundingClientRect(), H = document.documentElement.clientWidth - i.right, W = document.documentElement.clientHeight - (r.top - n), d = document.documentElement.clientHeight, u = `${d - 32}px`, s = { horizontal: "end", vertical: "above" }, m = e.offsetWidth + g;
|
|
38
|
+
let l = i.right, a = r.top + n;
|
|
39
|
+
return H < m && r.left > m && (l = l - i.width - e.offsetWidth, s.horizontal = "start"), g && s.horizontal !== "center" && (l += g * (s.horizontal === "start" ? -1 : 1)), W < e.scrollHeight && (a = d - e.clientHeight - 16), f.left < 0 && (l -= f.left), f.top < 0 && (a -= f.top), {
|
|
40
|
+
top: a,
|
|
41
|
+
left: l,
|
|
42
|
+
maxHeight: u,
|
|
43
|
+
alignment: s
|
|
34
44
|
};
|
|
35
45
|
}
|
|
36
46
|
export {
|
|
37
|
-
|
|
38
|
-
b as
|
|
39
|
-
|
|
47
|
+
y as getElementPosition,
|
|
48
|
+
b as getElementPositionHorizontal,
|
|
49
|
+
R as getElementRectangle,
|
|
50
|
+
x as isEventOnElement
|
|
40
51
|
};
|
package/core/overlay.js
CHANGED
|
@@ -1,18 +1,19 @@
|
|
|
1
1
|
import { overlayGapFixCorners as r } from "./overlay/overlay.js";
|
|
2
2
|
import { setOverlayPosition as i } from "./overlay/overlay-option-panel.js";
|
|
3
|
-
import { SbbOverlayOutsidePointerEventListener as
|
|
4
|
-
import { removeAriaComboBoxAttributes as
|
|
5
|
-
import { getElementPosition as O, getElementRectangle as
|
|
3
|
+
import { SbbOverlayOutsidePointerEventListener as s, sbbOverlayOutsidePointerEventListener as a } from "./overlay/overlay-outside-pointer-event-listener.js";
|
|
4
|
+
import { removeAriaComboBoxAttributes as l, removeAriaOverlayTriggerAttributes as v, setAriaComboBoxAttributes as b, setAriaOverlayTriggerAttributes as g } from "./overlay/overlay-trigger-attributes.js";
|
|
5
|
+
import { getElementPosition as A, getElementPositionHorizontal as O, getElementRectangle as E, isEventOnElement as p } from "./overlay/position.js";
|
|
6
6
|
export {
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
s as SbbOverlayOutsidePointerEventListener,
|
|
8
|
+
A as getElementPosition,
|
|
9
|
+
O as getElementPositionHorizontal,
|
|
10
|
+
E as getElementRectangle,
|
|
10
11
|
p as isEventOnElement,
|
|
11
12
|
r as overlayGapFixCorners,
|
|
12
|
-
|
|
13
|
-
|
|
13
|
+
l as removeAriaComboBoxAttributes,
|
|
14
|
+
v as removeAriaOverlayTriggerAttributes,
|
|
14
15
|
a as sbbOverlayOutsidePointerEventListener,
|
|
15
|
-
|
|
16
|
-
|
|
16
|
+
b as setAriaComboBoxAttributes,
|
|
17
|
+
g as setAriaOverlayTriggerAttributes,
|
|
17
18
|
i as setOverlayPosition
|
|
18
19
|
};
|
package/core/styles/core.scss
CHANGED
|
@@ -647,3 +647,10 @@ sbb-status:has(sbb-title) {
|
|
|
647
647
|
inset: 0;
|
|
648
648
|
pointer-events: none;
|
|
649
649
|
}
|
|
650
|
+
|
|
651
|
+
// Sets ellipsis on all sbb-option child elements
|
|
652
|
+
.sbb-options-nowrap {
|
|
653
|
+
--sbb-option-text-overflow: ellipsis;
|
|
654
|
+
--sbb-option-overflow: hidden;
|
|
655
|
+
--sbb-option-white-space: nowrap;
|
|
656
|
+
}
|
package/core.css
CHANGED
|
@@ -1907,4 +1907,10 @@ sbb-status:has(sbb-title) {
|
|
|
1907
1907
|
position: fixed;
|
|
1908
1908
|
inset: 0;
|
|
1909
1909
|
pointer-events: none;
|
|
1910
|
+
}
|
|
1911
|
+
|
|
1912
|
+
.sbb-options-nowrap {
|
|
1913
|
+
--sbb-option-text-overflow: ellipsis;
|
|
1914
|
+
--sbb-option-overflow: hidden;
|
|
1915
|
+
--sbb-option-white-space: nowrap;
|
|
1910
1916
|
}
|