@proximus/lavender-modal 2.0.0-alpha.21 → 2.0.0-alpha.22
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/Modal.d.ts +5 -1
- package/dist/index.es.js +59 -39
- package/package.json +1 -1
package/dist/Modal.d.ts
CHANGED
|
@@ -14,13 +14,17 @@ export declare class Modal extends HTMLElement {
|
|
|
14
14
|
attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
|
|
15
15
|
handleOpenChange(): void;
|
|
16
16
|
handleStatusChange(oldStatus: string, newStatus: string): void;
|
|
17
|
-
getIcon(status: string): "checkmark_fill" | "exclamation_mark_fill" | "minus_fill";
|
|
17
|
+
getIcon(status: string): "checkmark_fill" | "exclamation_mark_fill" | "minus_fill" | "information_fill";
|
|
18
18
|
show(): void;
|
|
19
19
|
close(): void;
|
|
20
|
+
updateMediaSrc(src: string): void;
|
|
20
21
|
get status(): string;
|
|
21
22
|
set status(value: string);
|
|
22
23
|
get $closeButton(): ButtonIcon;
|
|
23
24
|
get $statusIcon(): Icon;
|
|
25
|
+
get $mediaContainer(): HTMLDivElement;
|
|
26
|
+
get mediaSrc(): string;
|
|
27
|
+
set mediaSrc(value: string);
|
|
24
28
|
get $container(): Element;
|
|
25
29
|
get $iconContainer(): Element;
|
|
26
30
|
get $dialog(): HTMLDialogElement;
|
package/dist/index.es.js
CHANGED
|
@@ -4,40 +4,44 @@ import "@proximus/lavender-layout";
|
|
|
4
4
|
import "@proximus/lavender-icon";
|
|
5
5
|
import "@proximus/lavender-heading";
|
|
6
6
|
import "@proximus/lavender-paragraph";
|
|
7
|
-
const n = "#container{width:1080px;display:
|
|
7
|
+
const n = "*{box-sizing:border-box}#container{width:1080px;display:flex;flex-wrap:nowrap;border-radius:var(--px-radius-main);background-color:var(--px-color-background-surface-default);overflow:hidden}#container.info{border-left:5px var(--px-color-icon-brand-default) solid}#container.success{border-left:5px var(--px-color-icon-purpose-success-default) solid}#container.warning{border-left:5px var(--px-color-icon-purpose-warning-default) solid}#container.error{border-left:5px var(--px-color-icon-purpose-error-default) solid}#content-container{padding:var(--px-padding-m-mobile)}#media-container{display:none}::slotted(px-button-icon){position:absolute;top:var(--px-padding-m-desktop);right:var(--px-padding-m-desktop)}dialog{background:transparent;border-radius:0;box-shadow:none;padding:0;border:0;box-sizing:border-box;transform:scale(.95);animation:modalIn .3s ease-out forwards}::backdrop{background:#0000004d;-webkit-backdrop-filter:saturate(180%) blur(15px);backdrop-filter:saturate(180%) blur(15px)}#content{max-height:12.5em;overflow:auto}@media screen and (max-width: 1081px){#container{width:inherit}#content-container{padding:var(--px-padding-m-mobile)}::slotted(px-button-icon){top:var(--px-padding-m-mobile);right:var(--px-padding-m-mobile)}}@media only screen and (min-width: 48em){::slotted(px-button-icon){position:absolute;top:var(--px-padding-m-tablet);right:var(--px-padding-m-tablet)}#content{max-height:25em}}@media only screen and (min-width: 64.0625em){:host([media-src]) #media-container{display:block;background-size:cover;background-position:center center;background-repeat:no-repeat;flex-basis:25em;flex-shrink:0}}@keyframes modalIn{0%{transform:scale(.95);opacity:0}to{transform:scale(1);opacity:1}}", a = new CSSStyleSheet();
|
|
8
8
|
a.replaceSync(n);
|
|
9
9
|
const c = "px.lavender.modal.close";
|
|
10
|
-
class
|
|
10
|
+
class d extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(), this.template = ` <dialog>
|
|
13
13
|
<div id="container">
|
|
14
|
-
<
|
|
15
|
-
<px-
|
|
16
|
-
<px-
|
|
17
|
-
<px-
|
|
18
|
-
<
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
<
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
14
|
+
<div id="content-container">
|
|
15
|
+
<px-vstack gap="default" >
|
|
16
|
+
<px-hstack id="icon-container" gap="s" align-items="flex-start">
|
|
17
|
+
<px-vstack gap="s">
|
|
18
|
+
<px-h1 variant="title-l">
|
|
19
|
+
<slot name="title"></slot>
|
|
20
|
+
</px-h1>
|
|
21
|
+
<px-p font-weight="title">
|
|
22
|
+
<slot name="description"></slot>
|
|
23
|
+
</px-p>
|
|
24
|
+
</px-vstack>
|
|
25
|
+
</px-hstack>
|
|
26
|
+
<div id="content">
|
|
27
|
+
<slot></slot>
|
|
28
|
+
</div>
|
|
29
|
+
<px-separator size="m"></px-separator>
|
|
30
|
+
<px-stack
|
|
31
|
+
gap="s"
|
|
32
|
+
justify-content="flex-end"
|
|
33
|
+
align-items="center"
|
|
34
|
+
align-items--mobile="stretch"
|
|
35
|
+
direction="row"
|
|
36
|
+
direction--mobile="column-reverse"
|
|
37
|
+
>
|
|
38
|
+
<slot name="footer"></slot>
|
|
39
|
+
</px-stack>
|
|
40
|
+
</px-vstack>
|
|
41
|
+
<slot name="close-button"></slot>
|
|
42
|
+
</div>
|
|
43
|
+
<div id="media-container">
|
|
44
|
+
</div>
|
|
41
45
|
</div>
|
|
42
46
|
</dialog>`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [a];
|
|
43
47
|
}
|
|
@@ -58,17 +62,21 @@ class l extends HTMLElement {
|
|
|
58
62
|
this.show();
|
|
59
63
|
});
|
|
60
64
|
}
|
|
65
|
+
this.hasAttribute("media-src") && this.updateMediaSrc(this.getAttribute("media-src"));
|
|
61
66
|
}
|
|
62
67
|
static get observedAttributes() {
|
|
63
|
-
return ["open", "status"];
|
|
68
|
+
return ["open", "status", "media-src"];
|
|
64
69
|
}
|
|
65
|
-
attributeChangedCallback(t, e,
|
|
70
|
+
attributeChangedCallback(t, e, i) {
|
|
66
71
|
switch (t) {
|
|
67
72
|
case "open":
|
|
68
73
|
this.handleOpenChange();
|
|
69
74
|
break;
|
|
70
75
|
case "status":
|
|
71
|
-
this.handleStatusChange(e,
|
|
76
|
+
this.handleStatusChange(e, i);
|
|
77
|
+
break;
|
|
78
|
+
case "media-src":
|
|
79
|
+
this.updateMediaSrc(i);
|
|
72
80
|
break;
|
|
73
81
|
}
|
|
74
82
|
}
|
|
@@ -76,17 +84,17 @@ class l extends HTMLElement {
|
|
|
76
84
|
this.hasAttribute("open") ? this.show() : this.close();
|
|
77
85
|
}
|
|
78
86
|
handleStatusChange(t, e) {
|
|
79
|
-
var
|
|
80
|
-
if (e === "success" ? this.$container.classList.add("success") : this.$container.classList.remove("success"), e === "error" ? this.$container.classList.add("error") : this.$container.classList.remove("error"), e === "warning" ? this.$container.classList.add("warning") : this.$container.classList.remove("warning"), e === null && this.$statusIcon)
|
|
81
|
-
(
|
|
87
|
+
var i, s, r;
|
|
88
|
+
if (e === "info" ? this.$container.classList.add("info") : this.$container.classList.remove("info"), e === "success" ? this.$container.classList.add("success") : this.$container.classList.remove("success"), e === "error" ? this.$container.classList.add("error") : this.$container.classList.remove("error"), e === "warning" ? this.$container.classList.add("warning") : this.$container.classList.remove("warning"), e === null && this.$statusIcon)
|
|
89
|
+
(i = this.$statusIcon) == null || i.remove();
|
|
82
90
|
else if (t === null && e && !this.$statusIcon) {
|
|
83
91
|
const o = document.createElement("px-icon");
|
|
84
92
|
o.setAttribute("name", this.getIcon(e)), o.setAttribute("from", "lavender"), o.setAttribute("color", `purpose-${e}`), o.setAttribute("size", "l"), this.$iconContainer.prepend(o);
|
|
85
93
|
} else
|
|
86
|
-
(
|
|
94
|
+
(s = this.$statusIcon) == null || s.setAttribute("name", this.getIcon(e)), (r = this.$statusIcon) == null || r.setAttribute("color", `purpose-${e}`);
|
|
87
95
|
}
|
|
88
96
|
getIcon(t) {
|
|
89
|
-
return t === "success" ? "checkmark_fill" : t === "warning" ? "exclamation_mark_fill" : "minus_fill";
|
|
97
|
+
return t === "success" ? "checkmark_fill" : t === "warning" ? "exclamation_mark_fill" : t === "error" ? "minus_fill" : "information_fill";
|
|
90
98
|
}
|
|
91
99
|
show() {
|
|
92
100
|
this.$dialog.showModal();
|
|
@@ -99,6 +107,9 @@ class l extends HTMLElement {
|
|
|
99
107
|
})
|
|
100
108
|
);
|
|
101
109
|
}
|
|
110
|
+
updateMediaSrc(t) {
|
|
111
|
+
this.$mediaContainer.style.backgroundImage = `url(${t})`;
|
|
112
|
+
}
|
|
102
113
|
get status() {
|
|
103
114
|
return this.getAttribute("status");
|
|
104
115
|
}
|
|
@@ -113,6 +124,15 @@ class l extends HTMLElement {
|
|
|
113
124
|
"#icon-container > px-icon"
|
|
114
125
|
);
|
|
115
126
|
}
|
|
127
|
+
get $mediaContainer() {
|
|
128
|
+
return this.shadowRoot.querySelector("#media-container");
|
|
129
|
+
}
|
|
130
|
+
get mediaSrc() {
|
|
131
|
+
return this.getAttribute("media-src");
|
|
132
|
+
}
|
|
133
|
+
set mediaSrc(t) {
|
|
134
|
+
t === null ? this.removeAttribute("media-src") : this.setAttribute("media-src", t);
|
|
135
|
+
}
|
|
116
136
|
get $container() {
|
|
117
137
|
return this.shadowRoot.querySelector("#container");
|
|
118
138
|
}
|
|
@@ -126,7 +146,7 @@ class l extends HTMLElement {
|
|
|
126
146
|
return this.$dialog.open;
|
|
127
147
|
}
|
|
128
148
|
}
|
|
129
|
-
customElements.get("px-modal") || customElements.define("px-modal",
|
|
149
|
+
customElements.get("px-modal") || customElements.define("px-modal", d);
|
|
130
150
|
export {
|
|
131
|
-
|
|
151
|
+
d as Modal
|
|
132
152
|
};
|