@proximus/lavender-patch 1.0.0-alpha.19
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.js +75 -0
- package/package.json +40 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
const o = ".patch{display:inline-flex;align-items:center;padding:0 var(--px-padding-s);height:1.625rem;border:var(--px-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:700;font-size:var(--px-text-size-base-mobile);line-height:var(--px-line-height-m);text-align:center;background-color:var(--px-color-bg-promo-default);color:var(--px-color-txt-primary-inverted)}.patch,.patch *{box-sizing:border-box}@media only screen and (min-width: 768px){.patch{font-size:var(--px-text-size-base-tablet)}}@media only screen and (min-width: 1025px){.patch{font-size:var(--px-text-size-base-desktop)}}:host([inverted]) .patch{background-color:var(--px-color-bg-promo-inverted);color:var(--px-color-txt-primary-inverted)}.bottom-right{border-radius:var(--px-radius-patch-big) var(--px-radius-patch-big) var(--px-radius-patch-small) var(--px-radius-patch-big)}.bottom-left{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-illu-blue-core);color:var(--px-color-txt-body-default)}:host([inverted]) .info{background-color:var(--px-color-illu-blue-core);color:var(--px-color-txt-body-default)}.black-friday{background-color:var(--px-color-bg-container-rich-default);color:var(--px-color-txt-inverted-default)}:host([inverted]) .black-friday{background-color:var(--px-color-bg-container-rich-inverted);color:var(--px-color-txt-inverted-inverted)}.eco{background-color:var(--px-color-bg-success-default);color:var(--px-color-txt-inverted-default)}:host([inverted]) .eco{background-color:var(--px-color-bg-success-inverted);color:var(--px-color-txt-inverted-inverted)}.greyed{background-color:var(--px-color-bg-action-disabled-default);color:var(--px-color-icon-disabled-default)}:host([inverted]) .greyed{background-color:var(--px-color-bg-action-disabled-inverted);color:var(--px-color-icon-disabled-inverted)}", a = new CSSStyleSheet();
|
|
2
|
+
a.replaceSync(o);
|
|
3
|
+
const i = [
|
|
4
|
+
"",
|
|
5
|
+
"default",
|
|
6
|
+
"info",
|
|
7
|
+
"black-friday",
|
|
8
|
+
"eco",
|
|
9
|
+
"greyed"
|
|
10
|
+
], s = ["", "default", "bottom-right", "bottom-left"];
|
|
11
|
+
class c extends HTMLElement {
|
|
12
|
+
template() {
|
|
13
|
+
return `
|
|
14
|
+
<div class="patch">
|
|
15
|
+
<slot></slot>
|
|
16
|
+
</div>
|
|
17
|
+
`;
|
|
18
|
+
}
|
|
19
|
+
constructor() {
|
|
20
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [a];
|
|
21
|
+
}
|
|
22
|
+
static get observedAttributes() {
|
|
23
|
+
return ["variant", "shape", "inverted"];
|
|
24
|
+
}
|
|
25
|
+
attributeChangedCallback(t, r, e) {
|
|
26
|
+
if (r !== e)
|
|
27
|
+
switch (t) {
|
|
28
|
+
case "variant":
|
|
29
|
+
this.updateVariant(r, e);
|
|
30
|
+
break;
|
|
31
|
+
case "shape":
|
|
32
|
+
this.updateShape(r, e);
|
|
33
|
+
break;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
_toggleClass(t, r) {
|
|
37
|
+
t !== null && t !== "" && t !== "default" && this.$el.classList.toggle(t), r !== null && r !== "" && r !== "default" && this.$el.classList.toggle(r);
|
|
38
|
+
}
|
|
39
|
+
checkName(t, r) {
|
|
40
|
+
return t.includes(r);
|
|
41
|
+
}
|
|
42
|
+
updateVariant(t, r) {
|
|
43
|
+
this._toggleClass(t, r), this.checkName(i, r) || console.error('Bad "variant" value for patch');
|
|
44
|
+
}
|
|
45
|
+
updateShape(t, r) {
|
|
46
|
+
this._toggleClass(t, r), this.checkName(s, r) || console.error('Bad "shape" value for patch');
|
|
47
|
+
}
|
|
48
|
+
get $el() {
|
|
49
|
+
return this.shadowRoot.querySelector(".patch");
|
|
50
|
+
}
|
|
51
|
+
get variant() {
|
|
52
|
+
return this.getAttribute("variant");
|
|
53
|
+
}
|
|
54
|
+
set variant(t) {
|
|
55
|
+
this.setAttribute("variant", t);
|
|
56
|
+
}
|
|
57
|
+
get shape() {
|
|
58
|
+
return this.getAttribute("shape");
|
|
59
|
+
}
|
|
60
|
+
set shape(t) {
|
|
61
|
+
this.setAttribute("shape", t);
|
|
62
|
+
}
|
|
63
|
+
get inverted() {
|
|
64
|
+
return this.getAttribute("inverted");
|
|
65
|
+
}
|
|
66
|
+
set inverted(t) {
|
|
67
|
+
this.setAttribute("inverted", t);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
customElements.get("px-patch") || customElements.define("px-patch", c);
|
|
71
|
+
export {
|
|
72
|
+
c as Patch,
|
|
73
|
+
s as shapeValues,
|
|
74
|
+
i as variantValues
|
|
75
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-patch",
|
|
3
|
+
"version": "1.0.0-alpha.19",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.ts",
|
|
9
|
+
"development": "./src/index.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./src/*.css": {
|
|
13
|
+
"development": "src/*.css"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rm -rf dist;tsc; vite build",
|
|
22
|
+
"test": "vitest run --coverage"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"gitHead": "15a231df98020f83813279639a9a7712a5a5e759",
|
|
28
|
+
"lerna": {
|
|
29
|
+
"command": {
|
|
30
|
+
"publish": {
|
|
31
|
+
"assets": [
|
|
32
|
+
"CHANGELOG.md",
|
|
33
|
+
"package.json",
|
|
34
|
+
"dist/*.js",
|
|
35
|
+
"dist/css/**/*.css"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|