@proximus/lavender-icon 2.0.0-alpha.2 → 2.0.0-alpha.200
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/glyphmap.json +404 -343
- package/dist/iconNames.d.ts +1 -1
- package/dist/iconNames.js +1 -1
- package/dist/icons.svg +1 -1
- package/dist/index.es.js +1 -183
- package/dist/lavender.svg +1224 -0
- package/dist/lavender.ttf +0 -0
- package/dist/lavenderIconmap.js +404 -343
- package/package.json +5 -8
- package/dist/Icon.d.ts +0 -27
- package/dist/IconSet.d.ts +0 -6
- package/dist/attributeValues.d.ts +0 -3
- package/dist/index.d.ts +0 -3
package/dist/index.es.js
CHANGED
|
@@ -1,183 +1 @@
|
|
|
1
|
-
|
|
2
|
-
throw TypeError(o);
|
|
3
|
-
};
|
|
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
|
-
import { WithExtraAttributes as m, iconSizeValuesKC as b } from "@proximus/lavender-common";
|
|
7
|
-
class f extends HTMLElement {
|
|
8
|
-
constructor() {
|
|
9
|
-
super();
|
|
10
|
-
}
|
|
11
|
-
static get observedAttributes() {
|
|
12
|
-
return ["name", "src", "type", "format"];
|
|
13
|
-
}
|
|
14
|
-
connectedCallback() {
|
|
15
|
-
if (document.querySelectorAll(
|
|
16
|
-
`px-icon-set[name="${this.getAttribute("name")}"]`
|
|
17
|
-
).length > 1 && (console.warn(
|
|
18
|
-
"Only one <px-icon-set> component is allowed, self removing"
|
|
19
|
-
), this.remove()), this.getAttribute("type") === "font") {
|
|
20
|
-
const e = document.createElement("style");
|
|
21
|
-
e.setAttribute("type", "text/css"), e.setAttribute("data-name", this.getAttribute("name")), e.textContent = `
|
|
22
|
-
@font-face {
|
|
23
|
-
font-family: 'lavender';
|
|
24
|
-
src:
|
|
25
|
-
url('${this.getAttribute("src")}') format(${this.getAttribute("format")}),
|
|
26
|
-
font-weight: normal;
|
|
27
|
-
font-style: normal;
|
|
28
|
-
font-display: block;
|
|
29
|
-
}
|
|
30
|
-
`, document.head.appendChild(e);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
disconnectedCallback() {
|
|
34
|
-
const r = document.querySelector(
|
|
35
|
-
`style[data-name="${this.getAttribute("name")}"]`
|
|
36
|
-
);
|
|
37
|
-
r && r.remove();
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
customElements.get("px-icon-set") || customElements.define("px-icon-set", f);
|
|
41
|
-
const g = [
|
|
42
|
-
"Brand",
|
|
43
|
-
"Accent",
|
|
44
|
-
"Neutral",
|
|
45
|
-
"Dimmed",
|
|
46
|
-
"PurposeSuccess",
|
|
47
|
-
"PurposeWarning",
|
|
48
|
-
"PurposeError",
|
|
49
|
-
"PurposeUnlimited",
|
|
50
|
-
"PurposePromo",
|
|
51
|
-
"StateHover",
|
|
52
|
-
"StateActive",
|
|
53
|
-
"StateDisabled"
|
|
54
|
-
], x = ["Inherit", ...g].map(
|
|
55
|
-
(o) => o.replace(/([A-Z])/g, "-$1").toLowerCase().slice(1)
|
|
56
|
-
), A = ":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-brand-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-brand-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(A);
|
|
58
|
-
const z = [
|
|
59
|
-
"name",
|
|
60
|
-
"size",
|
|
61
|
-
"color",
|
|
62
|
-
"aria-label",
|
|
63
|
-
"inverted",
|
|
64
|
-
"from",
|
|
65
|
-
"disabled"
|
|
66
|
-
];
|
|
67
|
-
var c, n, l;
|
|
68
|
-
class $ extends m {
|
|
69
|
-
constructor(...e) {
|
|
70
|
-
var t;
|
|
71
|
-
super(...e, h);
|
|
72
|
-
a(this, c);
|
|
73
|
-
a(this, n);
|
|
74
|
-
a(this, l, () => `<svg aria-hidden="true">
|
|
75
|
-
<use xlink:href="#icon-${this.name}"></use>
|
|
76
|
-
</svg>`);
|
|
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
|
-
}
|
|
79
|
-
static get observedAttributes() {
|
|
80
|
-
return [...super.observedAttributes, ...z];
|
|
81
|
-
}
|
|
82
|
-
attributeChangedCallback(e, t, i) {
|
|
83
|
-
if (t !== i)
|
|
84
|
-
switch (e) {
|
|
85
|
-
case "name":
|
|
86
|
-
this.updateName(t, i);
|
|
87
|
-
break;
|
|
88
|
-
case "size":
|
|
89
|
-
this.updateAttribute(e, t, i, b);
|
|
90
|
-
break;
|
|
91
|
-
case "color":
|
|
92
|
-
this.updateAttribute(e, t, i, x);
|
|
93
|
-
break;
|
|
94
|
-
case "disabled":
|
|
95
|
-
this.color = "state-disabled";
|
|
96
|
-
break;
|
|
97
|
-
case "aria-label":
|
|
98
|
-
if (!s(this, n))
|
|
99
|
-
return;
|
|
100
|
-
i ? s(this, n).ariaHidden = "false" : s(this, n).ariaHidden = "true";
|
|
101
|
-
break;
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
connectedCallback() {
|
|
105
|
-
const e = document.querySelectorAll("px-icon-set");
|
|
106
|
-
e || console.log("<px-icon-set> component not found");
|
|
107
|
-
for (const t of e) {
|
|
108
|
-
if (!t.getAttribute("name") || !t.getAttribute("src")) {
|
|
109
|
-
console.error("Icon name or src not found");
|
|
110
|
-
continue;
|
|
111
|
-
}
|
|
112
|
-
t.getAttribute("name") === this.from && t.getAttribute("type") !== "font" && (d(this, c, t.getAttribute("src")), this.$el.firstElementChild.setAttribute(
|
|
113
|
-
"xlink:href",
|
|
114
|
-
`${s(this, c)}#icon-${this.name}`
|
|
115
|
-
));
|
|
116
|
-
}
|
|
117
|
-
!this.ariaLabel && s(this, n) && (s(this, n).ariaHidden = "true");
|
|
118
|
-
}
|
|
119
|
-
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) || console.error(`${i} is not an allowed ${e} value`);
|
|
121
|
-
}
|
|
122
|
-
updateName(e, t) {
|
|
123
|
-
s(this, c) && this.$el.firstElementChild.setAttribute(
|
|
124
|
-
"xlink:href",
|
|
125
|
-
`${s(this, c)}#icon-${t}`
|
|
126
|
-
);
|
|
127
|
-
}
|
|
128
|
-
get $el() {
|
|
129
|
-
return this.shadowRoot.querySelector("svg");
|
|
130
|
-
}
|
|
131
|
-
get name() {
|
|
132
|
-
return this.getAttribute("name");
|
|
133
|
-
}
|
|
134
|
-
set name(e) {
|
|
135
|
-
this.setAttribute("name", e);
|
|
136
|
-
}
|
|
137
|
-
get size() {
|
|
138
|
-
return this.getAttribute("size");
|
|
139
|
-
}
|
|
140
|
-
set size(e) {
|
|
141
|
-
this.setAttribute("size", e);
|
|
142
|
-
}
|
|
143
|
-
get color() {
|
|
144
|
-
return this.getAttribute("color");
|
|
145
|
-
}
|
|
146
|
-
set color(e) {
|
|
147
|
-
this.setAttribute("color", e);
|
|
148
|
-
}
|
|
149
|
-
get arialabel() {
|
|
150
|
-
return this.getAttribute("aria-label");
|
|
151
|
-
}
|
|
152
|
-
set arialabel(e) {
|
|
153
|
-
this.setAttribute("aria-label", e);
|
|
154
|
-
}
|
|
155
|
-
get inverted() {
|
|
156
|
-
return this.getAttribute("inverted");
|
|
157
|
-
}
|
|
158
|
-
set inverted(e) {
|
|
159
|
-
this.setAttribute("inverted", e);
|
|
160
|
-
}
|
|
161
|
-
get from() {
|
|
162
|
-
return this.getAttribute("from");
|
|
163
|
-
}
|
|
164
|
-
set from(e) {
|
|
165
|
-
this.setAttribute("from", e);
|
|
166
|
-
}
|
|
167
|
-
get disabled() {
|
|
168
|
-
return this.getAttribute("disabled");
|
|
169
|
-
}
|
|
170
|
-
set disabled(e) {
|
|
171
|
-
this.setAttribute("disabled", e);
|
|
172
|
-
}
|
|
173
|
-
}
|
|
174
|
-
c = new WeakMap(), n = new WeakMap(), l = new WeakMap();
|
|
175
|
-
customElements.get("px-icon") || customElements.define("px-icon", $);
|
|
176
|
-
export {
|
|
177
|
-
$ as Icon,
|
|
178
|
-
f as IconSet,
|
|
179
|
-
g as iconColorValues,
|
|
180
|
-
x as iconColorValuesKC,
|
|
181
|
-
z as observedAttributes,
|
|
182
|
-
h as styleSheet
|
|
183
|
-
};
|
|
1
|
+
export * from "@proximus/lavender-icon-common";
|