@proximus/lavender-section 2.0.0-alpha.100 → 2.0.0-alpha.102
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 +2 -1
- package/dist/index.es.js +25 -21
- package/package.json +1 -1
package/dist/Section.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
|
+
import { WithExtraAttributes } from '@proximus/lavender-common';
|
|
1
2
|
import type { Container } from '@proximus/lavender-container';
|
|
2
3
|
import '@proximus/lavender-container';
|
|
3
4
|
import '@proximus/lavender-layout';
|
|
4
|
-
export declare class Section extends
|
|
5
|
+
export declare class Section extends WithExtraAttributes {
|
|
5
6
|
private template;
|
|
6
7
|
constructor();
|
|
7
8
|
connectedCallback(): void;
|
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { WithExtraAttributes as r, backgroundColorValues as d } from "@proximus/lavender-common";
|
|
2
2
|
import "@proximus/lavender-container";
|
|
3
3
|
import "@proximus/lavender-layout";
|
|
4
|
-
const
|
|
5
|
-
a.replaceSync(
|
|
6
|
-
class
|
|
4
|
+
const n = ':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(n);
|
|
6
|
+
class s extends r {
|
|
7
7
|
constructor() {
|
|
8
|
-
super(), this.template = () => `
|
|
8
|
+
super(a), this.template = () => `
|
|
9
9
|
<px-container border-radius="none" padding-inline="none">
|
|
10
10
|
<div class="content-wrapper">
|
|
11
11
|
<px-vstack gap="heading-to-content">
|
|
@@ -19,17 +19,18 @@ class n extends HTMLElement {
|
|
|
19
19
|
<div class="content-wrapper">
|
|
20
20
|
<slot name="overlap"></slot>
|
|
21
21
|
</div>
|
|
22
|
-
`, this.
|
|
22
|
+
`, this.shadowRoot.innerHTML = this.template();
|
|
23
23
|
}
|
|
24
24
|
connectedCallback() {
|
|
25
|
-
var t,
|
|
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(), (
|
|
25
|
+
var t, i;
|
|
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(), (i = this.$slotOverlap) == null || i.addEventListener(
|
|
27
27
|
"slotchange",
|
|
28
28
|
this.toggleOverlapSpacing
|
|
29
29
|
);
|
|
30
30
|
}
|
|
31
31
|
static get observedAttributes() {
|
|
32
32
|
return [
|
|
33
|
+
...super.observedAttributes,
|
|
33
34
|
"background-color",
|
|
34
35
|
"background-gradient",
|
|
35
36
|
"background-image",
|
|
@@ -57,11 +58,11 @@ class n extends HTMLElement {
|
|
|
57
58
|
"border-side--laptop"
|
|
58
59
|
];
|
|
59
60
|
}
|
|
60
|
-
attributeChangedCallback(t,
|
|
61
|
-
if (
|
|
61
|
+
attributeChangedCallback(t, i, e) {
|
|
62
|
+
if (i !== e)
|
|
62
63
|
switch (t) {
|
|
63
64
|
case "background-color":
|
|
64
|
-
this.$container.backgroundColor =
|
|
65
|
+
this.$container.backgroundColor = d.indexOf(e) > 0 ? e : "none";
|
|
65
66
|
break;
|
|
66
67
|
case "background-gradient":
|
|
67
68
|
this.$container.gradient = this.gradient;
|
|
@@ -135,31 +136,34 @@ class n extends HTMLElement {
|
|
|
135
136
|
case "border-side--laptop":
|
|
136
137
|
this.$container.borderSideLaptop = e;
|
|
137
138
|
break;
|
|
139
|
+
default:
|
|
140
|
+
super.attributeChangedCallback(t, i, e);
|
|
141
|
+
break;
|
|
138
142
|
}
|
|
139
143
|
}
|
|
140
144
|
disconnectedCallback() {
|
|
141
|
-
var t,
|
|
145
|
+
var t, i;
|
|
142
146
|
(t = this.$slotHeading) == null || t.removeEventListener(
|
|
143
147
|
"slotchange",
|
|
144
148
|
this.setHeadingSpacing
|
|
145
|
-
), (
|
|
149
|
+
), (i = this.$slotOverlap) == null || i.removeEventListener(
|
|
146
150
|
"slotchange",
|
|
147
151
|
this.toggleOverlapSpacing
|
|
148
152
|
);
|
|
149
153
|
}
|
|
150
154
|
toggleOverlapSpacing() {
|
|
151
|
-
const t = this.$slotOverlap,
|
|
152
|
-
if (!t || !
|
|
153
|
-
const
|
|
154
|
-
|
|
155
|
+
const t = this.$slotOverlap, i = this.$mainContentWrapper;
|
|
156
|
+
if (!t || !i) return;
|
|
157
|
+
const o = t.assignedNodes({ flatten: !0 }).some(this.isNotEmptyNode);
|
|
158
|
+
i.classList.toggle("overlapped", o);
|
|
155
159
|
}
|
|
156
160
|
isNotEmptyNode(t) {
|
|
157
161
|
return t.nodeType === Node.ELEMENT_NODE ? !0 : t.nodeType === Node.TEXT_NODE ? (t.textContent ?? "").trim().length > 0 : !1;
|
|
158
162
|
}
|
|
159
163
|
setHeadingSpacing() {
|
|
160
164
|
var e;
|
|
161
|
-
const t = this.$slotHeading,
|
|
162
|
-
t &&
|
|
165
|
+
const t = this.$slotHeading, i = (e = this.shadowRoot) == null ? void 0 : e.querySelector("px-vstack");
|
|
166
|
+
t && i && (t.assignedElements().length > 0 ? i.setAttribute("gap", "heading-to-content") : i.setAttribute("gap", "none"));
|
|
163
167
|
}
|
|
164
168
|
get $container() {
|
|
165
169
|
var t;
|
|
@@ -338,7 +342,7 @@ class n extends HTMLElement {
|
|
|
338
342
|
this.setAttribute("border-side--laptop", t);
|
|
339
343
|
}
|
|
340
344
|
}
|
|
341
|
-
customElements.get("px-section") || customElements.define("px-section",
|
|
345
|
+
customElements.get("px-section") || customElements.define("px-section", s);
|
|
342
346
|
export {
|
|
343
|
-
|
|
347
|
+
s as Section
|
|
344
348
|
};
|