@govtechsg/sgds-web-component 3.2.0-rc.3 → 3.2.0-rc.4

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/index.umd.js CHANGED
@@ -26866,51 +26866,45 @@
26866
26866
  * href link for terms of use
26867
26867
  */
26868
26868
  this.termsOfUseHref = "#";
26869
- }
26870
- firstUpdated() {
26871
- const socialMediaSlot = this.shadowRoot.querySelector("slot[name='social-media']");
26872
- const footerTitleSlot = this.shadowRoot.querySelector("slot[name='title']");
26873
- const footerDescriptionSlot = this.shadowRoot.querySelector("slot[name='description']");
26874
- const footerItemsSlot = this.shadowRoot.querySelector("slot[name='items']");
26875
- const socialMediaChildNodes = socialMediaSlot.assignedNodes({ flatten: true });
26876
- const footerTitleChildNodes = footerTitleSlot.assignedNodes({ flatten: true });
26877
- const footerDescriptionChildNodes = footerDescriptionSlot.assignedNodes({ flatten: true });
26878
- const footerItemsChildNodes = footerItemsSlot.assignedNodes({ flatten: true });
26879
- if (socialMediaChildNodes.length === 0) {
26880
- const socialMediaContainer = this.shadowRoot.querySelector(".social-media");
26881
- socialMediaContainer.style.display = "none";
26882
- }
26883
- if (footerTitleChildNodes.length === 0 && footerDescriptionChildNodes.length === 0) {
26884
- const footerHeaderContainer = this.shadowRoot.querySelector(".footer-header");
26885
- footerHeaderContainer.style.display = "none";
26886
- }
26887
- if (footerItemsChildNodes.length === 0) {
26888
- const footerItemsContainer = this.shadowRoot.querySelector(".footer-items");
26889
- footerItemsContainer.style.display = "none";
26890
- }
26891
- if (footerTitleChildNodes.length === 0 &&
26892
- footerDescriptionChildNodes.length === 0 &&
26893
- footerItemsChildNodes.length === 0) {
26894
- const footerTopContainer = this.shadowRoot.querySelector(".footer-top");
26895
- footerTopContainer.style.display = "none";
26896
- }
26869
+ this.hasSlotController = new HasSlotController(this, "social-media", "title", "description", "items");
26897
26870
  }
26898
26871
  render() {
26872
+ const hasSocialMediaSlot = this.hasSlotController.test("social-media");
26873
+ const hasTitleSlot = this.hasSlotController.test("title");
26874
+ const hasDescriptionSlot = this.hasSlotController.test("description");
26875
+ const hasItemsSlot = this.hasSlotController.test("items");
26876
+ const displayFooterHeader = hasTitleSlot || hasDescriptionSlot;
26877
+ const displayFooterItems = hasItemsSlot;
26878
+ const displaySocialMedia = hasSocialMediaSlot;
26879
+ const displayFooterTop = displayFooterHeader || displayFooterItems;
26899
26880
  return html$1 `
26900
26881
  <footer class="footer">
26901
- <section class="footer-top">
26902
- <div class="footer-header">
26903
- <slot name="title"></slot>
26904
- <slot name="description"></slot>
26905
- </div>
26906
- <div class="footer-items">
26907
- <slot name="items"></slot>
26908
- </div>
26909
- </section>
26882
+ ${displayFooterTop
26883
+ ? html$1 ` <section class="footer-top">
26884
+ ${displayFooterHeader
26885
+ ? html$1 `
26886
+ <div class="footer-header">
26887
+ <slot name="title"></slot>
26888
+ <slot name="description"></slot>
26889
+ </div>
26890
+ `
26891
+ : nothing}
26892
+ ${displayFooterItems
26893
+ ? html$1 ` <div class="footer-items">
26894
+ <slot name="items"></slot>
26895
+ </div>`
26896
+ : nothing}
26897
+ </section>`
26898
+ : nothing}
26899
+
26910
26900
  <section class="footer-bottom">
26911
- <div class="social-media">
26912
- <slot name="social-media"></slot>
26913
- </div>
26901
+ ${displaySocialMedia
26902
+ ? html$1 `
26903
+ <div class="social-media">
26904
+ <slot name="social-media"></slot>
26905
+ </div>
26906
+ `
26907
+ : nothing}
26914
26908
  <div class="footer-mandatory-links">
26915
26909
  <ul>
26916
26910
  <li><a href=${this.contactHref}>Contact</a></li>