@proximus/lavender-dropdown 2.0.0-alpha.203 → 2.0.0-alpha.204
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/dist/custom-elements.json +0 -4
- package/dist/index.es.js +14 -14
- package/dist/web-types.json +2 -3
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { WithExtraAttributes as e, log as t, propertyToAttributeSetter as n } from "@proximus/lavender-common";
|
|
1
|
+
import { WithExtraAttributes as e, log as t, propertyToAttributeSetter as n, renderTemplate as r } from "@proximus/lavender-common";
|
|
2
2
|
//#region src/dropdown.css?inline
|
|
3
|
-
var
|
|
3
|
+
var i = ":host{position:relative}::slotted([slot=popover]){border-radius:var(--px-radius-main,8px);background:var(--px-color-background-container-light-default,#fff);padding:var(--px-padding-xs-mobile) 0;width:auto;max-height:var(--px-popover-max-height);border:0;margin:0;position:fixed;right:0;box-shadow:0 20px 25px -5px #25252514}:host([grow]) ::slotted([slot=trigger]):after{padding-right:var(--px-padding-xs-mobile);right:0}:host([anchoralignment=top-left]) ::slotted([slot=popover]){top:auto}:host([anchoralignment=top-right]) ::slotted([slot=popover]){top:auto}:host([anchoralignment=bottom-right]) ::slotted([slot=popover]){left:auto}@media screen and (width<=47.938rem){::slotted([slot=trigger]){width:100%;display:block}:host([anchoralignment=top-left]) ::slotted([slot=popover]){left:var(--px-padding-s-mobile)}:host([anchoralignment=top-right]) ::slotted([slot=popover]){left:var(--px-padding-s-mobile)}}@media screen and (width>=48rem){::slotted([slot=popover]){padding-block:var(--px-padding-s-desktop);width:auto;right:auto}}", a = [
|
|
4
4
|
"top-left",
|
|
5
5
|
"top-right",
|
|
6
6
|
"bottom-left",
|
|
@@ -8,7 +8,7 @@ var r = ":host{position:relative}::slotted([slot=popover]){border-radius:var(--p
|
|
|
8
8
|
];
|
|
9
9
|
//#endregion
|
|
10
10
|
//#region src/anchorPolyfill.ts
|
|
11
|
-
function
|
|
11
|
+
function o(e, t, n = "bottom-left", r, i = !1) {
|
|
12
12
|
"anchorName" in document.documentElement.style && i === !1 || t.addEventListener("toggle", () => {
|
|
13
13
|
if (!e || !t) return;
|
|
14
14
|
let i = e.getBoundingClientRect(), a = window.visualViewport?.height ?? window.innerHeight, o = window.visualViewport?.width ?? window.innerWidth, s = r.getPropertyValue("--px-padding-s-mobile") || "16px", c = parseInt((r.getPropertyValue("--px-icon-size-xs-desktop") || "24").replace("px", ""));
|
|
@@ -18,9 +18,9 @@ function a(e, t, n = "bottom-left", r, i = !1) {
|
|
|
18
18
|
/* v8 ignore end */
|
|
19
19
|
//#endregion
|
|
20
20
|
//#region src/Dropdown.ts
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
var
|
|
21
|
+
var s = new CSSStyleSheet();
|
|
22
|
+
s.replaceSync(i);
|
|
23
|
+
var c = "bottom-left", l = class extends e {
|
|
24
24
|
get css() {
|
|
25
25
|
return `::slotted([slot='trigger']) {
|
|
26
26
|
anchor-name: ${this.anchorName};
|
|
@@ -65,7 +65,7 @@ var s = "bottom-left", c = class extends e {
|
|
|
65
65
|
];
|
|
66
66
|
}
|
|
67
67
|
constructor() {
|
|
68
|
-
super(
|
|
68
|
+
super(s), this.template = () => `
|
|
69
69
|
<style>${this.css}</style>
|
|
70
70
|
<slot name="trigger"></slot>
|
|
71
71
|
<slot name="popover"></slot>`, this.isAboutToClose = !1, this.triggerPopoverDisplay = () => {
|
|
@@ -80,10 +80,10 @@ var s = "bottom-left", c = class extends e {
|
|
|
80
80
|
this.$popoverElement.matches(":popover-open") || setTimeout(() => {
|
|
81
81
|
this.isAboutToClose = !1;
|
|
82
82
|
});
|
|
83
|
-
}, this.shadowRoot
|
|
83
|
+
}, r(this.shadowRoot, this.template());
|
|
84
84
|
}
|
|
85
85
|
connectedCallback() {
|
|
86
|
-
this.getAttribute("id") || this.setAttribute("id", `px-dropdown-${Math.random().toString(36).substring(2, 15)}`), this.getAttribute("anchoralignment") || this.setAttribute("anchoralignment",
|
|
86
|
+
this.getAttribute("id") || this.setAttribute("id", `px-dropdown-${Math.random().toString(36).substring(2, 15)}`), this.getAttribute("anchoralignment") || this.setAttribute("anchoralignment", c), o(this.$trigger, this.$popoverElement, this.anchorAlignment, getComputedStyle(this), this.usePolyfill);
|
|
87
87
|
}
|
|
88
88
|
#e() {
|
|
89
89
|
this.isAboutToClose = !1, this.manualToggle || this.$trigger.removeEventListener("click", this.triggerPopoverDisplay), this.$popoverElement.removeEventListener("beforetoggle", this.#t), this.$popoverElement.removeEventListener("toggle", this.#n);
|
|
@@ -99,7 +99,7 @@ var s = "bottom-left", c = class extends e {
|
|
|
99
99
|
this.initPopover();
|
|
100
100
|
break;
|
|
101
101
|
case "use-polyfill":
|
|
102
|
-
|
|
102
|
+
o(this.$trigger, this.$popoverElement, this.anchorAlignment, getComputedStyle(this), this.usePolyfill);
|
|
103
103
|
break;
|
|
104
104
|
case "manual-toggle":
|
|
105
105
|
n != null && this.$trigger?.removeAttribute("aria-expanded");
|
|
@@ -136,10 +136,10 @@ var s = "bottom-left", c = class extends e {
|
|
|
136
136
|
return this.querySelector("[slot=\"popover\"]");
|
|
137
137
|
}
|
|
138
138
|
get anchorAlignment() {
|
|
139
|
-
return this.getAttribute("anchoralignment") ||
|
|
139
|
+
return this.getAttribute("anchoralignment") || c;
|
|
140
140
|
}
|
|
141
141
|
set anchorAlignment(e) {
|
|
142
|
-
|
|
142
|
+
a.includes(e) ? this.setAttribute("anchoralignment", e) : (t(`Invalid anchor alignment value: ${e}. Using default ${c}.`), this.setAttribute("anchoralignment", c));
|
|
143
143
|
}
|
|
144
144
|
get usePolyfill() {
|
|
145
145
|
return this.hasAttribute("use-polyfill");
|
|
@@ -160,6 +160,6 @@ var s = "bottom-left", c = class extends e {
|
|
|
160
160
|
n(this, "popover-height", e);
|
|
161
161
|
}
|
|
162
162
|
};
|
|
163
|
-
customElements.get("px-dropdown") || customElements.define("px-dropdown",
|
|
163
|
+
customElements.get("px-dropdown") || customElements.define("px-dropdown", l);
|
|
164
164
|
//#endregion
|
|
165
|
-
export {
|
|
165
|
+
export { l as Dropdown };
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@proximus/lavender-dropdown",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.204",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -28,8 +28,7 @@
|
|
|
28
28
|
{ "name": "anchorAlignment", "type": "AnchorAlignment" },
|
|
29
29
|
{ "name": "usePolyfill" },
|
|
30
30
|
{ "name": "manualToggle" },
|
|
31
|
-
{ "name": "popoverHeight" }
|
|
32
|
-
{ "name": "innerHTML" }
|
|
31
|
+
{ "name": "popoverHeight" }
|
|
33
32
|
],
|
|
34
33
|
"events": []
|
|
35
34
|
}
|