@proximus/lavender-icon-common 2.0.0-alpha.20 → 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/Icon.d.ts ADDED
@@ -0,0 +1,26 @@
1
+ import { WithExtraAttributes } from '@proximus/lavender-common';
2
+ export declare const styleSheet: CSSStyleSheet;
3
+ export declare class Icon extends WithExtraAttributes {
4
+ #private;
5
+ static get observedAttributes(): string[];
6
+ constructor(...styleSheets: CSSStyleSheet[]);
7
+ attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
8
+ connectedCallback(): void;
9
+ updateAttribute(attrName: string, oldValue: string, newValue: string, attrValues: readonly string[]): void;
10
+ updateName(oldValue: string, newValue: string): void;
11
+ get $el(): SVGElement;
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
+ }
@@ -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,308 @@
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": "#src",
22
+ "privacy": "private",
23
+ "type": {
24
+ "text": "string | null"
25
+ },
26
+ "default": "null"
27
+ },
28
+ {
29
+ "kind": "field",
30
+ "name": "#internals",
31
+ "privacy": "private",
32
+ "type": {
33
+ "text": "ElementInternals"
34
+ },
35
+ "readonly": true
36
+ },
37
+ {
38
+ "kind": "field",
39
+ "name": "#template",
40
+ "privacy": "private"
41
+ },
42
+ {
43
+ "kind": "method",
44
+ "name": "updateAttribute",
45
+ "parameters": [
46
+ {
47
+ "name": "attrName",
48
+ "type": {
49
+ "text": "string"
50
+ }
51
+ },
52
+ {
53
+ "name": "oldValue",
54
+ "type": {
55
+ "text": "string"
56
+ }
57
+ },
58
+ {
59
+ "name": "newValue",
60
+ "type": {
61
+ "text": "string"
62
+ }
63
+ },
64
+ {
65
+ "name": "attrValues",
66
+ "type": {
67
+ "text": "readonly string[]"
68
+ }
69
+ }
70
+ ]
71
+ },
72
+ {
73
+ "kind": "method",
74
+ "name": "updateName",
75
+ "parameters": [
76
+ {
77
+ "name": "oldValue",
78
+ "type": {
79
+ "text": "string"
80
+ }
81
+ },
82
+ {
83
+ "name": "newValue",
84
+ "type": {
85
+ "text": "string"
86
+ }
87
+ }
88
+ ]
89
+ },
90
+ {
91
+ "kind": "field",
92
+ "name": "$el",
93
+ "readonly": true
94
+ },
95
+ {
96
+ "kind": "field",
97
+ "name": "name"
98
+ },
99
+ {
100
+ "kind": "field",
101
+ "name": "size"
102
+ },
103
+ {
104
+ "kind": "field",
105
+ "name": "color"
106
+ },
107
+ {
108
+ "kind": "field",
109
+ "name": "arialabel"
110
+ },
111
+ {
112
+ "kind": "field",
113
+ "name": "inverted"
114
+ },
115
+ {
116
+ "kind": "field",
117
+ "name": "from"
118
+ },
119
+ {
120
+ "kind": "field",
121
+ "name": "disabled"
122
+ },
123
+ {
124
+ "kind": "field",
125
+ "name": "innerHTML"
126
+ }
127
+ ],
128
+ "attributes": [
129
+ {
130
+ "name": "name"
131
+ },
132
+ {
133
+ "name": "size"
134
+ },
135
+ {
136
+ "name": "color"
137
+ },
138
+ {
139
+ "name": "aria-label"
140
+ },
141
+ {
142
+ "name": "inverted"
143
+ },
144
+ {
145
+ "name": "from"
146
+ },
147
+ {
148
+ "name": "disabled"
149
+ }
150
+ ],
151
+ "superclass": {
152
+ "name": "WithExtraAttributes",
153
+ "package": "@proximus/lavender-common"
154
+ },
155
+ "tagName": "px-icon",
156
+ "customElement": true
157
+ }
158
+ ],
159
+ "exports": [
160
+ {
161
+ "kind": "js",
162
+ "name": "styleSheet",
163
+ "declaration": {
164
+ "name": "styleSheet",
165
+ "module": "src/Icon.ts"
166
+ }
167
+ },
168
+ {
169
+ "kind": "js",
170
+ "name": "Icon",
171
+ "declaration": {
172
+ "name": "Icon",
173
+ "module": "src/Icon.ts"
174
+ }
175
+ },
176
+ {
177
+ "kind": "custom-element-definition",
178
+ "name": "px-icon",
179
+ "declaration": {
180
+ "name": "Icon",
181
+ "module": "src/Icon.ts"
182
+ }
183
+ }
184
+ ]
185
+ },
186
+ {
187
+ "kind": "javascript-module",
188
+ "path": "src/IconSet.ts",
189
+ "declarations": [
190
+ {
191
+ "kind": "class",
192
+ "description": "",
193
+ "name": "IconSet",
194
+ "attributes": [
195
+ {
196
+ "name": "name"
197
+ },
198
+ {
199
+ "name": "src"
200
+ },
201
+ {
202
+ "name": "type"
203
+ },
204
+ {
205
+ "name": "format"
206
+ }
207
+ ],
208
+ "superclass": {
209
+ "name": "HTMLElement"
210
+ },
211
+ "tagName": "px-icon-set",
212
+ "customElement": true
213
+ }
214
+ ],
215
+ "exports": [
216
+ {
217
+ "kind": "js",
218
+ "name": "IconSet",
219
+ "declaration": {
220
+ "name": "IconSet",
221
+ "module": "src/IconSet.ts"
222
+ }
223
+ },
224
+ {
225
+ "kind": "custom-element-definition",
226
+ "name": "px-icon-set",
227
+ "declaration": {
228
+ "name": "IconSet",
229
+ "module": "src/IconSet.ts"
230
+ }
231
+ }
232
+ ]
233
+ },
234
+ {
235
+ "kind": "javascript-module",
236
+ "path": "src/attributeValues.ts",
237
+ "declarations": [
238
+ {
239
+ "kind": "variable",
240
+ "name": "iconColorValues",
241
+ "type": {
242
+ "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]"
243
+ },
244
+ "default": "[ 'Brand', 'Accent', 'Neutral', 'Dimmed', 'PurposeSuccess', 'PurposeWarning', 'PurposeError', 'PurposeUnlimited', 'PurposePromo', 'StateHover', 'StateActive', 'StateDisabled', ]"
245
+ },
246
+ {
247
+ "kind": "variable",
248
+ "name": "iconColorValuesKC"
249
+ }
250
+ ],
251
+ "exports": [
252
+ {
253
+ "kind": "js",
254
+ "name": "iconColorValues",
255
+ "declaration": {
256
+ "name": "iconColorValues",
257
+ "module": "src/attributeValues.ts"
258
+ }
259
+ },
260
+ {
261
+ "kind": "js",
262
+ "name": "iconColorValuesKC",
263
+ "declaration": {
264
+ "name": "iconColorValuesKC",
265
+ "module": "src/attributeValues.ts"
266
+ }
267
+ }
268
+ ]
269
+ },
270
+ {
271
+ "kind": "javascript-module",
272
+ "path": "src/icon.css",
273
+ "declarations": [],
274
+ "exports": []
275
+ },
276
+ {
277
+ "kind": "javascript-module",
278
+ "path": "src/index.ts",
279
+ "declarations": [],
280
+ "exports": [
281
+ {
282
+ "kind": "js",
283
+ "name": "*",
284
+ "declaration": {
285
+ "name": "*",
286
+ "module": "src/IconSet"
287
+ }
288
+ },
289
+ {
290
+ "kind": "js",
291
+ "name": "*",
292
+ "declaration": {
293
+ "name": "*",
294
+ "module": "src/Icon"
295
+ }
296
+ },
297
+ {
298
+ "kind": "js",
299
+ "name": "*",
300
+ "declaration": {
301
+ "name": "*",
302
+ "module": "src/attributeValues"
303
+ }
304
+ }
305
+ ]
306
+ }
307
+ ]
308
+ }
@@ -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, 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,162 +27,134 @@ 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", 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
+ }
189
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 };
@@ -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,58 @@
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.200",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "px-icon",
11
+ "description": "\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
+ { "name": "innerHTML" }
34
+ ],
35
+ "events": []
36
+ }
37
+ },
38
+ {
39
+ "name": "px-icon-set",
40
+ "description": "\n---\n",
41
+ "doc-url": "",
42
+ "attributes": [
43
+ { "name": "name", "value": { "type": "string" } },
44
+ { "name": "src", "value": { "type": "string" } },
45
+ { "name": "type", "value": { "type": "string" } },
46
+ { "name": "format", "value": { "type": "string" } }
47
+ ],
48
+ "events": [],
49
+ "js": { "properties": [], "events": [] }
50
+ }
51
+ ]
52
+ },
53
+ "css": {
54
+ "properties": [],
55
+ "pseudo-elements": []
56
+ }
57
+ }
58
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-icon-common",
3
- "version": "2.0.0-alpha.20",
3
+ "version": "2.0.0-alpha.200",
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"