@proximus/lavender-section 2.0.0-alpha.90 → 2.0.0-alpha.92
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/Section.d.ts +9 -1
- package/dist/index.es.js +62 -16
- package/package.json +1 -1
package/dist/Section.d.ts
CHANGED
|
@@ -6,9 +6,17 @@ export declare class Section extends HTMLElement {
|
|
|
6
6
|
constructor();
|
|
7
7
|
connectedCallback(): void;
|
|
8
8
|
static get observedAttributes(): string[];
|
|
9
|
-
get $container(): Container;
|
|
10
9
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
10
|
+
disconnectedCallback(): void;
|
|
11
|
+
toggleOverlapSpacing(): void;
|
|
12
|
+
private isNotEmptyNode;
|
|
13
|
+
setHeadingSpacing(): void;
|
|
14
|
+
get $container(): Container;
|
|
15
|
+
get $mainContentWrapper(): HTMLElement;
|
|
11
16
|
get $slotOverlap(): HTMLSlotElement;
|
|
17
|
+
get $slottedOverlap(): HTMLSlotElement;
|
|
18
|
+
get $slotHeading(): HTMLSlotElement;
|
|
19
|
+
get $slottedHeading(): HTMLSlotElement;
|
|
12
20
|
get backgroundColor(): string;
|
|
13
21
|
set backgroundColor(value: string);
|
|
14
22
|
get gradient(): string;
|
package/dist/index.es.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { backgroundColorValues as
|
|
1
|
+
import { backgroundColorValues as r } from "@proximus/lavender-common";
|
|
2
2
|
import "@proximus/lavender-container";
|
|
3
3
|
import "@proximus/lavender-layout";
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
class
|
|
4
|
+
const d = ':host{display:block}:host,:host *{box-sizing:border-box}.content-wrapper{margin-inline:var(--px-padding-s-mobile);max-width:var(--px-content-wrapper-max-width-desktop)}@media only screen and (min-width: 77em){.content-wrapper{margin-inline:auto}}.overlapped{margin-bottom:calc(var(--px-overlapped-mobile) * -1)}::slotted([slot="overlap"]){margin-top:var(--px-overlapped-mobile)}@media only screen and (min-width: 48em){.overlapped{margin-bottom:calc(var(--px-overlapped-desktop) * -1)}::slotted([slot="overlap"]){margin-top:var(--px-overlapped-desktop)}}@media only screen and (min-width: 64.0625em){.overlapped{margin-bottom:calc(var(--px-overlapped-desktop) * -1)}::slotted([slot="overlap"]){margin-top:var(--px-overlapped-desktop)}}', a = new CSSStyleSheet();
|
|
5
|
+
a.replaceSync(d);
|
|
6
|
+
class n extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
8
8
|
super(), this.template = () => `
|
|
9
9
|
<px-container border-radius="none" padding-inline="none">
|
|
@@ -19,12 +19,14 @@ class d extends HTMLElement {
|
|
|
19
19
|
<div class="content-wrapper">
|
|
20
20
|
<slot name="overlap"></slot>
|
|
21
21
|
</div>
|
|
22
|
-
`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [
|
|
22
|
+
`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [a];
|
|
23
23
|
}
|
|
24
24
|
connectedCallback() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
var t, o;
|
|
26
|
+
this.$container.setAttribute("background-color", this.backgroundColor), !this.paddingBlock && !this.paddingTop && !this.paddingBottom && !this.paddingBlockMobile && !this.paddingTopMobile && !this.paddingBottomMobile && !this.paddingBlockTablet && !this.paddingTopTablet && !this.paddingBottomTablet && !this.paddingBlockLaptop && !this.paddingTopLaptop && !this.paddingBottomLaptop && (this.$container.paddingBlock = "none"), this.setHeadingSpacing = this.setHeadingSpacing.bind(this), this.setHeadingSpacing(), (t = this.$slotHeading) == null || t.addEventListener("slotchange", this.setHeadingSpacing), this.toggleOverlapSpacing = this.toggleOverlapSpacing.bind(this), this.toggleOverlapSpacing(), (o = this.$slotOverlap) == null || o.addEventListener(
|
|
27
|
+
"slotchange",
|
|
28
|
+
this.toggleOverlapSpacing
|
|
29
|
+
);
|
|
28
30
|
}
|
|
29
31
|
static get observedAttributes() {
|
|
30
32
|
return [
|
|
@@ -55,14 +57,11 @@ class d extends HTMLElement {
|
|
|
55
57
|
"border-side--laptop"
|
|
56
58
|
];
|
|
57
59
|
}
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
}
|
|
61
|
-
attributeChangedCallback(t, i, e) {
|
|
62
|
-
if (i !== e)
|
|
60
|
+
attributeChangedCallback(t, o, e) {
|
|
61
|
+
if (o !== e)
|
|
63
62
|
switch (t) {
|
|
64
63
|
case "background-color":
|
|
65
|
-
this.$container.backgroundColor =
|
|
64
|
+
this.$container.backgroundColor = r.indexOf(e) > 0 ? e : "none";
|
|
66
65
|
break;
|
|
67
66
|
case "background-gradient":
|
|
68
67
|
this.$container.gradient = this.gradient;
|
|
@@ -138,9 +137,56 @@ class d extends HTMLElement {
|
|
|
138
137
|
break;
|
|
139
138
|
}
|
|
140
139
|
}
|
|
140
|
+
disconnectedCallback() {
|
|
141
|
+
var t, o;
|
|
142
|
+
(t = this.$slotHeading) == null || t.removeEventListener(
|
|
143
|
+
"slotchange",
|
|
144
|
+
this.setHeadingSpacing
|
|
145
|
+
), (o = this.$slotOverlap) == null || o.removeEventListener(
|
|
146
|
+
"slotchange",
|
|
147
|
+
this.toggleOverlapSpacing
|
|
148
|
+
);
|
|
149
|
+
}
|
|
150
|
+
toggleOverlapSpacing() {
|
|
151
|
+
const t = this.$slotOverlap, o = this.$mainContentWrapper;
|
|
152
|
+
if (!t || !o) return;
|
|
153
|
+
const i = t.assignedNodes({ flatten: !0 }).some(this.isNotEmptyNode);
|
|
154
|
+
o.classList.toggle("overlapped", i);
|
|
155
|
+
}
|
|
156
|
+
isNotEmptyNode(t) {
|
|
157
|
+
return t.nodeType === Node.ELEMENT_NODE ? !0 : t.nodeType === Node.TEXT_NODE ? (t.textContent ?? "").trim().length > 0 : !1;
|
|
158
|
+
}
|
|
159
|
+
setHeadingSpacing() {
|
|
160
|
+
var e;
|
|
161
|
+
const t = this.$slotHeading, o = (e = this.shadowRoot) == null ? void 0 : e.querySelector("px-vstack");
|
|
162
|
+
t && o && (t.assignedElements().length > 0 ? o.setAttribute("gap", "heading-to-content") : o.setAttribute("gap", "none"));
|
|
163
|
+
}
|
|
164
|
+
get $container() {
|
|
165
|
+
var t;
|
|
166
|
+
return (t = this.shadowRoot) == null ? void 0 : t.querySelector("px-container");
|
|
167
|
+
}
|
|
168
|
+
get $mainContentWrapper() {
|
|
169
|
+
var t;
|
|
170
|
+
return (t = this.$container) == null ? void 0 : t.querySelector(".content-wrapper");
|
|
171
|
+
}
|
|
141
172
|
get $slotOverlap() {
|
|
173
|
+
var t;
|
|
174
|
+
return (t = this.shadowRoot) == null ? void 0 : t.querySelector(
|
|
175
|
+
'slot[name="overlap"]'
|
|
176
|
+
);
|
|
177
|
+
}
|
|
178
|
+
get $slottedOverlap() {
|
|
142
179
|
return this.querySelector('[slot="overlap"]');
|
|
143
180
|
}
|
|
181
|
+
get $slotHeading() {
|
|
182
|
+
var t;
|
|
183
|
+
return (t = this.shadowRoot) == null ? void 0 : t.querySelector(
|
|
184
|
+
'slot[name="heading"]'
|
|
185
|
+
);
|
|
186
|
+
}
|
|
187
|
+
get $slottedHeading() {
|
|
188
|
+
return this.querySelector('[slot="heading"]');
|
|
189
|
+
}
|
|
144
190
|
get backgroundColor() {
|
|
145
191
|
return this.getAttribute("background-color") || "none";
|
|
146
192
|
}
|
|
@@ -292,7 +338,7 @@ class d extends HTMLElement {
|
|
|
292
338
|
this.setAttribute("border-side--laptop", t);
|
|
293
339
|
}
|
|
294
340
|
}
|
|
295
|
-
customElements.get("px-section") || customElements.define("px-section",
|
|
341
|
+
customElements.get("px-section") || customElements.define("px-section", n);
|
|
296
342
|
export {
|
|
297
|
-
|
|
343
|
+
n as Section
|
|
298
344
|
};
|