@proximus/lavender-color-option 2.0.0-alpha.203 → 2.0.0-alpha.205

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,8 +1,8 @@
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
6
  constructor();
7
7
  static get observedAttributes(): string[];
8
8
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
@@ -1,8 +1,8 @@
1
1
  import { PxElement } from '@proximus/lavender-common';
2
2
  import { ColorOption } from './ColorOption';
3
3
  export declare class ColorOptionLink extends PxElement<HTMLLinkElement> {
4
+ protected static readonly template: HTMLTemplateElement;
4
5
  static nativeName: string;
5
- private template;
6
6
  constructor();
7
7
  connectedCallback(): void;
8
8
  static get observedAttributes(): string[];
@@ -19,6 +19,13 @@
19
19
  "description": "",
20
20
  "name": "ColorOption",
21
21
  "members": [
22
+ {
23
+ "kind": "field",
24
+ "name": "template",
25
+ "privacy": "protected",
26
+ "static": true,
27
+ "readonly": true
28
+ },
22
29
  {
23
30
  "kind": "field",
24
31
  "name": "nativeName",
@@ -28,11 +35,6 @@
28
35
  "static": true,
29
36
  "default": "'div'"
30
37
  },
31
- {
32
- "kind": "method",
33
- "name": "template",
34
- "privacy": "private"
35
- },
36
38
  {
37
39
  "kind": "method",
38
40
  "name": "updateSize",
@@ -98,10 +100,6 @@
98
100
  {
99
101
  "kind": "field",
100
102
  "name": "unavailable"
101
- },
102
- {
103
- "kind": "field",
104
- "name": "innerHTML"
105
103
  }
106
104
  ],
107
105
  "attributes": [
@@ -159,6 +157,13 @@
159
157
  "description": "",
160
158
  "name": "ColorOptionLink",
161
159
  "members": [
160
+ {
161
+ "kind": "field",
162
+ "name": "template",
163
+ "privacy": "protected",
164
+ "static": true,
165
+ "readonly": true
166
+ },
162
167
  {
163
168
  "kind": "field",
164
169
  "name": "nativeName",
@@ -168,11 +173,6 @@
168
173
  "static": true,
169
174
  "default": "'a'"
170
175
  },
171
- {
172
- "kind": "method",
173
- "name": "template",
174
- "privacy": "private"
175
- },
176
176
  {
177
177
  "kind": "method",
178
178
  "name": "clickColorOptionLink"
@@ -193,10 +193,6 @@
193
193
  {
194
194
  "kind": "field",
195
195
  "name": "selected"
196
- },
197
- {
198
- "kind": "field",
199
- "name": "innerHTML"
200
196
  }
201
197
  ],
202
198
  "events": [
package/dist/index.es.js CHANGED
@@ -1,22 +1,20 @@
1
- import { PxElement as e, checkName as t, log as n } from "@proximus/lavender-common";
1
+ import { PxElement as e, checkName as t, createTemplate as n, log as r, renderTemplate as i } from "@proximus/lavender-common";
2
2
  //#region src/color-option.css?inline
3
- var r = ":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)}", i = new CSSStyleSheet();
4
- i.replaceSync(r);
5
- var a = [
3
+ var a = ":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)}", o = new CSSStyleSheet();
4
+ o.replaceSync(a);
5
+ var s = [
6
6
  "",
7
7
  "default",
8
8
  "small"
9
- ], o = class extends e {
9
+ ], c = class a extends e {
10
10
  static {
11
- this.nativeName = "div";
11
+ this.template = n("<div class=\"color-option\"><slot></slot></div>");
12
12
  }
13
- template() {
14
- return "\n <slot></slot>\n ";
13
+ static {
14
+ this.nativeName = "div";
15
15
  }
16
16
  constructor() {
17
- super(i);
18
- let e = document.createElement("div");
19
- e.classList.add("color-option"), e.innerHTML = this.template(), this.shadowRoot.appendChild(e);
17
+ super(o), i(this.shadowRoot, a.template);
20
18
  }
21
19
  static get observedAttributes() {
22
20
  return [
@@ -29,7 +27,7 @@ var a = [
29
27
  attributeChangedCallback(e, t, n) {
30
28
  if (t !== n) switch (e) {
31
29
  case "size":
32
- this.updateSize(e, t, n, a);
30
+ this.updateSize(e, t, n, s);
33
31
  break;
34
32
  case "device-color":
35
33
  this.updateDeviceColor(e, t, n);
@@ -40,12 +38,12 @@ var a = [
40
38
  default: super.attributeChangedCallback(e, t, n);
41
39
  }
42
40
  }
43
- updateSize(e, r, i, a) {
41
+ updateSize(e, n, i, a) {
44
42
  if (!t(a, i)) {
45
- n(`"${i}" is not a valid ${e} value for a color option. Allowed values are: "${a.join("\", \"")}".`);
43
+ r(`"${i}" is not a valid ${e} value for a color option. Allowed values are: "${a.join("\", \"")}".`);
46
44
  return;
47
45
  }
48
- r !== null && r !== "" && r !== "default" && this.$el.classList.toggle(`color-option--size-${r}`), i !== null && i !== "" && i !== "default" && this.$el.classList.toggle(`color-option--size-${i}`);
46
+ 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}`);
49
47
  }
50
48
  updateDeviceColor(e, t, n) {
51
49
  t !== null && t !== "" && this.$el.style.setProperty("--color-option-device-color", t), n !== null && n !== "" && this.$el.style.setProperty("--color-option-device-color", n);
@@ -69,22 +67,20 @@ var a = [
69
67
  this._updateBooleanAttribute("unavailable", e);
70
68
  }
71
69
  };
72
- customElements.get("px-color-option") || customElements.define("px-color-option", o);
70
+ customElements.get("px-color-option") || customElements.define("px-color-option", c);
73
71
  //#endregion
74
72
  //#region src/color-option-link.css?inline
75
- var s = ":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)}}", c = new CSSStyleSheet();
76
- c.replaceSync(s);
77
- var l = "px.lavender.color-option-link.click", u = class t extends e {
73
+ var l = ":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)}}", u = new CSSStyleSheet();
74
+ u.replaceSync(l);
75
+ var d = "px.lavender.color-option-link.click", f = class t extends e {
78
76
  static {
79
- this.nativeName = "a";
77
+ this.template = n("<a class=\"color-option-link\"><px-color-option><slot></slot></px-color-option></a>");
80
78
  }
81
- template() {
82
- return "\n <px-color-option><slot></slot></px-color-option>\n ";
79
+ static {
80
+ this.nativeName = "a";
83
81
  }
84
82
  constructor() {
85
- super(c);
86
- let e = document.createElement(t.nativeName);
87
- e.classList.add("color-option-link"), e.innerHTML = this.template(), this.shadowRoot.appendChild(e);
83
+ super(u), i(this.shadowRoot, t.template);
88
84
  }
89
85
  connectedCallback() {
90
86
  this.addEventListener("click", (e) => {
@@ -114,7 +110,7 @@ var l = "px.lavender.color-option-link.click", u = class t extends e {
114
110
  }
115
111
  }
116
112
  clickColorOptionLink() {
117
- this.dispatchEvent(new CustomEvent(l, {
113
+ this.dispatchEvent(new CustomEvent(d, {
118
114
  bubbles: !0,
119
115
  composed: !0
120
116
  }));
@@ -141,6 +137,6 @@ var l = "px.lavender.color-option-link.click", u = class t extends e {
141
137
  this._updateBooleanAttribute("selected", e);
142
138
  }
143
139
  };
144
- customElements.get("px-color-option-link") || customElements.define("px-color-option-link", u);
140
+ customElements.get("px-color-option-link") || customElements.define("px-color-option-link", f);
145
141
  //#endregion
146
- export { o as ColorOption, u as ColorOptionLink, a as colorOptionSizeValues };
142
+ export { c as ColorOption, f as ColorOptionLink, s as colorOptionSizeValues };
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
3
3
  "name": "@proximus/lavender-color-option",
4
- "version": "2.0.0-alpha.203",
4
+ "version": "2.0.0-alpha.205",
5
5
  "description-markup": "markdown",
6
6
  "contributions": {
7
7
  "html": {
@@ -20,8 +20,7 @@
20
20
  "properties": [
21
21
  { "name": "size" },
22
22
  { "name": "deviceColor" },
23
- { "name": "unavailable" },
24
- { "name": "innerHTML" }
23
+ { "name": "unavailable" }
25
24
  ],
26
25
  "events": []
27
26
  }
@@ -41,8 +40,7 @@
41
40
  { "name": "$colorOption" },
42
41
  { "name": "deviceColor" },
43
42
  { "name": "unavailable" },
44
- { "name": "selected" },
45
- { "name": "innerHTML" }
43
+ { "name": "selected" }
46
44
  ],
47
45
  "events": [{ "name": "CLICK_EVENT", "type": "CustomEvent" }]
48
46
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-color-option",
3
- "version": "2.0.0-alpha.203",
3
+ "version": "2.0.0-alpha.205",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",