@proximus/lavender-status 2.0.0-alpha.2 → 2.0.0-alpha.20

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.
Files changed (2) hide show
  1. package/dist/index.es.js +25 -25
  2. package/package.json +1 -1
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
- import { PxElement as n } from "@proximus/lavender-common";
2
- const a = ":host,:host>*{display:block;box-sizing:border-box}.status{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);color:var(--px-color-text-brand-default)}.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 only screen and (min-width: 768px){.status{font-size:var(--px-text-size-label-m-desktop)}}@media only screen and (min-width: 1025px){.status{font-size:var(--px-text-size-label-m-desktop)}}", l = new CSSStyleSheet();
3
- l.replaceSync(a);
4
- const c = [
1
+ import { PxElement as n, log as a } from "@proximus/lavender-common";
2
+ const c = ':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 only screen and (min-width: 768px){.status ::slotted([slot="label"]){font-size:var(--px-text-size-label-m-desktop)}}@media only screen and (min-width: 1025px){.status ::slotted([slot="label"]){font-size:var(--px-text-size-label-m-desktop)}}', r = new CSSStyleSheet();
3
+ r.replaceSync(c);
4
+ const u = [
5
5
  "",
6
6
  "info",
7
7
  "success",
@@ -9,17 +9,15 @@ const c = [
9
9
  "error",
10
10
  "ongoing",
11
11
  "unlimited"
12
- ], r = class r extends n {
12
+ ], l = class l extends n {
13
13
  constructor() {
14
- super(l), this.template = () => `
14
+ super(r), this.template = () => `
15
15
  <div class="status">
16
16
  <px-hstack gap="2xs" align-items="flex-start">
17
- <px-icon name="information_fill" from="lavender" size="m" color="brand"></px-icon>
17
+ <px-icon name="information_fill" from="lavender" size="s" color="brand"></px-icon>
18
18
  <slot name="label"></slot>
19
19
  </px-hstack>
20
- </div>`, this.shadowRoot.innerHTML = this.template(), (!this.$label || !this.iconAriaLabel) && console.warn(
21
- 'Label slot and icon aria-label slot are mandatory even with icon-only case. For accessibility the label slot will only be red by screen readers if the component is set to "icon-only".'
22
- );
20
+ </div>`, this.shadowRoot.innerHTML = this.template();
23
21
  }
24
22
  static get observedAttributes() {
25
23
  return [
@@ -33,8 +31,8 @@ const c = [
33
31
  "icon-aria-label"
34
32
  ];
35
33
  }
36
- attributeChangedCallback(t, i, e) {
37
- if (i !== e)
34
+ attributeChangedCallback(t, s, e) {
35
+ if (s !== e)
38
36
  switch (t) {
39
37
  case "state":
40
38
  this.updateState(e), this.$el.classList.toggle(`${e}`);
@@ -58,34 +56,36 @@ const c = [
58
56
  this.$el.toggleAttribute("disabled", e !== null), this.$statusIcon.color = "state-disabled";
59
57
  break;
60
58
  case "inverted":
61
- for (let s = 0; s < this.$children.length; s++)
62
- this.$children[s].hasAttribute("inverted") || this.$children[s].toggleAttribute("inverted");
59
+ for (let i = 0; i < this.$children.length; i++)
60
+ this.$children[i].hasAttribute("inverted") || this.$children[i].toggleAttribute("inverted");
63
61
  this.$el.toggleAttribute("inverted", e !== null), this.$statusIcon.toggleAttribute("inverted", e !== null);
64
62
  break;
65
63
  default:
66
- super.attributeChangedCallback(t, i, e);
64
+ super.attributeChangedCallback(t, s, e);
67
65
  break;
68
66
  }
69
67
  }
70
68
  updateState(t) {
71
- if (!this.checkName(c, t)) {
72
- console.error(`${t} is not a valid state value`);
69
+ if (!this.checkName(u, t)) {
70
+ a(
71
+ `${t} is not an allowed state value for ${this.tagName.toLowerCase()}`
72
+ );
73
73
  return;
74
74
  }
75
- const i = {
75
+ const s = {
76
76
  info: { name: "information_fill", color: "brand" },
77
77
  success: { name: "checkmark_fill", color: "purpose-success" },
78
78
  warning: { name: "exclamation_mark_fill", color: "purpose-warning" },
79
79
  error: { name: "minus_fill", color: "purpose-error" },
80
80
  ongoing: { name: "clock_fill", color: "purpose-warning" },
81
81
  unlimited: { name: "infinity_fill", color: "purpose-unlimited" }
82
- }, { name: e, color: s } = i[t] || i.info;
83
- this.$statusIcon.name = e, this.$statusIcon.color = s;
82
+ }, { name: e, color: i } = s[t] || s.info;
83
+ this.$statusIcon.name = e, this.$statusIcon.color = i;
84
84
  }
85
85
  updateIconOnly(t) {
86
86
  var e;
87
- const i = t ? `--${t}` : "";
88
- this.$label.setAttribute(`shown--sr${i}`, ""), (t === "laptop" || t === null) && this.$statusIcon.setAttribute(
87
+ const s = t ? `--${t}` : "";
88
+ this.$label.setAttribute(`shown--sr${s}`, ""), (t === "laptop" || t === null) && this.$statusIcon.setAttribute(
89
89
  "title",
90
90
  ((e = this.$label.textContent) == null ? void 0 : e.trim()) || ""
91
91
  );
@@ -148,10 +148,10 @@ const c = [
148
148
  t ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
149
149
  }
150
150
  };
151
- r.nativeName = "div";
152
- let o = r;
151
+ l.nativeName = "div";
152
+ let o = l;
153
153
  customElements.get("px-status") || customElements.define("px-status", o);
154
154
  export {
155
155
  o as Status,
156
- c as statusStateValues
156
+ u as statusStateValues
157
157
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-status",
3
- "version": "2.0.0-alpha.2",
3
+ "version": "2.0.0-alpha.20",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",