@proximus/lavender-color-option 2.0.0-alpha.23 → 2.0.0-alpha.231

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.
@@ -1,17 +1,18 @@
1
1
  import { PxElement } from '@proximus/lavender-common';
2
2
  export declare const colorOptionSizeValues: string[];
3
3
  export declare class ColorOption extends PxElement<HTMLDivElement> {
4
+ protected static readonly template: HTMLTemplateElement;
4
5
  static nativeName: string;
5
- private template;
6
+ static nativeAttributes: {};
6
7
  constructor();
7
8
  static get observedAttributes(): string[];
8
9
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
9
10
  updateSize(attrName: string, oldValue: string, newValue: string, attrValues: string[]): void;
10
11
  updateDeviceColor(attrName: string, oldValue: string, newValue: string): void;
11
- get size(): string;
12
- set size(value: string);
13
- get deviceColor(): string;
14
- set deviceColor(value: string);
12
+ get size(): string | null;
13
+ set size(value: string | null);
14
+ get deviceColor(): string | null;
15
+ set deviceColor(value: string | null);
15
16
  get unavailable(): boolean;
16
17
  set unavailable(value: boolean);
17
18
  }
@@ -1,18 +1,79 @@
1
1
  import { PxElement } from '@proximus/lavender-common';
2
2
  import { ColorOption } from './ColorOption';
3
- export declare class ColorOptionLink extends PxElement<HTMLLinkElement> {
3
+ export declare class ColorOptionLink extends PxElement<HTMLAnchorElement> {
4
+ protected static readonly template: HTMLTemplateElement;
4
5
  static nativeName: string;
5
- private template;
6
+ static nativeProperties: {
7
+ text: "writable";
8
+ shape: "writable";
9
+ origin: "readonly";
10
+ };
11
+ static nativeMethods: "toString"[];
12
+ static nativeAttributes: {
13
+ href: ("search" | "href" | "hash" | "host" | "hostname" | "password" | "pathname" | "port" | "protocol" | "username")[];
14
+ target: "target"[];
15
+ rel: ("rel" | "relList")[];
16
+ download: "download"[];
17
+ hreflang: "hreflang"[];
18
+ type: "type"[];
19
+ ping: "ping"[];
20
+ referrerpolicy: "referrerPolicy"[];
21
+ title: "title"[];
22
+ charset: "charset"[];
23
+ coords: "coords"[];
24
+ name: "name"[];
25
+ rev: "rev"[];
26
+ };
6
27
  constructor();
7
28
  connectedCallback(): void;
8
29
  static get observedAttributes(): string[];
9
30
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
10
31
  clickColorOptionLink(): void;
11
32
  get $colorOption(): ColorOption;
12
- get deviceColor(): string;
13
- set deviceColor(value: string);
33
+ get deviceColor(): string | null;
34
+ set deviceColor(value: string | null);
14
35
  get unavailable(): boolean;
15
36
  set unavailable(value: boolean);
16
37
  get selected(): boolean;
17
38
  set selected(value: boolean);
39
+ /** @attr {string} href - The destination URL; relative URLs remain relative in attributes. */
40
+ href: string;
41
+ protocol: string;
42
+ username: string;
43
+ password: string;
44
+ host: string;
45
+ hostname: string;
46
+ port: string;
47
+ pathname: string;
48
+ search: string;
49
+ hash: string;
50
+ /** @attr {string} target - Where to open the destination. */
51
+ target: string;
52
+ /** @attr {string} rel - The relationship to the destination. */
53
+ rel: string;
54
+ readonly relList: DOMTokenList;
55
+ /** @attr {string} download - The suggested download filename; an empty value is valid. */
56
+ download: string;
57
+ /** @attr {string} hreflang - The language of the destination. */
58
+ hreflang: string;
59
+ /** @attr {string} type - The native element type. */
60
+ type: string;
61
+ /** @attr {string} ping - Space-separated tracking URLs. */
62
+ ping: string;
63
+ /** @attr {string} referrerpolicy - The referrer policy. */
64
+ referrerPolicy: string;
65
+ /** @attr {string} title - The native element tooltip. */
66
+ title: string;
67
+ /** @attr {string} charset - The legacy character encoding hint. */
68
+ charset: string;
69
+ /** @attr {string} coords - The legacy image-map coordinates. */
70
+ coords: string;
71
+ /** @attr {string} name - The native element name. */
72
+ name: string;
73
+ /** @attr {string} rev - The legacy reverse link relationship. */
74
+ rev: string;
75
+ text: string;
76
+ shape: string;
77
+ readonly origin: string;
78
+ readonly toString: HTMLAnchorElement['toString'];
18
79
  }
@@ -0,0 +1,616 @@
1
+ {
2
+ "schemaVersion": "1.0.0",
3
+ "readme": "",
4
+ "modules": [
5
+ {
6
+ "kind": "javascript-module",
7
+ "path": "src/ColorOption.ts",
8
+ "declarations": [
9
+ {
10
+ "kind": "variable",
11
+ "name": "colorOptionSizeValues",
12
+ "type": {
13
+ "text": "array"
14
+ },
15
+ "default": "['', 'default', 'small']"
16
+ },
17
+ {
18
+ "kind": "class",
19
+ "description": "",
20
+ "name": "ColorOption",
21
+ "members": [
22
+ {
23
+ "kind": "field",
24
+ "name": "template",
25
+ "privacy": "protected",
26
+ "static": true,
27
+ "readonly": true
28
+ },
29
+ {
30
+ "kind": "field",
31
+ "name": "nativeName",
32
+ "type": {
33
+ "text": "string"
34
+ },
35
+ "static": true,
36
+ "default": "'div'"
37
+ },
38
+ {
39
+ "kind": "field",
40
+ "name": "nativeAttributes",
41
+ "type": {
42
+ "text": "object"
43
+ },
44
+ "static": true,
45
+ "default": "{}"
46
+ },
47
+ {
48
+ "kind": "method",
49
+ "name": "updateSize",
50
+ "parameters": [
51
+ {
52
+ "name": "attrName",
53
+ "type": {
54
+ "text": "string"
55
+ }
56
+ },
57
+ {
58
+ "name": "oldValue",
59
+ "type": {
60
+ "text": "string"
61
+ }
62
+ },
63
+ {
64
+ "name": "newValue",
65
+ "type": {
66
+ "text": "string"
67
+ }
68
+ },
69
+ {
70
+ "name": "attrValues",
71
+ "type": {
72
+ "text": "string[]"
73
+ }
74
+ }
75
+ ]
76
+ },
77
+ {
78
+ "kind": "method",
79
+ "name": "updateDeviceColor",
80
+ "parameters": [
81
+ {
82
+ "name": "attrName",
83
+ "type": {
84
+ "text": "string"
85
+ }
86
+ },
87
+ {
88
+ "name": "oldValue",
89
+ "type": {
90
+ "text": "string"
91
+ }
92
+ },
93
+ {
94
+ "name": "newValue",
95
+ "type": {
96
+ "text": "string"
97
+ }
98
+ }
99
+ ]
100
+ },
101
+ {
102
+ "kind": "field",
103
+ "name": "size"
104
+ },
105
+ {
106
+ "kind": "field",
107
+ "name": "deviceColor"
108
+ },
109
+ {
110
+ "kind": "field",
111
+ "name": "unavailable"
112
+ }
113
+ ],
114
+ "attributes": [
115
+ {
116
+ "name": "size"
117
+ },
118
+ {
119
+ "name": "device-color"
120
+ },
121
+ {
122
+ "name": "unavailable"
123
+ }
124
+ ],
125
+ "superclass": {
126
+ "name": "PxElement",
127
+ "package": "@proximus/lavender-common"
128
+ },
129
+ "tagName": "px-color-option",
130
+ "customElement": true
131
+ }
132
+ ],
133
+ "exports": [
134
+ {
135
+ "kind": "js",
136
+ "name": "colorOptionSizeValues",
137
+ "declaration": {
138
+ "name": "colorOptionSizeValues",
139
+ "module": "src/ColorOption.ts"
140
+ }
141
+ },
142
+ {
143
+ "kind": "js",
144
+ "name": "ColorOption",
145
+ "declaration": {
146
+ "name": "ColorOption",
147
+ "module": "src/ColorOption.ts"
148
+ }
149
+ },
150
+ {
151
+ "kind": "custom-element-definition",
152
+ "name": "px-color-option",
153
+ "declaration": {
154
+ "name": "ColorOption",
155
+ "module": "src/ColorOption.ts"
156
+ }
157
+ }
158
+ ]
159
+ },
160
+ {
161
+ "kind": "javascript-module",
162
+ "path": "src/ColorOptionLink.ts",
163
+ "declarations": [
164
+ {
165
+ "kind": "class",
166
+ "description": "",
167
+ "name": "ColorOptionLink",
168
+ "members": [
169
+ {
170
+ "kind": "field",
171
+ "name": "template",
172
+ "privacy": "protected",
173
+ "static": true,
174
+ "readonly": true
175
+ },
176
+ {
177
+ "kind": "field",
178
+ "name": "nativeName",
179
+ "type": {
180
+ "text": "string"
181
+ },
182
+ "static": true,
183
+ "default": "'a'"
184
+ },
185
+ {
186
+ "kind": "field",
187
+ "name": "nativeProperties",
188
+ "static": true,
189
+ "default": "nativeAnchorProperties"
190
+ },
191
+ {
192
+ "kind": "field",
193
+ "name": "nativeMethods",
194
+ "static": true,
195
+ "default": "nativeAnchorMethods"
196
+ },
197
+ {
198
+ "kind": "field",
199
+ "name": "nativeAttributes",
200
+ "static": true,
201
+ "default": "nativeAnchorAttributes"
202
+ },
203
+ {
204
+ "kind": "method",
205
+ "name": "clickColorOptionLink"
206
+ },
207
+ {
208
+ "kind": "field",
209
+ "name": "$colorOption",
210
+ "readonly": true
211
+ },
212
+ {
213
+ "kind": "field",
214
+ "name": "deviceColor"
215
+ },
216
+ {
217
+ "kind": "field",
218
+ "name": "unavailable"
219
+ },
220
+ {
221
+ "kind": "field",
222
+ "name": "selected"
223
+ },
224
+ {
225
+ "kind": "field",
226
+ "name": "href",
227
+ "type": {
228
+ "text": "string"
229
+ },
230
+ "attribute": "href"
231
+ },
232
+ {
233
+ "kind": "field",
234
+ "name": "protocol",
235
+ "type": {
236
+ "text": "string"
237
+ }
238
+ },
239
+ {
240
+ "kind": "field",
241
+ "name": "username",
242
+ "type": {
243
+ "text": "string"
244
+ }
245
+ },
246
+ {
247
+ "kind": "field",
248
+ "name": "password",
249
+ "type": {
250
+ "text": "string"
251
+ }
252
+ },
253
+ {
254
+ "kind": "field",
255
+ "name": "host",
256
+ "type": {
257
+ "text": "string"
258
+ }
259
+ },
260
+ {
261
+ "kind": "field",
262
+ "name": "hostname",
263
+ "type": {
264
+ "text": "string"
265
+ }
266
+ },
267
+ {
268
+ "kind": "field",
269
+ "name": "port",
270
+ "type": {
271
+ "text": "string"
272
+ }
273
+ },
274
+ {
275
+ "kind": "field",
276
+ "name": "pathname",
277
+ "type": {
278
+ "text": "string"
279
+ }
280
+ },
281
+ {
282
+ "kind": "field",
283
+ "name": "search",
284
+ "type": {
285
+ "text": "string"
286
+ }
287
+ },
288
+ {
289
+ "kind": "field",
290
+ "name": "hash",
291
+ "type": {
292
+ "text": "string"
293
+ }
294
+ },
295
+ {
296
+ "kind": "field",
297
+ "name": "target",
298
+ "type": {
299
+ "text": "string"
300
+ },
301
+ "attribute": "target"
302
+ },
303
+ {
304
+ "kind": "field",
305
+ "name": "rel",
306
+ "type": {
307
+ "text": "string"
308
+ },
309
+ "attribute": "rel"
310
+ },
311
+ {
312
+ "kind": "field",
313
+ "name": "relList",
314
+ "type": {
315
+ "text": "DOMTokenList"
316
+ },
317
+ "readonly": true
318
+ },
319
+ {
320
+ "kind": "field",
321
+ "name": "download",
322
+ "type": {
323
+ "text": "string"
324
+ },
325
+ "attribute": "download"
326
+ },
327
+ {
328
+ "kind": "field",
329
+ "name": "hreflang",
330
+ "type": {
331
+ "text": "string"
332
+ },
333
+ "attribute": "hreflang"
334
+ },
335
+ {
336
+ "kind": "field",
337
+ "name": "type",
338
+ "type": {
339
+ "text": "string"
340
+ },
341
+ "attribute": "type"
342
+ },
343
+ {
344
+ "kind": "field",
345
+ "name": "ping",
346
+ "type": {
347
+ "text": "string"
348
+ },
349
+ "attribute": "ping"
350
+ },
351
+ {
352
+ "kind": "field",
353
+ "name": "referrerPolicy",
354
+ "type": {
355
+ "text": "string"
356
+ },
357
+ "attribute": "referrerpolicy"
358
+ },
359
+ {
360
+ "kind": "field",
361
+ "name": "title",
362
+ "type": {
363
+ "text": "string"
364
+ },
365
+ "attribute": "title"
366
+ },
367
+ {
368
+ "kind": "field",
369
+ "name": "charset",
370
+ "type": {
371
+ "text": "string"
372
+ },
373
+ "attribute": "charset"
374
+ },
375
+ {
376
+ "kind": "field",
377
+ "name": "coords",
378
+ "type": {
379
+ "text": "string"
380
+ },
381
+ "attribute": "coords"
382
+ },
383
+ {
384
+ "kind": "field",
385
+ "name": "name",
386
+ "type": {
387
+ "text": "string"
388
+ },
389
+ "attribute": "name"
390
+ },
391
+ {
392
+ "kind": "field",
393
+ "name": "rev",
394
+ "type": {
395
+ "text": "string"
396
+ },
397
+ "attribute": "rev"
398
+ },
399
+ {
400
+ "kind": "field",
401
+ "name": "text",
402
+ "type": {
403
+ "text": "string"
404
+ }
405
+ },
406
+ {
407
+ "kind": "field",
408
+ "name": "shape",
409
+ "type": {
410
+ "text": "string"
411
+ }
412
+ },
413
+ {
414
+ "kind": "field",
415
+ "name": "origin",
416
+ "type": {
417
+ "text": "string"
418
+ },
419
+ "readonly": true
420
+ },
421
+ {
422
+ "kind": "field",
423
+ "name": "toString",
424
+ "type": {
425
+ "text": "HTMLAnchorElement['toString']"
426
+ },
427
+ "readonly": true
428
+ }
429
+ ],
430
+ "events": [
431
+ {
432
+ "name": "CLICK_EVENT",
433
+ "type": {
434
+ "text": "CustomEvent"
435
+ }
436
+ }
437
+ ],
438
+ "attributes": [
439
+ {
440
+ "name": "device-color"
441
+ },
442
+ {
443
+ "name": "unavailable"
444
+ },
445
+ {
446
+ "name": "selected"
447
+ },
448
+ {
449
+ "name": "href",
450
+ "type": {
451
+ "text": "string"
452
+ },
453
+ "fieldName": "href",
454
+ "description": "The destination URL; relative URLs remain relative in attributes."
455
+ },
456
+ {
457
+ "name": "target",
458
+ "type": {
459
+ "text": "string"
460
+ },
461
+ "fieldName": "target",
462
+ "description": "Where to open the destination."
463
+ },
464
+ {
465
+ "name": "rel",
466
+ "type": {
467
+ "text": "string"
468
+ },
469
+ "fieldName": "rel",
470
+ "description": "The relationship to the destination."
471
+ },
472
+ {
473
+ "name": "download",
474
+ "type": {
475
+ "text": "string"
476
+ },
477
+ "fieldName": "download",
478
+ "description": "The suggested download filename; an empty value is valid."
479
+ },
480
+ {
481
+ "name": "hreflang",
482
+ "type": {
483
+ "text": "string"
484
+ },
485
+ "fieldName": "hreflang",
486
+ "description": "The language of the destination."
487
+ },
488
+ {
489
+ "name": "type",
490
+ "type": {
491
+ "text": "string"
492
+ },
493
+ "fieldName": "type",
494
+ "description": "The native element type."
495
+ },
496
+ {
497
+ "name": "ping",
498
+ "type": {
499
+ "text": "string"
500
+ },
501
+ "fieldName": "ping",
502
+ "description": "Space-separated tracking URLs."
503
+ },
504
+ {
505
+ "name": "referrerpolicy",
506
+ "type": {
507
+ "text": "string"
508
+ },
509
+ "fieldName": "referrerPolicy",
510
+ "description": "The referrer policy."
511
+ },
512
+ {
513
+ "name": "title",
514
+ "type": {
515
+ "text": "string"
516
+ },
517
+ "fieldName": "title",
518
+ "description": "The native element tooltip."
519
+ },
520
+ {
521
+ "name": "charset",
522
+ "type": {
523
+ "text": "string"
524
+ },
525
+ "fieldName": "charset",
526
+ "description": "The legacy character encoding hint."
527
+ },
528
+ {
529
+ "name": "coords",
530
+ "type": {
531
+ "text": "string"
532
+ },
533
+ "fieldName": "coords",
534
+ "description": "The legacy image-map coordinates."
535
+ },
536
+ {
537
+ "name": "name",
538
+ "type": {
539
+ "text": "string"
540
+ },
541
+ "fieldName": "name",
542
+ "description": "The native element name."
543
+ },
544
+ {
545
+ "name": "rev",
546
+ "type": {
547
+ "text": "string"
548
+ },
549
+ "fieldName": "rev",
550
+ "description": "The legacy reverse link relationship."
551
+ }
552
+ ],
553
+ "superclass": {
554
+ "name": "PxElement",
555
+ "package": "@proximus/lavender-common"
556
+ },
557
+ "tagName": "px-color-option-link",
558
+ "customElement": true
559
+ }
560
+ ],
561
+ "exports": [
562
+ {
563
+ "kind": "js",
564
+ "name": "ColorOptionLink",
565
+ "declaration": {
566
+ "name": "ColorOptionLink",
567
+ "module": "src/ColorOptionLink.ts"
568
+ }
569
+ },
570
+ {
571
+ "kind": "custom-element-definition",
572
+ "name": "px-color-option-link",
573
+ "declaration": {
574
+ "name": "ColorOptionLink",
575
+ "module": "src/ColorOptionLink.ts"
576
+ }
577
+ }
578
+ ]
579
+ },
580
+ {
581
+ "kind": "javascript-module",
582
+ "path": "src/color-option-link.css",
583
+ "declarations": [],
584
+ "exports": []
585
+ },
586
+ {
587
+ "kind": "javascript-module",
588
+ "path": "src/color-option.css",
589
+ "declarations": [],
590
+ "exports": []
591
+ },
592
+ {
593
+ "kind": "javascript-module",
594
+ "path": "src/index.ts",
595
+ "declarations": [],
596
+ "exports": [
597
+ {
598
+ "kind": "js",
599
+ "name": "*",
600
+ "declaration": {
601
+ "name": "*",
602
+ "module": "src/ColorOption"
603
+ }
604
+ },
605
+ {
606
+ "kind": "js",
607
+ "name": "*",
608
+ "declaration": {
609
+ "name": "*",
610
+ "module": "src/ColorOptionLink"
611
+ }
612
+ }
613
+ ]
614
+ }
615
+ ]
616
+ }
package/dist/index.es.js CHANGED
@@ -1,149 +1,150 @@
1
- import { PxElement as a, checkName as p, log as b } from "@proximus/lavender-common";
2
- const u = ':host{display:inline-block;line-height:0}:host *{box-sizing:border-box}.color-option{display:inline-block;width:32px;height:32px!important;border-radius:var(--px-radius-pill);background-color:var(--color-option-device-color);border:var(--px-size-border-m) var(--px-color-border-main-default) solid}.color-option[unavailable]{position:relative}.color-option[unavailable]:before{content:"";position:absolute;top:50%;left:50%;transform:translate(-50%,-50%) rotate(-45deg);width:44px;height:var(--px-size-border-m);background-color:var(--px-color-border-neutral-default)}.color-option--size-small{width:16px;height:16px!important;border-width:var(--px-size-border-s)}.color-option--size-small[unavailable]:before{width:22px;height:var(--px-size-border-s)}', n = new CSSStyleSheet();
3
- n.replaceSync(u);
4
- const h = ["", "default", "small"], l = class l extends a {
5
- template() {
6
- return `
7
- <slot></slot>
8
- `;
9
- }
10
- constructor() {
11
- super(n);
12
- const e = document.createElement("div");
13
- e.classList.add("color-option"), e.innerHTML = this.template(), this.shadowRoot.appendChild(e);
14
- }
15
- static get observedAttributes() {
16
- return [...super.observedAttributes, "size", "device-color", "unavailable"];
17
- }
18
- attributeChangedCallback(e, o, t) {
19
- if (o !== t)
20
- switch (e) {
21
- case "size":
22
- this.updateSize(e, o, t, h);
23
- break;
24
- case "device-color":
25
- this.updateDeviceColor(e, o, t);
26
- break;
27
- case "unavailable":
28
- this.$el.toggleAttribute("unavailable");
29
- break;
30
- default:
31
- super.attributeChangedCallback(e, o, t);
32
- break;
33
- }
34
- }
35
- updateSize(e, o, t, d) {
36
- if (!p(d, t)) {
37
- b(
38
- `${t} is not an allowed ${e} value for ${this.tagName.toLowerCase()}`
39
- );
40
- return;
41
- }
42
- o !== null && o !== "" && o !== "default" && this.$el.classList.toggle(`color-option--size-${o}`), t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(`color-option--size-${t}`);
43
- }
44
- updateDeviceColor(e, o, t) {
45
- o !== null && o !== "" && this.$el.style.setProperty("--color-option-device-color", o), t !== null && t !== "" && this.$el.style.setProperty("--color-option-device-color", t);
46
- }
47
- get size() {
48
- return this.getAttribute("size");
49
- }
50
- set size(e) {
51
- e ? this.setAttribute("size", e) : this.removeAttribute("size");
52
- }
53
- get deviceColor() {
54
- return this.getAttribute("device-color");
55
- }
56
- set deviceColor(e) {
57
- e ? this.setAttribute("device-color", e) : this.removeAttribute("device-color");
58
- }
59
- get unavailable() {
60
- return this.hasAttribute("unavailable");
61
- }
62
- set unavailable(e) {
63
- e ? this.setAttribute("unavailable", "") : this.removeAttribute("unavailable");
64
- }
1
+ import { PxElement as e, checkName as t, createTemplate as n, log as r, nativeAnchorAttributes as i, nativeAnchorMethods as a, nativeAnchorProperties as o, renderTemplate as s } from "@proximus/lavender-common";
2
+ //#region src/color-option.css?inline
3
+ var c = ":host{line-height:0;display:inline-block}:host *{box-sizing:border-box}.color-option{border-radius:var(--px-radius-pill);background-color:var(--color-option-device-color);border:var(--px-size-border-m) var(--px-color-border-main-default) solid;width:32px;display:inline-block;height:32px!important}.color-option[unavailable]{position:relative}.color-option[unavailable]:before{content:\"\";width:44px;height:var(--px-size-border-m);background-color:var(--px-color-border-neutral-default);position:absolute;top:50%;left:50%;transform:translate(-50%,-50%)rotate(-45deg)}.color-option--size-small{border-width:var(--px-size-border-s);width:16px;height:16px!important}.color-option--size-small[unavailable]:before{width:22px;height:var(--px-size-border-s)}", l = new CSSStyleSheet();
4
+ l.replaceSync(c);
5
+ var u = [
6
+ "",
7
+ "default",
8
+ "small"
9
+ ], d = class i extends e {
10
+ static {
11
+ this.template = n("<div class=\"color-option\"><slot></slot></div>");
12
+ }
13
+ static {
14
+ this.nativeName = "div";
15
+ }
16
+ static {
17
+ this.nativeAttributes = {};
18
+ }
19
+ constructor() {
20
+ super(l), s(this.shadowRoot, i.template);
21
+ }
22
+ static get observedAttributes() {
23
+ return [
24
+ ...super.observedAttributes,
25
+ "size",
26
+ "device-color",
27
+ "unavailable"
28
+ ];
29
+ }
30
+ attributeChangedCallback(e, t, n) {
31
+ if (t !== n) switch (e) {
32
+ case "size":
33
+ this.updateSize(e, t, n, u);
34
+ break;
35
+ case "device-color":
36
+ this.updateDeviceColor(e, t, n);
37
+ break;
38
+ case "unavailable":
39
+ this.$el.toggleAttribute("unavailable");
40
+ break;
41
+ default: super.attributeChangedCallback(e, t, n);
42
+ }
43
+ }
44
+ updateSize(e, n, i, a) {
45
+ t(a, i) ? (n !== null && n !== "" && n !== "default" && this.$el.classList.toggle(`color-option--size-${n}`), i !== null && i !== "" && i !== "default" && this.$el.classList.toggle(`color-option--size-${i}`)) : r(`"${i}" is not a valid ${e} value for a color option. Allowed values are: "${a.join("\", \"")}".`);
46
+ }
47
+ updateDeviceColor(e, t, n) {
48
+ t !== null && t !== "" && this.$el.style.setProperty("--color-option-device-color", t), n !== null && n !== "" && this.$el.style.setProperty("--color-option-device-color", n);
49
+ }
50
+ get size() {
51
+ return this.getAttribute("size");
52
+ }
53
+ set size(e) {
54
+ this._updateAttribute("size", e);
55
+ }
56
+ get deviceColor() {
57
+ return this.getAttribute("device-color");
58
+ }
59
+ set deviceColor(e) {
60
+ this._updateAttribute("device-color", e);
61
+ }
62
+ get unavailable() {
63
+ return this.hasAttribute("unavailable");
64
+ }
65
+ set unavailable(e) {
66
+ this._updateBooleanAttribute("unavailable", e);
67
+ }
65
68
  };
66
- l.nativeName = "div";
67
- let r = l;
68
- customElements.get("px-color-option") || customElements.define("px-color-option", r);
69
- const v = ":host{display:inline-block;line-height:0}:host *{box-sizing:border-box}.color-option-link{display:inline-block;text-decoration:none;padding:var(--px-padding-2xs-mobile);border-radius:var(--px-radius-pill);--btn-transition: all .2s ease-in-out 0s;transition:var(--btn-transition)}.color-option-link[selected]{box-shadow:inset 0 0 0 var(--px-size-border-m) var(--px-color-border-brand-default)}.color-option-link:hover{box-shadow:inset 0 0 0 var(--px-size-border-s) var(--px-color-border-neutral-default)}.color-option-link:focus-visible{outline-offset:var(--px-focus-offset-mobile);outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default)}@media only screen and (min-width: 48em){.color-option-link{padding:var(--px-padding-2xs-tablet)}.color-option-link:focus-visible{outline-offset:var(--px-focus-offset-tablet);outline-width:var(--px-focus-outline-tablet)}}@media only screen and (min-width: 64.0625em){.color-option-link{padding:var(--px-padding-2xs-laptop)}.color-option-link:focus-visible{outline-offset:var(--px-focus-offset-laptop);outline-width:var(--px-focus-outline-laptop)}}@media only screen and (min-width: 90.0625em){.color-option-link{padding:var(--px-padding-2xs-desktop)}.color-option-link:focus-visible{outline-offset:var(--px-focus-offset-desktop);outline-width:var(--px-focus-outline-desktop)}}", c = new CSSStyleSheet();
70
- c.replaceSync(v);
71
- const f = "px.lavender.color-option-link.click", i = class i extends a {
72
- template() {
73
- return `
74
- <px-color-option><slot></slot></px-color-option>
75
- `;
76
- }
77
- constructor() {
78
- super(c);
79
- const e = document.createElement(i.nativeName);
80
- e.classList.add("color-option-link"), e.innerHTML = this.template(), this.shadowRoot.appendChild(e);
81
- }
82
- connectedCallback() {
83
- this.deviceColor && this.$colorOption.setAttribute("device-color", this.deviceColor), this.addEventListener("click", (e) => {
84
- e.preventDefault(), this.clickColorOptionLink();
85
- });
86
- }
87
- static get observedAttributes() {
88
- return [
89
- ...super.observedAttributes,
90
- "device-color",
91
- "unavailable",
92
- "selected"
93
- ];
94
- }
95
- attributeChangedCallback(e, o, t) {
96
- if (o !== t)
97
- switch (e) {
98
- case "device-color":
99
- this.$colorOption.setAttribute(e, t);
100
- break;
101
- case "unavailable":
102
- this.$colorOption.toggleAttribute(e);
103
- break;
104
- case "selected":
105
- this.$el.toggleAttribute("selected");
106
- break;
107
- default:
108
- super.attributeChangedCallback(e, o, t);
109
- break;
110
- }
111
- }
112
- clickColorOptionLink() {
113
- this.dispatchEvent(
114
- new CustomEvent(f, {
115
- bubbles: !0,
116
- composed: !0
117
- })
118
- );
119
- }
120
- get $colorOption() {
121
- return this.shadowRoot.querySelector("px-color-option");
122
- }
123
- get deviceColor() {
124
- return this.getAttribute("device-color");
125
- }
126
- set deviceColor(e) {
127
- e ? this.setAttribute("device-color", e) : this.removeAttribute("device-color");
128
- }
129
- get unavailable() {
130
- return this.hasAttribute("unavailable");
131
- }
132
- set unavailable(e) {
133
- e ? this.setAttribute("unavailable", "") : this.removeAttribute("unavailable");
134
- }
135
- get selected() {
136
- return this.hasAttribute("selected");
137
- }
138
- set selected(e) {
139
- e ? this.setAttribute("selected", "") : this.removeAttribute("selected");
140
- }
141
- };
142
- i.nativeName = "a";
143
- let s = i;
144
- customElements.get("px-color-option-link") || customElements.define("px-color-option-link", s);
145
- export {
146
- r as ColorOption,
147
- s as ColorOptionLink,
148
- h as colorOptionSizeValues
69
+ customElements.get("px-color-option") || customElements.define("px-color-option", d);
70
+ //#endregion
71
+ //#region src/color-option-link.css?inline
72
+ var f = ":host{line-height:0;display:inline-block}:host *{box-sizing:border-box}.color-option-link{padding:var(--px-padding-2xs-mobile);border-radius:var(--px-radius-pill);--btn-transition:all .2s ease-in-out 0s;transition:var(--btn-transition);text-decoration:none;display:inline-block}.color-option-link[selected]{box-shadow:inset 0px 0px 0px var(--px-size-border-m) var(--px-color-border-brand-default)}.color-option-link:hover{box-shadow:inset 0px 0px 0px var(--px-size-border-s) var(--px-color-border-neutral-default)}.color-option-link:focus-visible{outline-offset:var(--px-focus-offset-mobile);outline:var(--px-focus-outline-mobile) solid var(--px-color-border-focus-outline-default)}@media screen and (width>=48rem){.color-option-link{padding:var(--px-padding-2xs-tablet)}.color-option-link:focus-visible{outline-offset:var(--px-focus-offset-tablet);outline-width:var(--px-focus-outline-tablet)}}@media screen and (width>=64.0625rem){.color-option-link{padding:var(--px-padding-2xs-laptop)}.color-option-link:focus-visible{outline-offset:var(--px-focus-offset-laptop);outline-width:var(--px-focus-outline-laptop)}}@media screen and (width>=90.0625rem){.color-option-link{padding:var(--px-padding-2xs-desktop)}.color-option-link:focus-visible{outline-offset:var(--px-focus-offset-desktop);outline-width:var(--px-focus-outline-desktop)}}", p = new CSSStyleSheet();
73
+ p.replaceSync(f);
74
+ var m = "px.lavender.color-option-link.click", h = class t extends e {
75
+ static {
76
+ this.template = n("<a class=\"color-option-link\"><px-color-option><slot></slot></px-color-option></a>");
77
+ }
78
+ static {
79
+ this.nativeName = "a";
80
+ }
81
+ static {
82
+ this.nativeProperties = o;
83
+ }
84
+ static {
85
+ this.nativeMethods = a;
86
+ }
87
+ static {
88
+ this.nativeAttributes = i;
89
+ }
90
+ constructor() {
91
+ super(p), s(this.shadowRoot, t.template);
92
+ }
93
+ connectedCallback() {
94
+ this.addEventListener("click", (e) => {
95
+ e.preventDefault(), this.clickColorOptionLink();
96
+ });
97
+ }
98
+ static get observedAttributes() {
99
+ return [
100
+ ...super.observedAttributes,
101
+ "device-color",
102
+ "unavailable",
103
+ "selected"
104
+ ];
105
+ }
106
+ attributeChangedCallback(e, t, n) {
107
+ if (t !== n) switch (e) {
108
+ case "device-color":
109
+ this.$colorOption.setAttribute(e, n);
110
+ break;
111
+ case "unavailable":
112
+ this.$colorOption.toggleAttribute(e);
113
+ break;
114
+ case "selected":
115
+ this.$el.toggleAttribute("selected");
116
+ break;
117
+ default: super.attributeChangedCallback(e, t, n);
118
+ }
119
+ }
120
+ clickColorOptionLink() {
121
+ this.dispatchEvent(new CustomEvent(m, {
122
+ bubbles: !0,
123
+ composed: !0
124
+ }));
125
+ }
126
+ get $colorOption() {
127
+ return this.shadowRoot.querySelector("px-color-option");
128
+ }
129
+ get deviceColor() {
130
+ return this.getAttribute("device-color");
131
+ }
132
+ set deviceColor(e) {
133
+ this._updateAttribute("device-color", e);
134
+ }
135
+ get unavailable() {
136
+ return this.hasAttribute("unavailable");
137
+ }
138
+ set unavailable(e) {
139
+ this._updateBooleanAttribute("unavailable", e);
140
+ }
141
+ get selected() {
142
+ return this.hasAttribute("selected");
143
+ }
144
+ set selected(e) {
145
+ this._updateBooleanAttribute("selected", e);
146
+ }
149
147
  };
148
+ customElements.get("px-color-option-link") || customElements.define("px-color-option-link", h);
149
+ //#endregion
150
+ export { d as ColorOption, h as ColorOptionLink, u as colorOptionSizeValues };
@@ -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,91 @@
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-color-option",
7
+ "description": "\n---\n",
8
+ "attributes": [
9
+ { "name": "size", "values": [] },
10
+ { "name": "device-color", "values": [] },
11
+ { "name": "unavailable", "values": [] }
12
+ ],
13
+ "references": []
14
+ },
15
+ {
16
+ "name": "px-color-option-link",
17
+ "description": "\n---\n\n\n### **Events:**\n - **CLICK_EVENT**",
18
+ "attributes": [
19
+ { "name": "device-color", "values": [] },
20
+ { "name": "unavailable", "values": [] },
21
+ { "name": "selected", "values": [] },
22
+ {
23
+ "name": "href",
24
+ "description": "The destination URL; relative URLs remain relative in attributes.",
25
+ "values": []
26
+ },
27
+ {
28
+ "name": "target",
29
+ "description": "Where to open the destination.",
30
+ "values": []
31
+ },
32
+ {
33
+ "name": "rel",
34
+ "description": "The relationship to the destination.",
35
+ "values": []
36
+ },
37
+ {
38
+ "name": "download",
39
+ "description": "The suggested download filename; an empty value is valid.",
40
+ "values": []
41
+ },
42
+ {
43
+ "name": "hreflang",
44
+ "description": "The language of the destination.",
45
+ "values": []
46
+ },
47
+ {
48
+ "name": "type",
49
+ "description": "The native element type.",
50
+ "values": []
51
+ },
52
+ {
53
+ "name": "ping",
54
+ "description": "Space-separated tracking URLs.",
55
+ "values": []
56
+ },
57
+ {
58
+ "name": "referrerpolicy",
59
+ "description": "The referrer policy.",
60
+ "values": []
61
+ },
62
+ {
63
+ "name": "title",
64
+ "description": "The native element tooltip.",
65
+ "values": []
66
+ },
67
+ {
68
+ "name": "charset",
69
+ "description": "The legacy character encoding hint.",
70
+ "values": []
71
+ },
72
+ {
73
+ "name": "coords",
74
+ "description": "The legacy image-map coordinates.",
75
+ "values": []
76
+ },
77
+ {
78
+ "name": "name",
79
+ "description": "The native element name.",
80
+ "values": []
81
+ },
82
+ {
83
+ "name": "rev",
84
+ "description": "The legacy reverse link relationship.",
85
+ "values": []
86
+ }
87
+ ],
88
+ "references": []
89
+ }
90
+ ]
91
+ }
@@ -0,0 +1,147 @@
1
+ {
2
+ "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
+ "name": "@proximus/lavender-color-option",
4
+ "version": "2.0.0-alpha.231",
5
+ "description-markup": "markdown",
6
+ "contributions": {
7
+ "html": {
8
+ "elements": [
9
+ {
10
+ "name": "px-color-option",
11
+ "description": "\n\n---\n",
12
+ "doc-url": "",
13
+ "attributes": [
14
+ { "name": "size", "value": { "type": "string" } },
15
+ { "name": "device-color", "value": { "type": "string" } },
16
+ { "name": "unavailable", "value": { "type": "string" } }
17
+ ],
18
+ "events": [],
19
+ "js": {
20
+ "properties": [
21
+ { "name": "size" },
22
+ { "name": "deviceColor" },
23
+ { "name": "unavailable" }
24
+ ],
25
+ "events": []
26
+ }
27
+ },
28
+ {
29
+ "name": "px-color-option-link",
30
+ "description": "\n\n---\n\n\n### **Events:**\n - **CLICK_EVENT**",
31
+ "doc-url": "",
32
+ "attributes": [
33
+ { "name": "device-color", "value": { "type": "string" } },
34
+ { "name": "unavailable", "value": { "type": "string" } },
35
+ { "name": "selected", "value": { "type": "string" } },
36
+ {
37
+ "name": "href",
38
+ "description": "The destination URL; relative URLs remain relative in attributes.",
39
+ "value": { "type": "string" }
40
+ },
41
+ {
42
+ "name": "target",
43
+ "description": "Where to open the destination.",
44
+ "value": { "type": "string" }
45
+ },
46
+ {
47
+ "name": "rel",
48
+ "description": "The relationship to the destination.",
49
+ "value": { "type": "string" }
50
+ },
51
+ {
52
+ "name": "download",
53
+ "description": "The suggested download filename; an empty value is valid.",
54
+ "value": { "type": "string" }
55
+ },
56
+ {
57
+ "name": "hreflang",
58
+ "description": "The language of the destination.",
59
+ "value": { "type": "string" }
60
+ },
61
+ {
62
+ "name": "type",
63
+ "description": "The native element type.",
64
+ "value": { "type": "string" }
65
+ },
66
+ {
67
+ "name": "ping",
68
+ "description": "Space-separated tracking URLs.",
69
+ "value": { "type": "string" }
70
+ },
71
+ {
72
+ "name": "referrerpolicy",
73
+ "description": "The referrer policy.",
74
+ "value": { "type": "string" }
75
+ },
76
+ {
77
+ "name": "title",
78
+ "description": "The native element tooltip.",
79
+ "value": { "type": "string" }
80
+ },
81
+ {
82
+ "name": "charset",
83
+ "description": "The legacy character encoding hint.",
84
+ "value": { "type": "string" }
85
+ },
86
+ {
87
+ "name": "coords",
88
+ "description": "The legacy image-map coordinates.",
89
+ "value": { "type": "string" }
90
+ },
91
+ {
92
+ "name": "name",
93
+ "description": "The native element name.",
94
+ "value": { "type": "string" }
95
+ },
96
+ {
97
+ "name": "rev",
98
+ "description": "The legacy reverse link relationship.",
99
+ "value": { "type": "string" }
100
+ }
101
+ ],
102
+ "events": [{ "name": "CLICK_EVENT", "type": "CustomEvent" }],
103
+ "js": {
104
+ "properties": [
105
+ { "name": "$colorOption" },
106
+ { "name": "deviceColor" },
107
+ { "name": "unavailable" },
108
+ { "name": "selected" },
109
+ { "name": "href", "type": "string" },
110
+ { "name": "protocol", "type": "string" },
111
+ { "name": "username", "type": "string" },
112
+ { "name": "password", "type": "string" },
113
+ { "name": "host", "type": "string" },
114
+ { "name": "hostname", "type": "string" },
115
+ { "name": "port", "type": "string" },
116
+ { "name": "pathname", "type": "string" },
117
+ { "name": "search", "type": "string" },
118
+ { "name": "hash", "type": "string" },
119
+ { "name": "target", "type": "string" },
120
+ { "name": "rel", "type": "string" },
121
+ { "name": "relList", "type": "DOMTokenList" },
122
+ { "name": "download", "type": "string" },
123
+ { "name": "hreflang", "type": "string" },
124
+ { "name": "type", "type": "string" },
125
+ { "name": "ping", "type": "string" },
126
+ { "name": "referrerPolicy", "type": "string" },
127
+ { "name": "title", "type": "string" },
128
+ { "name": "charset", "type": "string" },
129
+ { "name": "coords", "type": "string" },
130
+ { "name": "name", "type": "string" },
131
+ { "name": "rev", "type": "string" },
132
+ { "name": "text", "type": "string" },
133
+ { "name": "shape", "type": "string" },
134
+ { "name": "origin", "type": "string" },
135
+ { "name": "toString", "type": "HTMLAnchorElement['toString']" }
136
+ ],
137
+ "events": [{ "name": "CLICK_EVENT", "type": "CustomEvent" }]
138
+ }
139
+ }
140
+ ]
141
+ },
142
+ "css": {
143
+ "properties": [],
144
+ "pseudo-elements": []
145
+ }
146
+ }
147
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-color-option",
3
- "version": "2.0.0-alpha.23",
3
+ "version": "2.0.0-alpha.231",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "clean": "rm -rf dist",
14
14
  "build": "npm run clean && NODE_ENV=development vite build && tsc && npm run transform-package-json && npm run wc-manifest",
15
15
  "test": "vitest run --coverage",
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"