@momentum-design/components 0.123.2 → 0.123.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.
@@ -54,9 +54,6 @@ const styles = css `
54
54
  :host([disabled])::part(combobox__button) {
55
55
  border-inline-start-color: var(--mdc-combobox-text-color-disabled);
56
56
  }
57
- :host::part(mdc-input) {
58
- width: calc(100% - 1.5rem);
59
- }
60
57
  :host::part(combobox__button-icon) {
61
58
  --mdc-icon-fill-color: var(--mdc-combobox-icon-color);
62
59
  }
@@ -66,6 +63,10 @@ const styles = css `
66
63
  :host::part(no-result-text) {
67
64
  pointer-events: none;
68
65
  }
66
+ :host::part(input-text) {
67
+ /* 2rem is the complete width of dropdown button */
68
+ width: calc(100% - 2rem);
69
+ }
69
70
  :host([disabled]) input,
70
71
  :host([disabled]) mdc-input {
71
72
  user-select: none;
@@ -20,7 +20,17 @@ const styles = [
20
20
 
21
21
  :host::part(input-text),
22
22
  ::slotted(input) {
23
- font-family: inherit;
23
+ /* Unset default native input placeholder padding */
24
+ padding-block: unset;
25
+ padding-inline: unset;
26
+
27
+ /* Set midsize regular font family to native input text */
28
+ font-family: var(--mdc-themeprovider-font-family);
29
+ font-size: var(--mds-font-apps-body-midsize-regular-font-size);
30
+ font-weight: var(--mds-font-apps-body-midsize-regular-font-weight);
31
+ line-height: var(--mds-font-apps-body-midsize-regular-line-height);
32
+ text-decoration: var(--mds-font-apps-body-midsize-regular-text-decoration);
33
+ text-transform: var(--mds-font-apps-body-midsize-regular-text-case);
24
34
  }
25
35
 
26
36
  :host::part(input-container) {
@@ -253,9 +253,9 @@ declare class Popover extends Popover_base {
253
253
  isBackdropInvisible?: boolean;
254
254
  /**
255
255
  * Changes the placement of popover to keep it in view when scrolling.
256
- * @default true
256
+ * @default false
257
257
  */
258
- flip: boolean;
258
+ disableFlip: boolean;
259
259
  /**
260
260
  * Changes the size of popover to keep it in view when scrolling.
261
261
  * @default false
@@ -272,9 +272,9 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
272
272
  this.isBackdropInvisible = DEFAULTS.IS_BACKDROP_INVISIBLE;
273
273
  /**
274
274
  * Changes the placement of popover to keep it in view when scrolling.
275
- * @default true
275
+ * @default false
276
276
  */
277
- this.flip = DEFAULTS.FLIP;
277
+ this.disableFlip = DEFAULTS.DISABLE_FLIP;
278
278
  /**
279
279
  * Changes the size of popover to keep it in view when scrolling.
280
280
  * @default false
@@ -613,7 +613,7 @@ class Popover extends BackdropMixin(PreventScrollMixin(FocusTrapMixin(Component)
613
613
  }),
614
614
  ];
615
615
  let popoverOffset = this.offset;
616
- if (this.flip) {
616
+ if (!this.disableFlip) {
617
617
  middleware.push(flip({
618
618
  boundary,
619
619
  rootBoundary,
@@ -1023,9 +1023,9 @@ __decorate([
1023
1023
  __metadata("design:type", Boolean)
1024
1024
  ], Popover.prototype, "isBackdropInvisible", void 0);
1025
1025
  __decorate([
1026
- property({ type: Boolean, reflect: true }),
1026
+ property({ type: Boolean, reflect: true, attribute: 'disable-flip' }),
1027
1027
  __metadata("design:type", Boolean)
1028
- ], Popover.prototype, "flip", void 0);
1028
+ ], Popover.prototype, "disableFlip", void 0);
1029
1029
  __decorate([
1030
1030
  property({ type: Boolean, reflect: true }),
1031
1031
  __metadata("design:type", Boolean)
@@ -47,7 +47,7 @@ declare const DEFAULTS: {
47
47
  readonly HIDE_ON_CLICK_OUTSIDE: false;
48
48
  readonly FOCUS_BACK: false;
49
49
  readonly BACKDROP: false;
50
- readonly FLIP: true;
50
+ readonly DISABLE_FLIP: false;
51
51
  readonly SIZE: false;
52
52
  readonly DELAY: "0,0";
53
53
  readonly ROLE: "dialog";
@@ -49,7 +49,7 @@ const DEFAULTS = {
49
49
  HIDE_ON_CLICK_OUTSIDE: false,
50
50
  FOCUS_BACK: false,
51
51
  BACKDROP: false,
52
- FLIP: true,
52
+ DISABLE_FLIP: false,
53
53
  SIZE: false,
54
54
  DELAY: '0,0',
55
55
  ROLE: ROLE.DIALOG,
@@ -115,6 +115,11 @@ declare class Select extends Select_base implements AssociatedFormControl {
115
115
  * @default 1000
116
116
  */
117
117
  popoverZIndex: number;
118
+ /**
119
+ * Determines whether the dropdown should flip its position when it hits the boundary.
120
+ * @default false
121
+ */
122
+ disableFlip: boolean;
118
123
  /**
119
124
  * ID of the element where the backdrop will be appended to.
120
125
  * This is useful to ensure that the backdrop is appended to the correct element in the DOM.
@@ -22,10 +22,10 @@ import { ROLE } from '../../utils/roles';
22
22
  import FormfieldWrapper from '../formfieldwrapper/formfieldwrapper.component';
23
23
  import { DEFAULTS as FORMFIELD_DEFAULTS, VALIDATION } from '../formfieldwrapper/formfieldwrapper.constants';
24
24
  import { TAG_NAME as OPTION_TAG_NAME } from '../option/option.constants';
25
- import { DEFAULTS as POPOVER_DEFAULTS, POPOVER_PLACEMENT } from '../popover/popover.constants';
25
+ import { DEFAULTS as POPOVER_DEFAULTS, POPOVER_PLACEMENT, TRIGGER } from '../popover/popover.constants';
26
26
  import { TYPE, VALID_TEXT_TAGS } from '../text/text.constants';
27
27
  import { debounce } from '../../utils/debounce';
28
- import { ARROW_ICON, LISTBOX_ID, TRIGGER_ID } from './select.constants';
28
+ import { ARROW_ICON, DEFAULTS, LISTBOX_ID, TRIGGER_ID } from './select.constants';
29
29
  import styles from './select.styles';
30
30
  /**
31
31
  * The mdc-select component is a dropdown selection control that allows users to pick an option from a predefined list.
@@ -132,6 +132,11 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
132
132
  * @default 1000
133
133
  */
134
134
  this.popoverZIndex = POPOVER_DEFAULTS.Z_INDEX;
135
+ /**
136
+ * Determines whether the dropdown should flip its position when it hits the boundary.
137
+ * @default false
138
+ */
139
+ this.disableFlip = DEFAULTS.DISABLE_FLIP;
135
140
  /** @internal */
136
141
  this.displayPopover = false;
137
142
  /** @internal */
@@ -653,13 +658,13 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
653
658
  >
654
659
  ${(_f = (_e = this.selectedOption) === null || _e === void 0 ? void 0 : _e.label) !== null && _f !== void 0 ? _f : this.placeholder}
655
660
  </mdc-text>
656
- <div part="icon-container">
657
- <mdc-icon
658
- size="1"
659
- length-unit="rem"
660
- name="${this.displayPopover ? ARROW_ICON.ARROW_UP : ARROW_ICON.ARROW_DOWN}"
661
- ></mdc-icon>
662
- </div>
661
+ </div>
662
+ <div part="icon-container">
663
+ <mdc-icon
664
+ size="1"
665
+ length-unit="rem"
666
+ name="${this.displayPopover ? ARROW_ICON.ARROW_UP : ARROW_ICON.ARROW_DOWN}"
667
+ ></mdc-icon>
663
668
  </div>
664
669
  <input
665
670
  id="${this.inputId}"
@@ -676,7 +681,7 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
676
681
  aria-disabled="${ifDefined(this.disabled || this.softDisabled)}"
677
682
  />
678
683
  <mdc-popover
679
- trigger="manual"
684
+ trigger="${TRIGGER.MANUAL}"
680
685
  triggerid="${TRIGGER_ID}"
681
686
  interactive
682
687
  ?visible="${this.displayPopover}"
@@ -689,6 +694,7 @@ class Select extends ListNavigationMixin(CaptureDestroyEventForChildElement(Auto
689
694
  focus-trap
690
695
  size
691
696
  @keydown="${this.handleKeydownPopover}"
697
+ ?disable-flip="${this.disableFlip}"
692
698
  boundary="${ifDefined(this.boundary)}"
693
699
  strategy="${ifDefined(this.strategy)}"
694
700
  placement="${this.placement}"
@@ -729,6 +735,10 @@ __decorate([
729
735
  property({ type: Number, reflect: true, attribute: 'popover-z-index' }),
730
736
  __metadata("design:type", Number)
731
737
  ], Select.prototype, "popoverZIndex", void 0);
738
+ __decorate([
739
+ property({ type: Boolean, reflect: true, attribute: 'disable-flip' }),
740
+ __metadata("design:type", Boolean)
741
+ ], Select.prototype, "disableFlip", void 0);
732
742
  __decorate([
733
743
  property({ type: String, reflect: true, attribute: 'backdrop-append-to' }),
734
744
  __metadata("design:type", String)
@@ -6,4 +6,7 @@ declare const ARROW_ICON: {
6
6
  };
7
7
  declare const TRIGGER_ID = "select-base-triggerid";
8
8
  declare const LISTBOX_ID = "select-listbox";
9
- export { ARROW_ICON, TAG_NAME, TRIGGER_ID, LISTBOX_ID };
9
+ declare const DEFAULTS: {
10
+ readonly DISABLE_FLIP: false;
11
+ };
12
+ export { ARROW_ICON, DEFAULTS, TAG_NAME, TRIGGER_ID, LISTBOX_ID };
@@ -6,4 +6,7 @@ const ARROW_ICON = {
6
6
  };
7
7
  const TRIGGER_ID = 'select-base-triggerid';
8
8
  const LISTBOX_ID = 'select-listbox';
9
- export { ARROW_ICON, TAG_NAME, TRIGGER_ID, LISTBOX_ID };
9
+ const DEFAULTS = {
10
+ DISABLE_FLIP: false,
11
+ };
12
+ export { ARROW_ICON, DEFAULTS, TAG_NAME, TRIGGER_ID, LISTBOX_ID };
@@ -28,8 +28,10 @@ const styles = css `
28
28
  z-index: -1;
29
29
  }
30
30
  :host::part(container) {
31
+ height: 2rem;
31
32
  width: 100%;
32
33
  position: relative;
34
+ display: flex;
33
35
  }
34
36
  :host ::slotted(mdc-selectlistbox) {
35
37
  display: flex;
@@ -46,6 +48,7 @@ const styles = css `
46
48
  gap: 0.375rem;
47
49
  align-items: center;
48
50
  user-select: none;
51
+ width: 100%;
49
52
  }
50
53
  :host::part(base-container):hover {
51
54
  --mdc-select-background-color: var(--mds-color-theme-background-primary-hover);
@@ -54,8 +57,9 @@ const styles = css `
54
57
  --mdc-select-background-color: var(--mds-color-theme-background-primary-active);
55
58
  }
56
59
  :host::part(base-text) {
57
- height: 1.3125rem;
58
- width: 100%;
60
+ height: 100%;
61
+ /* 2rem is the complete width of dropdown icon */
62
+ width: calc(100% - 2rem);
59
63
  color: var(--mdc-select-text-color);
60
64
  overflow: hidden;
61
65
  text-overflow: ellipsis;
@@ -68,9 +72,9 @@ const styles = css `
68
72
  flex-shrink: 0;
69
73
  }
70
74
  :host::part(icon-container) {
71
- margin-left: auto;
72
- display: flex;
73
- padding: 2px;
75
+ padding: 0.5rem;
76
+ position: absolute;
77
+ inset-inline-end: 0%;
74
78
  }
75
79
 
76
80
  /* Popover height, width & padding overrides */
@@ -58,7 +58,7 @@ class Tooltip extends Popover {
58
58
  this.role = ROLE.TOOLTIP;
59
59
  this.trigger = 'mouseenter focusin';
60
60
  this.preventScroll = false;
61
- this.flip = true;
61
+ this.disableFlip = false;
62
62
  this.preventScroll = false;
63
63
  this.closeButton = false;
64
64
  this.hideOnOutsideClick = false;