@momentum-design/components 0.84.4 → 0.85.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/browser/index.js +20 -20
- package/dist/browser/index.js.map +2 -2
- package/dist/components/dialog/dialog.component.d.ts +7 -2
- package/dist/components/dialog/dialog.component.js +15 -4
- package/dist/components/dialog/dialog.constants.d.ts +1 -0
- package/dist/components/dialog/dialog.constants.js +1 -0
- package/dist/custom-elements.json +377 -366
- package/dist/react/index.d.ts +2 -2
- package/dist/react/index.js +2 -2
- package/dist/utils/mixins/FocusTrapMixin.js +3 -0
- package/package.json +1 -1
@@ -142,8 +142,13 @@ declare class Dialog extends Dialog_base {
|
|
142
142
|
*/
|
143
143
|
disableAriaHasPopup: boolean;
|
144
144
|
/**
|
145
|
-
*
|
146
|
-
*
|
145
|
+
* Determines whether the focus trap is enabled.
|
146
|
+
* If true, focus will be restricted to the content within this component.
|
147
|
+
*
|
148
|
+
* NOTE: this should only be disabled in rare cases! By default a Modal Dialog
|
149
|
+
* should trap focus always.
|
150
|
+
*
|
151
|
+
* @default true
|
147
152
|
*/
|
148
153
|
focusTrap: boolean;
|
149
154
|
/**
|
@@ -147,10 +147,15 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(CardAndDialogFooterMixin(
|
|
147
147
|
*/
|
148
148
|
this.disableAriaHasPopup = DEFAULTS.DISABLE_ARIA_HAS_POPUP;
|
149
149
|
/**
|
150
|
-
*
|
151
|
-
*
|
150
|
+
* Determines whether the focus trap is enabled.
|
151
|
+
* If true, focus will be restricted to the content within this component.
|
152
|
+
*
|
153
|
+
* NOTE: this should only be disabled in rare cases! By default a Modal Dialog
|
154
|
+
* should trap focus always.
|
155
|
+
*
|
156
|
+
* @default true
|
152
157
|
*/
|
153
|
-
this.focusTrap =
|
158
|
+
this.focusTrap = DEFAULTS.FOCUS_TRAP;
|
154
159
|
/**
|
155
160
|
* For now preventScroll is always true as the dialog is a modal component only.
|
156
161
|
* This means scroll will be prevented when the dialog is open.
|
@@ -328,7 +333,9 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(CardAndDialogFooterMixin(
|
|
328
333
|
this.createBackdrop();
|
329
334
|
this.activatePreventScroll();
|
330
335
|
await this.updateComplete;
|
331
|
-
(
|
336
|
+
if (this.focusTrap) {
|
337
|
+
(_a = this.activateFocusTrap) === null || _a === void 0 ? void 0 : _a.call(this);
|
338
|
+
}
|
332
339
|
(_b = this.setInitialFocus) === null || _b === void 0 ? void 0 : _b.call(this);
|
333
340
|
// Set aria-expanded attribute on the trigger element to true if it exists
|
334
341
|
(_c = this.triggerElement) === null || _c === void 0 ? void 0 : _c.setAttribute('aria-expanded', 'true');
|
@@ -470,4 +477,8 @@ __decorate([
|
|
470
477
|
property({ type: Boolean, reflect: true, attribute: 'disable-aria-haspopup' }),
|
471
478
|
__metadata("design:type", Boolean)
|
472
479
|
], Dialog.prototype, "disableAriaHasPopup", void 0);
|
480
|
+
__decorate([
|
481
|
+
property({ type: Boolean, reflect: true, attribute: 'focus-trap' }),
|
482
|
+
__metadata("design:type", Boolean)
|
483
|
+
], Dialog.prototype, "focusTrap", void 0);
|
473
484
|
export default Dialog;
|
@@ -13,6 +13,7 @@ declare const DEFAULTS: {
|
|
13
13
|
readonly CANCEL_ICON: "cancel-bold";
|
14
14
|
readonly VARIANT: "default";
|
15
15
|
readonly DISABLE_ARIA_HAS_POPUP: false;
|
16
|
+
readonly FOCUS_TRAP: true;
|
16
17
|
};
|
17
18
|
declare const DIALOG_SIZE: readonly ["small", "medium", "large"];
|
18
19
|
declare const DIALOG_ROLE: readonly ["dialog", "alertdialog"];
|