@govtechsg/sgds-web-component 3.0.4 → 3.0.6

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.
Files changed (42) hide show
  1. package/Masthead/index.js +11 -2
  2. package/components/Card/index.umd.js +2 -2
  3. package/components/Card/index.umd.js.map +1 -1
  4. package/components/Card/sgds-card.d.ts +1 -1
  5. package/components/Card/sgds-card.js +2 -2
  6. package/components/Card/sgds-card.js.map +1 -1
  7. package/components/Datepicker/index.umd.js +1 -10
  8. package/components/Datepicker/index.umd.js.map +1 -1
  9. package/components/Input/index.umd.js +1 -10
  10. package/components/Input/index.umd.js.map +1 -1
  11. package/components/Input/sgds-input.d.ts +0 -2
  12. package/components/Input/sgds-input.js +1 -10
  13. package/components/Input/sgds-input.js.map +1 -1
  14. package/components/Masthead/index.umd.js +11 -2
  15. package/components/Masthead/index.umd.js.map +1 -1
  16. package/components/Masthead/masthead.js +1 -1
  17. package/components/Masthead/sgds-masthead.d.ts +2 -0
  18. package/components/Masthead/sgds-masthead.js +10 -1
  19. package/components/Masthead/sgds-masthead.js.map +1 -1
  20. package/components/QuantityToggle/index.umd.js +1 -10
  21. package/components/QuantityToggle/index.umd.js.map +1 -1
  22. package/components/index.umd.js +14 -14
  23. package/components/index.umd.js.map +1 -1
  24. package/css/grid.css +55 -16
  25. package/index.umd.js +14 -14
  26. package/index.umd.js.map +1 -1
  27. package/package.json +1 -4
  28. package/react/components/Card/sgds-card.cjs.js +2 -2
  29. package/react/components/Card/sgds-card.cjs.js.map +1 -1
  30. package/react/components/Card/sgds-card.js +2 -2
  31. package/react/components/Card/sgds-card.js.map +1 -1
  32. package/react/components/Input/sgds-input.cjs.js +1 -10
  33. package/react/components/Input/sgds-input.cjs.js.map +1 -1
  34. package/react/components/Input/sgds-input.js +1 -10
  35. package/react/components/Input/sgds-input.js.map +1 -1
  36. package/react/components/Masthead/masthead.cjs.js +1 -1
  37. package/react/components/Masthead/masthead.js +1 -1
  38. package/react/components/Masthead/sgds-masthead.cjs.js +10 -1
  39. package/react/components/Masthead/sgds-masthead.cjs.js.map +1 -1
  40. package/react/components/Masthead/sgds-masthead.js +10 -1
  41. package/react/components/Masthead/sgds-masthead.js.map +1 -1
  42. package/themes/root.css +17 -6
@@ -10109,7 +10109,7 @@
10109
10109
  this.orientation = "vertical";
10110
10110
  /** Sets the image position of the card. Available options: `before`, `after` */
10111
10111
  this.imagePosition = "before";
10112
- /** Sets the orientation of the card. Available options: `default`, `padding around`, `aspect ratio` */
10112
+ /** Controls how the image is sized and aligned within the card. Available options: `default`, `padding around`, `aspect ratio` */
10113
10113
  this.imageAdjustment = "default";
10114
10114
  }
10115
10115
  firstUpdated() {
@@ -10140,7 +10140,7 @@
10140
10140
  if (childNodes.length > 1) {
10141
10141
  return console.error("Multiple elements passed into SgdsCard's link slot");
10142
10142
  }
10143
- if (this.stretchedLink) {
10143
+ if (this.stretchedLink && childNodes[0] instanceof HTMLAnchorElement) {
10144
10144
  const hyperlink = childNodes[0].querySelector("a") || childNodes[0];
10145
10145
  this.card.setAttribute("href", hyperlink.href);
10146
10146
  const linkSlot = this.shadowRoot.querySelector("slot[name='link']");
@@ -21517,16 +21517,6 @@
21517
21517
  blur() {
21518
21518
  this.input.blur();
21519
21519
  }
21520
- /** Programatically sets the invalid state of the input. Pass in boolean value in the argument */
21521
- setInvalid(bool) {
21522
- this.invalid = bool;
21523
- if (bool) {
21524
- this.emit("sgds-invalid");
21525
- }
21526
- else {
21527
- this.emit("sgds-valid");
21528
- }
21529
- }
21530
21520
  /**
21531
21521
  * Checks for validity. Under the hood, HTMLFormElement's reportValidity method calls this method to check for component's validity state
21532
21522
  * Note that the native error popup is prevented for SGDS form components by default. Instead the validation message shows up in the feedback container of SgdsInput
@@ -21563,6 +21553,7 @@
21563
21553
  }
21564
21554
  _handleBlur() {
21565
21555
  const sgdsBlur = this.emit("sgds-blur", { cancelable: true });
21556
+ this.setInvalid(!this._mixinCheckValidity());
21566
21557
  if (sgdsBlur.defaultPrevented)
21567
21558
  return;
21568
21559
  this._isTouched = true;
@@ -24396,7 +24387,7 @@
24396
24387
  watch("disabled")
24397
24388
  ], SgdsMainnavItem.prototype, "_handleDisabled", null);
24398
24389
 
24399
- var css_248z$m = 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}}`;
24390
+ var css_248z$m = 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}}`;
24400
24391
 
24401
24392
  var css_248z$l = css`svg{vertical-align:middle}`;
24402
24393
 
@@ -24410,6 +24401,13 @@
24410
24401
  this.toggleVisibility = false;
24411
24402
  }
24412
24403
  /** @internal */
24404
+ _handleKeydown(event) {
24405
+ if (event.key === "Enter" || event.key === " ") {
24406
+ event.preventDefault();
24407
+ this._toggleVisibility();
24408
+ }
24409
+ }
24410
+ /** @internal */
24413
24411
  _toggleVisibility() {
24414
24412
  this.toggleVisibility = !this.toggleVisibility;
24415
24413
  }
@@ -24458,9 +24456,11 @@
24458
24456
  class="sgds-masthead-button"
24459
24457
  id="sgds-masthead-identify"
24460
24458
  role="button"
24459
+ tabindex="0"
24461
24460
  aria-expanded="${this.toggleVisibility}"
24462
24461
  aria-controls="sgds-masthead-content"
24463
- @click=${() => this._toggleVisibility()}
24462
+ @keydown=${this._handleKeydown}
24463
+ @click=${this._toggleVisibility}
24464
24464
  >
24465
24465
  <span>How to identify</span>
24466
24466
  <svg