@proximus/lavender-icon-common 2.0.0-alpha.5 → 2.0.0-alpha.50
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 +27 -21
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -3,8 +3,8 @@ var u = (r) => {
|
|
|
3
3
|
};
|
|
4
4
|
var p = (r, o, e) => o.has(r) || u("Cannot " + e);
|
|
5
5
|
var s = (r, o, e) => (p(r, o, "read from private field"), e ? e.call(r) : o.get(r)), a = (r, o, e) => o.has(r) ? u("Cannot add the same private member more than once") : o instanceof WeakSet ? o.add(r) : o.set(r, e), d = (r, o, e, t) => (p(r, o, "write to private field"), t ? t.call(r, e) : o.set(r, e), e);
|
|
6
|
-
import { WithExtraAttributes as m, iconSizeValuesKC as b } from "@proximus/lavender-common";
|
|
7
|
-
class
|
|
6
|
+
import { WithExtraAttributes as m, iconSizeValuesKC as f, log as b } from "@proximus/lavender-common";
|
|
7
|
+
class g extends HTMLElement {
|
|
8
8
|
constructor() {
|
|
9
9
|
super();
|
|
10
10
|
}
|
|
@@ -37,8 +37,8 @@ class f extends HTMLElement {
|
|
|
37
37
|
o && o.remove();
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
customElements.get("px-icon-set") || customElements.define("px-icon-set",
|
|
41
|
-
const
|
|
40
|
+
customElements.get("px-icon-set") || customElements.define("px-icon-set", g);
|
|
41
|
+
const x = [
|
|
42
42
|
"Brand",
|
|
43
43
|
"Accent",
|
|
44
44
|
"Neutral",
|
|
@@ -51,11 +51,11 @@ const g = [
|
|
|
51
51
|
"StateHover",
|
|
52
52
|
"StateActive",
|
|
53
53
|
"StateDisabled"
|
|
54
|
-
],
|
|
54
|
+
], A = ["Inherit", ...x].map(
|
|
55
55
|
(r) => r.replace(/([A-Z])/g, "-$1").toLowerCase().slice(1)
|
|
56
|
-
),
|
|
57
|
-
h.replaceSync(
|
|
58
|
-
const
|
|
56
|
+
), z = ":host{display:inline-flex;flex-direction:column;justify-content:center}svg{font-size:var(--px-size-icon-s);line-height:var(--px-font-line-height-xs);width:1em;height:1em;color:var(--px-color-icon-accent-default)}.inherit{color:inherit}.brand{color:var(--px-color-icon-brand-default)}.accent{color:var(--px-color-icon-accent-default)}.neutral{color:var(--px-color-icon-neutral-default)}.dimmed{color:var(--px-color-icon-dimmed-default)}.purpose-success{color:var(--px-color-icon-purpose-success-default)}.purpose-warning{color:var(--px-color-icon-purpose-warning-default)}.purpose-error{color:var(--px-color-icon-purpose-error-default)}.purpose-unlimited{color:var(--px-color-icon-purpose-unlimited-default)}.purpose-promo{color:var(--px-color-icon-purpose-promo-default)}.state-hover:hover{color:var(--px-color-icon-state-hover-default)}.state-active:active{color:var(--px-color-icon-state-active-default)}.state-disabled{color:var(--px-color-icon-state-disabled-default)}:host([inverted]) svg{color:var(--px-color-icon-accent-inverted)}:host([inverted]) .inherit{color:inherit}:host([inverted]) .brand{color:var(--px-color-icon-brand-inverted)}:host([inverted]) .accent{color:var(--px-color-icon-accent-inverted)}:host([inverted]) .neutral{color:var(--px-color-icon-neutral-inverted)}:host([inverted]) .dimmed{color:var(--px-color-icon-dimmed-inverted)}:host([inverted]) .purpose-success{color:var(--px-color-icon-purpose-success-inverted)}:host([inverted]) .purpose-warning{color:var(--px-color-icon-purpose-warning-inverted)}:host([inverted]) .purpose-error{color:var(--px-color-icon-purpose-error-inverted)}:host([inverted]) .purpose-unlimited{color:var(--px-color-icon-purpose-unlimited-inverted)}:host([inverted]) .purpose-promo{color:var(--px-color-icon-purpose-promo-inverted)}:host([inverted]) .state-hover:hover{color:var(--px-color-icon-state-hover-inverted)}:host([inverted]) .state-active:active{color:var(--px-color-icon-state-active-inverted)}:host([inverted]) .state-disabled{color:var(--px-color-icon-state-disabled-inverted)}.size-xs{font-size:var(--px-size-icon-xs)}.size-s{font-size:var(--px-size-icon-s)}.size-m{font-size:var(--px-size-icon-m)}.size-l{font-size:var(--px-size-icon-l)}.size-xl{font-size:var(--px-size-icon-xl)}", h = new CSSStyleSheet();
|
|
57
|
+
h.replaceSync(z);
|
|
58
|
+
const $ = [
|
|
59
59
|
"name",
|
|
60
60
|
"size",
|
|
61
61
|
"color",
|
|
@@ -65,19 +65,19 @@ const z = [
|
|
|
65
65
|
"disabled"
|
|
66
66
|
];
|
|
67
67
|
var c, n, l;
|
|
68
|
-
class
|
|
68
|
+
class y extends m {
|
|
69
69
|
constructor(...e) {
|
|
70
70
|
var t;
|
|
71
71
|
super(...e, h);
|
|
72
72
|
a(this, c);
|
|
73
73
|
a(this, n);
|
|
74
74
|
a(this, l, () => `<svg aria-hidden="true">
|
|
75
|
-
<use xlink:href="
|
|
75
|
+
<use xlink:href=""></use>
|
|
76
76
|
</svg>`);
|
|
77
|
-
this.shadowRoot.innerHTML = s(this, l).call(this),
|
|
77
|
+
this.shadowRoot.innerHTML = s(this, l).call(this), d(this, n, (t = this.attachInternals) == null ? void 0 : t.call(this)), s(this, n) && (s(this, n).role = "img");
|
|
78
78
|
}
|
|
79
79
|
static get observedAttributes() {
|
|
80
|
-
return [...super.observedAttributes,
|
|
80
|
+
return [...super.observedAttributes, ...$];
|
|
81
81
|
}
|
|
82
82
|
attributeChangedCallback(e, t, i) {
|
|
83
83
|
if (t !== i)
|
|
@@ -86,10 +86,10 @@ class $ extends m {
|
|
|
86
86
|
this.updateName(t, i);
|
|
87
87
|
break;
|
|
88
88
|
case "size":
|
|
89
|
-
this.updateAttribute(e, t, i,
|
|
89
|
+
this.updateAttribute(e, t, i, f);
|
|
90
90
|
break;
|
|
91
91
|
case "color":
|
|
92
|
-
this.updateAttribute(e, t, i,
|
|
92
|
+
this.updateAttribute(e, t, i, A);
|
|
93
93
|
break;
|
|
94
94
|
case "disabled":
|
|
95
95
|
this.color = "state-disabled";
|
|
@@ -102,6 +102,10 @@ class $ extends m {
|
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
connectedCallback() {
|
|
105
|
+
this.role = "img", this.name && this.$el.firstElementChild.setAttribute(
|
|
106
|
+
"xlink:href",
|
|
107
|
+
`#icon-${this.name}`
|
|
108
|
+
);
|
|
105
109
|
const e = document.querySelectorAll("px-icon-set");
|
|
106
110
|
e || console.log("<px-icon-set> component not found");
|
|
107
111
|
for (const t of e) {
|
|
@@ -117,7 +121,9 @@ class $ extends m {
|
|
|
117
121
|
!this.ariaLabel && s(this, n) && (s(this, n).ariaHidden = "true", this.ariaHidden = "true");
|
|
118
122
|
}
|
|
119
123
|
updateAttribute(e, t, i, v) {
|
|
120
|
-
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) ||
|
|
124
|
+
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(
|
|
125
|
+
`${i} is not an allowed ${e} value for ${this.tagName.toLowerCase()}`
|
|
126
|
+
);
|
|
121
127
|
}
|
|
122
128
|
updateName(e, t) {
|
|
123
129
|
s(this, c) && this.$el.firstElementChild.setAttribute(
|
|
@@ -172,12 +178,12 @@ class $ extends m {
|
|
|
172
178
|
}
|
|
173
179
|
}
|
|
174
180
|
c = new WeakMap(), n = new WeakMap(), l = new WeakMap();
|
|
175
|
-
customElements.get("px-icon") || customElements.define("px-icon",
|
|
181
|
+
customElements.get("px-icon") || customElements.define("px-icon", y);
|
|
176
182
|
export {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
183
|
+
y as Icon,
|
|
184
|
+
g as IconSet,
|
|
185
|
+
x as iconColorValues,
|
|
186
|
+
A as iconColorValuesKC,
|
|
187
|
+
$ as observedAttributes,
|
|
182
188
|
h as styleSheet
|
|
183
189
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@proximus/lavender-icon-common",
|
|
3
|
-
"version": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.50",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "dist/index.es.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"build": "npm run clean && vite build && npm run transform-package-json && npm run wc-manifest",
|
|
14
14
|
"test": "vitest run --coverage",
|
|
15
15
|
"transform-package-json": "node ../../../../scripts/tranformPackageJson.js package.json dist/far/away",
|
|
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"
|