@proximus/lavender-drawer 1.4.3-beta.1 → 1.4.3-beta.3
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/Drawer.d.ts +4 -0
- package/dist/index.es.js +23 -16
- package/package.json +1 -1
package/dist/Drawer.d.ts
CHANGED
|
@@ -15,6 +15,8 @@ export declare class Drawer extends HTMLElement {
|
|
|
15
15
|
show(): void;
|
|
16
16
|
hide(): void;
|
|
17
17
|
toggleFooterVisibility(): void;
|
|
18
|
+
addOpenListener(): void;
|
|
19
|
+
get $opener(): HTMLButtonElement;
|
|
18
20
|
get $closeButton(): Icon;
|
|
19
21
|
get $dialog(): HTMLDialogElement;
|
|
20
22
|
get open(): boolean;
|
|
@@ -24,4 +26,6 @@ export declare class Drawer extends HTMLElement {
|
|
|
24
26
|
set open(value: boolean);
|
|
25
27
|
get ariaLabelCloseButton(): string;
|
|
26
28
|
set ariaLabelCloseButton(value: string);
|
|
29
|
+
get openedby(): string;
|
|
30
|
+
set openedby(value: string);
|
|
27
31
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -50,15 +50,7 @@ class d extends HTMLElement {
|
|
|
50
50
|
this.hide();
|
|
51
51
|
});
|
|
52
52
|
}
|
|
53
|
-
|
|
54
|
-
const e = document.querySelector(
|
|
55
|
-
`px-button#${this.getAttribute("openedby")}`
|
|
56
|
-
);
|
|
57
|
-
e == null || e.addEventListener("click", () => {
|
|
58
|
-
this.show();
|
|
59
|
-
});
|
|
60
|
-
}
|
|
61
|
-
this.$closeButton.addEventListener("click", () => {
|
|
53
|
+
this.hasAttribute("openedby") && this.addOpenListener(), this.$closeButton.addEventListener("click", () => {
|
|
62
54
|
this.hide();
|
|
63
55
|
}), this.toggleFooterVisibility(), (t = this.$slotFooter) == null || t.addEventListener(
|
|
64
56
|
"slotchange",
|
|
@@ -66,15 +58,15 @@ class d extends HTMLElement {
|
|
|
66
58
|
);
|
|
67
59
|
}
|
|
68
60
|
static get observedAttributes() {
|
|
69
|
-
return ["open", "aria-label-close-button"];
|
|
61
|
+
return ["open", "aria-label-close-button", "openedby"];
|
|
70
62
|
}
|
|
71
|
-
attributeChangedCallback(t, e,
|
|
72
|
-
var a,
|
|
73
|
-
t === "open" ?
|
|
74
|
-
|
|
63
|
+
attributeChangedCallback(t, e, o) {
|
|
64
|
+
var a, i, r;
|
|
65
|
+
t === "open" ? o !== null ? this.show() : this.hide() : t === "aria-label-close-button" ? o ? (r = (i = this.$closeButton) == null ? void 0 : i.setAttribute) == null || r.call(
|
|
66
|
+
i,
|
|
75
67
|
"aria-label",
|
|
76
|
-
|
|
77
|
-
) : (a = this.$closeButton) == null || a.removeAttribute("aria-label"));
|
|
68
|
+
o || "Close drawer"
|
|
69
|
+
) : (a = this.$closeButton) == null || a.removeAttribute("aria-label") : t === "openedby" && this.addOpenListener();
|
|
78
70
|
}
|
|
79
71
|
disconnectedCallback() {
|
|
80
72
|
var t;
|
|
@@ -99,6 +91,15 @@ class d extends HTMLElement {
|
|
|
99
91
|
toggleFooterVisibility() {
|
|
100
92
|
this.$slottedFooter ? this.$footer.style.display = "block" : this.$footer.style.display = "none";
|
|
101
93
|
}
|
|
94
|
+
addOpenListener() {
|
|
95
|
+
var t, e, o;
|
|
96
|
+
((t = this.$opener) == null ? void 0 : t.getAttribute("data-has-opener")) !== "true" && ((e = this.$opener) == null || e.setAttribute("data-has-opener", "true"), (o = this.$opener) == null || o.addEventListener("click", () => this.show()));
|
|
97
|
+
}
|
|
98
|
+
get $opener() {
|
|
99
|
+
return document.querySelector(
|
|
100
|
+
`px-button#${this.getAttribute("openedby")}`
|
|
101
|
+
);
|
|
102
|
+
}
|
|
102
103
|
get $closeButton() {
|
|
103
104
|
return this.shadowRoot.querySelector("px-button-icon");
|
|
104
105
|
}
|
|
@@ -128,6 +129,12 @@ class d extends HTMLElement {
|
|
|
128
129
|
set ariaLabelCloseButton(t) {
|
|
129
130
|
this.setAttribute("aria-label-close-button", t);
|
|
130
131
|
}
|
|
132
|
+
get openedby() {
|
|
133
|
+
return this.getAttribute("openedby");
|
|
134
|
+
}
|
|
135
|
+
set openedby(t) {
|
|
136
|
+
this.setAttribute("openedby", t);
|
|
137
|
+
}
|
|
131
138
|
}
|
|
132
139
|
customElements.get("px-drawer") || customElements.define("px-drawer", d);
|
|
133
140
|
export {
|