@proximus/lavender-section 1.4.9-beta.1 → 1.4.9-beta.2
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 +65 -15
- 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,11 +1,11 @@
|
|
|
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-tablet) * -1)}::slotted([slot="overlap"]){margin-top:var(--px-overlapped-tablet)}}@media screen and (min-width: 64.0625rem){.overlapped{margin-bottom:calc(var(--px-overlapped-laptop) * -1)}::slotted([slot="overlap"]){margin-top:var(--px-overlapped-laptop)}}', 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,15 +19,18 @@ class d 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
|
-
|
|
27
|
-
|
|
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
|
+
);
|
|
28
30
|
}
|
|
29
31
|
static get observedAttributes() {
|
|
30
32
|
return [
|
|
33
|
+
...super.observedAttributes,
|
|
31
34
|
"background-color",
|
|
32
35
|
"background-gradient",
|
|
33
36
|
"background-image",
|
|
@@ -55,14 +58,11 @@ class d extends HTMLElement {
|
|
|
55
58
|
"border-side--laptop"
|
|
56
59
|
];
|
|
57
60
|
}
|
|
58
|
-
get $container() {
|
|
59
|
-
return this.shadowRoot.querySelector("px-container");
|
|
60
|
-
}
|
|
61
61
|
attributeChangedCallback(t, i, e) {
|
|
62
62
|
if (i !== e)
|
|
63
63
|
switch (t) {
|
|
64
64
|
case "background-color":
|
|
65
|
-
this.$container.backgroundColor =
|
|
65
|
+
this.$container.backgroundColor = d.indexOf(e) > 0 ? e : "none";
|
|
66
66
|
break;
|
|
67
67
|
case "background-gradient":
|
|
68
68
|
this.$container.gradient = this.gradient;
|
|
@@ -136,11 +136,61 @@ class d extends HTMLElement {
|
|
|
136
136
|
case "border-side--laptop":
|
|
137
137
|
this.$container.borderSideLaptop = e;
|
|
138
138
|
break;
|
|
139
|
+
default:
|
|
140
|
+
super.attributeChangedCallback(t, i, e);
|
|
141
|
+
break;
|
|
139
142
|
}
|
|
140
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
|
+
}
|
|
141
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() {
|
|
142
183
|
return this.querySelector('[slot="overlap"]');
|
|
143
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
|
+
}
|
|
144
194
|
get backgroundColor() {
|
|
145
195
|
return this.getAttribute("background-color") || "none";
|
|
146
196
|
}
|
|
@@ -292,7 +342,7 @@ class d extends HTMLElement {
|
|
|
292
342
|
this.setAttribute("border-side--laptop", t);
|
|
293
343
|
}
|
|
294
344
|
}
|
|
295
|
-
customElements.get("px-section") || customElements.define("px-section",
|
|
345
|
+
customElements.get("px-section") || customElements.define("px-section", s);
|
|
296
346
|
export {
|
|
297
|
-
|
|
347
|
+
s as Section
|
|
298
348
|
};
|