@proximus/lavender-section 2.0.0-alpha.12 → 2.0.0-alpha.121
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 +11 -2
- package/dist/index.es.js +67 -16
- package/package.json +1 -1
package/dist/Section.d.ts
CHANGED
|
@@ -1,14 +1,23 @@
|
|
|
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;
|
|
8
9
|
static get observedAttributes(): string[];
|
|
9
|
-
get $container(): Container;
|
|
10
10
|
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
11
|
+
disconnectedCallback(): void;
|
|
12
|
+
toggleOverlapSpacing(): void;
|
|
13
|
+
private isNotEmptyNode;
|
|
14
|
+
setHeadingSpacing(): void;
|
|
15
|
+
get $container(): Container;
|
|
16
|
+
get $mainContentWrapper(): HTMLElement;
|
|
11
17
|
get $slotOverlap(): HTMLSlotElement;
|
|
18
|
+
get $slottedOverlap(): HTMLSlotElement;
|
|
19
|
+
get $slotHeading(): HTMLSlotElement;
|
|
20
|
+
get $slottedHeading(): HTMLSlotElement;
|
|
12
21
|
get backgroundColor(): string;
|
|
13
22
|
set backgroundColor(value: string);
|
|
14
23
|
get gradient(): string;
|
package/dist/index.es.js
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { backgroundColorValues as
|
|
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
|
-
|
|
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 = () => `
|
|
9
|
-
<px-container border-radius="none" padding-inline="none"
|
|
10
|
-
<div class="content-wrapper
|
|
8
|
+
super(a), this.template = () => `
|
|
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,14 +19,18 @@ class r 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
|
-
|
|
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, 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
|
+
"slotchange",
|
|
28
|
+
this.toggleOverlapSpacing
|
|
29
|
+
);
|
|
27
30
|
}
|
|
28
31
|
static get observedAttributes() {
|
|
29
32
|
return [
|
|
33
|
+
...super.observedAttributes,
|
|
30
34
|
"background-color",
|
|
31
35
|
"background-gradient",
|
|
32
36
|
"background-image",
|
|
@@ -54,14 +58,11 @@ class r extends HTMLElement {
|
|
|
54
58
|
"border-side--laptop"
|
|
55
59
|
];
|
|
56
60
|
}
|
|
57
|
-
get $container() {
|
|
58
|
-
return this.shadowRoot.querySelector("px-container");
|
|
59
|
-
}
|
|
60
61
|
attributeChangedCallback(t, i, e) {
|
|
61
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,11 +136,61 @@ class r 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
|
}
|
|
144
|
+
disconnectedCallback() {
|
|
145
|
+
var t, i;
|
|
146
|
+
(t = this.$slotHeading) == null || t.removeEventListener(
|
|
147
|
+
"slotchange",
|
|
148
|
+
this.setHeadingSpacing
|
|
149
|
+
), (i = this.$slotOverlap) == null || i.removeEventListener(
|
|
150
|
+
"slotchange",
|
|
151
|
+
this.toggleOverlapSpacing
|
|
152
|
+
);
|
|
153
|
+
}
|
|
154
|
+
toggleOverlapSpacing() {
|
|
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);
|
|
159
|
+
}
|
|
160
|
+
isNotEmptyNode(t) {
|
|
161
|
+
return t.nodeType === Node.ELEMENT_NODE ? !0 : t.nodeType === Node.TEXT_NODE ? (t.textContent ?? "").trim().length > 0 : !1;
|
|
162
|
+
}
|
|
163
|
+
setHeadingSpacing() {
|
|
164
|
+
var e;
|
|
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"));
|
|
167
|
+
}
|
|
168
|
+
get $container() {
|
|
169
|
+
var t;
|
|
170
|
+
return (t = this.shadowRoot) == null ? void 0 : t.querySelector("px-container");
|
|
171
|
+
}
|
|
172
|
+
get $mainContentWrapper() {
|
|
173
|
+
var t;
|
|
174
|
+
return (t = this.$container) == null ? void 0 : t.querySelector(".content-wrapper");
|
|
175
|
+
}
|
|
140
176
|
get $slotOverlap() {
|
|
177
|
+
var t;
|
|
178
|
+
return (t = this.shadowRoot) == null ? void 0 : t.querySelector(
|
|
179
|
+
'slot[name="overlap"]'
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
get $slottedOverlap() {
|
|
141
183
|
return this.querySelector('[slot="overlap"]');
|
|
142
184
|
}
|
|
185
|
+
get $slotHeading() {
|
|
186
|
+
var t;
|
|
187
|
+
return (t = this.shadowRoot) == null ? void 0 : t.querySelector(
|
|
188
|
+
'slot[name="heading"]'
|
|
189
|
+
);
|
|
190
|
+
}
|
|
191
|
+
get $slottedHeading() {
|
|
192
|
+
return this.querySelector('[slot="heading"]');
|
|
193
|
+
}
|
|
143
194
|
get backgroundColor() {
|
|
144
195
|
return this.getAttribute("background-color") || "none";
|
|
145
196
|
}
|
|
@@ -291,7 +342,7 @@ class r extends HTMLElement {
|
|
|
291
342
|
this.setAttribute("border-side--laptop", t);
|
|
292
343
|
}
|
|
293
344
|
}
|
|
294
|
-
customElements.get("px-section") || customElements.define("px-section",
|
|
345
|
+
customElements.get("px-section") || customElements.define("px-section", s);
|
|
295
346
|
export {
|
|
296
|
-
|
|
347
|
+
s as Section
|
|
297
348
|
};
|