@govtechsg/sgds-web-component 3.0.4 → 3.0.5

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/Masthead/index.js CHANGED
@@ -4162,7 +4162,7 @@
4162
4162
  /** @internal */
4163
4163
  SgdsElement.dependencies = {};
4164
4164
 
4165
- var css_248z$2 = css`b{font-weight:bolder}[role=button]{cursor:pointer}a{color:#0049dc}a:hover{color:#0022b9}.sgds-masthead{font-family:Inter,system-ui,sans-serif;font-size:.875rem;line-height:1.25rem}.banner{background-color:light-dark(#f3f3f3,#1a1a1a)}.container{margin-left:auto;margin-right:auto;max-width:var(--sgds-mainnav-max-width);padding:.25rem var(--sgds-mainnav-padding-x);width:100%}.sg-crest{flex-shrink:0;height:20px;width:20px}.sg-crest path{fill:#db0000}.masthead-layout{display:flex;gap:.25rem}.masthead-text-layout{align-items:center;display:flex;flex-wrap:wrap;gap:0 .75rem}.sgds-masthead-identify-icon{align-self:center;display:block;height:20px;transform:rotate(180deg);transition:transform .3s ease-in-out 0s;user-select:none;width:20px}.sgds-masthead-identify-icon.show{transform:rotate(0deg)}.sgds-masthead-button{align-items:center;color:light-dark(#0269d0,#60aaf4);cursor:pointer;display:flex;gap:4px}.sgds-masthead-button:hover{color:light-dark(#0151a0,#96c7f7)}.panel{background-color:light-dark(oklch(from #0e0e0e l c h/.1),oklch(from #fff l c h/.1))}.sgds-masthead .sgds-masthead-content{display:none;padding-bottom:1rem;padding-top:1rem}.sgds-masthead .sgds-masthead-content.show{display:block}.content-grid{display:grid;gap:1.5rem;grid-template-columns:repeat(auto-fit,minmax(300px,1fr))}.icon{margin-top:-.1em}.wrapper{display:flex;gap:.5rem}.content{display:flex;flex-direction:column;gap:.25rem}.content .title{font-weight:600}.content article{color:light-dark(#525252,#a5a5a5)}.banner-icon,.banner-icon-inline{height:20px;width:20px}.banner-icon path,.banner-icon-inline path{fill:light-dark(#1a1a1a,#f3f3f3)}a.trusted-websites-link{color:light-dark(#0269d0,#60aaf4);text-decoration:underline;width:fit-content}a.trusted-websites-link:hover{color:light-dark(#0151a0,#96c7f7)}@media screen and (max-width:768px){.container{padding:.25rem var(--sgds-mainnav-mobile-padding-x)}.sgds-masthead-content .content-grid{gap:1rem;grid-template-columns:1fr}}`;
4165
+ var css_248z$2 = css`b{font-weight:bolder}[role=button]{cursor:pointer}a{color:#0049dc}a:hover{color:#0022b9}.sgds-masthead{font-family:Inter,system-ui,sans-serif;font-size:.875rem;line-height:1.25rem}.banner{background-color:light-dark(#f3f3f3,#1a1a1a)}.container{margin-left:auto;margin-right:auto;max-width:var(--sgds-mainnav-max-width);padding:.25rem var(--sgds-mainnav-padding-x);width:100%}.sg-crest{flex-shrink:0;height:20px;width:20px}.sg-crest path{fill:#db0000}.masthead-layout{display:flex;gap:.25rem}.masthead-text-layout{align-items:center;display:flex;flex-wrap:wrap;gap:0 .75rem}.sgds-masthead-identify-icon{align-self:center;display:block;height:20px;transform:rotate(180deg);transition:transform .3s ease-in-out 0s;user-select:none;width:20px}.sgds-masthead-identify-icon.show{transform:rotate(0deg)}.sgds-masthead-button{align-items:center;color:light-dark(#0269d0,#60aaf4);cursor:pointer;display:flex;gap:4px}.sgds-masthead-button:hover{color:light-dark(#0151a0,#96c7f7)}.panel{background-color:light-dark(oklch(from #0e0e0e l c h/.1),oklch(from #fff l c h/.1))}.sgds-masthead .sgds-masthead-content{display:none;padding-bottom:1rem;padding-top:1rem}.sgds-masthead .sgds-masthead-content.show{display:block}.content-grid{display:grid;gap:1.5rem;grid-template-columns:repeat(auto-fit,minmax(300px,1fr))}.icon{margin-top:-.1em}.wrapper{display:flex;gap:.5rem}.content{display:flex;flex-direction:column;gap:.25rem}.content .title{font-weight:600}.content article{color:light-dark(#525252,#a5a5a5)}.banner-icon,.banner-icon-inline{height:20px;width:20px}.banner-icon path,.banner-icon-inline path{fill:light-dark(#1a1a1a,#f3f3f3)}a.trusted-websites-link{color:light-dark(#0269d0,#60aaf4);text-decoration:underline;width:fit-content}a.trusted-websites-link:hover{color:light-dark(#0151a0,#96c7f7)}.sgds-masthead-button:focus,.sgds-masthead-button:focus-visible,a.trusted-websites-link:focus,a.trusted-websites-link:focus-visible{box-shadow:0 0 0 4px #60aaf4;outline:0}@media screen and (max-width:768px){.container{padding:.25rem var(--sgds-mainnav-mobile-padding-x)}.sgds-masthead-content .content-grid{gap:1rem;grid-template-columns:1fr}}`;
4166
4166
 
4167
4167
  var css_248z$1 = css`svg{vertical-align:middle}`;
4168
4168
 
@@ -4178,6 +4178,13 @@
4178
4178
  this.toggleVisibility = false;
4179
4179
  }
4180
4180
  /** @internal */
4181
+ _handleKeydown(event) {
4182
+ if (event.key === "Enter" || event.key === " ") {
4183
+ event.preventDefault();
4184
+ this._toggleVisibility();
4185
+ }
4186
+ }
4187
+ /** @internal */
4181
4188
  _toggleVisibility() {
4182
4189
  this.toggleVisibility = !this.toggleVisibility;
4183
4190
  }
@@ -4226,9 +4233,11 @@
4226
4233
  class="sgds-masthead-button"
4227
4234
  id="sgds-masthead-identify"
4228
4235
  role="button"
4236
+ tabindex="0"
4229
4237
  aria-expanded="${this.toggleVisibility}"
4230
4238
  aria-controls="sgds-masthead-content"
4231
- @click=${() => this._toggleVisibility()}
4239
+ @keydown=${this._handleKeydown}
4240
+ @click=${this._toggleVisibility}
4232
4241
  >
4233
4242
  <span>How to identify</span>
4234
4243
  <svg
@@ -4611,7 +4611,7 @@
4611
4611
  this.orientation = "vertical";
4612
4612
  /** Sets the image position of the card. Available options: `before`, `after` */
4613
4613
  this.imagePosition = "before";
4614
- /** Sets the orientation of the card. Available options: `default`, `padding around`, `aspect ratio` */
4614
+ /** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */
4615
4615
  this.imageAdjustment = "default";
4616
4616
  }
4617
4617
  firstUpdated() {
@@ -4642,7 +4642,7 @@
4642
4642
  if (childNodes.length > 1) {
4643
4643
  return console.error("Multiple elements passed into SgdsCard's link slot");
4644
4644
  }
4645
- if (this.stretchedLink) {
4645
+ if (this.stretchedLink && childNodes[0] instanceof HTMLAnchorElement) {
4646
4646
  const hyperlink = childNodes[0].querySelector("a") || childNodes[0];
4647
4647
  this.card.setAttribute("href", hyperlink.href);
4648
4648
  const linkSlot = this.shadowRoot.querySelector("slot[name='link']");