@proximus/lavender-skeleton 1.4.14-beta.2 → 1.4.15-alpha.2
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/Skeleton.d.ts +2 -2
- package/dist/index.es.js +69 -77
- package/package.json +1 -1
package/dist/Skeleton.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export declare class Skeleton extends PxElement<HTMLDivElement> {
|
|
|
10
10
|
attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
|
|
11
11
|
updateVariant(variant: string): void;
|
|
12
12
|
get $container(): Container;
|
|
13
|
-
get variant(): string;
|
|
14
|
-
set variant(value: string);
|
|
13
|
+
get variant(): string | null;
|
|
14
|
+
set variant(value: string | null);
|
|
15
15
|
get inverted(): boolean;
|
|
16
16
|
set inverted(value: boolean);
|
|
17
17
|
}
|
package/dist/index.es.js
CHANGED
|
@@ -1,78 +1,70 @@
|
|
|
1
|
-
import { PxElement 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
|
-
set inverted(e) {
|
|
69
|
-
e ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
a.nativeName = "div";
|
|
73
|
-
let s = a;
|
|
74
|
-
customElements.get("px-skeleton") || customElements.define("px-skeleton", s);
|
|
75
|
-
export {
|
|
76
|
-
s as Skeleton,
|
|
77
|
-
o as skeletonsVariantValues
|
|
1
|
+
import { PxElement as e, log as t } from "@proximus/lavender-common";
|
|
2
|
+
//#region src/skeleton.css?inline
|
|
3
|
+
var n = ":host,:host>*{box-sizing:border-box;display:block}.skeleton-wrapper{flex-direction:column;align-items:flex-start;gap:10px;min-width:40px;min-height:16px;display:flex}.skeleton{border-radius:var(--px-radius-main);background-color:var(--px-color-background-state-disabled-default);background-image:linear-gradient(-80deg,#0000 0% 25%,#ffffff3d 40% 55%,#0000 75% 100%);background-size:200% 100%;align-self:stretch;height:16px;animation:1.5s ease-in-out infinite skeletonLoading}[inverted] .skeleton{background-color:var(--px-color-background-state-disabled-inverted);background-image:linear-gradient(-80deg,#fff0 0% 25%,#0000001a 40% 55%,#fff0 75% 100%)}.skeleton.heading-s,.skeleton.heading-m,.skeleton.heading-l{max-width:240px}.skeleton.heading-s{height:24px}.skeleton.heading-m{height:32px}.skeleton.heading-l{height:40px}.skeleton.body,.skeleton.body-block{width:300px}.skeleton.body{height:16px}.skeleton.body-block{height:16px}.skeleton.body-block:nth-of-type(3){width:180px}.skeleton.action-s,.skeleton.action-l{border-radius:var(--px-radius-pill);height:40px}.skeleton.action-s{width:40px}.skeleton.action-l{width:160px}.skeleton.asset-s{width:40px;height:40px}.skeleton.asset-l{width:80px;height:80px}.skeleton.panel{width:300px;height:200px}@keyframes skeletonLoading{0%{background-position-x:150%}40%{background-position-x:-50%}to{background-position-x:-50%}}", r = new CSSStyleSheet();
|
|
4
|
+
r.replaceSync(n);
|
|
5
|
+
var i = [
|
|
6
|
+
"heading-s",
|
|
7
|
+
"heading-m",
|
|
8
|
+
"heading-l",
|
|
9
|
+
"body",
|
|
10
|
+
"body-block",
|
|
11
|
+
"action-s",
|
|
12
|
+
"action-l",
|
|
13
|
+
"asset-s",
|
|
14
|
+
"asset-l",
|
|
15
|
+
"panel"
|
|
16
|
+
], a = class extends e {
|
|
17
|
+
static {
|
|
18
|
+
this.nativeName = "div";
|
|
19
|
+
}
|
|
20
|
+
constructor() {
|
|
21
|
+
super(r), this.template = () => "<div class=\"skeleton-wrapper\">\n <div class=\"skeleton\" aria-hidden=\"true\"></div>\n <slot name=\"skeleton-text\"></slot>\n </div>", this.shadowRoot.innerHTML = this.template();
|
|
22
|
+
}
|
|
23
|
+
static get observedAttributes() {
|
|
24
|
+
return ["variant", "inverted"];
|
|
25
|
+
}
|
|
26
|
+
connectedCallback() {
|
|
27
|
+
this.hasAttribute("variant") || this.setAttribute("variant", "body");
|
|
28
|
+
}
|
|
29
|
+
attributeChangedCallback(e, t, n) {
|
|
30
|
+
if (t !== n) switch (e) {
|
|
31
|
+
case "variant":
|
|
32
|
+
if (this.updateVariant(n), this.$el?.querySelector(".skeleton")?.classList.toggle(`${n}`), n === "body-block") {
|
|
33
|
+
let e = this.shadowRoot.querySelector(".skeleton-wrapper");
|
|
34
|
+
Array.from({ length: 2 }, () => {
|
|
35
|
+
let e = document.createElement("div");
|
|
36
|
+
return e.className = "skeleton body-block", e.setAttribute("aria-hidden", "true"), e;
|
|
37
|
+
}).forEach((t) => e?.appendChild(t));
|
|
38
|
+
}
|
|
39
|
+
break;
|
|
40
|
+
case "inverted":
|
|
41
|
+
this.$el?.toggleAttribute("inverted", n !== null);
|
|
42
|
+
break;
|
|
43
|
+
default: super.attributeChangedCallback(e, t, n);
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
updateVariant(e) {
|
|
47
|
+
if (!this.checkName(i, e)) {
|
|
48
|
+
t(`"${e}" is not a valid variant value for ${this.tagName.toLowerCase()}. Allowed values are: "${i.join("\", \"")}".`);
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
get $container() {
|
|
53
|
+
return this.shadowRoot.querySelector("px-container");
|
|
54
|
+
}
|
|
55
|
+
get variant() {
|
|
56
|
+
return this.getAttribute("variant");
|
|
57
|
+
}
|
|
58
|
+
set variant(e) {
|
|
59
|
+
this._updateAttribute("variant", e);
|
|
60
|
+
}
|
|
61
|
+
get inverted() {
|
|
62
|
+
return this.hasAttribute("inverted");
|
|
63
|
+
}
|
|
64
|
+
set inverted(e) {
|
|
65
|
+
this._updateBooleanAttribute("inverted", e);
|
|
66
|
+
}
|
|
78
67
|
};
|
|
68
|
+
customElements.get("px-skeleton") || customElements.define("px-skeleton", a);
|
|
69
|
+
//#endregion
|
|
70
|
+
export { a as Skeleton, i as skeletonsVariantValues };
|