@proximus/lavender-status-card 2.0.0-alpha.18 → 2.0.0-alpha.181
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/StatusCard.d.ts +8 -4
- package/dist/index.es.js +136 -121
- package/package.json +2 -2
package/dist/StatusCard.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ import { Container } from '@proximus/lavender-container';
|
|
|
3
3
|
import { Icon } from '@proximus/lavender-icon';
|
|
4
4
|
import { PxElement } from '@proximus/lavender-common';
|
|
5
5
|
export declare const statusCardStateValues: string[];
|
|
6
|
+
export declare const statusCardBackgroundColorValues: string[];
|
|
6
7
|
export declare class StatusCard extends PxElement<HTMLDivElement> {
|
|
7
8
|
static nativeName: string;
|
|
8
9
|
private template;
|
|
@@ -10,16 +11,19 @@ export declare class StatusCard extends PxElement<HTMLDivElement> {
|
|
|
10
11
|
static get observedAttributes(): string[];
|
|
11
12
|
connectedCallback(): void;
|
|
12
13
|
attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
|
|
14
|
+
updateBackgroundColor(newValue: string, allowedValues: string[]): void;
|
|
13
15
|
updateState(state: string): void;
|
|
14
16
|
close(): void;
|
|
15
17
|
get $closeButtonSlot(): ButtonIcon;
|
|
16
18
|
get $statusIcon(): Icon;
|
|
17
19
|
get $container(): Container;
|
|
18
20
|
get $children(): NodeListOf<Element>;
|
|
19
|
-
get state(): string;
|
|
20
|
-
set state(value: string);
|
|
21
|
+
get state(): string | null;
|
|
22
|
+
set state(value: string | null);
|
|
21
23
|
get inverted(): boolean;
|
|
22
24
|
set inverted(value: boolean);
|
|
23
|
-
get statusIconAriaLabel(): string;
|
|
24
|
-
set statusIconAriaLabel(value: string);
|
|
25
|
+
get statusIconAriaLabel(): string | null;
|
|
26
|
+
set statusIconAriaLabel(value: string | null);
|
|
27
|
+
get backgroundColor(): string | null;
|
|
28
|
+
set backgroundColor(value: string | null);
|
|
25
29
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -1,122 +1,137 @@
|
|
|
1
|
-
import { PxElement as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
</px-vstack>
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
}
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
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-desktop)}}@media screen and (width>=64.0625rem){::slotted([slot=title]){font-size:var(--px-text-size-heading-s-desktop)}}", 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
|
+
}
|
|
122
134
|
};
|
|
135
|
+
customElements.get("px-status-card") || customElements.define("px-status-card", s);
|
|
136
|
+
//#endregion
|
|
137
|
+
export { s as StatusCard, a as statusCardBackgroundColorValues, i as statusCardStateValues };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-status-card",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.181",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"clean": "rm -rf dist",
|
|
14
14
|
"build": "npm run clean && NODE_ENV=development vite build && tsc && npm run transform-package-json && npm run wc-manifest",
|
|
15
15
|
"test": "vitest run --coverage",
|
|
16
|
-
"wc-manifest": "cem analyze --globs \"src/*\" --config
|
|
16
|
+
"wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|