@proximus/lavender-drawer 1.4.6-beta.2 → 1.4.6
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 -9
- package/dist/index.es.js +32 -64
- package/package.json +1 -1
package/dist/Drawer.d.ts
CHANGED
|
@@ -6,20 +6,17 @@ import '@proximus/lavender-heading';
|
|
|
6
6
|
import { type Icon } from '@proximus/lavender-icon';
|
|
7
7
|
export declare const HIDE_EVENT = "px.lavender.drawer.hide";
|
|
8
8
|
export declare class Drawer extends HTMLElement {
|
|
9
|
-
observer: MutationObserver;
|
|
10
9
|
template: string;
|
|
11
10
|
constructor();
|
|
12
11
|
connectedCallback(): void;
|
|
13
12
|
static get observedAttributes(): string[];
|
|
14
|
-
attributeChangedCallback(
|
|
13
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
15
14
|
disconnectedCallback(): void;
|
|
16
15
|
show(): void;
|
|
17
16
|
hide(): void;
|
|
18
17
|
toggleFooterVisibility(): void;
|
|
19
18
|
addOpenListener(): void;
|
|
20
|
-
|
|
21
|
-
get $opener(): HTMLElement;
|
|
22
|
-
get $closer(): HTMLElement;
|
|
19
|
+
get $opener(): HTMLButtonElement;
|
|
23
20
|
get $closeButton(): Icon;
|
|
24
21
|
get $dialog(): HTMLDialogElement;
|
|
25
22
|
get open(): boolean;
|
|
@@ -27,10 +24,8 @@ export declare class Drawer extends HTMLElement {
|
|
|
27
24
|
get $slottedFooter(): HTMLElement;
|
|
28
25
|
get $footer(): HTMLElement;
|
|
29
26
|
set open(value: boolean);
|
|
30
|
-
get
|
|
31
|
-
set
|
|
27
|
+
get ariaLabelCloseButton(): string;
|
|
28
|
+
set ariaLabelCloseButton(value: string);
|
|
32
29
|
get openedby(): string;
|
|
33
30
|
set openedby(value: string);
|
|
34
|
-
get closedby(): string;
|
|
35
|
-
set closedby(value: string);
|
|
36
31
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -3,10 +3,10 @@ import "@proximus/lavender-layout";
|
|
|
3
3
|
import "@proximus/lavender-button-icon";
|
|
4
4
|
import "@proximus/lavender-icon";
|
|
5
5
|
import "@proximus/lavender-heading";
|
|
6
|
-
const
|
|
7
|
-
|
|
8
|
-
const
|
|
9
|
-
class
|
|
6
|
+
const n = ':host *{box-sizing:border-box}::backdrop{background:#0000004d;-webkit-backdrop-filter:saturate(180%) blur(15px);backdrop-filter:saturate(180%) blur(15px)}dialog{box-shadow:none;padding:0;margin:auto 0 0;border:0;width:100%;animation:dialog-fade-in-bottom .3s;border-radius:var(--px-radius-main) var(--px-radius-main) 0 0;background-color:var(--px-color-background-surface-light)}#container{display:grid;grid-template:"header close" auto "content content" 1fr "footer footer" auto / 1fr auto;column-gap:var(--px-spacing-l-mobile);padding:var(--px-padding-l-mobile);max-height:90dvh}#header{grid-area:header;margin-bottom:var(--px-spacing-l-mobile)}#close{grid-area:close}#content{grid-area:content;overflow:hidden;overflow-y:auto}#footer{grid-area:footer;margin-top:var(--px-spacing-l-mobile)}@media only screen and (min-width: 48em){#container{column-gap:var(--px-spacing-l-tablet);padding:var(--px-padding-l-tablet)}#header{margin-bottom:var(--px-spacing-l-tablet)}#footer{margin-top:var(--px-spacing-l-tablet)}}@media only screen and (min-width: 64.0625em){#container{column-gap:var(--px-spacing-l-laptop);padding:var(--px-padding-l-laptop);max-width:var(--px-content-wrapper-max-width-laptop);margin:0 auto}#header{margin-bottom:var(--px-spacing-l-laptop)}#footer{margin-top:var(--px-spacing-l-laptop)}:host([showfrom="right"]) dialog{width:75%;height:100%;margin:0 0 0 auto;animation:dialog-fade-in-right .3s;border-radius:var(--px-radius-main) 0 0 var(--px-radius-main)}:host([showfrom="right"]) #container{max-height:100%;height:100%;margin:0 auto 0 0}:host([showfrom="left"]) dialog{width:75%;height:100%;margin:0 auto 0 0;animation:dialog-fade-in-left .3s;border-radius:0 var(--px-radius-main) var(--px-radius-main) 0}:host([showfrom="left"]) #container{margin:0 0 0 auto}}@media only screen and (min-width: 90.0625em){#container{column-gap:var(--px-spacing-l-desktop);padding:var(--px-padding-l-desktop)}#header{margin-bottom:var(--px-spacing-l-desktop)}#footer{margin-top:var(--px-spacing-l-desktop)}}@keyframes dialog-fade-in-right{0%{margin-right:-67.5em}to{margin-right:0}}@keyframes dialog-fade-in-left{0%{margin-left:-67.5em}to{margin-left:0}}@keyframes dialog-fade-in-bottom{0%{margin-bottom:-12.5em}to{margin-bottom:0}}', s = new CSSStyleSheet();
|
|
7
|
+
s.replaceSync(n);
|
|
8
|
+
const l = "px.lavender.drawer.hide";
|
|
9
|
+
class d extends HTMLElement {
|
|
10
10
|
constructor() {
|
|
11
11
|
super(), this.template = `<dialog popover role="dialog" aria-modal="true" >
|
|
12
12
|
<div id="container">
|
|
@@ -38,11 +38,19 @@ class h extends HTMLElement {
|
|
|
38
38
|
<px-icon name="cross" from="lavender"></px-icon>
|
|
39
39
|
</px-button-icon>
|
|
40
40
|
</div>
|
|
41
|
-
</dialog>`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [
|
|
41
|
+
</dialog>`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [s];
|
|
42
42
|
}
|
|
43
43
|
connectedCallback() {
|
|
44
44
|
var t;
|
|
45
|
-
this.toggleFooterVisibility = this.toggleFooterVisibility.bind(this), this
|
|
45
|
+
if (this.toggleFooterVisibility = this.toggleFooterVisibility.bind(this), this.hasAttribute("showfrom") || this.setAttribute("showfrom", "bottom"), this.hasAttribute("closedby")) {
|
|
46
|
+
const e = document.querySelector(
|
|
47
|
+
`#${this.getAttribute("closedby")}`
|
|
48
|
+
);
|
|
49
|
+
e == null || e.addEventListener("click", () => {
|
|
50
|
+
this.hide();
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
this.hasAttribute("openedby") && this.addOpenListener(), this.$closeButton.addEventListener("click", () => {
|
|
46
54
|
this.hide();
|
|
47
55
|
}), this.toggleFooterVisibility(), (t = this.$slotFooter) == null || t.addEventListener(
|
|
48
56
|
"slotchange",
|
|
@@ -50,41 +58,22 @@ class h extends HTMLElement {
|
|
|
50
58
|
);
|
|
51
59
|
}
|
|
52
60
|
static get observedAttributes() {
|
|
53
|
-
return ["open", "aria-label-close-button", "openedby"
|
|
61
|
+
return ["open", "aria-label-close-button", "openedby"];
|
|
54
62
|
}
|
|
55
63
|
attributeChangedCallback(t, e, o) {
|
|
56
|
-
var a, i,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
o ? (s = (i = this.$closeButton) == null ? void 0 : i.setAttribute) == null || s.call(
|
|
63
|
-
i,
|
|
64
|
-
"aria-label",
|
|
65
|
-
o || "Close drawer"
|
|
66
|
-
) : (a = this.$closeButton) == null || a.removeAttribute("aria-label");
|
|
67
|
-
break;
|
|
68
|
-
case "openedby":
|
|
69
|
-
if (o !== e) {
|
|
70
|
-
if (e) {
|
|
71
|
-
const r = document.querySelector(`#${e}`);
|
|
72
|
-
r == null || r.removeEventListener("click", () => this.show());
|
|
73
|
-
}
|
|
74
|
-
this.addOpenListener();
|
|
75
|
-
}
|
|
76
|
-
break;
|
|
77
|
-
case "closedby":
|
|
78
|
-
this.addCloseListener();
|
|
79
|
-
break;
|
|
80
|
-
}
|
|
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,
|
|
67
|
+
"aria-label",
|
|
68
|
+
o || "Close drawer"
|
|
69
|
+
) : (a = this.$closeButton) == null || a.removeAttribute("aria-label") : t === "openedby" && this.addOpenListener();
|
|
81
70
|
}
|
|
82
71
|
disconnectedCallback() {
|
|
83
|
-
var t
|
|
72
|
+
var t;
|
|
84
73
|
(t = this.$slotFooter) == null || t.removeEventListener(
|
|
85
74
|
"slotchange",
|
|
86
75
|
this.toggleFooterVisibility
|
|
87
|
-
)
|
|
76
|
+
);
|
|
88
77
|
}
|
|
89
78
|
show() {
|
|
90
79
|
var t, e;
|
|
@@ -93,7 +82,7 @@ class h extends HTMLElement {
|
|
|
93
82
|
hide() {
|
|
94
83
|
var t, e;
|
|
95
84
|
(e = (t = this.$dialog).hidePopover) == null || e.call(t), document.body.style.overflow = "", this.dispatchEvent(
|
|
96
|
-
new Event(
|
|
85
|
+
new Event(l, {
|
|
97
86
|
bubbles: !0,
|
|
98
87
|
composed: !0
|
|
99
88
|
})
|
|
@@ -103,27 +92,12 @@ class h extends HTMLElement {
|
|
|
103
92
|
this.$slottedFooter ? this.$footer.style.display = "block" : this.$footer.style.display = "none";
|
|
104
93
|
}
|
|
105
94
|
addOpenListener() {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
}), this.observer.observe(document.body, {
|
|
109
|
-
childList: !0,
|
|
110
|
-
subtree: !0
|
|
111
|
-
}));
|
|
112
|
-
}
|
|
113
|
-
addCloseListener() {
|
|
114
|
-
var t;
|
|
115
|
-
this.$closer && ((t = this.$closer) == null || t.addEventListener("click", () => {
|
|
116
|
-
this.hide();
|
|
117
|
-
}));
|
|
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()));
|
|
118
97
|
}
|
|
119
98
|
get $opener() {
|
|
120
99
|
return document.querySelector(
|
|
121
|
-
|
|
122
|
-
);
|
|
123
|
-
}
|
|
124
|
-
get $closer() {
|
|
125
|
-
return document.querySelector(
|
|
126
|
-
`#${this.getAttribute("closedby")}`
|
|
100
|
+
`px-button#${this.getAttribute("openedby")}`
|
|
127
101
|
);
|
|
128
102
|
}
|
|
129
103
|
get $closeButton() {
|
|
@@ -149,10 +123,10 @@ class h extends HTMLElement {
|
|
|
149
123
|
set open(t) {
|
|
150
124
|
t ? this.setAttribute("open", "") : this.removeAttribute("open");
|
|
151
125
|
}
|
|
152
|
-
get
|
|
126
|
+
get ariaLabelCloseButton() {
|
|
153
127
|
return this.getAttribute("aria-label-close-button");
|
|
154
128
|
}
|
|
155
|
-
set
|
|
129
|
+
set ariaLabelCloseButton(t) {
|
|
156
130
|
this.setAttribute("aria-label-close-button", t);
|
|
157
131
|
}
|
|
158
132
|
get openedby() {
|
|
@@ -161,15 +135,9 @@ class h extends HTMLElement {
|
|
|
161
135
|
set openedby(t) {
|
|
162
136
|
this.setAttribute("openedby", t);
|
|
163
137
|
}
|
|
164
|
-
get closedby() {
|
|
165
|
-
return this.getAttribute("closedby");
|
|
166
|
-
}
|
|
167
|
-
set closedby(t) {
|
|
168
|
-
this.setAttribute("closedby", t);
|
|
169
|
-
}
|
|
170
138
|
}
|
|
171
|
-
customElements.get("px-drawer") || customElements.define("px-drawer",
|
|
139
|
+
customElements.get("px-drawer") || customElements.define("px-drawer", d);
|
|
172
140
|
export {
|
|
173
|
-
|
|
174
|
-
|
|
141
|
+
d as Drawer,
|
|
142
|
+
l as HIDE_EVENT
|
|
175
143
|
};
|