@proximus/lavender-layout 1.1.0-alpha.7 → 1.1.0-alpha.9

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.js +120 -118
  2. package/package.json +5 -3
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
- import { WithFlexAttributes as r, backgroundColorValues as l } from "@proximus/lavender-common";
2
- const p = ".flex-container{display:flex;height:100%;width:100%;box-sizing:border-box;flex-direction:var(--flex-direction--mobile-value);gap:var(--flex-gap-mobile-value);flex-wrap:var(--flex-wrap-mobile-value);justify-content:var(--flex-justify-content--mobile-value);align-items:var(--flex-align-items--mobile-value)}@media screen and (min-width: 768px){.flex-container{flex-direction:var(--flex-direction--tablet-value);gap:var(--flex-gap-tablet-value);flex-wrap:var(--flex-wrap-tablet-value);justify-content:var(--flex-justify-content--tablet-value);align-items:var(--flex-align-items--tablet-value)}}@media screen and (min-width: 1025px){.flex-container{flex-direction:var(--flex-direction--laptop-value);gap:var(--flex-gap-laptop-value);flex-wrap:var(--flex-wrap-laptop-value);justify-content:var(--flex-justify-content--laptop-value);align-items:var(--flex-align-items--laptop-value)}}@media screen and (min-width: 1441px){.flex-container{flex-direction:var(--flex-direction--desktop-value);gap:var(--flex-gap-desktop-value);flex-wrap:var(--flex-wrap-desktop-value);justify-content:var(--flex-justify-content--desktop-value);align-items:var(--flex-align-items--desktop-value)}}", o = new CSSStyleSheet();
3
- o.replaceSync(p);
4
- const c = [
1
+ import { WithFlexAttributes as l, backgroundColorValues as b } from "@proximus/lavender-common";
2
+ const u = ".flex-container{display:flex;height:100%;width:100%;box-sizing:border-box;flex-direction:var(--flex-direction--mobile-value);gap:var(--flex-gap--mobile-value);flex-wrap:var(--flex-wrap--mobile-value);justify-content:var(--flex-justify-content--mobile-value);align-items:var(--flex-align-items--mobile-value)}@media screen and (min-width: 768px){.flex-container{flex-direction:var(--flex-direction--tablet-value);gap:var(--flex-gap--tablet-value);flex-wrap:var(--flex-wrap--tablet-value);justify-content:var(--flex-justify-content--tablet-value);align-items:var(--flex-align-items--tablet-value)}}@media screen and (min-width: 1025px){.flex-container{flex-direction:var(--flex-direction--laptop-value);gap:var(--flex-gap--laptop-value);flex-wrap:var(--flex-wrap--laptop-value);justify-content:var(--flex-justify-content--laptop-value);align-items:var(--flex-align-items--laptop-value)}}@media screen and (min-width: 1441px){.flex-container{flex-direction:var(--flex-direction--desktop-value);gap:var(--flex-gap--desktop-value);flex-wrap:var(--flex-wrap--desktop-value);justify-content:var(--flex-justify-content--desktop-value);align-items:var(--flex-align-items--desktop-value)}}", d = new CSSStyleSheet();
3
+ d.replaceSync(u);
4
+ const h = [
5
5
  "after-element-none",
6
6
  "after-element-2xs",
7
7
  "after-element-xs",
@@ -16,15 +16,39 @@ const c = [
16
16
  "inside-section-default",
17
17
  "inside-section-l",
18
18
  "between-sections"
19
- ];
20
- class s extends r {
19
+ ], x = [
20
+ "",
21
+ "default",
22
+ "row",
23
+ "row-reverse",
24
+ "column",
25
+ "column-reverse"
26
+ ], m = [
27
+ "",
28
+ "default",
29
+ "stretch",
30
+ "flex-start",
31
+ "flex-end",
32
+ "center",
33
+ "baseline"
34
+ ], f = [
35
+ "",
36
+ "default",
37
+ "flex-start",
38
+ "flex-end",
39
+ "center",
40
+ "space-between",
41
+ "space-around",
42
+ "space-evenly"
43
+ ], k = ["", "default", "nowrap", "wrap", "wrap-reverse"];
44
+ class p extends l {
21
45
  constructor() {
22
- super(o), this.template = `<div class="flex-container">
46
+ super(d), this.template = `<div class="flex-container">
23
47
  <slot></slot>
24
48
  </div>`, this.shadowRoot.innerHTML = this.template;
25
49
  }
26
50
  connectedCallback() {
27
- this.hasAttribute("direction") || (this.direction = "row");
51
+ this.hasAttribute("direction") || (this.direction = "row"), this.hasAttribute("gap") || (this.gap = "inside-section-none"), this.hasAttribute("align-items") || (this.alignItems = "stretch"), this.hasAttribute("justify-content") || (this.justifyContent = "flex-start"), this.hasAttribute("wrap") || (this.wrap = "nowrap");
28
52
  }
29
53
  static get observedAttributes() {
30
54
  return [
@@ -35,6 +59,10 @@ class s extends r {
35
59
  "direction--laptop",
36
60
  "direction--desktop",
37
61
  "gap",
62
+ "gap--mobile",
63
+ "gap--tablet",
64
+ "gap--laptop",
65
+ "gap--desktop",
38
66
  "justify-content",
39
67
  "justify-content--mobile",
40
68
  "justify-content--tablet",
@@ -46,112 +74,82 @@ class s extends r {
46
74
  "align-items--laptop",
47
75
  "align-items--desktop",
48
76
  "wrap",
49
- "wrap-mobile",
50
- "wrap-tablet",
51
- "wrap-laptop",
52
- "wrap-desktop"
77
+ "wrap--mobile",
78
+ "wrap--tablet",
79
+ "wrap--laptop",
80
+ "wrap--desktop"
53
81
  ];
54
82
  }
55
83
  attributeChangedCallback(t, i, e) {
56
- if (t.indexOf("direction") > -1 && !["column", "row"].includes(e))
57
- throw new Error("Invalid direction");
58
84
  switch (t) {
59
85
  case "gap":
60
- this.$el.style.setProperty(
61
- "--flex-gap-mobile-value",
62
- this.getGapCSSVariable(e, "mobile")
63
- ), this.$el.style.setProperty(
64
- "--flex-gap-tablet-value",
65
- this.getGapCSSVariable(e, "tablet")
66
- ), this.$el.style.setProperty(
67
- "--flex-gap-laptop-value",
68
- this.getGapCSSVariable(e, "desktop")
69
- ), this.$el.style.setProperty(
70
- "--flex-gap-desktop-value",
71
- this.getGapCSSVariable(e, "desktop")
72
- );
73
- break;
74
- case "direction":
75
- this.$el.style.getPropertyValue("--flex-direction--mobile-value") || this.$el.style.setProperty(
76
- "--flex-direction--mobile-value",
77
- e
78
- ), this.$el.style.getPropertyValue("--flex-direction--tablet-value") || this.$el.style.setProperty(
79
- "--flex-direction--tablet-value",
80
- e
81
- ), this.$el.style.getPropertyValue("--flex-direction--laptop-value") || this.$el.style.setProperty(
82
- "--flex-direction--laptop-value",
83
- e
84
- ), this.$el.style.getPropertyValue("--flex-direction--desktop-value") || this.$el.style.setProperty(
85
- "--flex-direction--desktop-value",
86
- e
87
- );
86
+ case "gap--mobile":
87
+ case "gap--tablet":
88
+ case "gap--laptop":
89
+ case "gap--desktop":
90
+ this.updateFlexProperties(t, i, e, h);
88
91
  break;
89
92
  case "justify-content":
90
- this.$el.style.getPropertyValue(
91
- "--flex-justify-content--mobile-value"
92
- ) || this.$el.style.setProperty(
93
- "--flex-justify-content--mobile-value",
94
- e
95
- ), this.$el.style.getPropertyValue(
96
- "--flex-justify-content--tablet-value"
97
- ) || this.$el.style.setProperty(
98
- "--flex-justify-content--tablet-value",
99
- e
100
- ), this.$el.style.getPropertyValue(
101
- "--flex-justify-content--laptop-value"
102
- ) || this.$el.style.setProperty(
103
- "--flex-justify-content--laptop-value",
104
- e
105
- ), this.$el.style.getPropertyValue(
106
- "--flex-justify-content--desktop-value"
107
- ) || this.$el.style.setProperty(
108
- "--flex-justify-content--desktop-value",
109
- e
93
+ case "justify-content--mobile":
94
+ case "justify-content--tablet":
95
+ case "justify-content--laptop":
96
+ case "justify-content--desktop":
97
+ this.updateFlexProperties(
98
+ t,
99
+ i,
100
+ e,
101
+ f
110
102
  );
111
103
  break;
112
104
  case "align-items":
113
- this.$el.style.getPropertyValue("--flex-align-items--mobile-value") || this.$el.style.setProperty(
114
- "--flex-align-items--mobile-value",
115
- e
116
- ), this.$el.style.getPropertyValue("--flex-align-items--tablet-value") || this.$el.style.setProperty(
117
- "--flex-align-items--tablet-value",
118
- e
119
- ), this.$el.style.getPropertyValue("--flex-align-items--laptop-value") || this.$el.style.setProperty(
120
- "--flex-align-items--laptop-value",
121
- e
122
- ), this.$el.style.getPropertyValue("--flex-align-items--desktop-value") || this.$el.style.setProperty(
123
- "--flex-align-items--desktop-value",
124
- e
125
- );
105
+ case "align-items--mobile":
106
+ case "align-items--tablet":
107
+ case "align-items--laptop":
108
+ case "align-items--desktop":
109
+ this.updateFlexProperties(t, i, e, m);
126
110
  break;
127
111
  case "wrap":
128
- this.$el.style.getPropertyValue("--flex-wrap-mobile-value") || this.$el.style.setProperty("--flex-wrap-mobile-value", e), this.$el.style.getPropertyValue("--flex-wrap-tablet-value") || this.$el.style.setProperty("--flex-wrap-tablet-value", e), this.$el.style.getPropertyValue("--flex-wrap-laptop-value") || this.$el.style.setProperty("--flex-wrap-laptop-value", e), this.$el.style.getPropertyValue("--flex-wrap-desktop-value") || this.$el.style.setProperty("--flex-wrap-desktop-value", e);
112
+ case "wrap--mobile":
113
+ case "wrap--tablet":
114
+ case "wrap--laptop":
115
+ case "wrap--desktop":
116
+ this.updateFlexProperties(t, i, e, k);
129
117
  break;
118
+ case "direction":
130
119
  case "direction--mobile":
131
120
  case "direction--tablet":
132
121
  case "direction--laptop":
133
122
  case "direction--desktop":
134
- case "justify-content--mobile":
135
- case "justify-content--tablet":
136
- case "justify-content--laptop":
137
- case "justify-content--desktop":
138
- case "align-items--mobile":
139
- case "align-items--tablet":
140
- case "align-items--laptop":
141
- case "align-items--desktop":
142
- case "wrap-mobile":
143
- case "wrap-tablet":
144
- case "wrap-laptop":
145
- case "wrap-desktop":
146
- this.$el.style.setProperty(`--flex-${t}-value`, e);
123
+ this.updateFlexProperties(t, i, e, x);
147
124
  break;
148
125
  default:
149
126
  super.attributeChangedCallback(t, i, e);
150
127
  break;
151
128
  }
152
129
  }
153
- getGapCSSVariable(t, i = "mobile") {
154
- return c.includes(t) ? `var(--px-spacing-${t}-${i})` : t;
130
+ updateFlexProperties(t, i, e, s) {
131
+ this.checkName(s, e) || console.error(`Bad ${t} value for`, this.$el);
132
+ const c = t.indexOf("--") > -1, a = c ? t.split("--")[0] : t, r = [];
133
+ if (!c)
134
+ this.getAttribute(a + "--mobile") || r.push("mobile"), this.getAttribute(a + "--tablet") || r.push("tablet"), this.getAttribute(a + "--laptop") || r.push("laptop"), this.getAttribute(a + "--desktop") || r.push("desktop"), r.forEach((o) => {
135
+ this.updateStyle(a, o, i, s), this.updateStyle(a, o, e, s);
136
+ });
137
+ else {
138
+ const o = t.split("--")[1];
139
+ this.updateStyle(a, o, i, s), this.updateStyle(a, o, e, s);
140
+ }
141
+ }
142
+ updateStyle(t, i, e, s) {
143
+ e !== null && e !== "" && e !== "default" && (t === "gap" && s.includes(e) ? this.$el.style.setProperty(
144
+ `--flex-${t}--${i}-value`,
145
+ `var(--px-spacing-${e}-${i === "laptop" ? "desktop" : i})`
146
+ ) : this.$el.style.setProperty(
147
+ `--flex-${t}--${i}-value`,
148
+ e
149
+ ));
150
+ }
151
+ checkName(t, i) {
152
+ return t.includes(i);
155
153
  }
156
154
  get direction() {
157
155
  return this.getAttribute("direction");
@@ -274,35 +272,35 @@ class s extends r {
274
272
  this.setAttribute("wrap", t);
275
273
  }
276
274
  get wrapMobile() {
277
- return this.getAttribute("wrap-mobile");
275
+ return this.getAttribute("wrap--mobile");
278
276
  }
279
277
  set wrapMobile(t) {
280
- this.setAttribute("wrap-mobile", t);
278
+ this.setAttribute("wrap--mobile", t);
281
279
  }
282
280
  get wrapTablet() {
283
- return this.getAttribute("wrap-tablet");
281
+ return this.getAttribute("wrap--tablet");
284
282
  }
285
283
  set wrapTablet(t) {
286
- this.setAttribute("wrap-tablet", t);
284
+ this.setAttribute("wrap--tablet", t);
287
285
  }
288
286
  get wrapLaptop() {
289
- return this.getAttribute("wrap-laptop");
287
+ return this.getAttribute("wrap--laptop");
290
288
  }
291
289
  set wrapLaptop(t) {
292
- this.setAttribute("wrap-laptop", t);
290
+ this.setAttribute("wrap--laptop", t);
293
291
  }
294
292
  get wrapDesktop() {
295
- return this.getAttribute("wrap-desktop");
293
+ return this.getAttribute("wrap--desktop");
296
294
  }
297
295
  set wrapDesktop(t) {
298
- this.setAttribute("wrap-desktop", t);
296
+ this.setAttribute("wrap--desktop", t);
299
297
  }
300
298
  get $el() {
301
299
  return this.shadowRoot.querySelector(".flex-container");
302
300
  }
303
301
  }
304
- customElements.get("px-stack") || customElements.define("px-stack", s);
305
- class d extends s {
302
+ customElements.get("px-stack") || customElements.define("px-stack", p);
303
+ class y extends p {
306
304
  constructor() {
307
305
  super();
308
306
  }
@@ -310,8 +308,8 @@ class d extends s {
310
308
  super.connectedCallback(), this.direction = "column", this.directionMobile = "column", this.directionTablet = "column", this.directionLaptop = "column", this.directionDesktop = "column";
311
309
  }
312
310
  }
313
- customElements.get("px-vstack") || customElements.define("px-vstack", d);
314
- class g extends s {
311
+ customElements.get("px-vstack") || customElements.define("px-vstack", y);
312
+ class A extends p {
315
313
  constructor() {
316
314
  super();
317
315
  }
@@ -319,8 +317,8 @@ class g extends s {
319
317
  super.connectedCallback(), this.direction = "row", this.directionMobile = "row", this.directionTablet = "row", this.directionLaptop = "row", this.directionDesktop = "row";
320
318
  }
321
319
  }
322
- customElements.get("px-hstack") || customElements.define("px-hstack", g);
323
- class u extends HTMLElement {
320
+ customElements.get("px-hstack") || customElements.define("px-hstack", A);
321
+ class v extends HTMLElement {
324
322
  constructor() {
325
323
  super();
326
324
  }
@@ -340,12 +338,12 @@ class u extends HTMLElement {
340
338
  this.setAttribute("grow", t);
341
339
  }
342
340
  }
343
- customElements.define("px-spacer", u);
344
- const b = ":host{display:block;box-sizing:border-box}slot[name=body-container]{min-height:100vh}#image-sticky-box{margin-top:-2.5rem}", n = new CSSStyleSheet();
345
- n.replaceSync(b);
346
- class h extends r {
341
+ customElements.define("px-spacer", v);
342
+ const w = ":host{display:block;box-sizing:border-box}slot[name=body-container]{min-height:100vh}#image-sticky-box{margin-top:-2.5rem}", g = new CSSStyleSheet();
343
+ g.replaceSync(w);
344
+ class C extends l {
347
345
  constructor() {
348
- super(n), this.template = (t) => `
346
+ super(g), this.template = (t) => `
349
347
  <px-container border-radius="none" padding="none">
350
348
  <px-vstack>
351
349
  <px-container id="header-container" border-radius="none">
@@ -522,7 +520,7 @@ class h extends r {
522
520
  case "background-color":
523
521
  this.$bodyContainer.setAttribute(
524
522
  "background-color",
525
- l.indexOf(e) > 0 ? e : "none"
523
+ b.indexOf(e) > 0 ? e : "none"
526
524
  );
527
525
  break;
528
526
  case "padding-vertical":
@@ -542,12 +540,16 @@ class h extends r {
542
540
  this.$headerContainer.paddingLeft = t, this.$headerContainer.paddingRight = t, this.$bodyContainer.paddingLeft = t, this.$bodyContainer.paddingRight = t, this.$contactContainer.paddingLeft = t, this.$contactContainer.paddingRight = t, this.$footerContainer.paddingLeft = t, this.$footerContainer.paddingRight = t, this.$imageContainer.paddingLeft = t, this.$imageContainer.paddingRight = t;
543
541
  }
544
542
  }
545
- customElements.get("px-page") === void 0 && customElements.define("px-page", h);
543
+ customElements.get("px-page") === void 0 && customElements.define("px-page", C);
546
544
  export {
547
- g as HStack,
548
- h as Page,
549
- u as Spacer,
550
- s as Stack,
551
- d as VStack,
552
- c as gapValues
545
+ A as HStack,
546
+ C as Page,
547
+ v as Spacer,
548
+ p as Stack,
549
+ y as VStack,
550
+ m as alignItemsValues,
551
+ x as directionValues,
552
+ h as gapValues,
553
+ f as justifyContentValues,
554
+ k as wrapValues
553
555
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-layout",
3
- "version": "1.1.0-alpha.7",
3
+ "version": "1.1.0-alpha.9",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "exports": {
@@ -24,7 +24,7 @@
24
24
  "publishConfig": {
25
25
  "access": "public"
26
26
  },
27
- "gitHead": "671fab7ee21d1c0ec6498b45b0bb2fd47e6e6c84",
27
+ "gitHead": "b4be1f903f3a005cd365b10b9d0c15dad930371e",
28
28
  "lerna": {
29
29
  "command": {
30
30
  "publish": {
@@ -32,7 +32,9 @@
32
32
  "CHANGELOG.md",
33
33
  "package.json",
34
34
  "dist/*.js",
35
- "dist/css/**/*.css"
35
+ "dist/*.cjs",
36
+ "dist/css/**/*.css",
37
+ "dist/js/**/*.js"
36
38
  ]
37
39
  }
38
40
  }