@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/index.umd.js
CHANGED
|
@@ -7772,7 +7772,9 @@
|
|
|
7772
7772
|
* @slot icon - The slot for icon to the left of the badge text
|
|
7773
7773
|
*
|
|
7774
7774
|
* @event sgds-show - Emitted when the badge appears.
|
|
7775
|
-
* @event sgds-hide - Emitted
|
|
7775
|
+
* @event sgds-hide - Emitted when the badge is starting to close but has not closed.
|
|
7776
|
+
* @event sgds-after-show - Emitted after the badge has appeared
|
|
7777
|
+
* @event sgds-after-hide - Emitted after the badge has closed
|
|
7776
7778
|
*/
|
|
7777
7779
|
class SgdsBadge extends SgdsElement {
|
|
7778
7780
|
constructor() {
|
|
@@ -7792,7 +7794,24 @@
|
|
|
7792
7794
|
}
|
|
7793
7795
|
/**@internal */
|
|
7794
7796
|
_handleShowChange() {
|
|
7795
|
-
|
|
7797
|
+
if (this.show) {
|
|
7798
|
+
const sgdsShow = this.emit("sgds-show", { cancelable: true });
|
|
7799
|
+
if (sgdsShow.defaultPrevented) {
|
|
7800
|
+
this.show = false;
|
|
7801
|
+
return;
|
|
7802
|
+
}
|
|
7803
|
+
// animations if any go here
|
|
7804
|
+
this.emit("sgds-after-show");
|
|
7805
|
+
}
|
|
7806
|
+
else {
|
|
7807
|
+
const sgdsHide = this.emit("sgds-hide", { cancelable: true });
|
|
7808
|
+
if (sgdsHide.defaultPrevented) {
|
|
7809
|
+
this.show = true;
|
|
7810
|
+
return;
|
|
7811
|
+
}
|
|
7812
|
+
// animations if any go here
|
|
7813
|
+
this.emit("sgds-after-hide");
|
|
7814
|
+
}
|
|
7796
7815
|
}
|
|
7797
7816
|
render() {
|
|
7798
7817
|
return (this.dismissible && this.show) || !this.dismissible
|
|
@@ -13554,7 +13573,8 @@
|
|
|
13554
13573
|
this.selectedItems = this.selectedItems.filter(i => i.value !== foundItem.value);
|
|
13555
13574
|
this.value = this.selectedItems.map(i => i.value).join(";");
|
|
13556
13575
|
}
|
|
13557
|
-
async _handleBadgeDismissed(item) {
|
|
13576
|
+
async _handleBadgeDismissed(e, item) {
|
|
13577
|
+
e.preventDefault();
|
|
13558
13578
|
this.selectedItems = this.selectedItems.filter(i => i.value !== item.value);
|
|
13559
13579
|
this.value = this.selectedItems.map(i => i.value).join(";");
|
|
13560
13580
|
}
|
|
@@ -13653,7 +13673,7 @@
|
|
|
13653
13673
|
variant="neutral"
|
|
13654
13674
|
show
|
|
13655
13675
|
dismissible
|
|
13656
|
-
@sgds-hide=${
|
|
13676
|
+
@sgds-hide=${e => this._handleBadgeDismissed(e, item)}
|
|
13657
13677
|
>${item.label}</sgds-badge
|
|
13658
13678
|
>`)}
|
|
13659
13679
|
`
|
|
@@ -25133,7 +25153,7 @@
|
|
|
25133
25153
|
*/
|
|
25134
25154
|
function lockBodyScrolling(lockingEl) {
|
|
25135
25155
|
locks.add(lockingEl);
|
|
25136
|
-
document.body.
|
|
25156
|
+
document.body.style.overflow = "hidden";
|
|
25137
25157
|
}
|
|
25138
25158
|
/**
|
|
25139
25159
|
* Unlocks body scrolling. Scrolling will only be unlocked once all elements that requested a lock call this method.
|
|
@@ -25141,7 +25161,7 @@
|
|
|
25141
25161
|
function unlockBodyScrolling(lockingEl) {
|
|
25142
25162
|
locks.delete(lockingEl);
|
|
25143
25163
|
if (locks.size === 0) {
|
|
25144
|
-
document.body.
|
|
25164
|
+
document.body.style.overflow = "";
|
|
25145
25165
|
}
|
|
25146
25166
|
}
|
|
25147
25167
|
|
|
@@ -26366,9 +26386,9 @@
|
|
|
26366
26386
|
});
|
|
26367
26387
|
}
|
|
26368
26388
|
|
|
26369
|
-
const LG_BREAKPOINT = 1024;
|
|
26370
|
-
const MD_BREAKPOINT = 768;
|
|
26371
26389
|
const SM_BREAKPOINT = 512;
|
|
26390
|
+
const MD_BREAKPOINT = 768;
|
|
26391
|
+
const LG_BREAKPOINT = 1024;
|
|
26372
26392
|
const XL_BREAKPOINT = 1280;
|
|
26373
26393
|
const XXL_BREAKPOINT = 1440;
|
|
26374
26394
|
|
|
@@ -27298,7 +27318,7 @@
|
|
|
27298
27318
|
}
|
|
27299
27319
|
}
|
|
27300
27320
|
|
|
27301
|
-
var css_248z$p = css`:host([size=sm]) .modal-panel{max-width:
|
|
27321
|
+
var css_248z$p = 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}`;
|
|
27302
27322
|
|
|
27303
27323
|
/**
|
|
27304
27324
|
* @summary The modal component inform users about a specific task and may contain critical information which users then have to make a decision.
|
|
@@ -27363,7 +27383,7 @@
|
|
|
27363
27383
|
return;
|
|
27364
27384
|
if (buttonElements.length <= 1)
|
|
27365
27385
|
return;
|
|
27366
|
-
if (panelWidth
|
|
27386
|
+
if (panelWidth < SM_BREAKPOINT || (this.size === "fullscreen" && panelWidth < MD_BREAKPOINT)) {
|
|
27367
27387
|
buttonElements.forEach(buttonElement => {
|
|
27368
27388
|
const button = buttonElement;
|
|
27369
27389
|
button.fullWidth = true;
|
|
@@ -27507,20 +27527,22 @@
|
|
|
27507
27527
|
aria-labelledby="title"
|
|
27508
27528
|
tabindex="-1"
|
|
27509
27529
|
>
|
|
27510
|
-
<div class="modal-
|
|
27511
|
-
<div class="modal-
|
|
27512
|
-
<
|
|
27513
|
-
|
|
27530
|
+
<div class="modal-content">
|
|
27531
|
+
<div class="modal-header">
|
|
27532
|
+
<div class="modal-header__title-description">
|
|
27533
|
+
<slot class="modal-title" id="title" name="title"></slot>
|
|
27534
|
+
<slot name="description"></slot>
|
|
27535
|
+
</div>
|
|
27536
|
+
<sgds-close-button
|
|
27537
|
+
class="modal-header__close"
|
|
27538
|
+
@click="${() => this.requestClose("close-button")}"
|
|
27539
|
+
ariaLabel="close modal"
|
|
27540
|
+
></sgds-close-button>
|
|
27514
27541
|
</div>
|
|
27515
|
-
<
|
|
27516
|
-
|
|
27517
|
-
|
|
27518
|
-
|
|
27519
|
-
></sgds-close-button>
|
|
27520
|
-
</div>
|
|
27521
|
-
<div class="modal-body">
|
|
27522
|
-
<slot></slot>
|
|
27523
|
-
</div>
|
|
27542
|
+
<div class="modal-body">
|
|
27543
|
+
<slot></slot>
|
|
27544
|
+
</div>
|
|
27545
|
+
</div class="modal-content">
|
|
27524
27546
|
<div class="modal-footer">
|
|
27525
27547
|
<slot name="footer"></slot>
|
|
27526
27548
|
</div>
|