@proximus/lavender-status 1.4.14-beta.2 → 1.4.15-alpha.2

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