@proximus/lavender-modal 2.0.0-alpha.34 → 2.0.0-alpha.35

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
@@ -18,8 +18,12 @@ export declare class Modal extends HTMLElement {
18
18
  show(): void;
19
19
  close(): void;
20
20
  updateMediaSrc(src: string): void;
21
+ addOpenListener(): void;
22
+ get $opener(): HTMLButtonElement;
21
23
  get status(): string;
22
24
  set status(value: string);
25
+ get openedby(): string;
26
+ set openedby(value: string);
23
27
  get $closeButton(): ButtonIcon;
24
28
  get $statusIcon(): Icon;
25
29
  get $mediaContainer(): HTMLDivElement;
package/dist/index.es.js CHANGED
@@ -4,8 +4,8 @@ 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 = "*{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
- a.replaceSync(n);
7
+ const a = "*{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}}", n = new CSSStyleSheet();
8
+ n.replaceSync(a);
9
9
  const c = "px.lavender.modal.close";
10
10
  class d extends HTMLElement {
11
11
  constructor() {
@@ -43,7 +43,7 @@ class d extends HTMLElement {
43
43
  <div id="media-container">
44
44
  </div>
45
45
  </div>
46
- </dialog>`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [a];
46
+ </dialog>`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template, this.shadowRoot.adoptedStyleSheets = [n];
47
47
  }
48
48
  connectedCallback() {
49
49
  if (this.hasAttribute("open") && this.show(), this.hasAttribute("closedby")) {
@@ -54,29 +54,24 @@ class d extends HTMLElement {
54
54
  this.close();
55
55
  });
56
56
  }
57
- if (this.hasAttribute("openedby")) {
58
- const t = document.querySelector(
59
- `px-button#${this.getAttribute("openedby")}`
60
- );
61
- t == null || t.addEventListener("click", () => {
62
- this.show();
63
- });
64
- }
65
- this.hasAttribute("media-src") && this.updateMediaSrc(this.getAttribute("media-src"));
57
+ this.hasAttribute("openedby") && this.addOpenListener(), this.hasAttribute("media-src") && this.updateMediaSrc(this.getAttribute("media-src"));
66
58
  }
67
59
  static get observedAttributes() {
68
- return ["open", "status", "media-src"];
60
+ return ["open", "status", "media-src", "openedby"];
69
61
  }
70
- attributeChangedCallback(t, e, o) {
62
+ attributeChangedCallback(t, e, i) {
71
63
  switch (t) {
72
64
  case "open":
73
65
  this.handleOpenChange();
74
66
  break;
75
67
  case "status":
76
- this.handleStatusChange(e, o);
68
+ this.handleStatusChange(e, i);
77
69
  break;
78
70
  case "media-src":
79
- this.updateMediaSrc(o);
71
+ this.updateMediaSrc(i);
72
+ break;
73
+ case "openedby":
74
+ this.addOpenListener();
80
75
  break;
81
76
  }
82
77
  }
@@ -84,14 +79,14 @@ class d extends HTMLElement {
84
79
  this.hasAttribute("open") ? this.show() : this.close();
85
80
  }
86
81
  handleStatusChange(t, e) {
87
- var o, s, r;
82
+ var i, r, s;
88
83
  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
- (o = this.$statusIcon) == null || o.remove();
84
+ (i = this.$statusIcon) == null || i.remove();
90
85
  else if (t === null && e && !this.$statusIcon) {
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);
86
+ const o = document.createElement("px-icon");
87
+ o.setAttribute("name", this.getIcon(e)), o.setAttribute("from", "lavender"), o.setAttribute("color", `purpose-${e}`), o.setAttribute("size", "l"), this.$iconContainer.prepend(o);
93
88
  } else
94
- (s = this.$statusIcon) == null || s.setAttribute("name", this.getIcon(e)), (r = this.$statusIcon) == null || r.setAttribute("color", `purpose-${e}`);
89
+ (r = this.$statusIcon) == null || r.setAttribute("name", this.getIcon(e)), (s = this.$statusIcon) == null || s.setAttribute("color", `purpose-${e}`);
95
90
  }
96
91
  getIcon(t) {
97
92
  return t === "success" ? "checkmark_fill" : t === "warning" ? "exclamation_mark_fill" : t === "error" ? "minus_fill" : "information_fill";
@@ -110,12 +105,27 @@ class d extends HTMLElement {
110
105
  updateMediaSrc(t) {
111
106
  this.$mediaContainer.style.backgroundImage = `url(${t})`;
112
107
  }
108
+ addOpenListener() {
109
+ var t, e, i;
110
+ ((t = this.$opener) == null ? void 0 : t.getAttribute("data-has-opener")) !== "true" && ((e = this.$opener) == null || e.setAttribute("data-has-opener", "true"), (i = this.$opener) == null || i.addEventListener("click", () => this.show()));
111
+ }
112
+ get $opener() {
113
+ return document.querySelector(
114
+ `px-button#${this.getAttribute("openedby")}`
115
+ );
116
+ }
113
117
  get status() {
114
118
  return this.getAttribute("status");
115
119
  }
116
120
  set status(t) {
117
121
  this.setAttribute("status", t);
118
122
  }
123
+ get openedby() {
124
+ return this.getAttribute("openedby");
125
+ }
126
+ set openedby(t) {
127
+ this.setAttribute("openedby", t);
128
+ }
119
129
  get $closeButton() {
120
130
  return this.shadowRoot.querySelector("px-button-icon");
121
131
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-modal",
3
- "version": "2.0.0-alpha.34",
3
+ "version": "2.0.0-alpha.35",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",