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