@proximus/lavender-content-header 2.0.0-alpha.1 → 2.0.0-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.
@@ -1,5 +1,6 @@
1
1
  import { Section } from '@proximus/lavender-section';
2
2
  import { H1 } from '@proximus/lavender-heading';
3
+ import { Grid } from '@proximus/lavender-grid';
3
4
  import { PxElement } from '@proximus/lavender-common';
4
5
  export declare class ContentHeader extends PxElement<HTMLDivElement> {
5
6
  static nativeName: string;
@@ -8,6 +9,8 @@ export declare class ContentHeader extends PxElement<HTMLDivElement> {
8
9
  static get observedAttributes(): string[];
9
10
  connectedCallback(): void;
10
11
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
12
+ createGridding(): void;
13
+ get $grid(): Grid;
11
14
  get $section(): Section;
12
15
  get $h1(): H1;
13
16
  get $subtitleSlot(): HTMLSlotElement;
@@ -34,6 +37,14 @@ export declare class ContentHeader extends PxElement<HTMLDivElement> {
34
37
  set gradientContrastHelper(value: boolean);
35
38
  get overlayContrastHelper(): boolean;
36
39
  set overlayContrastHelper(value: boolean);
40
+ get hasGridding(): boolean;
41
+ set hasGridding(value: boolean);
42
+ get hasGriddingMobile(): boolean;
43
+ set hasGriddingMobile(value: boolean);
44
+ get hasGriddingTablet(): boolean;
45
+ set hasGriddingTablet(value: boolean);
46
+ get hasGriddingLaptop(): boolean;
47
+ set hasGriddingLaptop(value: boolean);
37
48
  get inverted(): boolean;
38
49
  set inverted(value: boolean);
39
50
  get minHeight(): boolean;
package/dist/index.es.js CHANGED
@@ -1,21 +1,25 @@
1
- import { PxElement as s, backgroundSizeValues as c, gradientValues as l, backgroundColorValues as g } from "@proximus/lavender-common";
2
- const h = ":host{--min-height--mobile: 15.625em;--min-height--tablet: 17.5em;--min-height--laptop: 17.5em;--min-height--desktop: 17.5em}:host,:host>*{display:block;box-sizing:border-box}.content-header{position:relative;z-index:0}[min-height] .content-header-content{min-height:calc(var(--min-height--mobile) - (var(--px-spacing-l-mobile) * 2))}.content-header-content{display:flex;flex-direction:column;gap:var(--px-spacing-l-mobile);z-index:2;position:relative;box-sizing:border-box}.contrast-helper{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;pointer-events:none;display:none;border-radius:var(--px-radius-main)}[contrast-helper-gradient] .contrast-helper{display:block;background-image:linear-gradient(90deg,#fff 23.43%,#fff0 81.69%)}[inverted] :is([contrast-helper-gradient] .contrast-helper){background-image:linear-gradient(90deg,#000 23.43%,#0000 81.69%)}[contrast-helper-overlay] .contrast-helper{display:block;background-color:#ffffffb3}[inverted] :is([contrast-helper-overlay] .contrast-helper){background-color:#0006}@media only screen and (min-width: 48em){.content-header-content{gap:var(--px-spacing-l-desktop)}[min-height] .content-header-content{min-height:calc(var(--min-height--tablet) - (var(--px-spacing-l-tablet) * 2))}}@media only screen and (min-width: 64.0625em){.content-header-content{gap:var(--px-spacing-l-laptop)}[min-height] .content-header-content{min-height:calc(var(--min-height--laptop) - (var(--px-spacing-l-laptop) * 2))}}", n = new CSSStyleSheet();
1
+ import { PxElement as g, backgroundSizeValues as d, gradientValues as c, backgroundColorValues as l } from "@proximus/lavender-common";
2
+ const h = ":host{--min-height--mobile: 15.625em;--min-height--tablet: 17.5em;--min-height--laptop: 17.5em;--min-height--desktop: 17.5em}:host,:host>*{display:block;box-sizing:border-box}.content-header{position:relative;z-index:0}[min-height] .content-header-content{min-height:calc(var(--min-height--mobile) - (var(--px-spacing-l-mobile) * 2))}.content-header-content{display:flex;flex-direction:column;gap:var(--px-spacing-l-mobile);z-index:2;position:relative;box-sizing:border-box}.contrast-helper{position:absolute;top:0;right:0;bottom:0;left:0;z-index:1;pointer-events:none;display:none}[contrast-helper-gradient] .contrast-helper{display:block;background-image:linear-gradient(90deg,#fff 23.43%,#fff0 81.69%)}[inverted] :is([contrast-helper-gradient] .contrast-helper){background-image:linear-gradient(90deg,#000 23.43%,#0000 81.69%)}[contrast-helper-overlay] .contrast-helper{display:block;background-color:#ffffffb3}[inverted] :is([contrast-helper-overlay] .contrast-helper){background-color:#0006}@media only screen and (min-width: 48em){.content-header-content{gap:var(--px-spacing-l-desktop)}[min-height] .content-header-content{min-height:calc(var(--min-height--tablet) - (var(--px-spacing-l-tablet) * 2))}}@media only screen and (min-width: 64.0625em){.content-header-content{gap:var(--px-spacing-l-laptop)}[min-height] .content-header-content{min-height:calc(var(--min-height--laptop) - (var(--px-spacing-l-laptop) * 2))}}", n = new CSSStyleSheet();
3
3
  n.replaceSync(h);
4
- const o = class o extends s {
4
+ const o = class o extends g {
5
5
  constructor() {
6
6
  super(n), this.template = () => `<div class="content-header">
7
7
  <div class="contrast-helper"></div>
8
8
  <px-section padding-block="l">
9
- <div class="content-header-content">
10
- <px-vstack gap="heading-to-subtitle">
11
- <px-h1 variant="title-3xl"><slot></slot></px-h1>
12
- <slot name="subtitle"></slot>
13
- </px-vstack>
14
- ${this.$patchDescriptionSlot ? `<px-stack gap="s" direction="row" direction--mobile="column">
15
- <slot name="patch" shrink></slot>
16
- <slot name="patch-description"></slot>
17
- </px-stack>` : ""}
18
- </div>
9
+ <px-grid gap="none">
10
+ <px-container padding="none" border-radius="none" background-color="none" background-image="none" background-image--mobile="none" background-image--tablet="none" background-image--laptop="none" >
11
+ <div class="content-header-content">
12
+ <px-vstack gap="heading-to-subtitle">
13
+ <px-h1 variant="title-3xl"><slot></slot></px-h1>
14
+ <slot name="subtitle"></slot>
15
+ </px-vstack>
16
+ ${this.$patchDescriptionSlot ? `<px-stack gap="s" direction="row" direction--mobile="column">
17
+ <slot name="patch" shrink></slot>
18
+ <slot name="patch-description"></slot>
19
+ </px-stack>` : ""}
20
+ </div>
21
+ </px-container>
22
+ </px-grid>
19
23
  ${this.$overlapSlot ? '<slot name="overlap" slot="overlap"></slot>' : ""}
20
24
  </px-section>
21
25
  </div>`, this.shadowRoot.innerHTML = this.template();
@@ -33,21 +37,25 @@ const o = class o extends s {
33
37
  "contrast-helper-gradient",
34
38
  "contrast-helper-overlay",
35
39
  "min-height",
40
+ "has-gridding",
41
+ "has-gridding--mobile",
42
+ "has-gridding--tablet",
43
+ "has-gridding--laptop",
36
44
  "inverted"
37
45
  ];
38
46
  }
39
47
  connectedCallback() {
40
48
  var t;
41
- (t = super.connectedCallback) == null || t.call(this), this.$subtitleSlot && this.$subtitleSlot.setAttribute("variant", "subtitle"), this.$patchDescriptionSlot && (this.$patchDescriptionSlot.localName === "px-p" && this.$patchDescriptionSlot.setAttribute("variant", "default"), (this.$patchDescriptionSlot.localName === "px-p" || this.$patchDescriptionSlot.localName === "px-span") && (this.$patchDescriptionSlot.setAttribute("font-size", "body-l"), this.$patchDescriptionSlot.removeAttribute("font-weight"), this.$patchDescriptionSlot.removeAttribute("color")), this.$patchDescriptionSlot.localName === "px-price" && this.$patchDescriptionSlot.setAttribute("size", "m"));
49
+ (t = super.connectedCallback) == null || t.call(this), this.$subtitleSlot && this.$subtitleSlot.setAttribute("variant", "subtitle"), this.$patchDescriptionSlot && (this.$patchDescriptionSlot.localName === "px-p" && this.$patchDescriptionSlot.setAttribute("variant", "default"), (this.$patchDescriptionSlot.localName === "px-p" || this.$patchDescriptionSlot.localName === "px-span") && (this.$patchDescriptionSlot.setAttribute("font-size", "body-l"), this.$patchDescriptionSlot.removeAttribute("font-weight"), this.$patchDescriptionSlot.removeAttribute("color")), this.$patchDescriptionSlot.localName === "px-price" && this.$patchDescriptionSlot.setAttribute("size", "m")), this.createGridding();
42
50
  }
43
- attributeChangedCallback(t, a, e) {
44
- if (a !== e)
51
+ attributeChangedCallback(t, r, e) {
52
+ if (r !== e)
45
53
  switch (t) {
46
54
  case "background-color":
47
- this.$section.backgroundColor = g.indexOf(e) > 0 ? e : "none";
55
+ this.$section.backgroundColor = l.indexOf(e) > 0 ? e : "none";
48
56
  break;
49
57
  case "background-gradient":
50
- this.$section.gradient = l.indexOf(e) > 0 ? e : "none";
58
+ this.$section.gradient = c.indexOf(e) > 0 ? e : "none";
51
59
  break;
52
60
  case "background-image":
53
61
  this.$section.backgroundImage = e;
@@ -62,21 +70,55 @@ const o = class o extends s {
62
70
  this.$section.backgroundImageLaptop = e;
63
71
  break;
64
72
  case "background-size":
65
- this.$section.backgroundSize = c.indexOf(e) > 0 ? e : "";
73
+ this.$section.backgroundSize = d.indexOf(e) > 0 ? e : "";
66
74
  break;
67
75
  case "background-position":
68
76
  this.$section.backgroundPosition = e;
69
77
  break;
78
+ case "has-gridding":
79
+ case "has-gridding--mobile":
80
+ case "has-gridding--tablet":
81
+ case "has-gridding--laptop":
82
+ this.createGridding();
83
+ break;
70
84
  case "inverted":
71
85
  for (let i = 0; i < this.$children.length; i++)
72
86
  this.$children[i].hasAttribute("inverted") || this.$children[i].toggleAttribute("inverted");
73
87
  this.$h1.toggleAttribute("inverted", e !== null), this.$el.toggleAttribute("inverted", e !== null);
74
88
  break;
75
89
  default:
76
- super.attributeChangedCallback(t, a, e);
90
+ super.attributeChangedCallback(t, r, e);
77
91
  break;
78
92
  }
79
93
  }
94
+ createGridding() {
95
+ const t = [
96
+ { prop: "hasGridding", gridProp: "gridCols", attr: "col-span" },
97
+ {
98
+ prop: "hasGriddingMobile",
99
+ gridProp: "gridColsMobile",
100
+ attr: "col-span--mobile"
101
+ },
102
+ {
103
+ prop: "hasGriddingTablet",
104
+ gridProp: "gridColsTablet",
105
+ attr: "col-span--tablet"
106
+ },
107
+ {
108
+ prop: "hasGriddingLaptop",
109
+ gridProp: "gridColsLaptop",
110
+ attr: "col-span--laptop"
111
+ }
112
+ ], r = this.shadowRoot.querySelector(
113
+ "px-grid > px-container"
114
+ );
115
+ t.forEach(({ prop: e, gridProp: i, attr: s }) => {
116
+ this[e] && (this.$grid[i] = "3", r.setAttribute(s, "2"));
117
+ });
118
+ }
119
+ get $grid() {
120
+ return this.shadowRoot.querySelector("px-grid");
121
+ }
80
122
  get $section() {
81
123
  return this.shadowRoot.querySelector("px-section");
82
124
  }
@@ -155,6 +197,30 @@ const o = class o extends s {
155
197
  set overlayContrastHelper(t) {
156
198
  t ? this.setAttribute("contrast-helper-overlay", "") : this.removeAttribute("contrast-helper-overlay");
157
199
  }
200
+ get hasGridding() {
201
+ return this.hasAttribute("has-gridding");
202
+ }
203
+ set hasGridding(t) {
204
+ t ? this.setAttribute("has-gridding", "") : this.removeAttribute("has-gridding");
205
+ }
206
+ get hasGriddingMobile() {
207
+ return this.hasAttribute("has-gridding--mobile");
208
+ }
209
+ set hasGriddingMobile(t) {
210
+ t ? this.setAttribute("has-gridding--mobile", "") : this.removeAttribute("has-gridding--mobile");
211
+ }
212
+ get hasGriddingTablet() {
213
+ return this.hasAttribute("has-gridding--tablet");
214
+ }
215
+ set hasGriddingTablet(t) {
216
+ t ? this.setAttribute("has-gridding--tablet", "") : this.removeAttribute("has-gridding--tablet");
217
+ }
218
+ get hasGriddingLaptop() {
219
+ return this.hasAttribute("has-gridding--laptop");
220
+ }
221
+ set hasGriddingLaptop(t) {
222
+ t ? this.setAttribute("has-gridding--laptop", "") : this.removeAttribute("has-gridding--laptop");
223
+ }
158
224
  get inverted() {
159
225
  return this.hasAttribute("inverted");
160
226
  }
@@ -169,8 +235,8 @@ const o = class o extends s {
169
235
  }
170
236
  };
171
237
  o.nativeName = "div";
172
- let r = o;
173
- customElements.get("px-content-header") || customElements.define("px-content-header", r);
238
+ let a = o;
239
+ customElements.get("px-content-header") || customElements.define("px-content-header", a);
174
240
  export {
175
- r as ContentHeader
241
+ a as ContentHeader
176
242
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-content-header",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.2",
4
4
  "description": "",
5
5
  "main": "dist/index.es.js",
6
6
  "types": "dist/index.d.ts",