@proximus/lavender-banner 2.0.0-alpha.1 → 2.0.0-alpha.100

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/Banner.d.ts CHANGED
@@ -1,13 +1,21 @@
1
- import { Container } from '@proximus/lavender-container';
2
- import { PxElement } from '@proximus/lavender-common';
3
- export declare class Banner extends PxElement<HTMLDivElement> {
1
+ import type { Container } from '@proximus/lavender-container';
2
+ import '@proximus/lavender-container';
3
+ import type { Grid } from '@proximus/lavender-grid';
4
+ import '@proximus/lavender-grid';
5
+ import { VerticallyExtendedElement } from '@proximus/lavender-common';
6
+ export declare class Banner extends VerticallyExtendedElement<HTMLDivElement> {
7
+ #private;
4
8
  static nativeName: string;
9
+ observer: MutationObserver;
5
10
  private template;
6
11
  constructor();
7
12
  static get observedAttributes(): string[];
8
13
  connectedCallback(): void;
9
14
  attributeChangedCallback(attrName: string, oldValue: string, newValue: string): void;
15
+ disconnectedCallback(): void;
10
16
  createGridTemplateAreas(): void;
17
+ createGridding(value?: string): void;
18
+ get $grid(): Grid;
11
19
  get $container(): Container;
12
20
  get $children(): NodeListOf<Element>;
13
21
  get backgroundColor(): string;
@@ -34,4 +42,12 @@ export declare class Banner extends PxElement<HTMLDivElement> {
34
42
  set inverted(value: boolean);
35
43
  get reduced(): boolean;
36
44
  set reduced(value: boolean);
45
+ get hasGridding(): boolean;
46
+ set hasGridding(value: boolean);
47
+ get hasGriddingMobile(): boolean;
48
+ set hasGriddingMobile(value: boolean);
49
+ get hasGriddingTablet(): boolean;
50
+ set hasGriddingTablet(value: boolean);
51
+ get hasGriddingLaptop(): boolean;
52
+ set hasGriddingLaptop(value: boolean);
37
53
  }
package/dist/index.es.js CHANGED
@@ -1,24 +1,355 @@
1
- import { PxElement as d, backgroundSizeValues as c, gradientValues as g, backgroundColorValues as l } from "@proximus/lavender-common";
2
- const b = ':host{position:relative}:host,:host>*{display:block;box-sizing:border-box}.banner{position:relative;min-height:8em}.banner[reduced]{min-height:5em}px-container{height:100%}.banner-content{display:grid;grid-template-columns:1fr;grid-template-rows:minmax(0,auto);row-gap:var(--px-spacing-s-mobile);z-index:2;position:relative}[reduced] .banner-content{grid-template-columns:min-content minmax(0,1fr);column-gap:var(--px-spacing-default-mobile)}::slotted([slot="tag"]){grid-area:tag}::slotted([slot="media"]){grid-area:media;align-self:start}::slotted([slot="title"]){grid-area:title}::slotted([slot="description"]){grid-area:description}::slotted([slot="content"]){grid-area:content}:host(:not([reduced])) ::slotted([slot="action"]){grid-area:action;margin-top:calc(var(--px-spacing-default-mobile) - var(--px-spacing-s-mobile))}.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){.banner-content{row-gap:var(--px-spacing-s-desktop)}[reduced] .banner-content{column-gap:var(--px-spacing-default-desktop)}.banner-content :host(:not([reduced])) ::slotted([slot="action"]){margin-top:calc(var(--px-spacing-default-desktop) - var(--px-spacing-s-desktop))}}@media only screen and (min-width: 64.0625em){.banner-content{row-gap:var(--px-spacing-s-desktop)}[reduced] .banner-content{column-gap:var(--px-spacing-default-desktop)}.banner-content :host(:not([reduced])) ::slotted([slot="action"]){margin-top:calc(var(--px-spacing-default-desktop) - var(--px-spacing-s-desktop))}}', s = new CSSStyleSheet();
3
- s.replaceSync(b);
4
- const o = class o extends d {
1
+ var b = (a) => {
2
+ throw TypeError(a);
3
+ };
4
+ var k = (a, t, e) => t.has(a) || b("Cannot " + e);
5
+ var m = (a, t, e) => t.has(a) ? b("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(a) : t.set(a, e);
6
+ var l = (a, t, e) => (k(a, t, "access private method"), e);
7
+ import "@proximus/lavender-container";
8
+ import { cssTokenBreakpoints as A, gapValues as v, PxElement as C, log as h, VerticallyExtendedElement as x, backgroundSizeValues as $, gradientValues as I, backgroundColorValues as S } from "@proximus/lavender-common";
9
+ const T = ':host{position:relative}:host,:host>*{display:block;box-sizing:border-box}.banner{position:relative;min-height:8rem;height:100%}.banner[reduced]{min-height:5rem}px-container{height:100%}.banner-content{display:grid;grid-template-columns:1fr;grid-template-rows:minmax(0,auto);row-gap:var(--px-spacing-s-mobile);z-index:2;position:relative}[reduced] .banner-content{grid-template-columns:min-content minmax(0,1fr);column-gap:var(--px-spacing-default-mobile)}::slotted([slot="tag"]){grid-area:tag}::slotted([slot="media"]){grid-area:media;align-self:start}::slotted([slot="title"]){grid-area:title}::slotted([slot="description"]){grid-area:description}::slotted([slot="content"]){grid-area:content}::slotted([slot="action"]){grid-area:action;z-index:2}:host(:not([reduced])) ::slotted([slot="action"]){margin-top:calc(var(--px-spacing-default-mobile) - var(--px-spacing-s-mobile))}.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 screen and (min-width: 48rem){.banner-content{row-gap:var(--px-spacing-s-desktop)}[reduced] .banner-content{column-gap:var(--px-spacing-default-desktop)}.banner-content :host(:not([reduced])) ::slotted([slot="action"]){margin-top:calc(var(--px-spacing-default-desktop) - var(--px-spacing-s-desktop))}}@media screen and (min-width: 64.0625rem){.banner-content{row-gap:var(--px-spacing-s-desktop)}[reduced] .banner-content{column-gap:var(--px-spacing-default-desktop)}.banner-content :host(:not([reduced])) ::slotted([slot="action"]){margin-top:calc(var(--px-spacing-default-desktop) - var(--px-spacing-s-desktop))}}', L = ":host{display:block;--grid-cols: initial;--grid-cols--mobile: initial;--grid-cols--tablet: initial;--grid-cols--laptop: initial;--grid-cols--desktop: initial;--justify-content: initial;--justify-items: initial;--align-content: initial;--align-items: initial}.grid{display:grid;grid-template-columns:repeat(var(--grid-cols),minmax(0,1fr));justify-content:var(--justify-content);justify-items:var(--justify-items);align-content:var(--align-content);align-items:var(--align-items)}.justify-content-normal{justify-content:normal}.justify-content-start{justify-content:start}.justify-content-end{justify-content:end}.justify-content-center{justify-content:center}.justify-content-space-between{justify-content:space-between}.justify-content-space-around{justify-content:space-around}.justify-content-space-evenly{justify-content:space-evenly}.justify-content-stretch{justify-content:stretch}.justify-items-start{justify-items:start}.justify-items-end{justify-items:end}.justify-items-center{justify-items:center}.justify-items-stretch{justify-items:stretch}.align-content-normal{align-content:normal}.align-content-start{align-content:start}.align-content-end{align-content:end}.align-content-center{align-content:center}.align-content-space-between{align-content:space-between}.align-content-space-around{align-content:space-around}.align-content-space-evenly{align-content:space-evenly}.align-content-stretch{align-content:stretch}.align-items-start{align-items:start}.align-items-end{align-items:end}.align-items-center{align-items:center}.align-items-stretch{align-items:stretch}@media screen and (max-width: 47.938rem){.grid{grid-template-columns:repeat(var(--grid-cols--mobile, var(--grid-cols)),minmax(0,1fr))}.justify-content-normal-mobile{justify-content:normal}.justify-content-start-mobile{justify-content:start}.justify-content-end-mobile{justify-content:end}.justify-content-center-mobile{justify-content:center}.justify-content-space-between-mobile{justify-content:space-between}.justify-content-space-around-mobile{justify-content:space-around}.justify-content-space-evenly-mobile{justify-content:space-evenly}.justify-content-stretch-mobile{justify-content:stretch}.justify-items-start-mobile{justify-items:start}.justify-items-end-mobile{justify-items:end}.justify-items-center-mobile{justify-items:center}.justify-items-stretch-mobile{justify-items:stretch}.align-content-normal-mobile{align-content:normal}.align-content-start-mobile{align-content:start}.align-content-end-mobile{align-content:end}.align-content-center-mobile{align-content:center}.align-content-space-between-mobile{align-content:space-between}.align-content-space-around-mobile{align-content:space-around}.align-content-space-evenly-mobile{align-content:space-evenly}.align-content-stretch-mobile{align-content:stretch}.align-items-start-mobile{align-items:start}.align-items-end-mobile{align-items:end}.align-items-center-mobile{align-items:center}.align-items-stretch-mobile{align-items:stretch}}@media screen and (min-width: 48rem) and (max-width: 64rem){.grid{grid-template-columns:repeat(var(--grid-cols--tablet, var(--grid-cols)),minmax(0,1fr))}.justify-content-normal-tablet{justify-content:normal}.justify-content-start-tablet{justify-content:start}.justify-content-end-tablet{justify-content:end}.justify-content-center-tablet{justify-content:center}.justify-content-space-between-tablet{justify-content:space-between}.justify-content-space-around-tablet{justify-content:space-around}.justify-content-space-evenly-tablet{justify-content:space-evenly}.justify-content-stretch-tablet{justify-content:stretch}.justify-items-start-tablet{justify-items:start}.justify-items-end-tablet{justify-items:end}.justify-items-center-tablet{justify-items:center}.justify-items-stretch-tablet{justify-items:stretch}.align-content-normal-tablet{align-content:normal}.align-content-start-tablet{align-content:start}.align-content-end-tablet{align-content:end}.align-content-center-tablet{align-content:center}.align-content-space-between-tablet{align-content:space-between}.align-content-space-around-tablet{align-content:space-around}.align-content-space-evenly-tablet{align-content:space-evenly}.align-content-stretch-tablet{align-content:stretch}.align-items-start-tablet{align-items:start}.align-items-end-tablet{align-items:end}.align-items-center-tablet{align-items:center}.align-items-stretch-tablet{align-items:stretch}}@media screen and (min-width: 64.0625rem){.grid{grid-template-columns:repeat(var(--grid-cols--laptop, var(--grid-cols)),minmax(0,1fr))}.justify-content-normal-laptop{justify-content:normal}.justify-content-start-laptop{justify-content:start}.justify-content-end-laptop{justify-content:end}.justify-content-center-laptop{justify-content:center}.justify-content-space-between-laptop{justify-content:space-between}.justify-content-space-around-laptop{justify-content:space-around}.justify-content-space-evenly-laptop{justify-content:space-evenly}.justify-content-stretch-laptop{justify-content:stretch}.justify-items-start-laptop{justify-items:start}.justify-items-end-laptop{justify-items:end}.justify-items-center-laptop{justify-items:center}.justify-items-stretch-laptop{justify-items:stretch}.align-content-normal-laptop{align-content:normal}.align-content-start-laptop{align-content:start}.align-content-end-laptop{align-content:end}.align-content-center-laptop{align-content:center}.align-content-space-between-laptop{align-content:space-between}.align-content-space-around-laptop{align-content:space-around}.align-content-space-evenly-laptop{align-content:space-evenly}.align-content-stretch-laptop{align-content:stretch}.align-items-start-laptop{align-items:start}.align-items-end-laptop{align-items:end}.align-items-center-laptop{align-items:center}.align-items-stretch-laptop{align-items:stretch}}", f = new CSSStyleSheet();
10
+ f.replaceSync(L);
11
+ const M = [
12
+ "1",
13
+ "2",
14
+ "3",
15
+ "4",
16
+ "5",
17
+ "6",
18
+ "7",
19
+ "8",
20
+ "9",
21
+ "10",
22
+ "11",
23
+ "12"
24
+ ], G = [
25
+ "",
26
+ "start",
27
+ "end",
28
+ "center",
29
+ "space-between",
30
+ "space-around",
31
+ "space-evenly",
32
+ "stretch"
33
+ ], w = ["", "start", "end", "center", "stretch"], z = (a, t, e) => `:host([${a}${e ? `--${e}` : ""}='${t}']) .grid`, E = "px-spacing", P = A(
34
+ "gap",
35
+ z,
36
+ v,
37
+ E,
38
+ "--grid-gap"
39
+ ), u = class u extends C {
40
+ constructor() {
41
+ super(f, P), this.template = () => `<div class="grid">
42
+ <slot></slot>
43
+ </div>`, this.shadowRoot.innerHTML = this.template();
44
+ }
45
+ static get observedAttributes() {
46
+ return [
47
+ ...super.observedAttributes,
48
+ "grid-cols",
49
+ "grid-cols--mobile",
50
+ "grid-cols--tablet",
51
+ "grid-cols--laptop",
52
+ "justify-content",
53
+ "justify-items",
54
+ "align-content",
55
+ "align-items",
56
+ "justify-content--mobile",
57
+ "justify-items--mobile",
58
+ "align-content--mobile",
59
+ "align-items--mobile",
60
+ "justify-content--tablet",
61
+ "justify-items--tablet",
62
+ "align-content--tablet",
63
+ "align-items--tablet",
64
+ "justify-content--laptop",
65
+ "justify-items--laptop",
66
+ "align-content--laptop",
67
+ "align-items--laptop",
68
+ "justify-content--desktop",
69
+ "justify-items--desktop",
70
+ "align-content--desktop",
71
+ "align-items--desktop"
72
+ ];
73
+ }
74
+ connectedCallback() {
75
+ this.gap || (this.gap = "default"), this.alignItems || (this.alignItems = "stretch");
76
+ }
77
+ attributeChangedCallback(t, e, n) {
78
+ if (e !== n)
79
+ switch (t) {
80
+ case "grid-cols":
81
+ case "grid-cols--mobile":
82
+ case "grid-cols--tablet":
83
+ case "grid-cols--laptop":
84
+ this.updateAttribute(t, e, n, M);
85
+ break;
86
+ case "justify-content":
87
+ case "align-content":
88
+ case "justify-content--mobile":
89
+ case "align-content--mobile":
90
+ case "justify-content--tablet":
91
+ case "align-content--tablet":
92
+ case "justify-content--laptop":
93
+ case "align-content--laptop":
94
+ case "justify-content--desktop":
95
+ case "align-content--desktop":
96
+ this.updateAttribute(
97
+ t,
98
+ e,
99
+ n,
100
+ G
101
+ );
102
+ break;
103
+ case "justify-items":
104
+ case "align-items":
105
+ case "justify-items--mobile":
106
+ case "align-items--mobile":
107
+ case "justify-items--tablet":
108
+ case "align-items--tablet":
109
+ case "justify-items--laptop":
110
+ case "align-items--laptop":
111
+ case "justify-items--desktop":
112
+ case "align-items--desktop":
113
+ this.updateAttribute(
114
+ t,
115
+ e,
116
+ n,
117
+ w
118
+ );
119
+ break;
120
+ default:
121
+ super.attributeChangedCallback(t, e, n);
122
+ break;
123
+ }
124
+ }
125
+ updateGap(t, e, n) {
126
+ if (!this.checkName(n, e)) {
127
+ h(
128
+ `${e} is not an allowed gap value for ${this.tagName.toLowerCase()}`
129
+ );
130
+ return;
131
+ }
132
+ const i = (s) => {
133
+ s !== null && s !== "" && s !== "default" && (this.$el.style.setProperty(
134
+ "--grid-gap--mobile",
135
+ `var(--px-spacing-${s}-mobile)`
136
+ ), this.$el.style.setProperty(
137
+ "--grid-gap--tablet",
138
+ `var(--px-spacing-${s}-tablet)`
139
+ ), this.$el.style.setProperty(
140
+ "--grid-gap--laptop",
141
+ `var(--px-spacing-${s}-laptop)`
142
+ ));
143
+ };
144
+ i(t), i(e);
145
+ }
146
+ updateAttribute(t, e, n, i) {
147
+ this.checkName(i, n) ? t === "grid-cols" || t === "grid-cols--mobile" || t === "grid-cols--tablet" || t === "grid-cols--laptop" || t === "grid-cols--desktop" ? this.$el.style.setProperty(`--${t}`, n) : (e !== null && e !== "" && e !== "default" && this.$el.classList.toggle(`${t}-${e}`), n !== null && n !== "" && n !== "default" && this.$el.classList.toggle(`${t}-${n}`)) : h(
148
+ `${n} is not an allowed ${t} value for ${this.tagName.toLowerCase()}`
149
+ );
150
+ }
151
+ get gap() {
152
+ return this.getAttribute("gap");
153
+ }
154
+ set gap(t) {
155
+ this.setAttribute("gap", t);
156
+ }
157
+ get gapMobile() {
158
+ return this.getAttribute("gap--mobile");
159
+ }
160
+ set gapMobile(t) {
161
+ this.setAttribute("gap--mobile", t);
162
+ }
163
+ get gapTablet() {
164
+ return this.getAttribute("gap--tablet");
165
+ }
166
+ set gapTablet(t) {
167
+ this.setAttribute("gap--tablet", t);
168
+ }
169
+ get gapLaptop() {
170
+ return this.getAttribute("gap--laptop");
171
+ }
172
+ set gapLaptop(t) {
173
+ this.setAttribute("gap--laptop", t);
174
+ }
175
+ get gridCols() {
176
+ return this.getAttribute("grid-cols");
177
+ }
178
+ set gridCols(t) {
179
+ this.setAttribute("grid-cols", t);
180
+ }
181
+ get gridColsMobile() {
182
+ return this.getAttribute("grid-cols--mobile");
183
+ }
184
+ set gridColsMobile(t) {
185
+ this.setAttribute("grid-cols--mobile", t);
186
+ }
187
+ get gridColsTablet() {
188
+ return this.getAttribute("grid-cols--tablet");
189
+ }
190
+ set gridColsTablet(t) {
191
+ this.setAttribute("grid-cols--tablet", t);
192
+ }
193
+ get gridColsLaptop() {
194
+ return this.getAttribute("grid-cols--laptop");
195
+ }
196
+ set gridColsLaptop(t) {
197
+ this.setAttribute("grid-cols--laptop", t);
198
+ }
199
+ get justifyContent() {
200
+ return this.getAttribute("justify-content");
201
+ }
202
+ set justifyContent(t) {
203
+ this.setAttribute("justify-content", t);
204
+ }
205
+ get justifyItems() {
206
+ return this.getAttribute("justify-items");
207
+ }
208
+ set justifyItems(t) {
209
+ this.setAttribute("justify-items", t);
210
+ }
211
+ get alignContent() {
212
+ return this.getAttribute("align-content");
213
+ }
214
+ set alignContent(t) {
215
+ this.setAttribute("align-content", t);
216
+ }
217
+ get alignItems() {
218
+ return this.getAttribute("align-items");
219
+ }
220
+ set alignItems(t) {
221
+ this.setAttribute("align-items", t);
222
+ }
223
+ get justifyContentMobile() {
224
+ return this.getAttribute("justify-content--mobile");
225
+ }
226
+ set justifyContentMobile(t) {
227
+ this.setAttribute("justify-content--mobile", t);
228
+ }
229
+ get justifyItemsMobile() {
230
+ return this.getAttribute("justify-items--mobile");
231
+ }
232
+ set justifyItemsMobile(t) {
233
+ this.setAttribute("justify-items--mobile", t);
234
+ }
235
+ get alignContentMobile() {
236
+ return this.getAttribute("align-content--mobile");
237
+ }
238
+ set alignContentMobile(t) {
239
+ this.setAttribute("align-content--mobile", t);
240
+ }
241
+ get alignItemsMobile() {
242
+ return this.getAttribute("align-items--mobile");
243
+ }
244
+ set alignItemsMobile(t) {
245
+ this.setAttribute("align-items--mobile", t);
246
+ }
247
+ get justifyContentTablet() {
248
+ return this.getAttribute("justify-content--tablet");
249
+ }
250
+ set justifyContentTablet(t) {
251
+ this.setAttribute("justify-content--tablet", t);
252
+ }
253
+ get justifyItemsTablet() {
254
+ return this.getAttribute("justify-items--tablet");
255
+ }
256
+ set justifyItemsTablet(t) {
257
+ this.setAttribute("justify-items--tablet", t);
258
+ }
259
+ get alignContentTablet() {
260
+ return this.getAttribute("align-content--tablet");
261
+ }
262
+ set alignContentTablet(t) {
263
+ this.setAttribute("align-content--tablet", t);
264
+ }
265
+ get alignItemsTablet() {
266
+ return this.getAttribute("align-items--tablet");
267
+ }
268
+ set alignItemsTablet(t) {
269
+ this.setAttribute("align-items--tablet", t);
270
+ }
271
+ get justifyContentLaptop() {
272
+ return this.getAttribute("justify-content--laptop");
273
+ }
274
+ set justifyContentLaptop(t) {
275
+ this.setAttribute("justify-content--laptop", t);
276
+ }
277
+ get justifyItemsLaptop() {
278
+ return this.getAttribute("justify-items--laptop");
279
+ }
280
+ set justifyItemsLaptop(t) {
281
+ this.setAttribute("justify-items--laptop", t);
282
+ }
283
+ get alignContentLaptop() {
284
+ return this.getAttribute("align-content--laptop");
285
+ }
286
+ set alignContentLaptop(t) {
287
+ this.setAttribute("align-content--laptop", t);
288
+ }
289
+ get alignItemsLaptop() {
290
+ return this.getAttribute("align-items--laptop");
291
+ }
292
+ set alignItemsLaptop(t) {
293
+ this.setAttribute("align-items--laptop", t);
294
+ }
295
+ get justifyContentDesktop() {
296
+ return this.getAttribute("justify-content--desktop");
297
+ }
298
+ set justifyContentDesktop(t) {
299
+ this.setAttribute("justify-content--desktop", t);
300
+ }
301
+ get justifyItemsDesktop() {
302
+ return this.getAttribute("justify-items--desktop");
303
+ }
304
+ set justifyItemsDesktop(t) {
305
+ this.setAttribute("justify-items--desktop", t);
306
+ }
307
+ get alignContentDesktop() {
308
+ return this.getAttribute("align-content--desktop");
309
+ }
310
+ set alignContentDesktop(t) {
311
+ this.setAttribute("align-content--desktop", t);
312
+ }
313
+ get alignItemsDesktop() {
314
+ return this.getAttribute("align-items--desktop");
315
+ }
316
+ set alignItemsDesktop(t) {
317
+ this.setAttribute("align-items--desktop", t);
318
+ }
319
+ };
320
+ u.nativeName = "div";
321
+ let c = u;
322
+ customElements.get("px-grid") || customElements.define("px-grid", c);
323
+ const y = new CSSStyleSheet();
324
+ y.replaceSync(T);
325
+ var o, d;
326
+ const p = class p extends x {
5
327
  constructor() {
6
- super(s), this.template = () => `<div class="banner">
328
+ super(y);
329
+ m(this, o);
330
+ this.template = () => `<div class="banner">
7
331
  <div class="contrast-helper"></div>
8
- <px-container padding="${this.reduced ? "m" : "l"}" padding--mobile="m" border-radius="main" >
9
- <div class="banner-content">
10
- <slot name="tag"></slot>
11
- <slot name="media"></slot>
12
- <slot name="title"></slot>
13
- <slot name="description"></slot>
14
- <slot name="content"></slot>
332
+ <px-container class="banner-container" padding--mobile="m" border-radius="main" >
333
+ <px-vstack>
334
+ <px-grid gap="none">
335
+ <px-container padding="none" background-color="none">
336
+ <div class="banner-content">
337
+ <slot name="tag"></slot>
338
+ <slot name="media"></slot>
339
+ <slot name="title"></slot>
340
+ <slot name="description"></slot>
341
+ <slot name="content"></slot>
342
+ </div>
343
+ </px-container>
344
+ </px-grid>
15
345
  <slot name="action"></slot>
16
- </div>
346
+ </px-vstack>
17
347
  </px-container>
18
348
  </div>`, this.shadowRoot.innerHTML = this.template();
19
349
  }
20
350
  static get observedAttributes() {
21
351
  return [
352
+ ...super.observedAttributes,
22
353
  "background-color",
23
354
  "background-gradient",
24
355
  "background-image",
@@ -29,78 +360,126 @@ const o = class o extends d {
29
360
  "background-position",
30
361
  "contrast-helper-gradient",
31
362
  "contrast-helper-overlay",
363
+ "has-gridding",
364
+ "has-gridding--mobile",
365
+ "has-gridding--tablet",
366
+ "has-gridding--laptop",
32
367
  "reduced",
33
368
  "inverted"
34
369
  ];
35
370
  }
36
371
  connectedCallback() {
37
- var t;
38
- (t = super.connectedCallback) == null || t.call(this), this.createGridTemplateAreas();
372
+ var e;
373
+ (e = super.connectedCallback) == null || e.call(this), l(this, o, d).call(this), this.createGridTemplateAreas(), this.createGridding(), this.observer = new MutationObserver(() => {
374
+ this.createGridTemplateAreas(), this.createGridding();
375
+ }), this.observer.observe(this, {
376
+ childList: !0,
377
+ subtree: !0
378
+ });
39
379
  }
40
- attributeChangedCallback(t, a, e) {
41
- if (a !== e)
42
- switch (t) {
380
+ attributeChangedCallback(e, n, i) {
381
+ if (n !== i)
382
+ switch (e) {
43
383
  case "background-color":
44
- this.$container.backgroundColor = l.indexOf(e) > 0 ? e : "none";
384
+ this.$container.backgroundColor = S.indexOf(i) > 0 ? i : "none";
45
385
  break;
46
386
  case "background-gradient":
47
- this.$container.gradient = g.indexOf(e) > 0 ? e : "none";
387
+ this.$container.gradient = I.indexOf(i) > 0 ? i : "none";
48
388
  break;
49
389
  case "background-image":
50
- this.$container.backgroundImage = e;
390
+ this.$container.backgroundImage = i;
51
391
  break;
52
392
  case "background-image--mobile":
53
- this.$container.backgroundImageMobile = e;
393
+ this.$container.backgroundImageMobile = i;
54
394
  break;
55
395
  case "background-image--tablet":
56
- this.$container.backgroundImageTablet = e;
396
+ this.$container.backgroundImageTablet = i;
57
397
  break;
58
398
  case "background-image--laptop":
59
- this.$container.backgroundImageLaptop = e;
399
+ this.$container.backgroundImageLaptop = i;
60
400
  break;
61
401
  case "background-size":
62
- this.$container.backgroundSize = c.indexOf(e) > 0 ? e : "";
402
+ this.$container.backgroundSize = $.indexOf(i) > 0 ? i : "";
63
403
  break;
64
404
  case "background-position":
65
- this.$container.backgroundPosition = e;
405
+ this.$container.backgroundPosition = i;
66
406
  break;
67
407
  case "reduced":
68
- this.$el.toggleAttribute("reduced", e !== null), this.createGridTemplateAreas();
408
+ this.$el.toggleAttribute("reduced", i !== null), this.isConnected && l(this, o, d).call(this), this.createGridTemplateAreas();
409
+ break;
410
+ case "has-gridding":
411
+ case "has-gridding--mobile":
412
+ case "has-gridding--tablet":
413
+ case "has-gridding--laptop":
414
+ this.createGridding(i);
69
415
  break;
70
416
  case "inverted":
71
- for (let r = 0; r < this.$children.length; r++)
72
- this.$children[r].hasAttribute("inverted") || this.$children[r].toggleAttribute("inverted");
73
- this.$el.toggleAttribute("inverted", e !== null);
417
+ for (let s = 0; s < this.$children.length; s++)
418
+ this.$children[s].hasAttribute("inverted") || this.$children[s].toggleAttribute("inverted");
419
+ this.$el.toggleAttribute("inverted", i !== null);
74
420
  break;
75
421
  default:
76
- super.attributeChangedCallback(t, a, e);
422
+ super.attributeChangedCallback(e, n, i);
77
423
  break;
78
424
  }
79
425
  }
426
+ disconnectedCallback() {
427
+ this.observer.disconnect();
428
+ }
80
429
  createGridTemplateAreas() {
81
- const t = this.shadowRoot.querySelector(
430
+ const e = this.shadowRoot.querySelector(
82
431
  ".banner-content"
83
- ), a = ["tag", "media", "title", "description", "content", "action"];
84
- let e = "";
85
- this.reduced ? a.forEach((r) => {
86
- const n = this.shadowRoot.querySelector(
87
- `slot[name="${r}"]`
432
+ ), n = ["tag", "media", "title", "description", "content", "action"];
433
+ let i = "";
434
+ this.reduced ? n.forEach((s) => {
435
+ const r = this.shadowRoot.querySelector(
436
+ `slot[name="${s}"]`
88
437
  );
89
- if (n && n.assignedElements().length > 0) {
90
- if (r === "media") return;
91
- e += `'media ${r}'
438
+ if (r && r.assignedElements().length > 0) {
439
+ if (s === "media") return;
440
+ i += `'media ${s}'
92
441
  `;
93
442
  }
94
- }) : a.forEach((r) => {
95
- const n = this.shadowRoot.querySelector(
96
- `slot[name="${r}"]`
443
+ }) : n.forEach((s) => {
444
+ const r = this.shadowRoot.querySelector(
445
+ `slot[name="${s}"]`
97
446
  );
98
- n && n.assignedElements().length > 0 && (e += `'${r}'
447
+ r && r.assignedElements().length > 0 && (i += `'${s}'
99
448
  `);
100
- }), e || (e = "'content'"), t.style.gridTemplateAreas = e;
449
+ }), i || (i = "'content'"), e.style.gridTemplateAreas = i;
450
+ }
451
+ createGridding(e) {
452
+ const n = [
453
+ { prop: "hasGridding", gridAttr: "grid-cols", attr: "col-span" },
454
+ {
455
+ prop: "hasGriddingMobile",
456
+ gridAttr: "grid-cols--mobile",
457
+ attr: "col-span--mobile"
458
+ },
459
+ {
460
+ prop: "hasGriddingTablet",
461
+ gridAttr: "grid-cols--tablet",
462
+ attr: "col-span--tablet"
463
+ },
464
+ {
465
+ prop: "hasGriddingLaptop",
466
+ gridAttr: "grid-cols--laptop",
467
+ attr: "col-span--laptop"
468
+ }
469
+ ], i = this.shadowRoot.querySelector(
470
+ "px-grid > px-container"
471
+ );
472
+ e !== null ? n.forEach(({ prop: s, gridAttr: r, attr: j }) => {
473
+ this[s] && (this.$grid.setAttribute(r, "3"), i == null || i.setAttribute(j, "2"));
474
+ }) : n.forEach(({ gridAttr: s, attr: r }) => {
475
+ this.$grid.setAttribute(s, "1"), i == null || i.setAttribute(r, "1");
476
+ });
477
+ }
478
+ get $grid() {
479
+ return this.shadowRoot.querySelector("px-grid");
101
480
  }
102
481
  get $container() {
103
- return this.shadowRoot.querySelector("px-container");
482
+ return this.shadowRoot.querySelector(".banner-container");
104
483
  }
105
484
  get $children() {
106
485
  return this.querySelectorAll("px-banner > *");
@@ -108,79 +487,105 @@ const o = class o extends d {
108
487
  get backgroundColor() {
109
488
  return this.getAttribute("background-color");
110
489
  }
111
- set backgroundColor(t) {
112
- this.setAttribute("background-color", t);
490
+ set backgroundColor(e) {
491
+ this.setAttribute("background-color", e);
113
492
  }
114
493
  get gradient() {
115
494
  return this.getAttribute("background-gradient");
116
495
  }
117
- set gradient(t) {
118
- this.setAttribute("background-gradient", t);
496
+ set gradient(e) {
497
+ this.setAttribute("background-gradient", e);
119
498
  }
120
499
  get backgroundImage() {
121
500
  return this.getAttribute("background-image");
122
501
  }
123
- set backgroundImage(t) {
124
- this.setAttribute("background-image", t);
502
+ set backgroundImage(e) {
503
+ this.setAttribute("background-image", e);
125
504
  }
126
505
  get backgroundImageMobile() {
127
506
  return this.getAttribute("background-image--mobile");
128
507
  }
129
- set backgroundImageMobile(t) {
130
- this.setAttribute("background-image--mobile", t);
508
+ set backgroundImageMobile(e) {
509
+ this.setAttribute("background-image--mobile", e);
131
510
  }
132
511
  get backgroundImageTablet() {
133
512
  return this.getAttribute("background-image--tablet");
134
513
  }
135
- set backgroundImageTablet(t) {
136
- this.setAttribute("background-image--tablet", t);
514
+ set backgroundImageTablet(e) {
515
+ this.setAttribute("background-image--tablet", e);
137
516
  }
138
517
  get backgroundImageLaptop() {
139
518
  return this.getAttribute("background-image--laptop");
140
519
  }
141
- set backgroundImageLaptop(t) {
142
- this.setAttribute("background-image--laptop", t);
520
+ set backgroundImageLaptop(e) {
521
+ this.setAttribute("background-image--laptop", e);
143
522
  }
144
523
  get backgroundSize() {
145
524
  return this.getAttribute("background-size");
146
525
  }
147
- set backgroundSize(t) {
148
- this.setAttribute("background-size", t);
526
+ set backgroundSize(e) {
527
+ this.setAttribute("background-size", e);
149
528
  }
150
529
  get backgroundPosition() {
151
530
  return this.getAttribute("background-position");
152
531
  }
153
- set backgroundPosition(t) {
154
- this.setAttribute("background-position", t);
532
+ set backgroundPosition(e) {
533
+ this.setAttribute("background-position", e);
155
534
  }
156
535
  get gradientContrastHelper() {
157
536
  return this.hasAttribute("contrast-helper-gradient");
158
537
  }
159
- set gradientContrastHelper(t) {
160
- t ? this.setAttribute("contrast-helper-gradient", "") : this.removeAttribute("contrast-helper-gradient");
538
+ set gradientContrastHelper(e) {
539
+ e ? this.setAttribute("contrast-helper-gradient", "") : this.removeAttribute("contrast-helper-gradient");
161
540
  }
162
541
  get overlayContrastHelper() {
163
542
  return this.hasAttribute("contrast-helper-overlay");
164
543
  }
165
- set overlayContrastHelper(t) {
166
- t ? this.setAttribute("contrast-helper-overlay", "") : this.removeAttribute("contrast-helper-overlay");
544
+ set overlayContrastHelper(e) {
545
+ e ? this.setAttribute("contrast-helper-overlay", "") : this.removeAttribute("contrast-helper-overlay");
167
546
  }
168
547
  get inverted() {
169
548
  return this.hasAttribute("inverted");
170
549
  }
171
- set inverted(t) {
172
- t ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
550
+ set inverted(e) {
551
+ e ? this.setAttribute("inverted", "") : this.removeAttribute("inverted");
173
552
  }
174
553
  get reduced() {
175
554
  return this.hasAttribute("reduced");
176
555
  }
177
- set reduced(t) {
178
- t ? this.setAttribute("reduced", "") : this.removeAttribute("reduced");
556
+ set reduced(e) {
557
+ e ? this.setAttribute("reduced", "") : this.removeAttribute("reduced");
558
+ }
559
+ get hasGridding() {
560
+ return this.hasAttribute("has-gridding");
561
+ }
562
+ set hasGridding(e) {
563
+ e ? this.setAttribute("has-gridding", "") : this.removeAttribute("has-gridding");
564
+ }
565
+ get hasGriddingMobile() {
566
+ return this.hasAttribute("has-gridding--mobile");
567
+ }
568
+ set hasGriddingMobile(e) {
569
+ e ? this.setAttribute("has-gridding--mobile", "") : this.removeAttribute("has-gridding--mobile");
570
+ }
571
+ get hasGriddingTablet() {
572
+ return this.hasAttribute("has-gridding--tablet");
573
+ }
574
+ set hasGriddingTablet(e) {
575
+ e ? this.setAttribute("has-gridding--tablet", "") : this.removeAttribute("has-gridding--tablet");
576
+ }
577
+ get hasGriddingLaptop() {
578
+ return this.hasAttribute("has-gridding--laptop");
579
+ }
580
+ set hasGriddingLaptop(e) {
581
+ e ? this.setAttribute("has-gridding--laptop", "") : this.removeAttribute("has-gridding--laptop");
179
582
  }
180
583
  };
181
- o.nativeName = "div";
182
- let i = o;
183
- customElements.get("px-banner") || customElements.define("px-banner", i);
584
+ o = new WeakSet(), d = function() {
585
+ this.$container.setAttribute("padding", this.reduced ? "m" : "l");
586
+ }, p.nativeName = "div";
587
+ let g = p;
588
+ customElements.get("px-banner") || customElements.define("px-banner", g);
184
589
  export {
185
- i as Banner
590
+ g as Banner
186
591
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@proximus/lavender-banner",
3
- "version": "2.0.0-alpha.1",
3
+ "version": "2.0.0-alpha.100",
4
4
  "description": "",
5
5
  "files": [
6
6
  "dist"
@@ -11,7 +11,7 @@
11
11
  "clean": "rm -rf dist",
12
12
  "build": "npm run clean && NODE_ENV=development vite build && tsc && npm run transform-package-json && npm run wc-manifest",
13
13
  "test": "vitest run --coverage",
14
- "wc-manifest": "cem analyze --globs \"src/*\" --config ../custom-elements-manifest.config.js --outdir dist"
14
+ "wc-manifest": "cem analyze --globs \"src/*\" --config ../../custom-elements-manifest.config.js --outdir dist"
15
15
  },
16
16
  "publishConfig": {
17
17
  "access": "public"