@govtechsg/sgds-web-component 0.0.7 → 0.0.8

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/Mainnav/index.js CHANGED
@@ -6472,7 +6472,7 @@ slot[name=non-collapsible] {
6472
6472
  gap: 1rem;
6473
6473
  }
6474
6474
 
6475
- .slot-end::slotted(:not(sgds-mainnav-item)) {
6475
+ .slot-end::slotted(:not([name$=-mainnav-item])) {
6476
6476
  align-self: center;
6477
6477
  }`;
6478
6478
 
@@ -13608,6 +13608,11 @@ let SgdsMainnav = class SgdsMainnav extends SgdsElement {
13608
13608
  });
13609
13609
  }
13610
13610
  }
13611
+ // assigning name attribute to elements added in slot="end", to use wildcard css selector to assign styles only to *-mainnav-item
13612
+ _handleSlotChange(e) {
13613
+ const childElements = e.target.assignedElements({ flatten: true });
13614
+ childElements.forEach(e => e.setAttribute('name', e.tagName.toLowerCase()));
13615
+ }
13611
13616
  render() {
13612
13617
  this.breakpointReached = window.innerWidth < SIZES[this.expand.toString()];
13613
13618
  const collapseClass = "collapse navbar-collapse order-4";
@@ -13655,7 +13660,7 @@ let SgdsMainnav = class SgdsMainnav extends SgdsElement {
13655
13660
  >
13656
13661
  <ul class="navbar-nav">
13657
13662
  <slot></slot>
13658
- <slot name="end" class=${o({ "slot-end": !this.breakpointReached })}></slot>
13663
+ <slot name="end" class=${o({ "slot-end": !this.breakpointReached })} @slotchange=${this._handleSlotChange}></slot>
13659
13664
  </ul>
13660
13665
  </div>
13661
13666
  </nav>