@momentum-design/components 0.85.9 → 0.85.10

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.
@@ -77,6 +77,8 @@ declare class Dialog extends Dialog_base {
77
77
  visible: boolean;
78
78
  /**
79
79
  * The z-index of the dialog
80
+ *
81
+ * The backdrop will have z-index of `zIndex - 1`
80
82
  * @default 1000
81
83
  */
82
84
  zIndex: number;
@@ -165,6 +167,13 @@ declare class Dialog extends Dialog_base {
165
167
  protected lastActiveElement: HTMLElement | null;
166
168
  connectedCallback(): void;
167
169
  disconnectedCallback(): void;
170
+ /**
171
+ * Applies the z-index to the dialog and backdrop elements.
172
+ * The dialog will have a z-index of `zIndex` and the backdrop will have a z-index of `zIndex - 1`.
173
+ *
174
+ * @internal
175
+ */
176
+ private applyZIndex;
168
177
  protected firstUpdated(changedProperties: PropertyValues): Promise<void>;
169
178
  protected updated(changedProperties: PropertyValues): Promise<void>;
170
179
  /**
@@ -90,6 +90,8 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(CardAndDialogFooterMixin(
90
90
  this.visible = DEFAULTS.VISIBLE;
91
91
  /**
92
92
  * The z-index of the dialog
93
+ *
94
+ * The backdrop will have z-index of `zIndex - 1`
93
95
  * @default 1000
94
96
  */
95
97
  this.zIndex = DEFAULTS.Z_INDEX;
@@ -203,11 +205,22 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(CardAndDialogFooterMixin(
203
205
  this.focusBackToTrigger();
204
206
  DialogEventManager.onDestroyedDialog(this);
205
207
  }
208
+ /**
209
+ * Applies the z-index to the dialog and backdrop elements.
210
+ * The dialog will have a z-index of `zIndex` and the backdrop will have a z-index of `zIndex - 1`.
211
+ *
212
+ * @internal
213
+ */
214
+ applyZIndex() {
215
+ var _a;
216
+ this.style.setProperty('z-index', `${this.zIndex}`);
217
+ (_a = this.backdropElement) === null || _a === void 0 ? void 0 : _a.style.setProperty('z-index', `${this.zIndex - 1}`);
218
+ }
206
219
  async firstUpdated(changedProperties) {
207
220
  super.firstUpdated(changedProperties);
208
221
  this.setAttribute('aria-modal', 'true');
209
222
  this.setupAriaLabelledDescribedBy();
210
- this.style.zIndex = `${this.zIndex}`;
223
+ this.applyZIndex();
211
224
  DialogEventManager.onCreatedDialog(this);
212
225
  }
213
226
  async updated(changedProperties) {
@@ -221,7 +234,12 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(CardAndDialogFooterMixin(
221
234
  await this.isOpenUpdated(oldValue, this.visible);
222
235
  }
223
236
  if (changedProperties.has('zIndex')) {
224
- this.setAttribute('z-index', `${this.zIndex}`);
237
+ // If zIndex is not set, use the default value
238
+ // This is to ensure that the dialog has always a z-index set even if not explicitly defined
239
+ if (this.zIndex === null) {
240
+ this.zIndex = DEFAULTS.Z_INDEX;
241
+ }
242
+ this.applyZIndex();
225
243
  }
226
244
  if (changedProperties.has('variant')) {
227
245
  this.updateFooterButtonColors(this.variant);
@@ -9579,7 +9579,7 @@
9579
9579
  "type": {
9580
9580
  "text": "number"
9581
9581
  },
9582
- "description": "The z-index of the dialog",
9582
+ "description": "The z-index of the dialog\n\nThe backdrop will have z-index of `zIndex - 1`",
9583
9583
  "default": "1000",
9584
9584
  "attribute": "z-index",
9585
9585
  "reflects": true
@@ -10369,7 +10369,7 @@
10369
10369
  "type": {
10370
10370
  "text": "number"
10371
10371
  },
10372
- "description": "The z-index of the dialog",
10372
+ "description": "The z-index of the dialog\n\nThe backdrop will have z-index of `zIndex - 1`",
10373
10373
  "default": "1000",
10374
10374
  "fieldName": "zIndex"
10375
10375
  },
package/package.json CHANGED
@@ -41,5 +41,5 @@
41
41
  "lottie-web": "^5.12.2",
42
42
  "uuid": "^11.0.5"
43
43
  },
44
- "version": "0.85.9"
44
+ "version": "0.85.10"
45
45
  }