@govtechsg/sgds-web-component 3.1.1 → 3.1.2

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 (56) hide show
  1. package/components/Badge/index.umd.js +63 -44
  2. package/components/Badge/index.umd.js.map +1 -1
  3. package/components/Badge/sgds-badge.d.ts +3 -1
  4. package/components/Badge/sgds-badge.js +23 -4
  5. package/components/Badge/sgds-badge.js.map +1 -1
  6. package/components/ComboBox/index.umd.js +29 -9
  7. package/components/ComboBox/index.umd.js.map +1 -1
  8. package/components/ComboBox/sgds-combo-box.js +3 -2
  9. package/components/ComboBox/sgds-combo-box.js.map +1 -1
  10. package/components/Drawer/index.umd.js +2 -2
  11. package/components/Drawer/index.umd.js.map +1 -1
  12. package/components/Mainnav/index.umd.js +2 -2
  13. package/components/Mainnav/index.umd.js.map +1 -1
  14. package/components/Modal/index.umd.js +22 -17
  15. package/components/Modal/index.umd.js.map +1 -1
  16. package/components/Modal/modal.js +1 -1
  17. package/components/Modal/sgds-modal.js +17 -14
  18. package/components/Modal/sgds-modal.js.map +1 -1
  19. package/components/Subnav/index.umd.js.map +1 -1
  20. package/components/index.umd.js +45 -23
  21. package/components/index.umd.js.map +1 -1
  22. package/index.umd.js +45 -23
  23. package/index.umd.js.map +1 -1
  24. package/package.json +1 -1
  25. package/react/badge/index.cjs.js +3 -1
  26. package/react/badge/index.cjs.js.map +1 -1
  27. package/react/badge/index.js +3 -1
  28. package/react/badge/index.js.map +1 -1
  29. package/react/components/Badge/sgds-badge.cjs.js +23 -4
  30. package/react/components/Badge/sgds-badge.cjs.js.map +1 -1
  31. package/react/components/Badge/sgds-badge.js +23 -4
  32. package/react/components/Badge/sgds-badge.js.map +1 -1
  33. package/react/components/ComboBox/sgds-combo-box.cjs.js +3 -2
  34. package/react/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
  35. package/react/components/ComboBox/sgds-combo-box.js +3 -2
  36. package/react/components/ComboBox/sgds-combo-box.js.map +1 -1
  37. package/react/components/Modal/modal.cjs.js +1 -1
  38. package/react/components/Modal/modal.js +1 -1
  39. package/react/components/Modal/sgds-modal.cjs.js +17 -14
  40. package/react/components/Modal/sgds-modal.cjs.js.map +1 -1
  41. package/react/components/Modal/sgds-modal.js +17 -14
  42. package/react/components/Modal/sgds-modal.js.map +1 -1
  43. package/react/utils/breakpoints.cjs.js +2 -2
  44. package/react/utils/breakpoints.cjs.js.map +1 -1
  45. package/react/utils/breakpoints.js +2 -2
  46. package/react/utils/breakpoints.js.map +1 -1
  47. package/react/utils/scroll.cjs.js +2 -2
  48. package/react/utils/scroll.cjs.js.map +1 -1
  49. package/react/utils/scroll.js +2 -2
  50. package/react/utils/scroll.js.map +1 -1
  51. package/themes/root.css +6 -0
  52. package/utils/breakpoints.d.ts +3 -2
  53. package/utils/breakpoints.js +2 -2
  54. package/utils/breakpoints.js.map +1 -1
  55. package/utils/scroll.js +2 -2
  56. package/utils/scroll.js.map +1 -1
@@ -4699,7 +4699,7 @@
4699
4699
  */
4700
4700
  function lockBodyScrolling(lockingEl) {
4701
4701
  locks.add(lockingEl);
4702
- document.body.classList.add("sl-scroll-lock");
4702
+ document.body.style.overflow = "hidden";
4703
4703
  }
4704
4704
  /**
4705
4705
  * Unlocks body scrolling. Scrolling will only be unlocked once all elements that requested a lock call this method.
@@ -4707,7 +4707,7 @@
4707
4707
  function unlockBodyScrolling(lockingEl) {
4708
4708
  locks.delete(lockingEl);
4709
4709
  if (locks.size === 0) {
4710
- document.body.classList.remove("sl-scroll-lock");
4710
+ document.body.style.overflow = "";
4711
4711
  }
4712
4712
  }
4713
4713
 
@@ -4802,12 +4802,15 @@
4802
4802
  property({ type: String, reflect: true })
4803
4803
  ], SgdsCloseButton.prototype, "variant", void 0);
4804
4804
 
4805
- var css_248z$2 = css`:host([size=sm]) .modal-panel{max-width:480px}:host([size=lg]) .modal-panel{max-width:800px}:host([size=fullscreen]) .modal-panel{max-width:1128px}:host(:not([size=fullscreen])) .modal-panel{background-color:var(--sgds-surface-default)}:host([size=fullscreen]) .modal-overlay{background-color:var(--sgds-surface-default)}.modal{align-items:start;bottom:0;display:flex;font-family:var(--sgds-body-font-family);justify-content:center;left:0;position:fixed;right:0;top:0;z-index:105500}.modal-panel{border-radius:var(--sgds-border-radius-md);display:flex;flex-direction:column;margin:var(--sgds-spacer-9) var(--sgds-spacer-6);max-height:calc(100% - var(--sgds-spacer-9) - var(--sgds-spacer-9));max-width:640px;position:relative;width:100%}.modal-panel:focus{outline:none}@media screen and (max-width:420px){.modal-panel{margin:var(--sgds-spacer-8) var(--sgds-spacer-6);max-height:calc(100% - var(--sgds-spacer-8) - var(--sgds-spacer-8))}}.modal.show .modal-panel{opacity:1;transform:none}.modal-header{display:flex;flex:0 0 auto;flex-direction:row;justify-content:space-between;padding:var(--sgds-padding-xl)}.modal-header__title-description{display:flex;flex-direction:column;gap:var(--sgds-gap-xs)}slot[name=title]::slotted(*){--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-margin-xs:var(--sgds-margin-none);--sgds-font-size-6:var(--sgds-font-size-4);align-items:center;display:flex;flex:1 1 auto;font-size:var(--sgds-font-size-6,--sgds-font-size-4);gap:1rem;line-height:var(--sgds-line-height-heading);margin:var(--sgds-margin-none,var(--sgds-margin-xs,--sgds-margin-2-xs))}slot[name=description]::slotted(*){--sgds-paragraph-spacing-xl:var(--sgds-margin-none);color:var(--sgds-color-subtle);line-height:var(--sgds-line-height-body);margin:var(--sgds-margin-none,--sgds-paragraph-spacing-xl)}.modal-body{-webkit-overflow-scrolling:touch;overflow:auto;padding:0 var(--sgds-padding-xl) var(--sgds-padding-xl)}.modal-body slot::slotted(*){--sgds-paragraph-spacing-xl:var(--sgds-margin-none);margin:var(--sgds-paragraph-spacing-xl,--sgds-margin-none)}.modal-footer{display:flex;flex:0 0 auto;flex-wrap:wrap;gap:var(--sgds-gap-md);justify-content:flex-end;padding:var(--sgds-padding-xl)}.modal:not(.has-footer) .modal-footer{display:none}.modal-overlay{background-color:var(--sgds-bg-overlay);bottom:0;left:0;position:fixed;right:0;top:0}[hidden]{display:none}`;
4805
+ var css_248z$2 = css`:host([size=sm]) .modal-panel{max-width:var(--sgds-dimension-480)}:host([size=md]) .modal-panel{max-width:var(--sgds-dimension-640)}:host([size=lg]) .modal-panel{max-width:var(--sgds-dimension-800)}:host([size=fullscreen]) .modal-overlay{background-color:var(--sgds-surface-default)}.modal{align-items:start;bottom:0;display:flex;font-family:var(--sgds-body-font-family);justify-content:center;left:0;position:fixed;right:0;top:0;z-index:105500}.modal-panel{border-radius:var(--sgds-border-radius-md);display:flex;flex-direction:column;gap:var(--sgds-gap-2-xl);margin:var(--sgds-margin-sm) var(--sgds-margin-xs);max-height:calc(100% - var(--sgds-margin-sm) - var(--sgds-margin-sm));position:relative;width:100%}:host(:not([size=fullscreen])) .modal-panel{background-color:var(--sgds-surface-default);max-width:var(--sgds-dimension-640);padding:var(--sgds-padding-xl)}.modal-panel:focus{outline:none}.modal-content{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--sgds-gap-2-xl);min-height:0;position:relative}.modal-header__close{position:absolute;right:calc(var(--sgds-padding-md)*-1);top:calc(var(--sgds-padding-md)*-1)}@media screen and (min-width:512px){:host([size=fullscreen]) .modal-panel{margin:var(--sgds-margin-sm)}}@media screen and (min-width:768px){:host([size=fullscreen]) .modal-panel{margin:var(--sgds-margin-md);max-height:calc(100% - var(--sgds-margin-md) - var(--sgds-margin-md))}}@media screen and (min-width:1024px){:host([size=fullscreen]) .modal-panel{margin:var(--sgds-margin-xl) var(--sgds-margin-xs);max-height:calc(100% - var(--sgds-margin-xl) - var(--sgds-margin-xl));max-width:var(--sgds-dimension-896)}}@media screen and (min-width:1280px){:host([size=fullscreen]) .modal-panel{max-width:var(--sgds-dimension-1176)}}@media screen and (min-width:1440px){:host([size=fullscreen]) .modal-panel{max-width:var(--sgds-dimension-1320)}}.modal.show .modal-panel{opacity:1;transform:none}.modal-header{display:flex;flex:0 0 auto;flex-direction:row;justify-content:space-between;max-width:var(--sgds-dimension-872)}.modal-header__title-description{display:flex;flex-direction:column;gap:var(--sgds-gap-sm)}:host([size=fullscreen]) .modal-header__title-description{gap:var(--sgds-gap-md)}slot[name=title]::slotted(*){--sgds-margin-2-xs:var(--sgds-margin-none);--sgds-margin-xs:var(--sgds-margin-none);--sgds-font-size-6:var(--sgds-font-size-4);align-items:center;display:flex;flex:1 1 auto;font-size:var(--sgds-font-size-6,--sgds-font-size-4);gap:1rem;line-height:var(--sgds-line-height-heading);margin:var(--sgds-margin-none,var(--sgds-margin-xs,--sgds-margin-2-xs))}slot[name=description]::slotted(*){--sgds-paragraph-spacing-xl:var(--sgds-margin-none);color:var(--sgds-color-subtle);line-height:var(--sgds-line-height-body);margin:var(--sgds-margin-none,--sgds-paragraph-spacing-xl)}.modal-body{-webkit-overflow-scrolling:touch;flex:1 1 auto;overflow:auto}.modal-body slot::slotted(*){--sgds-paragraph-spacing-xl:var(--sgds-margin-none)}.modal-footer{display:flex;flex:0 0 auto;flex-wrap:wrap;gap:var(--sgds-gap-md);justify-content:flex-end;padding-top:var(--sgds-padding-md)}.modal:not(.has-footer) .modal-footer{display:none}.modal-overlay{background-color:var(--sgds-bg-overlay);bottom:0;left:0;position:fixed;right:0;top:0}[hidden]{display:none}`;
4806
4806
 
4807
4807
  var css_248z$1 = css`.h1,.h2,.h3,.h4,.h5,.h6 ::slotted(h6),::slotted(h1),::slotted(h2),::slotted(h3),::slotted(h4),::slotted(h5),h1,h2,h3,h4,h5,h6{color:var(--sgds-heading-color);font-weight:700;line-height:1.2;margin-bottom:.5rem;margin-top:0}.h1,::slotted(h1),h1{font-size:calc(1.375rem + 1.5vw)}@media (min-width:1200px){.h1,::slotted(h1),h1{font-size:2.5rem}}.h2,::slotted(h2),h2{font-size:calc(1.325rem + .9vw)}@media (min-width:1200px){.h2,::slotted(h2),h2{font-size:2rem}}.h3,::slotted(h3),h3{font-size:calc(1.275rem + .3vw)}@media (min-width:1200px){.h3,::slotted(h3),h3{font-size:1.5rem}}.h4,::slotted(h4),h4{font-size:1.125rem}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{font-size:1rem}.h1,::slotted(h1),h1{line-height:1.2}.h2,::slotted(h2),h2{line-height:1.25}.h3,::slotted(h3),h3{line-height:1.33}.h4,::slotted(h4),h4{line-height:1.78}.h5,.h6 ::slotted(h6),::slotted(h5),h5,h6{line-height:1.2}`;
4808
4808
 
4809
4809
  var css_248z = css`svg{vertical-align:middle}`;
4810
4810
 
4811
+ const SM_BREAKPOINT = 512;
4812
+ const MD_BREAKPOINT = 768;
4813
+
4811
4814
  /**
4812
4815
  * @summary The modal component inform users about a specific task and may contain critical information which users then have to make a decision.
4813
4816
  *
@@ -4871,7 +4874,7 @@
4871
4874
  return;
4872
4875
  if (buttonElements.length <= 1)
4873
4876
  return;
4874
- if (panelWidth <= 360) {
4877
+ if (panelWidth < SM_BREAKPOINT || (this.size === "fullscreen" && panelWidth < MD_BREAKPOINT)) {
4875
4878
  buttonElements.forEach(buttonElement => {
4876
4879
  const button = buttonElement;
4877
4880
  button.fullWidth = true;
@@ -5015,20 +5018,22 @@
5015
5018
  aria-labelledby="title"
5016
5019
  tabindex="-1"
5017
5020
  >
5018
- <div class="modal-header">
5019
- <div class="modal-header__title-description">
5020
- <slot class="modal-title" id="title" name="title"></slot>
5021
- <slot name="description"></slot>
5021
+ <div class="modal-content">
5022
+ <div class="modal-header">
5023
+ <div class="modal-header__title-description">
5024
+ <slot class="modal-title" id="title" name="title"></slot>
5025
+ <slot name="description"></slot>
5026
+ </div>
5027
+ <sgds-close-button
5028
+ class="modal-header__close"
5029
+ @click="${() => this.requestClose("close-button")}"
5030
+ ariaLabel="close modal"
5031
+ ></sgds-close-button>
5022
5032
  </div>
5023
- <sgds-close-button
5024
- class="modal-header__close"
5025
- @click="${() => this.requestClose("close-button")}"
5026
- ariaLabel="close modal"
5027
- ></sgds-close-button>
5028
- </div>
5029
- <div class="modal-body">
5030
- <slot></slot>
5031
- </div>
5033
+ <div class="modal-body">
5034
+ <slot></slot>
5035
+ </div>
5036
+ </div class="modal-content">
5032
5037
  <div class="modal-footer">
5033
5038
  <slot name="footer"></slot>
5034
5039
  </div>