@proximus/lavender-patch 2.0.0-alpha.19 → 2.0.0-alpha.190
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/Patch.d.ts +6 -6
- package/dist/index.es.js +78 -83
- package/package.json +1 -1
package/dist/Patch.d.ts
CHANGED
|
@@ -10,10 +10,10 @@ export declare class Patch extends HTMLElement {
|
|
|
10
10
|
updateVariant(oldValue: string, newValue: string): void;
|
|
11
11
|
updateShape(attrName: string, newValue: string, attrValue: string[]): void;
|
|
12
12
|
get $el(): Element;
|
|
13
|
-
get variant(): string;
|
|
14
|
-
set variant(value: string);
|
|
15
|
-
get shape(): string;
|
|
16
|
-
set shape(value: string);
|
|
17
|
-
get inverted():
|
|
18
|
-
set inverted(value:
|
|
13
|
+
get variant(): string | null;
|
|
14
|
+
set variant(value: string | null);
|
|
15
|
+
get shape(): string | null;
|
|
16
|
+
set shape(value: string | null);
|
|
17
|
+
get inverted(): boolean;
|
|
18
|
+
set inverted(value: boolean);
|
|
19
19
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -1,84 +1,79 @@
|
|
|
1
|
-
import { log 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
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
this.setAttribute("inverted", t);
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
customElements.get("px-patch") || customElements.define("px-patch", c);
|
|
80
|
-
export {
|
|
81
|
-
c as Patch,
|
|
82
|
-
d as patchShapeValues,
|
|
83
|
-
s as patchVariantValues
|
|
1
|
+
import { booleanPropertyToAttributeSetter as e, log as t, propertyToAttributeSetter as n } from "@proximus/lavender-common";
|
|
2
|
+
//#region src/patch.css?inline
|
|
3
|
+
var r = ".patch,.patch *{box-sizing:border-box}.patch{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);align-items:center;display:inline-flex}[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 screen and (width>=48rem){.patch{padding:0 var(--px-padding-s-desktop);font-size:var(--px-text-size-label-m-desktop)}}@media screen and (width>=64.0625rem){.patch{padding:0 var(--px-padding-s-desktop);font-size:var(--px-text-size-label-m-desktop)}}@media screen and (width>=90.0625rem){.patch{padding:0 var(--px-padding-s-desktop);font-size:var(--px-text-size-label-m-desktop)}}", i = new CSSStyleSheet();
|
|
4
|
+
i.replaceSync(r);
|
|
5
|
+
var a = [
|
|
6
|
+
"",
|
|
7
|
+
"default",
|
|
8
|
+
"info",
|
|
9
|
+
"black-friday",
|
|
10
|
+
"eco",
|
|
11
|
+
"greyed"
|
|
12
|
+
], o = [
|
|
13
|
+
"",
|
|
14
|
+
"default",
|
|
15
|
+
"bottom-right",
|
|
16
|
+
"bottom-left"
|
|
17
|
+
], s = class extends HTMLElement {
|
|
18
|
+
template() {
|
|
19
|
+
return "\n <div class=\"patch\">\n <slot></slot>\n </div>\n ";
|
|
20
|
+
}
|
|
21
|
+
constructor() {
|
|
22
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [i];
|
|
23
|
+
}
|
|
24
|
+
static get observedAttributes() {
|
|
25
|
+
return [
|
|
26
|
+
"variant",
|
|
27
|
+
"shape",
|
|
28
|
+
"inverted"
|
|
29
|
+
];
|
|
30
|
+
}
|
|
31
|
+
attributeChangedCallback(e, t, n) {
|
|
32
|
+
if (t !== n) switch (e) {
|
|
33
|
+
case "variant":
|
|
34
|
+
this.updateVariant(t, n);
|
|
35
|
+
break;
|
|
36
|
+
case "shape": this.updateShape(e, n, o);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
_toggleClass(e, t) {
|
|
40
|
+
e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(e), t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(t);
|
|
41
|
+
}
|
|
42
|
+
checkName(e, t) {
|
|
43
|
+
return e.includes(t);
|
|
44
|
+
}
|
|
45
|
+
updateVariant(e, n) {
|
|
46
|
+
this._toggleClass(e, n), this.checkName(a, n) || t(`"${n}" is not a valid variant value for ${this.tagName.toLowerCase()}. Allowed values are: "${a.join("\", \"")}".`);
|
|
47
|
+
}
|
|
48
|
+
updateShape(e, n, r) {
|
|
49
|
+
if (!this.checkName(r, n)) {
|
|
50
|
+
t(`"${n}" is not a valid ${e} value for ${this.tagName.toLowerCase()}. Allowed values are: "${r.join("\", \"")}".`);
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
n !== null && n !== "" && this.$el.setAttribute(e, n);
|
|
54
|
+
}
|
|
55
|
+
get $el() {
|
|
56
|
+
return this.shadowRoot.querySelector(".patch");
|
|
57
|
+
}
|
|
58
|
+
get variant() {
|
|
59
|
+
return this.getAttribute("variant");
|
|
60
|
+
}
|
|
61
|
+
set variant(e) {
|
|
62
|
+
n(this, "variant", e);
|
|
63
|
+
}
|
|
64
|
+
get shape() {
|
|
65
|
+
return this.getAttribute("shape");
|
|
66
|
+
}
|
|
67
|
+
set shape(e) {
|
|
68
|
+
n(this, "shape", e);
|
|
69
|
+
}
|
|
70
|
+
get inverted() {
|
|
71
|
+
return this.hasAttribute("inverted");
|
|
72
|
+
}
|
|
73
|
+
set inverted(t) {
|
|
74
|
+
e(this, "inverted", t);
|
|
75
|
+
}
|
|
84
76
|
};
|
|
77
|
+
customElements.get("px-patch") || customElements.define("px-patch", s);
|
|
78
|
+
//#endregion
|
|
79
|
+
export { s as Patch, o as patchShapeValues, a as patchVariantValues };
|