@momentum-design/components 0.129.5 → 0.129.7
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/browser/index.js +19 -19
- package/dist/browser/index.js.map +2 -2
- package/dist/components/dialog/dialog.component.d.ts +9 -0
- package/dist/components/dialog/dialog.component.js +21 -3
- package/dist/components/dialog/dialog.constants.d.ts +1 -0
- package/dist/components/dialog/dialog.constants.js +1 -0
- package/dist/custom-elements.json +15257 -15209
- package/package.json +1 -1
|
@@ -181,6 +181,15 @@ declare class Dialog extends Dialog_base {
|
|
|
181
181
|
* @default true
|
|
182
182
|
*/
|
|
183
183
|
focusTrap: boolean;
|
|
184
|
+
/**
|
|
185
|
+
* Determines whether a backdrop should be displayed behind the dialog.
|
|
186
|
+
* By default, a backdrop is present and it will cover the rest of the page and prevent interaction
|
|
187
|
+
* with other elements while the dialog is open.
|
|
188
|
+
* When this attribute is set to true, no backdrop will be created.
|
|
189
|
+
*
|
|
190
|
+
* @default false
|
|
191
|
+
*/
|
|
192
|
+
hideBackdrop: boolean;
|
|
184
193
|
/**
|
|
185
194
|
* For now preventScroll is always true as the dialog is a modal component only.
|
|
186
195
|
* This means scroll will be prevented when the dialog is open.
|
|
@@ -186,6 +186,15 @@ class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin
|
|
|
186
186
|
* @default true
|
|
187
187
|
*/
|
|
188
188
|
this.focusTrap = DEFAULTS.FOCUS_TRAP;
|
|
189
|
+
/**
|
|
190
|
+
* Determines whether a backdrop should be displayed behind the dialog.
|
|
191
|
+
* By default, a backdrop is present and it will cover the rest of the page and prevent interaction
|
|
192
|
+
* with other elements while the dialog is open.
|
|
193
|
+
* When this attribute is set to true, no backdrop will be created.
|
|
194
|
+
*
|
|
195
|
+
* @default false
|
|
196
|
+
*/
|
|
197
|
+
this.hideBackdrop = DEFAULTS.HIDE_BACKDROP;
|
|
189
198
|
/**
|
|
190
199
|
* For now preventScroll is always true as the dialog is a modal component only.
|
|
191
200
|
* This means scroll will be prevented when the dialog is open.
|
|
@@ -358,9 +367,12 @@ class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin
|
|
|
358
367
|
if (newValue && !oldValue) {
|
|
359
368
|
// Store the currently focused element before opening the dialog
|
|
360
369
|
this.lastActiveElement = document.activeElement;
|
|
361
|
-
//
|
|
362
|
-
this.
|
|
363
|
-
|
|
370
|
+
// create backdrop if enabled
|
|
371
|
+
if (!this.hideBackdrop) {
|
|
372
|
+
// remove any existing backdrop and create a new one
|
|
373
|
+
this.removeBackdrop();
|
|
374
|
+
this.createBackdrop('dialog');
|
|
375
|
+
}
|
|
364
376
|
this.activatePreventScroll();
|
|
365
377
|
await this.updateComplete;
|
|
366
378
|
if (this.focusTrap) {
|
|
@@ -372,6 +384,8 @@ class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin
|
|
|
372
384
|
DialogEventManager.onShowDialog(this);
|
|
373
385
|
}
|
|
374
386
|
else if (!newValue && oldValue) {
|
|
387
|
+
// Always remove backdrop if it exists, regardless of current hideBackdrop value
|
|
388
|
+
// This handles the case where hideBackdrop was changed while dialog was open
|
|
375
389
|
this.removeBackdrop();
|
|
376
390
|
// Set aria-expanded attribute on the trigger element to false if it exists
|
|
377
391
|
(_d = this.triggerElement) === null || _d === void 0 ? void 0 : _d.setAttribute('aria-expanded', 'false');
|
|
@@ -526,4 +540,8 @@ __decorate([
|
|
|
526
540
|
property({ type: Boolean, reflect: true, attribute: 'focus-trap' }),
|
|
527
541
|
__metadata("design:type", Boolean)
|
|
528
542
|
], Dialog.prototype, "focusTrap", void 0);
|
|
543
|
+
__decorate([
|
|
544
|
+
property({ type: Boolean, reflect: true, attribute: 'hide-backdrop' }),
|
|
545
|
+
__metadata("design:type", Boolean)
|
|
546
|
+
], Dialog.prototype, "hideBackdrop", void 0);
|
|
529
547
|
export default Dialog;
|
|
@@ -15,6 +15,7 @@ declare const DEFAULTS: {
|
|
|
15
15
|
readonly VARIANT: "default";
|
|
16
16
|
readonly DISABLE_ARIA_HAS_POPUP: false;
|
|
17
17
|
readonly FOCUS_TRAP: true;
|
|
18
|
+
readonly HIDE_BACKDROP: false;
|
|
18
19
|
};
|
|
19
20
|
declare const DIALOG_SIZE: readonly ["small", "medium", "large", "xlarge", "fullscreen"];
|
|
20
21
|
declare const DIALOG_ROLE: readonly ["dialog", "alertdialog"];
|
|
@@ -15,6 +15,7 @@ const DEFAULTS = {
|
|
|
15
15
|
VARIANT: DIALOG_VARIANT.DEFAULT,
|
|
16
16
|
DISABLE_ARIA_HAS_POPUP: false,
|
|
17
17
|
FOCUS_TRAP: true,
|
|
18
|
+
HIDE_BACKDROP: false,
|
|
18
19
|
};
|
|
19
20
|
const DIALOG_SIZE = ['small', 'medium', 'large', 'xlarge', 'fullscreen'];
|
|
20
21
|
const DIALOG_ROLE = ['dialog', 'alertdialog'];
|