@proximus/lavender-drawer 2.0.0-alpha.1 → 2.0.0-alpha.10
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 +7 -2
- package/dist/index.es.js +64 -39
- package/package.json +1 -1
package/dist/Drawer.d.ts
CHANGED
|
@@ -11,12 +11,17 @@ export declare class Drawer extends HTMLElement {
|
|
|
11
11
|
connectedCallback(): void;
|
|
12
12
|
static get observedAttributes(): string[];
|
|
13
13
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
14
|
+
disconnectedCallback(): void;
|
|
14
15
|
show(): void;
|
|
15
16
|
hide(): void;
|
|
17
|
+
toggleFooterVisibility(): void;
|
|
16
18
|
get $closeButton(): Icon;
|
|
17
19
|
get $dialog(): HTMLDialogElement;
|
|
18
20
|
get open(): boolean;
|
|
21
|
+
get $slotFooter(): HTMLSlotElement;
|
|
22
|
+
get $slottedFooter(): HTMLElement;
|
|
23
|
+
get $footer(): HTMLElement;
|
|
19
24
|
set open(value: boolean);
|
|
20
|
-
get
|
|
21
|
-
set
|
|
25
|
+
get closeButtonAriaLabel(): string;
|
|
26
|
+
set closeButtonAriaLabel(value: string);
|
|
22
27
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -3,25 +3,25 @@ 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 n = '
|
|
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-default)}#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
7
|
s.replaceSync(n);
|
|
8
|
-
const
|
|
9
|
-
class
|
|
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">
|
|
13
|
-
<px-vstack gap="
|
|
14
|
-
<px-
|
|
15
|
-
<
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
<
|
|
23
|
-
|
|
24
|
-
|
|
13
|
+
<px-vstack gap="heading-to-subtitle" id="header">
|
|
14
|
+
<px-h1 variant="title-2xl">
|
|
15
|
+
<slot name="title"></slot>
|
|
16
|
+
</px-h1>
|
|
17
|
+
<px-h2 variant="subtitle" color="neutral">
|
|
18
|
+
<slot name="subtitle"></slot>
|
|
19
|
+
</px-h2>
|
|
20
|
+
</px-vstack>
|
|
21
|
+
<div id="content">
|
|
22
|
+
<slot></slot>
|
|
23
|
+
</div>
|
|
24
|
+
<px-vstack gap="l" id="footer">
|
|
25
25
|
<px-separator size="m"></px-separator>
|
|
26
26
|
<px-stack
|
|
27
27
|
gap="s"
|
|
@@ -34,57 +34,71 @@ class l extends HTMLElement {
|
|
|
34
34
|
<slot name="footer"></slot>
|
|
35
35
|
</px-stack>
|
|
36
36
|
</px-vstack>
|
|
37
|
-
<px-button-icon variant="secondary" size="small">
|
|
37
|
+
<px-button-icon variant="secondary" size="small" id="close">
|
|
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 = [s], this.hasAttribute("showfrom") || this.setAttribute("showfrom", "bottom");
|
|
41
|
+
</dialog>`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [s], this.toggleFooterVisibility = this.toggleFooterVisibility.bind(this), this.hasAttribute("showfrom") || this.setAttribute("showfrom", "bottom");
|
|
42
42
|
}
|
|
43
43
|
connectedCallback() {
|
|
44
|
+
var t;
|
|
44
45
|
if (this.hasAttribute("closedby")) {
|
|
45
|
-
const
|
|
46
|
+
const e = document.querySelector(
|
|
46
47
|
`#${this.getAttribute("closedby")}`
|
|
47
48
|
);
|
|
48
|
-
|
|
49
|
+
e == null || e.addEventListener("click", () => {
|
|
49
50
|
this.hide();
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
if (this.hasAttribute("openedby")) {
|
|
53
|
-
const
|
|
54
|
+
const e = document.querySelector(
|
|
54
55
|
`px-button#${this.getAttribute("openedby")}`
|
|
55
56
|
);
|
|
56
|
-
|
|
57
|
+
e == null || e.addEventListener("click", () => {
|
|
57
58
|
this.show();
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
this.$closeButton.addEventListener("click", () => {
|
|
61
62
|
this.hide();
|
|
62
|
-
})
|
|
63
|
+
}), this.toggleFooterVisibility(), (t = this.$slotFooter) == null || t.addEventListener(
|
|
64
|
+
"slotchange",
|
|
65
|
+
this.toggleFooterVisibility
|
|
66
|
+
);
|
|
63
67
|
}
|
|
64
68
|
static get observedAttributes() {
|
|
65
|
-
return ["open", "aria-label
|
|
69
|
+
return ["open", "close-button-aria-label"];
|
|
66
70
|
}
|
|
67
|
-
attributeChangedCallback(t,
|
|
68
|
-
var a,
|
|
69
|
-
t === "open" ? i !== null ? this.show() : this.hide() : t === "aria-label
|
|
70
|
-
|
|
71
|
+
attributeChangedCallback(t, e, i) {
|
|
72
|
+
var a, o, r;
|
|
73
|
+
t === "open" ? i !== null ? this.show() : this.hide() : t === "close-button-aria-label" && (i ? (r = (o = this.$closeButton) == null ? void 0 : o.setAttribute) == null || r.call(
|
|
74
|
+
o,
|
|
71
75
|
"aria-label",
|
|
72
76
|
i || "Close drawer"
|
|
73
77
|
) : (a = this.$closeButton) == null || a.removeAttribute("aria-label"));
|
|
74
78
|
}
|
|
79
|
+
disconnectedCallback() {
|
|
80
|
+
var t;
|
|
81
|
+
(t = this.$slotFooter) == null || t.removeEventListener(
|
|
82
|
+
"slotchange",
|
|
83
|
+
this.toggleFooterVisibility
|
|
84
|
+
);
|
|
85
|
+
}
|
|
75
86
|
show() {
|
|
76
|
-
var t,
|
|
77
|
-
(
|
|
87
|
+
var t, e;
|
|
88
|
+
(e = (t = this.$dialog).showPopover) == null || e.call(t);
|
|
78
89
|
}
|
|
79
90
|
hide() {
|
|
80
|
-
var t,
|
|
81
|
-
(
|
|
82
|
-
new Event(
|
|
91
|
+
var t, e;
|
|
92
|
+
(e = (t = this.$dialog).hidePopover) == null || e.call(t), this.dispatchEvent(
|
|
93
|
+
new Event(l, {
|
|
83
94
|
bubbles: !0,
|
|
84
95
|
composed: !0
|
|
85
96
|
})
|
|
86
97
|
);
|
|
87
98
|
}
|
|
99
|
+
toggleFooterVisibility() {
|
|
100
|
+
this.$slottedFooter ? this.$footer.style.display = "block" : this.$footer.style.display = "none";
|
|
101
|
+
}
|
|
88
102
|
get $closeButton() {
|
|
89
103
|
return this.shadowRoot.querySelector("px-button-icon");
|
|
90
104
|
}
|
|
@@ -94,18 +108,29 @@ class l extends HTMLElement {
|
|
|
94
108
|
get open() {
|
|
95
109
|
return this.hasAttribute("open");
|
|
96
110
|
}
|
|
111
|
+
get $slotFooter() {
|
|
112
|
+
return this.shadowRoot.querySelector(
|
|
113
|
+
'slot[name="footer"]'
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
get $slottedFooter() {
|
|
117
|
+
return this.querySelector('[slot="footer"]');
|
|
118
|
+
}
|
|
119
|
+
get $footer() {
|
|
120
|
+
return this.shadowRoot.querySelector("#footer");
|
|
121
|
+
}
|
|
97
122
|
set open(t) {
|
|
98
123
|
t ? this.setAttribute("open", "") : this.removeAttribute("open");
|
|
99
124
|
}
|
|
100
|
-
get
|
|
101
|
-
return this.getAttribute("aria-label
|
|
125
|
+
get closeButtonAriaLabel() {
|
|
126
|
+
return this.getAttribute("close-button-aria-label");
|
|
102
127
|
}
|
|
103
|
-
set
|
|
104
|
-
this.setAttribute("aria-label
|
|
128
|
+
set closeButtonAriaLabel(t) {
|
|
129
|
+
this.setAttribute("close-button-aria-label", t);
|
|
105
130
|
}
|
|
106
131
|
}
|
|
107
|
-
customElements.get("px-drawer") || customElements.define("px-drawer",
|
|
132
|
+
customElements.get("px-drawer") || customElements.define("px-drawer", d);
|
|
108
133
|
export {
|
|
109
|
-
|
|
110
|
-
|
|
134
|
+
d as Drawer,
|
|
135
|
+
l as HIDE_EVENT
|
|
111
136
|
};
|