@proximus/lavender-modal 2.0.0-alpha.3 → 2.0.0-alpha.31

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