@proximus/lavender 2.0.0-alpha.90 → 2.0.0-alpha.92

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.
@@ -8646,17 +8646,20 @@ class Section extends HTMLElement {
8646
8646
  this.shadowRoot.adoptedStyleSheets = [styleSheet$t];
8647
8647
  }
8648
8648
  connectedCallback() {
8649
+ var _a, _b;
8649
8650
  this.$container.setAttribute("background-color", this.backgroundColor);
8650
- if (this.$slotOverlap) {
8651
- this.shadowRoot.firstElementChild.querySelector(".content-wrapper").classList.add("overlapped");
8652
- }
8653
- const headingSlot = this.querySelector('[slot="heading"]');
8654
8651
  if (!this.paddingBlock && !this.paddingTop && !this.paddingBottom && !this.paddingBlockMobile && !this.paddingTopMobile && !this.paddingBottomMobile && !this.paddingBlockTablet && !this.paddingTopTablet && !this.paddingBottomTablet && !this.paddingBlockLaptop && !this.paddingTopLaptop && !this.paddingBottomLaptop) {
8655
8652
  this.$container.paddingBlock = "none";
8656
8653
  }
8657
- if (!headingSlot) {
8658
- this.shadowRoot.querySelector("px-vstack").setAttribute("gap", "none");
8659
- }
8654
+ this.setHeadingSpacing = this.setHeadingSpacing.bind(this);
8655
+ this.setHeadingSpacing();
8656
+ (_a = this.$slotHeading) == null ? void 0 : _a.addEventListener("slotchange", this.setHeadingSpacing);
8657
+ this.toggleOverlapSpacing = this.toggleOverlapSpacing.bind(this);
8658
+ this.toggleOverlapSpacing();
8659
+ (_b = this.$slotOverlap) == null ? void 0 : _b.addEventListener(
8660
+ "slotchange",
8661
+ this.toggleOverlapSpacing
8662
+ );
8660
8663
  }
8661
8664
  static get observedAttributes() {
8662
8665
  return [
@@ -8687,9 +8690,6 @@ class Section extends HTMLElement {
8687
8690
  "border-side--laptop"
8688
8691
  ];
8689
8692
  }
8690
- get $container() {
8691
- return this.shadowRoot.querySelector("px-container");
8692
- }
8693
8693
  attributeChangedCallback(name, oldValue, newValue) {
8694
8694
  if (oldValue !== newValue) {
8695
8695
  switch (name) {
@@ -8771,9 +8771,71 @@ class Section extends HTMLElement {
8771
8771
  }
8772
8772
  }
8773
8773
  }
8774
+ disconnectedCallback() {
8775
+ var _a, _b;
8776
+ (_a = this.$slotHeading) == null ? void 0 : _a.removeEventListener(
8777
+ "slotchange",
8778
+ this.setHeadingSpacing
8779
+ );
8780
+ (_b = this.$slotOverlap) == null ? void 0 : _b.removeEventListener(
8781
+ "slotchange",
8782
+ this.toggleOverlapSpacing
8783
+ );
8784
+ }
8785
+ toggleOverlapSpacing() {
8786
+ const overlapSlot = this.$slotOverlap;
8787
+ const mainContentWrapper = this.$mainContentWrapper;
8788
+ if (!overlapSlot || !mainContentWrapper) return;
8789
+ const assignedNodes = overlapSlot.assignedNodes({ flatten: true });
8790
+ const hasOverlapContent = assignedNodes.some(this.isNotEmptyNode);
8791
+ mainContentWrapper.classList.toggle("overlapped", hasOverlapContent);
8792
+ }
8793
+ isNotEmptyNode(node) {
8794
+ if (node.nodeType === Node.ELEMENT_NODE) return true;
8795
+ if (node.nodeType === Node.TEXT_NODE) {
8796
+ return (node.textContent ?? "").trim().length > 0;
8797
+ }
8798
+ return false;
8799
+ }
8800
+ setHeadingSpacing() {
8801
+ var _a;
8802
+ const headingSlot = this.$slotHeading;
8803
+ const vStack = (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("px-vstack");
8804
+ if (headingSlot && vStack) {
8805
+ const hasHeadingContent = headingSlot.assignedElements().length > 0;
8806
+ if (hasHeadingContent) {
8807
+ vStack.setAttribute("gap", "heading-to-content");
8808
+ } else {
8809
+ vStack.setAttribute("gap", "none");
8810
+ }
8811
+ }
8812
+ }
8813
+ get $container() {
8814
+ var _a;
8815
+ return (_a = this.shadowRoot) == null ? void 0 : _a.querySelector("px-container");
8816
+ }
8817
+ get $mainContentWrapper() {
8818
+ var _a;
8819
+ return (_a = this.$container) == null ? void 0 : _a.querySelector(".content-wrapper");
8820
+ }
8774
8821
  get $slotOverlap() {
8822
+ var _a;
8823
+ return (_a = this.shadowRoot) == null ? void 0 : _a.querySelector(
8824
+ 'slot[name="overlap"]'
8825
+ );
8826
+ }
8827
+ get $slottedOverlap() {
8775
8828
  return this.querySelector('[slot="overlap"]');
8776
8829
  }
8830
+ get $slotHeading() {
8831
+ var _a;
8832
+ return (_a = this.shadowRoot) == null ? void 0 : _a.querySelector(
8833
+ 'slot[name="heading"]'
8834
+ );
8835
+ }
8836
+ get $slottedHeading() {
8837
+ return this.querySelector('[slot="heading"]');
8838
+ }
8777
8839
  get backgroundColor() {
8778
8840
  return this.getAttribute("background-color") || "none";
8779
8841
  }
@@ -9181,6 +9243,7 @@ const _ContentHeader = class _ContentHeader extends PxElement {
9181
9243
  </div>
9182
9244
  </px-container>
9183
9245
  </px-grid>
9246
+ <slot name="overlap" slot="overlap"></slot>
9184
9247
  </px-section>
9185
9248
  </div>`;
9186
9249
  this.shadowRoot.innerHTML = this.template();
@@ -9217,12 +9280,6 @@ const _ContentHeader = class _ContentHeader extends PxElement {
9217
9280
  </px-stack>`
9218
9281
  );
9219
9282
  }
9220
- if (this.$overlapSlot) {
9221
- this.shadowRoot.querySelector("px-section").insertAdjacentHTML(
9222
- "beforeend",
9223
- `<slot name="overlap" slot="overlap"></slot>`
9224
- );
9225
- }
9226
9283
  if (this.$subtitleSlot) {
9227
9284
  this.$subtitleSlot.setAttribute("variant", "subtitle");
9228
9285
  }
@@ -9739,6 +9796,11 @@ class Drawer extends HTMLElement {
9739
9796
  this.$closeButton.addEventListener("click", () => {
9740
9797
  this.hide();
9741
9798
  });
9799
+ this.$dialog.addEventListener("toggle", (e) => {
9800
+ if (e.newState === "closed") {
9801
+ this.hide();
9802
+ }
9803
+ });
9742
9804
  this.toggleFooterVisibility();
9743
9805
  (_a = this.$slotFooter) == null ? void 0 : _a.addEventListener(
9744
9806
  "slotchange",