@proximus/lavender-icon-common 2.0.0-alpha.22 → 2.0.0-alpha.220

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 ADDED
@@ -0,0 +1,27 @@
1
+ import { WithExtraAttributes } from '@proximus/lavender-common';
2
+ export declare const styleSheet: CSSStyleSheet;
3
+ export declare class Icon extends WithExtraAttributes {
4
+ #private;
5
+ protected static readonly template: HTMLTemplateElement;
6
+ static get observedAttributes(): string[];
7
+ constructor(...styleSheets: CSSStyleSheet[]);
8
+ attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
9
+ connectedCallback(): void;
10
+ updateAttribute(attrName: string, oldValue: string, newValue: string, attrValues: readonly string[]): void;
11
+ updateName(oldValue: string, newValue: string): void;
12
+ get $el(): SVGElement;
13
+ get name(): string | null;
14
+ set name(value: string | null);
15
+ get size(): string | null;
16
+ set size(value: string | null);
17
+ get color(): string | null;
18
+ set color(value: string | null);
19
+ get arialabel(): string | null;
20
+ set arialabel(value: string | null);
21
+ get inverted(): boolean;
22
+ set inverted(value: boolean);
23
+ get from(): string | null;
24
+ set from(value: string | null);
25
+ get disabled(): boolean;
26
+ set disabled(value: boolean);
27
+ }
@@ -0,0 +1,6 @@
1
+ export declare class IconSet extends HTMLElement {
2
+ constructor();
3
+ static get observedAttributes(): string[];
4
+ connectedCallback(): void;
5
+ disconnectedCallback(): void;
6
+ }
@@ -0,0 +1,3 @@
1
+ export declare const iconColorValues: readonly ["Brand", "Accent", "Neutral", "Dimmed", "PurposeSuccess", "PurposeWarning", "PurposeError", "PurposeUnlimited", "PurposePromo", "StateHover", "StateActive", "StateDisabled"];
2
+ export declare const iconColorValuesKC: string[];
3
+ export type IconColor = (typeof iconColorValues)[number];
@@ -0,0 +1,306 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/Icon.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "styleSheet",
12
+ "default": "new CSSStyleSheet()"
13
+ },
14
+ {
15
+ "kind": "class",
16
+ "description": "",
17
+ "name": "Icon",
18
+ "members": [
19
+ {
20
+ "kind": "field",
21
+ "name": "template",
22
+ "privacy": "protected",
23
+ "static": true,
24
+ "readonly": true
25
+ },
26
+ {
27
+ "kind": "field",
28
+ "name": "#src",
29
+ "privacy": "private",
30
+ "type": {
31
+ "text": "string | null"
32
+ },
33
+ "default": "null"
34
+ },
35
+ {
36
+ "kind": "field",
37
+ "name": "#internals",
38
+ "privacy": "private",
39
+ "type": {
40
+ "text": "ElementInternals"
41
+ },
42
+ "readonly": true
43
+ },
44
+ {
45
+ "kind": "method",
46
+ "name": "updateAttribute",
47
+ "parameters": [
48
+ {
49
+ "name": "attrName",
50
+ "type": {
51
+ "text": "string"
52
+ }
53
+ },
54
+ {
55
+ "name": "oldValue",
56
+ "type": {
57
+ "text": "string"
58
+ }
59
+ },
60
+ {
61
+ "name": "newValue",
62
+ "type": {
63
+ "text": "string"
64
+ }
65
+ },
66
+ {
67
+ "name": "attrValues",
68
+ "type": {
69
+ "text": "readonly string[]"
70
+ }
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "kind": "method",
76
+ "name": "updateName",
77
+ "parameters": [
78
+ {
79
+ "name": "oldValue",
80
+ "type": {
81
+ "text": "string"
82
+ }
83
+ },
84
+ {
85
+ "name": "newValue",
86
+ "type": {
87
+ "text": "string"
88
+ }
89
+ }
90
+ ]
91
+ },
92
+ {
93
+ "kind": "field",
94
+ "name": "$el",
95
+ "readonly": true
96
+ },
97
+ {
98
+ "kind": "field",
99
+ "name": "name"
100
+ },
101
+ {
102
+ "kind": "field",
103
+ "name": "size"
104
+ },
105
+ {
106
+ "kind": "field",
107
+ "name": "color"
108
+ },
109
+ {
110
+ "kind": "field",
111
+ "name": "arialabel"
112
+ },
113
+ {
114
+ "kind": "field",
115
+ "name": "inverted"
116
+ },
117
+ {
118
+ "kind": "field",
119
+ "name": "from"
120
+ },
121
+ {
122
+ "kind": "field",
123
+ "name": "disabled"
124
+ }
125
+ ],
126
+ "attributes": [
127
+ {
128
+ "name": "name"
129
+ },
130
+ {
131
+ "name": "size"
132
+ },
133
+ {
134
+ "name": "color"
135
+ },
136
+ {
137
+ "name": "aria-label"
138
+ },
139
+ {
140
+ "name": "inverted"
141
+ },
142
+ {
143
+ "name": "from"
144
+ },
145
+ {
146
+ "name": "disabled"
147
+ }
148
+ ],
149
+ "superclass": {
150
+ "name": "WithExtraAttributes",
151
+ "package": "@proximus/lavender-common"
152
+ },
153
+ "tagName": "px-icon",
154
+ "customElement": true
155
+ }
156
+ ],
157
+ "exports": [
158
+ {
159
+ "kind": "js",
160
+ "name": "styleSheet",
161
+ "declaration": {
162
+ "name": "styleSheet",
163
+ "module": "src/Icon.ts"
164
+ }
165
+ },
166
+ {
167
+ "kind": "js",
168
+ "name": "Icon",
169
+ "declaration": {
170
+ "name": "Icon",
171
+ "module": "src/Icon.ts"
172
+ }
173
+ },
174
+ {
175
+ "kind": "custom-element-definition",
176
+ "name": "px-icon",
177
+ "declaration": {
178
+ "name": "Icon",
179
+ "module": "src/Icon.ts"
180
+ }
181
+ }
182
+ ]
183
+ },
184
+ {
185
+ "kind": "javascript-module",
186
+ "path": "src/IconSet.ts",
187
+ "declarations": [
188
+ {
189
+ "kind": "class",
190
+ "description": "",
191
+ "name": "IconSet",
192
+ "attributes": [
193
+ {
194
+ "name": "name"
195
+ },
196
+ {
197
+ "name": "src"
198
+ },
199
+ {
200
+ "name": "type"
201
+ },
202
+ {
203
+ "name": "format"
204
+ }
205
+ ],
206
+ "superclass": {
207
+ "name": "HTMLElement"
208
+ },
209
+ "tagName": "px-icon-set",
210
+ "customElement": true
211
+ }
212
+ ],
213
+ "exports": [
214
+ {
215
+ "kind": "js",
216
+ "name": "IconSet",
217
+ "declaration": {
218
+ "name": "IconSet",
219
+ "module": "src/IconSet.ts"
220
+ }
221
+ },
222
+ {
223
+ "kind": "custom-element-definition",
224
+ "name": "px-icon-set",
225
+ "declaration": {
226
+ "name": "IconSet",
227
+ "module": "src/IconSet.ts"
228
+ }
229
+ }
230
+ ]
231
+ },
232
+ {
233
+ "kind": "javascript-module",
234
+ "path": "src/attributeValues.ts",
235
+ "declarations": [
236
+ {
237
+ "kind": "variable",
238
+ "name": "iconColorValues",
239
+ "type": {
240
+ "text": "[\n 'Brand',\n 'Accent',\n 'Neutral',\n 'Dimmed',\n 'PurposeSuccess',\n 'PurposeWarning',\n 'PurposeError',\n 'PurposeUnlimited',\n 'PurposePromo',\n 'StateHover',\n 'StateActive',\n 'StateDisabled',\n]"
241
+ },
242
+ "default": "[ 'Brand', 'Accent', 'Neutral', 'Dimmed', 'PurposeSuccess', 'PurposeWarning', 'PurposeError', 'PurposeUnlimited', 'PurposePromo', 'StateHover', 'StateActive', 'StateDisabled', ]"
243
+ },
244
+ {
245
+ "kind": "variable",
246
+ "name": "iconColorValuesKC"
247
+ }
248
+ ],
249
+ "exports": [
250
+ {
251
+ "kind": "js",
252
+ "name": "iconColorValues",
253
+ "declaration": {
254
+ "name": "iconColorValues",
255
+ "module": "src/attributeValues.ts"
256
+ }
257
+ },
258
+ {
259
+ "kind": "js",
260
+ "name": "iconColorValuesKC",
261
+ "declaration": {
262
+ "name": "iconColorValuesKC",
263
+ "module": "src/attributeValues.ts"
264
+ }
265
+ }
266
+ ]
267
+ },
268
+ {
269
+ "kind": "javascript-module",
270
+ "path": "src/icon.css",
271
+ "declarations": [],
272
+ "exports": []
273
+ },
274
+ {
275
+ "kind": "javascript-module",
276
+ "path": "src/index.ts",
277
+ "declarations": [],
278
+ "exports": [
279
+ {
280
+ "kind": "js",
281
+ "name": "*",
282
+ "declaration": {
283
+ "name": "*",
284
+ "module": "src/IconSet"
285
+ }
286
+ },
287
+ {
288
+ "kind": "js",
289
+ "name": "*",
290
+ "declaration": {
291
+ "name": "*",
292
+ "module": "src/Icon"
293
+ }
294
+ },
295
+ {
296
+ "kind": "js",
297
+ "name": "*",
298
+ "declaration": {
299
+ "name": "*",
300
+ "module": "src/attributeValues"
301
+ }
302
+ }
303
+ ]
304
+ }
305
+ ]
306
+ }
@@ -0,0 +1,3 @@
1
+ export * from './IconSet';
2
+ export * from './Icon';
3
+ export * from './attributeValues';
package/dist/index.es.js CHANGED
@@ -1,24 +1,23 @@
1
- var u = (r) => {
2
- throw TypeError(r);
3
- };
4
- var p = (r, o, e) => o.has(r) || u("Cannot " + e);
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 f, log as b } from "@proximus/lavender-common";
7
- class g 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 = `
1
+ import { WithExtraAttributes as e, booleanPropertyToAttributeSetter as t, createTemplate as n, iconSizeValuesKC as r, log as i, propertyToAttributeSetter as a, renderTemplate as o } from "@proximus/lavender-common";
2
+ //#region src/IconSet.ts
3
+ var s = 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,162 +27,130 @@ class g extends HTMLElement {
28
27
  font-display: block;
29
28
  }
30
29
  `, document.head.appendChild(e);
31
- }
32
- }
33
- disconnectedCallback() {
34
- const o = document.querySelector(
35
- `style[data-name="${this.getAttribute("name")}"]`
36
- );
37
- o && o.remove();
38
- }
39
- }
40
- customElements.get("px-icon-set") || customElements.define("px-icon-set", g);
41
- const x = [
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
- ], A = ["Inherit", ...x].map(
55
- (r) => r.replace(/([A-Z])/g, "-$1").toLowerCase().slice(1)
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
- "name",
60
- "size",
61
- "color",
62
- "aria-label",
63
- "inverted",
64
- "from",
65
- "disabled"
66
- ];
67
- var c, n, l;
68
- class y 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=""></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, ...$];
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, f);
90
- break;
91
- case "color":
92
- this.updateAttribute(e, t, i, A);
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", this.ariaHidden = "false") : (s(this, n).ariaHidden = "true", this.ariaHidden = "true");
101
- break;
102
- }
103
- }
104
- connectedCallback() {
105
- this.role = "img", this.name && this.$el.firstElementChild.setAttribute(
106
- "xlink:href",
107
- `#icon-${this.name}`
108
- );
109
- const e = document.querySelectorAll("px-icon-set");
110
- e || console.log("<px-icon-set> component not found");
111
- for (const t of e) {
112
- if (!t.getAttribute("name") || !t.getAttribute("src")) {
113
- console.error("Icon name or src not found");
114
- continue;
115
- }
116
- t.getAttribute("name") === this.from && t.getAttribute("type") !== "font" && (d(this, c, t.getAttribute("src")), this.$el.firstElementChild.setAttribute(
117
- "xlink:href",
118
- `${s(this, c)}#icon-${this.name}`
119
- ));
120
- }
121
- !this.ariaLabel && s(this, n) && (s(this, n).ariaHidden = "true", this.ariaHidden = "true");
122
- }
123
- updateAttribute(e, t, i, v) {
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
- );
127
- }
128
- updateName(e, t) {
129
- s(this, c) && this.$el.firstElementChild.setAttribute(
130
- "xlink:href",
131
- `${s(this, c)}#icon-${t}`
132
- );
133
- }
134
- get $el() {
135
- return this.shadowRoot.querySelector("svg");
136
- }
137
- get name() {
138
- return this.getAttribute("name");
139
- }
140
- set name(e) {
141
- this.setAttribute("name", e);
142
- }
143
- get size() {
144
- return this.getAttribute("size");
145
- }
146
- set size(e) {
147
- this.setAttribute("size", e);
148
- }
149
- get color() {
150
- return this.getAttribute("color");
151
- }
152
- set color(e) {
153
- this.setAttribute("color", e);
154
- }
155
- get arialabel() {
156
- return this.getAttribute("aria-label");
157
- }
158
- set arialabel(e) {
159
- this.setAttribute("aria-label", e);
160
- }
161
- get inverted() {
162
- return this.getAttribute("inverted");
163
- }
164
- set inverted(e) {
165
- this.setAttribute("inverted", e);
166
- }
167
- get from() {
168
- return this.getAttribute("from");
169
- }
170
- set from(e) {
171
- this.setAttribute("from", e);
172
- }
173
- get disabled() {
174
- return this.getAttribute("disabled");
175
- }
176
- set disabled(e) {
177
- this.setAttribute("disabled", e);
178
- }
179
- }
180
- c = new WeakMap(), n = new WeakMap(), l = new WeakMap();
181
- customElements.get("px-icon") || customElements.define("px-icon", y);
182
- export {
183
- y as Icon,
184
- g as IconSet,
185
- x as iconColorValues,
186
- A as iconColorValuesKC,
187
- $ as observedAttributes,
188
- 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", s);
38
+ //#endregion
39
+ //#region src/attributeValues.ts
40
+ var c = [
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
+ ], l = ["Inherit", ...c].map((e) => e.replace(/([A-Z])/g, "-$1").toLowerCase().slice(1)), u = ":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)}", d = new CSSStyleSheet();
54
+ d.replaceSync(u);
55
+ var f = class s extends e {
56
+ static {
57
+ this.template = n("<svg aria-hidden=\"true\"><use></use></svg>");
58
+ }
59
+ #e = null;
60
+ #t;
61
+ static get observedAttributes() {
62
+ return [
63
+ ...super.observedAttributes,
64
+ "name",
65
+ "size",
66
+ "color",
67
+ "aria-label",
68
+ "inverted",
69
+ "from",
70
+ "disabled"
71
+ ];
72
+ }
73
+ constructor(...e) {
74
+ super(...e, d), o(this.shadowRoot, s.template), this.#t = this.attachInternals?.(), this.#t && (this.#t.role = "img");
75
+ }
76
+ attributeChangedCallback(e, t, n) {
77
+ if (t !== n) switch (e) {
78
+ case "name":
79
+ this.updateName(t, n);
80
+ break;
81
+ case "size":
82
+ this.updateAttribute(e, t, n, r);
83
+ break;
84
+ case "color":
85
+ this.updateAttribute(e, t, n, l);
86
+ break;
87
+ case "disabled":
88
+ this.color = "state-disabled";
89
+ break;
90
+ case "aria-label":
91
+ if (!this.#t) return;
92
+ n ? (this.#t.ariaHidden = "false", this.ariaHidden = "false") : (this.#t.ariaHidden = "true", this.ariaHidden = "true");
93
+ }
94
+ }
95
+ connectedCallback() {
96
+ this.role = "img";
97
+ let e = document.querySelectorAll("px-icon-set");
98
+ e || console.log("<px-icon-set> component not found");
99
+ for (let t of e) !t.getAttribute("name") || !t.getAttribute("src") ? console.error("Icon name or src not found") : t.getAttribute("name") === this.from && t.getAttribute("type") !== "font" && (this.#e = t.getAttribute("src"), this.$el.firstElementChild?.setAttribute("href", `${this.#e}#icon-${this.name}`));
100
+ !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"));
101
+ }
102
+ updateAttribute(e, t, n, r) {
103
+ 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(r, n) || i(`${n} is not an allowed ${e} value for ${this.tagName.toLowerCase()}`);
104
+ }
105
+ updateName(e, t) {
106
+ this.#e && this.$el.firstElementChild?.setAttribute("href", `${this.#e}#icon-${t}`);
107
+ }
108
+ get $el() {
109
+ return this.shadowRoot.querySelector("svg");
110
+ }
111
+ get name() {
112
+ return this.getAttribute("name");
113
+ }
114
+ set name(e) {
115
+ a(this, "name", e);
116
+ }
117
+ get size() {
118
+ return this.getAttribute("size");
119
+ }
120
+ set size(e) {
121
+ a(this, "size", e);
122
+ }
123
+ get color() {
124
+ return this.getAttribute("color");
125
+ }
126
+ set color(e) {
127
+ a(this, "color", e);
128
+ }
129
+ get arialabel() {
130
+ return this.getAttribute("aria-label");
131
+ }
132
+ set arialabel(e) {
133
+ a(this, "aria-label", e);
134
+ }
135
+ get inverted() {
136
+ return this.hasAttribute("inverted");
137
+ }
138
+ set inverted(e) {
139
+ t(this, "inverted", e);
140
+ }
141
+ get from() {
142
+ return this.getAttribute("from");
143
+ }
144
+ set from(e) {
145
+ a(this, "from", e);
146
+ }
147
+ get disabled() {
148
+ return this.hasAttribute("disabled");
149
+ }
150
+ set disabled(e) {
151
+ t(this, "disabled", e);
152
+ }
189
153
  };
154
+ customElements.get("px-icon") || customElements.define("px-icon", f);
155
+ //#endregion
156
+ export { f as Icon, s as IconSet, c as iconColorValues, l as iconColorValuesKC, d as styleSheet };
@@ -0,0 +1,6 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-css-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "properties": [],
5
+ "pseudoElements": []
6
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/microsoft/vscode-html-languageservice/main/docs/customData.schema.json",
3
+ "version": 1.1,
4
+ "tags": [
5
+ {
6
+ "name": "px-icon",
7
+ "description": "\n---\n",
8
+ "attributes": [
9
+ { "name": "name", "values": [] },
10
+ { "name": "size", "values": [] },
11
+ { "name": "color", "values": [] },
12
+ { "name": "aria-label", "values": [] },
13
+ { "name": "inverted", "values": [] },
14
+ { "name": "from", "values": [] },
15
+ { "name": "disabled", "values": [] }
16
+ ],
17
+ "references": []
18
+ },
19
+ {
20
+ "name": "px-icon-set",
21
+ "description": "\n---\n",
22
+ "attributes": [
23
+ { "name": "name", "values": [] },
24
+ { "name": "src", "values": [] },
25
+ { "name": "type", "values": [] },
26
+ { "name": "format", "values": [] }
27
+ ],
28
+ "references": []
29
+ }
30
+ ]
31
+ }
@@ -0,0 +1,57 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
+ "name": "@proximus/lavender-icon-common",
4
+ "version": "2.0.0-alpha.220",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "px-icon",
11
+ "description": "\n\n---\n",
12
+ "doc-url": "",
13
+ "attributes": [
14
+ { "name": "name", "value": { "type": "string" } },
15
+ { "name": "size", "value": { "type": "string" } },
16
+ { "name": "color", "value": { "type": "string" } },
17
+ { "name": "aria-label", "value": { "type": "string" } },
18
+ { "name": "inverted", "value": { "type": "string" } },
19
+ { "name": "from", "value": { "type": "string" } },
20
+ { "name": "disabled", "value": { "type": "string" } }
21
+ ],
22
+ "events": [],
23
+ "js": {
24
+ "properties": [
25
+ { "name": "$el" },
26
+ { "name": "name" },
27
+ { "name": "size" },
28
+ { "name": "color" },
29
+ { "name": "arialabel" },
30
+ { "name": "inverted" },
31
+ { "name": "from" },
32
+ { "name": "disabled" }
33
+ ],
34
+ "events": []
35
+ }
36
+ },
37
+ {
38
+ "name": "px-icon-set",
39
+ "description": "\n\n---\n",
40
+ "doc-url": "",
41
+ "attributes": [
42
+ { "name": "name", "value": { "type": "string" } },
43
+ { "name": "src", "value": { "type": "string" } },
44
+ { "name": "type", "value": { "type": "string" } },
45
+ { "name": "format", "value": { "type": "string" } }
46
+ ],
47
+ "events": [],
48
+ "js": { "properties": [], "events": [] }
49
+ }
50
+ ]
51
+ },
52
+ "css": {
53
+ "properties": [],
54
+ "pseudo-elements": []
55
+ }
56
+ }
57
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-icon-common",
3
- "version": "2.0.0-alpha.22",
3
+ "version": "2.0.0-alpha.220",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -10,10 +10,10 @@
10
10
  "type": "module",
11
11
  "scripts": {
12
12
  "clean": "rm -rf dist",
13
- "build": "npm run clean && vite build && npm run transform-package-json && npm run wc-manifest",
13
+ "build": "npm run clean && vite build && tsc && 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 ../custom-elements-manifest.config.js --outdir dist"
16
+ "wc-manifest": "cem analyze --globs \"src/*\" --config ../../../custom-elements-manifest.config.js --outdir dist"
17
17
  },
18
18
  "publishConfig": {
19
19
  "access": "public"