@proximus/lavender-status-card 1.4.14-beta.3 → 1.4.14

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.
@@ -18,12 +18,12 @@ export declare class StatusCard extends PxElement<HTMLDivElement> {
18
18
  get $statusIcon(): Icon;
19
19
  get $container(): Container;
20
20
  get $children(): NodeListOf<Element>;
21
- get state(): string | null;
22
- set state(value: string | null);
21
+ get state(): string;
22
+ set state(value: string);
23
23
  get inverted(): boolean;
24
24
  set inverted(value: boolean);
25
- get statusIconAriaLabel(): string | null;
26
- set statusIconAriaLabel(value: string | null);
25
+ get statusIconAriaLabel(): string;
26
+ set statusIconAriaLabel(value: string);
27
27
  get backgroundColor(): string | null;
28
- set backgroundColor(value: string | null);
28
+ set backgroundColor(value: string);
29
29
  }
package/dist/index.es.js CHANGED
@@ -1,137 +1,155 @@
1
- import { PxElement as e, log as t } from "@proximus/lavender-common";
2
- //#region src/statuscard.css?inline
3
- var n = ":host,:host>*{box-sizing:border-box;display:block}px-container{height:100%}.status-card{position:relative}.status-card:before{content:\"\";border-left:5px solid var(--px-color-border-brand-default);border-radius:var(--px-radius-main) 0 0 var(--px-radius-main);height:100%;display:block;position:absolute;top:0;left:0}.status-card.success:before{border-color:var(--px-color-border-purpose-success-default)}.status-card.warning:before,.status-card.ongoing:before{border-color:var(--px-color-border-purpose-warning-default)}.status-card.error:before{border-color:var(--px-color-border-purpose-error-default)}::slotted([slot=title]){font-size:var(--px-text-size-heading-s-mobile);font-weight:var(--px-font-weight-title);line-height:var(--px-line-height-ratio-l);color:var(--px-color-text-neutral-default);display:block}:host([inverted]) .status-card:before{border-color:var(--px-color-border-brand-inverted)}:host([inverted]) .status-card.success:before{border-color:var(--px-color-border-purpose-success-inverted)}:host([inverted]) .status-card.warning:before,:host([inverted]) .status-card.ongoing:before{border-color:var(--px-color-border-purpose-warning-inverted)}:host([inverted]) .status-card.error:before{border-color:var(--px-color-border-purpose-error-inverted)}:host([inverted]) ::slotted([slot=title]){color:var(--px-color-text-neutral-inverted)}@media screen and (width<=47.938rem){.status-card-content{margin-top:3px}}@media screen and (width>=48rem){::slotted([slot=title]){font-size:var(--px-text-size-heading-s-tablet)}}@media screen and (width>=64.0625rem){::slotted([slot=title]){font-size:var(--px-text-size-heading-s-laptop)}}", r = new CSSStyleSheet();
4
- r.replaceSync(n);
5
- var i = [
6
- "",
7
- "info",
8
- "success",
9
- "warning",
10
- "error",
11
- "ongoing"
12
- ], a = [
13
- "",
14
- "container-light",
15
- "container-default"
16
- ], o = "px.lavender.modal.close", s = class extends e {
17
- static {
18
- this.nativeName = "div";
19
- }
20
- constructor() {
21
- super(r), this.template = () => "<div class=\"status-card\">\n <px-container padding=\"s\" background-color=\"container-default\">\n <px-hstack gap=\"s\" align-items=\"flex-start\">\n <px-icon name=\"information_fill\" from=\"lavender\" size=\"m\" color=\"brand\"></px-icon>\n <px-vstack gap=\"s\" grow=\"1\" class=\"status-card-content\">\n <px-vstack gap=\"xs\">\n <slot name=\"title\"></slot>\n <slot></slot>\n </px-vstack>\n <slot name=\"action\"></slot>\n </px-vstack>\n <slot name=\"close-button\"></slot>\n </px-hstack>\n </px-container>\n</div>", this.shadowRoot.innerHTML = this.template();
22
- }
23
- static get observedAttributes() {
24
- return [
25
- ...super.observedAttributes,
26
- "state",
27
- "inverted",
28
- "status-icon-aria-label",
29
- "background-color"
30
- ];
31
- }
32
- connectedCallback() {
33
- this.$closeButtonSlot.addEventListener("click", () => {
34
- this.close();
35
- });
36
- }
37
- attributeChangedCallback(e, t, n) {
38
- if (t !== n) switch (e) {
39
- case "state":
40
- this.updateState(n), this.$el.classList.toggle(`${n}`);
41
- break;
42
- case "inverted":
43
- for (let e = 0; e < this.$children.length; e++) this.$children[e].hasAttribute("inverted") || this.$children[e].toggleAttribute("inverted");
44
- this.$el.toggleAttribute("inverted", n !== null), this.$container.toggleAttribute("inverted", n !== null), this.$statusIcon.toggleAttribute("inverted", n !== null);
45
- break;
46
- case "status-icon-aria-label":
47
- this.statusIconAriaLabel ? this.$statusIcon.setAttribute("aria-label", this.statusIconAriaLabel) : this.$statusIcon.removeAttribute("aria-label");
48
- break;
49
- case "background-color":
50
- this.backgroundColor && this.updateBackgroundColor(n, a);
51
- break;
52
- default: super.attributeChangedCallback(e, t, n);
53
- }
54
- }
55
- updateBackgroundColor(e, n) {
56
- if (!this.checkName(n, e)) {
57
- t(`"${e}" is not a valid background-color value for ${this.tagName.toLowerCase()}.
58
- Allowed values are: "${n.join("\", \"")}".`);
59
- return;
60
- }
61
- e === null || e === "" ? this.$container.setAttribute("background-color", "container-default") : this.$container.setAttribute("background-color", e);
62
- }
63
- updateState(e) {
64
- if (!this.checkName(i, e)) {
65
- t(`"${e}" is not a valid state value for ${this.tagName.toLowerCase()}. Allowed values are: "${i.join("\", \"")}".`);
66
- return;
67
- }
68
- let n = {
69
- info: {
70
- name: "information_fill",
71
- color: "brand"
72
- },
73
- success: {
74
- name: "checkmark_fill",
75
- color: "purpose-success"
76
- },
77
- warning: {
78
- name: "exclamation_mark_fill",
79
- color: "purpose-warning"
80
- },
81
- error: {
82
- name: "minus_fill",
83
- color: "purpose-error"
84
- },
85
- ongoing: {
86
- name: "clock_fill",
87
- color: "purpose-warning"
88
- }
89
- }, { name: r, color: a } = n[e] || n.info;
90
- this.$statusIcon.name = r, this.$statusIcon.color = a;
91
- }
92
- close() {
93
- this.remove(), this.dispatchEvent(new CustomEvent(o, {
94
- bubbles: !0,
95
- composed: !0
96
- }));
97
- }
98
- get $closeButtonSlot() {
99
- return this.shadowRoot.querySelector("slot[name=\"close-button\"]");
100
- }
101
- get $statusIcon() {
102
- return this.shadowRoot.querySelector("px-icon");
103
- }
104
- get $container() {
105
- return this.shadowRoot.querySelector("px-container");
106
- }
107
- get $children() {
108
- return this.querySelectorAll("px-status-card > *");
109
- }
110
- get state() {
111
- return this.getAttribute("state");
112
- }
113
- set state(e) {
114
- this._updateAttribute("state", e);
115
- }
116
- get inverted() {
117
- return this.hasAttribute("inverted");
118
- }
119
- set inverted(e) {
120
- this._updateBooleanAttribute("inverted", e);
121
- }
122
- get statusIconAriaLabel() {
123
- return this.getAttribute("status-icon-aria-label");
124
- }
125
- set statusIconAriaLabel(e) {
126
- this._updateAttribute("status-icon-aria-label", e);
127
- }
128
- get backgroundColor() {
129
- return this.getAttribute("background-color");
130
- }
131
- set backgroundColor(e) {
132
- this._updateAttribute("background-color", e);
133
- }
1
+ import { PxElement as c, log as i } from "@proximus/lavender-common";
2
+ const d = ':host,:host>*{display:block;box-sizing:border-box}px-container{height:100%}.status-card{position:relative}.status-card:before{content:"";position:absolute;display:block;border-left:5px solid var(--px-color-border-brand-default);height:100%;left:0;top:0;border-radius:var(--px-radius-main) 0 0 var(--px-radius-main)}.status-card.success:before{border-color:var(--px-color-border-purpose-success-default)}.status-card.warning:before,.status-card.ongoing:before{border-color:var(--px-color-border-purpose-warning-default)}.status-card.error:before{border-color:var(--px-color-border-purpose-error-default)}::slotted([slot="title"]){display:block;font-size:var(--px-text-size-heading-s-mobile);font-weight:var(--px-font-weight-title);line-height:var(--px-line-height-ratio-l);color:var(--px-color-text-neutral-default)}:host([inverted]) .status-card:before{border-color:var(--px-color-border-brand-inverted)}:host([inverted]) .status-card.success:before{border-color:var(--px-color-border-purpose-success-inverted)}:host([inverted]) .status-card.warning:before,:host([inverted]) .status-card.ongoing:before{border-color:var(--px-color-border-purpose-warning-inverted)}:host([inverted]) .status-card.error:before{border-color:var(--px-color-border-purpose-error-inverted)}:host([inverted]) ::slotted([slot="title"]){color:var(--px-color-text-neutral-inverted)}@media screen and (min-width: 48rem){::slotted([slot="title"]){font-size:var(--px-text-size-heading-s-tablet)}}@media screen and (min-width: 64.0625rem){::slotted([slot="title"]){font-size:var(--px-text-size-heading-s-laptop)}}', l = new CSSStyleSheet();
3
+ l.replaceSync(d);
4
+ const n = [
5
+ "",
6
+ "info",
7
+ "success",
8
+ "warning",
9
+ "error",
10
+ "ongoing"
11
+ ], u = [
12
+ "",
13
+ "container-light",
14
+ "container-default"
15
+ ], b = "px.lavender.modal.close", a = class a extends c {
16
+ constructor() {
17
+ super(l), this.template = () => `<div class="status-card">
18
+ <px-container padding="s" background-color="container-default">
19
+ <px-hstack gap="s" align-items="flex-start">
20
+ <px-icon name="information_fill" from="lavender" size="l" color="brand"></px-icon>
21
+ <px-vstack gap="s" grow="1">
22
+ <px-vstack gap="xs">
23
+ <slot name="title"></slot>
24
+ <slot></slot>
25
+ </px-vstack>
26
+ <slot name="action"></slot>
27
+ </px-vstack>
28
+ <slot name="close-button"></slot>
29
+ </px-hstack>
30
+ </px-container>
31
+ </div>`, this.shadowRoot.innerHTML = this.template();
32
+ }
33
+ static get observedAttributes() {
34
+ return [
35
+ ...super.observedAttributes,
36
+ "state",
37
+ "inverted",
38
+ "status-icon-aria-label",
39
+ "background-color"
40
+ ];
41
+ }
42
+ connectedCallback() {
43
+ this.$closeButtonSlot.addEventListener("click", () => {
44
+ this.close();
45
+ });
46
+ }
47
+ attributeChangedCallback(t, r, e) {
48
+ if (r !== e)
49
+ switch (t) {
50
+ case "state":
51
+ this.updateState(e), this.$el.classList.toggle(`${e}`);
52
+ break;
53
+ case "inverted":
54
+ for (let o = 0; o < this.$children.length; o++)
55
+ this.$children[o].hasAttribute("inverted") || this.$children[o].toggleAttribute("inverted");
56
+ this.$el.toggleAttribute("inverted", e !== null), this.$container.toggleAttribute("inverted", e !== null), this.$statusIcon.toggleAttribute("inverted", e !== null);
57
+ break;
58
+ case "status-icon-aria-label":
59
+ this.statusIconAriaLabel ? this.$statusIcon.setAttribute(
60
+ "aria-label",
61
+ this.statusIconAriaLabel
62
+ ) : this.$statusIcon.removeAttribute("aria-label");
63
+ break;
64
+ case "background-color":
65
+ this.backgroundColor && this.updateBackgroundColor(
66
+ e,
67
+ u
68
+ );
69
+ break;
70
+ default:
71
+ super.attributeChangedCallback(t, r, e);
72
+ break;
73
+ }
74
+ }
75
+ updateBackgroundColor(t, r) {
76
+ if (!this.checkName(r, t)) {
77
+ i(
78
+ `"${t}" is not a valid background-color value for ${this.tagName.toLowerCase()}.
79
+ Allowed values are: "${r.join('", "')}".`
80
+ );
81
+ return;
82
+ }
83
+ t === null || t === "" ? this.$container.setAttribute("background-color", "container-default") : this.$container.setAttribute("background-color", t);
84
+ }
85
+ updateState(t) {
86
+ if (!this.checkName(n, t)) {
87
+ i(
88
+ `"${t}" is not a valid state value for ${this.tagName.toLowerCase()}. Allowed values are: "${n.join('", "')}".`
89
+ );
90
+ return;
91
+ }
92
+ const r = {
93
+ info: { name: "information_fill", color: "brand" },
94
+ success: { name: "checkmark_fill", color: "purpose-success" },
95
+ warning: { name: "exclamation_mark_fill", color: "purpose-warning" },
96
+ error: { name: "minus_fill", color: "purpose-error" },
97
+ ongoing: { name: "clock_fill", color: "purpose-warning" }
98
+ }, { name: e, color: o } = r[t] || r.info;
99
+ this.$statusIcon.name = e, this.$statusIcon.color = o;
100
+ }
101
+ close() {
102
+ this.remove(), this.dispatchEvent(
103
+ new CustomEvent(b, {
104
+ bubbles: !0,
105
+ composed: !0
106
+ })
107
+ );
108
+ }
109
+ get $closeButtonSlot() {
110
+ return this.shadowRoot.querySelector(
111
+ 'slot[name="close-button"]'
112
+ );
113
+ }
114
+ get $statusIcon() {
115
+ return this.shadowRoot.querySelector("px-icon");
116
+ }
117
+ get $container() {
118
+ return this.shadowRoot.querySelector("px-container");
119
+ }
120
+ get $children() {
121
+ return this.querySelectorAll("px-status-card > *");
122
+ }
123
+ get state() {
124
+ return this.getAttribute("state");
125
+ }
126
+ set state(t) {
127
+ this.setAttribute("state", t);
128
+ }
129
+ get inverted() {
130
+ return this.hasAttribute("inverted");
131
+ }
132
+ set inverted(t) {
133
+ t ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
134
+ }
135
+ get statusIconAriaLabel() {
136
+ return this.getAttribute("status-icon-aria-label");
137
+ }
138
+ set statusIconAriaLabel(t) {
139
+ t ? this.setAttribute("status-icon-aria-label", t) : this.removeAttribute("status-icon-aria-label");
140
+ }
141
+ get backgroundColor() {
142
+ return this.getAttribute("background-color");
143
+ }
144
+ set backgroundColor(t) {
145
+ t ? this.setAttribute("background-color", t) : this.removeAttribute("background-color");
146
+ }
134
147
  };
148
+ a.nativeName = "div";
149
+ let s = a;
135
150
  customElements.get("px-status-card") || customElements.define("px-status-card", s);
136
- //#endregion
137
- export { s as StatusCard, a as statusCardBackgroundColorValues, i as statusCardStateValues };
151
+ export {
152
+ s as StatusCard,
153
+ u as statusCardBackgroundColorValues,
154
+ n as statusCardStateValues
155
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-status-card",
3
- "version": "1.4.14-beta.3",
3
+ "version": "1.4.14",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",