@proximus/lavender-price 2.0.0-alpha.203 → 2.0.0-alpha.204
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/Price.d.ts +1 -1
- package/dist/custom-elements.json +7 -9
- package/dist/index.es.js +17 -14
- package/dist/web-types.json +2 -3
- package/package.json +1 -1
package/dist/Price.d.ts
CHANGED
|
@@ -2,9 +2,9 @@ import { PxElement } from '@proximus/lavender-common';
|
|
|
2
2
|
export declare const priceVariantValues: string[];
|
|
3
3
|
export declare const priceSizeValues: string[];
|
|
4
4
|
export declare class Price extends PxElement<HTMLDivElement> {
|
|
5
|
+
protected static readonly template: HTMLTemplateElement;
|
|
5
6
|
static nativeName: string;
|
|
6
7
|
observer: MutationObserver | null;
|
|
7
|
-
private template;
|
|
8
8
|
constructor();
|
|
9
9
|
static get observedAttributes(): string[];
|
|
10
10
|
connectedCallback(): void;
|
|
@@ -27,6 +27,13 @@
|
|
|
27
27
|
"description": "",
|
|
28
28
|
"name": "Price",
|
|
29
29
|
"members": [
|
|
30
|
+
{
|
|
31
|
+
"kind": "field",
|
|
32
|
+
"name": "template",
|
|
33
|
+
"privacy": "protected",
|
|
34
|
+
"static": true,
|
|
35
|
+
"readonly": true
|
|
36
|
+
},
|
|
30
37
|
{
|
|
31
38
|
"kind": "field",
|
|
32
39
|
"name": "nativeName",
|
|
@@ -44,11 +51,6 @@
|
|
|
44
51
|
},
|
|
45
52
|
"default": "null"
|
|
46
53
|
},
|
|
47
|
-
{
|
|
48
|
-
"kind": "field",
|
|
49
|
-
"name": "template",
|
|
50
|
-
"privacy": "private"
|
|
51
|
-
},
|
|
52
54
|
{
|
|
53
55
|
"kind": "method",
|
|
54
56
|
"name": "toggleClass",
|
|
@@ -112,10 +114,6 @@
|
|
|
112
114
|
{
|
|
113
115
|
"kind": "field",
|
|
114
116
|
"name": "inverted"
|
|
115
|
-
},
|
|
116
|
-
{
|
|
117
|
-
"kind": "field",
|
|
118
|
-
"name": "innerHTML"
|
|
119
117
|
}
|
|
120
118
|
],
|
|
121
119
|
"attributes": [
|
package/dist/index.es.js
CHANGED
|
@@ -1,25 +1,28 @@
|
|
|
1
|
-
import { PxElement as e,
|
|
1
|
+
import { PxElement as e, createTemplate as t, log as n, renderTemplate as r } from "@proximus/lavender-common";
|
|
2
2
|
//#region src/price.css?inline
|
|
3
|
-
var
|
|
4
|
-
|
|
5
|
-
var
|
|
3
|
+
var i = ".price{--price-s:var(--px-price-size-unit-s-mobile);--price-m:var(--px-price-size-unit-m-mobile);--price-l:var(--px-price-size-unit-l-mobile)}@media screen and (width>=48rem){.price{--price-s:var(--px-price-size-unit-s-tablet);--price-m:var(--px-price-size-unit-m-tablet);--price-l:var(--px-price-size-unit-l-tablet)}}@media screen and (width>=64.0625rem){.price{--price-s:var(--px-price-size-unit-s-laptop);--price-m:var(--px-price-size-unit-m-laptop);--price-l:var(--px-price-size-unit-l-laptop)}}.price{font-family:var(--px-font-family);white-space:nowrap;font-weight:var(--px-font-weight-title);color:var(--px-color-text-brand-default);font-size:var(--price-s);line-height:var(--px-line-height-ratio-l)}.promo,.free{color:var(--px-color-text-purpose-promo-default)}.neutral{color:var(--px-color-text-neutral-default)}.exceeding{color:var(--px-color-text-purpose-error-default)}.disabled{color:var(--px-color-text-state-disabled-default)}:host([inverted]) .price{color:var(--px-color-text-brand-inverted)}:host([inverted]) .promo,:host([inverted]) .free{color:var(--px-color-text-purpose-promo-inverted)}:host([inverted]) .neutral{color:var(--px-color-text-neutral-inverted)}:host([inverted]) .exceeding{color:var(--px-color-text-purpose-error-inverted)}:host([inverted]) .disabled{color:var(--px-color-text-state-disabled-inverted)}.price:not(.promo):not(.free) ::slotted(s){display:none}.euro{font-size:var(--px-price-ratio-l)}.decimals{font-size:var(--px-price-ratio-s)}.m{font-size:var(--price-m)}.l{font-size:var(--price-l)}", a = new CSSStyleSheet();
|
|
4
|
+
a.replaceSync(i);
|
|
5
|
+
var o = [
|
|
6
6
|
"default",
|
|
7
7
|
"promo",
|
|
8
8
|
"free",
|
|
9
9
|
"neutral",
|
|
10
10
|
"exceeding",
|
|
11
11
|
"disabled"
|
|
12
|
-
],
|
|
12
|
+
], s = [
|
|
13
13
|
"",
|
|
14
14
|
"s",
|
|
15
15
|
"m",
|
|
16
16
|
"l"
|
|
17
|
-
],
|
|
17
|
+
], c = class i extends e {
|
|
18
|
+
static {
|
|
19
|
+
this.template = t("<span class=\"price\"></span>");
|
|
20
|
+
}
|
|
18
21
|
static {
|
|
19
22
|
this.nativeName = "span";
|
|
20
23
|
}
|
|
21
24
|
constructor() {
|
|
22
|
-
super(
|
|
25
|
+
super(a), this.observer = null, this.buildPrice = () => {
|
|
23
26
|
let e = this.innerHTML.trim(), t = /^[\d|.|,]+/.test(e), n = "";
|
|
24
27
|
n = t ? "<span class=\"euro\">€</span>" : "";
|
|
25
28
|
let r = e.charAt(e.length - 3);
|
|
@@ -27,7 +30,7 @@ var i = [
|
|
|
27
30
|
let [t, i] = e.split(r);
|
|
28
31
|
this.$el.innerHTML = `${n}${t}<span class="decimals">${r}${i}</span>`;
|
|
29
32
|
} else this.$el.innerHTML = `${n}${e}`;
|
|
30
|
-
}, this.shadowRoot
|
|
33
|
+
}, r(this.shadowRoot, i.template);
|
|
31
34
|
}
|
|
32
35
|
static get observedAttributes() {
|
|
33
36
|
return [
|
|
@@ -49,10 +52,10 @@ var i = [
|
|
|
49
52
|
attributeChangedCallback(e, t, n) {
|
|
50
53
|
if (t !== n) switch (e) {
|
|
51
54
|
case "variant":
|
|
52
|
-
this.updateAttribute(e, t, n,
|
|
55
|
+
this.updateAttribute(e, t, n, o), this.buildPrice();
|
|
53
56
|
break;
|
|
54
57
|
case "size":
|
|
55
|
-
this.updateAttribute(e, t, n,
|
|
58
|
+
this.updateAttribute(e, t, n, s);
|
|
56
59
|
break;
|
|
57
60
|
default: super.attributeChangedCallback(e, t, n);
|
|
58
61
|
}
|
|
@@ -63,8 +66,8 @@ var i = [
|
|
|
63
66
|
toggleClass(e, t) {
|
|
64
67
|
e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(e), t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(t);
|
|
65
68
|
}
|
|
66
|
-
updateAttribute(e,
|
|
67
|
-
this.toggleClass(
|
|
69
|
+
updateAttribute(e, t, r, i) {
|
|
70
|
+
this.toggleClass(t, r), this.checkName(i, r) || n(`"${r}" is not a valid ${e} value for ${this.tagName.toLowerCase()}. Allowed values are: "${i.join("\", \"")}".`);
|
|
68
71
|
}
|
|
69
72
|
get variant() {
|
|
70
73
|
return this.getAttribute("variant");
|
|
@@ -85,6 +88,6 @@ var i = [
|
|
|
85
88
|
this._updateBooleanAttribute("inverted", e);
|
|
86
89
|
}
|
|
87
90
|
};
|
|
88
|
-
customElements.get("px-price") || customElements.define("px-price",
|
|
91
|
+
customElements.get("px-price") || customElements.define("px-price", c);
|
|
89
92
|
//#endregion
|
|
90
|
-
export {
|
|
93
|
+
export { c as Price, s as priceSizeValues, o as priceVariantValues };
|
package/dist/web-types.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://raw.githubusercontent.com/JetBrains/web-types/master/schema/web-types.json",
|
|
3
3
|
"name": "@proximus/lavender-price",
|
|
4
|
-
"version": "2.0.0-alpha.
|
|
4
|
+
"version": "2.0.0-alpha.204",
|
|
5
5
|
"description-markup": "markdown",
|
|
6
6
|
"contributions": {
|
|
7
7
|
"html": {
|
|
@@ -22,8 +22,7 @@
|
|
|
22
22
|
{ "name": "buildPrice" },
|
|
23
23
|
{ "name": "variant" },
|
|
24
24
|
{ "name": "size" },
|
|
25
|
-
{ "name": "inverted" }
|
|
26
|
-
{ "name": "innerHTML" }
|
|
25
|
+
{ "name": "inverted" }
|
|
27
26
|
],
|
|
28
27
|
"events": []
|
|
29
28
|
}
|