@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.
- package/components/Badge/index.umd.js +63 -44
- package/components/Badge/index.umd.js.map +1 -1
- package/components/Badge/sgds-badge.d.ts +3 -1
- package/components/Badge/sgds-badge.js +23 -4
- package/components/Badge/sgds-badge.js.map +1 -1
- package/components/ComboBox/index.umd.js +29 -9
- package/components/ComboBox/index.umd.js.map +1 -1
- package/components/ComboBox/sgds-combo-box.js +3 -2
- package/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/components/Drawer/index.umd.js +2 -2
- package/components/Drawer/index.umd.js.map +1 -1
- package/components/Mainnav/index.umd.js +2 -2
- package/components/Mainnav/index.umd.js.map +1 -1
- package/components/Modal/index.umd.js +22 -17
- package/components/Modal/index.umd.js.map +1 -1
- package/components/Modal/modal.js +1 -1
- package/components/Modal/sgds-modal.js +17 -14
- package/components/Modal/sgds-modal.js.map +1 -1
- package/components/Subnav/index.umd.js.map +1 -1
- package/components/index.umd.js +45 -23
- package/components/index.umd.js.map +1 -1
- package/index.umd.js +45 -23
- package/index.umd.js.map +1 -1
- package/package.json +1 -1
- package/react/badge/index.cjs.js +3 -1
- package/react/badge/index.cjs.js.map +1 -1
- package/react/badge/index.js +3 -1
- package/react/badge/index.js.map +1 -1
- package/react/components/Badge/sgds-badge.cjs.js +23 -4
- package/react/components/Badge/sgds-badge.cjs.js.map +1 -1
- package/react/components/Badge/sgds-badge.js +23 -4
- package/react/components/Badge/sgds-badge.js.map +1 -1
- package/react/components/ComboBox/sgds-combo-box.cjs.js +3 -2
- package/react/components/ComboBox/sgds-combo-box.cjs.js.map +1 -1
- package/react/components/ComboBox/sgds-combo-box.js +3 -2
- package/react/components/ComboBox/sgds-combo-box.js.map +1 -1
- package/react/components/Modal/modal.cjs.js +1 -1
- package/react/components/Modal/modal.js +1 -1
- package/react/components/Modal/sgds-modal.cjs.js +17 -14
- package/react/components/Modal/sgds-modal.cjs.js.map +1 -1
- package/react/components/Modal/sgds-modal.js +17 -14
- package/react/components/Modal/sgds-modal.js.map +1 -1
- package/react/utils/breakpoints.cjs.js +2 -2
- package/react/utils/breakpoints.cjs.js.map +1 -1
- package/react/utils/breakpoints.js +2 -2
- package/react/utils/breakpoints.js.map +1 -1
- package/react/utils/scroll.cjs.js +2 -2
- package/react/utils/scroll.cjs.js.map +1 -1
- package/react/utils/scroll.js +2 -2
- package/react/utils/scroll.js.map +1 -1
- package/themes/root.css +6 -0
- package/utils/breakpoints.d.ts +3 -2
- package/utils/breakpoints.js +2 -2
- package/utils/breakpoints.js.map +1 -1
- package/utils/scroll.js +2 -2
- package/utils/scroll.js.map +1 -1
package/components/index.umd.js
CHANGED
|
@@ -7762,7 +7762,9 @@
|
|
|
7762
7762
|
* @slot icon - The slot for icon to the left of the badge text
|
|
7763
7763
|
*
|
|
7764
7764
|
* @event sgds-show - Emitted when the badge appears.
|
|
7765
|
-
* @event sgds-hide - Emitted
|
|
7765
|
+
* @event sgds-hide - Emitted when the badge is starting to close but has not closed.
|
|
7766
|
+
* @event sgds-after-show - Emitted after the badge has appeared
|
|
7767
|
+
* @event sgds-after-hide - Emitted after the badge has closed
|
|
7766
7768
|
*/
|
|
7767
7769
|
class SgdsBadge extends SgdsElement {
|
|
7768
7770
|
constructor() {
|
|
@@ -7782,7 +7784,24 @@
|
|
|
7782
7784
|
}
|
|
7783
7785
|
/**@internal */
|
|
7784
7786
|
_handleShowChange() {
|
|
7785
|
-
|
|
7787
|
+
if (this.show) {
|
|
7788
|
+
const sgdsShow = this.emit("sgds-show", { cancelable: true });
|
|
7789
|
+
if (sgdsShow.defaultPrevented) {
|
|
7790
|
+
this.show = false;
|
|
7791
|
+
return;
|
|
7792
|
+
}
|
|
7793
|
+
// animations if any go here
|
|
7794
|
+
this.emit("sgds-after-show");
|
|
7795
|
+
}
|
|
7796
|
+
else {
|
|
7797
|
+
const sgdsHide = this.emit("sgds-hide", { cancelable: true });
|
|
7798
|
+
if (sgdsHide.defaultPrevented) {
|
|
7799
|
+
this.show = true;
|
|
7800
|
+
return;
|
|
7801
|
+
}
|
|
7802
|
+
// animations if any go here
|
|
7803
|
+
this.emit("sgds-after-hide");
|
|
7804
|
+
}
|
|
7786
7805
|
}
|
|
7787
7806
|
render() {
|
|
7788
7807
|
return (this.dismissible && this.show) || !this.dismissible
|
|
@@ -13777,7 +13796,8 @@
|
|
|
13777
13796
|
this.selectedItems = this.selectedItems.filter(i => i.value !== foundItem.value);
|
|
13778
13797
|
this.value = this.selectedItems.map(i => i.value).join(";");
|
|
13779
13798
|
}
|
|
13780
|
-
async _handleBadgeDismissed(item) {
|
|
13799
|
+
async _handleBadgeDismissed(e, item) {
|
|
13800
|
+
e.preventDefault();
|
|
13781
13801
|
this.selectedItems = this.selectedItems.filter(i => i.value !== item.value);
|
|
13782
13802
|
this.value = this.selectedItems.map(i => i.value).join(";");
|
|
13783
13803
|
}
|
|
@@ -13876,7 +13896,7 @@
|
|
|
13876
13896
|
variant="neutral"
|
|
13877
13897
|
show
|
|
13878
13898
|
dismissible
|
|
13879
|
-
@sgds-hide=${
|
|
13899
|
+
@sgds-hide=${e => this._handleBadgeDismissed(e, item)}
|
|
13880
13900
|
>${item.label}</sgds-badge
|
|
13881
13901
|
>`)}
|
|
13882
13902
|
`
|
|
@@ -25102,7 +25122,7 @@
|
|
|
25102
25122
|
*/
|
|
25103
25123
|
function lockBodyScrolling(lockingEl) {
|
|
25104
25124
|
locks.add(lockingEl);
|
|
25105
|
-
document.body.
|
|
25125
|
+
document.body.style.overflow = "hidden";
|
|
25106
25126
|
}
|
|
25107
25127
|
/**
|
|
25108
25128
|
* Unlocks body scrolling. Scrolling will only be unlocked once all elements that requested a lock call this method.
|
|
@@ -25110,7 +25130,7 @@
|
|
|
25110
25130
|
function unlockBodyScrolling(lockingEl) {
|
|
25111
25131
|
locks.delete(lockingEl);
|
|
25112
25132
|
if (locks.size === 0) {
|
|
25113
|
-
document.body.
|
|
25133
|
+
document.body.style.overflow = "";
|
|
25114
25134
|
}
|
|
25115
25135
|
}
|
|
25116
25136
|
|
|
@@ -26292,9 +26312,9 @@
|
|
|
26292
26312
|
});
|
|
26293
26313
|
}
|
|
26294
26314
|
|
|
26295
|
-
const LG_BREAKPOINT = 1024;
|
|
26296
|
-
const MD_BREAKPOINT = 768;
|
|
26297
26315
|
const SM_BREAKPOINT = 512;
|
|
26316
|
+
const MD_BREAKPOINT = 768;
|
|
26317
|
+
const LG_BREAKPOINT = 1024;
|
|
26298
26318
|
const XL_BREAKPOINT = 1280;
|
|
26299
26319
|
const XXL_BREAKPOINT = 1440;
|
|
26300
26320
|
|
|
@@ -27218,7 +27238,7 @@
|
|
|
27218
27238
|
}
|
|
27219
27239
|
}
|
|
27220
27240
|
|
|
27221
|
-
var css_248z$o = css`:host([size=sm]) .modal-panel{max-width:
|
|
27241
|
+
var css_248z$o = 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}`;
|
|
27222
27242
|
|
|
27223
27243
|
/**
|
|
27224
27244
|
* @summary The modal component inform users about a specific task and may contain critical information which users then have to make a decision.
|
|
@@ -27283,7 +27303,7 @@
|
|
|
27283
27303
|
return;
|
|
27284
27304
|
if (buttonElements.length <= 1)
|
|
27285
27305
|
return;
|
|
27286
|
-
if (panelWidth
|
|
27306
|
+
if (panelWidth < SM_BREAKPOINT || (this.size === "fullscreen" && panelWidth < MD_BREAKPOINT)) {
|
|
27287
27307
|
buttonElements.forEach(buttonElement => {
|
|
27288
27308
|
const button = buttonElement;
|
|
27289
27309
|
button.fullWidth = true;
|
|
@@ -27427,20 +27447,22 @@
|
|
|
27427
27447
|
aria-labelledby="title"
|
|
27428
27448
|
tabindex="-1"
|
|
27429
27449
|
>
|
|
27430
|
-
<div class="modal-
|
|
27431
|
-
<div class="modal-
|
|
27432
|
-
<
|
|
27433
|
-
|
|
27450
|
+
<div class="modal-content">
|
|
27451
|
+
<div class="modal-header">
|
|
27452
|
+
<div class="modal-header__title-description">
|
|
27453
|
+
<slot class="modal-title" id="title" name="title"></slot>
|
|
27454
|
+
<slot name="description"></slot>
|
|
27455
|
+
</div>
|
|
27456
|
+
<sgds-close-button
|
|
27457
|
+
class="modal-header__close"
|
|
27458
|
+
@click="${() => this.requestClose("close-button")}"
|
|
27459
|
+
ariaLabel="close modal"
|
|
27460
|
+
></sgds-close-button>
|
|
27434
27461
|
</div>
|
|
27435
|
-
<
|
|
27436
|
-
|
|
27437
|
-
|
|
27438
|
-
|
|
27439
|
-
></sgds-close-button>
|
|
27440
|
-
</div>
|
|
27441
|
-
<div class="modal-body">
|
|
27442
|
-
<slot></slot>
|
|
27443
|
-
</div>
|
|
27462
|
+
<div class="modal-body">
|
|
27463
|
+
<slot></slot>
|
|
27464
|
+
</div>
|
|
27465
|
+
</div class="modal-content">
|
|
27444
27466
|
<div class="modal-footer">
|
|
27445
27467
|
<slot name="footer"></slot>
|
|
27446
27468
|
</div>
|