@descope/web-components-ui 3.14.10 → 3.15.0
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/dist/cjs/index.cjs.js +26 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +26 -0
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/dist/umd/descope-modal-index-js.js +1 -1
- package/dist/umd/descope-modal-index-js.js.map +1 -1
- package/dist/umd/index.js +1 -1
- package/package.json +40 -40
- package/src/components/descope-modal/ModalClass.js +26 -0
- package/stories/descope-modal.stories.js +13 -2
package/dist/cjs/index.cjs.js
CHANGED
|
@@ -22912,6 +22912,10 @@ const customMixin$3 = (superclass) =>
|
|
|
22912
22912
|
return this.getAttribute('opened') === 'true';
|
|
22913
22913
|
}
|
|
22914
22914
|
|
|
22915
|
+
get closeOnOutsideClick() {
|
|
22916
|
+
return this.getAttribute('close-on-outside-click') === 'true';
|
|
22917
|
+
}
|
|
22918
|
+
|
|
22915
22919
|
handleOpened() {
|
|
22916
22920
|
if (this.opened) {
|
|
22917
22921
|
this.style.display = '';
|
|
@@ -22977,6 +22981,28 @@ const customMixin$3 = (superclass) =>
|
|
|
22977
22981
|
overlay._enterModalState = () => {};
|
|
22978
22982
|
|
|
22979
22983
|
overlay.close = () => false;
|
|
22984
|
+
|
|
22985
|
+
// close the modal when the user clicks/taps the backdrop (outside the modal
|
|
22986
|
+
// box). Vaadin's own outside-click does not fire here because we keep the
|
|
22987
|
+
// overlay in the shadow DOM (see _attachOverlay above), which leaves it out
|
|
22988
|
+
// of Vaadin's overlay stack, so we detect the backdrop click ourselves.
|
|
22989
|
+
// the listener is always attached and reads `closeOnOutsideClick` at click
|
|
22990
|
+
// time, so toggling the attribute after init is respected.
|
|
22991
|
+
overlay.addEventListener('click', (event) => {
|
|
22992
|
+
if (!this.closeOnOutsideClick || !this.opened) return;
|
|
22993
|
+
|
|
22994
|
+
// the visible modal box; clicks inside it (content + its padding) keep
|
|
22995
|
+
// the modal open, only clicks on the dimmed backdrop close it. if we
|
|
22996
|
+
// can't find the box, don't close - safer than closing on an inside click
|
|
22997
|
+
const overlayPart = overlay.shadowRoot?.querySelector('[part="overlay"]');
|
|
22998
|
+
if (!overlayPart || event.composedPath().includes(overlayPart)) {
|
|
22999
|
+
return;
|
|
23000
|
+
}
|
|
23001
|
+
|
|
23002
|
+
// just close ourselves; consumers that need to react (e.g. ModalDriver
|
|
23003
|
+
// resetting the content) observe the `opened` attribute
|
|
23004
|
+
this.removeAttribute('opened');
|
|
23005
|
+
});
|
|
22980
23006
|
}
|
|
22981
23007
|
};
|
|
22982
23008
|
|