@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.
@@ -15,6 +15,7 @@ export declare class SgdsMainnav extends SgdsElement {
15
15
  breakpointReached: Boolean;
16
16
  expanded: Boolean;
17
17
  firstUpdated(): void;
18
+ _handleSlotChange(e: Event): void;
18
19
  render(): import("lit-html").TemplateResult<1>;
19
20
  _expandClass(): string;
20
21
  }
package/index.js CHANGED
@@ -27095,7 +27095,7 @@ slot[name=non-collapsible] {
27095
27095
  gap: 1rem;
27096
27096
  }
27097
27097
 
27098
- .slot-end::slotted(:not(sgds-mainnav-item)) {
27098
+ .slot-end::slotted(:not([name$=-mainnav-item])) {
27099
27099
  align-self: center;
27100
27100
  }`;
27101
27101
 
@@ -34209,6 +34209,11 @@ let SgdsMainnav = class SgdsMainnav extends SgdsElement {
34209
34209
  });
34210
34210
  }
34211
34211
  }
34212
+ // assigning name attribute to elements added in slot="end", to use wildcard css selector to assign styles only to *-mainnav-item
34213
+ _handleSlotChange(e) {
34214
+ const childElements = e.target.assignedElements({ flatten: true });
34215
+ childElements.forEach(e => e.setAttribute('name', e.tagName.toLowerCase()));
34216
+ }
34212
34217
  render() {
34213
34218
  this.breakpointReached = window.innerWidth < SIZES[this.expand.toString()];
34214
34219
  const collapseClass = "collapse navbar-collapse order-4";
@@ -34256,7 +34261,7 @@ let SgdsMainnav = class SgdsMainnav extends SgdsElement {
34256
34261
  >
34257
34262
  <ul class="navbar-nav">
34258
34263
  <slot></slot>
34259
- <slot name="end" class=${o$2({ "slot-end": !this.breakpointReached })}></slot>
34264
+ <slot name="end" class=${o$2({ "slot-end": !this.breakpointReached })} @slotchange=${this._handleSlotChange}></slot>
34260
34265
  </ul>
34261
34266
  </div>
34262
34267
  </nav>