@momentum-design/components 0.104.3 → 0.104.5

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.
@@ -1,7 +1,7 @@
1
1
  import { CSSResult, PropertyValues } from 'lit';
2
2
  import { Component } from '../../models';
3
3
  import type { DialogRole, DialogSize, DialogVariant } from './dialog.types';
4
- declare const Dialog_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/PreventScrollMixin").PreventScrollMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/FocusTrapMixin").FocusTrapClassInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FooterMixin").FooterMixinInterface> & typeof Component;
4
+ declare const Dialog_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/BackdropMixin").BackdropMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/PreventScrollMixin").PreventScrollMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/FocusTrapMixin").FocusTrapClassInterface> & import("../../utils/mixins/index.types").Constructor<import("../../utils/mixins/FooterMixin").FooterMixinInterface> & typeof Component;
5
5
  /**
6
6
  * Dialog component is a modal dialog that can be used to display information or prompt the user for input.
7
7
  * It can be used to create custom dialogs where content for the body and footer actions is provided by the consumer.
@@ -162,8 +162,6 @@ declare class Dialog extends Dialog_base {
162
162
  /** @internal */
163
163
  protected triggerElement: HTMLElement | null;
164
164
  /** @internal */
165
- protected backdropElement: HTMLElement | null;
166
- /** @internal */
167
165
  protected lastActiveElement: HTMLElement | null;
168
166
  connectedCallback(): void;
169
167
  disconnectedCallback(): void;
@@ -192,13 +190,6 @@ declare class Dialog extends Dialog_base {
192
190
  * @internal
193
191
  */
194
192
  private setupAriaLabelledDescribedBy;
195
- /**
196
- * Creates a backdrop element for the dialog.
197
- * The backdrop is a full-screen overlay that appears behind the dialog when it is open.
198
- * It prevents interaction with the rest of the application while the dialog is open.
199
- * @internal
200
- */
201
- private createBackdrop;
202
193
  /**
203
194
  * Fired when Close Button is clicked or Escape key is pressed.
204
195
  * This method dispatches the close event. Setting visible to false
@@ -16,6 +16,7 @@ import { PreventScrollMixin } from '../../utils/mixins/PreventScrollMixin';
16
16
  import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
17
17
  import { BUTTON_VARIANTS, ICON_BUTTON_SIZES } from '../button/button.constants';
18
18
  import { FooterMixin } from '../../utils/mixins/FooterMixin';
19
+ import { BackdropMixin } from '../../utils/mixins/BackdropMixin';
19
20
  import { DEFAULTS } from './dialog.constants';
20
21
  import { DialogEventManager } from './dialog.events';
21
22
  import styles from './dialog.styles';
@@ -74,7 +75,7 @@ import styles from './dialog.styles';
74
75
  * @slot footer - This slot is for passing custom footer content. Only use this if really needed,
75
76
  * using the footer-link and footer-button slots is preferred
76
77
  */
77
- class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component))) {
78
+ class Dialog extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))) {
78
79
  constructor() {
79
80
  super(...arguments);
80
81
  /**
@@ -167,8 +168,6 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
167
168
  /** @internal */
168
169
  this.triggerElement = null;
169
170
  /** @internal */
170
- this.backdropElement = null;
171
- /** @internal */
172
171
  this.lastActiveElement = null;
173
172
  /**
174
173
  * Handles the escape keydown event to close the dialog.
@@ -193,15 +192,14 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
193
192
  this.addEventListener('keydown', this.onEscapeKeydown.bind(this));
194
193
  }
195
194
  disconnectedCallback() {
196
- var _a, _b, _c;
195
+ var _a, _b;
197
196
  super.disconnectedCallback();
198
197
  this.removeEventListener('keydown', this.onEscapeKeydown);
199
- (_a = this.backdropElement) === null || _a === void 0 ? void 0 : _a.remove();
200
- this.backdropElement = null;
198
+ this.removeBackdrop();
201
199
  // Set aria-expanded attribute on the trigger element to false if it exists
202
- (_b = this.triggerElement) === null || _b === void 0 ? void 0 : _b.setAttribute('aria-expanded', 'false');
200
+ (_a = this.triggerElement) === null || _a === void 0 ? void 0 : _a.setAttribute('aria-expanded', 'false');
203
201
  this.deactivatePreventScroll();
204
- (_c = this.deactivateFocusTrap) === null || _c === void 0 ? void 0 : _c.call(this);
202
+ (_b = this.deactivateFocusTrap) === null || _b === void 0 ? void 0 : _b.call(this);
205
203
  this.focusBackToTrigger();
206
204
  DialogEventManager.onDestroyedDialog(this);
207
205
  }
@@ -299,37 +297,6 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
299
297
  }
300
298
  }
301
299
  }
302
- /**
303
- * Creates a backdrop element for the dialog.
304
- * The backdrop is a full-screen overlay that appears behind the dialog when it is open.
305
- * It prevents interaction with the rest of the application while the dialog is open.
306
- * @internal
307
- */
308
- createBackdrop() {
309
- var _a;
310
- // Remove existing backdrop if present
311
- if (this.backdropElement && this.backdropElement.parentElement) {
312
- this.backdropElement.parentElement.removeChild(this.backdropElement);
313
- this.backdropElement = null;
314
- }
315
- const backdrop = document.createElement('div');
316
- backdrop.classList.add('dialog-backdrop');
317
- const styleElement = document.createElement('style');
318
- styleElement.textContent = `
319
- .dialog-backdrop {
320
- position: fixed;
321
- top: 0;
322
- left: 0;
323
- width: 100%;
324
- height: 100%;
325
- background: var(--mds-color-theme-common-overlays-secondary-normal);
326
- z-index: ${this.zIndex - 1};
327
- }
328
- `;
329
- backdrop.appendChild(styleElement);
330
- (_a = this.parentElement) === null || _a === void 0 ? void 0 : _a.appendChild(backdrop);
331
- this.backdropElement = backdrop;
332
- }
333
300
  /**
334
301
  * Fired when Close Button is clicked or Escape key is pressed.
335
302
  * This method dispatches the close event. Setting visible to false
@@ -346,14 +313,16 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
346
313
  * @param newValue - The new value of the visible property.
347
314
  */
348
315
  async isOpenUpdated(oldValue, newValue) {
349
- var _a, _b, _c, _d, _e, _f;
316
+ var _a, _b, _c, _d, _e;
350
317
  if (oldValue === newValue) {
351
318
  return;
352
319
  }
353
320
  if (newValue && !oldValue) {
354
321
  // Store the currently focused element before opening the dialog
355
322
  this.lastActiveElement = document.activeElement;
356
- this.createBackdrop();
323
+ // remove any existing backdrop and create a new one
324
+ this.removeBackdrop();
325
+ this.createBackdrop('dialog');
357
326
  this.activatePreventScroll();
358
327
  await this.updateComplete;
359
328
  if (this.focusTrap) {
@@ -365,12 +334,11 @@ class Dialog extends PreventScrollMixin(FocusTrapMixin(FooterMixin(Component)))
365
334
  DialogEventManager.onShowDialog(this);
366
335
  }
367
336
  else if (!newValue && oldValue) {
368
- (_d = this.backdropElement) === null || _d === void 0 ? void 0 : _d.remove();
369
- this.backdropElement = null;
337
+ this.removeBackdrop();
370
338
  // Set aria-expanded attribute on the trigger element to false if it exists
371
- (_e = this.triggerElement) === null || _e === void 0 ? void 0 : _e.setAttribute('aria-expanded', 'false');
339
+ (_d = this.triggerElement) === null || _d === void 0 ? void 0 : _d.setAttribute('aria-expanded', 'false');
372
340
  this.deactivatePreventScroll();
373
- (_f = this.deactivateFocusTrap) === null || _f === void 0 ? void 0 : _f.call(this);
341
+ (_e = this.deactivateFocusTrap) === null || _e === void 0 ? void 0 : _e.call(this);
374
342
  this.focusBackToTrigger();
375
343
  DialogEventManager.onHideDialog(this);
376
344
  }
@@ -88,7 +88,7 @@ class MenuBar extends Component {
88
88
  const id = item.getAttribute('id');
89
89
  if (!id)
90
90
  return;
91
- const submenu = (_a = this.querySelector) === null || _a === void 0 ? void 0 : _a.call(this, `${MENUPOPOVER_TAGNAME}[triggerid="${id}"]`);
91
+ const submenu = (_a = document.querySelector) === null || _a === void 0 ? void 0 : _a.call(document, `${MENUPOPOVER_TAGNAME}[triggerid="${id}"]`);
92
92
  if (submenu && submenu.visible) {
93
93
  subMenus.push(submenu);
94
94
  }
@@ -11,6 +11,7 @@ import { property } from 'lit/decorators.js';
11
11
  import { KEYS } from '../../utils/keys';
12
12
  import { ROLE } from '../../utils/roles';
13
13
  import { TAG_NAME as MENUSECTION_TAGNAME } from '../menusection/menusection.constants';
14
+ import { TAG_NAME as NAVMENUITEM_TAGNAME } from '../navmenuitem/navmenuitem.constants';
14
15
  import { TAG_NAME as MENUITEM_TAGNAME } from '../menuitem/menuitem.constants';
15
16
  import { TAG_NAME as MENUITEMCHECKBOX_TAGNAME } from '../menuitemcheckbox/menuitemcheckbox.constants';
16
17
  import { TAG_NAME as MENUITEMRADIO_TAGNAME } from '../menuitemradio/menuitemradio.constants';
@@ -358,7 +359,7 @@ class MenuPopover extends Popover {
358
359
  // make sure backdrop is set before showing the popover, but it does not change when popover is closing, otherwise
359
360
  // `super.isOpenUpdated` will skip the backdrop cleanup
360
361
  if (newValue) {
361
- this.backdrop = !(this.triggerElement.tagName.toLowerCase() === MENUITEM_TAGNAME);
362
+ this.backdrop = ![MENUITEM_TAGNAME, NAVMENUITEM_TAGNAME].includes(this.triggerElement.tagName.toLowerCase());
362
363
  }
363
364
  // if the current menupopover is closed, close all submenus
364
365
  if (newValue === false) {
@@ -1,7 +1,7 @@
1
1
  import { CSSResult, PropertyValues } from 'lit';
2
2
  import { Component } from '../../models';
3
3
  import type { PopoverColor, PopoverPlacement, PopoverTrigger } from './popover.types';
4
- declare const Popover_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/PreventScrollMixin").PreventScrollMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/FocusTrapMixin").FocusTrapClassInterface> & typeof Component;
4
+ declare const Popover_base: import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/BackdropMixin").BackdropMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/PreventScrollMixin").PreventScrollMixinInterface> & import("../../utils/mixins/index.types").Constructor<Component & import("../../utils/mixins/FocusTrapMixin").FocusTrapClassInterface> & typeof Component;
5
5
  /**
6
6
  * Popover component is a lightweight floating UI element that displays additional content when triggered.
7
7
  * It can be used for tooltips, dropdowns, or contextual menus.
@@ -195,6 +195,18 @@ declare class Popover extends Popover_base {
195
195
  * @default false
196
196
  */
197
197
  backdrop: boolean;
198
+ /**
199
+ * Element ID the backdrop will be a append to (if `backdrop` is true).
200
+ * @default ''
201
+ */
202
+ backdropAppendTo?: string;
203
+ /**
204
+ * Set this property to true to make the backdrop invisible (if `backdrop` is true).
205
+ * This is useful for components that do want a backdrop which stops interaction,
206
+ * but do not want the backdrop to be visible as a overlay.
207
+ * @default false
208
+ */
209
+ isBackdropInvisible?: boolean;
198
210
  /**
199
211
  * Changes the placement of popover to keep it in view when scrolling.
200
212
  * @default true
@@ -271,8 +283,6 @@ declare class Popover extends Popover_base {
271
283
  arrowElement: HTMLElement | null;
272
284
  triggerElement: HTMLElement | null;
273
285
  /** @internal */
274
- private triggerElementOriginalStyle;
275
- /** @internal */
276
286
  private hoverTimer;
277
287
  /** @internal */
278
288
  private isHovered;
@@ -287,8 +297,6 @@ declare class Popover extends Popover_base {
287
297
  /** @internal */
288
298
  protected shouldSupressOpening: boolean;
289
299
  /** @internal */
290
- backdropElement: HTMLElement | null;
291
- /** @internal */
292
300
  private connectedTooltip;
293
301
  constructor();
294
302
  private storeConnectedTooltip;
@@ -13,6 +13,7 @@ import { html, nothing } from 'lit';
13
13
  import { property } from 'lit/decorators.js';
14
14
  import { ifDefined } from 'lit/directives/if-defined.js';
15
15
  import { Component } from '../../models';
16
+ import { BackdropMixin } from '../../utils/mixins/BackdropMixin';
16
17
  import { FocusTrapMixin } from '../../utils/mixins/FocusTrapMixin';
17
18
  import { PreventScrollMixin } from '../../utils/mixins/PreventScrollMixin';
18
19
  import { COLOR, DEFAULTS, POPOVER_PLACEMENT, TRIGGER } from './popover.constants';
@@ -50,7 +51,7 @@ import { PopoverUtils } from './popover.utils';
50
51
  * @slot - Default slot for the popover content
51
52
  *
52
53
  */
53
- class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
54
+ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component))) {
54
55
  constructor() {
55
56
  super();
56
57
  /**
@@ -204,6 +205,13 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
204
205
  * @default false
205
206
  */
206
207
  this.backdrop = DEFAULTS.BACKDROP;
208
+ /**
209
+ * Set this property to true to make the backdrop invisible (if `backdrop` is true).
210
+ * This is useful for components that do want a backdrop which stops interaction,
211
+ * but do not want the backdrop to be visible as a overlay.
212
+ * @default false
213
+ */
214
+ this.isBackdropInvisible = DEFAULTS.IS_BACKDROP_INVISIBLE;
207
215
  /**
208
216
  * Changes the placement of popover to keep it in view when scrolling.
209
217
  * @default true
@@ -275,11 +283,6 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
275
283
  this.arrowElement = null;
276
284
  this.triggerElement = null;
277
285
  /** @internal */
278
- this.triggerElementOriginalStyle = {
279
- zIndex: '',
280
- position: '',
281
- };
282
- /** @internal */
283
286
  this.hoverTimer = null;
284
287
  /** @internal */
285
288
  this.isHovered = false;
@@ -292,8 +295,6 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
292
295
  /** @internal */
293
296
  this.shouldSupressOpening = false;
294
297
  /** @internal */
295
- this.backdropElement = null;
296
- /** @internal */
297
298
  this.connectedTooltip = null;
298
299
  this.storeConnectedTooltip = () => {
299
300
  const connectedTooltips = this.getRootNode().querySelectorAll(`mdc-tooltip[triggerID="${this.triggerID}"]`);
@@ -642,7 +643,8 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
642
643
  this.removeAllListeners();
643
644
  (_a = this.deactivateFocusTrap) === null || _a === void 0 ? void 0 : _a.call(this);
644
645
  this.deactivatePreventScroll();
645
- this.utils.removeBackdrop();
646
+ this.moveElementBackAfterBackdropRemoval(this.triggerElement);
647
+ this.removeBackdrop();
646
648
  (_b = this.floatingUICleanupFunction) === null || _b === void 0 ? void 0 : _b.call(this);
647
649
  // clean timer if there is one set:
648
650
  this.cancelCloseDelay();
@@ -740,14 +742,10 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
740
742
  this.connectedTooltip.shouldSupressOpening = true;
741
743
  }
742
744
  }
743
- if (this.backdrop) {
744
- this.utils.createBackdrop();
745
- this.triggerElementOriginalStyle = {
746
- position: this.triggerElement.style.position,
747
- zIndex: this.triggerElement.style.zIndex,
748
- };
749
- this.triggerElement.style.position = 'relative';
750
- this.triggerElement.style.zIndex = `${this.zIndex}`;
745
+ // create backdrop if it doesn't exist
746
+ if (this.backdrop && !this.backdropElement) {
747
+ this.createBackdrop('popover');
748
+ this.keepElementAboveBackdrop(this.triggerElement);
751
749
  }
752
750
  this.positionPopover();
753
751
  if (this.hideOnBlur) {
@@ -781,9 +779,8 @@ class Popover extends PreventScrollMixin(FocusTrapMixin(Component)) {
781
779
  // cleanup floating-ui on closing the popover
782
780
  (_b = this.floatingUICleanupFunction) === null || _b === void 0 ? void 0 : _b.call(this);
783
781
  if (this.backdrop) {
784
- this.triggerElement.style.position = this.triggerElementOriginalStyle.position;
785
- this.triggerElement.style.zIndex = this.triggerElementOriginalStyle.zIndex;
786
- this.utils.removeBackdrop();
782
+ this.moveElementBackAfterBackdropRemoval(this.triggerElement);
783
+ this.removeBackdrop();
787
784
  }
788
785
  if (this.hideOnBlur) {
789
786
  this.removeEventListener('focusout', this.onPopoverFocusOut);
@@ -927,6 +924,14 @@ __decorate([
927
924
  property({ type: Boolean, reflect: true }),
928
925
  __metadata("design:type", Boolean)
929
926
  ], Popover.prototype, "backdrop", void 0);
927
+ __decorate([
928
+ property({ type: String, reflect: true, attribute: 'backdrop-append-to' }),
929
+ __metadata("design:type", String)
930
+ ], Popover.prototype, "backdropAppendTo", void 0);
931
+ __decorate([
932
+ property({ type: Boolean, reflect: true, attribute: 'is-backdrop-invisible' }),
933
+ __metadata("design:type", Boolean)
934
+ ], Popover.prototype, "isBackdropInvisible", void 0);
930
935
  __decorate([
931
936
  property({ type: Boolean, reflect: true }),
932
937
  __metadata("design:type", Boolean)
@@ -52,5 +52,6 @@ declare const DEFAULTS: {
52
52
  readonly PROPAGATE_EVENT_ON_ESCAPE: false;
53
53
  readonly KEEP_CONNECTED_TOOLTIP_CLOSED: true;
54
54
  readonly STRATEGY: "absolute";
55
+ readonly IS_BACKDROP_INVISIBLE: false;
55
56
  };
56
57
  export { TAG_NAME, POPOVER_PLACEMENT, COLOR, TRIGGER, DEFAULTS };
@@ -53,5 +53,6 @@ const DEFAULTS = {
53
53
  PROPAGATE_EVENT_ON_ESCAPE: false,
54
54
  KEEP_CONNECTED_TOOLTIP_CLOSED: true,
55
55
  STRATEGY: 'absolute',
56
+ IS_BACKDROP_INVISIBLE: false,
56
57
  };
57
58
  export { TAG_NAME, POPOVER_PLACEMENT, COLOR, TRIGGER, DEFAULTS };
@@ -57,6 +57,4 @@ export declare class PopoverUtils {
57
57
  * @param y - The y position.
58
58
  */
59
59
  updatePopoverStyle(x: number, y: number): void;
60
- createBackdrop(): void;
61
- removeBackdrop(): void;
62
60
  }
@@ -184,33 +184,4 @@ export class PopoverUtils {
184
184
  top: `${y}px`,
185
185
  });
186
186
  }
187
- createBackdrop() {
188
- var _a;
189
- if (!this.popover.backdropElement) {
190
- const backdrop = document.createElement('div');
191
- backdrop.classList.add('popover-backdrop');
192
- const styleElement = document.createElement('style');
193
- styleElement.textContent = `
194
- .popover-backdrop {
195
- position: fixed;
196
- cursor: default;
197
- top: 0;
198
- left: 0;
199
- width: 100%;
200
- height: 100%;
201
- background: transparent;
202
- z-index: ${this.popover.zIndex - 1};
203
- }
204
- `;
205
- backdrop.appendChild(styleElement);
206
- (_a = this.popover.parentElement) === null || _a === void 0 ? void 0 : _a.appendChild(backdrop);
207
- this.popover.backdropElement = backdrop;
208
- }
209
- }
210
- removeBackdrop() {
211
- if (this.popover.backdropElement) {
212
- this.popover.backdropElement.remove();
213
- this.popover.backdropElement = null;
214
- }
215
- }
216
187
  }
@@ -97,6 +97,19 @@ declare class Select extends Select_base implements AssociatedFormControl {
97
97
  * @see [Floating UI - strategy](https://floating-ui.com/docs/computePosition#strategy)
98
98
  */
99
99
  strategy: 'absolute' | 'fixed';
100
+ /**
101
+ * The z-index of the popover within Select.
102
+ *
103
+ * Override this to make sure this stays on top of other components.
104
+ * @default 1000
105
+ */
106
+ popoverZIndex: number;
107
+ /**
108
+ * ID of the element where the backdrop will be appended to.
109
+ * This is useful to ensure that the backdrop is appended to the correct element in the DOM.
110
+ * If not set, the backdrop will be appended to the parent element of the select.
111
+ */
112
+ backdropAppendTo?: string;
100
113
  /** @internal */
101
114
  slottedListboxes: Array<HTMLElement>;
102
115
  /** @internal */
@@ -103,6 +103,13 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
103
103
  * @see [Floating UI - strategy](https://floating-ui.com/docs/computePosition#strategy)
104
104
  */
105
105
  this.strategy = POPOVER_DEFAULTS.STRATEGY;
106
+ /**
107
+ * The z-index of the popover within Select.
108
+ *
109
+ * Override this to make sure this stays on top of other components.
110
+ * @default 1000
111
+ */
112
+ this.popoverZIndex = POPOVER_DEFAULTS.Z_INDEX;
106
113
  /** @internal */
107
114
  this.displayPopover = false;
108
115
  /** @internal */
@@ -211,7 +218,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
211
218
  * @param option - The option element in DOM which gets selected.
212
219
  */
213
220
  setSelectedOption(option) {
214
- var _a, _b;
221
+ var _a, _b, _c;
215
222
  // set the attribute 'selected' on the option in HTML and remove it from others
216
223
  this.updateSelectedInChildOptions(option);
217
224
  // update the tabindex for all options
@@ -221,7 +228,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
221
228
  // update all form related values
222
229
  this.value = (_b = (_a = this.selectedOption) === null || _a === void 0 ? void 0 : _a.value) !== null && _b !== void 0 ? _b : '';
223
230
  this.internals.setFormValue(this.value);
224
- this.inputElement.setAttribute('value', this.value);
231
+ (_c = this.inputElement) === null || _c === void 0 ? void 0 : _c.setAttribute('value', this.value);
225
232
  this.setInputValidity();
226
233
  }
227
234
  /**
@@ -269,11 +276,12 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
269
276
  * @internal
270
277
  */
271
278
  setInputValidity() {
279
+ var _a, _b;
272
280
  if (!this.selectedOption && this.required && this.validationMessage) {
273
- this.inputElement.setCustomValidity(this.validationMessage);
281
+ (_a = this.inputElement) === null || _a === void 0 ? void 0 : _a.setCustomValidity(this.validationMessage);
274
282
  }
275
283
  else {
276
- this.inputElement.setCustomValidity('');
284
+ (_b = this.inputElement) === null || _b === void 0 ? void 0 : _b.setCustomValidity('');
277
285
  }
278
286
  this.setValidity();
279
287
  }
@@ -469,6 +477,9 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
469
477
  updateState() {
470
478
  var _a;
471
479
  const newSelectedOption = this.getFirstSelectedOption();
480
+ if (!this.inputElement) {
481
+ return;
482
+ }
472
483
  if (!newSelectedOption) {
473
484
  this.setSelectedOption(this.placeholder ? null : this.getFirstValidOption());
474
485
  }
@@ -545,6 +556,8 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
545
556
  ?visible="${this.displayPopover}"
546
557
  role=""
547
558
  backdrop
559
+ backdrop-append-to="${ifDefined(this.backdropAppendTo)}"
560
+ is-backdrop-invisible
548
561
  hide-on-outside-click
549
562
  hide-on-escape
550
563
  focus-back-to-trigger
@@ -559,6 +572,8 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
559
572
  @closebyoutsideclick="${() => {
560
573
  this.displayPopover = false;
561
574
  }}"
575
+ z-index="${ifDefined(this.popoverZIndex)}"
576
+ exportparts="popover-content"
562
577
  >
563
578
  <slot @click="${this.handleOptionsClick}"></slot>
564
579
  </mdc-popover>
@@ -581,7 +596,7 @@ __decorate([
581
596
  __metadata("design:type", String)
582
597
  ], Select.prototype, "placement", void 0);
583
598
  __decorate([
584
- property({ type: Boolean, attribute: 'soft-disabled' }),
599
+ property({ type: Boolean, attribute: 'soft-disabled', reflect: true }),
585
600
  __metadata("design:type", Boolean)
586
601
  ], Select.prototype, "softDisabled", void 0);
587
602
  __decorate([
@@ -592,6 +607,14 @@ __decorate([
592
607
  property({ type: String, reflect: true, attribute: 'strategy' }),
593
608
  __metadata("design:type", String)
594
609
  ], Select.prototype, "strategy", void 0);
610
+ __decorate([
611
+ property({ type: Number, reflect: true, attribute: 'popover-z-index' }),
612
+ __metadata("design:type", Number)
613
+ ], Select.prototype, "popoverZIndex", void 0);
614
+ __decorate([
615
+ property({ type: String, reflect: true, attribute: 'backdrop-append-to' }),
616
+ __metadata("design:type", String)
617
+ ], Select.prototype, "backdropAppendTo", void 0);
595
618
  __decorate([
596
619
  queryAssignedElements({ selector: 'mdc-selectlistbox' }),
597
620
  __metadata("design:type", Array)
@@ -89,6 +89,7 @@ const styles = css `
89
89
  }
90
90
  :host mdc-popover::part(popover-content) {
91
91
  max-height: var(--mdc-popover-max-height);
92
+ min-width: auto;
92
93
  padding: 0.75rem 0.5rem;
93
94
  }
94
95