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

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 -116
  2. package/package.json +2 -2
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,10 +74,10 @@ 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) {
@@ -57,101 +85,73 @@ class s extends r {
57
85
  throw new Error("Invalid direction");
58
86
  switch (t) {
59
87
  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
- );
88
+ case "gap--mobile":
89
+ case "gap--tablet":
90
+ case "gap--laptop":
91
+ case "gap--desktop":
92
+ this.updateFlexProperties(t, i, e, h);
88
93
  break;
89
94
  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
95
+ case "justify-content--mobile":
96
+ case "justify-content--tablet":
97
+ case "justify-content--laptop":
98
+ case "justify-content--desktop":
99
+ this.updateFlexProperties(
100
+ t,
101
+ i,
102
+ e,
103
+ f
110
104
  );
111
105
  break;
112
106
  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
- );
107
+ case "align-items--mobile":
108
+ case "align-items--tablet":
109
+ case "align-items--laptop":
110
+ case "align-items--desktop":
111
+ this.updateFlexProperties(t, i, e, m);
126
112
  break;
127
113
  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);
114
+ case "wrap--mobile":
115
+ case "wrap--tablet":
116
+ case "wrap--laptop":
117
+ case "wrap--desktop":
118
+ this.updateFlexProperties(t, i, e, k);
129
119
  break;
120
+ case "direction":
130
121
  case "direction--mobile":
131
122
  case "direction--tablet":
132
123
  case "direction--laptop":
133
124
  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);
125
+ this.updateFlexProperties(t, i, e, x);
147
126
  break;
148
127
  default:
149
128
  super.attributeChangedCallback(t, i, e);
150
129
  break;
151
130
  }
152
131
  }
153
- getGapCSSVariable(t, i = "mobile") {
154
- return c.includes(t) ? `var(--px-spacing-${t}-${i})` : t;
132
+ updateFlexProperties(t, i, e, s) {
133
+ this.checkName(s, e) || console.error(`Bad ${t} value for`, this.$el);
134
+ const c = t.indexOf("--") > -1, a = c ? t.split("--")[0] : t, r = [];
135
+ if (!c)
136
+ 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) => {
137
+ this.updateStyle(a, o, i, s), this.updateStyle(a, o, e, s);
138
+ });
139
+ else {
140
+ const o = t.split("--")[1];
141
+ this.updateStyle(a, o, i, s), this.updateStyle(a, o, e, s);
142
+ }
143
+ }
144
+ updateStyle(t, i, e, s) {
145
+ e !== null && e !== "" && e !== "default" && (t === "gap" && s.includes(e) ? this.$el.style.setProperty(
146
+ `--flex-${t}--${i}-value`,
147
+ `var(--px-spacing-${e}-${i === "laptop" ? "desktop" : i})`
148
+ ) : this.$el.style.setProperty(
149
+ `--flex-${t}--${i}-value`,
150
+ e
151
+ ));
152
+ }
153
+ checkName(t, i) {
154
+ return t.includes(i);
155
155
  }
156
156
  get direction() {
157
157
  return this.getAttribute("direction");
@@ -274,35 +274,35 @@ class s extends r {
274
274
  this.setAttribute("wrap", t);
275
275
  }
276
276
  get wrapMobile() {
277
- return this.getAttribute("wrap-mobile");
277
+ return this.getAttribute("wrap--mobile");
278
278
  }
279
279
  set wrapMobile(t) {
280
- this.setAttribute("wrap-mobile", t);
280
+ this.setAttribute("wrap--mobile", t);
281
281
  }
282
282
  get wrapTablet() {
283
- return this.getAttribute("wrap-tablet");
283
+ return this.getAttribute("wrap--tablet");
284
284
  }
285
285
  set wrapTablet(t) {
286
- this.setAttribute("wrap-tablet", t);
286
+ this.setAttribute("wrap--tablet", t);
287
287
  }
288
288
  get wrapLaptop() {
289
- return this.getAttribute("wrap-laptop");
289
+ return this.getAttribute("wrap--laptop");
290
290
  }
291
291
  set wrapLaptop(t) {
292
- this.setAttribute("wrap-laptop", t);
292
+ this.setAttribute("wrap--laptop", t);
293
293
  }
294
294
  get wrapDesktop() {
295
- return this.getAttribute("wrap-desktop");
295
+ return this.getAttribute("wrap--desktop");
296
296
  }
297
297
  set wrapDesktop(t) {
298
- this.setAttribute("wrap-desktop", t);
298
+ this.setAttribute("wrap--desktop", t);
299
299
  }
300
300
  get $el() {
301
301
  return this.shadowRoot.querySelector(".flex-container");
302
302
  }
303
303
  }
304
- customElements.get("px-stack") || customElements.define("px-stack", s);
305
- class d extends s {
304
+ customElements.get("px-stack") || customElements.define("px-stack", p);
305
+ class y extends p {
306
306
  constructor() {
307
307
  super();
308
308
  }
@@ -310,8 +310,8 @@ class d extends s {
310
310
  super.connectedCallback(), this.direction = "column", this.directionMobile = "column", this.directionTablet = "column", this.directionLaptop = "column", this.directionDesktop = "column";
311
311
  }
312
312
  }
313
- customElements.get("px-vstack") || customElements.define("px-vstack", d);
314
- class g extends s {
313
+ customElements.get("px-vstack") || customElements.define("px-vstack", y);
314
+ class A extends p {
315
315
  constructor() {
316
316
  super();
317
317
  }
@@ -319,8 +319,8 @@ class g extends s {
319
319
  super.connectedCallback(), this.direction = "row", this.directionMobile = "row", this.directionTablet = "row", this.directionLaptop = "row", this.directionDesktop = "row";
320
320
  }
321
321
  }
322
- customElements.get("px-hstack") || customElements.define("px-hstack", g);
323
- class u extends HTMLElement {
322
+ customElements.get("px-hstack") || customElements.define("px-hstack", A);
323
+ class v extends HTMLElement {
324
324
  constructor() {
325
325
  super();
326
326
  }
@@ -340,12 +340,12 @@ class u extends HTMLElement {
340
340
  this.setAttribute("grow", t);
341
341
  }
342
342
  }
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 {
343
+ customElements.define("px-spacer", v);
344
+ 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();
345
+ g.replaceSync(w);
346
+ class C extends l {
347
347
  constructor() {
348
- super(n), this.template = (t) => `
348
+ super(g), this.template = (t) => `
349
349
  <px-container border-radius="none" padding="none">
350
350
  <px-vstack>
351
351
  <px-container id="header-container" border-radius="none">
@@ -522,7 +522,7 @@ class h extends r {
522
522
  case "background-color":
523
523
  this.$bodyContainer.setAttribute(
524
524
  "background-color",
525
- l.indexOf(e) > 0 ? e : "none"
525
+ b.indexOf(e) > 0 ? e : "none"
526
526
  );
527
527
  break;
528
528
  case "padding-vertical":
@@ -542,12 +542,16 @@ class h extends r {
542
542
  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
543
  }
544
544
  }
545
- customElements.get("px-page") === void 0 && customElements.define("px-page", h);
545
+ customElements.get("px-page") === void 0 && customElements.define("px-page", C);
546
546
  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
547
+ A as HStack,
548
+ C as Page,
549
+ v as Spacer,
550
+ p as Stack,
551
+ y as VStack,
552
+ m as alignItemsValues,
553
+ x as directionValues,
554
+ h as gapValues,
555
+ f as justifyContentValues,
556
+ k as wrapValues
553
557
  };
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.8",
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": "74b23a0ad9d5ab4f454d38eaa0c043d2f0c2128e",
28
28
  "lerna": {
29
29
  "command": {
30
30
  "publish": {