@proximus/lavender-section 2.0.0-alpha.10 → 2.0.0-alpha.101
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 +64 -17
- 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,13 +1,13 @@
|
|
|
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 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
|
|
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 screen and (min-width: 77rem){.content-wrapper{margin-inline:auto}}.overlapped{margin-bottom:calc(var(--px-overlapped-mobile) * -1)}::slotted([slot="overlap"]){margin-top:var(--px-overlapped-mobile)}@media screen and (min-width: 48rem){.overlapped{margin-bottom:calc(var(--px-overlapped-desktop) * -1)}::slotted([slot="overlap"]){margin-top:var(--px-overlapped-desktop)}}@media screen and (min-width: 64.0625rem){.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
|
-
<px-container border-radius="none" padding-inline="none"
|
|
10
|
-
<div class="content-wrapper
|
|
9
|
+
<px-container border-radius="none" padding-inline="none">
|
|
10
|
+
<div class="content-wrapper">
|
|
11
11
|
<px-vstack gap="heading-to-content">
|
|
12
12
|
<slot name="heading"></slot>
|
|
13
13
|
<px-vstack gap="none">
|
|
@@ -19,11 +19,14 @@ class r 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
|
-
!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"),
|
|
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
|
+
);
|
|
27
30
|
}
|
|
28
31
|
static get observedAttributes() {
|
|
29
32
|
return [
|
|
@@ -54,14 +57,11 @@ class r extends HTMLElement {
|
|
|
54
57
|
"border-side--laptop"
|
|
55
58
|
];
|
|
56
59
|
}
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
}
|
|
60
|
-
attributeChangedCallback(t, i, e) {
|
|
61
|
-
if (i !== e)
|
|
60
|
+
attributeChangedCallback(t, o, e) {
|
|
61
|
+
if (o !== e)
|
|
62
62
|
switch (t) {
|
|
63
63
|
case "background-color":
|
|
64
|
-
this.$container.backgroundColor =
|
|
64
|
+
this.$container.backgroundColor = r.indexOf(e) > 0 ? e : "none";
|
|
65
65
|
break;
|
|
66
66
|
case "background-gradient":
|
|
67
67
|
this.$container.gradient = this.gradient;
|
|
@@ -137,9 +137,56 @@ class r extends HTMLElement {
|
|
|
137
137
|
break;
|
|
138
138
|
}
|
|
139
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
|
+
}
|
|
140
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() {
|
|
141
179
|
return this.querySelector('[slot="overlap"]');
|
|
142
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
|
+
}
|
|
143
190
|
get backgroundColor() {
|
|
144
191
|
return this.getAttribute("background-color") || "none";
|
|
145
192
|
}
|
|
@@ -291,7 +338,7 @@ class r extends HTMLElement {
|
|
|
291
338
|
this.setAttribute("border-side--laptop", t);
|
|
292
339
|
}
|
|
293
340
|
}
|
|
294
|
-
customElements.get("px-section") || customElements.define("px-section",
|
|
341
|
+
customElements.get("px-section") || customElements.define("px-section", n);
|
|
295
342
|
export {
|
|
296
|
-
|
|
343
|
+
n as Section
|
|
297
344
|
};
|