@proximus/lavender-status-card 2.0.0-alpha.20 → 2.0.0-alpha.201

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.
@@ -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
  }
@@ -0,0 +1,209 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/StatusCard.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "statusCardStateValues",
12
+ "type": {
13
+ "text": "array"
14
+ },
15
+ "default": "[ '', 'info', 'success', 'warning', 'error', 'ongoing', ]"
16
+ },
17
+ {
18
+ "kind": "variable",
19
+ "name": "statusCardBackgroundColorValues",
20
+ "type": {
21
+ "text": "array"
22
+ },
23
+ "default": "[ '', 'container-light', 'container-default', ]"
24
+ },
25
+ {
26
+ "kind": "class",
27
+ "description": "",
28
+ "name": "StatusCard",
29
+ "members": [
30
+ {
31
+ "kind": "field",
32
+ "name": "nativeName",
33
+ "type": {
34
+ "text": "string"
35
+ },
36
+ "static": true,
37
+ "default": "'div'"
38
+ },
39
+ {
40
+ "kind": "field",
41
+ "name": "template",
42
+ "privacy": "private"
43
+ },
44
+ {
45
+ "kind": "method",
46
+ "name": "updateBackgroundColor",
47
+ "parameters": [
48
+ {
49
+ "name": "newValue",
50
+ "type": {
51
+ "text": "string"
52
+ }
53
+ },
54
+ {
55
+ "name": "allowedValues",
56
+ "type": {
57
+ "text": "string[]"
58
+ }
59
+ }
60
+ ]
61
+ },
62
+ {
63
+ "kind": "method",
64
+ "name": "updateState",
65
+ "parameters": [
66
+ {
67
+ "name": "state",
68
+ "type": {
69
+ "text": "string"
70
+ }
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "kind": "method",
76
+ "name": "close"
77
+ },
78
+ {
79
+ "kind": "field",
80
+ "name": "$closeButtonSlot",
81
+ "readonly": true
82
+ },
83
+ {
84
+ "kind": "field",
85
+ "name": "$statusIcon",
86
+ "readonly": true
87
+ },
88
+ {
89
+ "kind": "field",
90
+ "name": "$container",
91
+ "readonly": true
92
+ },
93
+ {
94
+ "kind": "field",
95
+ "name": "$children",
96
+ "readonly": true
97
+ },
98
+ {
99
+ "kind": "field",
100
+ "name": "state"
101
+ },
102
+ {
103
+ "kind": "field",
104
+ "name": "inverted"
105
+ },
106
+ {
107
+ "kind": "field",
108
+ "name": "statusIconAriaLabel"
109
+ },
110
+ {
111
+ "kind": "field",
112
+ "name": "backgroundColor",
113
+ "type": {
114
+ "text": "string | null"
115
+ }
116
+ },
117
+ {
118
+ "kind": "field",
119
+ "name": "innerHTML"
120
+ }
121
+ ],
122
+ "events": [
123
+ {
124
+ "name": "CLOSE_EVENT",
125
+ "type": {
126
+ "text": "CustomEvent"
127
+ }
128
+ }
129
+ ],
130
+ "attributes": [
131
+ {
132
+ "name": "state"
133
+ },
134
+ {
135
+ "name": "inverted"
136
+ },
137
+ {
138
+ "name": "status-icon-aria-label"
139
+ },
140
+ {
141
+ "name": "background-color"
142
+ }
143
+ ],
144
+ "superclass": {
145
+ "name": "PxElement",
146
+ "package": "@proximus/lavender-common"
147
+ },
148
+ "tagName": "px-status-card",
149
+ "customElement": true
150
+ }
151
+ ],
152
+ "exports": [
153
+ {
154
+ "kind": "js",
155
+ "name": "statusCardStateValues",
156
+ "declaration": {
157
+ "name": "statusCardStateValues",
158
+ "module": "src/StatusCard.ts"
159
+ }
160
+ },
161
+ {
162
+ "kind": "js",
163
+ "name": "statusCardBackgroundColorValues",
164
+ "declaration": {
165
+ "name": "statusCardBackgroundColorValues",
166
+ "module": "src/StatusCard.ts"
167
+ }
168
+ },
169
+ {
170
+ "kind": "js",
171
+ "name": "StatusCard",
172
+ "declaration": {
173
+ "name": "StatusCard",
174
+ "module": "src/StatusCard.ts"
175
+ }
176
+ },
177
+ {
178
+ "kind": "custom-element-definition",
179
+ "name": "px-status-card",
180
+ "declaration": {
181
+ "name": "StatusCard",
182
+ "module": "src/StatusCard.ts"
183
+ }
184
+ }
185
+ ]
186
+ },
187
+ {
188
+ "kind": "javascript-module",
189
+ "path": "src/index.ts",
190
+ "declarations": [],
191
+ "exports": [
192
+ {
193
+ "kind": "js",
194
+ "name": "*",
195
+ "declaration": {
196
+ "name": "*",
197
+ "module": "src/StatusCard"
198
+ }
199
+ }
200
+ ]
201
+ },
202
+ {
203
+ "kind": "javascript-module",
204
+ "path": "src/statuscard.css",
205
+ "declarations": [],
206
+ "exports": []
207
+ }
208
+ ]
209
+ }
package/dist/index.es.js CHANGED
@@ -1,122 +1,137 @@
1
- import { PxElement as n, log as l } from "@proximus/lavender-common";
2
- const c = ':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 only screen and (min-width: 768px){::slotted([slot="title"]){font-size:var(--px-text-size-heading-s-desktop)}}@media only screen and (min-width: 1025px){::slotted([slot="title"]){font-size:var(--px-text-size-heading-s-desktop)}}', i = new CSSStyleSheet();
3
- i.replaceSync(c);
4
- const d = [
5
- "",
6
- "info",
7
- "success",
8
- "warning",
9
- "error",
10
- "ongoing"
11
- ], u = "px.lavender.modal.close", a = class a extends n {
12
- constructor() {
13
- super(i), this.template = () => `<div class="status-card">
14
- <px-container background-color="container-default" padding="s">
15
- <px-hstack gap="s" align-items="flex-start">
16
- <px-icon name="information_fill" from="lavender" size="l" color="brand"></px-icon>
17
- <px-vstack gap="s" grow="1">
18
- <px-vstack gap="xs">
19
- <slot name="title"></slot>
20
- <slot></slot>
21
- </px-vstack>
22
- <slot name="action"></slot>
23
- </px-vstack>
24
- <slot name="close-button"></slot>
25
- </px-hstack>
26
- </px-container>
27
- </div>`, this.shadowRoot.innerHTML = this.template();
28
- }
29
- static get observedAttributes() {
30
- return ["state", "inverted", "status-icon-aria-label"];
31
- }
32
- connectedCallback() {
33
- this.$closeButtonSlot.addEventListener("click", () => {
34
- this.close();
35
- });
36
- }
37
- attributeChangedCallback(t, s, e) {
38
- if (s !== e)
39
- switch (t) {
40
- case "state":
41
- this.updateState(e), this.$el.classList.toggle(`${e}`);
42
- break;
43
- case "inverted":
44
- for (let r = 0; r < this.$children.length; r++)
45
- this.$children[r].hasAttribute("inverted") || this.$children[r].toggleAttribute("inverted");
46
- this.$el.toggleAttribute("inverted", e !== null), this.$container.toggleAttribute("inverted", e !== null), this.$statusIcon.toggleAttribute("inverted", e !== null);
47
- break;
48
- case "status-icon-aria-label":
49
- this.statusIconAriaLabel ? this.$statusIcon.setAttribute(
50
- "aria-label",
51
- this.statusIconAriaLabel
52
- ) : this.$statusIcon.removeAttribute("aria-label");
53
- break;
54
- default:
55
- super.attributeChangedCallback(t, s, e);
56
- break;
57
- }
58
- }
59
- updateState(t) {
60
- if (!this.checkName(d, t)) {
61
- l(
62
- `${t} is not an allowed state value for ${this.tagName.toLowerCase()}`
63
- );
64
- return;
65
- }
66
- const s = {
67
- info: { name: "information_fill", color: "brand" },
68
- success: { name: "checkmark_fill", color: "purpose-success" },
69
- warning: { name: "exclamation_mark_fill", color: "purpose-warning" },
70
- error: { name: "minus_fill", color: "purpose-error" },
71
- ongoing: { name: "clock_fill", color: "purpose-warning" }
72
- }, { name: e, color: r } = s[t] || s.info;
73
- this.$statusIcon.name = e, this.$statusIcon.color = r;
74
- }
75
- close() {
76
- this.remove(), this.dispatchEvent(
77
- new CustomEvent(u, {
78
- bubbles: !0,
79
- composed: !0
80
- })
81
- );
82
- }
83
- get $closeButtonSlot() {
84
- return this.shadowRoot.querySelector(
85
- 'slot[name="close-button"]'
86
- );
87
- }
88
- get $statusIcon() {
89
- return this.shadowRoot.querySelector("px-icon");
90
- }
91
- get $container() {
92
- return this.shadowRoot.querySelector("px-container");
93
- }
94
- get $children() {
95
- return this.querySelectorAll("px-status-card > *");
96
- }
97
- get state() {
98
- return this.getAttribute("state");
99
- }
100
- set state(t) {
101
- this.setAttribute("state", t);
102
- }
103
- get inverted() {
104
- return this.hasAttribute("inverted");
105
- }
106
- set inverted(t) {
107
- t ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
108
- }
109
- get statusIconAriaLabel() {
110
- return this.getAttribute("status-icon-aria-label");
111
- }
112
- set statusIconAriaLabel(t) {
113
- t ? this.setAttribute("status-icon-aria-label", t) : this.removeAttribute("status-icon-aria-label");
114
- }
115
- };
116
- a.nativeName = "div";
117
- let o = a;
118
- customElements.get("px-status-card") || customElements.define("px-status-card", o);
119
- export {
120
- o as StatusCard,
121
- d as statusCardStateValues
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 };
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "properties": [],
5
+ "pseudoElements": []
6
+ }
@@ -0,0 +1,17 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "tags": [
5
+ {
6
+ "name": "px-status-card",
7
+ "description": "\n---\n\n\n### **Events:**\n - **CLOSE_EVENT**",
8
+ "attributes": [
9
+ { "name": "state", "values": [] },
10
+ { "name": "inverted", "values": [] },
11
+ { "name": "status-icon-aria-label", "values": [] },
12
+ { "name": "background-color", "values": [] }
13
+ ],
14
+ "references": []
15
+ }
16
+ ]
17
+ }
@@ -0,0 +1,42 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
+ "name": "@proximus/lavender-status-card",
4
+ "version": "2.0.0-alpha.201",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "px-status-card",
11
+ "description": "\n---\n\n\n### **Events:**\n - **CLOSE_EVENT**",
12
+ "doc-url": "",
13
+ "attributes": [
14
+ { "name": "state", "value": { "type": "string" } },
15
+ { "name": "inverted", "value": { "type": "string" } },
16
+ { "name": "status-icon-aria-label", "value": { "type": "string" } },
17
+ { "name": "background-color", "value": { "type": "string" } }
18
+ ],
19
+ "events": [{ "name": "CLOSE_EVENT", "type": "CustomEvent" }],
20
+ "js": {
21
+ "properties": [
22
+ { "name": "$closeButtonSlot" },
23
+ { "name": "$statusIcon" },
24
+ { "name": "$container" },
25
+ { "name": "$children" },
26
+ { "name": "state" },
27
+ { "name": "inverted" },
28
+ { "name": "statusIconAriaLabel" },
29
+ { "name": "backgroundColor", "type": "string | null" },
30
+ { "name": "innerHTML" }
31
+ ],
32
+ "events": [{ "name": "CLOSE_EVENT", "type": "CustomEvent" }]
33
+ }
34
+ }
35
+ ]
36
+ },
37
+ "css": {
38
+ "properties": [],
39
+ "pseudo-elements": []
40
+ }
41
+ }
42
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-status-card",
3
- "version": "2.0.0-alpha.20",
3
+ "version": "2.0.0-alpha.201",
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 ../custom-elements-manifest.config.js --outdir dist"
16
+ "wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
17
17
  },
18
18
  "publishConfig": {
19
19
  "access": "public"