@momentum-design/components 0.54.2 → 0.54.3

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,6 +1,6 @@
1
1
  import { CSSResult, PropertyValues } from 'lit';
2
2
  import { Component } from '../../models';
3
- import type { PopoverPlacement, PopoverTrigger, PopoverColor } from './popover.types';
3
+ import { PopoverColor, PopoverPlacement, PopoverTrigger } from './popover.types';
4
4
  declare const Popover_base: import("../../utils/mixins/index.types").Constructor<HTMLElement & 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,16 +7,16 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
7
7
  var __metadata = (this && this.__metadata) || function (k, v) {
8
8
  if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
9
9
  };
10
+ import { arrow, autoUpdate, computePosition, flip, offset, shift, size } from '@floating-ui/dom';
10
11
  import { html, nothing } from 'lit';
11
- import { ifDefined } from 'lit/directives/if-defined.js';
12
12
  import { property } from 'lit/decorators.js';
13
- import { computePosition, autoUpdate, offset, flip, shift, arrow, size } from '@floating-ui/dom';
14
- import styles from './popover.styles';
13
+ import { ifDefined } from 'lit/directives/if-defined.js';
15
14
  import { Component } from '../../models';
16
15
  import { FocusTrapMixin } from '../../utils/mixins/FocusTrapMixin';
17
- import { popoverStack } from './popover.stack';
18
- import { DEFAULTS, POPOVER_PLACEMENT, TRIGGER, COLOR } from './popover.constants';
16
+ import { COLOR, DEFAULTS, POPOVER_PLACEMENT, TRIGGER } from './popover.constants';
19
17
  import { PopoverEventManager } from './popover.events';
18
+ import { popoverStack } from './popover.stack';
19
+ import styles from './popover.styles';
20
20
  import { PopoverUtils } from './popover.utils';
21
21
  /**
22
22
  * Popover component is a lightweight floating UI element that displays additional content when triggered.
@@ -536,6 +536,7 @@ class Popover extends FocusTrapMixin(Component) {
536
536
  return;
537
537
  Object.assign(popoverContent.style, {
538
538
  maxHeight: `${availableHeight}px`,
539
+ overflowY: 'auto',
539
540
  });
540
541
  },
541
542
  padding: 50,
@@ -48,7 +48,6 @@ const styles = css `
48
48
  :host::part(popover-content) {
49
49
  position: relative;
50
50
  padding: 0.75rem;
51
- overflow-y: auto;
52
51
  min-width: max-content;
53
52
  z-index: 9998;
54
53
  max-height: var(--mdc-popover-max-height);
@@ -35,7 +35,7 @@ declare class Select extends Select_base implements AssociatedFormControl {
35
35
  /**
36
36
  * height attribute of the select field. If set,
37
37
  * then a scroll bar will be visible when there more options than the adjusted height.
38
- * @default 'auto'
38
+ * @default auto
39
39
  */
40
40
  height: string;
41
41
  /** @internal */
@@ -50,6 +50,8 @@ declare class Select extends Select_base implements AssociatedFormControl {
50
50
  displayPopover: boolean;
51
51
  /** @internal */
52
52
  activeDescendant: string;
53
+ /** @internal */
54
+ popoverWidth: string;
53
55
  /**
54
56
  * @internal
55
57
  * The native select element
@@ -50,7 +50,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
50
50
  /**
51
51
  * height attribute of the select field. If set,
52
52
  * then a scroll bar will be visible when there more options than the adjusted height.
53
- * @default 'auto'
53
+ * @default auto
54
54
  */
55
55
  this.height = 'auto';
56
56
  /** @internal */
@@ -61,6 +61,8 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
61
61
  this.displayPopover = false;
62
62
  /** @internal */
63
63
  this.activeDescendant = '';
64
+ /** @internal */
65
+ this.popoverWidth = '100%';
64
66
  }
65
67
  connectedCallback() {
66
68
  super.connectedCallback();
@@ -233,6 +235,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
233
235
  break;
234
236
  case KEYS.ESCAPE:
235
237
  this.closePopover();
238
+ event.stopPropagation();
236
239
  break;
237
240
  case KEYS.HOME:
238
241
  this.setFocusAndTabIndex(0);
@@ -453,7 +456,7 @@ class Select extends FormInternalsMixin(DataAriaLabelMixin(FormfieldWrapper)) {
453
456
  placement="${POPOVER_PLACEMENT.BOTTOM_START}"
454
457
  @shown="${this.handlePopoverOpen}"
455
458
  @hidden="${this.handlePopoverClose}"
456
- style="--mdc-popover-max-width: 100%; --mdc-popover-max-height: ${this.height};"
459
+ style="--mdc-popover-max-width: ${this.popoverWidth}; --mdc-popover-max-height: ${this.height};"
457
460
  >
458
461
  <slot @click="${this.handleOptionsClick}"></slot>
459
462
  </mdc-popover>
@@ -511,7 +514,7 @@ __decorate([
511
514
  __metadata("design:type", Object)
512
515
  ], Select.prototype, "readonly", void 0);
513
516
  __decorate([
514
- property({ type: String, attribute: 'height' }),
517
+ property({ type: String }),
515
518
  __metadata("design:type", Object)
516
519
  ], Select.prototype, "height", void 0);
517
520
  __decorate([
@@ -538,6 +541,10 @@ __decorate([
538
541
  state(),
539
542
  __metadata("design:type", Object)
540
543
  ], Select.prototype, "activeDescendant", void 0);
544
+ __decorate([
545
+ state(),
546
+ __metadata("design:type", Object)
547
+ ], Select.prototype, "popoverWidth", void 0);
541
548
  __decorate([
542
549
  query('select'),
543
550
  __metadata("design:type", HTMLInputElement)