@proximus/lavender-patch 2.0.0-alpha.3 → 2.0.0-alpha.31
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 -13
- package/package.json +1 -1
package/dist/index.es.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
import { log as a } from "@proximus/lavender-common";
|
|
2
|
+
const i = ".patch{display:inline-flex;align-items:center;padding:var(--px-padding-3xs-mobile) var(--px-padding-s-mobile);border:var(--px-size-border-m) solid transparent;border-radius:var(--px-radius-patch-big) var(--px-radius-patch-big) var(--px-radius-patch-big) var(--px-radius-patch-small);font-family:var(--px-font-family);font-weight:var(--px-font-weight-title);font-size:var(--px-text-size-label-m-mobile);line-height:var(--px-line-height-ratio-l);background-color:var(--px-color-background-purpose-promo-default);color:var(--px-color-text-neutral-inverted)}.patch,.patch *{box-sizing:border-box}[shape=bottom-right]{border-radius:var(--px-radius-patch-big) var(--px-radius-patch-big) var(--px-radius-patch-small) var(--px-radius-patch-big)}[shape=bottom-left],[shape=default]{border-radius:var(--px-radius-patch-big) var(--px-radius-patch-big) var(--px-radius-patch-big) var(--px-radius-patch-small)}.info{background-color:var(--px-color-background-purpose-info-default);color:var(--px-color-text-neutral-default)}.black-friday{background-color:var(--px-color-background-surface-dark);color:var(--px-color-text-neutral-inverted)}.eco{background-color:var(--px-color-background-purpose-success-default);color:var(--px-color-text-neutral-inverted)}.greyed{background-color:var(--px-color-background-state-disabled-default);color:var(--px-color-text-state-disabled-default)}:host([inverted]) .patch{background-color:var(--px-color-background-purpose-promo-inverted);color:var(--px-color-text-neutral-inverted)}:host([inverted]) .info{background-color:var(--px-color-background-purpose-info-inverted);color:var(--px-color-text-neutral-default)}:host([inverted]) .black-friday{background-color:var(--px-color-background-container-light-default);color:var(--px-color-text-neutral-default)}:host([inverted]) .eco{background-color:var(--px-color-background-purpose-success-inverted);color:var(--px-color-text-neutral-default)}:host([inverted]) .greyed{background-color:var(--px-color-background-state-disabled-inverted);color:var(--px-color-text-state-disabled-inverted)}@media only screen and (min-width: 768px){.patch{padding:0 var(--px-padding-s-desktop);font-size:var(--px-text-size-label-m-desktop)}}@media only screen and (min-width: 1025px){.patch{padding:0 var(--px-padding-s-desktop);font-size:var(--px-text-size-label-m-desktop)}}@media only screen and (min-width: 1441px){.patch{padding:0 var(--px-padding-s-desktop);font-size:var(--px-text-size-label-m-desktop)}}", o = new CSSStyleSheet();
|
|
3
|
+
o.replaceSync(i);
|
|
4
|
+
const s = [
|
|
4
5
|
"",
|
|
5
6
|
"default",
|
|
6
7
|
"info",
|
|
7
8
|
"black-friday",
|
|
8
9
|
"eco",
|
|
9
10
|
"greyed"
|
|
10
|
-
],
|
|
11
|
-
class
|
|
11
|
+
], d = ["", "default", "bottom-right", "bottom-left"];
|
|
12
|
+
class c extends HTMLElement {
|
|
12
13
|
template() {
|
|
13
14
|
return `
|
|
14
15
|
<div class="patch">
|
|
@@ -17,7 +18,7 @@ class d extends HTMLElement {
|
|
|
17
18
|
`;
|
|
18
19
|
}
|
|
19
20
|
constructor() {
|
|
20
|
-
super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [
|
|
21
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [o];
|
|
21
22
|
}
|
|
22
23
|
static get observedAttributes() {
|
|
23
24
|
return ["variant", "shape", "inverted"];
|
|
@@ -29,7 +30,7 @@ class d extends HTMLElement {
|
|
|
29
30
|
this.updateVariant(e, r);
|
|
30
31
|
break;
|
|
31
32
|
case "shape":
|
|
32
|
-
this.updateShape(t, r,
|
|
33
|
+
this.updateShape(t, r, d);
|
|
33
34
|
break;
|
|
34
35
|
}
|
|
35
36
|
}
|
|
@@ -40,11 +41,15 @@ class d extends HTMLElement {
|
|
|
40
41
|
return t.includes(e);
|
|
41
42
|
}
|
|
42
43
|
updateVariant(t, e) {
|
|
43
|
-
this._toggleClass(t, e), this.checkName(
|
|
44
|
+
this._toggleClass(t, e), this.checkName(s, e) || a(
|
|
45
|
+
`${e} is not an allowed variant value for ${this.tagName.toLowerCase()}`
|
|
46
|
+
);
|
|
44
47
|
}
|
|
45
48
|
updateShape(t, e, r) {
|
|
46
49
|
if (!this.checkName(r, e)) {
|
|
47
|
-
|
|
50
|
+
a(
|
|
51
|
+
`${e} is not an allowed ${t} value for ${this.tagName.toLowerCase()}`
|
|
52
|
+
);
|
|
48
53
|
return;
|
|
49
54
|
}
|
|
50
55
|
e !== null && e !== "" && this.$el.setAttribute(t, e);
|
|
@@ -71,9 +76,9 @@ class d extends HTMLElement {
|
|
|
71
76
|
this.setAttribute("inverted", t);
|
|
72
77
|
}
|
|
73
78
|
}
|
|
74
|
-
customElements.get("px-patch") || customElements.define("px-patch",
|
|
79
|
+
customElements.get("px-patch") || customElements.define("px-patch", c);
|
|
75
80
|
export {
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
81
|
+
c as Patch,
|
|
82
|
+
d as patchShapeValues,
|
|
83
|
+
s as patchVariantValues
|
|
79
84
|
};
|