@proximus/lavender-section 1.4.9-beta.2 → 1.4.9
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 -11
- package/dist/index.es.js +15 -65
- package/package.json +1 -1
package/dist/Section.d.ts
CHANGED
|
@@ -1,23 +1,14 @@
|
|
|
1
|
-
import { WithExtraAttributes } from '@proximus/lavender-common';
|
|
2
1
|
import type { Container } from '@proximus/lavender-container';
|
|
3
2
|
import '@proximus/lavender-container';
|
|
4
3
|
import '@proximus/lavender-layout';
|
|
5
|
-
export declare class Section extends
|
|
4
|
+
export declare class Section extends HTMLElement {
|
|
6
5
|
private template;
|
|
7
6
|
constructor();
|
|
8
7
|
connectedCallback(): void;
|
|
9
8
|
static get observedAttributes(): string[];
|
|
10
|
-
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
11
|
-
disconnectedCallback(): void;
|
|
12
|
-
toggleOverlapSpacing(): void;
|
|
13
|
-
private isNotEmptyNode;
|
|
14
|
-
setHeadingSpacing(): void;
|
|
15
9
|
get $container(): Container;
|
|
16
|
-
|
|
10
|
+
attributeChangedCallback(name: string, oldValue: string, newValue: string): void;
|
|
17
11
|
get $slotOverlap(): HTMLSlotElement;
|
|
18
|
-
get $slottedOverlap(): HTMLSlotElement;
|
|
19
|
-
get $slotHeading(): HTMLSlotElement;
|
|
20
|
-
get $slottedHeading(): HTMLSlotElement;
|
|
21
12
|
get backgroundColor(): string;
|
|
22
13
|
set backgroundColor(value: string);
|
|
23
14
|
get gradient(): string;
|
package/dist/index.es.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { backgroundColorValues as a } from "@proximus/lavender-common";
|
|
2
2
|
import "@proximus/lavender-container";
|
|
3
3
|
import "@proximus/lavender-layout";
|
|
4
|
-
const
|
|
5
|
-
|
|
6
|
-
class
|
|
4
|
+
const r = ':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)}}', o = new CSSStyleSheet();
|
|
5
|
+
o.replaceSync(r);
|
|
6
|
+
class d extends HTMLElement {
|
|
7
7
|
constructor() {
|
|
8
|
-
super(
|
|
8
|
+
super(), 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,18 +19,15 @@ class s extends r {
|
|
|
19
19
|
<div class="content-wrapper">
|
|
20
20
|
<slot name="overlap"></slot>
|
|
21
21
|
</div>
|
|
22
|
-
`, this.shadowRoot.innerHTML = this.template();
|
|
22
|
+
`, this.attachShadow({ mode: "open" }), this.shadowRoot.innerHTML = this.template(), this.shadowRoot.adoptedStyleSheets = [o];
|
|
23
23
|
}
|
|
24
24
|
connectedCallback() {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
this.toggleOverlapSpacing
|
|
29
|
-
);
|
|
25
|
+
this.$container.setAttribute("background-color", this.backgroundColor), this.$slotOverlap && this.shadowRoot.firstElementChild.querySelector(".content-wrapper").classList.add("overlapped");
|
|
26
|
+
const t = this.querySelector('[slot="heading"]');
|
|
27
|
+
!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"), t || this.shadowRoot.querySelector("px-vstack").setAttribute("gap", "none");
|
|
30
28
|
}
|
|
31
29
|
static get observedAttributes() {
|
|
32
30
|
return [
|
|
33
|
-
...super.observedAttributes,
|
|
34
31
|
"background-color",
|
|
35
32
|
"background-gradient",
|
|
36
33
|
"background-image",
|
|
@@ -58,11 +55,14 @@ class s extends r {
|
|
|
58
55
|
"border-side--laptop"
|
|
59
56
|
];
|
|
60
57
|
}
|
|
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 = a.indexOf(e) > 0 ? e : "none";
|
|
66
66
|
break;
|
|
67
67
|
case "background-gradient":
|
|
68
68
|
this.$container.gradient = this.gradient;
|
|
@@ -136,61 +136,11 @@ class s extends r {
|
|
|
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;
|
|
142
139
|
}
|
|
143
140
|
}
|
|
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
|
-
}
|
|
176
141
|
get $slotOverlap() {
|
|
177
|
-
var t;
|
|
178
|
-
return (t = this.shadowRoot) == null ? void 0 : t.querySelector(
|
|
179
|
-
'slot[name="overlap"]'
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
get $slottedOverlap() {
|
|
183
142
|
return this.querySelector('[slot="overlap"]');
|
|
184
143
|
}
|
|
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
|
-
}
|
|
194
144
|
get backgroundColor() {
|
|
195
145
|
return this.getAttribute("background-color") || "none";
|
|
196
146
|
}
|
|
@@ -342,7 +292,7 @@ class s extends r {
|
|
|
342
292
|
this.setAttribute("border-side--laptop", t);
|
|
343
293
|
}
|
|
344
294
|
}
|
|
345
|
-
customElements.get("px-section") || customElements.define("px-section",
|
|
295
|
+
customElements.get("px-section") || customElements.define("px-section", d);
|
|
346
296
|
export {
|
|
347
|
-
|
|
297
|
+
d as Section
|
|
348
298
|
};
|