@proximus/lavender-patch 2.0.0-alpha.203 → 2.0.0-alpha.205
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 +1 -1
- package/dist/index.es.js +20 -20
- package/package.json +1 -1
package/dist/Patch.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export declare const patchVariantValues: string[];
|
|
2
2
|
export declare const patchShapeValues: string[];
|
|
3
3
|
export declare class Patch extends HTMLElement {
|
|
4
|
-
|
|
4
|
+
protected static readonly template: HTMLTemplateElement;
|
|
5
5
|
constructor();
|
|
6
6
|
static get observedAttributes(): string[];
|
|
7
7
|
attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
|
package/dist/index.es.js
CHANGED
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { booleanPropertyToAttributeSetter as e,
|
|
1
|
+
import { booleanPropertyToAttributeSetter as e, createTemplate as t, log as n, propertyToAttributeSetter as r, renderTemplate as i } from "@proximus/lavender-common";
|
|
2
2
|
//#region src/patch.css?inline
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
3
|
+
var a = ".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)}}", o = new CSSStyleSheet();
|
|
4
|
+
o.replaceSync(a);
|
|
5
|
+
var s = [
|
|
6
6
|
"",
|
|
7
7
|
"default",
|
|
8
8
|
"info",
|
|
9
9
|
"black-friday",
|
|
10
10
|
"eco",
|
|
11
11
|
"greyed"
|
|
12
|
-
],
|
|
12
|
+
], c = [
|
|
13
13
|
"",
|
|
14
14
|
"default",
|
|
15
15
|
"bottom-right",
|
|
16
16
|
"bottom-left"
|
|
17
|
-
],
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
], l = class a extends HTMLElement {
|
|
18
|
+
static {
|
|
19
|
+
this.template = t("<div class=\"patch\"><slot></slot></div>");
|
|
20
20
|
}
|
|
21
21
|
constructor() {
|
|
22
|
-
super(), this.attachShadow({ mode: "open" }), this.shadowRoot
|
|
22
|
+
super(), this.attachShadow({ mode: "open" }), i(this.shadowRoot, a.template), this.shadowRoot.adoptedStyleSheets = [o];
|
|
23
23
|
}
|
|
24
24
|
static get observedAttributes() {
|
|
25
25
|
return [
|
|
@@ -33,7 +33,7 @@ var a = [
|
|
|
33
33
|
case "variant":
|
|
34
34
|
this.updateVariant(t, n);
|
|
35
35
|
break;
|
|
36
|
-
case "shape": this.updateShape(e, n,
|
|
36
|
+
case "shape": this.updateShape(e, n, c);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
_toggleClass(e, t) {
|
|
@@ -42,15 +42,15 @@ var a = [
|
|
|
42
42
|
checkName(e, t) {
|
|
43
43
|
return e.includes(t);
|
|
44
44
|
}
|
|
45
|
-
updateVariant(e,
|
|
46
|
-
this._toggleClass(e,
|
|
45
|
+
updateVariant(e, t) {
|
|
46
|
+
this._toggleClass(e, t), this.checkName(s, t) || n(`"${t}" is not a valid variant value for ${this.tagName.toLowerCase()}. Allowed values are: "${s.join("\", \"")}".`);
|
|
47
47
|
}
|
|
48
|
-
updateShape(e,
|
|
49
|
-
if (!this.checkName(r,
|
|
50
|
-
|
|
48
|
+
updateShape(e, t, r) {
|
|
49
|
+
if (!this.checkName(r, t)) {
|
|
50
|
+
n(`"${t}" is not a valid ${e} value for ${this.tagName.toLowerCase()}. Allowed values are: "${r.join("\", \"")}".`);
|
|
51
51
|
return;
|
|
52
52
|
}
|
|
53
|
-
|
|
53
|
+
t !== null && t !== "" && this.$el.setAttribute(e, t);
|
|
54
54
|
}
|
|
55
55
|
get $el() {
|
|
56
56
|
return this.shadowRoot.querySelector(".patch");
|
|
@@ -59,13 +59,13 @@ var a = [
|
|
|
59
59
|
return this.getAttribute("variant");
|
|
60
60
|
}
|
|
61
61
|
set variant(e) {
|
|
62
|
-
|
|
62
|
+
r(this, "variant", e);
|
|
63
63
|
}
|
|
64
64
|
get shape() {
|
|
65
65
|
return this.getAttribute("shape");
|
|
66
66
|
}
|
|
67
67
|
set shape(e) {
|
|
68
|
-
|
|
68
|
+
r(this, "shape", e);
|
|
69
69
|
}
|
|
70
70
|
get inverted() {
|
|
71
71
|
return this.hasAttribute("inverted");
|
|
@@ -74,6 +74,6 @@ var a = [
|
|
|
74
74
|
e(this, "inverted", t);
|
|
75
75
|
}
|
|
76
76
|
};
|
|
77
|
-
customElements.get("px-patch") || customElements.define("px-patch",
|
|
77
|
+
customElements.get("px-patch") || customElements.define("px-patch", l);
|
|
78
78
|
//#endregion
|
|
79
|
-
export {
|
|
79
|
+
export { l as Patch, c as patchShapeValues, s as patchVariantValues };
|