@proximus/lavender-tile 1.0.0-alpha.12
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/index.js +701 -0
- package/package.json +40 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,701 @@
|
|
|
1
|
+
import { WithFlexAttributes as u, backgroundColorValues as x } from "@proximus/lavender-common";
|
|
2
|
+
const m = '.tile__container{display:flex;flex-direction:column;font-family:var(--px-font-family);line-height:var(--px-line-height-m);font-size:var(--px-text-size-label-m-mobile);font-weight:700;color:var(--px-text-color-action-neutral-default)}.tile__container,.tile__container *{box-sizing:border-box}.tile__container .tile__header:not(.tile__header--empty)+.tile__content:not(.tile__content--empty){margin-top:var(--px-spacing-inside-section-default-mobile)}.tile__container ::slotted([slot="prefix"]){font-weight:400}.tile__container ::slotted([slot="description"]){font-weight:400}@media only screen and (min-width: 768px){.tile__container{font-size:var(--px-text-size-label-m-tablet)}.tile__container .tile__header:not(.tile__header--empty)+.tile__content:not(.tile__content--empty){margin-top:var(--px-spacing-inside-section-default-tablet)}}@media only screen and (min-width: 1025px){.tile__container{font-size:var(--px-text-size-label-m-desktop)}.tile__container .tile__header:not(.tile__header--empty)+.tile__content:not(.tile__content--empty){margin-top:var(--px-spacing-inside-section-default-desktop)}}:host([inverted]) .tile__container{color:var(--px-text-color-action-neutral-inverted)}', k = ".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)}}", g = new CSSStyleSheet();
|
|
3
|
+
g.replaceSync(k);
|
|
4
|
+
const v = [
|
|
5
|
+
"after-element-none",
|
|
6
|
+
"after-element-2xs",
|
|
7
|
+
"after-element-xs",
|
|
8
|
+
"after-element-s",
|
|
9
|
+
"after-element-default",
|
|
10
|
+
"after-element-l",
|
|
11
|
+
"heading-to-subtitle",
|
|
12
|
+
"heading-to-content",
|
|
13
|
+
"inside-section-none",
|
|
14
|
+
"inside-section-xs",
|
|
15
|
+
"inside-section-s",
|
|
16
|
+
"inside-section-default",
|
|
17
|
+
"inside-section-l",
|
|
18
|
+
"between-sections"
|
|
19
|
+
], y = [
|
|
20
|
+
"",
|
|
21
|
+
"default",
|
|
22
|
+
"row",
|
|
23
|
+
"row-reverse",
|
|
24
|
+
"column",
|
|
25
|
+
"column-reverse"
|
|
26
|
+
], A = [
|
|
27
|
+
"",
|
|
28
|
+
"default",
|
|
29
|
+
"stretch",
|
|
30
|
+
"flex-start",
|
|
31
|
+
"flex-end",
|
|
32
|
+
"center",
|
|
33
|
+
"baseline"
|
|
34
|
+
], w = [
|
|
35
|
+
"",
|
|
36
|
+
"default",
|
|
37
|
+
"flex-start",
|
|
38
|
+
"flex-end",
|
|
39
|
+
"center",
|
|
40
|
+
"space-between",
|
|
41
|
+
"space-around",
|
|
42
|
+
"space-evenly"
|
|
43
|
+
], $ = ["", "default", "nowrap", "wrap", "wrap-reverse"];
|
|
44
|
+
class c extends u {
|
|
45
|
+
constructor() {
|
|
46
|
+
super(g), this.template = `<div class="flex-container">
|
|
47
|
+
<slot></slot>
|
|
48
|
+
</div>`, this.shadowRoot.innerHTML = this.template;
|
|
49
|
+
}
|
|
50
|
+
connectedCallback() {
|
|
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");
|
|
52
|
+
}
|
|
53
|
+
static get observedAttributes() {
|
|
54
|
+
return [
|
|
55
|
+
...super.observedAttributes,
|
|
56
|
+
"direction",
|
|
57
|
+
"direction--mobile",
|
|
58
|
+
"direction--tablet",
|
|
59
|
+
"direction--laptop",
|
|
60
|
+
"direction--desktop",
|
|
61
|
+
"gap",
|
|
62
|
+
"gap--mobile",
|
|
63
|
+
"gap--tablet",
|
|
64
|
+
"gap--laptop",
|
|
65
|
+
"gap--desktop",
|
|
66
|
+
"justify-content",
|
|
67
|
+
"justify-content--mobile",
|
|
68
|
+
"justify-content--tablet",
|
|
69
|
+
"justify-content--laptop",
|
|
70
|
+
"justify-content--desktop",
|
|
71
|
+
"align-items",
|
|
72
|
+
"align-items--mobile",
|
|
73
|
+
"align-items--tablet",
|
|
74
|
+
"align-items--laptop",
|
|
75
|
+
"align-items--desktop",
|
|
76
|
+
"wrap",
|
|
77
|
+
"wrap--mobile",
|
|
78
|
+
"wrap--tablet",
|
|
79
|
+
"wrap--laptop",
|
|
80
|
+
"wrap--desktop"
|
|
81
|
+
];
|
|
82
|
+
}
|
|
83
|
+
attributeChangedCallback(t, e, i) {
|
|
84
|
+
if (t.indexOf("direction") > -1 && !["column", "row"].includes(i))
|
|
85
|
+
throw new Error("Invalid direction");
|
|
86
|
+
switch (t) {
|
|
87
|
+
case "gap":
|
|
88
|
+
case "gap--mobile":
|
|
89
|
+
case "gap--tablet":
|
|
90
|
+
case "gap--laptop":
|
|
91
|
+
case "gap--desktop":
|
|
92
|
+
this.updateFlexProperties(t, e, i, v);
|
|
93
|
+
break;
|
|
94
|
+
case "justify-content":
|
|
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
|
+
e,
|
|
102
|
+
i,
|
|
103
|
+
w
|
|
104
|
+
);
|
|
105
|
+
break;
|
|
106
|
+
case "align-items":
|
|
107
|
+
case "align-items--mobile":
|
|
108
|
+
case "align-items--tablet":
|
|
109
|
+
case "align-items--laptop":
|
|
110
|
+
case "align-items--desktop":
|
|
111
|
+
this.updateFlexProperties(t, e, i, A);
|
|
112
|
+
break;
|
|
113
|
+
case "wrap":
|
|
114
|
+
case "wrap--mobile":
|
|
115
|
+
case "wrap--tablet":
|
|
116
|
+
case "wrap--laptop":
|
|
117
|
+
case "wrap--desktop":
|
|
118
|
+
this.updateFlexProperties(t, e, i, $);
|
|
119
|
+
break;
|
|
120
|
+
case "direction":
|
|
121
|
+
case "direction--mobile":
|
|
122
|
+
case "direction--tablet":
|
|
123
|
+
case "direction--laptop":
|
|
124
|
+
case "direction--desktop":
|
|
125
|
+
this.updateFlexProperties(t, e, i, y);
|
|
126
|
+
break;
|
|
127
|
+
default:
|
|
128
|
+
super.attributeChangedCallback(t, e, i);
|
|
129
|
+
break;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
updateFlexProperties(t, e, i, r) {
|
|
133
|
+
this.checkName(r, i) || console.error(`Bad ${t} value for`, this.$el);
|
|
134
|
+
const o = t.indexOf("--") > -1, s = o ? t.split("--")[0] : t, n = [];
|
|
135
|
+
if (!o)
|
|
136
|
+
this.getAttribute(s + "--mobile") || n.push("mobile"), this.getAttribute(s + "--tablet") || n.push("tablet"), this.getAttribute(s + "--laptop") || n.push("laptop"), this.getAttribute(s + "--desktop") || n.push("desktop"), n.forEach((l) => {
|
|
137
|
+
this.updateStyle(s, l, e, r), this.updateStyle(s, l, i, r);
|
|
138
|
+
});
|
|
139
|
+
else {
|
|
140
|
+
const l = t.split("--")[1];
|
|
141
|
+
this.updateStyle(s, l, e, r), this.updateStyle(s, l, i, r);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
updateStyle(t, e, i, r) {
|
|
145
|
+
i !== null && i !== "" && i !== "default" && (t === "gap" && r.includes(i) ? this.$el.style.setProperty(
|
|
146
|
+
`--flex-${t}--${e}-value`,
|
|
147
|
+
`var(--px-spacing-${i}-${e === "laptop" ? "desktop" : e})`
|
|
148
|
+
) : this.$el.style.setProperty(
|
|
149
|
+
`--flex-${t}--${e}-value`,
|
|
150
|
+
i
|
|
151
|
+
));
|
|
152
|
+
}
|
|
153
|
+
checkName(t, e) {
|
|
154
|
+
return t.includes(e);
|
|
155
|
+
}
|
|
156
|
+
get direction() {
|
|
157
|
+
return this.getAttribute("direction");
|
|
158
|
+
}
|
|
159
|
+
set direction(t) {
|
|
160
|
+
this.setAttribute("direction", t);
|
|
161
|
+
}
|
|
162
|
+
get directionMobile() {
|
|
163
|
+
return this.getAttribute("direction--mobile");
|
|
164
|
+
}
|
|
165
|
+
set directionMobile(t) {
|
|
166
|
+
this.setAttribute("direction--mobile", t);
|
|
167
|
+
}
|
|
168
|
+
get directionTablet() {
|
|
169
|
+
return this.getAttribute("direction--tablet");
|
|
170
|
+
}
|
|
171
|
+
set directionTablet(t) {
|
|
172
|
+
this.setAttribute("direction--tablet", t);
|
|
173
|
+
}
|
|
174
|
+
get directionLaptop() {
|
|
175
|
+
return this.getAttribute("direction--laptop");
|
|
176
|
+
}
|
|
177
|
+
set directionLaptop(t) {
|
|
178
|
+
this.setAttribute("direction--laptop", t);
|
|
179
|
+
}
|
|
180
|
+
get directionDesktop() {
|
|
181
|
+
return this.getAttribute("direction--desktop");
|
|
182
|
+
}
|
|
183
|
+
set directionDesktop(t) {
|
|
184
|
+
this.setAttribute("direction--desktop", t);
|
|
185
|
+
}
|
|
186
|
+
get gap() {
|
|
187
|
+
return this.getAttribute("gap");
|
|
188
|
+
}
|
|
189
|
+
set gap(t) {
|
|
190
|
+
this.setAttribute("gap", t);
|
|
191
|
+
}
|
|
192
|
+
get gapMobile() {
|
|
193
|
+
return this.getAttribute("gap--mobile");
|
|
194
|
+
}
|
|
195
|
+
set gapMobile(t) {
|
|
196
|
+
this.setAttribute("gap--mobile", t);
|
|
197
|
+
}
|
|
198
|
+
get gapTablet() {
|
|
199
|
+
return this.getAttribute("gap--tablet");
|
|
200
|
+
}
|
|
201
|
+
set gapTablet(t) {
|
|
202
|
+
this.setAttribute("gap--tablet", t);
|
|
203
|
+
}
|
|
204
|
+
get gapLaptop() {
|
|
205
|
+
return this.getAttribute("gap--laptop");
|
|
206
|
+
}
|
|
207
|
+
set gapLaptop(t) {
|
|
208
|
+
this.setAttribute("gap--laptop", t);
|
|
209
|
+
}
|
|
210
|
+
get justifyContent() {
|
|
211
|
+
return this.getAttribute("justify-content");
|
|
212
|
+
}
|
|
213
|
+
set justifyContent(t) {
|
|
214
|
+
this.setAttribute("justify-content", t);
|
|
215
|
+
}
|
|
216
|
+
get justifyContentMobile() {
|
|
217
|
+
return this.getAttribute("justify-content--mobile");
|
|
218
|
+
}
|
|
219
|
+
set justifyContentMobile(t) {
|
|
220
|
+
this.setAttribute("justify-content--mobile", t);
|
|
221
|
+
}
|
|
222
|
+
get justifyContentTablet() {
|
|
223
|
+
return this.getAttribute("justify-content--tablet");
|
|
224
|
+
}
|
|
225
|
+
set justifyContentTablet(t) {
|
|
226
|
+
this.setAttribute("justify-content--tablet", t);
|
|
227
|
+
}
|
|
228
|
+
get justifyContentLaptop() {
|
|
229
|
+
return this.getAttribute("justify-content--laptop");
|
|
230
|
+
}
|
|
231
|
+
set justifyContentLaptop(t) {
|
|
232
|
+
this.setAttribute("justify-content--laptop", t);
|
|
233
|
+
}
|
|
234
|
+
get justifyContentDesktop() {
|
|
235
|
+
return this.getAttribute("justify-content--desktop");
|
|
236
|
+
}
|
|
237
|
+
set justifyContentDesktop(t) {
|
|
238
|
+
this.setAttribute("justify-content--desktop", t);
|
|
239
|
+
}
|
|
240
|
+
get alignItems() {
|
|
241
|
+
return this.getAttribute("align-items");
|
|
242
|
+
}
|
|
243
|
+
set alignItems(t) {
|
|
244
|
+
this.setAttribute("align-items", t);
|
|
245
|
+
}
|
|
246
|
+
get alignItemsMobile() {
|
|
247
|
+
return this.getAttribute("align-items--mobile");
|
|
248
|
+
}
|
|
249
|
+
set alignItemsMobile(t) {
|
|
250
|
+
this.setAttribute("align-items--mobile", t);
|
|
251
|
+
}
|
|
252
|
+
get alignItemsTablet() {
|
|
253
|
+
return this.getAttribute("align-items--tablet");
|
|
254
|
+
}
|
|
255
|
+
set alignItemsTablet(t) {
|
|
256
|
+
this.setAttribute("align-items--tablet", t);
|
|
257
|
+
}
|
|
258
|
+
get alignItemsLaptop() {
|
|
259
|
+
return this.getAttribute("align-items--laptop");
|
|
260
|
+
}
|
|
261
|
+
set alignItemsLaptop(t) {
|
|
262
|
+
this.setAttribute("align-items--laptop", t);
|
|
263
|
+
}
|
|
264
|
+
get alignItemsDesktop() {
|
|
265
|
+
return this.getAttribute("align-items--desktop");
|
|
266
|
+
}
|
|
267
|
+
set alignItemsDesktop(t) {
|
|
268
|
+
this.setAttribute("align-items--desktop", t);
|
|
269
|
+
}
|
|
270
|
+
get wrap() {
|
|
271
|
+
return this.getAttribute("wrap");
|
|
272
|
+
}
|
|
273
|
+
set wrap(t) {
|
|
274
|
+
this.setAttribute("wrap", t);
|
|
275
|
+
}
|
|
276
|
+
get wrapMobile() {
|
|
277
|
+
return this.getAttribute("wrap--mobile");
|
|
278
|
+
}
|
|
279
|
+
set wrapMobile(t) {
|
|
280
|
+
this.setAttribute("wrap--mobile", t);
|
|
281
|
+
}
|
|
282
|
+
get wrapTablet() {
|
|
283
|
+
return this.getAttribute("wrap--tablet");
|
|
284
|
+
}
|
|
285
|
+
set wrapTablet(t) {
|
|
286
|
+
this.setAttribute("wrap--tablet", t);
|
|
287
|
+
}
|
|
288
|
+
get wrapLaptop() {
|
|
289
|
+
return this.getAttribute("wrap--laptop");
|
|
290
|
+
}
|
|
291
|
+
set wrapLaptop(t) {
|
|
292
|
+
this.setAttribute("wrap--laptop", t);
|
|
293
|
+
}
|
|
294
|
+
get wrapDesktop() {
|
|
295
|
+
return this.getAttribute("wrap--desktop");
|
|
296
|
+
}
|
|
297
|
+
set wrapDesktop(t) {
|
|
298
|
+
this.setAttribute("wrap--desktop", t);
|
|
299
|
+
}
|
|
300
|
+
get $el() {
|
|
301
|
+
return this.shadowRoot.querySelector(".flex-container");
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
customElements.get("px-stack") || customElements.define("px-stack", c);
|
|
305
|
+
class C extends c {
|
|
306
|
+
constructor() {
|
|
307
|
+
super();
|
|
308
|
+
}
|
|
309
|
+
connectedCallback() {
|
|
310
|
+
super.connectedCallback(), this.direction = "column", this.directionMobile = "column", this.directionTablet = "column", this.directionLaptop = "column", this.directionDesktop = "column";
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
customElements.get("px-vstack") || customElements.define("px-vstack", C);
|
|
314
|
+
class S extends c {
|
|
315
|
+
constructor() {
|
|
316
|
+
super();
|
|
317
|
+
}
|
|
318
|
+
connectedCallback() {
|
|
319
|
+
super.connectedCallback(), this.direction = "row", this.directionMobile = "row", this.directionTablet = "row", this.directionLaptop = "row", this.directionDesktop = "row";
|
|
320
|
+
}
|
|
321
|
+
}
|
|
322
|
+
customElements.get("px-hstack") || customElements.define("px-hstack", S);
|
|
323
|
+
class _ extends HTMLElement {
|
|
324
|
+
constructor() {
|
|
325
|
+
super();
|
|
326
|
+
}
|
|
327
|
+
static get observedAttributes() {
|
|
328
|
+
return ["grow"];
|
|
329
|
+
}
|
|
330
|
+
attributeChangedCallback(t, e, i) {
|
|
331
|
+
t === "grow" && (this.style.flexGrow = i);
|
|
332
|
+
}
|
|
333
|
+
connectedCallback() {
|
|
334
|
+
this.style.flexGrow = this.getAttribute("grow") || "1";
|
|
335
|
+
}
|
|
336
|
+
get grow() {
|
|
337
|
+
return this.getAttribute("grow");
|
|
338
|
+
}
|
|
339
|
+
set grow(t) {
|
|
340
|
+
this.setAttribute("grow", t);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
customElements.define("px-spacer", _);
|
|
344
|
+
const j = ":host{display:block;box-sizing:border-box}slot[name=body-container]{min-height:100vh}#image-sticky-box{margin-top:-2.5rem}", b = new CSSStyleSheet();
|
|
345
|
+
b.replaceSync(j);
|
|
346
|
+
class z extends u {
|
|
347
|
+
constructor() {
|
|
348
|
+
super(b), this.template = (t) => `
|
|
349
|
+
<px-container border-radius="none" padding="none">
|
|
350
|
+
<px-vstack>
|
|
351
|
+
<px-container id="header-container" border-radius="none">
|
|
352
|
+
<px-hstack>
|
|
353
|
+
<px-spacer></px-spacer>
|
|
354
|
+
<px-vstack
|
|
355
|
+
id="header-vstack-container"
|
|
356
|
+
gap="1rem"
|
|
357
|
+
grow="${this.grow}"
|
|
358
|
+
basis="${this.basis}"
|
|
359
|
+
>
|
|
360
|
+
<slot name="header-container"></slot>
|
|
361
|
+
</px-vstack>
|
|
362
|
+
<px-spacer></px-spacer>
|
|
363
|
+
</px-hstack>
|
|
364
|
+
</px-container>
|
|
365
|
+
<px-container
|
|
366
|
+
id="image-container"
|
|
367
|
+
border-radius="none"
|
|
368
|
+
padding="none"
|
|
369
|
+
padding-top="xl"
|
|
370
|
+
id="image-box"
|
|
371
|
+
background-size="cover"
|
|
372
|
+
background-position="top center"
|
|
373
|
+
padding-bottom="xl"
|
|
374
|
+
border-radius="none"
|
|
375
|
+
bgimg="${this.backgroundImage}"
|
|
376
|
+
>
|
|
377
|
+
<px-hstack>
|
|
378
|
+
<px-spacer></px-spacer>
|
|
379
|
+
<px-vstack grow="${this.grow}" basis="${this.basis}">
|
|
380
|
+
<slot name="image-container"></slot>
|
|
381
|
+
</px-vstack>
|
|
382
|
+
<px-spacer></px-spacer>
|
|
383
|
+
</px-hstack>
|
|
384
|
+
</px-container>
|
|
385
|
+
${t ? ` <px-hstack>
|
|
386
|
+
<px-spacer></px-spacer>
|
|
387
|
+
<px-container border-radius="none" box-shadow="xl" id="image-sticky-box" border="s" grow="${this.grow}" basis="${this.basis}" border-radius="m">
|
|
388
|
+
<px-vstack gap="1rem">
|
|
389
|
+
<slot name="image-sticky-container"></slot>
|
|
390
|
+
</px-vstack>
|
|
391
|
+
</px-container>
|
|
392
|
+
<px-spacer></px-spacer>
|
|
393
|
+
</px-hstack>` : ""}
|
|
394
|
+
<px-container
|
|
395
|
+
id="body-container"
|
|
396
|
+
id="main"
|
|
397
|
+
background-color="${this.backgroundColor}"
|
|
398
|
+
padding="none"
|
|
399
|
+
padding-top="xl"
|
|
400
|
+
padding-bottom="xl"
|
|
401
|
+
>
|
|
402
|
+
<px-hstack>
|
|
403
|
+
<px-spacer></px-spacer>
|
|
404
|
+
<px-vstack
|
|
405
|
+
id="body-vstack-container"
|
|
406
|
+
gap="3rem"
|
|
407
|
+
grow="${this.grow}"
|
|
408
|
+
basis="${this.basis}"
|
|
409
|
+
>
|
|
410
|
+
<slot name="body-container"></slot>
|
|
411
|
+
</px-vstack>
|
|
412
|
+
<px-spacer></px-spacer>
|
|
413
|
+
</px-hstack>
|
|
414
|
+
</px-container>
|
|
415
|
+
<px-container
|
|
416
|
+
id="contact-container"
|
|
417
|
+
border-radius="none"
|
|
418
|
+
id="main"
|
|
419
|
+
background-color="container-weak"
|
|
420
|
+
padding="none"
|
|
421
|
+
padding-top="xl"
|
|
422
|
+
padding-bottom="xl"
|
|
423
|
+
>
|
|
424
|
+
<px-hstack>
|
|
425
|
+
<px-spacer></px-spacer>
|
|
426
|
+
<px-vstack gap="3rem" grow="${this.grow}" basis="${this.basis}">
|
|
427
|
+
<slot name="contact-container"></slot>
|
|
428
|
+
</px-vstack>
|
|
429
|
+
<px-spacer></px-spacer>
|
|
430
|
+
</px-hstack>
|
|
431
|
+
</px-container>
|
|
432
|
+
<px-container
|
|
433
|
+
id="footer-container"
|
|
434
|
+
background-color="none"
|
|
435
|
+
border-radius="none"
|
|
436
|
+
style="background-color: rgb(108, 66, 156)"
|
|
437
|
+
padding-top="xl"
|
|
438
|
+
padding-bottom="xl"
|
|
439
|
+
>
|
|
440
|
+
<px-hstack>
|
|
441
|
+
<px-spacer></px-spacer>
|
|
442
|
+
<px-vstack gap="3rem" grow="${this.grow}" basis="${this.basis}">
|
|
443
|
+
<slot name="footer-container"></slot>
|
|
444
|
+
</px-vstack>
|
|
445
|
+
<px-spacer></px-spacer>
|
|
446
|
+
</px-hstack>
|
|
447
|
+
</px-container>
|
|
448
|
+
</px-vstack>
|
|
449
|
+
</px-container>
|
|
450
|
+
`, this.shadowRoot.innerHTML = this.template(!!this.$imageStickySlot);
|
|
451
|
+
}
|
|
452
|
+
static get observedAttributes() {
|
|
453
|
+
return [
|
|
454
|
+
...super.observedAttributes,
|
|
455
|
+
"background-image",
|
|
456
|
+
"gap",
|
|
457
|
+
"background-color",
|
|
458
|
+
"padding-vertical",
|
|
459
|
+
"padding-horizontal"
|
|
460
|
+
];
|
|
461
|
+
}
|
|
462
|
+
get $wideImage() {
|
|
463
|
+
return this.shadowRoot.querySelector("#image-box");
|
|
464
|
+
}
|
|
465
|
+
get $bodyVStackContainer() {
|
|
466
|
+
return this.shadowRoot.querySelector("#header-vstack-container");
|
|
467
|
+
}
|
|
468
|
+
get $bodyContainer() {
|
|
469
|
+
return this.shadowRoot.querySelector("#body-container");
|
|
470
|
+
}
|
|
471
|
+
get $contactContainer() {
|
|
472
|
+
return this.shadowRoot.querySelector("#contact-container");
|
|
473
|
+
}
|
|
474
|
+
get $footerContainer() {
|
|
475
|
+
return this.shadowRoot.querySelector("#footer-container");
|
|
476
|
+
}
|
|
477
|
+
get $headerContainer() {
|
|
478
|
+
return this.shadowRoot.querySelector("#header-container");
|
|
479
|
+
}
|
|
480
|
+
get $imageContainer() {
|
|
481
|
+
return this.shadowRoot.querySelector("#image-container");
|
|
482
|
+
}
|
|
483
|
+
get backgroundImage() {
|
|
484
|
+
return this.getAttribute("background-image");
|
|
485
|
+
}
|
|
486
|
+
get $imageStickySlot() {
|
|
487
|
+
return this.querySelector('*[slot="image-sticky-container"]');
|
|
488
|
+
}
|
|
489
|
+
get $main() {
|
|
490
|
+
return this.shadowRoot.querySelector("#main");
|
|
491
|
+
}
|
|
492
|
+
get backgroundColor() {
|
|
493
|
+
return this.getAttribute("background-color") || "none";
|
|
494
|
+
}
|
|
495
|
+
get paddingVertical() {
|
|
496
|
+
return this.getAttribute("padding-vertical");
|
|
497
|
+
}
|
|
498
|
+
get paddingHorizontal() {
|
|
499
|
+
return this.getAttribute("padding-horizontal");
|
|
500
|
+
}
|
|
501
|
+
set paddingVertical(t) {
|
|
502
|
+
this.setAttribute("padding-vertical", t);
|
|
503
|
+
}
|
|
504
|
+
set paddingHorizontal(t) {
|
|
505
|
+
this.setAttribute("padding-horizontal", t);
|
|
506
|
+
}
|
|
507
|
+
get gap() {
|
|
508
|
+
return this.getAttribute("gap");
|
|
509
|
+
}
|
|
510
|
+
connectedCallback() {
|
|
511
|
+
this.handlePaddingVerticalChange(this.paddingVertical), this.handlePaddingHorizontalChange(this.paddingHorizontal);
|
|
512
|
+
}
|
|
513
|
+
attributeChangedCallback(t, e, i) {
|
|
514
|
+
if (e !== i)
|
|
515
|
+
switch (t) {
|
|
516
|
+
case "background-image":
|
|
517
|
+
this.$imageContainer.setAttribute("background-image", i);
|
|
518
|
+
break;
|
|
519
|
+
case "gap":
|
|
520
|
+
this.$bodyVStackContainer.setAttribute("gap", i);
|
|
521
|
+
break;
|
|
522
|
+
case "background-color":
|
|
523
|
+
this.$bodyContainer.setAttribute(
|
|
524
|
+
"background-color",
|
|
525
|
+
x.indexOf(i) > 0 ? i : "none"
|
|
526
|
+
);
|
|
527
|
+
break;
|
|
528
|
+
case "padding-vertical":
|
|
529
|
+
this.handlePaddingVerticalChange(i);
|
|
530
|
+
break;
|
|
531
|
+
case "padding-horizontal":
|
|
532
|
+
this.handlePaddingHorizontalChange(i);
|
|
533
|
+
break;
|
|
534
|
+
default:
|
|
535
|
+
super.attributeChangedCallback(t, e, i);
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
handlePaddingVerticalChange(t) {
|
|
539
|
+
this.$headerContainer.setAttribute("padding-top", t), this.$footerContainer.setAttribute("padding-bottom", t);
|
|
540
|
+
}
|
|
541
|
+
handlePaddingHorizontalChange(t) {
|
|
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
|
+
}
|
|
544
|
+
}
|
|
545
|
+
customElements.get("px-page") === void 0 && customElements.define("px-page", z);
|
|
546
|
+
const h = new CSSStyleSheet();
|
|
547
|
+
h.replaceSync(m);
|
|
548
|
+
const d = ["", "default", "xs", "s", "l", "2xl"], p = ["", "default", "s", "m", "l"], H = ["", "default", "left", "center"], I = ["", "default", "left", "center"];
|
|
549
|
+
class L extends HTMLElement {
|
|
550
|
+
template() {
|
|
551
|
+
return `
|
|
552
|
+
<div class="tile__container">
|
|
553
|
+
<px-hstack gap="after-element-s" justify-content="space-between" align-items="center" class="tile__header">
|
|
554
|
+
<slot name="prefix"></slot>
|
|
555
|
+
<slot name="action"></slot>
|
|
556
|
+
</px-hstack>
|
|
557
|
+
<px-vstack gap="after-element-2xs" class="tile__content">
|
|
558
|
+
<slot></slot>
|
|
559
|
+
<slot name="description"></slot>
|
|
560
|
+
</px-vstack>
|
|
561
|
+
</div>
|
|
562
|
+
`;
|
|
563
|
+
}
|
|
564
|
+
constructor() {
|
|
565
|
+
super(), this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [h];
|
|
566
|
+
}
|
|
567
|
+
connectedCallback() {
|
|
568
|
+
if (!this.$slotPrefix && !this.$slotAction && this.$tileHeader.classList.toggle("tile__header--empty"), this.$slotAction && !this.$slotPrefix && this.$tileHeader && this.$tileHeader.setAttribute("justify-content", "flex-end"), this.$slotPrefix) {
|
|
569
|
+
const t = this.querySelector("px-icon"), e = this.querySelector("px-img");
|
|
570
|
+
t && (t.hasAttribute("size") ? d.includes(
|
|
571
|
+
t.getAttribute("size")
|
|
572
|
+
) ? (t.getAttribute("size") === "" || t.getAttribute("size") === "default") && t.setAttribute("size", "s") : (console.error(
|
|
573
|
+
`Wrong icon size value for prefix. Allowed values are: ${d.join(
|
|
574
|
+
", "
|
|
575
|
+
)}.`
|
|
576
|
+
), t.setAttribute("size", "s")) : t.setAttribute("size", "s"), t.setAttribute("color", "content-brand")), e && (e.hasAttribute("width") ? p.includes(
|
|
577
|
+
e.getAttribute("width")
|
|
578
|
+
) ? (e.getAttribute("width") === "" || e.getAttribute("width") === "default") && e.setAttribute("width", "s") : (console.error(
|
|
579
|
+
`Wrong img width value for prefix. Allowed values are: ${p.join(
|
|
580
|
+
", "
|
|
581
|
+
)}.`
|
|
582
|
+
), e.setAttribute("width", "s")) : e.setAttribute("width", "s"), e.setAttribute("border-radius", "pill"));
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
static get observedAttributes() {
|
|
586
|
+
return ["header-alignment", "content-alignment", "inverted"];
|
|
587
|
+
}
|
|
588
|
+
attributeChangedCallback(t, e, i) {
|
|
589
|
+
if (e !== i)
|
|
590
|
+
switch (t) {
|
|
591
|
+
case "header-alignment":
|
|
592
|
+
this.updateHeaderAlignment(e, i, H);
|
|
593
|
+
break;
|
|
594
|
+
case "content-alignment":
|
|
595
|
+
this.updateContentAlignment(
|
|
596
|
+
e,
|
|
597
|
+
i,
|
|
598
|
+
I
|
|
599
|
+
);
|
|
600
|
+
break;
|
|
601
|
+
}
|
|
602
|
+
}
|
|
603
|
+
checkName(t, e) {
|
|
604
|
+
return t.includes(e);
|
|
605
|
+
}
|
|
606
|
+
updateHeaderAlignment(t, e, i) {
|
|
607
|
+
this.checkName(i, e) || console.error(`${e} is not an allowed header-alignment value.`), this.$tileHeader && !this.$slotAction && (t !== null && t !== "" && t !== "default" && (t === "left" && (t = "flex-start"), this.$tileHeader.setAttribute("justify-content", t)), e !== null && e !== "" && e !== "default" && (e === "left" && (e = "flex-start"), this.$tileHeader.setAttribute("justify-content", e)));
|
|
608
|
+
}
|
|
609
|
+
updateContentAlignment(t, e, i) {
|
|
610
|
+
this.checkName(i, e) || console.error(`${e} is not an allowed content-alignment value.`), this.$tileContent && (t !== null && t !== "" && t !== "default" && (this.$tileContent.style.textAlign = t), e !== null && e !== "" && e !== "default" && (this.$tileContent.style.textAlign = e));
|
|
611
|
+
}
|
|
612
|
+
get $tileHeader() {
|
|
613
|
+
return this.shadowRoot.querySelector(".tile__header");
|
|
614
|
+
}
|
|
615
|
+
get $tileContent() {
|
|
616
|
+
return this.shadowRoot.querySelector(".tile__content");
|
|
617
|
+
}
|
|
618
|
+
get $slotPrefix() {
|
|
619
|
+
return this.querySelector('[slot="prefix"]');
|
|
620
|
+
}
|
|
621
|
+
get $slotAction() {
|
|
622
|
+
return this.querySelector('[slot="action"]');
|
|
623
|
+
}
|
|
624
|
+
get headerAlignment() {
|
|
625
|
+
return this.getAttribute("header-alignment");
|
|
626
|
+
}
|
|
627
|
+
set headerAlignment(t) {
|
|
628
|
+
this.setAttribute("header-alignment", t);
|
|
629
|
+
}
|
|
630
|
+
get contentAlignment() {
|
|
631
|
+
return this.getAttribute("content-alignment");
|
|
632
|
+
}
|
|
633
|
+
set contentAlignment(t) {
|
|
634
|
+
this.setAttribute("content-alignment", t);
|
|
635
|
+
}
|
|
636
|
+
get inverted() {
|
|
637
|
+
return this.getAttribute("inverted");
|
|
638
|
+
}
|
|
639
|
+
set inverted(t) {
|
|
640
|
+
this.setAttribute("inverted", t);
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
const R = ":host{display:inline-block}.tile{display:inline-block;padding:var(--px-padding-s-mobile);text-align:left;cursor:pointer;--btn-transition: all .2s ease-in-out 0s;transition:var(--btn-transition);border:var(--px-border-size-m) solid transparent;border-radius:var(--px-radius-main);background:var( --tile-background-color-default, var(--px-background-color-action-primary-inverted) )}.tile,.tile *{box-sizing:border-box}.tile:hover:not([disabled],[aria-disabled=true],.loading){background-color:var(--px-background-color-action-hover-bordered-default);border-color:var(--px-border-color-action-hover-default)}.tile:focus:not([disabled],[aria-disabled=true]){outline-offset:var(--px-focus-offset-mobile);outline:var(--px-focus-outline-mobile) solid var(--px-border-color-focus-outline-default)}.tile[disabled],.tile[aria-disabled=true]{cursor:default;pointer-events:none}@media only screen and (min-width: 768px){.tile{padding:var(--px-padding-s-tablet)}.tile:focus:not([disabled],[aria-disabled=true]){outline-offset:var(--px-focus-offset-tablet);outline-width:var(--px-focus-outline-tablet)}}@media only screen and (min-width: 1025px){.tile{padding:var(--px-padding-s-desktop)}.tile:focus:not([disabled],[aria-disabled=true]){outline-offset:var(--px-focus-offset-desktop);outline-width:var(--px-focus-outline-desktop)}}:host([inverted]) .tile{background:var( --tile-background-color-inverted, var(--px-background-color-action-primary-default) )}:host([inverted]) .tile:hover:not([disabled],[aria-disabled=true],.loading){background-color:var( --px-background-color-action-hover-bordered-inverted );border-color:var(--px-border-color-action-hover-inverted)}:host([inverted]) .tile:focus:not([disabled],[aria-disabled=true]){outline-color:var(--px-border-color-focus-outline-inverted)}", f = new CSSStyleSheet();
|
|
644
|
+
f.replaceSync(R);
|
|
645
|
+
const P = ["", "default", "action-neutral"];
|
|
646
|
+
class T extends L {
|
|
647
|
+
template() {
|
|
648
|
+
return `
|
|
649
|
+
<button class="tile">
|
|
650
|
+
${super.template()}
|
|
651
|
+
</button>
|
|
652
|
+
`;
|
|
653
|
+
}
|
|
654
|
+
constructor() {
|
|
655
|
+
super(), this.shadowRoot.adoptedStyleSheets = [
|
|
656
|
+
...this.shadowRoot.adoptedStyleSheets,
|
|
657
|
+
f
|
|
658
|
+
];
|
|
659
|
+
}
|
|
660
|
+
static get observedAttributes() {
|
|
661
|
+
return [...super.observedAttributes, "background-color"];
|
|
662
|
+
}
|
|
663
|
+
attributeChangedCallback(t, e, i) {
|
|
664
|
+
if (super.attributeChangedCallback(t, e, i), e !== i)
|
|
665
|
+
switch (t) {
|
|
666
|
+
case "background-color":
|
|
667
|
+
this.updateBackgroundColor(e, i, P);
|
|
668
|
+
break;
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
updateBackgroundColor(t, e, i) {
|
|
672
|
+
if (!this.checkName(i, e)) {
|
|
673
|
+
console.error("Bad color value for", this.$el);
|
|
674
|
+
return;
|
|
675
|
+
}
|
|
676
|
+
const r = (o) => {
|
|
677
|
+
o !== null && o !== "" && o !== "default" && (this.$el.style.setProperty(
|
|
678
|
+
"--tile-background-color-default",
|
|
679
|
+
`var(--px-background-color-${o}-default)`
|
|
680
|
+
), this.$el.style.setProperty(
|
|
681
|
+
"--tile-background-color-inverted",
|
|
682
|
+
`var(--px-background-color-${o}-inverted)`
|
|
683
|
+
));
|
|
684
|
+
};
|
|
685
|
+
r(t), r(e);
|
|
686
|
+
}
|
|
687
|
+
get $el() {
|
|
688
|
+
return this.shadowRoot.querySelector(".tile");
|
|
689
|
+
}
|
|
690
|
+
get backgroundColor() {
|
|
691
|
+
return this.getAttribute("background-color");
|
|
692
|
+
}
|
|
693
|
+
set backgroundColor(t) {
|
|
694
|
+
this.setAttribute("background-color", t);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
customElements.define("px-tile", T);
|
|
698
|
+
export {
|
|
699
|
+
T as Tile,
|
|
700
|
+
P as backgroundColorValues
|
|
701
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@proximus/lavender-tile",
|
|
3
|
+
"version": "1.0.0-alpha.12",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"exports": {
|
|
7
|
+
".": {
|
|
8
|
+
"types": "./src/index.ts",
|
|
9
|
+
"development": "./src/index.ts",
|
|
10
|
+
"default": "./dist/index.js"
|
|
11
|
+
},
|
|
12
|
+
"./src/*.css": {
|
|
13
|
+
"development": "src/*.css"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"type": "module",
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "rm -rf dist;tsc; vite build",
|
|
22
|
+
"test": "vitest run --coverage"
|
|
23
|
+
},
|
|
24
|
+
"publishConfig": {
|
|
25
|
+
"access": "public"
|
|
26
|
+
},
|
|
27
|
+
"gitHead": "747626981362ce4c17f746ff6e88bc104ba6aebd",
|
|
28
|
+
"lerna": {
|
|
29
|
+
"command": {
|
|
30
|
+
"publish": {
|
|
31
|
+
"assets": [
|
|
32
|
+
"CHANGELOG.md",
|
|
33
|
+
"package.json",
|
|
34
|
+
"dist/*.js",
|
|
35
|
+
"dist/css/**/*.css"
|
|
36
|
+
]
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|