@proximus/lavender-color-option 1.4.14-beta.3 → 1.4.14

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.
@@ -8,10 +8,10 @@ export declare class ColorOption extends PxElement<HTMLDivElement> {
8
8
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
9
9
  updateSize(attrName: string, oldValue: string, newValue: string, attrValues: string[]): void;
10
10
  updateDeviceColor(attrName: string, oldValue: string, newValue: string): void;
11
- get size(): string | null;
12
- set size(value: string | null);
13
- get deviceColor(): string | null;
14
- set deviceColor(value: string | null);
11
+ get size(): string;
12
+ set size(value: string);
13
+ get deviceColor(): string;
14
+ set deviceColor(value: string);
15
15
  get unavailable(): boolean;
16
16
  set unavailable(value: boolean);
17
17
  }
@@ -9,8 +9,8 @@ export declare class ColorOptionLink extends PxElement<HTMLLinkElement> {
9
9
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
10
10
  clickColorOptionLink(): void;
11
11
  get $colorOption(): ColorOption;
12
- get deviceColor(): string | null;
13
- set deviceColor(value: string | null);
12
+ get deviceColor(): string;
13
+ set deviceColor(value: string);
14
14
  get unavailable(): boolean;
15
15
  set unavailable(value: boolean);
16
16
  get selected(): boolean;
package/dist/index.es.js CHANGED
@@ -1,146 +1,149 @@
1
- import { PxElement as e, checkName as t, log as n } from "@proximus/lavender-common";
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 = [
6
- "",
7
- "default",
8
- "small"
9
- ], o = class extends e {
10
- static {
11
- this.nativeName = "div";
12
- }
13
- template() {
14
- return "\n <slot></slot>\n ";
15
- }
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);
20
- }
21
- static get observedAttributes() {
22
- return [
23
- ...super.observedAttributes,
24
- "size",
25
- "device-color",
26
- "unavailable"
27
- ];
28
- }
29
- attributeChangedCallback(e, t, n) {
30
- if (t !== n) switch (e) {
31
- case "size":
32
- this.updateSize(e, t, n, a);
33
- break;
34
- case "device-color":
35
- this.updateDeviceColor(e, t, n);
36
- break;
37
- case "unavailable":
38
- this.$el.toggleAttribute("unavailable");
39
- break;
40
- default: super.attributeChangedCallback(e, t, n);
41
- }
42
- }
43
- updateSize(e, r, i, a) {
44
- if (!t(a, i)) {
45
- n(`"${i}" is not a valid ${e} value for a color option. Allowed values are: "${a.join("\", \"")}".`);
46
- return;
47
- }
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}`);
49
- }
50
- updateDeviceColor(e, t, n) {
51
- t !== null && t !== "" && this.$el.style.setProperty("--color-option-device-color", t), n !== null && n !== "" && this.$el.style.setProperty("--color-option-device-color", n);
52
- }
53
- get size() {
54
- return this.getAttribute("size");
55
- }
56
- set size(e) {
57
- this._updateAttribute("size", e);
58
- }
59
- get deviceColor() {
60
- return this.getAttribute("device-color");
61
- }
62
- set deviceColor(e) {
63
- this._updateAttribute("device-color", e);
64
- }
65
- get unavailable() {
66
- return this.hasAttribute("unavailable");
67
- }
68
- set unavailable(e) {
69
- this._updateBooleanAttribute("unavailable", e);
70
- }
1
+ import { PxElement as n, 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)}', c = new CSSStyleSheet();
3
+ c.replaceSync(u);
4
+ const v = ["", "default", "small"], l = class l extends n {
5
+ template() {
6
+ return `
7
+ <slot></slot>
8
+ `;
9
+ }
10
+ constructor() {
11
+ super(c);
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, v);
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, a) {
36
+ if (!p(a, t)) {
37
+ b(
38
+ `"${t}" is not a valid ${e} value for a color option. Allowed values are: "${a.join('", "')}".`
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
+ }
71
65
  };
72
- customElements.get("px-color-option") || customElements.define("px-color-option", o);
73
- //#endregion
74
- //#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 {
78
- static {
79
- this.nativeName = "a";
80
- }
81
- template() {
82
- return "\n <px-color-option><slot></slot></px-color-option>\n ";
83
- }
84
- 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);
88
- }
89
- connectedCallback() {
90
- this.addEventListener("click", (e) => {
91
- e.preventDefault(), this.clickColorOptionLink();
92
- });
93
- }
94
- static get observedAttributes() {
95
- return [
96
- ...super.observedAttributes,
97
- "device-color",
98
- "unavailable",
99
- "selected"
100
- ];
101
- }
102
- attributeChangedCallback(e, t, n) {
103
- if (t !== n) switch (e) {
104
- case "device-color":
105
- this.$colorOption.setAttribute(e, n);
106
- break;
107
- case "unavailable":
108
- this.$colorOption.toggleAttribute(e);
109
- break;
110
- case "selected":
111
- this.$el.toggleAttribute("selected");
112
- break;
113
- default: super.attributeChangedCallback(e, t, n);
114
- }
115
- }
116
- clickColorOptionLink() {
117
- this.dispatchEvent(new CustomEvent(l, {
118
- bubbles: !0,
119
- composed: !0
120
- }));
121
- }
122
- get $colorOption() {
123
- return this.shadowRoot.querySelector("px-color-option");
124
- }
125
- get deviceColor() {
126
- return this.getAttribute("device-color");
127
- }
128
- set deviceColor(e) {
129
- this._updateAttribute("device-color", e);
130
- }
131
- get unavailable() {
132
- return this.hasAttribute("unavailable");
133
- }
134
- set unavailable(e) {
135
- this._updateBooleanAttribute("unavailable", e);
136
- }
137
- get selected() {
138
- return this.hasAttribute("selected");
139
- }
140
- set selected(e) {
141
- this._updateBooleanAttribute("selected", e);
142
- }
66
+ l.nativeName = "div";
67
+ let r = l;
68
+ customElements.get("px-color-option") || customElements.define("px-color-option", r);
69
+ const h = ":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 screen and (min-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 (min-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 (min-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)}}", d = new CSSStyleSheet();
70
+ d.replaceSync(h);
71
+ const f = "px.lavender.color-option-link.click", i = class i extends n {
72
+ template() {
73
+ return `
74
+ <px-color-option><slot></slot></px-color-option>
75
+ `;
76
+ }
77
+ constructor() {
78
+ super(d);
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.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
+ v as colorOptionSizeValues
143
149
  };
144
- customElements.get("px-color-option-link") || customElements.define("px-color-option-link", u);
145
- //#endregion
146
- export { o as ColorOption, u as ColorOptionLink, a as colorOptionSizeValues };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-color-option",
3
- "version": "1.4.14-beta.3",
3
+ "version": "1.4.14",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",