@proximus/lavender-color-option 2.0.0-alpha.13 → 2.0.0-alpha.131
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/index.es.js +18 -16
- package/package.json +2 -2
package/dist/index.es.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { PxElement as n, checkName as p } from "@proximus/lavender-common";
|
|
2
|
-
const
|
|
3
|
-
|
|
4
|
-
const
|
|
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
5
|
template() {
|
|
6
6
|
return `
|
|
7
7
|
<slot></slot>
|
|
8
8
|
`;
|
|
9
9
|
}
|
|
10
10
|
constructor() {
|
|
11
|
-
super(
|
|
11
|
+
super(c);
|
|
12
12
|
const e = document.createElement("div");
|
|
13
13
|
e.classList.add("color-option"), e.innerHTML = this.template(), this.shadowRoot.appendChild(e);
|
|
14
14
|
}
|
|
@@ -19,7 +19,7 @@ const u = ["", "default", "small"], l = class l extends n {
|
|
|
19
19
|
if (o !== t)
|
|
20
20
|
switch (e) {
|
|
21
21
|
case "size":
|
|
22
|
-
this.updateSize(e, o, t,
|
|
22
|
+
this.updateSize(e, o, t, v);
|
|
23
23
|
break;
|
|
24
24
|
case "device-color":
|
|
25
25
|
this.updateDeviceColor(e, o, t);
|
|
@@ -32,9 +32,11 @@ const u = ["", "default", "small"], l = class l extends n {
|
|
|
32
32
|
break;
|
|
33
33
|
}
|
|
34
34
|
}
|
|
35
|
-
updateSize(e, o, t,
|
|
36
|
-
if (!p(
|
|
37
|
-
|
|
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
|
+
);
|
|
38
40
|
return;
|
|
39
41
|
}
|
|
40
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}`);
|
|
@@ -64,16 +66,16 @@ const u = ["", "default", "small"], l = class l extends n {
|
|
|
64
66
|
l.nativeName = "div";
|
|
65
67
|
let r = l;
|
|
66
68
|
customElements.get("px-color-option") || customElements.define("px-color-option", r);
|
|
67
|
-
const
|
|
68
|
-
|
|
69
|
-
const
|
|
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 {
|
|
70
72
|
template() {
|
|
71
73
|
return `
|
|
72
|
-
<px-color-option
|
|
74
|
+
<px-color-option><slot></slot></px-color-option>
|
|
73
75
|
`;
|
|
74
76
|
}
|
|
75
77
|
constructor() {
|
|
76
|
-
super(
|
|
78
|
+
super(d);
|
|
77
79
|
const e = document.createElement(i.nativeName);
|
|
78
80
|
e.classList.add("color-option-link"), e.innerHTML = this.template(), this.shadowRoot.appendChild(e);
|
|
79
81
|
}
|
|
@@ -109,7 +111,7 @@ const h = "px.lavender.color-option-link.click", i = class i extends n {
|
|
|
109
111
|
}
|
|
110
112
|
clickColorOptionLink() {
|
|
111
113
|
this.dispatchEvent(
|
|
112
|
-
new CustomEvent(
|
|
114
|
+
new CustomEvent(f, {
|
|
113
115
|
bubbles: !0,
|
|
114
116
|
composed: !0
|
|
115
117
|
})
|
|
@@ -143,5 +145,5 @@ customElements.get("px-color-option-link") || customElements.define("px-color-op
|
|
|
143
145
|
export {
|
|
144
146
|
r as ColorOption,
|
|
145
147
|
s as ColorOptionLink,
|
|
146
|
-
|
|
148
|
+
v as colorOptionSizeValues
|
|
147
149
|
};
|
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.131",
|
|
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"
|