@proximus/lavender-skeleton 2.0.0-alpha.4 → 2.0.0-alpha.41

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.
Files changed (2) hide show
  1. package/dist/index.es.js +21 -25
  2. package/package.json +2 -2
package/dist/index.es.js CHANGED
@@ -1,7 +1,7 @@
1
- import { PxElement as l } from "@proximus/lavender-common";
2
- const d = ":host,:host>*{display:block;box-sizing:border-box}.skeleton-wrapper{display:flex;min-width:40px;flex-direction:column;align-items:flex-start;gap:10px;min-height:16px}.skeleton{border-radius:var(--px-radius-main);background-color:var(--px-color-background-state-disabled-default);align-self:stretch;height:16px;background-image:linear-gradient(-80deg,#0000,#0000 25%,#ffffff3d,#ffffff3d 55%,#0000 75%,#0000);background-size:200% 100%;animation:skeletonLoading 1.5s ease-in-out infinite}[inverted] .skeleton{background-color:var(--px-color-background-state-disabled-inverted);background-image:linear-gradient(-80deg,#fff0,#fff0 25%,#0000001a,#0000001a 55%,#fff0 75%,#fff0)}.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,.skeleton.body-block{height:16px}.skeleton.body-block:nth-of-type(3){width:180px}.skeleton.action-s,.skeleton.action-l{height:40px;border-radius:var(--px-radius-pill)}.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%}}", a = new CSSStyleSheet();
3
- a.replaceSync(d);
4
- const h = [
1
+ import { PxElement as l, log as d } from "@proximus/lavender-common";
2
+ const h = ":host,:host>*{display:block;box-sizing:border-box}.skeleton-wrapper{display:flex;min-width:40px;flex-direction:column;align-items:flex-start;gap:10px;min-height:16px}.skeleton{border-radius:var(--px-radius-main);background-color:var(--px-color-background-state-disabled-default);align-self:stretch;height:16px;background-image:linear-gradient(-80deg,#0000,#0000 25%,#ffffff3d,#ffffff3d 55%,#0000 75%,#0000);background-size:200% 100%;animation:skeletonLoading 1.5s ease-in-out infinite}[inverted] .skeleton{background-color:var(--px-color-background-state-disabled-inverted);background-image:linear-gradient(-80deg,#fff0,#fff0 25%,#0000001a,#0000001a 55%,#fff0 75%,#fff0)}.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,.skeleton.body-block{height:16px}.skeleton.body-block:nth-of-type(3){width:180px}.skeleton.action-s,.skeleton.action-l{height:40px;border-radius:var(--px-radius-pill)}.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%}}", o = new CSSStyleSheet();
3
+ o.replaceSync(h);
4
+ const c = [
5
5
  "heading-s",
6
6
  "heading-m",
7
7
  "heading-l",
@@ -12,9 +12,9 @@ const h = [
12
12
  "asset-s",
13
13
  "asset-l",
14
14
  "panel"
15
- ], o = class o extends l {
15
+ ], n = class n extends l {
16
16
  constructor() {
17
- super(a), this.template = () => `<div class="skeleton-wrapper">
17
+ super(o), this.template = () => `<div class="skeleton-wrapper">
18
18
  <div class="skeleton" aria-hidden="true"></div>
19
19
  <slot name="skeleton-text"></slot>
20
20
  </div>`, this.shadowRoot.innerHTML = this.template();
@@ -24,36 +24,32 @@ const h = [
24
24
  }
25
25
  connectedCallback() {
26
26
  this.hasAttribute("variant") || this.setAttribute("variant", "body");
27
- const e = this.shadowRoot.querySelector(
28
- 'slot[name="skeleton-text"]'
29
- );
30
- e && e.assignedNodes().length === 0 && console.error(
31
- 'The "skeleton-text" slot cannot be empty for accessibility. This text will only be visible to screen readers by adding `shown--sr` property to the slot.'
32
- );
33
27
  }
34
- attributeChangedCallback(e, n, t) {
35
- if (n !== t)
28
+ attributeChangedCallback(e, a, t) {
29
+ if (a !== t)
36
30
  switch (e) {
37
31
  case "variant":
38
32
  if (this.updateVariant(t), this.$el.querySelector(".skeleton").classList.toggle(`${t}`), t === "body-block") {
39
33
  const r = this.shadowRoot.querySelector(".skeleton-wrapper");
40
34
  Array.from({ length: 2 }, () => {
41
- const s = document.createElement("div");
42
- return s.className = "skeleton body-block", s.setAttribute("aria-hidden", "true"), s;
43
- }).forEach((s) => r.appendChild(s));
35
+ const i = document.createElement("div");
36
+ return i.className = "skeleton body-block", i.setAttribute("aria-hidden", "true"), i;
37
+ }).forEach((i) => r.appendChild(i));
44
38
  }
45
39
  break;
46
40
  case "inverted":
47
41
  this.$el.toggleAttribute("inverted", t !== null);
48
42
  break;
49
43
  default:
50
- super.attributeChangedCallback(e, n, t);
44
+ super.attributeChangedCallback(e, a, t);
51
45
  break;
52
46
  }
53
47
  }
54
48
  updateVariant(e) {
55
- if (!this.checkName(h, e)) {
56
- console.error(`${e} is not a valid variant value`);
49
+ if (!this.checkName(c, e)) {
50
+ d(
51
+ `${e} is not an allowed variant value for ${this.tagName.toLowerCase()}`
52
+ );
57
53
  return;
58
54
  }
59
55
  }
@@ -73,10 +69,10 @@ const h = [
73
69
  e ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
74
70
  }
75
71
  };
76
- o.nativeName = "div";
77
- let i = o;
78
- customElements.get("px-skeleton") || customElements.define("px-skeleton", i);
72
+ n.nativeName = "div";
73
+ let s = n;
74
+ customElements.get("px-skeleton") || customElements.define("px-skeleton", s);
79
75
  export {
80
- i as Skeleton,
81
- h as skeletonsVariantValues
76
+ s as Skeleton,
77
+ c as skeletonsVariantValues
82
78
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-skeleton",
3
- "version": "2.0.0-alpha.4",
3
+ "version": "2.0.0-alpha.41",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",
@@ -13,7 +13,7 @@
13
13
  "clean": "rm -rf dist",
14
14
  "build": "npm run clean && NODE_ENV=development vite build && tsc && npm run transform-package-json && npm run wc-manifest",
15
15
  "test": "vitest run --coverage",
16
- "wc-manifest": "cem analyze --globs \"src/*\" --config ../custom-elements-manifest.config.js --outdir dist"
16
+ "wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
17
17
  },
18
18
  "publishConfig": {
19
19
  "access": "public"