@proximus/lavender-color-option 2.0.0-alpha.18 → 2.0.0-alpha.180
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/ColorOption.d.ts +4 -4
- package/dist/ColorOptionLink.d.ts +2 -2
- package/dist/index.es.js +144 -147
- package/package.json +2 -2
package/dist/ColorOption.d.ts
CHANGED
|
@@ -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;
|
|
12
|
-
set size(value: string);
|
|
13
|
-
get deviceColor(): string;
|
|
14
|
-
set deviceColor(value: string);
|
|
11
|
+
get size(): string | null;
|
|
12
|
+
set size(value: string | null);
|
|
13
|
+
get deviceColor(): string | null;
|
|
14
|
+
set deviceColor(value: string | null);
|
|
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;
|
|
13
|
-
set deviceColor(value: string);
|
|
12
|
+
get deviceColor(): string | null;
|
|
13
|
+
set deviceColor(value: string | null);
|
|
14
14
|
get unavailable(): boolean;
|
|
15
15
|
set unavailable(value: boolean);
|
|
16
16
|
get selected(): boolean;
|
package/dist/index.es.js
CHANGED
|
@@ -1,149 +1,146 @@
|
|
|
1
|
-
import { PxElement as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
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
|
+
}
|
|
65
71
|
};
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
c.replaceSync(
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
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
|
|
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
|
+
}
|
|
149
143
|
};
|
|
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": "2.0.0-alpha.
|
|
3
|
+
"version": "2.0.0-alpha.180",
|
|
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
|
|
16
|
+
"wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
|
|
17
17
|
},
|
|
18
18
|
"publishConfig": {
|
|
19
19
|
"access": "public"
|