@proximus/lavender-icon-common 1.4.10-beta.4 → 1.4.10
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/index.es.js +17 -18
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
var u = (o) => {
|
|
2
2
|
throw TypeError(o);
|
|
3
3
|
};
|
|
4
|
-
var p = (o,
|
|
5
|
-
var s = (o,
|
|
4
|
+
var p = (o, r, e) => r.has(o) || u("Cannot " + e);
|
|
5
|
+
var s = (o, r, e) => (p(o, r, "read from private field"), e ? e.call(o) : r.get(o)), a = (o, r, e) => r.has(o) ? u("Cannot add the same private member more than once") : r instanceof WeakSet ? r.add(o) : r.set(o, e), d = (o, r, e, t) => (p(o, r, "write to private field"), t ? t.call(o, e) : r.set(o, e), e);
|
|
6
6
|
import { WithExtraAttributes as m, iconSizeValuesKC as f, log as b } from "@proximus/lavender-common";
|
|
7
7
|
class g extends HTMLElement {
|
|
8
8
|
constructor() {
|
|
@@ -31,10 +31,10 @@ class g extends HTMLElement {
|
|
|
31
31
|
}
|
|
32
32
|
}
|
|
33
33
|
disconnectedCallback() {
|
|
34
|
-
const
|
|
34
|
+
const r = document.querySelector(
|
|
35
35
|
`style[data-name="${this.getAttribute("name")}"]`
|
|
36
36
|
);
|
|
37
|
-
|
|
37
|
+
r && r.remove();
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
customElements.get("px-icon-set") || customElements.define("px-icon-set", g);
|
|
@@ -79,17 +79,17 @@ class $ extends m {
|
|
|
79
79
|
"disabled"
|
|
80
80
|
];
|
|
81
81
|
}
|
|
82
|
-
attributeChangedCallback(e, t,
|
|
83
|
-
if (t !==
|
|
82
|
+
attributeChangedCallback(e, t, i) {
|
|
83
|
+
if (t !== i)
|
|
84
84
|
switch (e) {
|
|
85
85
|
case "name":
|
|
86
|
-
this.updateName(t,
|
|
86
|
+
this.updateName(t, i);
|
|
87
87
|
break;
|
|
88
88
|
case "size":
|
|
89
|
-
this.updateAttribute(e, t,
|
|
89
|
+
this.updateAttribute(e, t, i, f);
|
|
90
90
|
break;
|
|
91
91
|
case "color":
|
|
92
|
-
this.updateAttribute(e, t,
|
|
92
|
+
this.updateAttribute(e, t, i, A);
|
|
93
93
|
break;
|
|
94
94
|
case "disabled":
|
|
95
95
|
this.color = "state-disabled";
|
|
@@ -97,30 +97,29 @@ class $ extends m {
|
|
|
97
97
|
case "aria-label":
|
|
98
98
|
if (!s(this, n))
|
|
99
99
|
return;
|
|
100
|
-
|
|
100
|
+
i ? (s(this, n).ariaHidden = "false", this.ariaHidden = "false") : (s(this, n).ariaHidden = "true", this.ariaHidden = "true");
|
|
101
101
|
break;
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
connectedCallback() {
|
|
105
|
-
var t;
|
|
106
105
|
this.role = "img";
|
|
107
106
|
const e = document.querySelectorAll("px-icon-set");
|
|
108
107
|
e || console.log("<px-icon-set> component not found");
|
|
109
|
-
for (const
|
|
110
|
-
if (!
|
|
108
|
+
for (const t of e) {
|
|
109
|
+
if (!t.getAttribute("name") || !t.getAttribute("src")) {
|
|
111
110
|
console.error("Icon name or src not found");
|
|
112
111
|
continue;
|
|
113
112
|
}
|
|
114
|
-
|
|
113
|
+
t.getAttribute("name") === this.from && t.getAttribute("type") !== "font" && (d(this, c, t.getAttribute("src")), this.$el.firstElementChild.setAttribute(
|
|
115
114
|
"href",
|
|
116
115
|
`${s(this, c)}#icon-${this.name}`
|
|
117
116
|
));
|
|
118
117
|
}
|
|
119
|
-
!this.ariaLabel && s(this, n) && (s(this, n).ariaHidden = "true", this.ariaHidden = "true")
|
|
118
|
+
!this.ariaLabel && s(this, n) && (s(this, n).ariaHidden = "true", this.ariaHidden = "true");
|
|
120
119
|
}
|
|
121
|
-
updateAttribute(e, t,
|
|
122
|
-
t !== null && t !== "" && (e === "size" ? this.$el.classList.toggle(`${e}-${t}`) : this.$el.classList.toggle(t)),
|
|
123
|
-
`${
|
|
120
|
+
updateAttribute(e, t, i, v) {
|
|
121
|
+
t !== null && t !== "" && (e === "size" ? this.$el.classList.toggle(`${e}-${t}`) : this.$el.classList.toggle(t)), i !== null && i !== "" && (e === "size" ? this.$el.classList.toggle(`${e}-${i}`) : this.$el.classList.toggle(i)), this.checkName(v, i) || b(
|
|
122
|
+
`${i} is not an allowed ${e} value for ${this.tagName.toLowerCase()}`
|
|
124
123
|
);
|
|
125
124
|
}
|
|
126
125
|
updateName(e, t) {
|